]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
Add support for ARMv8-M's Secure Extensions flag and intrinsics
[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 -fpermitted-flt-eval-methods=@var{standard} @gol
182 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
183 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
184 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
185 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness}
186 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
187 -fsigned-bitfields -fsigned-char @gol
188 -funsigned-bitfields -funsigned-char @gol
189 -trigraphs -traditional -traditional-cpp}
190
191 @item C++ Language Options
192 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
193 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
194 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
195 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
196 -ffriend-injection @gol
197 -fno-elide-constructors @gol
198 -fno-enforce-eh-specs @gol
199 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
200 -fno-implicit-templates @gol
201 -fno-implicit-inline-templates @gol
202 -fno-implement-inlines -fms-extensions @gol
203 -fnew-inheriting-ctors @gol
204 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
205 -fno-optional-diags -fpermissive @gol
206 -fno-pretty-templates @gol
207 -frepo -fno-rtti -fsized-deallocation @gol
208 -ftemplate-backtrace-limit=@var{n} @gol
209 -ftemplate-depth=@var{n} @gol
210 -fno-threadsafe-statics -fuse-cxa-atexit @gol
211 -fno-weak -nostdinc++ @gol
212 -fvisibility-inlines-hidden @gol
213 -fvisibility-ms-compat @gol
214 -fext-numeric-literals @gol
215 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
216 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
217 -Wnamespaces -Wnarrowing @gol
218 -Wnoexcept -Wnon-virtual-dtor -Wreorder -Wregister @gol
219 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
220 -Wno-non-template-friend -Wold-style-cast @gol
221 -Woverloaded-virtual -Wno-pmf-conversions @gol
222 -Wsign-promo -Wvirtual-inheritance}
223
224 @item Objective-C and Objective-C++ Language Options
225 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
226 Objective-C and Objective-C++ Dialects}.
227 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
228 -fgnu-runtime -fnext-runtime @gol
229 -fno-nil-receivers @gol
230 -fobjc-abi-version=@var{n} @gol
231 -fobjc-call-cxx-cdtors @gol
232 -fobjc-direct-dispatch @gol
233 -fobjc-exceptions @gol
234 -fobjc-gc @gol
235 -fobjc-nilcheck @gol
236 -fobjc-std=objc1 @gol
237 -fno-local-ivars @gol
238 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
239 -freplace-objc-classes @gol
240 -fzero-link @gol
241 -gen-decls @gol
242 -Wassign-intercept @gol
243 -Wno-protocol -Wselector @gol
244 -Wstrict-selector-match @gol
245 -Wundeclared-selector}
246
247 @item Diagnostic Message Formatting Options
248 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
249 @gccoptlist{-fmessage-length=@var{n} @gol
250 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
251 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
252 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
253 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch}
254
255 @item Warning Options
256 @xref{Warning Options,,Options to Request or Suppress Warnings}.
257 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
258 -pedantic-errors @gol
259 -w -Wextra -Wall -Waddress -Waggregate-return @gol
260 -Walloca -Walloca-larger-than=@var{n} @gol
261 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
262 -Wno-attributes -Wbool-compare -Wbool-operation @gol
263 -Wno-builtin-declaration-mismatch @gol
264 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
265 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
266 -Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
267 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
268 -Wdelete-incomplete @gol
269 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
270 -Wdisabled-optimization @gol
271 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
272 -Wno-div-by-zero -Wdouble-promotion -Wduplicated-cond @gol
273 -Wempty-body -Wenum-compare -Wno-endif-labels @gol
274 -Werror -Werror=* -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
275 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-length=@var{n} @gol
276 -Wformat-nonliteral @gol
277 -Wformat-security -Wformat-signedness -Wformat-y2k -Wframe-address @gol
278 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
279 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
280 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
281 -Wimplicit-function-declaration -Wimplicit-int @gol
282 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
283 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
284 -Winvalid-pch -Wlarger-than=@var{len} @gol
285 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
286 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
287 -Wmisleading-indentation -Wmissing-braces @gol
288 -Wmissing-field-initializers -Wmissing-include-dirs @gol
289 -Wno-multichar -Wnonnull -Wnonnull-compare @gol
290 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
291 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
292 -Woverride-init-side-effects -Woverlength-strings @gol
293 -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
294 -Wparentheses -Wno-pedantic-ms-format @gol
295 -Wplacement-new -Wplacement-new=@var{n} @gol
296 -Wpointer-arith -Wno-pointer-to-int-cast @gol
297 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
298 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
299 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
300 -Wshift-overflow -Wshift-overflow=@var{n} @gol
301 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
302 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
303 -Wno-scalar-storage-order @gol
304 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
305 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
306 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
307 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
308 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
309 -Wmissing-format-attribute -Wsubobject-linkage @gol
310 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
311 -Wswitch-unreachable -Wsync-nand @gol
312 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
313 -Wtype-limits -Wundef @gol
314 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
315 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
316 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
317 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
318 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
319 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
320 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
321 -Wvla -Wvla-larger-than=@var{n} -Wvolatile-register-var -Wwrite-strings @gol
322 -Wzero-as-null-pointer-constant -Whsa}
323
324 @item C and Objective-C-only Warning Options
325 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
326 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
327 -Wold-style-declaration -Wold-style-definition @gol
328 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
329 -Wdeclaration-after-statement -Wpointer-sign}
330
331 @item Debugging Options
332 @xref{Debugging Options,,Options for Debugging Your Program}.
333 @gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol
334 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
335 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
336 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
337 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
338 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
339 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
340 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
341 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
342 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
343 -fvar-tracking -fvar-tracking-assignments}
344
345 @item Optimization Options
346 @xref{Optimize Options,,Options that Control Optimization}.
347 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
348 -falign-jumps[=@var{n}] @gol
349 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
350 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
351 -fauto-inc-dec -fbranch-probabilities @gol
352 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
353 -fbtr-bb-exclusive -fcaller-saves @gol
354 -fcombine-stack-adjustments -fconserve-stack @gol
355 -fcompare-elim -fcprop-registers -fcrossjumping @gol
356 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
357 -fcx-limited-range @gol
358 -fdata-sections -fdce -fdelayed-branch @gol
359 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
360 -fdevirtualize-at-ltrans -fdse @gol
361 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
362 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
363 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
364 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
365 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
366 -fif-conversion2 -findirect-inlining @gol
367 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
368 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment -fipa-bit-cp @gol
369 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
370 -fira-algorithm=@var{algorithm} @gol
371 -fira-region=@var{region} -fira-hoist-pressure @gol
372 -fira-loop-pressure -fno-ira-share-save-slots @gol
373 -fno-ira-share-spill-slots @gol
374 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
375 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
376 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
377 -floop-block -floop-interchange -floop-strip-mine @gol
378 -floop-unroll-and-jam -floop-nest-optimize @gol
379 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
380 -flto-partition=@var{alg} -fmerge-all-constants @gol
381 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
382 -fmove-loop-invariants -fno-branch-count-reg @gol
383 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
384 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
385 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
386 -fno-sched-spec -fno-signed-zeros @gol
387 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
388 -fomit-frame-pointer -foptimize-sibling-calls @gol
389 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
390 -fprefetch-loop-arrays @gol
391 -fprofile-correction @gol
392 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
393 -fprofile-reorder-functions @gol
394 -freciprocal-math -free -frename-registers -freorder-blocks @gol
395 -freorder-blocks-algorithm=@var{algorithm} @gol
396 -freorder-blocks-and-partition -freorder-functions @gol
397 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
398 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
399 -fsched-spec-load -fsched-spec-load-dangerous @gol
400 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
401 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
402 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
403 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
404 -fschedule-fusion @gol
405 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
406 -fselective-scheduling -fselective-scheduling2 @gol
407 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
408 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
409 -fsignaling-nans @gol
410 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
411 -fsplit-paths @gol
412 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
413 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
414 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
415 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
416 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
417 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting -ftree-loop-if-convert @gol
418 -ftree-loop-im @gol
419 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
420 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
421 -ftree-loop-vectorize @gol
422 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
423 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
424 -ftree-switch-conversion -ftree-tail-merge @gol
425 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
426 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
427 -funsafe-math-optimizations -funswitch-loops @gol
428 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
429 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
430 --param @var{name}=@var{value}
431 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
432
433 @item Program Instrumentation Options
434 @xref{Instrumentation Options,,Program Instrumentation Options}.
435 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
436 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
437 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
438 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
439 -fsanitize-undefined-trap-on-error -fbounds-check @gol
440 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
441 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
442 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
443 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
444 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
445 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
446 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
447 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
448 -fchkp-use-wrappers @gol
449 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
450 -fstack-protector-explicit -fstack-check @gol
451 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
452 -fno-stack-limit -fsplit-stack @gol
453 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
454 -fvtv-counts -fvtv-debug @gol
455 -finstrument-functions @gol
456 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
457 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
458
459 @item Preprocessor Options
460 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
461 @gccoptlist{-A@var{question}=@var{answer} @gol
462 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
463 -C -dD -dI -dM -dN @gol
464 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
465 -idirafter @var{dir} @gol
466 -include @var{file} -imacros @var{file} @gol
467 -iprefix @var{file} -iwithprefix @var{dir} @gol
468 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
469 -imultilib @var{dir} -isysroot @var{dir} @gol
470 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
471 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
472 -remap -trigraphs -undef -U@var{macro} @gol
473 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
474
475 @item Assembler Option
476 @xref{Assembler Options,,Passing Options to the Assembler}.
477 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
478
479 @item Linker Options
480 @xref{Link Options,,Options for Linking}.
481 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
482 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
483 -s -static -static-libgcc -static-libstdc++ @gol
484 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
485 -static-libmpx -static-libmpxwrappers @gol
486 -shared -shared-libgcc -symbolic @gol
487 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
488 -u @var{symbol} -z @var{keyword}}
489
490 @item Directory Options
491 @xref{Directory Options,,Options for Directory Search}.
492 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
493 -iquote@var{dir} -L@var{dir} -no-canonical-prefixes -I- @gol
494 --sysroot=@var{dir} --no-sysroot-suffix}
495
496 @item Code Generation Options
497 @xref{Code Gen Options,,Options for Code Generation Conventions}.
498 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
499 -ffixed-@var{reg} -fexceptions @gol
500 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
501 -fasynchronous-unwind-tables @gol
502 -fno-gnu-unique @gol
503 -finhibit-size-directive -fno-common -fno-ident @gol
504 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
505 -fno-jump-tables @gol
506 -frecord-gcc-switches @gol
507 -freg-struct-return -fshort-enums -fshort-wchar @gol
508 -fverbose-asm -fpack-struct[=@var{n}] @gol
509 -fleading-underscore -ftls-model=@var{model} @gol
510 -fstack-reuse=@var{reuse_level} @gol
511 -ftrampolines -ftrapv -fwrapv @gol
512 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
513 -fstrict-volatile-bitfields -fsync-libcalls}
514
515 @item Developer Options
516 @xref{Developer Options,,GCC Developer Options}.
517 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
518 -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
519 -fdbg-cnt=@var{counter-value-list} @gol
520 -fdisable-ipa-@var{pass_name} @gol
521 -fdisable-rtl-@var{pass_name} @gol
522 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
523 -fdisable-tree-@var{pass_name} @gol
524 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
525 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
526 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
527 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
528 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
529 -fdump-passes @gol
530 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
531 -fdump-statistics @gol
532 -fdump-tree-all @gol
533 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
534 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
535 -fdump-tree-cfg -fdump-tree-alias @gol
536 -fdump-tree-ch @gol
537 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
538 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
539 -fdump-tree-gimple@r{[}-raw@r{]} @gol
540 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
541 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
542 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
543 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
544 -fdump-tree-backprop@r{[}-@var{n}@r{]} @gol
545 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
546 -fdump-tree-nrv -fdump-tree-vect @gol
547 -fdump-tree-sink @gol
548 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
549 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
550 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
551 -fdump-tree-vtable-verify @gol
552 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
553 -fdump-tree-split-paths@r{[}-@var{n}@r{]} @gol
554 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
555 -fdump-final-insns=@var{file} @gol
556 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
557 -fenable-@var{kind}-@var{pass} @gol
558 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
559 -fira-verbose=@var{n} @gol
560 -flto-report -flto-report-wpa -fmem-report-wpa @gol
561 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
562 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
563 -fprofile-report @gol
564 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
565 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
566 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
567 -fvar-tracking-assignments-toggle -gtoggle @gol
568 -print-file-name=@var{library} -print-libgcc-file-name @gol
569 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
570 -print-prog-name=@var{program} -print-search-dirs -Q @gol
571 -print-sysroot -print-sysroot-headers-suffix @gol
572 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
573
574 @item Machine-Dependent Options
575 @xref{Submodel Options,,Machine-Dependent Options}.
576 @c This list is ordered alphanumerically by subsection name.
577 @c Try and put the significant identifier (CPU or system) first,
578 @c so users have a clue at guessing where the ones they want will be.
579
580 @emph{AArch64 Options}
581 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
582 -mgeneral-regs-only @gol
583 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
584 -mstrict-align @gol
585 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
586 -mtls-dialect=desc -mtls-dialect=traditional @gol
587 -mtls-size=@var{size} @gol
588 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
589 -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol
590 -mlow-precision-recip-sqrt -mno-low-precision-recip-sqrt@gol
591 -mlow-precision-sqrt -mno-low-precision-sqrt@gol
592 -mlow-precision-div -mno-low-precision-div @gol
593 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
594
595 @emph{Adapteva Epiphany Options}
596 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
597 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
598 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
599 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
600 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
601 -msplit-vecmove-early -m1reg-@var{reg}}
602
603 @emph{ARC Options}
604 @gccoptlist{-mbarrel-shifter @gol
605 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
606 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
607 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
608 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
609 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
610 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
611 -mlong-calls -mmedium-calls -msdata @gol
612 -mucb-mcount -mvolatile-cache -mtp-regno=@var{regno} @gol
613 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
614 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
615 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
616 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
617 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
618 -mtune=@var{cpu} -mmultcost=@var{num} @gol
619 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
620 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
621
622 @emph{ARM Options}
623 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
624 -mabi=@var{name} @gol
625 -mapcs-stack-check -mno-apcs-stack-check @gol
626 -mapcs-reentrant -mno-apcs-reentrant @gol
627 -msched-prolog -mno-sched-prolog @gol
628 -mlittle-endian -mbig-endian @gol
629 -mfloat-abi=@var{name} @gol
630 -mfp16-format=@var{name}
631 -mthumb-interwork -mno-thumb-interwork @gol
632 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
633 -mtune=@var{name} -mprint-tune-info @gol
634 -mstructure-size-boundary=@var{n} @gol
635 -mabort-on-noreturn @gol
636 -mlong-calls -mno-long-calls @gol
637 -msingle-pic-base -mno-single-pic-base @gol
638 -mpic-register=@var{reg} @gol
639 -mnop-fun-dllimport @gol
640 -mpoke-function-name @gol
641 -mthumb -marm @gol
642 -mtpcs-frame -mtpcs-leaf-frame @gol
643 -mcaller-super-interworking -mcallee-super-interworking @gol
644 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
645 -mword-relocations @gol
646 -mfix-cortex-m3-ldrd @gol
647 -munaligned-access @gol
648 -mneon-for-64bits @gol
649 -mslow-flash-data @gol
650 -masm-syntax-unified @gol
651 -mrestrict-it @gol
652 -mpure-code @gol
653 -mcmse}
654
655 @emph{AVR Options}
656 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
657 -mbranch-cost=@var{cost} @gol
658 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
659 -mrelax -mrmw -mstrict-X -mtiny-stack -mfract-convert-truncate -nodevicelib @gol
660 -Waddr-space-convert -Wmisspelled-isr}
661
662 @emph{Blackfin Options}
663 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
664 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
665 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
666 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
667 -mno-id-shared-library -mshared-library-id=@var{n} @gol
668 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
669 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
670 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
671 -micplb}
672
673 @emph{C6X Options}
674 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
675 -msim -msdata=@var{sdata-type}}
676
677 @emph{CRIS Options}
678 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
679 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
680 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
681 -mstack-align -mdata-align -mconst-align @gol
682 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
683 -melf -maout -melinux -mlinux -sim -sim2 @gol
684 -mmul-bug-workaround -mno-mul-bug-workaround}
685
686 @emph{CR16 Options}
687 @gccoptlist{-mmac @gol
688 -mcr16cplus -mcr16c @gol
689 -msim -mint32 -mbit-ops
690 -mdata-model=@var{model}}
691
692 @emph{Darwin Options}
693 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
694 -arch_only -bind_at_load -bundle -bundle_loader @gol
695 -client_name -compatibility_version -current_version @gol
696 -dead_strip @gol
697 -dependency-file -dylib_file -dylinker_install_name @gol
698 -dynamic -dynamiclib -exported_symbols_list @gol
699 -filelist -flat_namespace -force_cpusubtype_ALL @gol
700 -force_flat_namespace -headerpad_max_install_names @gol
701 -iframework @gol
702 -image_base -init -install_name -keep_private_externs @gol
703 -multi_module -multiply_defined -multiply_defined_unused @gol
704 -noall_load -no_dead_strip_inits_and_terms @gol
705 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
706 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
707 -private_bundle -read_only_relocs -sectalign @gol
708 -sectobjectsymbols -whyload -seg1addr @gol
709 -sectcreate -sectobjectsymbols -sectorder @gol
710 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
711 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
712 -segprot -segs_read_only_addr -segs_read_write_addr @gol
713 -single_module -static -sub_library -sub_umbrella @gol
714 -twolevel_namespace -umbrella -undefined @gol
715 -unexported_symbols_list -weak_reference_mismatches @gol
716 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
717 -mkernel -mone-byte-bool}
718
719 @emph{DEC Alpha Options}
720 @gccoptlist{-mno-fp-regs -msoft-float @gol
721 -mieee -mieee-with-inexact -mieee-conformant @gol
722 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
723 -mtrap-precision=@var{mode} -mbuild-constants @gol
724 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
725 -mbwx -mmax -mfix -mcix @gol
726 -mfloat-vax -mfloat-ieee @gol
727 -mexplicit-relocs -msmall-data -mlarge-data @gol
728 -msmall-text -mlarge-text @gol
729 -mmemory-latency=@var{time}}
730
731 @emph{FR30 Options}
732 @gccoptlist{-msmall-model -mno-lsim}
733
734 @emph{FT32 Options}
735 @gccoptlist{-msim -mlra -mnodiv}
736
737 @emph{FRV Options}
738 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
739 -mhard-float -msoft-float @gol
740 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
741 -mdouble -mno-double @gol
742 -mmedia -mno-media -mmuladd -mno-muladd @gol
743 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
744 -mlinked-fp -mlong-calls -malign-labels @gol
745 -mlibrary-pic -macc-4 -macc-8 @gol
746 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
747 -moptimize-membar -mno-optimize-membar @gol
748 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
749 -mvliw-branch -mno-vliw-branch @gol
750 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
751 -mno-nested-cond-exec -mtomcat-stats @gol
752 -mTLS -mtls @gol
753 -mcpu=@var{cpu}}
754
755 @emph{GNU/Linux Options}
756 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
757 -tno-android-cc -tno-android-ld}
758
759 @emph{H8/300 Options}
760 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
761
762 @emph{HPPA Options}
763 @gccoptlist{-march=@var{architecture-type} @gol
764 -mdisable-fpregs -mdisable-indexing @gol
765 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
766 -mfixed-range=@var{register-range} @gol
767 -mjump-in-delay -mlinker-opt -mlong-calls @gol
768 -mlong-load-store -mno-disable-fpregs @gol
769 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
770 -mno-jump-in-delay -mno-long-load-store @gol
771 -mno-portable-runtime -mno-soft-float @gol
772 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
773 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
774 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
775 -munix=@var{unix-std} -nolibdld -static -threads}
776
777 @emph{IA-64 Options}
778 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
779 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
780 -mconstant-gp -mauto-pic -mfused-madd @gol
781 -minline-float-divide-min-latency @gol
782 -minline-float-divide-max-throughput @gol
783 -mno-inline-float-divide @gol
784 -minline-int-divide-min-latency @gol
785 -minline-int-divide-max-throughput @gol
786 -mno-inline-int-divide @gol
787 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
788 -mno-inline-sqrt @gol
789 -mdwarf2-asm -mearly-stop-bits @gol
790 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
791 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
792 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
793 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
794 -msched-spec-ldc -msched-spec-control-ldc @gol
795 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
796 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
797 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
798 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
799
800 @emph{LM32 Options}
801 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
802 -msign-extend-enabled -muser-enabled}
803
804 @emph{M32R/D Options}
805 @gccoptlist{-m32r2 -m32rx -m32r @gol
806 -mdebug @gol
807 -malign-loops -mno-align-loops @gol
808 -missue-rate=@var{number} @gol
809 -mbranch-cost=@var{number} @gol
810 -mmodel=@var{code-size-model-type} @gol
811 -msdata=@var{sdata-type} @gol
812 -mno-flush-func -mflush-func=@var{name} @gol
813 -mno-flush-trap -mflush-trap=@var{number} @gol
814 -G @var{num}}
815
816 @emph{M32C Options}
817 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
818
819 @emph{M680x0 Options}
820 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
821 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
822 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
823 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
824 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
825 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
826 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
827 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
828 -mxgot -mno-xgot}
829
830 @emph{MCore Options}
831 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
832 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
833 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
834 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
835 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
836
837 @emph{MeP Options}
838 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
839 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
840 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
841 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
842 -mtiny=@var{n}}
843
844 @emph{MicroBlaze Options}
845 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
846 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
847 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
848 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
849 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
850
851 @emph{MIPS Options}
852 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
853 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
854 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
855 -mips16 -mno-mips16 -mflip-mips16 @gol
856 -minterlink-compressed -mno-interlink-compressed @gol
857 -minterlink-mips16 -mno-interlink-mips16 @gol
858 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
859 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
860 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
861 -mno-float -msingle-float -mdouble-float @gol
862 -modd-spreg -mno-odd-spreg @gol
863 -mabs=@var{mode} -mnan=@var{encoding} @gol
864 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
865 -mmcu -mmno-mcu @gol
866 -meva -mno-eva @gol
867 -mvirt -mno-virt @gol
868 -mxpa -mno-xpa @gol
869 -mmicromips -mno-micromips @gol
870 -mmsa -mno-msa @gol
871 -mfpu=@var{fpu-type} @gol
872 -msmartmips -mno-smartmips @gol
873 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
874 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
875 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
876 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
877 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
878 -membedded-data -mno-embedded-data @gol
879 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
880 -mcode-readable=@var{setting} @gol
881 -msplit-addresses -mno-split-addresses @gol
882 -mexplicit-relocs -mno-explicit-relocs @gol
883 -mcheck-zero-division -mno-check-zero-division @gol
884 -mdivide-traps -mdivide-breaks @gol
885 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
886 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
887 -mfix-24k -mno-fix-24k @gol
888 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
889 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
890 -mfix-vr4120 -mno-fix-vr4120 @gol
891 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
892 -mflush-func=@var{func} -mno-flush-func @gol
893 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
894 -mcompact-branches=@var{policy} @gol
895 -mfp-exceptions -mno-fp-exceptions @gol
896 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
897 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
898 -mframe-header-opt -mno-frame-header-opt}
899
900 @emph{MMIX Options}
901 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
902 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
903 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
904 -mno-base-addresses -msingle-exit -mno-single-exit}
905
906 @emph{MN10300 Options}
907 @gccoptlist{-mmult-bug -mno-mult-bug @gol
908 -mno-am33 -mam33 -mam33-2 -mam34 @gol
909 -mtune=@var{cpu-type} @gol
910 -mreturn-pointer-on-d0 @gol
911 -mno-crt0 -mrelax -mliw -msetlb}
912
913 @emph{Moxie Options}
914 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
915
916 @emph{MSP430 Options}
917 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
918 -mwarn-mcu @gol
919 -mcode-region= -mdata-region= @gol
920 -msilicon-errata= -msilicon-errata-warn= @gol
921 -mhwmult= -minrt}
922
923 @emph{NDS32 Options}
924 @gccoptlist{-mbig-endian -mlittle-endian @gol
925 -mreduced-regs -mfull-regs @gol
926 -mcmov -mno-cmov @gol
927 -mperf-ext -mno-perf-ext @gol
928 -mv3push -mno-v3push @gol
929 -m16bit -mno-16bit @gol
930 -misr-vector-size=@var{num} @gol
931 -mcache-block-size=@var{num} @gol
932 -march=@var{arch} @gol
933 -mcmodel=@var{code-model} @gol
934 -mctor-dtor -mrelax}
935
936 @emph{Nios II Options}
937 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
938 -mel -meb @gol
939 -mno-bypass-cache -mbypass-cache @gol
940 -mno-cache-volatile -mcache-volatile @gol
941 -mno-fast-sw-div -mfast-sw-div @gol
942 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
943 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
944 -mcustom-fpu-cfg=@var{name} @gol
945 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
946 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
947
948 @emph{Nvidia PTX Options}
949 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
950
951 @emph{PDP-11 Options}
952 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
953 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
954 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
955 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
956 -mbranch-expensive -mbranch-cheap @gol
957 -munix-asm -mdec-asm}
958
959 @emph{picoChip Options}
960 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
961 -msymbol-as-address -mno-inefficient-warnings}
962
963 @emph{PowerPC Options}
964 See RS/6000 and PowerPC Options.
965
966 @emph{RL78 Options}
967 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
968 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
969 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
970
971 @emph{RS/6000 and PowerPC Options}
972 @gccoptlist{-mcpu=@var{cpu-type} @gol
973 -mtune=@var{cpu-type} @gol
974 -mcmodel=@var{code-model} @gol
975 -mpowerpc64 @gol
976 -maltivec -mno-altivec @gol
977 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
978 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
979 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
980 -mfprnd -mno-fprnd @gol
981 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
982 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
983 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
984 -malign-power -malign-natural @gol
985 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
986 -msingle-float -mdouble-float -msimple-fpu @gol
987 -mstring -mno-string -mupdate -mno-update @gol
988 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
989 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
990 -mstrict-align -mno-strict-align -mrelocatable @gol
991 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
992 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
993 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
994 -mprioritize-restricted-insns=@var{priority} @gol
995 -msched-costly-dep=@var{dependence_type} @gol
996 -minsert-sched-nops=@var{scheme} @gol
997 -mcall-sysv -mcall-netbsd @gol
998 -maix-struct-return -msvr4-struct-return @gol
999 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1000 -mblock-move-inline-limit=@var{num} @gol
1001 -misel -mno-isel @gol
1002 -misel=yes -misel=no @gol
1003 -mspe -mno-spe @gol
1004 -mspe=yes -mspe=no @gol
1005 -mpaired @gol
1006 -mgen-cell-microcode -mwarn-cell-microcode @gol
1007 -mvrsave -mno-vrsave @gol
1008 -mmulhw -mno-mulhw @gol
1009 -mdlmzb -mno-dlmzb @gol
1010 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1011 -mprototype -mno-prototype @gol
1012 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1013 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
1014 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1015 -mno-recip-precision @gol
1016 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1017 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1018 -msave-toc-indirect -mno-save-toc-indirect @gol
1019 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1020 -mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol
1021 -mquad-memory -mno-quad-memory @gol
1022 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1023 -mcompat-align-parm -mno-compat-align-parm @gol
1024 -mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
1025 -mupper-regs-di -mno-upper-regs-di @gol
1026 -mupper-regs -mno-upper-regs @gol
1027 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1028 -mgnu-attribute -mno-gnu-attribute @gol
1029 -mlra -mno-lra}
1030
1031 @emph{RX Options}
1032 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1033 -mcpu=@gol
1034 -mbig-endian-data -mlittle-endian-data @gol
1035 -msmall-data @gol
1036 -msim -mno-sim@gol
1037 -mas100-syntax -mno-as100-syntax@gol
1038 -mrelax@gol
1039 -mmax-constant-size=@gol
1040 -mint-register=@gol
1041 -mpid@gol
1042 -mallow-string-insns -mno-allow-string-insns@gol
1043 -mjsr@gol
1044 -mno-warn-multiple-fast-interrupts@gol
1045 -msave-acc-in-interrupts}
1046
1047 @emph{S/390 and zSeries Options}
1048 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1049 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1050 -mlong-double-64 -mlong-double-128 @gol
1051 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1052 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1053 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1054 -mhtm -mvx -mzvector @gol
1055 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1056 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1057 -mhotpatch=@var{halfwords},@var{halfwords}}
1058
1059 @emph{Score Options}
1060 @gccoptlist{-meb -mel @gol
1061 -mnhwloop @gol
1062 -muls @gol
1063 -mmac @gol
1064 -mscore5 -mscore5u -mscore7 -mscore7d}
1065
1066 @emph{SH Options}
1067 @gccoptlist{-m1 -m2 -m2e @gol
1068 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1069 -m3 -m3e @gol
1070 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1071 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1072 -mb -ml -mdalign -mrelax @gol
1073 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1074 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1075 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1076 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1077 -maccumulate-outgoing-args @gol
1078 -matomic-model=@var{atomic-model} @gol
1079 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1080 -mcbranch-force-delay-slot @gol
1081 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1082 -mpretend-cmove -mtas}
1083
1084 @emph{Solaris 2 Options}
1085 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1086 -pthreads -pthread}
1087
1088 @emph{SPARC Options}
1089 @gccoptlist{-mcpu=@var{cpu-type} @gol
1090 -mtune=@var{cpu-type} @gol
1091 -mcmodel=@var{code-model} @gol
1092 -mmemory-model=@var{mem-model} @gol
1093 -m32 -m64 -mapp-regs -mno-app-regs @gol
1094 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1095 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1096 -mhard-quad-float -msoft-quad-float @gol
1097 -mstack-bias -mno-stack-bias @gol
1098 -mstd-struct-return -mno-std-struct-return @gol
1099 -munaligned-doubles -mno-unaligned-doubles @gol
1100 -muser-mode -mno-user-mode @gol
1101 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1102 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1103 -mcbcond -mno-cbcond -mfmaf -mno-fmaf @gol
1104 -mpopc -mno-popc -msubxc -mno-subxc@gol
1105 -mfix-at697f -mfix-ut699}
1106
1107 @emph{SPU Options}
1108 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1109 -msafe-dma -munsafe-dma @gol
1110 -mbranch-hints @gol
1111 -msmall-mem -mlarge-mem -mstdmain @gol
1112 -mfixed-range=@var{register-range} @gol
1113 -mea32 -mea64 @gol
1114 -maddress-space-conversion -mno-address-space-conversion @gol
1115 -mcache-size=@var{cache-size} @gol
1116 -matomic-updates -mno-atomic-updates}
1117
1118 @emph{System V Options}
1119 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1120
1121 @emph{TILE-Gx Options}
1122 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1123 -mcmodel=@var{code-model}}
1124
1125 @emph{TILEPro Options}
1126 @gccoptlist{-mcpu=@var{cpu} -m32}
1127
1128 @emph{V850 Options}
1129 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1130 -mprolog-function -mno-prolog-function -mspace @gol
1131 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1132 -mapp-regs -mno-app-regs @gol
1133 -mdisable-callt -mno-disable-callt @gol
1134 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1135 -mv850e -mv850 -mv850e3v5 @gol
1136 -mloop @gol
1137 -mrelax @gol
1138 -mlong-jumps @gol
1139 -msoft-float @gol
1140 -mhard-float @gol
1141 -mgcc-abi @gol
1142 -mrh850-abi @gol
1143 -mbig-switch}
1144
1145 @emph{VAX Options}
1146 @gccoptlist{-mg -mgnu -munix}
1147
1148 @emph{Visium Options}
1149 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1150 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1151
1152 @emph{VMS Options}
1153 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1154 -mpointer-size=@var{size}}
1155
1156 @emph{VxWorks Options}
1157 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1158 -Xbind-lazy -Xbind-now}
1159
1160 @emph{x86 Options}
1161 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1162 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1163 -mfpmath=@var{unit} @gol
1164 -masm=@var{dialect} -mno-fancy-math-387 @gol
1165 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1166 -mno-wide-multiply -mrtd -malign-double @gol
1167 -mpreferred-stack-boundary=@var{num} @gol
1168 -mincoming-stack-boundary=@var{num} @gol
1169 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1170 -mrecip -mrecip=@var{opt} @gol
1171 -mvzeroupper -mprefer-avx128 @gol
1172 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1173 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1174 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1175 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1176 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1177 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
1178 -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mmwaitx -mclzero
1179 -mpku -mthreads @gol
1180 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1181 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1182 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1183 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1184 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1185 -mregparm=@var{num} -msseregparm @gol
1186 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1187 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1188 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1189 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1190 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1191 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1192 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1193 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1194 -mmitigate-rop -mgeneral-regs-only}
1195
1196 @emph{x86 Windows Options}
1197 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1198 -mnop-fun-dllimport -mthread @gol
1199 -municode -mwin32 -mwindows -fno-set-stack-executable}
1200
1201 @emph{Xstormy16 Options}
1202 @gccoptlist{-msim}
1203
1204 @emph{Xtensa Options}
1205 @gccoptlist{-mconst16 -mno-const16 @gol
1206 -mfused-madd -mno-fused-madd @gol
1207 -mforce-no-pic @gol
1208 -mserialize-volatile -mno-serialize-volatile @gol
1209 -mtext-section-literals -mno-text-section-literals @gol
1210 -mauto-litpools -mno-auto-litpools @gol
1211 -mtarget-align -mno-target-align @gol
1212 -mlongcalls -mno-longcalls}
1213
1214 @emph{zSeries Options}
1215 See S/390 and zSeries Options.
1216 @end table
1217
1218
1219 @node Overall Options
1220 @section Options Controlling the Kind of Output
1221
1222 Compilation can involve up to four stages: preprocessing, compilation
1223 proper, assembly and linking, always in that order. GCC is capable of
1224 preprocessing and compiling several files either into several
1225 assembler input files, or into one assembler input file; then each
1226 assembler input file produces an object file, and linking combines all
1227 the object files (those newly compiled, and those specified as input)
1228 into an executable file.
1229
1230 @cindex file name suffix
1231 For any given input file, the file name suffix determines what kind of
1232 compilation is done:
1233
1234 @table @gcctabopt
1235 @item @var{file}.c
1236 C source code that must be preprocessed.
1237
1238 @item @var{file}.i
1239 C source code that should not be preprocessed.
1240
1241 @item @var{file}.ii
1242 C++ source code that should not be preprocessed.
1243
1244 @item @var{file}.m
1245 Objective-C source code. Note that you must link with the @file{libobjc}
1246 library to make an Objective-C program work.
1247
1248 @item @var{file}.mi
1249 Objective-C source code that should not be preprocessed.
1250
1251 @item @var{file}.mm
1252 @itemx @var{file}.M
1253 Objective-C++ source code. Note that you must link with the @file{libobjc}
1254 library to make an Objective-C++ program work. Note that @samp{.M} refers
1255 to a literal capital M@.
1256
1257 @item @var{file}.mii
1258 Objective-C++ source code that should not be preprocessed.
1259
1260 @item @var{file}.h
1261 C, C++, Objective-C or Objective-C++ header file to be turned into a
1262 precompiled header (default), or C, C++ header file to be turned into an
1263 Ada spec (via the @option{-fdump-ada-spec} switch).
1264
1265 @item @var{file}.cc
1266 @itemx @var{file}.cp
1267 @itemx @var{file}.cxx
1268 @itemx @var{file}.cpp
1269 @itemx @var{file}.CPP
1270 @itemx @var{file}.c++
1271 @itemx @var{file}.C
1272 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1273 the last two letters must both be literally @samp{x}. Likewise,
1274 @samp{.C} refers to a literal capital C@.
1275
1276 @item @var{file}.mm
1277 @itemx @var{file}.M
1278 Objective-C++ source code that must be preprocessed.
1279
1280 @item @var{file}.mii
1281 Objective-C++ source code that should not be preprocessed.
1282
1283 @item @var{file}.hh
1284 @itemx @var{file}.H
1285 @itemx @var{file}.hp
1286 @itemx @var{file}.hxx
1287 @itemx @var{file}.hpp
1288 @itemx @var{file}.HPP
1289 @itemx @var{file}.h++
1290 @itemx @var{file}.tcc
1291 C++ header file to be turned into a precompiled header or Ada spec.
1292
1293 @item @var{file}.f
1294 @itemx @var{file}.for
1295 @itemx @var{file}.ftn
1296 Fixed form Fortran source code that should not be preprocessed.
1297
1298 @item @var{file}.F
1299 @itemx @var{file}.FOR
1300 @itemx @var{file}.fpp
1301 @itemx @var{file}.FPP
1302 @itemx @var{file}.FTN
1303 Fixed form Fortran source code that must be preprocessed (with the traditional
1304 preprocessor).
1305
1306 @item @var{file}.f90
1307 @itemx @var{file}.f95
1308 @itemx @var{file}.f03
1309 @itemx @var{file}.f08
1310 Free form Fortran source code that should not be preprocessed.
1311
1312 @item @var{file}.F90
1313 @itemx @var{file}.F95
1314 @itemx @var{file}.F03
1315 @itemx @var{file}.F08
1316 Free form Fortran source code that must be preprocessed (with the
1317 traditional preprocessor).
1318
1319 @item @var{file}.go
1320 Go source code.
1321
1322 @item @var{file}.ads
1323 Ada source code file that contains a library unit declaration (a
1324 declaration of a package, subprogram, or generic, or a generic
1325 instantiation), or a library unit renaming declaration (a package,
1326 generic, or subprogram renaming declaration). Such files are also
1327 called @dfn{specs}.
1328
1329 @item @var{file}.adb
1330 Ada source code file containing a library unit body (a subprogram or
1331 package body). Such files are also called @dfn{bodies}.
1332
1333 @c GCC also knows about some suffixes for languages not yet included:
1334 @c Pascal:
1335 @c @var{file}.p
1336 @c @var{file}.pas
1337 @c Ratfor:
1338 @c @var{file}.r
1339
1340 @item @var{file}.s
1341 Assembler code.
1342
1343 @item @var{file}.S
1344 @itemx @var{file}.sx
1345 Assembler code that must be preprocessed.
1346
1347 @item @var{other}
1348 An object file to be fed straight into linking.
1349 Any file name with no recognized suffix is treated this way.
1350 @end table
1351
1352 @opindex x
1353 You can specify the input language explicitly with the @option{-x} option:
1354
1355 @table @gcctabopt
1356 @item -x @var{language}
1357 Specify explicitly the @var{language} for the following input files
1358 (rather than letting the compiler choose a default based on the file
1359 name suffix). This option applies to all following input files until
1360 the next @option{-x} option. Possible values for @var{language} are:
1361 @smallexample
1362 c c-header cpp-output
1363 c++ c++-header c++-cpp-output
1364 objective-c objective-c-header objective-c-cpp-output
1365 objective-c++ objective-c++-header objective-c++-cpp-output
1366 assembler assembler-with-cpp
1367 ada
1368 f77 f77-cpp-input f95 f95-cpp-input
1369 go
1370 @end smallexample
1371
1372 @item -x none
1373 Turn off any specification of a language, so that subsequent files are
1374 handled according to their file name suffixes (as they are if @option{-x}
1375 has not been used at all).
1376 @end table
1377
1378 If you only want some of the stages of compilation, you can use
1379 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1380 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1381 @command{gcc} is to stop. Note that some combinations (for example,
1382 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1383
1384 @table @gcctabopt
1385 @item -c
1386 @opindex c
1387 Compile or assemble the source files, but do not link. The linking
1388 stage simply is not done. The ultimate output is in the form of an
1389 object file for each source file.
1390
1391 By default, the object file name for a source file is made by replacing
1392 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1393
1394 Unrecognized input files, not requiring compilation or assembly, are
1395 ignored.
1396
1397 @item -S
1398 @opindex S
1399 Stop after the stage of compilation proper; do not assemble. The output
1400 is in the form of an assembler code file for each non-assembler input
1401 file specified.
1402
1403 By default, the assembler file name for a source file is made by
1404 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1405
1406 Input files that don't require compilation are ignored.
1407
1408 @item -E
1409 @opindex E
1410 Stop after the preprocessing stage; do not run the compiler proper. The
1411 output is in the form of preprocessed source code, which is sent to the
1412 standard output.
1413
1414 Input files that don't require preprocessing are ignored.
1415
1416 @cindex output file option
1417 @item -o @var{file}
1418 @opindex o
1419 Place output in file @var{file}. This applies to whatever
1420 sort of output is being produced, whether it be an executable file,
1421 an object file, an assembler file or preprocessed C code.
1422
1423 If @option{-o} is not specified, the default is to put an executable
1424 file in @file{a.out}, the object file for
1425 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1426 assembler file in @file{@var{source}.s}, a precompiled header file in
1427 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1428 standard output.
1429
1430 @item -v
1431 @opindex v
1432 Print (on standard error output) the commands executed to run the stages
1433 of compilation. Also print the version number of the compiler driver
1434 program and of the preprocessor and the compiler proper.
1435
1436 @item -###
1437 @opindex ###
1438 Like @option{-v} except the commands are not executed and arguments
1439 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1440 This is useful for shell scripts to capture the driver-generated command lines.
1441
1442 @item --help
1443 @opindex help
1444 Print (on the standard output) a description of the command-line options
1445 understood by @command{gcc}. If the @option{-v} option is also specified
1446 then @option{--help} is also passed on to the various processes
1447 invoked by @command{gcc}, so that they can display the command-line options
1448 they accept. If the @option{-Wextra} option has also been specified
1449 (prior to the @option{--help} option), then command-line options that
1450 have no documentation associated with them are also displayed.
1451
1452 @item --target-help
1453 @opindex target-help
1454 Print (on the standard output) a description of target-specific command-line
1455 options for each tool. For some targets extra target-specific
1456 information may also be printed.
1457
1458 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1459 Print (on the standard output) a description of the command-line
1460 options understood by the compiler that fit into all specified classes
1461 and qualifiers. These are the supported classes:
1462
1463 @table @asis
1464 @item @samp{optimizers}
1465 Display all of the optimization options supported by the
1466 compiler.
1467
1468 @item @samp{warnings}
1469 Display all of the options controlling warning messages
1470 produced by the compiler.
1471
1472 @item @samp{target}
1473 Display target-specific options. Unlike the
1474 @option{--target-help} option however, target-specific options of the
1475 linker and assembler are not displayed. This is because those
1476 tools do not currently support the extended @option{--help=} syntax.
1477
1478 @item @samp{params}
1479 Display the values recognized by the @option{--param}
1480 option.
1481
1482 @item @var{language}
1483 Display the options supported for @var{language}, where
1484 @var{language} is the name of one of the languages supported in this
1485 version of GCC@.
1486
1487 @item @samp{common}
1488 Display the options that are common to all languages.
1489 @end table
1490
1491 These are the supported qualifiers:
1492
1493 @table @asis
1494 @item @samp{undocumented}
1495 Display only those options that are undocumented.
1496
1497 @item @samp{joined}
1498 Display options taking an argument that appears after an equal
1499 sign in the same continuous piece of text, such as:
1500 @samp{--help=target}.
1501
1502 @item @samp{separate}
1503 Display options taking an argument that appears as a separate word
1504 following the original option, such as: @samp{-o output-file}.
1505 @end table
1506
1507 Thus for example to display all the undocumented target-specific
1508 switches supported by the compiler, use:
1509
1510 @smallexample
1511 --help=target,undocumented
1512 @end smallexample
1513
1514 The sense of a qualifier can be inverted by prefixing it with the
1515 @samp{^} character, so for example to display all binary warning
1516 options (i.e., ones that are either on or off and that do not take an
1517 argument) that have a description, use:
1518
1519 @smallexample
1520 --help=warnings,^joined,^undocumented
1521 @end smallexample
1522
1523 The argument to @option{--help=} should not consist solely of inverted
1524 qualifiers.
1525
1526 Combining several classes is possible, although this usually
1527 restricts the output so much that there is nothing to display. One
1528 case where it does work, however, is when one of the classes is
1529 @var{target}. For example, to display all the target-specific
1530 optimization options, use:
1531
1532 @smallexample
1533 --help=target,optimizers
1534 @end smallexample
1535
1536 The @option{--help=} option can be repeated on the command line. Each
1537 successive use displays its requested class of options, skipping
1538 those that have already been displayed.
1539
1540 If the @option{-Q} option appears on the command line before the
1541 @option{--help=} option, then the descriptive text displayed by
1542 @option{--help=} is changed. Instead of describing the displayed
1543 options, an indication is given as to whether the option is enabled,
1544 disabled or set to a specific value (assuming that the compiler
1545 knows this at the point where the @option{--help=} option is used).
1546
1547 Here is a truncated example from the ARM port of @command{gcc}:
1548
1549 @smallexample
1550 % gcc -Q -mabi=2 --help=target -c
1551 The following options are target specific:
1552 -mabi= 2
1553 -mabort-on-noreturn [disabled]
1554 -mapcs [disabled]
1555 @end smallexample
1556
1557 The output is sensitive to the effects of previous command-line
1558 options, so for example it is possible to find out which optimizations
1559 are enabled at @option{-O2} by using:
1560
1561 @smallexample
1562 -Q -O2 --help=optimizers
1563 @end smallexample
1564
1565 Alternatively you can discover which binary optimizations are enabled
1566 by @option{-O3} by using:
1567
1568 @smallexample
1569 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1570 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1571 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1572 @end smallexample
1573
1574 @item --version
1575 @opindex version
1576 Display the version number and copyrights of the invoked GCC@.
1577
1578 @item -pass-exit-codes
1579 @opindex pass-exit-codes
1580 Normally the @command{gcc} program exits with the code of 1 if any
1581 phase of the compiler returns a non-success return code. If you specify
1582 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1583 the numerically highest error produced by any phase returning an error
1584 indication. The C, C++, and Fortran front ends return 4 if an internal
1585 compiler error is encountered.
1586
1587 @item -pipe
1588 @opindex pipe
1589 Use pipes rather than temporary files for communication between the
1590 various stages of compilation. This fails to work on some systems where
1591 the assembler is unable to read from a pipe; but the GNU assembler has
1592 no trouble.
1593
1594 @item -specs=@var{file}
1595 @opindex specs
1596 Process @var{file} after the compiler reads in the standard @file{specs}
1597 file, in order to override the defaults which the @command{gcc} driver
1598 program uses when determining what switches to pass to @command{cc1},
1599 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1600 @option{-specs=@var{file}} can be specified on the command line, and they
1601 are processed in order, from left to right. @xref{Spec Files}, for
1602 information about the format of the @var{file}.
1603
1604 @item -wrapper
1605 @opindex wrapper
1606 Invoke all subcommands under a wrapper program. The name of the
1607 wrapper program and its parameters are passed as a comma separated
1608 list.
1609
1610 @smallexample
1611 gcc -c t.c -wrapper gdb,--args
1612 @end smallexample
1613
1614 @noindent
1615 This invokes all subprograms of @command{gcc} under
1616 @samp{gdb --args}, thus the invocation of @command{cc1} is
1617 @samp{gdb --args cc1 @dots{}}.
1618
1619 @item -fplugin=@var{name}.so
1620 @opindex fplugin
1621 Load the plugin code in file @var{name}.so, assumed to be a
1622 shared object to be dlopen'd by the compiler. The base name of
1623 the shared object file is used to identify the plugin for the
1624 purposes of argument parsing (See
1625 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1626 Each plugin should define the callback functions specified in the
1627 Plugins API.
1628
1629 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1630 @opindex fplugin-arg
1631 Define an argument called @var{key} with a value of @var{value}
1632 for the plugin called @var{name}.
1633
1634 @item -fdump-ada-spec@r{[}-slim@r{]}
1635 @opindex fdump-ada-spec
1636 For C and C++ source and include files, generate corresponding Ada specs.
1637 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1638 GNAT User's Guide}, which provides detailed documentation on this feature.
1639
1640 @item -fada-spec-parent=@var{unit}
1641 @opindex fada-spec-parent
1642 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1643 Ada specs as child units of parent @var{unit}.
1644
1645 @item -fdump-go-spec=@var{file}
1646 @opindex fdump-go-spec
1647 For input files in any language, generate corresponding Go
1648 declarations in @var{file}. This generates Go @code{const},
1649 @code{type}, @code{var}, and @code{func} declarations which may be a
1650 useful way to start writing a Go interface to code written in some
1651 other language.
1652
1653 @include @value{srcdir}/../libiberty/at-file.texi
1654 @end table
1655
1656 @node Invoking G++
1657 @section Compiling C++ Programs
1658
1659 @cindex suffixes for C++ source
1660 @cindex C++ source file suffixes
1661 C++ source files conventionally use one of the suffixes @samp{.C},
1662 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1663 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1664 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1665 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1666 files with these names and compiles them as C++ programs even if you
1667 call the compiler the same way as for compiling C programs (usually
1668 with the name @command{gcc}).
1669
1670 @findex g++
1671 @findex c++
1672 However, the use of @command{gcc} does not add the C++ library.
1673 @command{g++} is a program that calls GCC and automatically specifies linking
1674 against the C++ library. It treats @samp{.c},
1675 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1676 files unless @option{-x} is used. This program is also useful when
1677 precompiling a C header file with a @samp{.h} extension for use in C++
1678 compilations. On many systems, @command{g++} is also installed with
1679 the name @command{c++}.
1680
1681 @cindex invoking @command{g++}
1682 When you compile C++ programs, you may specify many of the same
1683 command-line options that you use for compiling programs in any
1684 language; or command-line options meaningful for C and related
1685 languages; or options that are meaningful only for C++ programs.
1686 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1687 explanations of options for languages related to C@.
1688 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1689 explanations of options that are meaningful only for C++ programs.
1690
1691 @node C Dialect Options
1692 @section Options Controlling C Dialect
1693 @cindex dialect options
1694 @cindex language dialect options
1695 @cindex options, dialect
1696
1697 The following options control the dialect of C (or languages derived
1698 from C, such as C++, Objective-C and Objective-C++) that the compiler
1699 accepts:
1700
1701 @table @gcctabopt
1702 @cindex ANSI support
1703 @cindex ISO support
1704 @item -ansi
1705 @opindex ansi
1706 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1707 equivalent to @option{-std=c++98}.
1708
1709 This turns off certain features of GCC that are incompatible with ISO
1710 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1711 such as the @code{asm} and @code{typeof} keywords, and
1712 predefined macros such as @code{unix} and @code{vax} that identify the
1713 type of system you are using. It also enables the undesirable and
1714 rarely used ISO trigraph feature. For the C compiler,
1715 it disables recognition of C++ style @samp{//} comments as well as
1716 the @code{inline} keyword.
1717
1718 The alternate keywords @code{__asm__}, @code{__extension__},
1719 @code{__inline__} and @code{__typeof__} continue to work despite
1720 @option{-ansi}. You would not want to use them in an ISO C program, of
1721 course, but it is useful to put them in header files that might be included
1722 in compilations done with @option{-ansi}. Alternate predefined macros
1723 such as @code{__unix__} and @code{__vax__} are also available, with or
1724 without @option{-ansi}.
1725
1726 The @option{-ansi} option does not cause non-ISO programs to be
1727 rejected gratuitously. For that, @option{-Wpedantic} is required in
1728 addition to @option{-ansi}. @xref{Warning Options}.
1729
1730 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1731 option is used. Some header files may notice this macro and refrain
1732 from declaring certain functions or defining certain macros that the
1733 ISO standard doesn't call for; this is to avoid interfering with any
1734 programs that might use these names for other things.
1735
1736 Functions that are normally built in but do not have semantics
1737 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1738 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1739 built-in functions provided by GCC}, for details of the functions
1740 affected.
1741
1742 @item -std=
1743 @opindex std
1744 Determine the language standard. @xref{Standards,,Language Standards
1745 Supported by GCC}, for details of these standard versions. This option
1746 is currently only supported when compiling C or C++.
1747
1748 The compiler can accept several base standards, such as @samp{c90} or
1749 @samp{c++98}, and GNU dialects of those standards, such as
1750 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1751 compiler accepts all programs following that standard plus those
1752 using GNU extensions that do not contradict it. For example,
1753 @option{-std=c90} turns off certain features of GCC that are
1754 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1755 keywords, but not other GNU extensions that do not have a meaning in
1756 ISO C90, such as omitting the middle term of a @code{?:}
1757 expression. On the other hand, when a GNU dialect of a standard is
1758 specified, all features supported by the compiler are enabled, even when
1759 those features change the meaning of the base standard. As a result, some
1760 strict-conforming programs may be rejected. The particular standard
1761 is used by @option{-Wpedantic} to identify which features are GNU
1762 extensions given that version of the standard. For example
1763 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1764 comments, while @option{-std=gnu99 -Wpedantic} does not.
1765
1766 A value for this option must be provided; possible values are
1767
1768 @table @samp
1769 @item c90
1770 @itemx c89
1771 @itemx iso9899:1990
1772 Support all ISO C90 programs (certain GNU extensions that conflict
1773 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1774
1775 @item iso9899:199409
1776 ISO C90 as modified in amendment 1.
1777
1778 @item c99
1779 @itemx c9x
1780 @itemx iso9899:1999
1781 @itemx iso9899:199x
1782 ISO C99. This standard is substantially completely supported, modulo
1783 bugs and floating-point issues
1784 (mainly but not entirely relating to optional C99 features from
1785 Annexes F and G). See
1786 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1787 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1788
1789 @item c11
1790 @itemx c1x
1791 @itemx iso9899:2011
1792 ISO C11, the 2011 revision of the ISO C standard. This standard is
1793 substantially completely supported, modulo bugs, floating-point issues
1794 (mainly but not entirely relating to optional C11 features from
1795 Annexes F and G) and the optional Annexes K (Bounds-checking
1796 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1797
1798 @item gnu90
1799 @itemx gnu89
1800 GNU dialect of ISO C90 (including some C99 features).
1801
1802 @item gnu99
1803 @itemx gnu9x
1804 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1805
1806 @item gnu11
1807 @itemx gnu1x
1808 GNU dialect of ISO C11. This is the default for C code.
1809 The name @samp{gnu1x} is deprecated.
1810
1811 @item c++98
1812 @itemx c++03
1813 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1814 additional defect reports. Same as @option{-ansi} for C++ code.
1815
1816 @item gnu++98
1817 @itemx gnu++03
1818 GNU dialect of @option{-std=c++98}.
1819
1820 @item c++11
1821 @itemx c++0x
1822 The 2011 ISO C++ standard plus amendments.
1823 The name @samp{c++0x} is deprecated.
1824
1825 @item gnu++11
1826 @itemx gnu++0x
1827 GNU dialect of @option{-std=c++11}.
1828 The name @samp{gnu++0x} is deprecated.
1829
1830 @item c++14
1831 @itemx c++1y
1832 The 2014 ISO C++ standard plus amendments.
1833 The name @samp{c++1y} is deprecated.
1834
1835 @item gnu++14
1836 @itemx gnu++1y
1837 GNU dialect of @option{-std=c++14}.
1838 This is the default for C++ code.
1839 The name @samp{gnu++1y} is deprecated.
1840
1841 @item c++1z
1842 The next revision of the ISO C++ standard, tentatively planned for
1843 2017. Support is highly experimental, and will almost certainly
1844 change in incompatible ways in future releases.
1845
1846 @item gnu++1z
1847 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1848 and will almost certainly change in incompatible ways in future
1849 releases.
1850 @end table
1851
1852 @item -fgnu89-inline
1853 @opindex fgnu89-inline
1854 The option @option{-fgnu89-inline} tells GCC to use the traditional
1855 GNU semantics for @code{inline} functions when in C99 mode.
1856 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1857 Using this option is roughly equivalent to adding the
1858 @code{gnu_inline} function attribute to all inline functions
1859 (@pxref{Function Attributes}).
1860
1861 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1862 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1863 specifies the default behavior).
1864 This option is not supported in @option{-std=c90} or
1865 @option{-std=gnu90} mode.
1866
1867 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1868 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1869 in effect for @code{inline} functions. @xref{Common Predefined
1870 Macros,,,cpp,The C Preprocessor}.
1871
1872 @item -fpermitted-flt-eval-methods=@var{style}
1873 @opindex fpermitted-flt-eval-methods
1874 @opindex fpermitted-flt-eval-methods=c11
1875 @opindex fpermitted-flt-eval-methods=ts-18661-3
1876 ISO/IEC TS 18661-3 defines new permissible values for
1877 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
1878 a semantic type that is an interchange or extended format should be
1879 evaluated to the precision and range of that type. These new values are
1880 a superset of those permitted under C99/C11, which does not specify the
1881 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
1882 conforming to C11 may not have been written expecting the possibility of
1883 the new values.
1884
1885 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
1886 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
1887 or the extended set of values specified in ISO/IEC TS 18661-3.
1888
1889 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
1890
1891 The default when in a standards compliant mode (@option{-std=c11} or similar)
1892 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
1893 dialect (@option{-std=gnu11} or similar) is
1894 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
1895
1896 @item -aux-info @var{filename}
1897 @opindex aux-info
1898 Output to the given filename prototyped declarations for all functions
1899 declared and/or defined in a translation unit, including those in header
1900 files. This option is silently ignored in any language other than C@.
1901
1902 Besides declarations, the file indicates, in comments, the origin of
1903 each declaration (source file and line), whether the declaration was
1904 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1905 @samp{O} for old, respectively, in the first character after the line
1906 number and the colon), and whether it came from a declaration or a
1907 definition (@samp{C} or @samp{F}, respectively, in the following
1908 character). In the case of function definitions, a K&R-style list of
1909 arguments followed by their declarations is also provided, inside
1910 comments, after the declaration.
1911
1912 @item -fallow-parameterless-variadic-functions
1913 @opindex fallow-parameterless-variadic-functions
1914 Accept variadic functions without named parameters.
1915
1916 Although it is possible to define such a function, this is not very
1917 useful as it is not possible to read the arguments. This is only
1918 supported for C as this construct is allowed by C++.
1919
1920 @item -fno-asm
1921 @opindex fno-asm
1922 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1923 keyword, so that code can use these words as identifiers. You can use
1924 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1925 instead. @option{-ansi} implies @option{-fno-asm}.
1926
1927 In C++, this switch only affects the @code{typeof} keyword, since
1928 @code{asm} and @code{inline} are standard keywords. You may want to
1929 use the @option{-fno-gnu-keywords} flag instead, which has the same
1930 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1931 switch only affects the @code{asm} and @code{typeof} keywords, since
1932 @code{inline} is a standard keyword in ISO C99.
1933
1934 @item -fno-builtin
1935 @itemx -fno-builtin-@var{function}
1936 @opindex fno-builtin
1937 @cindex built-in functions
1938 Don't recognize built-in functions that do not begin with
1939 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1940 functions provided by GCC}, for details of the functions affected,
1941 including those which are not built-in functions when @option{-ansi} or
1942 @option{-std} options for strict ISO C conformance are used because they
1943 do not have an ISO standard meaning.
1944
1945 GCC normally generates special code to handle certain built-in functions
1946 more efficiently; for instance, calls to @code{alloca} may become single
1947 instructions which adjust the stack directly, and calls to @code{memcpy}
1948 may become inline copy loops. The resulting code is often both smaller
1949 and faster, but since the function calls no longer appear as such, you
1950 cannot set a breakpoint on those calls, nor can you change the behavior
1951 of the functions by linking with a different library. In addition,
1952 when a function is recognized as a built-in function, GCC may use
1953 information about that function to warn about problems with calls to
1954 that function, or to generate more efficient code, even if the
1955 resulting code still contains calls to that function. For example,
1956 warnings are given with @option{-Wformat} for bad calls to
1957 @code{printf} when @code{printf} is built in and @code{strlen} is
1958 known not to modify global memory.
1959
1960 With the @option{-fno-builtin-@var{function}} option
1961 only the built-in function @var{function} is
1962 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1963 function is named that is not built-in in this version of GCC, this
1964 option is ignored. There is no corresponding
1965 @option{-fbuiltin-@var{function}} option; if you wish to enable
1966 built-in functions selectively when using @option{-fno-builtin} or
1967 @option{-ffreestanding}, you may define macros such as:
1968
1969 @smallexample
1970 #define abs(n) __builtin_abs ((n))
1971 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1972 @end smallexample
1973
1974 @item -fgimple
1975 @opindex fgimple
1976
1977 Enable parsing of function definitions marked with @code{__GIMPLE}.
1978 This is an experimental feature that allows unit testing of GIMPLE
1979 passes.
1980
1981 @item -fhosted
1982 @opindex fhosted
1983 @cindex hosted environment
1984
1985 Assert that compilation targets a hosted environment. This implies
1986 @option{-fbuiltin}. A hosted environment is one in which the
1987 entire standard library is available, and in which @code{main} has a return
1988 type of @code{int}. Examples are nearly everything except a kernel.
1989 This is equivalent to @option{-fno-freestanding}.
1990
1991 @item -ffreestanding
1992 @opindex ffreestanding
1993 @cindex hosted environment
1994
1995 Assert that compilation targets a freestanding environment. This
1996 implies @option{-fno-builtin}. A freestanding environment
1997 is one in which the standard library may not exist, and program startup may
1998 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1999 This is equivalent to @option{-fno-hosted}.
2000
2001 @xref{Standards,,Language Standards Supported by GCC}, for details of
2002 freestanding and hosted environments.
2003
2004 @item -fopenacc
2005 @opindex fopenacc
2006 @cindex OpenACC accelerator programming
2007 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2008 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2009 compiler generates accelerated code according to the OpenACC Application
2010 Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
2011 implies @option{-pthread}, and thus is only supported on targets that
2012 have support for @option{-pthread}.
2013
2014 @item -fopenacc-dim=@var{geom}
2015 @opindex fopenacc-dim
2016 @cindex OpenACC accelerator programming
2017 Specify default compute dimensions for parallel offload regions that do
2018 not explicitly specify. The @var{geom} value is a triple of
2019 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2020 can be omitted, to use a target-specific default value.
2021
2022 @item -fopenmp
2023 @opindex fopenmp
2024 @cindex OpenMP parallel
2025 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2026 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2027 compiler generates parallel code according to the OpenMP Application
2028 Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
2029 implies @option{-pthread}, and thus is only supported on targets that
2030 have support for @option{-pthread}. @option{-fopenmp} implies
2031 @option{-fopenmp-simd}.
2032
2033 @item -fopenmp-simd
2034 @opindex fopenmp-simd
2035 @cindex OpenMP SIMD
2036 @cindex SIMD
2037 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2038 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2039 are ignored.
2040
2041 @item -fcilkplus
2042 @opindex fcilkplus
2043 @cindex Enable Cilk Plus
2044 Enable the usage of Cilk Plus language extension features for C/C++.
2045 When the option @option{-fcilkplus} is specified, enable the usage of
2046 the Cilk Plus Language extension features for C/C++. The present
2047 implementation follows ABI version 1.2. This is an experimental
2048 feature that is only partially complete, and whose interface may
2049 change in future versions of GCC as the official specification
2050 changes. Currently, all features but @code{_Cilk_for} have been
2051 implemented.
2052
2053 @item -fgnu-tm
2054 @opindex fgnu-tm
2055 When the option @option{-fgnu-tm} is specified, the compiler
2056 generates code for the Linux variant of Intel's current Transactional
2057 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2058 an experimental feature whose interface may change in future versions
2059 of GCC, as the official specification changes. Please note that not
2060 all architectures are supported for this feature.
2061
2062 For more information on GCC's support for transactional memory,
2063 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2064 Transactional Memory Library}.
2065
2066 Note that the transactional memory feature is not supported with
2067 non-call exceptions (@option{-fnon-call-exceptions}).
2068
2069 @item -fms-extensions
2070 @opindex fms-extensions
2071 Accept some non-standard constructs used in Microsoft header files.
2072
2073 In C++ code, this allows member names in structures to be similar
2074 to previous types declarations.
2075
2076 @smallexample
2077 typedef int UOW;
2078 struct ABC @{
2079 UOW UOW;
2080 @};
2081 @end smallexample
2082
2083 Some cases of unnamed fields in structures and unions are only
2084 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2085 fields within structs/unions}, for details.
2086
2087 Note that this option is off for all targets but x86
2088 targets using ms-abi.
2089
2090 @item -fplan9-extensions
2091 @opindex fplan9-extensions
2092 Accept some non-standard constructs used in Plan 9 code.
2093
2094 This enables @option{-fms-extensions}, permits passing pointers to
2095 structures with anonymous fields to functions that expect pointers to
2096 elements of the type of the field, and permits referring to anonymous
2097 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2098 struct/union fields within structs/unions}, for details. This is only
2099 supported for C, not C++.
2100
2101 @item -trigraphs
2102 @opindex trigraphs
2103 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
2104 options for strict ISO C conformance) implies @option{-trigraphs}.
2105
2106 @cindex traditional C language
2107 @cindex C language, traditional
2108 @item -traditional
2109 @itemx -traditional-cpp
2110 @opindex traditional-cpp
2111 @opindex traditional
2112 Formerly, these options caused GCC to attempt to emulate a pre-standard
2113 C compiler. They are now only supported with the @option{-E} switch.
2114 The preprocessor continues to support a pre-standard mode. See the GNU
2115 CPP manual for details.
2116
2117 @item -fcond-mismatch
2118 @opindex fcond-mismatch
2119 Allow conditional expressions with mismatched types in the second and
2120 third arguments. The value of such an expression is void. This option
2121 is not supported for C++.
2122
2123 @item -flax-vector-conversions
2124 @opindex flax-vector-conversions
2125 Allow implicit conversions between vectors with differing numbers of
2126 elements and/or incompatible element types. This option should not be
2127 used for new code.
2128
2129 @item -funsigned-char
2130 @opindex funsigned-char
2131 Let the type @code{char} be unsigned, like @code{unsigned char}.
2132
2133 Each kind of machine has a default for what @code{char} should
2134 be. It is either like @code{unsigned char} by default or like
2135 @code{signed char} by default.
2136
2137 Ideally, a portable program should always use @code{signed char} or
2138 @code{unsigned char} when it depends on the signedness of an object.
2139 But many programs have been written to use plain @code{char} and
2140 expect it to be signed, or expect it to be unsigned, depending on the
2141 machines they were written for. This option, and its inverse, let you
2142 make such a program work with the opposite default.
2143
2144 The type @code{char} is always a distinct type from each of
2145 @code{signed char} or @code{unsigned char}, even though its behavior
2146 is always just like one of those two.
2147
2148 @item -fsigned-char
2149 @opindex fsigned-char
2150 Let the type @code{char} be signed, like @code{signed char}.
2151
2152 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2153 the negative form of @option{-funsigned-char}. Likewise, the option
2154 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2155
2156 @item -fsigned-bitfields
2157 @itemx -funsigned-bitfields
2158 @itemx -fno-signed-bitfields
2159 @itemx -fno-unsigned-bitfields
2160 @opindex fsigned-bitfields
2161 @opindex funsigned-bitfields
2162 @opindex fno-signed-bitfields
2163 @opindex fno-unsigned-bitfields
2164 These options control whether a bit-field is signed or unsigned, when the
2165 declaration does not use either @code{signed} or @code{unsigned}. By
2166 default, such a bit-field is signed, because this is consistent: the
2167 basic integer types such as @code{int} are signed types.
2168
2169 @item -fsso-struct=@var{endianness}
2170 @opindex fsso-struct
2171 Set the default scalar storage order of structures and unions to the
2172 specified endianness. The accepted values are @samp{big-endian} and
2173 @samp{little-endian}. If the option is not passed, the compiler uses
2174 the native endianness of the target. This option is not supported for C++.
2175
2176 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2177 code that is not binary compatible with code generated without it if the
2178 specified endianness is not the native endianness of the target.
2179 @end table
2180
2181 @node C++ Dialect Options
2182 @section Options Controlling C++ Dialect
2183
2184 @cindex compiler options, C++
2185 @cindex C++ options, command-line
2186 @cindex options, C++
2187 This section describes the command-line options that are only meaningful
2188 for C++ programs. You can also use most of the GNU compiler options
2189 regardless of what language your program is in. For example, you
2190 might compile a file @file{firstClass.C} like this:
2191
2192 @smallexample
2193 g++ -g -fstrict-enums -O -c firstClass.C
2194 @end smallexample
2195
2196 @noindent
2197 In this example, only @option{-fstrict-enums} is an option meant
2198 only for C++ programs; you can use the other options with any
2199 language supported by GCC@.
2200
2201 Some options for compiling C programs, such as @option{-std}, are also
2202 relevant for C++ programs.
2203 @xref{C Dialect Options,,Options Controlling C Dialect}.
2204
2205 Here is a list of options that are @emph{only} for compiling C++ programs:
2206
2207 @table @gcctabopt
2208
2209 @item -fabi-version=@var{n}
2210 @opindex fabi-version
2211 Use version @var{n} of the C++ ABI@. The default is version 0.
2212
2213 Version 0 refers to the version conforming most closely to
2214 the C++ ABI specification. Therefore, the ABI obtained using version 0
2215 will change in different versions of G++ as ABI bugs are fixed.
2216
2217 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2218
2219 Version 2 is the version of the C++ ABI that first appeared in G++
2220 3.4, and was the default through G++ 4.9.
2221
2222 Version 3 corrects an error in mangling a constant address as a
2223 template argument.
2224
2225 Version 4, which first appeared in G++ 4.5, implements a standard
2226 mangling for vector types.
2227
2228 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2229 attribute const/volatile on function pointer types, decltype of a
2230 plain decl, and use of a function parameter in the declaration of
2231 another parameter.
2232
2233 Version 6, which first appeared in G++ 4.7, corrects the promotion
2234 behavior of C++11 scoped enums and the mangling of template argument
2235 packs, const/static_cast, prefix ++ and --, and a class scope function
2236 used as a template argument.
2237
2238 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2239 builtin type and corrects the mangling of lambdas in default argument
2240 scope.
2241
2242 Version 8, which first appeared in G++ 4.9, corrects the substitution
2243 behavior of function types with function-cv-qualifiers.
2244
2245 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2246 @code{nullptr_t}.
2247
2248 Version 10, which first appeared in G++ 6.1, adds mangling of
2249 attributes that affect type identity, such as ia32 calling convention
2250 attributes (e.g. @samp{stdcall}).
2251
2252 Version 11, which first appeared in G++ 7, corrects the mangling of
2253 sizeof... expressions. It also implies
2254 @option{-fnew-inheriting-ctors}.
2255
2256 See also @option{-Wabi}.
2257
2258 @item -fabi-compat-version=@var{n}
2259 @opindex fabi-compat-version
2260 On targets that support strong aliases, G++
2261 works around mangling changes by creating an alias with the correct
2262 mangled name when defining a symbol with an incorrect mangled name.
2263 This switch specifies which ABI version to use for the alias.
2264
2265 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2266 compatibility). If another ABI version is explicitly selected, this
2267 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2268 use @option{-fabi-compat-version=2}.
2269
2270 If this option is not provided but @option{-Wabi=@var{n}} is, that
2271 version is used for compatibility aliases. If this option is provided
2272 along with @option{-Wabi} (without the version), the version from this
2273 option is used for the warning.
2274
2275 @item -fno-access-control
2276 @opindex fno-access-control
2277 Turn off all access checking. This switch is mainly useful for working
2278 around bugs in the access control code.
2279
2280 @item -faligned-new
2281 @opindex faligned-new
2282 Enable support for C++17 @code{new} of types that require more
2283 alignment than @code{void* ::operator new(std::size_t)} provides. A
2284 numeric argument such as @code{-faligned-new=32} can be used to
2285 specify how much alignment (in bytes) is provided by that function,
2286 but few users will need to override the default of
2287 @code{alignof(std::max_align_t)}.
2288
2289 @item -fcheck-new
2290 @opindex fcheck-new
2291 Check that the pointer returned by @code{operator new} is non-null
2292 before attempting to modify the storage allocated. This check is
2293 normally unnecessary because the C++ standard specifies that
2294 @code{operator new} only returns @code{0} if it is declared
2295 @code{throw()}, in which case the compiler always checks the
2296 return value even without this option. In all other cases, when
2297 @code{operator new} has a non-empty exception specification, memory
2298 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2299 @samp{new (nothrow)}.
2300
2301 @item -fconcepts
2302 @opindex fconcepts
2303 Enable support for the C++ Extensions for Concepts Technical
2304 Specification, ISO 19217 (2015), which allows code like
2305
2306 @smallexample
2307 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2308 template <Addable T> T add (T a, T b) @{ return a + b; @}
2309 @end smallexample
2310
2311 @item -fconstexpr-depth=@var{n}
2312 @opindex fconstexpr-depth
2313 Set the maximum nested evaluation depth for C++11 constexpr functions
2314 to @var{n}. A limit is needed to detect endless recursion during
2315 constant expression evaluation. The minimum specified by the standard
2316 is 512.
2317
2318 @item -fconstexpr-loop-limit=@var{n}
2319 @opindex fconstexpr-loop-limit
2320 Set the maximum number of iterations for a loop in C++14 constexpr functions
2321 to @var{n}. A limit is needed to detect infinite loops during
2322 constant expression evaluation. The default is 262144 (1<<18).
2323
2324 @item -fdeduce-init-list
2325 @opindex fdeduce-init-list
2326 Enable deduction of a template type parameter as
2327 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2328
2329 @smallexample
2330 template <class T> auto forward(T t) -> decltype (realfn (t))
2331 @{
2332 return realfn (t);
2333 @}
2334
2335 void f()
2336 @{
2337 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2338 @}
2339 @end smallexample
2340
2341 This deduction was implemented as a possible extension to the
2342 originally proposed semantics for the C++11 standard, but was not part
2343 of the final standard, so it is disabled by default. This option is
2344 deprecated, and may be removed in a future version of G++.
2345
2346 @item -ffriend-injection
2347 @opindex ffriend-injection
2348 Inject friend functions into the enclosing namespace, so that they are
2349 visible outside the scope of the class in which they are declared.
2350 Friend functions were documented to work this way in the old Annotated
2351 C++ Reference Manual.
2352 However, in ISO C++ a friend function that is not declared
2353 in an enclosing scope can only be found using argument dependent
2354 lookup. GCC defaults to the standard behavior.
2355
2356 This option is for compatibility, and may be removed in a future
2357 release of G++.
2358
2359 @item -fno-elide-constructors
2360 @opindex fno-elide-constructors
2361 The C++ standard allows an implementation to omit creating a temporary
2362 that is only used to initialize another object of the same type.
2363 Specifying this option disables that optimization, and forces G++ to
2364 call the copy constructor in all cases. This option also causes G++
2365 to call trivial member functions which otherwise would be expanded inline.
2366
2367 In C++17, the compiler is required to omit these temporaries, but this
2368 option still affects trivial member functions.
2369
2370 @item -fno-enforce-eh-specs
2371 @opindex fno-enforce-eh-specs
2372 Don't generate code to check for violation of exception specifications
2373 at run time. This option violates the C++ standard, but may be useful
2374 for reducing code size in production builds, much like defining
2375 @code{NDEBUG}. This does not give user code permission to throw
2376 exceptions in violation of the exception specifications; the compiler
2377 still optimizes based on the specifications, so throwing an
2378 unexpected exception results in undefined behavior at run time.
2379
2380 @item -fextern-tls-init
2381 @itemx -fno-extern-tls-init
2382 @opindex fextern-tls-init
2383 @opindex fno-extern-tls-init
2384 The C++11 and OpenMP standards allow @code{thread_local} and
2385 @code{threadprivate} variables to have dynamic (runtime)
2386 initialization. To support this, any use of such a variable goes
2387 through a wrapper function that performs any necessary initialization.
2388 When the use and definition of the variable are in the same
2389 translation unit, this overhead can be optimized away, but when the
2390 use is in a different translation unit there is significant overhead
2391 even if the variable doesn't actually need dynamic initialization. If
2392 the programmer can be sure that no use of the variable in a
2393 non-defining TU needs to trigger dynamic initialization (either
2394 because the variable is statically initialized, or a use of the
2395 variable in the defining TU will be executed before any uses in
2396 another TU), they can avoid this overhead with the
2397 @option{-fno-extern-tls-init} option.
2398
2399 On targets that support symbol aliases, the default is
2400 @option{-fextern-tls-init}. On targets that do not support symbol
2401 aliases, the default is @option{-fno-extern-tls-init}.
2402
2403 @item -ffor-scope
2404 @itemx -fno-for-scope
2405 @opindex ffor-scope
2406 @opindex fno-for-scope
2407 If @option{-ffor-scope} is specified, the scope of variables declared in
2408 a @i{for-init-statement} is limited to the @code{for} loop itself,
2409 as specified by the C++ standard.
2410 If @option{-fno-for-scope} is specified, the scope of variables declared in
2411 a @i{for-init-statement} extends to the end of the enclosing scope,
2412 as was the case in old versions of G++, and other (traditional)
2413 implementations of C++.
2414
2415 If neither flag is given, the default is to follow the standard,
2416 but to allow and give a warning for old-style code that would
2417 otherwise be invalid, or have different behavior.
2418
2419 @item -fno-gnu-keywords
2420 @opindex fno-gnu-keywords
2421 Do not recognize @code{typeof} as a keyword, so that code can use this
2422 word as an identifier. You can use the keyword @code{__typeof__} instead.
2423 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2424 @option{-std=c++98}, @option{-std=c++11}, etc.
2425
2426 @item -fno-implicit-templates
2427 @opindex fno-implicit-templates
2428 Never emit code for non-inline templates that are instantiated
2429 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2430 @xref{Template Instantiation}, for more information.
2431
2432 @item -fno-implicit-inline-templates
2433 @opindex fno-implicit-inline-templates
2434 Don't emit code for implicit instantiations of inline templates, either.
2435 The default is to handle inlines differently so that compiles with and
2436 without optimization need the same set of explicit instantiations.
2437
2438 @item -fno-implement-inlines
2439 @opindex fno-implement-inlines
2440 To save space, do not emit out-of-line copies of inline functions
2441 controlled by @code{#pragma implementation}. This causes linker
2442 errors if these functions are not inlined everywhere they are called.
2443
2444 @item -fms-extensions
2445 @opindex fms-extensions
2446 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2447 int and getting a pointer to member function via non-standard syntax.
2448
2449 @item -fnew-inheriting-ctors
2450 @opindex fnew-inheriting-ctors
2451 Enable the P0136 adjustment to the semantics of C++11 constructor
2452 inheritance. This is part of C++17 but also considered to be a Defect
2453 Report against C++11 and C++14. This flag is enabled by default
2454 unless @option{-fabi-version=10} or lower is specified.
2455
2456 @item -fno-nonansi-builtins
2457 @opindex fno-nonansi-builtins
2458 Disable built-in declarations of functions that are not mandated by
2459 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2460 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2461
2462 @item -fnothrow-opt
2463 @opindex fnothrow-opt
2464 Treat a @code{throw()} exception specification as if it were a
2465 @code{noexcept} specification to reduce or eliminate the text size
2466 overhead relative to a function with no exception specification. If
2467 the function has local variables of types with non-trivial
2468 destructors, the exception specification actually makes the
2469 function smaller because the EH cleanups for those variables can be
2470 optimized away. The semantic effect is that an exception thrown out of
2471 a function with such an exception specification results in a call
2472 to @code{terminate} rather than @code{unexpected}.
2473
2474 @item -fno-operator-names
2475 @opindex fno-operator-names
2476 Do not treat the operator name keywords @code{and}, @code{bitand},
2477 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2478 synonyms as keywords.
2479
2480 @item -fno-optional-diags
2481 @opindex fno-optional-diags
2482 Disable diagnostics that the standard says a compiler does not need to
2483 issue. Currently, the only such diagnostic issued by G++ is the one for
2484 a name having multiple meanings within a class.
2485
2486 @item -fpermissive
2487 @opindex fpermissive
2488 Downgrade some diagnostics about nonconformant code from errors to
2489 warnings. Thus, using @option{-fpermissive} allows some
2490 nonconforming code to compile.
2491
2492 @item -fno-pretty-templates
2493 @opindex fno-pretty-templates
2494 When an error message refers to a specialization of a function
2495 template, the compiler normally prints the signature of the
2496 template followed by the template arguments and any typedefs or
2497 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2498 rather than @code{void f(int)}) so that it's clear which template is
2499 involved. When an error message refers to a specialization of a class
2500 template, the compiler omits any template arguments that match
2501 the default template arguments for that template. If either of these
2502 behaviors make it harder to understand the error message rather than
2503 easier, you can use @option{-fno-pretty-templates} to disable them.
2504
2505 @item -frepo
2506 @opindex frepo
2507 Enable automatic template instantiation at link time. This option also
2508 implies @option{-fno-implicit-templates}. @xref{Template
2509 Instantiation}, for more information.
2510
2511 @item -fno-rtti
2512 @opindex fno-rtti
2513 Disable generation of information about every class with virtual
2514 functions for use by the C++ run-time type identification features
2515 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2516 of the language, you can save some space by using this flag. Note that
2517 exception handling uses the same information, but G++ generates it as
2518 needed. The @code{dynamic_cast} operator can still be used for casts that
2519 do not require run-time type information, i.e.@: casts to @code{void *} or to
2520 unambiguous base classes.
2521
2522 @item -fsized-deallocation
2523 @opindex fsized-deallocation
2524 Enable the built-in global declarations
2525 @smallexample
2526 void operator delete (void *, std::size_t) noexcept;
2527 void operator delete[] (void *, std::size_t) noexcept;
2528 @end smallexample
2529 as introduced in C++14. This is useful for user-defined replacement
2530 deallocation functions that, for example, use the size of the object
2531 to make deallocation faster. Enabled by default under
2532 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2533 warns about places that might want to add a definition.
2534
2535 @item -fstrict-enums
2536 @opindex fstrict-enums
2537 Allow the compiler to optimize using the assumption that a value of
2538 enumerated type can only be one of the values of the enumeration (as
2539 defined in the C++ standard; basically, a value that can be
2540 represented in the minimum number of bits needed to represent all the
2541 enumerators). This assumption may not be valid if the program uses a
2542 cast to convert an arbitrary integer value to the enumerated type.
2543
2544 @item -fstrong-eval-order
2545 @opindex fstrong-eval-order
2546 Evaluate member access, array subscripting, and shift expressions in
2547 left-to-right order, and evaluate assignment in right-to-left order,
2548 as adopted for C++17. Enabled by default with @option{-std=c++1z}.
2549 @option{-fstrong-eval-order=some} enables just the ordering of member
2550 access and shift expressions, and is the default without
2551 @option{-std=c++1z}.
2552
2553 @item -ftemplate-backtrace-limit=@var{n}
2554 @opindex ftemplate-backtrace-limit
2555 Set the maximum number of template instantiation notes for a single
2556 warning or error to @var{n}. The default value is 10.
2557
2558 @item -ftemplate-depth=@var{n}
2559 @opindex ftemplate-depth
2560 Set the maximum instantiation depth for template classes to @var{n}.
2561 A limit on the template instantiation depth is needed to detect
2562 endless recursions during template class instantiation. ANSI/ISO C++
2563 conforming programs must not rely on a maximum depth greater than 17
2564 (changed to 1024 in C++11). The default value is 900, as the compiler
2565 can run out of stack space before hitting 1024 in some situations.
2566
2567 @item -fno-threadsafe-statics
2568 @opindex fno-threadsafe-statics
2569 Do not emit the extra code to use the routines specified in the C++
2570 ABI for thread-safe initialization of local statics. You can use this
2571 option to reduce code size slightly in code that doesn't need to be
2572 thread-safe.
2573
2574 @item -fuse-cxa-atexit
2575 @opindex fuse-cxa-atexit
2576 Register destructors for objects with static storage duration with the
2577 @code{__cxa_atexit} function rather than the @code{atexit} function.
2578 This option is required for fully standards-compliant handling of static
2579 destructors, but only works if your C library supports
2580 @code{__cxa_atexit}.
2581
2582 @item -fno-use-cxa-get-exception-ptr
2583 @opindex fno-use-cxa-get-exception-ptr
2584 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2585 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2586 if the runtime routine is not available.
2587
2588 @item -fvisibility-inlines-hidden
2589 @opindex fvisibility-inlines-hidden
2590 This switch declares that the user does not attempt to compare
2591 pointers to inline functions or methods where the addresses of the two functions
2592 are taken in different shared objects.
2593
2594 The effect of this is that GCC may, effectively, mark inline methods with
2595 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2596 appear in the export table of a DSO and do not require a PLT indirection
2597 when used within the DSO@. Enabling this option can have a dramatic effect
2598 on load and link times of a DSO as it massively reduces the size of the
2599 dynamic export table when the library makes heavy use of templates.
2600
2601 The behavior of this switch is not quite the same as marking the
2602 methods as hidden directly, because it does not affect static variables
2603 local to the function or cause the compiler to deduce that
2604 the function is defined in only one shared object.
2605
2606 You may mark a method as having a visibility explicitly to negate the
2607 effect of the switch for that method. For example, if you do want to
2608 compare pointers to a particular inline method, you might mark it as
2609 having default visibility. Marking the enclosing class with explicit
2610 visibility has no effect.
2611
2612 Explicitly instantiated inline methods are unaffected by this option
2613 as their linkage might otherwise cross a shared library boundary.
2614 @xref{Template Instantiation}.
2615
2616 @item -fvisibility-ms-compat
2617 @opindex fvisibility-ms-compat
2618 This flag attempts to use visibility settings to make GCC's C++
2619 linkage model compatible with that of Microsoft Visual Studio.
2620
2621 The flag makes these changes to GCC's linkage model:
2622
2623 @enumerate
2624 @item
2625 It sets the default visibility to @code{hidden}, like
2626 @option{-fvisibility=hidden}.
2627
2628 @item
2629 Types, but not their members, are not hidden by default.
2630
2631 @item
2632 The One Definition Rule is relaxed for types without explicit
2633 visibility specifications that are defined in more than one
2634 shared object: those declarations are permitted if they are
2635 permitted when this option is not used.
2636 @end enumerate
2637
2638 In new code it is better to use @option{-fvisibility=hidden} and
2639 export those classes that are intended to be externally visible.
2640 Unfortunately it is possible for code to rely, perhaps accidentally,
2641 on the Visual Studio behavior.
2642
2643 Among the consequences of these changes are that static data members
2644 of the same type with the same name but defined in different shared
2645 objects are different, so changing one does not change the other;
2646 and that pointers to function members defined in different shared
2647 objects may not compare equal. When this flag is given, it is a
2648 violation of the ODR to define types with the same name differently.
2649
2650 @item -fno-weak
2651 @opindex fno-weak
2652 Do not use weak symbol support, even if it is provided by the linker.
2653 By default, G++ uses weak symbols if they are available. This
2654 option exists only for testing, and should not be used by end-users;
2655 it results in inferior code and has no benefits. This option may
2656 be removed in a future release of G++.
2657
2658 @item -nostdinc++
2659 @opindex nostdinc++
2660 Do not search for header files in the standard directories specific to
2661 C++, but do still search the other standard directories. (This option
2662 is used when building the C++ library.)
2663 @end table
2664
2665 In addition, these optimization, warning, and code generation options
2666 have meanings only for C++ programs:
2667
2668 @table @gcctabopt
2669 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2670 @opindex Wabi
2671 @opindex Wno-abi
2672 Warn when G++ it generates code that is probably not compatible with
2673 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2674 ABI with each major release, normally @option{-Wabi} will warn only if
2675 there is a check added later in a release series for an ABI issue
2676 discovered since the initial release. @option{-Wabi} will warn about
2677 more things if an older ABI version is selected (with
2678 @option{-fabi-version=@var{n}}).
2679
2680 @option{-Wabi} can also be used with an explicit version number to
2681 warn about compatibility with a particular @option{-fabi-version}
2682 level, e.g. @option{-Wabi=2} to warn about changes relative to
2683 @option{-fabi-version=2}.
2684
2685 If an explicit version number is provided and
2686 @option{-fabi-compat-version} is not specified, the version number
2687 from this option is used for compatibility aliases. If no explicit
2688 version number is provided with this option, but
2689 @option{-fabi-compat-version} is specified, that version number is
2690 used for ABI warnings.
2691
2692 Although an effort has been made to warn about
2693 all such cases, there are probably some cases that are not warned about,
2694 even though G++ is generating incompatible code. There may also be
2695 cases where warnings are emitted even though the code that is generated
2696 is compatible.
2697
2698 You should rewrite your code to avoid these warnings if you are
2699 concerned about the fact that code generated by G++ may not be binary
2700 compatible with code generated by other compilers.
2701
2702 Known incompatibilities in @option{-fabi-version=2} (which was the
2703 default from GCC 3.4 to 4.9) include:
2704
2705 @itemize @bullet
2706
2707 @item
2708 A template with a non-type template parameter of reference type was
2709 mangled incorrectly:
2710 @smallexample
2711 extern int N;
2712 template <int &> struct S @{@};
2713 void n (S<N>) @{2@}
2714 @end smallexample
2715
2716 This was fixed in @option{-fabi-version=3}.
2717
2718 @item
2719 SIMD vector types declared using @code{__attribute ((vector_size))} were
2720 mangled in a non-standard way that does not allow for overloading of
2721 functions taking vectors of different sizes.
2722
2723 The mangling was changed in @option{-fabi-version=4}.
2724
2725 @item
2726 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2727 qualifiers, and @code{decltype} of a plain declaration was folded away.
2728
2729 These mangling issues were fixed in @option{-fabi-version=5}.
2730
2731 @item
2732 Scoped enumerators passed as arguments to a variadic function are
2733 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2734 On most targets this does not actually affect the parameter passing
2735 ABI, as there is no way to pass an argument smaller than @code{int}.
2736
2737 Also, the ABI changed the mangling of template argument packs,
2738 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2739 a class scope function used as a template argument.
2740
2741 These issues were corrected in @option{-fabi-version=6}.
2742
2743 @item
2744 Lambdas in default argument scope were mangled incorrectly, and the
2745 ABI changed the mangling of @code{nullptr_t}.
2746
2747 These issues were corrected in @option{-fabi-version=7}.
2748
2749 @item
2750 When mangling a function type with function-cv-qualifiers, the
2751 un-qualified function type was incorrectly treated as a substitution
2752 candidate.
2753
2754 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2755
2756 @item
2757 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2758 unaligned accesses. Note that this did not affect the ABI of a
2759 function with a @code{nullptr_t} parameter, as parameters have a
2760 minimum alignment.
2761
2762 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2763
2764 @item
2765 Target-specific attributes that affect the identity of a type, such as
2766 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2767 did not affect the mangled name, leading to name collisions when
2768 function pointers were used as template arguments.
2769
2770 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2771
2772 @end itemize
2773
2774 It also warns about psABI-related changes. The known psABI changes at this
2775 point include:
2776
2777 @itemize @bullet
2778
2779 @item
2780 For SysV/x86-64, unions with @code{long double} members are
2781 passed in memory as specified in psABI. For example:
2782
2783 @smallexample
2784 union U @{
2785 long double ld;
2786 int i;
2787 @};
2788 @end smallexample
2789
2790 @noindent
2791 @code{union U} is always passed in memory.
2792
2793 @end itemize
2794
2795 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2796 @opindex Wabi-tag
2797 @opindex -Wabi-tag
2798 Warn when a type with an ABI tag is used in a context that does not
2799 have that ABI tag. See @ref{C++ Attributes} for more information
2800 about ABI tags.
2801
2802 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2803 @opindex Wctor-dtor-privacy
2804 @opindex Wno-ctor-dtor-privacy
2805 Warn when a class seems unusable because all the constructors or
2806 destructors in that class are private, and it has neither friends nor
2807 public static member functions. Also warn if there are no non-private
2808 methods, and there's at least one private member function that isn't
2809 a constructor or destructor.
2810
2811 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2812 @opindex Wdelete-non-virtual-dtor
2813 @opindex Wno-delete-non-virtual-dtor
2814 Warn when @code{delete} is used to destroy an instance of a class that
2815 has virtual functions and non-virtual destructor. It is unsafe to delete
2816 an instance of a derived class through a pointer to a base class if the
2817 base class does not have a virtual destructor. This warning is enabled
2818 by @option{-Wall}.
2819
2820 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2821 @opindex Wliteral-suffix
2822 @opindex Wno-literal-suffix
2823 Warn when a string or character literal is followed by a ud-suffix which does
2824 not begin with an underscore. As a conforming extension, GCC treats such
2825 suffixes as separate preprocessing tokens in order to maintain backwards
2826 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2827 For example:
2828
2829 @smallexample
2830 #define __STDC_FORMAT_MACROS
2831 #include <inttypes.h>
2832 #include <stdio.h>
2833
2834 int main() @{
2835 int64_t i64 = 123;
2836 printf("My int64: %" PRId64"\n", i64);
2837 @}
2838 @end smallexample
2839
2840 In this case, @code{PRId64} is treated as a separate preprocessing token.
2841
2842 This warning is enabled by default.
2843
2844 @item -Wlto-type-mismatch
2845 @opindex Wlto-type-mismatch
2846 @opindex Wno-lto-type-mismatch
2847
2848 During the link-time optimization warn about type mismatches in
2849 global declarations from different compilation units.
2850 Requires @option{-flto} to be enabled. Enabled by default.
2851
2852 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2853 @opindex Wnarrowing
2854 @opindex Wno-narrowing
2855 With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing
2856 conversion prohibited by C++11 occurs within
2857 @samp{@{ @}}, e.g.
2858
2859 @smallexample
2860 int i = @{ 2.2 @}; // error: narrowing from double to int
2861 @end smallexample
2862
2863 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2864
2865 When a later standard is in effect, e.g. when using @option{-std=c++11},
2866 narrowing conversions are diagnosed by default, as required by the standard.
2867 A narrowing conversion from a constant produces an error,
2868 and a narrowing conversion from a non-constant produces a warning,
2869 but @option{-Wno-narrowing} suppresses the diagnostic.
2870 Note that this does not affect the meaning of well-formed code;
2871 narrowing conversions are still considered ill-formed in SFINAE contexts.
2872
2873 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2874 @opindex Wnoexcept
2875 @opindex Wno-noexcept
2876 Warn when a noexcept-expression evaluates to false because of a call
2877 to a function that does not have a non-throwing exception
2878 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2879 the compiler to never throw an exception.
2880
2881 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2882 @opindex Wnon-virtual-dtor
2883 @opindex Wno-non-virtual-dtor
2884 Warn when a class has virtual functions and an accessible non-virtual
2885 destructor itself or in an accessible polymorphic base class, in which
2886 case it is possible but unsafe to delete an instance of a derived
2887 class through a pointer to the class itself or base class. This
2888 warning is automatically enabled if @option{-Weffc++} is specified.
2889
2890 @item -Wregister @r{(C++ and Objective-C++ only)}
2891 @opindex Wregister
2892 @opindex Wno-register
2893 Warn on uses of the @code{register} storage class specifier, except
2894 when it is part of the GNU @ref{Explicit Register Variables} extension.
2895 The use of the @code{register} keyword as storage class specifier has
2896 been deprecated in C++11 and removed in C++17.
2897 Enabled by default with @option{-std=c++1z}.
2898
2899 @item -Wreorder @r{(C++ and Objective-C++ only)}
2900 @opindex Wreorder
2901 @opindex Wno-reorder
2902 @cindex reordering, warning
2903 @cindex warning for reordering of member initializers
2904 Warn when the order of member initializers given in the code does not
2905 match the order in which they must be executed. For instance:
2906
2907 @smallexample
2908 struct A @{
2909 int i;
2910 int j;
2911 A(): j (0), i (1) @{ @}
2912 @};
2913 @end smallexample
2914
2915 @noindent
2916 The compiler rearranges the member initializers for @code{i}
2917 and @code{j} to match the declaration order of the members, emitting
2918 a warning to that effect. This warning is enabled by @option{-Wall}.
2919
2920 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2921 @opindex fext-numeric-literals
2922 @opindex fno-ext-numeric-literals
2923 Accept imaginary, fixed-point, or machine-defined
2924 literal number suffixes as GNU extensions.
2925 When this option is turned off these suffixes are treated
2926 as C++11 user-defined literal numeric suffixes.
2927 This is on by default for all pre-C++11 dialects and all GNU dialects:
2928 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2929 @option{-std=gnu++14}.
2930 This option is off by default
2931 for ISO C++11 onwards (@option{-std=c++11}, ...).
2932 @end table
2933
2934 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2935
2936 @table @gcctabopt
2937 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2938 @opindex Weffc++
2939 @opindex Wno-effc++
2940 Warn about violations of the following style guidelines from Scott Meyers'
2941 @cite{Effective C++} series of books:
2942
2943 @itemize @bullet
2944 @item
2945 Define a copy constructor and an assignment operator for classes
2946 with dynamically-allocated memory.
2947
2948 @item
2949 Prefer initialization to assignment in constructors.
2950
2951 @item
2952 Have @code{operator=} return a reference to @code{*this}.
2953
2954 @item
2955 Don't try to return a reference when you must return an object.
2956
2957 @item
2958 Distinguish between prefix and postfix forms of increment and
2959 decrement operators.
2960
2961 @item
2962 Never overload @code{&&}, @code{||}, or @code{,}.
2963
2964 @end itemize
2965
2966 This option also enables @option{-Wnon-virtual-dtor}, which is also
2967 one of the effective C++ recommendations. However, the check is
2968 extended to warn about the lack of virtual destructor in accessible
2969 non-polymorphic bases classes too.
2970
2971 When selecting this option, be aware that the standard library
2972 headers do not obey all of these guidelines; use @samp{grep -v}
2973 to filter out those warnings.
2974
2975 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2976 @opindex Wstrict-null-sentinel
2977 @opindex Wno-strict-null-sentinel
2978 Warn about the use of an uncasted @code{NULL} as sentinel. When
2979 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2980 to @code{__null}. Although it is a null pointer constant rather than a
2981 null pointer, it is guaranteed to be of the same size as a pointer.
2982 But this use is not portable across different compilers.
2983
2984 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2985 @opindex Wno-non-template-friend
2986 @opindex Wnon-template-friend
2987 Disable warnings when non-templatized friend functions are declared
2988 within a template. Since the advent of explicit template specification
2989 support in G++, if the name of the friend is an unqualified-id (i.e.,
2990 @samp{friend foo(int)}), the C++ language specification demands that the
2991 friend declare or define an ordinary, nontemplate function. (Section
2992 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2993 could be interpreted as a particular specialization of a templatized
2994 function. Because this non-conforming behavior is no longer the default
2995 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2996 check existing code for potential trouble spots and is on by default.
2997 This new compiler behavior can be turned off with
2998 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2999 but disables the helpful warning.
3000
3001 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3002 @opindex Wold-style-cast
3003 @opindex Wno-old-style-cast
3004 Warn if an old-style (C-style) cast to a non-void type is used within
3005 a C++ program. The new-style casts (@code{dynamic_cast},
3006 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3007 less vulnerable to unintended effects and much easier to search for.
3008
3009 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3010 @opindex Woverloaded-virtual
3011 @opindex Wno-overloaded-virtual
3012 @cindex overloaded virtual function, warning
3013 @cindex warning for overloaded virtual function
3014 Warn when a function declaration hides virtual functions from a
3015 base class. For example, in:
3016
3017 @smallexample
3018 struct A @{
3019 virtual void f();
3020 @};
3021
3022 struct B: public A @{
3023 void f(int);
3024 @};
3025 @end smallexample
3026
3027 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3028 like:
3029
3030 @smallexample
3031 B* b;
3032 b->f();
3033 @end smallexample
3034
3035 @noindent
3036 fails to compile.
3037
3038 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3039 @opindex Wno-pmf-conversions
3040 @opindex Wpmf-conversions
3041 Disable the diagnostic for converting a bound pointer to member function
3042 to a plain pointer.
3043
3044 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3045 @opindex Wsign-promo
3046 @opindex Wno-sign-promo
3047 Warn when overload resolution chooses a promotion from unsigned or
3048 enumerated type to a signed type, over a conversion to an unsigned type of
3049 the same size. Previous versions of G++ tried to preserve
3050 unsignedness, but the standard mandates the current behavior.
3051
3052 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3053 @opindex Wtemplates
3054 Warn when a primary template declaration is encountered. Some coding
3055 rules disallow templates, and this may be used to enforce that rule.
3056 The warning is inactive inside a system header file, such as the STL, so
3057 one can still use the STL. One may also instantiate or specialize
3058 templates.
3059
3060 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3061 @opindex Wmultiple-inheritance
3062 Warn when a class is defined with multiple direct base classes. Some
3063 coding rules disallow multiple inheritance, and this may be used to
3064 enforce that rule. The warning is inactive inside a system header file,
3065 such as the STL, so one can still use the STL. One may also define
3066 classes that indirectly use multiple inheritance.
3067
3068 @item -Wvirtual-inheritance
3069 @opindex Wvirtual-inheritance
3070 Warn when a class is defined with a virtual direct base classe. Some
3071 coding rules disallow multiple inheritance, and this may be used to
3072 enforce that rule. The warning is inactive inside a system header file,
3073 such as the STL, so one can still use the STL. One may also define
3074 classes that indirectly use virtual inheritance.
3075
3076 @item -Wnamespaces
3077 @opindex Wnamespaces
3078 Warn when a namespace definition is opened. Some coding rules disallow
3079 namespaces, and this may be used to enforce that rule. The warning is
3080 inactive inside a system header file, such as the STL, so one can still
3081 use the STL. One may also use using directives and qualified names.
3082
3083 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3084 @opindex Wterminate
3085 @opindex Wno-terminate
3086 Disable the warning about a throw-expression that will immediately
3087 result in a call to @code{terminate}.
3088 @end table
3089
3090 @node Objective-C and Objective-C++ Dialect Options
3091 @section Options Controlling Objective-C and Objective-C++ Dialects
3092
3093 @cindex compiler options, Objective-C and Objective-C++
3094 @cindex Objective-C and Objective-C++ options, command-line
3095 @cindex options, Objective-C and Objective-C++
3096 (NOTE: This manual does not describe the Objective-C and Objective-C++
3097 languages themselves. @xref{Standards,,Language Standards
3098 Supported by GCC}, for references.)
3099
3100 This section describes the command-line options that are only meaningful
3101 for Objective-C and Objective-C++ programs. You can also use most of
3102 the language-independent GNU compiler options.
3103 For example, you might compile a file @file{some_class.m} like this:
3104
3105 @smallexample
3106 gcc -g -fgnu-runtime -O -c some_class.m
3107 @end smallexample
3108
3109 @noindent
3110 In this example, @option{-fgnu-runtime} is an option meant only for
3111 Objective-C and Objective-C++ programs; you can use the other options with
3112 any language supported by GCC@.
3113
3114 Note that since Objective-C is an extension of the C language, Objective-C
3115 compilations may also use options specific to the C front-end (e.g.,
3116 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3117 C++-specific options (e.g., @option{-Wabi}).
3118
3119 Here is a list of options that are @emph{only} for compiling Objective-C
3120 and Objective-C++ programs:
3121
3122 @table @gcctabopt
3123 @item -fconstant-string-class=@var{class-name}
3124 @opindex fconstant-string-class
3125 Use @var{class-name} as the name of the class to instantiate for each
3126 literal string specified with the syntax @code{@@"@dots{}"}. The default
3127 class name is @code{NXConstantString} if the GNU runtime is being used, and
3128 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3129 @option{-fconstant-cfstrings} option, if also present, overrides the
3130 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3131 to be laid out as constant CoreFoundation strings.
3132
3133 @item -fgnu-runtime
3134 @opindex fgnu-runtime
3135 Generate object code compatible with the standard GNU Objective-C
3136 runtime. This is the default for most types of systems.
3137
3138 @item -fnext-runtime
3139 @opindex fnext-runtime
3140 Generate output compatible with the NeXT runtime. This is the default
3141 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3142 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3143 used.
3144
3145 @item -fno-nil-receivers
3146 @opindex fno-nil-receivers
3147 Assume that all Objective-C message dispatches (@code{[receiver
3148 message:arg]}) in this translation unit ensure that the receiver is
3149 not @code{nil}. This allows for more efficient entry points in the
3150 runtime to be used. This option is only available in conjunction with
3151 the NeXT runtime and ABI version 0 or 1.
3152
3153 @item -fobjc-abi-version=@var{n}
3154 @opindex fobjc-abi-version
3155 Use version @var{n} of the Objective-C ABI for the selected runtime.
3156 This option is currently supported only for the NeXT runtime. In that
3157 case, Version 0 is the traditional (32-bit) ABI without support for
3158 properties and other Objective-C 2.0 additions. Version 1 is the
3159 traditional (32-bit) ABI with support for properties and other
3160 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3161 nothing is specified, the default is Version 0 on 32-bit target
3162 machines, and Version 2 on 64-bit target machines.
3163
3164 @item -fobjc-call-cxx-cdtors
3165 @opindex fobjc-call-cxx-cdtors
3166 For each Objective-C class, check if any of its instance variables is a
3167 C++ object with a non-trivial default constructor. If so, synthesize a
3168 special @code{- (id) .cxx_construct} instance method which runs
3169 non-trivial default constructors on any such instance variables, in order,
3170 and then return @code{self}. Similarly, check if any instance variable
3171 is a C++ object with a non-trivial destructor, and if so, synthesize a
3172 special @code{- (void) .cxx_destruct} method which runs
3173 all such default destructors, in reverse order.
3174
3175 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3176 methods thusly generated only operate on instance variables
3177 declared in the current Objective-C class, and not those inherited
3178 from superclasses. It is the responsibility of the Objective-C
3179 runtime to invoke all such methods in an object's inheritance
3180 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3181 by the runtime immediately after a new object instance is allocated;
3182 the @code{- (void) .cxx_destruct} methods are invoked immediately
3183 before the runtime deallocates an object instance.
3184
3185 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3186 support for invoking the @code{- (id) .cxx_construct} and
3187 @code{- (void) .cxx_destruct} methods.
3188
3189 @item -fobjc-direct-dispatch
3190 @opindex fobjc-direct-dispatch
3191 Allow fast jumps to the message dispatcher. On Darwin this is
3192 accomplished via the comm page.
3193
3194 @item -fobjc-exceptions
3195 @opindex fobjc-exceptions
3196 Enable syntactic support for structured exception handling in
3197 Objective-C, similar to what is offered by C++. This option
3198 is required to use the Objective-C keywords @code{@@try},
3199 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3200 @code{@@synchronized}. This option is available with both the GNU
3201 runtime and the NeXT runtime (but not available in conjunction with
3202 the NeXT runtime on Mac OS X 10.2 and earlier).
3203
3204 @item -fobjc-gc
3205 @opindex fobjc-gc
3206 Enable garbage collection (GC) in Objective-C and Objective-C++
3207 programs. This option is only available with the NeXT runtime; the
3208 GNU runtime has a different garbage collection implementation that
3209 does not require special compiler flags.
3210
3211 @item -fobjc-nilcheck
3212 @opindex fobjc-nilcheck
3213 For the NeXT runtime with version 2 of the ABI, check for a nil
3214 receiver in method invocations before doing the actual method call.
3215 This is the default and can be disabled using
3216 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3217 checked for nil in this way no matter what this flag is set to.
3218 Currently this flag does nothing when the GNU runtime, or an older
3219 version of the NeXT runtime ABI, is used.
3220
3221 @item -fobjc-std=objc1
3222 @opindex fobjc-std
3223 Conform to the language syntax of Objective-C 1.0, the language
3224 recognized by GCC 4.0. This only affects the Objective-C additions to
3225 the C/C++ language; it does not affect conformance to C/C++ standards,
3226 which is controlled by the separate C/C++ dialect option flags. When
3227 this option is used with the Objective-C or Objective-C++ compiler,
3228 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3229 This is useful if you need to make sure that your Objective-C code can
3230 be compiled with older versions of GCC@.
3231
3232 @item -freplace-objc-classes
3233 @opindex freplace-objc-classes
3234 Emit a special marker instructing @command{ld(1)} not to statically link in
3235 the resulting object file, and allow @command{dyld(1)} to load it in at
3236 run time instead. This is used in conjunction with the Fix-and-Continue
3237 debugging mode, where the object file in question may be recompiled and
3238 dynamically reloaded in the course of program execution, without the need
3239 to restart the program itself. Currently, Fix-and-Continue functionality
3240 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3241 and later.
3242
3243 @item -fzero-link
3244 @opindex fzero-link
3245 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3246 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3247 compile time) with static class references that get initialized at load time,
3248 which improves run-time performance. Specifying the @option{-fzero-link} flag
3249 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3250 to be retained. This is useful in Zero-Link debugging mode, since it allows
3251 for individual class implementations to be modified during program execution.
3252 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3253 regardless of command-line options.
3254
3255 @item -fno-local-ivars
3256 @opindex fno-local-ivars
3257 @opindex flocal-ivars
3258 By default instance variables in Objective-C can be accessed as if
3259 they were local variables from within the methods of the class they're
3260 declared in. This can lead to shadowing between instance variables
3261 and other variables declared either locally inside a class method or
3262 globally with the same name. Specifying the @option{-fno-local-ivars}
3263 flag disables this behavior thus avoiding variable shadowing issues.
3264
3265 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3266 @opindex fivar-visibility
3267 Set the default instance variable visibility to the specified option
3268 so that instance variables declared outside the scope of any access
3269 modifier directives default to the specified visibility.
3270
3271 @item -gen-decls
3272 @opindex gen-decls
3273 Dump interface declarations for all classes seen in the source file to a
3274 file named @file{@var{sourcename}.decl}.
3275
3276 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3277 @opindex Wassign-intercept
3278 @opindex Wno-assign-intercept
3279 Warn whenever an Objective-C assignment is being intercepted by the
3280 garbage collector.
3281
3282 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3283 @opindex Wno-protocol
3284 @opindex Wprotocol
3285 If a class is declared to implement a protocol, a warning is issued for
3286 every method in the protocol that is not implemented by the class. The
3287 default behavior is to issue a warning for every method not explicitly
3288 implemented in the class, even if a method implementation is inherited
3289 from the superclass. If you use the @option{-Wno-protocol} option, then
3290 methods inherited from the superclass are considered to be implemented,
3291 and no warning is issued for them.
3292
3293 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3294 @opindex Wselector
3295 @opindex Wno-selector
3296 Warn if multiple methods of different types for the same selector are
3297 found during compilation. The check is performed on the list of methods
3298 in the final stage of compilation. Additionally, a check is performed
3299 for each selector appearing in a @code{@@selector(@dots{})}
3300 expression, and a corresponding method for that selector has been found
3301 during compilation. Because these checks scan the method table only at
3302 the end of compilation, these warnings are not produced if the final
3303 stage of compilation is not reached, for example because an error is
3304 found during compilation, or because the @option{-fsyntax-only} option is
3305 being used.
3306
3307 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3308 @opindex Wstrict-selector-match
3309 @opindex Wno-strict-selector-match
3310 Warn if multiple methods with differing argument and/or return types are
3311 found for a given selector when attempting to send a message using this
3312 selector to a receiver of type @code{id} or @code{Class}. When this flag
3313 is off (which is the default behavior), the compiler omits such warnings
3314 if any differences found are confined to types that share the same size
3315 and alignment.
3316
3317 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3318 @opindex Wundeclared-selector
3319 @opindex Wno-undeclared-selector
3320 Warn if a @code{@@selector(@dots{})} expression referring to an
3321 undeclared selector is found. A selector is considered undeclared if no
3322 method with that name has been declared before the
3323 @code{@@selector(@dots{})} expression, either explicitly in an
3324 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3325 an @code{@@implementation} section. This option always performs its
3326 checks as soon as a @code{@@selector(@dots{})} expression is found,
3327 while @option{-Wselector} only performs its checks in the final stage of
3328 compilation. This also enforces the coding style convention
3329 that methods and selectors must be declared before being used.
3330
3331 @item -print-objc-runtime-info
3332 @opindex print-objc-runtime-info
3333 Generate C header describing the largest structure that is passed by
3334 value, if any.
3335
3336 @end table
3337
3338 @node Diagnostic Message Formatting Options
3339 @section Options to Control Diagnostic Messages Formatting
3340 @cindex options to control diagnostics formatting
3341 @cindex diagnostic messages
3342 @cindex message formatting
3343
3344 Traditionally, diagnostic messages have been formatted irrespective of
3345 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3346 options described below
3347 to control the formatting algorithm for diagnostic messages,
3348 e.g.@: how many characters per line, how often source location
3349 information should be reported. Note that some language front ends may not
3350 honor these options.
3351
3352 @table @gcctabopt
3353 @item -fmessage-length=@var{n}
3354 @opindex fmessage-length
3355 Try to format error messages so that they fit on lines of about
3356 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3357 done; each error message appears on a single line. This is the
3358 default for all front ends.
3359
3360 @item -fdiagnostics-show-location=once
3361 @opindex fdiagnostics-show-location
3362 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3363 reporter to emit source location information @emph{once}; that is, in
3364 case the message is too long to fit on a single physical line and has to
3365 be wrapped, the source location won't be emitted (as prefix) again,
3366 over and over, in subsequent continuation lines. This is the default
3367 behavior.
3368
3369 @item -fdiagnostics-show-location=every-line
3370 Only meaningful in line-wrapping mode. Instructs the diagnostic
3371 messages reporter to emit the same source location information (as
3372 prefix) for physical lines that result from the process of breaking
3373 a message which is too long to fit on a single line.
3374
3375 @item -fdiagnostics-color[=@var{WHEN}]
3376 @itemx -fno-diagnostics-color
3377 @opindex fdiagnostics-color
3378 @cindex highlight, color
3379 @vindex GCC_COLORS @r{environment variable}
3380 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3381 or @samp{auto}. The default depends on how the compiler has been configured,
3382 it can be any of the above @var{WHEN} options or also @samp{never}
3383 if @env{GCC_COLORS} environment variable isn't present in the environment,
3384 and @samp{auto} otherwise.
3385 @samp{auto} means to use color only when the standard error is a terminal.
3386 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3387 aliases for @option{-fdiagnostics-color=always} and
3388 @option{-fdiagnostics-color=never}, respectively.
3389
3390 The colors are defined by the environment variable @env{GCC_COLORS}.
3391 Its value is a colon-separated list of capabilities and Select Graphic
3392 Rendition (SGR) substrings. SGR commands are interpreted by the
3393 terminal or terminal emulator. (See the section in the documentation
3394 of your text terminal for permitted values and their meanings as
3395 character attributes.) These substring values are integers in decimal
3396 representation and can be concatenated with semicolons.
3397 Common values to concatenate include
3398 @samp{1} for bold,
3399 @samp{4} for underline,
3400 @samp{5} for blink,
3401 @samp{7} for inverse,
3402 @samp{39} for default foreground color,
3403 @samp{30} to @samp{37} for foreground colors,
3404 @samp{90} to @samp{97} for 16-color mode foreground colors,
3405 @samp{38;5;0} to @samp{38;5;255}
3406 for 88-color and 256-color modes foreground colors,
3407 @samp{49} for default background color,
3408 @samp{40} to @samp{47} for background colors,
3409 @samp{100} to @samp{107} for 16-color mode background colors,
3410 and @samp{48;5;0} to @samp{48;5;255}
3411 for 88-color and 256-color modes background colors.
3412
3413 The default @env{GCC_COLORS} is
3414 @smallexample
3415 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:quote=01:\
3416 fixit-insert=32:fixit-delete=31:\
3417 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32
3418 @end smallexample
3419 @noindent
3420 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3421 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3422 @samp{01} is bold, and @samp{31} is red.
3423 Setting @env{GCC_COLORS} to the empty string disables colors.
3424 Supported capabilities are as follows.
3425
3426 @table @code
3427 @item error=
3428 @vindex error GCC_COLORS @r{capability}
3429 SGR substring for error: markers.
3430
3431 @item warning=
3432 @vindex warning GCC_COLORS @r{capability}
3433 SGR substring for warning: markers.
3434
3435 @item note=
3436 @vindex note GCC_COLORS @r{capability}
3437 SGR substring for note: markers.
3438
3439 @item range1=
3440 @vindex range1 GCC_COLORS @r{capability}
3441 SGR substring for first additional range.
3442
3443 @item range2=
3444 @vindex range2 GCC_COLORS @r{capability}
3445 SGR substring for second additional range.
3446
3447 @item locus=
3448 @vindex locus GCC_COLORS @r{capability}
3449 SGR substring for location information, @samp{file:line} or
3450 @samp{file:line:column} etc.
3451
3452 @item quote=
3453 @vindex quote GCC_COLORS @r{capability}
3454 SGR substring for information printed within quotes.
3455
3456 @item fixit-insert=
3457 @vindex fixit-insert GCC_COLORS @r{capability}
3458 SGR substring for fix-it hints suggesting text to
3459 be inserted or replaced.
3460
3461 @item fixit-delete=
3462 @vindex fixit-delete GCC_COLORS @r{capability}
3463 SGR substring for fix-it hints suggesting text to
3464 be deleted.
3465
3466 @item diff-filename=
3467 @vindex diff-filename GCC_COLORS @r{capability}
3468 SGR substring for filename headers within generated patches.
3469
3470 @item diff-hunk=
3471 @vindex diff-hunk GCC_COLORS @r{capability}
3472 SGR substring for the starts of hunks within generated patches.
3473
3474 @item diff-delete=
3475 @vindex diff-delete GCC_COLORS @r{capability}
3476 SGR substring for deleted lines within generated patches.
3477
3478 @item diff-insert=
3479 @vindex diff-insert GCC_COLORS @r{capability}
3480 SGR substring for inserted lines within generated patches.
3481 @end table
3482
3483 @item -fno-diagnostics-show-option
3484 @opindex fno-diagnostics-show-option
3485 @opindex fdiagnostics-show-option
3486 By default, each diagnostic emitted includes text indicating the
3487 command-line option that directly controls the diagnostic (if such an
3488 option is known to the diagnostic machinery). Specifying the
3489 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3490
3491 @item -fno-diagnostics-show-caret
3492 @opindex fno-diagnostics-show-caret
3493 @opindex fdiagnostics-show-caret
3494 By default, each diagnostic emitted includes the original source line
3495 and a caret @samp{^} indicating the column. This option suppresses this
3496 information. The source line is truncated to @var{n} characters, if
3497 the @option{-fmessage-length=n} option is given. When the output is done
3498 to the terminal, the width is limited to the width given by the
3499 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3500
3501 @item -fdiagnostics-parseable-fixits
3502 @opindex fdiagnostics-parseable-fixits
3503 Emit fix-it hints in a machine-parseable format, suitable for consumption
3504 by IDEs. For each fix-it, a line will be printed after the relevant
3505 diagnostic, starting with the string ``fix-it:''. For example:
3506
3507 @smallexample
3508 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3509 @end smallexample
3510
3511 The location is expressed as a half-open range, expressed as a count of
3512 bytes, starting at byte 1 for the initial column. In the above example,
3513 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3514 given string:
3515
3516 @smallexample
3517 00000000011111111112222222222
3518 12345678901234567890123456789
3519 gtk_widget_showall (dlg);
3520 ^^^^^^^^^^^^^^^^^^
3521 gtk_widget_show_all
3522 @end smallexample
3523
3524 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3525 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3526 (e.g. vertical tab as ``\013'').
3527
3528 An empty replacement string indicates that the given range is to be removed.
3529 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3530 be inserted at the given position.
3531
3532 @item -fdiagnostics-generate-patch
3533 @opindex fdiagnostics-generate-patch
3534 Print fix-it hints to stderr in unified diff format, after any diagnostics
3535 are printed. For example:
3536
3537 @smallexample
3538 --- test.c
3539 +++ test.c
3540 @@ -42,5 +42,5 @@
3541
3542 void show_cb(GtkDialog *dlg)
3543 @{
3544 - gtk_widget_showall(dlg);
3545 + gtk_widget_show_all(dlg);
3546 @}
3547
3548 @end smallexample
3549
3550 The diff may or may not be colorized, following the same rules
3551 as for diagnostics (see @option{-fdiagnostics-color}).
3552
3553 @end table
3554
3555 @node Warning Options
3556 @section Options to Request or Suppress Warnings
3557 @cindex options to control warnings
3558 @cindex warning messages
3559 @cindex messages, warning
3560 @cindex suppressing warnings
3561
3562 Warnings are diagnostic messages that report constructions that
3563 are not inherently erroneous but that are risky or suggest there
3564 may have been an error.
3565
3566 The following language-independent options do not enable specific
3567 warnings but control the kinds of diagnostics produced by GCC@.
3568
3569 @table @gcctabopt
3570 @cindex syntax checking
3571 @item -fsyntax-only
3572 @opindex fsyntax-only
3573 Check the code for syntax errors, but don't do anything beyond that.
3574
3575 @item -fmax-errors=@var{n}
3576 @opindex fmax-errors
3577 Limits the maximum number of error messages to @var{n}, at which point
3578 GCC bails out rather than attempting to continue processing the source
3579 code. If @var{n} is 0 (the default), there is no limit on the number
3580 of error messages produced. If @option{-Wfatal-errors} is also
3581 specified, then @option{-Wfatal-errors} takes precedence over this
3582 option.
3583
3584 @item -w
3585 @opindex w
3586 Inhibit all warning messages.
3587
3588 @item -Werror
3589 @opindex Werror
3590 @opindex Wno-error
3591 Make all warnings into errors.
3592
3593 @item -Werror=
3594 @opindex Werror=
3595 @opindex Wno-error=
3596 Make the specified warning into an error. The specifier for a warning
3597 is appended; for example @option{-Werror=switch} turns the warnings
3598 controlled by @option{-Wswitch} into errors. This switch takes a
3599 negative form, to be used to negate @option{-Werror} for specific
3600 warnings; for example @option{-Wno-error=switch} makes
3601 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3602 is in effect.
3603
3604 The warning message for each controllable warning includes the
3605 option that controls the warning. That option can then be used with
3606 @option{-Werror=} and @option{-Wno-error=} as described above.
3607 (Printing of the option in the warning message can be disabled using the
3608 @option{-fno-diagnostics-show-option} flag.)
3609
3610 Note that specifying @option{-Werror=}@var{foo} automatically implies
3611 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3612 imply anything.
3613
3614 @item -Wfatal-errors
3615 @opindex Wfatal-errors
3616 @opindex Wno-fatal-errors
3617 This option causes the compiler to abort compilation on the first error
3618 occurred rather than trying to keep going and printing further error
3619 messages.
3620
3621 @end table
3622
3623 You can request many specific warnings with options beginning with
3624 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3625 implicit declarations. Each of these specific warning options also
3626 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3627 example, @option{-Wno-implicit}. This manual lists only one of the
3628 two forms, whichever is not the default. For further
3629 language-specific options also refer to @ref{C++ Dialect Options} and
3630 @ref{Objective-C and Objective-C++ Dialect Options}.
3631
3632 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3633 options, such as @option{-Wunused}, which may turn on further options,
3634 such as @option{-Wunused-value}. The combined effect of positive and
3635 negative forms is that more specific options have priority over less
3636 specific ones, independently of their position in the command-line. For
3637 options of the same specificity, the last one takes effect. Options
3638 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3639 as if they appeared at the end of the command-line.
3640
3641 When an unrecognized warning option is requested (e.g.,
3642 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3643 that the option is not recognized. However, if the @option{-Wno-} form
3644 is used, the behavior is slightly different: no diagnostic is
3645 produced for @option{-Wno-unknown-warning} unless other diagnostics
3646 are being produced. This allows the use of new @option{-Wno-} options
3647 with old compilers, but if something goes wrong, the compiler
3648 warns that an unrecognized option is present.
3649
3650 @table @gcctabopt
3651 @item -Wpedantic
3652 @itemx -pedantic
3653 @opindex pedantic
3654 @opindex Wpedantic
3655 Issue all the warnings demanded by strict ISO C and ISO C++;
3656 reject all programs that use forbidden extensions, and some other
3657 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3658 version of the ISO C standard specified by any @option{-std} option used.
3659
3660 Valid ISO C and ISO C++ programs should compile properly with or without
3661 this option (though a rare few require @option{-ansi} or a
3662 @option{-std} option specifying the required version of ISO C)@. However,
3663 without this option, certain GNU extensions and traditional C and C++
3664 features are supported as well. With this option, they are rejected.
3665
3666 @option{-Wpedantic} does not cause warning messages for use of the
3667 alternate keywords whose names begin and end with @samp{__}. Pedantic
3668 warnings are also disabled in the expression that follows
3669 @code{__extension__}. However, only system header files should use
3670 these escape routes; application programs should avoid them.
3671 @xref{Alternate Keywords}.
3672
3673 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3674 C conformance. They soon find that it does not do quite what they want:
3675 it finds some non-ISO practices, but not all---only those for which
3676 ISO C @emph{requires} a diagnostic, and some others for which
3677 diagnostics have been added.
3678
3679 A feature to report any failure to conform to ISO C might be useful in
3680 some instances, but would require considerable additional work and would
3681 be quite different from @option{-Wpedantic}. We don't have plans to
3682 support such a feature in the near future.
3683
3684 Where the standard specified with @option{-std} represents a GNU
3685 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3686 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3687 extended dialect is based. Warnings from @option{-Wpedantic} are given
3688 where they are required by the base standard. (It does not make sense
3689 for such warnings to be given only for features not in the specified GNU
3690 C dialect, since by definition the GNU dialects of C include all
3691 features the compiler supports with the given option, and there would be
3692 nothing to warn about.)
3693
3694 @item -pedantic-errors
3695 @opindex pedantic-errors
3696 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3697 requires a diagnostic, in some cases where there is undefined behavior
3698 at compile-time and in some other cases that do not prevent compilation
3699 of programs that are valid according to the standard. This is not
3700 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3701 by this option and not enabled by the latter and vice versa.
3702
3703 @item -Wall
3704 @opindex Wall
3705 @opindex Wno-all
3706 This enables all the warnings about constructions that some users
3707 consider questionable, and that are easy to avoid (or modify to
3708 prevent the warning), even in conjunction with macros. This also
3709 enables some language-specific warnings described in @ref{C++ Dialect
3710 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3711
3712 @option{-Wall} turns on the following warning flags:
3713
3714 @gccoptlist{-Waddress @gol
3715 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3716 -Wbool-compare @gol
3717 -Wbool-operation @gol
3718 -Wc++11-compat -Wc++14-compat@gol
3719 -Wchar-subscripts @gol
3720 -Wcomment @gol
3721 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3722 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3723 -Wformat @gol
3724 -Wint-in-bool-context @gol
3725 -Wimplicit @r{(C and Objective-C only)} @gol
3726 -Wimplicit-int @r{(C and Objective-C only)} @gol
3727 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3728 -Winit-self @r{(only for C++)} @gol
3729 -Wlogical-not-parentheses
3730 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3731 -Wmaybe-uninitialized @gol
3732 -Wmemset-elt-size @gol
3733 -Wmemset-transposed-args @gol
3734 -Wmisleading-indentation @r{(only for C/C++)} @gol
3735 -Wmissing-braces @r{(only for C/ObjC)} @gol
3736 -Wnarrowing @r{(only for C++)} @gol
3737 -Wnonnull @gol
3738 -Wnonnull-compare @gol
3739 -Wopenmp-simd @gol
3740 -Wparentheses @gol
3741 -Wpointer-sign @gol
3742 -Wreorder @gol
3743 -Wreturn-type @gol
3744 -Wsequence-point @gol
3745 -Wsign-compare @r{(only in C++)} @gol
3746 -Wsizeof-pointer-memaccess @gol
3747 -Wstrict-aliasing @gol
3748 -Wstrict-overflow=1 @gol
3749 -Wswitch @gol
3750 -Wtautological-compare @gol
3751 -Wtrigraphs @gol
3752 -Wuninitialized @gol
3753 -Wunknown-pragmas @gol
3754 -Wunused-function @gol
3755 -Wunused-label @gol
3756 -Wunused-value @gol
3757 -Wunused-variable @gol
3758 -Wvolatile-register-var @gol
3759 }
3760
3761 Note that some warning flags are not implied by @option{-Wall}. Some of
3762 them warn about constructions that users generally do not consider
3763 questionable, but which occasionally you might wish to check for;
3764 others warn about constructions that are necessary or hard to avoid in
3765 some cases, and there is no simple way to modify the code to suppress
3766 the warning. Some of them are enabled by @option{-Wextra} but many of
3767 them must be enabled individually.
3768
3769 @item -Wextra
3770 @opindex W
3771 @opindex Wextra
3772 @opindex Wno-extra
3773 This enables some extra warning flags that are not enabled by
3774 @option{-Wall}. (This option used to be called @option{-W}. The older
3775 name is still supported, but the newer name is more descriptive.)
3776
3777 @gccoptlist{-Wclobbered @gol
3778 -Wempty-body @gol
3779 -Wignored-qualifiers @gol
3780 -Wimplicit-fallthrough=3 @gol
3781 -Wmissing-field-initializers @gol
3782 -Wmissing-parameter-type @r{(C only)} @gol
3783 -Wold-style-declaration @r{(C only)} @gol
3784 -Woverride-init @gol
3785 -Wsign-compare @r{(C only)} @gol
3786 -Wtype-limits @gol
3787 -Wuninitialized @gol
3788 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3789 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3790 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3791 }
3792
3793 The option @option{-Wextra} also prints warning messages for the
3794 following cases:
3795
3796 @itemize @bullet
3797
3798 @item
3799 A pointer is compared against integer zero with @code{<}, @code{<=},
3800 @code{>}, or @code{>=}.
3801
3802 @item
3803 (C++ only) An enumerator and a non-enumerator both appear in a
3804 conditional expression.
3805
3806 @item
3807 (C++ only) Ambiguous virtual bases.
3808
3809 @item
3810 (C++ only) Subscripting an array that has been declared @code{register}.
3811
3812 @item
3813 (C++ only) Taking the address of a variable that has been declared
3814 @code{register}.
3815
3816 @item
3817 (C++ only) A base class is not initialized in the copy constructor
3818 of a derived class.
3819
3820 @end itemize
3821
3822 @item -Wchar-subscripts
3823 @opindex Wchar-subscripts
3824 @opindex Wno-char-subscripts
3825 Warn if an array subscript has type @code{char}. This is a common cause
3826 of error, as programmers often forget that this type is signed on some
3827 machines.
3828 This warning is enabled by @option{-Wall}.
3829
3830 @item -Wcomment
3831 @opindex Wcomment
3832 @opindex Wno-comment
3833 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3834 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3835 This warning is enabled by @option{-Wall}.
3836
3837 @item -Wno-coverage-mismatch
3838 @opindex Wno-coverage-mismatch
3839 Warn if feedback profiles do not match when using the
3840 @option{-fprofile-use} option.
3841 If a source file is changed between compiling with @option{-fprofile-gen} and
3842 with @option{-fprofile-use}, the files with the profile feedback can fail
3843 to match the source file and GCC cannot use the profile feedback
3844 information. By default, this warning is enabled and is treated as an
3845 error. @option{-Wno-coverage-mismatch} can be used to disable the
3846 warning or @option{-Wno-error=coverage-mismatch} can be used to
3847 disable the error. Disabling the error for this warning can result in
3848 poorly optimized code and is useful only in the
3849 case of very minor changes such as bug fixes to an existing code-base.
3850 Completely disabling the warning is not recommended.
3851
3852 @item -Wno-cpp
3853 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3854
3855 Suppress warning messages emitted by @code{#warning} directives.
3856
3857 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3858 @opindex Wdouble-promotion
3859 @opindex Wno-double-promotion
3860 Give a warning when a value of type @code{float} is implicitly
3861 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3862 floating-point unit implement @code{float} in hardware, but emulate
3863 @code{double} in software. On such a machine, doing computations
3864 using @code{double} values is much more expensive because of the
3865 overhead required for software emulation.
3866
3867 It is easy to accidentally do computations with @code{double} because
3868 floating-point literals are implicitly of type @code{double}. For
3869 example, in:
3870 @smallexample
3871 @group
3872 float area(float radius)
3873 @{
3874 return 3.14159 * radius * radius;
3875 @}
3876 @end group
3877 @end smallexample
3878 the compiler performs the entire computation with @code{double}
3879 because the floating-point literal is a @code{double}.
3880
3881 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
3882 @opindex Wduplicate-decl-specifier
3883 @opindex Wno-duplicate-decl-specifier
3884 Warn if a declaration has duplicate @code{const}, @code{volatile},
3885 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
3886 @option{-Wall}.
3887
3888 @item -Wformat
3889 @itemx -Wformat=@var{n}
3890 @opindex Wformat
3891 @opindex Wno-format
3892 @opindex ffreestanding
3893 @opindex fno-builtin
3894 @opindex Wformat=
3895 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3896 the arguments supplied have types appropriate to the format string
3897 specified, and that the conversions specified in the format string make
3898 sense. This includes standard functions, and others specified by format
3899 attributes (@pxref{Function Attributes}), in the @code{printf},
3900 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3901 not in the C standard) families (or other target-specific families).
3902 Which functions are checked without format attributes having been
3903 specified depends on the standard version selected, and such checks of
3904 functions without the attribute specified are disabled by
3905 @option{-ffreestanding} or @option{-fno-builtin}.
3906
3907 The formats are checked against the format features supported by GNU
3908 libc version 2.2. These include all ISO C90 and C99 features, as well
3909 as features from the Single Unix Specification and some BSD and GNU
3910 extensions. Other library implementations may not support all these
3911 features; GCC does not support warning about features that go beyond a
3912 particular library's limitations. However, if @option{-Wpedantic} is used
3913 with @option{-Wformat}, warnings are given about format features not
3914 in the selected standard version (but not for @code{strfmon} formats,
3915 since those are not in any version of the C standard). @xref{C Dialect
3916 Options,,Options Controlling C Dialect}.
3917
3918 @table @gcctabopt
3919 @item -Wformat=1
3920 @itemx -Wformat
3921 @opindex Wformat
3922 @opindex Wformat=1
3923 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3924 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3925 @option{-Wformat} also checks for null format arguments for several
3926 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3927 aspects of this level of format checking can be disabled by the
3928 options: @option{-Wno-format-contains-nul},
3929 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3930 @option{-Wformat} is enabled by @option{-Wall}.
3931
3932 @item -Wno-format-contains-nul
3933 @opindex Wno-format-contains-nul
3934 @opindex Wformat-contains-nul
3935 If @option{-Wformat} is specified, do not warn about format strings that
3936 contain NUL bytes.
3937
3938 @item -Wno-format-extra-args
3939 @opindex Wno-format-extra-args
3940 @opindex Wformat-extra-args
3941 If @option{-Wformat} is specified, do not warn about excess arguments to a
3942 @code{printf} or @code{scanf} format function. The C standard specifies
3943 that such arguments are ignored.
3944
3945 Where the unused arguments lie between used arguments that are
3946 specified with @samp{$} operand number specifications, normally
3947 warnings are still given, since the implementation could not know what
3948 type to pass to @code{va_arg} to skip the unused arguments. However,
3949 in the case of @code{scanf} formats, this option suppresses the
3950 warning if the unused arguments are all pointers, since the Single
3951 Unix Specification says that such unused arguments are allowed.
3952
3953 @item -Wformat-length
3954 @itemx -Wformat-length=@var{level}
3955 @opindex Wformat-length
3956 @opindex Wno-format-length
3957 Warn about calls to formatted input/output functions such as @code{sprintf}
3958 that might overflow the destination buffer, or about bounded functions such
3959 as @code{snprintf} that might result in output truncation. When the exact
3960 number of bytes written by a format directive cannot be determined at
3961 compile-time it is estimated based on heuristics that depend on the
3962 @var{level} argument and on optimization. While enabling optimization
3963 will in most cases improve the accuracy of the warning, it may also
3964 result in false positives.
3965
3966 @table @gcctabopt
3967 @item -Wformat-length
3968 @item -Wformat-length=1
3969 @opindex Wformat-length
3970 @opindex Wno-format-length
3971 Level @var{1} of @option{-Wformat-length} enabled by @option{-Wformat}
3972 employs a conservative approach that warns only about calls that most
3973 likely overflow the buffer or result in output truncation. At this
3974 level, numeric arguments to format directives with unknown values are
3975 assumed to have the value of one, and strings of unknown length to be
3976 empty. Numeric arguments that are known to be bounded to a subrange
3977 of their type, or string arguments whose output is bounded either by
3978 their directive's precision or by a finite set of string literals, are
3979 assumed to take on the value within the range that results in the most
3980 bytes on output. For example, the call to @code{sprintf} below is
3981 diagnosed because even with both @var{a} and @var{b} equal to zero,
3982 the terminating NUL character (@code{'\0'}) appended by the function
3983 to the destination buffer will be written past its end. Increasing
3984 the size of the buffer by a single byte is sufficient to avoid the
3985 warning, though it may not be sufficient to avoid the overflow.
3986
3987 @smallexample
3988 void f (int a, int b)
3989 @{
3990 char buf [12];
3991 sprintf (buf, "a = %i, b = %i\n", a, b);
3992 @}
3993 @end smallexample
3994
3995 @item -Wformat-length=2
3996 Level @var{2} warns also about calls that might overflow the destination
3997 buffer or result in truncation given an argument of sufficient length
3998 or magnitude. At level @var{2}, unknown numeric arguments are assumed
3999 to have the minimum representable value for signed types with a precision
4000 greater than 1, and the maximum representable value otherwise. Unknown
4001 string arguments whose length cannot be assumed to be bounded either by
4002 the directive's precision, or by a finite set of string literals they
4003 may evaluate to, or the character array they may point to, are assumed
4004 to be 1 character long.
4005
4006 At level @var{2}, the call in the example above is again diagnosed, but
4007 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4008 @code{%i} directive will write some of its digits beyond the end of
4009 the destination buffer. To make the call safe regardless of the values
4010 of the two variables, the size of the destination buffer must be increased
4011 to at least 34 bytes. GCC includes the minimum size of the buffer in
4012 an informational note following the warning.
4013
4014 An alternative to increasing the size of the destination buffer is to
4015 constrain the range of formatted values. The maximum length of string
4016 arguments can be bounded by specifying the precision in the format
4017 directive. When numeric arguments of format directives can be assumed
4018 to be bounded by less than the precision of their type, choosing
4019 an appropriate length modifier to the format specifier will reduce
4020 the required buffer size. For example, if @var{a} and @var{b} in the
4021 example above can be assumed to be within the precision of
4022 the @code{short int} type then using either the @code{%hi} format
4023 directive or casting the argument to @code{short} reduces the maximum
4024 required size of the buffer to 24 bytes.
4025
4026 @smallexample
4027 void f (int a, int b)
4028 @{
4029 char buf [23];
4030 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4031 @}
4032 @end smallexample
4033 @end table
4034
4035 @item -Wno-format-zero-length
4036 @opindex Wno-format-zero-length
4037 @opindex Wformat-zero-length
4038 If @option{-Wformat} is specified, do not warn about zero-length formats.
4039 The C standard specifies that zero-length formats are allowed.
4040
4041
4042 @item -Wformat=2
4043 @opindex Wformat=2
4044 Enable @option{-Wformat} plus additional format checks. Currently
4045 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4046 -Wformat-y2k}.
4047
4048 @item -Wformat-nonliteral
4049 @opindex Wformat-nonliteral
4050 @opindex Wno-format-nonliteral
4051 If @option{-Wformat} is specified, also warn if the format string is not a
4052 string literal and so cannot be checked, unless the format function
4053 takes its format arguments as a @code{va_list}.
4054
4055 @item -Wformat-security
4056 @opindex Wformat-security
4057 @opindex Wno-format-security
4058 If @option{-Wformat} is specified, also warn about uses of format
4059 functions that represent possible security problems. At present, this
4060 warns about calls to @code{printf} and @code{scanf} functions where the
4061 format string is not a string literal and there are no format arguments,
4062 as in @code{printf (foo);}. This may be a security hole if the format
4063 string came from untrusted input and contains @samp{%n}. (This is
4064 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4065 in future warnings may be added to @option{-Wformat-security} that are not
4066 included in @option{-Wformat-nonliteral}.)
4067
4068 @item -Wformat-signedness
4069 @opindex Wformat-signedness
4070 @opindex Wno-format-signedness
4071 If @option{-Wformat} is specified, also warn if the format string
4072 requires an unsigned argument and the argument is signed and vice versa.
4073
4074 @item -Wformat-y2k
4075 @opindex Wformat-y2k
4076 @opindex Wno-format-y2k
4077 If @option{-Wformat} is specified, also warn about @code{strftime}
4078 formats that may yield only a two-digit year.
4079 @end table
4080
4081 @item -Wnonnull
4082 @opindex Wnonnull
4083 @opindex Wno-nonnull
4084 Warn about passing a null pointer for arguments marked as
4085 requiring a non-null value by the @code{nonnull} function attribute.
4086
4087 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4088 can be disabled with the @option{-Wno-nonnull} option.
4089
4090 @item -Wnonnull-compare
4091 @opindex Wnonnull-compare
4092 @opindex Wno-nonnull-compare
4093 Warn when comparing an argument marked with the @code{nonnull}
4094 function attribute against null inside the function.
4095
4096 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4097 can be disabled with the @option{-Wno-nonnull-compare} option.
4098
4099 @item -Wnull-dereference
4100 @opindex Wnull-dereference
4101 @opindex Wno-null-dereference
4102 Warn if the compiler detects paths that trigger erroneous or
4103 undefined behavior due to dereferencing a null pointer. This option
4104 is only active when @option{-fdelete-null-pointer-checks} is active,
4105 which is enabled by optimizations in most targets. The precision of
4106 the warnings depends on the optimization options used.
4107
4108 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4109 @opindex Winit-self
4110 @opindex Wno-init-self
4111 Warn about uninitialized variables that are initialized with themselves.
4112 Note this option can only be used with the @option{-Wuninitialized} option.
4113
4114 For example, GCC warns about @code{i} being uninitialized in the
4115 following snippet only when @option{-Winit-self} has been specified:
4116 @smallexample
4117 @group
4118 int f()
4119 @{
4120 int i = i;
4121 return i;
4122 @}
4123 @end group
4124 @end smallexample
4125
4126 This warning is enabled by @option{-Wall} in C++.
4127
4128 @item -Wimplicit-int @r{(C and Objective-C only)}
4129 @opindex Wimplicit-int
4130 @opindex Wno-implicit-int
4131 Warn when a declaration does not specify a type.
4132 This warning is enabled by @option{-Wall}.
4133
4134 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4135 @opindex Wimplicit-function-declaration
4136 @opindex Wno-implicit-function-declaration
4137 Give a warning whenever a function is used before being declared. In
4138 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4139 enabled by default and it is made into an error by
4140 @option{-pedantic-errors}. This warning is also enabled by
4141 @option{-Wall}.
4142
4143 @item -Wimplicit @r{(C and Objective-C only)}
4144 @opindex Wimplicit
4145 @opindex Wno-implicit
4146 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4147 This warning is enabled by @option{-Wall}.
4148
4149 @item -Wimplicit-fallthrough
4150 @opindex Wimplicit-fallthrough
4151 @opindex Wno-implicit-fallthrough
4152 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4153 and @option{-Wno-implicit-fallthrough} is the same as
4154 @option{-Wimplicit-fallthrough=0}.
4155
4156 @item -Wimplicit-fallthrough=@var{n}
4157 @opindex Wimplicit-fallthrough=
4158 Warn when a switch case falls through. For example:
4159
4160 @smallexample
4161 @group
4162 switch (cond)
4163 @{
4164 case 1:
4165 a = 1;
4166 break;
4167 case 2:
4168 a = 2;
4169 case 3:
4170 a = 3;
4171 break;
4172 @}
4173 @end group
4174 @end smallexample
4175
4176 This warning does not warn when the last statement of a case cannot
4177 fall through, e.g. when there is a return statement or a call to function
4178 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4179 also takes into account control flow statements, such as ifs, and only
4180 warns when appropriate. E.g.@:
4181
4182 @smallexample
4183 @group
4184 switch (cond)
4185 @{
4186 case 1:
4187 if (i > 3) @{
4188 bar (5);
4189 break;
4190 @} else if (i < 1) @{
4191 bar (0);
4192 @} else
4193 return;
4194 default:
4195 @dots{}
4196 @}
4197 @end group
4198 @end smallexample
4199
4200 Since there are occasions where a switch case fall through is desirable,
4201 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4202 to be used along with a null statement to suppress this warning that
4203 would normally occur:
4204
4205 @smallexample
4206 @group
4207 switch (cond)
4208 @{
4209 case 1:
4210 bar (0);
4211 __attribute__ ((fallthrough));
4212 default:
4213 @dots{}
4214 @}
4215 @end group
4216 @end smallexample
4217
4218 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4219 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4220 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4221 Instead of the these attributes, it is also possible to add a fallthrough
4222 comment to silence the warning. The whole body of the C or C++ style comment
4223 should match the given regular expressions listed below. The option argument
4224 @var{n} specifies what kind of comments are accepted:
4225
4226 @itemize @bullet
4227
4228 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4229
4230 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4231 expression, any comment is used as fallthrough comment.
4232
4233 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4234 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4235
4236 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4237 following regular expressions:
4238
4239 @itemize @bullet
4240
4241 @item @code{-fallthrough}
4242
4243 @item @code{@@fallthrough@@}
4244
4245 @item @code{lint -fallthrough[ \t]*}
4246
4247 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4248
4249 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4250
4251 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4252
4253 @end itemize
4254
4255 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4256 following regular expressions:
4257
4258 @itemize @bullet
4259
4260 @item @code{-fallthrough}
4261
4262 @item @code{@@fallthrough@@}
4263
4264 @item @code{lint -fallthrough[ \t]*}
4265
4266 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4267
4268 @end itemize
4269
4270 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4271 fallthrough comments, only attributes disable the warning.
4272
4273 @end itemize
4274
4275 The comment needs to be followed after optional whitespace and other comments
4276 by @code{case} or @code{default} keywords or by a user label that preceeds some
4277 @code{case} or @code{default} label.
4278
4279 @smallexample
4280 @group
4281 switch (cond)
4282 @{
4283 case 1:
4284 bar (0);
4285 /* FALLTHRU */
4286 default:
4287 @dots{}
4288 @}
4289 @end group
4290 @end smallexample
4291
4292 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4293
4294 @item -Wignored-qualifiers @r{(C and C++ only)}
4295 @opindex Wignored-qualifiers
4296 @opindex Wno-ignored-qualifiers
4297 Warn if the return type of a function has a type qualifier
4298 such as @code{const}. For ISO C such a type qualifier has no effect,
4299 since the value returned by a function is not an lvalue.
4300 For C++, the warning is only emitted for scalar types or @code{void}.
4301 ISO C prohibits qualified @code{void} return types on function
4302 definitions, so such return types always receive a warning
4303 even without this option.
4304
4305 This warning is also enabled by @option{-Wextra}.
4306
4307 @item -Wignored-attributes @r{(C and C++ only)}
4308 @opindex Wignored-attributes
4309 @opindex Wno-ignored-attributes
4310 Warn when an attribute is ignored. This is different from the
4311 @option{-Wattributes} option in that it warns whenever the compiler decides
4312 to drop an attribute, not that the attribute is either unknown, used in a
4313 wrong place, etc. This warning is enabled by default.
4314
4315 @item -Wmain
4316 @opindex Wmain
4317 @opindex Wno-main
4318 Warn if the type of @code{main} is suspicious. @code{main} should be
4319 a function with external linkage, returning int, taking either zero
4320 arguments, two, or three arguments of appropriate types. This warning
4321 is enabled by default in C++ and is enabled by either @option{-Wall}
4322 or @option{-Wpedantic}.
4323
4324 @item -Wmisleading-indentation @r{(C and C++ only)}
4325 @opindex Wmisleading-indentation
4326 @opindex Wno-misleading-indentation
4327 Warn when the indentation of the code does not reflect the block structure.
4328 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4329 @code{for} clauses with a guarded statement that does not use braces,
4330 followed by an unguarded statement with the same indentation.
4331
4332 In the following example, the call to ``bar'' is misleadingly indented as
4333 if it were guarded by the ``if'' conditional.
4334
4335 @smallexample
4336 if (some_condition ())
4337 foo ();
4338 bar (); /* Gotcha: this is not guarded by the "if". */
4339 @end smallexample
4340
4341 In the case of mixed tabs and spaces, the warning uses the
4342 @option{-ftabstop=} option to determine if the statements line up
4343 (defaulting to 8).
4344
4345 The warning is not issued for code involving multiline preprocessor logic
4346 such as the following example.
4347
4348 @smallexample
4349 if (flagA)
4350 foo (0);
4351 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4352 if (flagB)
4353 #endif
4354 foo (1);
4355 @end smallexample
4356
4357 The warning is not issued after a @code{#line} directive, since this
4358 typically indicates autogenerated code, and no assumptions can be made
4359 about the layout of the file that the directive references.
4360
4361 This warning is enabled by @option{-Wall} in C and C++.
4362
4363 @item -Wmissing-braces
4364 @opindex Wmissing-braces
4365 @opindex Wno-missing-braces
4366 Warn if an aggregate or union initializer is not fully bracketed. In
4367 the following example, the initializer for @code{a} is not fully
4368 bracketed, but that for @code{b} is fully bracketed. This warning is
4369 enabled by @option{-Wall} in C.
4370
4371 @smallexample
4372 int a[2][2] = @{ 0, 1, 2, 3 @};
4373 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4374 @end smallexample
4375
4376 This warning is enabled by @option{-Wall}.
4377
4378 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4379 @opindex Wmissing-include-dirs
4380 @opindex Wno-missing-include-dirs
4381 Warn if a user-supplied include directory does not exist.
4382
4383 @item -Wparentheses
4384 @opindex Wparentheses
4385 @opindex Wno-parentheses
4386 Warn if parentheses are omitted in certain contexts, such
4387 as when there is an assignment in a context where a truth value
4388 is expected, or when operators are nested whose precedence people
4389 often get confused about.
4390
4391 Also warn if a comparison like @code{x<=y<=z} appears; this is
4392 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4393 interpretation from that of ordinary mathematical notation.
4394
4395 Also warn for dangerous uses of the GNU extension to
4396 @code{?:} with omitted middle operand. When the condition
4397 in the @code{?}: operator is a boolean expression, the omitted value is
4398 always 1. Often programmers expect it to be a value computed
4399 inside the conditional expression instead.
4400
4401 This warning is enabled by @option{-Wall}.
4402
4403 @item -Wsequence-point
4404 @opindex Wsequence-point
4405 @opindex Wno-sequence-point
4406 Warn about code that may have undefined semantics because of violations
4407 of sequence point rules in the C and C++ standards.
4408
4409 The C and C++ standards define the order in which expressions in a C/C++
4410 program are evaluated in terms of @dfn{sequence points}, which represent
4411 a partial ordering between the execution of parts of the program: those
4412 executed before the sequence point, and those executed after it. These
4413 occur after the evaluation of a full expression (one which is not part
4414 of a larger expression), after the evaluation of the first operand of a
4415 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4416 function is called (but after the evaluation of its arguments and the
4417 expression denoting the called function), and in certain other places.
4418 Other than as expressed by the sequence point rules, the order of
4419 evaluation of subexpressions of an expression is not specified. All
4420 these rules describe only a partial order rather than a total order,
4421 since, for example, if two functions are called within one expression
4422 with no sequence point between them, the order in which the functions
4423 are called is not specified. However, the standards committee have
4424 ruled that function calls do not overlap.
4425
4426 It is not specified when between sequence points modifications to the
4427 values of objects take effect. Programs whose behavior depends on this
4428 have undefined behavior; the C and C++ standards specify that ``Between
4429 the previous and next sequence point an object shall have its stored
4430 value modified at most once by the evaluation of an expression.
4431 Furthermore, the prior value shall be read only to determine the value
4432 to be stored.''. If a program breaks these rules, the results on any
4433 particular implementation are entirely unpredictable.
4434
4435 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4436 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4437 diagnosed by this option, and it may give an occasional false positive
4438 result, but in general it has been found fairly effective at detecting
4439 this sort of problem in programs.
4440
4441 The C++17 standard will define the order of evaluation of operands in
4442 more cases: in particular it requires that the right-hand side of an
4443 assignment be evaluated before the left-hand side, so the above
4444 examples are no longer undefined. But this warning will still warn
4445 about them, to help people avoid writing code that is undefined in C
4446 and earlier revisions of C++.
4447
4448 The standard is worded confusingly, therefore there is some debate
4449 over the precise meaning of the sequence point rules in subtle cases.
4450 Links to discussions of the problem, including proposed formal
4451 definitions, may be found on the GCC readings page, at
4452 @uref{http://gcc.gnu.org/@/readings.html}.
4453
4454 This warning is enabled by @option{-Wall} for C and C++.
4455
4456 @item -Wno-return-local-addr
4457 @opindex Wno-return-local-addr
4458 @opindex Wreturn-local-addr
4459 Do not warn about returning a pointer (or in C++, a reference) to a
4460 variable that goes out of scope after the function returns.
4461
4462 @item -Wreturn-type
4463 @opindex Wreturn-type
4464 @opindex Wno-return-type
4465 Warn whenever a function is defined with a return type that defaults
4466 to @code{int}. Also warn about any @code{return} statement with no
4467 return value in a function whose return type is not @code{void}
4468 (falling off the end of the function body is considered returning
4469 without a value).
4470
4471 For C only, warn about a @code{return} statement with an expression in a
4472 function whose return type is @code{void}, unless the expression type is
4473 also @code{void}. As a GNU extension, the latter case is accepted
4474 without a warning unless @option{-Wpedantic} is used.
4475
4476 For C++, a function without return type always produces a diagnostic
4477 message, even when @option{-Wno-return-type} is specified. The only
4478 exceptions are @code{main} and functions defined in system headers.
4479
4480 This warning is enabled by @option{-Wall}.
4481
4482 @item -Wshift-count-negative
4483 @opindex Wshift-count-negative
4484 @opindex Wno-shift-count-negative
4485 Warn if shift count is negative. This warning is enabled by default.
4486
4487 @item -Wshift-count-overflow
4488 @opindex Wshift-count-overflow
4489 @opindex Wno-shift-count-overflow
4490 Warn if shift count >= width of type. This warning is enabled by default.
4491
4492 @item -Wshift-negative-value
4493 @opindex Wshift-negative-value
4494 @opindex Wno-shift-negative-value
4495 Warn if left shifting a negative value. This warning is enabled by
4496 @option{-Wextra} in C99 and C++11 modes (and newer).
4497
4498 @item -Wshift-overflow
4499 @itemx -Wshift-overflow=@var{n}
4500 @opindex Wshift-overflow
4501 @opindex Wno-shift-overflow
4502 Warn about left shift overflows. This warning is enabled by
4503 default in C99 and C++11 modes (and newer).
4504
4505 @table @gcctabopt
4506 @item -Wshift-overflow=1
4507 This is the warning level of @option{-Wshift-overflow} and is enabled
4508 by default in C99 and C++11 modes (and newer). This warning level does
4509 not warn about left-shifting 1 into the sign bit. (However, in C, such
4510 an overflow is still rejected in contexts where an integer constant expression
4511 is required.)
4512
4513 @item -Wshift-overflow=2
4514 This warning level also warns about left-shifting 1 into the sign bit,
4515 unless C++14 mode is active.
4516 @end table
4517
4518 @item -Wswitch
4519 @opindex Wswitch
4520 @opindex Wno-switch
4521 Warn whenever a @code{switch} statement has an index of enumerated type
4522 and lacks a @code{case} for one or more of the named codes of that
4523 enumeration. (The presence of a @code{default} label prevents this
4524 warning.) @code{case} labels outside the enumeration range also
4525 provoke warnings when this option is used (even if there is a
4526 @code{default} label).
4527 This warning is enabled by @option{-Wall}.
4528
4529 @item -Wswitch-default
4530 @opindex Wswitch-default
4531 @opindex Wno-switch-default
4532 Warn whenever a @code{switch} statement does not have a @code{default}
4533 case.
4534
4535 @item -Wswitch-enum
4536 @opindex Wswitch-enum
4537 @opindex Wno-switch-enum
4538 Warn whenever a @code{switch} statement has an index of enumerated type
4539 and lacks a @code{case} for one or more of the named codes of that
4540 enumeration. @code{case} labels outside the enumeration range also
4541 provoke warnings when this option is used. The only difference
4542 between @option{-Wswitch} and this option is that this option gives a
4543 warning about an omitted enumeration code even if there is a
4544 @code{default} label.
4545
4546 @item -Wswitch-bool
4547 @opindex Wswitch-bool
4548 @opindex Wno-switch-bool
4549 Warn whenever a @code{switch} statement has an index of boolean type
4550 and the case values are outside the range of a boolean type.
4551 It is possible to suppress this warning by casting the controlling
4552 expression to a type other than @code{bool}. For example:
4553 @smallexample
4554 @group
4555 switch ((int) (a == 4))
4556 @{
4557 @dots{}
4558 @}
4559 @end group
4560 @end smallexample
4561 This warning is enabled by default for C and C++ programs.
4562
4563 @item -Wswitch-unreachable
4564 @opindex Wswitch-unreachable
4565 @opindex Wno-switch-unreachable
4566 Warn whenever a @code{switch} statement contains statements between the
4567 controlling expression and the first case label, which will never be
4568 executed. For example:
4569 @smallexample
4570 @group
4571 switch (cond)
4572 @{
4573 i = 15;
4574 @dots{}
4575 case 5:
4576 @dots{}
4577 @}
4578 @end group
4579 @end smallexample
4580 @option{-Wswitch-unreachable} does not warn if the statement between the
4581 controlling expression and the first case label is just a declaration:
4582 @smallexample
4583 @group
4584 switch (cond)
4585 @{
4586 int i;
4587 @dots{}
4588 case 5:
4589 i = 5;
4590 @dots{}
4591 @}
4592 @end group
4593 @end smallexample
4594 This warning is enabled by default for C and C++ programs.
4595
4596 @item -Wsync-nand @r{(C and C++ only)}
4597 @opindex Wsync-nand
4598 @opindex Wno-sync-nand
4599 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4600 built-in functions are used. These functions changed semantics in GCC 4.4.
4601
4602 @item -Wtrigraphs
4603 @opindex Wtrigraphs
4604 @opindex Wno-trigraphs
4605 Warn if any trigraphs are encountered that might change the meaning of
4606 the program (trigraphs within comments are not warned about).
4607 This warning is enabled by @option{-Wall}.
4608
4609 @item -Wunused-but-set-parameter
4610 @opindex Wunused-but-set-parameter
4611 @opindex Wno-unused-but-set-parameter
4612 Warn whenever a function parameter is assigned to, but otherwise unused
4613 (aside from its declaration).
4614
4615 To suppress this warning use the @code{unused} attribute
4616 (@pxref{Variable Attributes}).
4617
4618 This warning is also enabled by @option{-Wunused} together with
4619 @option{-Wextra}.
4620
4621 @item -Wunused-but-set-variable
4622 @opindex Wunused-but-set-variable
4623 @opindex Wno-unused-but-set-variable
4624 Warn whenever a local variable is assigned to, but otherwise unused
4625 (aside from its declaration).
4626 This warning is enabled by @option{-Wall}.
4627
4628 To suppress this warning use the @code{unused} attribute
4629 (@pxref{Variable Attributes}).
4630
4631 This warning is also enabled by @option{-Wunused}, which is enabled
4632 by @option{-Wall}.
4633
4634 @item -Wunused-function
4635 @opindex Wunused-function
4636 @opindex Wno-unused-function
4637 Warn whenever a static function is declared but not defined or a
4638 non-inline static function is unused.
4639 This warning is enabled by @option{-Wall}.
4640
4641 @item -Wunused-label
4642 @opindex Wunused-label
4643 @opindex Wno-unused-label
4644 Warn whenever a label is declared but not used.
4645 This warning is enabled by @option{-Wall}.
4646
4647 To suppress this warning use the @code{unused} attribute
4648 (@pxref{Variable Attributes}).
4649
4650 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4651 @opindex Wunused-local-typedefs
4652 Warn when a typedef locally defined in a function is not used.
4653 This warning is enabled by @option{-Wall}.
4654
4655 @item -Wunused-parameter
4656 @opindex Wunused-parameter
4657 @opindex Wno-unused-parameter
4658 Warn whenever a function parameter is unused aside from its declaration.
4659
4660 To suppress this warning use the @code{unused} attribute
4661 (@pxref{Variable Attributes}).
4662
4663 @item -Wno-unused-result
4664 @opindex Wunused-result
4665 @opindex Wno-unused-result
4666 Do not warn if a caller of a function marked with attribute
4667 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4668 its return value. The default is @option{-Wunused-result}.
4669
4670 @item -Wunused-variable
4671 @opindex Wunused-variable
4672 @opindex Wno-unused-variable
4673 Warn whenever a local or static variable is unused aside from its
4674 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4675 but not for C++. This warning is enabled by @option{-Wall}.
4676
4677 To suppress this warning use the @code{unused} attribute
4678 (@pxref{Variable Attributes}).
4679
4680 @item -Wunused-const-variable
4681 @itemx -Wunused-const-variable=@var{n}
4682 @opindex Wunused-const-variable
4683 @opindex Wno-unused-const-variable
4684 Warn whenever a constant static variable is unused aside from its declaration.
4685 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4686 for C, but not for C++. In C this declares variable storage, but in C++ this
4687 is not an error since const variables take the place of @code{#define}s.
4688
4689 To suppress this warning use the @code{unused} attribute
4690 (@pxref{Variable Attributes}).
4691
4692 @table @gcctabopt
4693 @item -Wunused-const-variable=1
4694 This is the warning level that is enabled by @option{-Wunused-variable} for
4695 C. It warns only about unused static const variables defined in the main
4696 compilation unit, but not about static const variables declared in any
4697 header included.
4698
4699 @item -Wunused-const-variable=2
4700 This warning level also warns for unused constant static variables in
4701 headers (excluding system headers). This is the warning level of
4702 @option{-Wunused-const-variable} and must be explicitly requested since
4703 in C++ this isn't an error and in C it might be harder to clean up all
4704 headers included.
4705 @end table
4706
4707 @item -Wunused-value
4708 @opindex Wunused-value
4709 @opindex Wno-unused-value
4710 Warn whenever a statement computes a result that is explicitly not
4711 used. To suppress this warning cast the unused expression to
4712 @code{void}. This includes an expression-statement or the left-hand
4713 side of a comma expression that contains no side effects. For example,
4714 an expression such as @code{x[i,j]} causes a warning, while
4715 @code{x[(void)i,j]} does not.
4716
4717 This warning is enabled by @option{-Wall}.
4718
4719 @item -Wunused
4720 @opindex Wunused
4721 @opindex Wno-unused
4722 All the above @option{-Wunused} options combined.
4723
4724 In order to get a warning about an unused function parameter, you must
4725 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4726 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4727
4728 @item -Wuninitialized
4729 @opindex Wuninitialized
4730 @opindex Wno-uninitialized
4731 Warn if an automatic variable is used without first being initialized
4732 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4733 warn if a non-static reference or non-static @code{const} member
4734 appears in a class without constructors.
4735
4736 If you want to warn about code that uses the uninitialized value of the
4737 variable in its own initializer, use the @option{-Winit-self} option.
4738
4739 These warnings occur for individual uninitialized or clobbered
4740 elements of structure, union or array variables as well as for
4741 variables that are uninitialized or clobbered as a whole. They do
4742 not occur for variables or elements declared @code{volatile}. Because
4743 these warnings depend on optimization, the exact variables or elements
4744 for which there are warnings depends on the precise optimization
4745 options and version of GCC used.
4746
4747 Note that there may be no warning about a variable that is used only
4748 to compute a value that itself is never used, because such
4749 computations may be deleted by data flow analysis before the warnings
4750 are printed.
4751
4752 @item -Winvalid-memory-model
4753 @opindex Winvalid-memory-model
4754 @opindex Wno-invalid-memory-model
4755 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4756 and the C11 atomic generic functions with a memory consistency argument
4757 that is either invalid for the operation or outside the range of values
4758 of the @code{memory_order} enumeration. For example, since the
4759 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4760 defined for the relaxed, release, and sequentially consistent memory
4761 orders the following code is diagnosed:
4762
4763 @smallexample
4764 void store (int *i)
4765 @{
4766 __atomic_store_n (i, 0, memory_order_consume);
4767 @}
4768 @end smallexample
4769
4770 @option{-Winvalid-memory-model} is enabled by default.
4771
4772 @item -Wmaybe-uninitialized
4773 @opindex Wmaybe-uninitialized
4774 @opindex Wno-maybe-uninitialized
4775 For an automatic variable, if there exists a path from the function
4776 entry to a use of the variable that is initialized, but there exist
4777 some other paths for which the variable is not initialized, the compiler
4778 emits a warning if it cannot prove the uninitialized paths are not
4779 executed at run time. These warnings are made optional because GCC is
4780 not smart enough to see all the reasons why the code might be correct
4781 in spite of appearing to have an error. Here is one example of how
4782 this can happen:
4783
4784 @smallexample
4785 @group
4786 @{
4787 int x;
4788 switch (y)
4789 @{
4790 case 1: x = 1;
4791 break;
4792 case 2: x = 4;
4793 break;
4794 case 3: x = 5;
4795 @}
4796 foo (x);
4797 @}
4798 @end group
4799 @end smallexample
4800
4801 @noindent
4802 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4803 always initialized, but GCC doesn't know this. To suppress the
4804 warning, you need to provide a default case with assert(0) or
4805 similar code.
4806
4807 @cindex @code{longjmp} warnings
4808 This option also warns when a non-volatile automatic variable might be
4809 changed by a call to @code{longjmp}. These warnings as well are possible
4810 only in optimizing compilation.
4811
4812 The compiler sees only the calls to @code{setjmp}. It cannot know
4813 where @code{longjmp} will be called; in fact, a signal handler could
4814 call it at any point in the code. As a result, you may get a warning
4815 even when there is in fact no problem because @code{longjmp} cannot
4816 in fact be called at the place that would cause a problem.
4817
4818 Some spurious warnings can be avoided if you declare all the functions
4819 you use that never return as @code{noreturn}. @xref{Function
4820 Attributes}.
4821
4822 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4823
4824 @item -Wunknown-pragmas
4825 @opindex Wunknown-pragmas
4826 @opindex Wno-unknown-pragmas
4827 @cindex warning for unknown pragmas
4828 @cindex unknown pragmas, warning
4829 @cindex pragmas, warning of unknown
4830 Warn when a @code{#pragma} directive is encountered that is not understood by
4831 GCC@. If this command-line option is used, warnings are even issued
4832 for unknown pragmas in system header files. This is not the case if
4833 the warnings are only enabled by the @option{-Wall} command-line option.
4834
4835 @item -Wno-pragmas
4836 @opindex Wno-pragmas
4837 @opindex Wpragmas
4838 Do not warn about misuses of pragmas, such as incorrect parameters,
4839 invalid syntax, or conflicts between pragmas. See also
4840 @option{-Wunknown-pragmas}.
4841
4842 @item -Wstrict-aliasing
4843 @opindex Wstrict-aliasing
4844 @opindex Wno-strict-aliasing
4845 This option is only active when @option{-fstrict-aliasing} is active.
4846 It warns about code that might break the strict aliasing rules that the
4847 compiler is using for optimization. The warning does not catch all
4848 cases, but does attempt to catch the more common pitfalls. It is
4849 included in @option{-Wall}.
4850 It is equivalent to @option{-Wstrict-aliasing=3}
4851
4852 @item -Wstrict-aliasing=n
4853 @opindex Wstrict-aliasing=n
4854 This option is only active when @option{-fstrict-aliasing} is active.
4855 It warns about code that might break the strict aliasing rules that the
4856 compiler is using for optimization.
4857 Higher levels correspond to higher accuracy (fewer false positives).
4858 Higher levels also correspond to more effort, similar to the way @option{-O}
4859 works.
4860 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4861
4862 Level 1: Most aggressive, quick, least accurate.
4863 Possibly useful when higher levels
4864 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4865 false negatives. However, it has many false positives.
4866 Warns for all pointer conversions between possibly incompatible types,
4867 even if never dereferenced. Runs in the front end only.
4868
4869 Level 2: Aggressive, quick, not too precise.
4870 May still have many false positives (not as many as level 1 though),
4871 and few false negatives (but possibly more than level 1).
4872 Unlike level 1, it only warns when an address is taken. Warns about
4873 incomplete types. Runs in the front end only.
4874
4875 Level 3 (default for @option{-Wstrict-aliasing}):
4876 Should have very few false positives and few false
4877 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4878 Takes care of the common pun+dereference pattern in the front end:
4879 @code{*(int*)&some_float}.
4880 If optimization is enabled, it also runs in the back end, where it deals
4881 with multiple statement cases using flow-sensitive points-to information.
4882 Only warns when the converted pointer is dereferenced.
4883 Does not warn about incomplete types.
4884
4885 @item -Wstrict-overflow
4886 @itemx -Wstrict-overflow=@var{n}
4887 @opindex Wstrict-overflow
4888 @opindex Wno-strict-overflow
4889 This option is only active when @option{-fstrict-overflow} is active.
4890 It warns about cases where the compiler optimizes based on the
4891 assumption that signed overflow does not occur. Note that it does not
4892 warn about all cases where the code might overflow: it only warns
4893 about cases where the compiler implements some optimization. Thus
4894 this warning depends on the optimization level.
4895
4896 An optimization that assumes that signed overflow does not occur is
4897 perfectly safe if the values of the variables involved are such that
4898 overflow never does, in fact, occur. Therefore this warning can
4899 easily give a false positive: a warning about code that is not
4900 actually a problem. To help focus on important issues, several
4901 warning levels are defined. No warnings are issued for the use of
4902 undefined signed overflow when estimating how many iterations a loop
4903 requires, in particular when determining whether a loop will be
4904 executed at all.
4905
4906 @table @gcctabopt
4907 @item -Wstrict-overflow=1
4908 Warn about cases that are both questionable and easy to avoid. For
4909 example, with @option{-fstrict-overflow}, the compiler simplifies
4910 @code{x + 1 > x} to @code{1}. This level of
4911 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4912 are not, and must be explicitly requested.
4913
4914 @item -Wstrict-overflow=2
4915 Also warn about other cases where a comparison is simplified to a
4916 constant. For example: @code{abs (x) >= 0}. This can only be
4917 simplified when @option{-fstrict-overflow} is in effect, because
4918 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4919 zero. @option{-Wstrict-overflow} (with no level) is the same as
4920 @option{-Wstrict-overflow=2}.
4921
4922 @item -Wstrict-overflow=3
4923 Also warn about other cases where a comparison is simplified. For
4924 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4925
4926 @item -Wstrict-overflow=4
4927 Also warn about other simplifications not covered by the above cases.
4928 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4929
4930 @item -Wstrict-overflow=5
4931 Also warn about cases where the compiler reduces the magnitude of a
4932 constant involved in a comparison. For example: @code{x + 2 > y} is
4933 simplified to @code{x + 1 >= y}. This is reported only at the
4934 highest warning level because this simplification applies to many
4935 comparisons, so this warning level gives a very large number of
4936 false positives.
4937 @end table
4938
4939 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4940 @opindex Wsuggest-attribute=
4941 @opindex Wno-suggest-attribute=
4942 Warn for cases where adding an attribute may be beneficial. The
4943 attributes currently supported are listed below.
4944
4945 @table @gcctabopt
4946 @item -Wsuggest-attribute=pure
4947 @itemx -Wsuggest-attribute=const
4948 @itemx -Wsuggest-attribute=noreturn
4949 @opindex Wsuggest-attribute=pure
4950 @opindex Wno-suggest-attribute=pure
4951 @opindex Wsuggest-attribute=const
4952 @opindex Wno-suggest-attribute=const
4953 @opindex Wsuggest-attribute=noreturn
4954 @opindex Wno-suggest-attribute=noreturn
4955
4956 Warn about functions that might be candidates for attributes
4957 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4958 functions visible in other compilation units or (in the case of @code{pure} and
4959 @code{const}) if it cannot prove that the function returns normally. A function
4960 returns normally if it doesn't contain an infinite loop or return abnormally
4961 by throwing, calling @code{abort} or trapping. This analysis requires option
4962 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4963 higher. Higher optimization levels improve the accuracy of the analysis.
4964
4965 @item -Wsuggest-attribute=format
4966 @itemx -Wmissing-format-attribute
4967 @opindex Wsuggest-attribute=format
4968 @opindex Wmissing-format-attribute
4969 @opindex Wno-suggest-attribute=format
4970 @opindex Wno-missing-format-attribute
4971 @opindex Wformat
4972 @opindex Wno-format
4973
4974 Warn about function pointers that might be candidates for @code{format}
4975 attributes. Note these are only possible candidates, not absolute ones.
4976 GCC guesses that function pointers with @code{format} attributes that
4977 are used in assignment, initialization, parameter passing or return
4978 statements should have a corresponding @code{format} attribute in the
4979 resulting type. I.e.@: the left-hand side of the assignment or
4980 initialization, the type of the parameter variable, or the return type
4981 of the containing function respectively should also have a @code{format}
4982 attribute to avoid the warning.
4983
4984 GCC also warns about function definitions that might be
4985 candidates for @code{format} attributes. Again, these are only
4986 possible candidates. GCC guesses that @code{format} attributes
4987 might be appropriate for any function that calls a function like
4988 @code{vprintf} or @code{vscanf}, but this might not always be the
4989 case, and some functions for which @code{format} attributes are
4990 appropriate may not be detected.
4991 @end table
4992
4993 @item -Wsuggest-final-types
4994 @opindex Wno-suggest-final-types
4995 @opindex Wsuggest-final-types
4996 Warn about types with virtual methods where code quality would be improved
4997 if the type were declared with the C++11 @code{final} specifier,
4998 or, if possible,
4999 declared in an anonymous namespace. This allows GCC to more aggressively
5000 devirtualize the polymorphic calls. This warning is more effective with link
5001 time optimization, where the information about the class hierarchy graph is
5002 more complete.
5003
5004 @item -Wsuggest-final-methods
5005 @opindex Wno-suggest-final-methods
5006 @opindex Wsuggest-final-methods
5007 Warn about virtual methods where code quality would be improved if the method
5008 were declared with the C++11 @code{final} specifier,
5009 or, if possible, its type were
5010 declared in an anonymous namespace or with the @code{final} specifier.
5011 This warning is
5012 more effective with link time optimization, where the information about the
5013 class hierarchy graph is more complete. It is recommended to first consider
5014 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5015 annotations.
5016
5017 @item -Wsuggest-override
5018 Warn about overriding virtual functions that are not marked with the override
5019 keyword.
5020
5021 @item -Walloca
5022 @opindex Wno-alloca
5023 @opindex Walloca
5024 This option warns on all uses of @code{alloca} in the source.
5025
5026 @item -Walloca-larger-than=@var{n}
5027 This option warns on calls to @code{alloca} that are not bounded by a
5028 controlling predicate limiting its argument of integer type to at most
5029 @var{n} bytes, or calls to @code{alloca} where the bound is unknown.
5030 Arguments of non-integer types are considered unbounded even if they
5031 appear to be constrained to the expected range.
5032
5033 For example, a bounded case of @code{alloca} could be:
5034
5035 @smallexample
5036 void func (size_t n)
5037 @{
5038 void *p;
5039 if (n <= 1000)
5040 p = alloca (n);
5041 else
5042 p = malloc (n);
5043 f (p);
5044 @}
5045 @end smallexample
5046
5047 In the above example, passing @code{-Walloca-larger-than=1000} would not
5048 issue a warning because the call to @code{alloca} is known to be at most
5049 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5050 the compiler would emit a warning.
5051
5052 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5053 controlling predicate constraining its integer argument. For example:
5054
5055 @smallexample
5056 void func ()
5057 @{
5058 void *p = alloca (n);
5059 f (p);
5060 @}
5061 @end smallexample
5062
5063 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5064 a warning, but this time because of the lack of bounds checking.
5065
5066 Note, that even seemingly correct code involving signed integers could
5067 cause a warning:
5068
5069 @smallexample
5070 void func (signed int n)
5071 @{
5072 if (n < 500)
5073 @{
5074 p = alloca (n);
5075 f (p);
5076 @}
5077 @}
5078 @end smallexample
5079
5080 In the above example, @var{n} could be negative, causing a larger than
5081 expected argument to be implicitly cast into the @code{alloca} call.
5082
5083 This option also warns when @code{alloca} is used in a loop.
5084
5085 This warning is not enabled by @option{-Wall}, and is only active when
5086 @option{-ftree-vrp} is active (default for @option{-O2} and above).
5087
5088 See also @option{-Wvla-larger-than=@var{n}}.
5089
5090 @item -Warray-bounds
5091 @itemx -Warray-bounds=@var{n}
5092 @opindex Wno-array-bounds
5093 @opindex Warray-bounds
5094 This option is only active when @option{-ftree-vrp} is active
5095 (default for @option{-O2} and above). It warns about subscripts to arrays
5096 that are always out of bounds. This warning is enabled by @option{-Wall}.
5097
5098 @table @gcctabopt
5099 @item -Warray-bounds=1
5100 This is the warning level of @option{-Warray-bounds} and is enabled
5101 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5102
5103 @item -Warray-bounds=2
5104 This warning level also warns about out of bounds access for
5105 arrays at the end of a struct and for arrays accessed through
5106 pointers. This warning level may give a larger number of
5107 false positives and is deactivated by default.
5108 @end table
5109
5110 @item -Wbool-compare
5111 @opindex Wno-bool-compare
5112 @opindex Wbool-compare
5113 Warn about boolean expression compared with an integer value different from
5114 @code{true}/@code{false}. For instance, the following comparison is
5115 always false:
5116 @smallexample
5117 int n = 5;
5118 @dots{}
5119 if ((n > 1) == 2) @{ @dots{} @}
5120 @end smallexample
5121 This warning is enabled by @option{-Wall}.
5122
5123 @item -Wbool-operation
5124 @opindex Wno-bool-operation
5125 @opindex Wbool-operation
5126 Warn about suspicious operations on expressions of a boolean type. For
5127 instance, bitwise negation of a boolean is very likely a bug in the program.
5128 For C, this warning also warns about incrementing or decrementing a boolean,
5129 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5130 Incrementing a boolean is invalid in C++1z, and deprecated otherwise.)
5131
5132 This warning is enabled by @option{-Wall}.
5133
5134 @item -Wduplicated-cond
5135 @opindex Wno-duplicated-cond
5136 @opindex Wduplicated-cond
5137 Warn about duplicated conditions in an if-else-if chain. For instance,
5138 warn for the following code:
5139 @smallexample
5140 if (p->q != NULL) @{ @dots{} @}
5141 else if (p->q != NULL) @{ @dots{} @}
5142 @end smallexample
5143
5144 @item -Wframe-address
5145 @opindex Wno-frame-address
5146 @opindex Wframe-address
5147 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5148 is called with an argument greater than 0. Such calls may return indeterminate
5149 values or crash the program. The warning is included in @option{-Wall}.
5150
5151 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5152 @opindex Wno-discarded-qualifiers
5153 @opindex Wdiscarded-qualifiers
5154 Do not warn if type qualifiers on pointers are being discarded.
5155 Typically, the compiler warns if a @code{const char *} variable is
5156 passed to a function that takes a @code{char *} parameter. This option
5157 can be used to suppress such a warning.
5158
5159 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5160 @opindex Wno-discarded-array-qualifiers
5161 @opindex Wdiscarded-array-qualifiers
5162 Do not warn if type qualifiers on arrays which are pointer targets
5163 are being discarded. Typically, the compiler warns if a
5164 @code{const int (*)[]} variable is passed to a function that
5165 takes a @code{int (*)[]} parameter. This option can be used to
5166 suppress such a warning.
5167
5168 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5169 @opindex Wno-incompatible-pointer-types
5170 @opindex Wincompatible-pointer-types
5171 Do not warn when there is a conversion between pointers that have incompatible
5172 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5173 which warns for pointer argument passing or assignment with different
5174 signedness.
5175
5176 @item -Wno-int-conversion @r{(C and Objective-C only)}
5177 @opindex Wno-int-conversion
5178 @opindex Wint-conversion
5179 Do not warn about incompatible integer to pointer and pointer to integer
5180 conversions. This warning is about implicit conversions; for explicit
5181 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5182 @option{-Wno-pointer-to-int-cast} may be used.
5183
5184 @item -Wno-div-by-zero
5185 @opindex Wno-div-by-zero
5186 @opindex Wdiv-by-zero
5187 Do not warn about compile-time integer division by zero. Floating-point
5188 division by zero is not warned about, as it can be a legitimate way of
5189 obtaining infinities and NaNs.
5190
5191 @item -Wsystem-headers
5192 @opindex Wsystem-headers
5193 @opindex Wno-system-headers
5194 @cindex warnings from system headers
5195 @cindex system headers, warnings from
5196 Print warning messages for constructs found in system header files.
5197 Warnings from system headers are normally suppressed, on the assumption
5198 that they usually do not indicate real problems and would only make the
5199 compiler output harder to read. Using this command-line option tells
5200 GCC to emit warnings from system headers as if they occurred in user
5201 code. However, note that using @option{-Wall} in conjunction with this
5202 option does @emph{not} warn about unknown pragmas in system
5203 headers---for that, @option{-Wunknown-pragmas} must also be used.
5204
5205 @item -Wtautological-compare
5206 @opindex Wtautological-compare
5207 @opindex Wno-tautological-compare
5208 Warn if a self-comparison always evaluates to true or false. This
5209 warning detects various mistakes such as:
5210 @smallexample
5211 int i = 1;
5212 @dots{}
5213 if (i > i) @{ @dots{} @}
5214 @end smallexample
5215 This warning is enabled by @option{-Wall}.
5216
5217 @item -Wtrampolines
5218 @opindex Wtrampolines
5219 @opindex Wno-trampolines
5220 Warn about trampolines generated for pointers to nested functions.
5221 A trampoline is a small piece of data or code that is created at run
5222 time on the stack when the address of a nested function is taken, and is
5223 used to call the nested function indirectly. For some targets, it is
5224 made up of data only and thus requires no special treatment. But, for
5225 most targets, it is made up of code and thus requires the stack to be
5226 made executable in order for the program to work properly.
5227
5228 @item -Wfloat-equal
5229 @opindex Wfloat-equal
5230 @opindex Wno-float-equal
5231 Warn if floating-point values are used in equality comparisons.
5232
5233 The idea behind this is that sometimes it is convenient (for the
5234 programmer) to consider floating-point values as approximations to
5235 infinitely precise real numbers. If you are doing this, then you need
5236 to compute (by analyzing the code, or in some other way) the maximum or
5237 likely maximum error that the computation introduces, and allow for it
5238 when performing comparisons (and when producing output, but that's a
5239 different problem). In particular, instead of testing for equality, you
5240 should check to see whether the two values have ranges that overlap; and
5241 this is done with the relational operators, so equality comparisons are
5242 probably mistaken.
5243
5244 @item -Wtraditional @r{(C and Objective-C only)}
5245 @opindex Wtraditional
5246 @opindex Wno-traditional
5247 Warn about certain constructs that behave differently in traditional and
5248 ISO C@. Also warn about ISO C constructs that have no traditional C
5249 equivalent, and/or problematic constructs that should be avoided.
5250
5251 @itemize @bullet
5252 @item
5253 Macro parameters that appear within string literals in the macro body.
5254 In traditional C macro replacement takes place within string literals,
5255 but in ISO C it does not.
5256
5257 @item
5258 In traditional C, some preprocessor directives did not exist.
5259 Traditional preprocessors only considered a line to be a directive
5260 if the @samp{#} appeared in column 1 on the line. Therefore
5261 @option{-Wtraditional} warns about directives that traditional C
5262 understands but ignores because the @samp{#} does not appear as the
5263 first character on the line. It also suggests you hide directives like
5264 @code{#pragma} not understood by traditional C by indenting them. Some
5265 traditional implementations do not recognize @code{#elif}, so this option
5266 suggests avoiding it altogether.
5267
5268 @item
5269 A function-like macro that appears without arguments.
5270
5271 @item
5272 The unary plus operator.
5273
5274 @item
5275 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
5276 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
5277 constants.) Note, these suffixes appear in macros defined in the system
5278 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
5279 Use of these macros in user code might normally lead to spurious
5280 warnings, however GCC's integrated preprocessor has enough context to
5281 avoid warning in these cases.
5282
5283 @item
5284 A function declared external in one block and then used after the end of
5285 the block.
5286
5287 @item
5288 A @code{switch} statement has an operand of type @code{long}.
5289
5290 @item
5291 A non-@code{static} function declaration follows a @code{static} one.
5292 This construct is not accepted by some traditional C compilers.
5293
5294 @item
5295 The ISO type of an integer constant has a different width or
5296 signedness from its traditional type. This warning is only issued if
5297 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
5298 typically represent bit patterns, are not warned about.
5299
5300 @item
5301 Usage of ISO string concatenation is detected.
5302
5303 @item
5304 Initialization of automatic aggregates.
5305
5306 @item
5307 Identifier conflicts with labels. Traditional C lacks a separate
5308 namespace for labels.
5309
5310 @item
5311 Initialization of unions. If the initializer is zero, the warning is
5312 omitted. This is done under the assumption that the zero initializer in
5313 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
5314 initializer warnings and relies on default initialization to zero in the
5315 traditional C case.
5316
5317 @item
5318 Conversions by prototypes between fixed/floating-point values and vice
5319 versa. The absence of these prototypes when compiling with traditional
5320 C causes serious problems. This is a subset of the possible
5321 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
5322
5323 @item
5324 Use of ISO C style function definitions. This warning intentionally is
5325 @emph{not} issued for prototype declarations or variadic functions
5326 because these ISO C features appear in your code when using
5327 libiberty's traditional C compatibility macros, @code{PARAMS} and
5328 @code{VPARAMS}. This warning is also bypassed for nested functions
5329 because that feature is already a GCC extension and thus not relevant to
5330 traditional C compatibility.
5331 @end itemize
5332
5333 @item -Wtraditional-conversion @r{(C and Objective-C only)}
5334 @opindex Wtraditional-conversion
5335 @opindex Wno-traditional-conversion
5336 Warn if a prototype causes a type conversion that is different from what
5337 would happen to the same argument in the absence of a prototype. This
5338 includes conversions of fixed point to floating and vice versa, and
5339 conversions changing the width or signedness of a fixed-point argument
5340 except when the same as the default promotion.
5341
5342 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
5343 @opindex Wdeclaration-after-statement
5344 @opindex Wno-declaration-after-statement
5345 Warn when a declaration is found after a statement in a block. This
5346 construct, known from C++, was introduced with ISO C99 and is by default
5347 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
5348
5349 @item -Wexpansion-to-defined
5350 @opindex Wexpansion-to-defined
5351 Warn whenever @samp{defined} is encountered in the expansion of a macro.
5352 This warning is also enabled by @option{-Wpedantic} and @option{-Wextra}.
5353
5354 @item -Wundef
5355 @opindex Wundef
5356 @opindex Wno-undef
5357 Warn if an undefined identifier is evaluated in an @code{#if} directive.
5358
5359 @item -Wno-endif-labels
5360 @opindex Wno-endif-labels
5361 @opindex Wendif-labels
5362 Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
5363
5364 @item -Wshadow
5365 @opindex Wshadow
5366 @opindex Wno-shadow
5367 Warn whenever a local variable or type declaration shadows another
5368 variable, parameter, type, class member (in C++), or instance variable
5369 (in Objective-C) or whenever a built-in function is shadowed. Note
5370 that in C++, the compiler warns if a local variable shadows an
5371 explicit typedef, but not if it shadows a struct/class/enum.
5372 Same as @option{-Wshadow=global}.
5373
5374 @item -Wno-shadow-ivar @r{(Objective-C only)}
5375 @opindex Wno-shadow-ivar
5376 @opindex Wshadow-ivar
5377 Do not warn whenever a local variable shadows an instance variable in an
5378 Objective-C method.
5379
5380 @item -Wshadow=global
5381 @opindex Wshadow=local
5382 The default for @option{-Wshadow}. Warns for any (global) shadowing.
5383
5384 @item -Wshadow=local
5385 @opindex Wshadow=local
5386 Warn when a local variable shadows another local variable or parameter.
5387 This warning is enabled by @option{-Wshadow=global}.
5388
5389 @item -Wshadow=compatible-local
5390 @opindex Wshadow=compatible-local
5391 Warn when a local variable shadows another local variable or parameter
5392 whose type is compatible with that of the shadowing variable. In C++,
5393 type compatibility here means the type of the shadowing variable can be
5394 converted to that of the shadowed variable. The creation of this flag
5395 (in addition to @option{-Wshadow=local}) is based on the idea that when
5396 a local variable shadows another one of incompatible type, it is most
5397 likely intentional, not a bug or typo, as shown in the following example:
5398
5399 @smallexample
5400 @group
5401 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5402 @{
5403 for (int i = 0; i < N; ++i)
5404 @{
5405 ...
5406 @}
5407 ...
5408 @}
5409 @end group
5410 @end smallexample
5411
5412 Since the two variable @code{i} in the example above have incompatible types,
5413 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
5414 Because their types are incompatible, if a programmer accidentally uses one
5415 in place of the other, type checking will catch that and emit an error or
5416 warning. So not warning (about shadowing) in this case will not lead to
5417 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
5418 possibly reduce the number of warnings triggered by intentional shadowing.
5419
5420 This warning is enabled by @option{-Wshadow=local}.
5421
5422 @item -Wlarger-than=@var{len}
5423 @opindex Wlarger-than=@var{len}
5424 @opindex Wlarger-than-@var{len}
5425 Warn whenever an object of larger than @var{len} bytes is defined.
5426
5427 @item -Wframe-larger-than=@var{len}
5428 @opindex Wframe-larger-than
5429 Warn if the size of a function frame is larger than @var{len} bytes.
5430 The computation done to determine the stack frame size is approximate
5431 and not conservative.
5432 The actual requirements may be somewhat greater than @var{len}
5433 even if you do not get a warning. In addition, any space allocated
5434 via @code{alloca}, variable-length arrays, or related constructs
5435 is not included by the compiler when determining
5436 whether or not to issue a warning.
5437
5438 @item -Wno-free-nonheap-object
5439 @opindex Wno-free-nonheap-object
5440 @opindex Wfree-nonheap-object
5441 Do not warn when attempting to free an object that was not allocated
5442 on the heap.
5443
5444 @item -Wstack-usage=@var{len}
5445 @opindex Wstack-usage
5446 Warn if the stack usage of a function might be larger than @var{len} bytes.
5447 The computation done to determine the stack usage is conservative.
5448 Any space allocated via @code{alloca}, variable-length arrays, or related
5449 constructs is included by the compiler when determining whether or not to
5450 issue a warning.
5451
5452 The message is in keeping with the output of @option{-fstack-usage}.
5453
5454 @itemize
5455 @item
5456 If the stack usage is fully static but exceeds the specified amount, it's:
5457
5458 @smallexample
5459 warning: stack usage is 1120 bytes
5460 @end smallexample
5461 @item
5462 If the stack usage is (partly) dynamic but bounded, it's:
5463
5464 @smallexample
5465 warning: stack usage might be 1648 bytes
5466 @end smallexample
5467 @item
5468 If the stack usage is (partly) dynamic and not bounded, it's:
5469
5470 @smallexample
5471 warning: stack usage might be unbounded
5472 @end smallexample
5473 @end itemize
5474
5475 @item -Wunsafe-loop-optimizations
5476 @opindex Wunsafe-loop-optimizations
5477 @opindex Wno-unsafe-loop-optimizations
5478 Warn if the loop cannot be optimized because the compiler cannot
5479 assume anything on the bounds of the loop indices. With
5480 @option{-funsafe-loop-optimizations} warn if the compiler makes
5481 such assumptions.
5482
5483 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
5484 @opindex Wno-pedantic-ms-format
5485 @opindex Wpedantic-ms-format
5486 When used in combination with @option{-Wformat}
5487 and @option{-pedantic} without GNU extensions, this option
5488 disables the warnings about non-ISO @code{printf} / @code{scanf} format
5489 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
5490 which depend on the MS runtime.
5491
5492 @item -Waligned-new
5493 @opindex Waligned-new
5494 @opindex Wno-aligned-new
5495 Warn about a new-expression of a type that requires greater alignment
5496 than the @code{alignof(std::max_align_t)} but uses an allocation
5497 function without an explicit alignment parameter. This option is
5498 enabled by @option{-Wall}.
5499
5500 Normally this only warns about global allocation functions, but
5501 @option{-Waligned-new=all} also warns about class member allocation
5502 functions.
5503
5504 @item -Wplacement-new
5505 @itemx -Wplacement-new=@var{n}
5506 @opindex Wplacement-new
5507 @opindex Wno-placement-new
5508 Warn about placement new expressions with undefined behavior, such as
5509 constructing an object in a buffer that is smaller than the type of
5510 the object. For example, the placement new expression below is diagnosed
5511 because it attempts to construct an array of 64 integers in a buffer only
5512 64 bytes large.
5513 @smallexample
5514 char buf [64];
5515 new (buf) int[64];
5516 @end smallexample
5517 This warning is enabled by default.
5518
5519 @table @gcctabopt
5520 @item -Wplacement-new=1
5521 This is the default warning level of @option{-Wplacement-new}. At this
5522 level the warning is not issued for some strictly undefined constructs that
5523 GCC allows as extensions for compatibility with legacy code. For example,
5524 the following @code{new} expression is not diagnosed at this level even
5525 though it has undefined behavior according to the C++ standard because
5526 it writes past the end of the one-element array.
5527 @smallexample
5528 struct S @{ int n, a[1]; @};
5529 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5530 new (s->a)int [32]();
5531 @end smallexample
5532
5533 @item -Wplacement-new=2
5534 At this level, in addition to diagnosing all the same constructs as at level
5535 1, a diagnostic is also issued for placement new expressions that construct
5536 an object in the last member of structure whose type is an array of a single
5537 element and whose size is less than the size of the object being constructed.
5538 While the previous example would be diagnosed, the following construct makes
5539 use of the flexible member array extension to avoid the warning at level 2.
5540 @smallexample
5541 struct S @{ int n, a[]; @};
5542 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
5543 new (s->a)int [32]();
5544 @end smallexample
5545
5546 @end table
5547
5548 @item -Wpointer-arith
5549 @opindex Wpointer-arith
5550 @opindex Wno-pointer-arith
5551 Warn about anything that depends on the ``size of'' a function type or
5552 of @code{void}. GNU C assigns these types a size of 1, for
5553 convenience in calculations with @code{void *} pointers and pointers
5554 to functions. In C++, warn also when an arithmetic operation involves
5555 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
5556
5557 @item -Wtype-limits
5558 @opindex Wtype-limits
5559 @opindex Wno-type-limits
5560 Warn if a comparison is always true or always false due to the limited
5561 range of the data type, but do not warn for constant expressions. For
5562 example, warn if an unsigned variable is compared against zero with
5563 @code{<} or @code{>=}. This warning is also enabled by
5564 @option{-Wextra}.
5565
5566 @item -Wbad-function-cast @r{(C and Objective-C only)}
5567 @opindex Wbad-function-cast
5568 @opindex Wno-bad-function-cast
5569 Warn when a function call is cast to a non-matching type.
5570 For example, warn if a call to a function returning an integer type
5571 is cast to a pointer type.
5572
5573 @item -Wc90-c99-compat @r{(C and Objective-C only)}
5574 @opindex Wc90-c99-compat
5575 @opindex Wno-c90-c99-compat
5576 Warn about features not present in ISO C90, but present in ISO C99.
5577 For instance, warn about use of variable length arrays, @code{long long}
5578 type, @code{bool} type, compound literals, designated initializers, and so
5579 on. This option is independent of the standards mode. Warnings are disabled
5580 in the expression that follows @code{__extension__}.
5581
5582 @item -Wc99-c11-compat @r{(C and Objective-C only)}
5583 @opindex Wc99-c11-compat
5584 @opindex Wno-c99-c11-compat
5585 Warn about features not present in ISO C99, but present in ISO C11.
5586 For instance, warn about use of anonymous structures and unions,
5587 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
5588 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
5589 and so on. This option is independent of the standards mode. Warnings are
5590 disabled in the expression that follows @code{__extension__}.
5591
5592 @item -Wc++-compat @r{(C and Objective-C only)}
5593 @opindex Wc++-compat
5594 Warn about ISO C constructs that are outside of the common subset of
5595 ISO C and ISO C++, e.g.@: request for implicit conversion from
5596 @code{void *} to a pointer to non-@code{void} type.
5597
5598 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
5599 @opindex Wc++11-compat
5600 Warn about C++ constructs whose meaning differs between ISO C++ 1998
5601 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
5602 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
5603 enabled by @option{-Wall}.
5604
5605 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
5606 @opindex Wc++14-compat
5607 Warn about C++ constructs whose meaning differs between ISO C++ 2011
5608 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
5609
5610 @item -Wc++1z-compat @r{(C++ and Objective-C++ only)}
5611 @opindex Wc++1z-compat
5612 Warn about C++ constructs whose meaning differs between ISO C++ 2014
5613 and the forthoming ISO C++ 2017(?). This warning is enabled by @option{-Wall}.
5614
5615 @item -Wcast-qual
5616 @opindex Wcast-qual
5617 @opindex Wno-cast-qual
5618 Warn whenever a pointer is cast so as to remove a type qualifier from
5619 the target type. For example, warn if a @code{const char *} is cast
5620 to an ordinary @code{char *}.
5621
5622 Also warn when making a cast that introduces a type qualifier in an
5623 unsafe way. For example, casting @code{char **} to @code{const char **}
5624 is unsafe, as in this example:
5625
5626 @smallexample
5627 /* p is char ** value. */
5628 const char **q = (const char **) p;
5629 /* Assignment of readonly string to const char * is OK. */
5630 *q = "string";
5631 /* Now char** pointer points to read-only memory. */
5632 **p = 'b';
5633 @end smallexample
5634
5635 @item -Wcast-align
5636 @opindex Wcast-align
5637 @opindex Wno-cast-align
5638 Warn whenever a pointer is cast such that the required alignment of the
5639 target is increased. For example, warn if a @code{char *} is cast to
5640 an @code{int *} on machines where integers can only be accessed at
5641 two- or four-byte boundaries.
5642
5643 @item -Wwrite-strings
5644 @opindex Wwrite-strings
5645 @opindex Wno-write-strings
5646 When compiling C, give string constants the type @code{const
5647 char[@var{length}]} so that copying the address of one into a
5648 non-@code{const} @code{char *} pointer produces a warning. These
5649 warnings help you find at compile time code that can try to write
5650 into a string constant, but only if you have been very careful about
5651 using @code{const} in declarations and prototypes. Otherwise, it is
5652 just a nuisance. This is why we did not make @option{-Wall} request
5653 these warnings.
5654
5655 When compiling C++, warn about the deprecated conversion from string
5656 literals to @code{char *}. This warning is enabled by default for C++
5657 programs.
5658
5659 @item -Wclobbered
5660 @opindex Wclobbered
5661 @opindex Wno-clobbered
5662 Warn for variables that might be changed by @code{longjmp} or
5663 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5664
5665 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5666 @opindex Wconditionally-supported
5667 @opindex Wno-conditionally-supported
5668 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5669
5670 @item -Wconversion
5671 @opindex Wconversion
5672 @opindex Wno-conversion
5673 Warn for implicit conversions that may alter a value. This includes
5674 conversions between real and integer, like @code{abs (x)} when
5675 @code{x} is @code{double}; conversions between signed and unsigned,
5676 like @code{unsigned ui = -1}; and conversions to smaller types, like
5677 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5678 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5679 changed by the conversion like in @code{abs (2.0)}. Warnings about
5680 conversions between signed and unsigned integers can be disabled by
5681 using @option{-Wno-sign-conversion}.
5682
5683 For C++, also warn for confusing overload resolution for user-defined
5684 conversions; and conversions that never use a type conversion
5685 operator: conversions to @code{void}, the same type, a base class or a
5686 reference to them. Warnings about conversions between signed and
5687 unsigned integers are disabled by default in C++ unless
5688 @option{-Wsign-conversion} is explicitly enabled.
5689
5690 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5691 @opindex Wconversion-null
5692 @opindex Wno-conversion-null
5693 Do not warn for conversions between @code{NULL} and non-pointer
5694 types. @option{-Wconversion-null} is enabled by default.
5695
5696 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5697 @opindex Wzero-as-null-pointer-constant
5698 @opindex Wno-zero-as-null-pointer-constant
5699 Warn when a literal @samp{0} is used as null pointer constant. This can
5700 be useful to facilitate the conversion to @code{nullptr} in C++11.
5701
5702 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5703 @opindex Wsubobject-linkage
5704 @opindex Wno-subobject-linkage
5705 Warn if a class type has a base or a field whose type uses the anonymous
5706 namespace or depends on a type with no linkage. If a type A depends on
5707 a type B with no or internal linkage, defining it in multiple
5708 translation units would be an ODR violation because the meaning of B
5709 is different in each translation unit. If A only appears in a single
5710 translation unit, the best way to silence the warning is to give it
5711 internal linkage by putting it in an anonymous namespace as well. The
5712 compiler doesn't give this warning for types defined in the main .C
5713 file, as those are unlikely to have multiple definitions.
5714 @option{-Wsubobject-linkage} is enabled by default.
5715
5716 @item -Wdangling-else
5717 @opindex Wdangling-else
5718 @opindex Wno-dangling-else
5719 Warn about constructions where there may be confusion to which
5720 @code{if} statement an @code{else} branch belongs. Here is an example of
5721 such a case:
5722
5723 @smallexample
5724 @group
5725 @{
5726 if (a)
5727 if (b)
5728 foo ();
5729 else
5730 bar ();
5731 @}
5732 @end group
5733 @end smallexample
5734
5735 In C/C++, every @code{else} branch belongs to the innermost possible
5736 @code{if} statement, which in this example is @code{if (b)}. This is
5737 often not what the programmer expected, as illustrated in the above
5738 example by indentation the programmer chose. When there is the
5739 potential for this confusion, GCC issues a warning when this flag
5740 is specified. To eliminate the warning, add explicit braces around
5741 the innermost @code{if} statement so there is no way the @code{else}
5742 can belong to the enclosing @code{if}. The resulting code
5743 looks like this:
5744
5745 @smallexample
5746 @group
5747 @{
5748 if (a)
5749 @{
5750 if (b)
5751 foo ();
5752 else
5753 bar ();
5754 @}
5755 @}
5756 @end group
5757 @end smallexample
5758
5759 This warning is enabled by @option{-Wparentheses}.
5760
5761 @item -Wdate-time
5762 @opindex Wdate-time
5763 @opindex Wno-date-time
5764 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
5765 are encountered as they might prevent bit-wise-identical reproducible
5766 compilations.
5767
5768 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
5769 @opindex Wdelete-incomplete
5770 @opindex Wno-delete-incomplete
5771 Warn when deleting a pointer to incomplete type, which may cause
5772 undefined behavior at runtime. This warning is enabled by default.
5773
5774 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
5775 @opindex Wuseless-cast
5776 @opindex Wno-useless-cast
5777 Warn when an expression is casted to its own type.
5778
5779 @item -Wempty-body
5780 @opindex Wempty-body
5781 @opindex Wno-empty-body
5782 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
5783 while} statement. This warning is also enabled by @option{-Wextra}.
5784
5785 @item -Wenum-compare
5786 @opindex Wenum-compare
5787 @opindex Wno-enum-compare
5788 Warn about a comparison between values of different enumerated types.
5789 In C++ enumeral mismatches in conditional expressions are also
5790 diagnosed and the warning is enabled by default. In C this warning is
5791 enabled by @option{-Wall}.
5792
5793 @item -Wjump-misses-init @r{(C, Objective-C only)}
5794 @opindex Wjump-misses-init
5795 @opindex Wno-jump-misses-init
5796 Warn if a @code{goto} statement or a @code{switch} statement jumps
5797 forward across the initialization of a variable, or jumps backward to a
5798 label after the variable has been initialized. This only warns about
5799 variables that are initialized when they are declared. This warning is
5800 only supported for C and Objective-C; in C++ this sort of branch is an
5801 error in any case.
5802
5803 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
5804 can be disabled with the @option{-Wno-jump-misses-init} option.
5805
5806 @item -Wsign-compare
5807 @opindex Wsign-compare
5808 @opindex Wno-sign-compare
5809 @cindex warning for comparison of signed and unsigned values
5810 @cindex comparison of signed and unsigned values, warning
5811 @cindex signed and unsigned values, comparison warning
5812 Warn when a comparison between signed and unsigned values could produce
5813 an incorrect result when the signed value is converted to unsigned.
5814 In C++, this warning is also enabled by @option{-Wall}. In C, it is
5815 also enabled by @option{-Wextra}.
5816
5817 @item -Wsign-conversion
5818 @opindex Wsign-conversion
5819 @opindex Wno-sign-conversion
5820 Warn for implicit conversions that may change the sign of an integer
5821 value, like assigning a signed integer expression to an unsigned
5822 integer variable. An explicit cast silences the warning. In C, this
5823 option is enabled also by @option{-Wconversion}.
5824
5825 @item -Wfloat-conversion
5826 @opindex Wfloat-conversion
5827 @opindex Wno-float-conversion
5828 Warn for implicit conversions that reduce the precision of a real value.
5829 This includes conversions from real to integer, and from higher precision
5830 real to lower precision real values. This option is also enabled by
5831 @option{-Wconversion}.
5832
5833 @item -Wno-scalar-storage-order
5834 @opindex -Wno-scalar-storage-order
5835 @opindex -Wscalar-storage-order
5836 Do not warn on suspicious constructs involving reverse scalar storage order.
5837
5838 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
5839 @opindex Wsized-deallocation
5840 @opindex Wno-sized-deallocation
5841 Warn about a definition of an unsized deallocation function
5842 @smallexample
5843 void operator delete (void *) noexcept;
5844 void operator delete[] (void *) noexcept;
5845 @end smallexample
5846 without a definition of the corresponding sized deallocation function
5847 @smallexample
5848 void operator delete (void *, std::size_t) noexcept;
5849 void operator delete[] (void *, std::size_t) noexcept;
5850 @end smallexample
5851 or vice versa. Enabled by @option{-Wextra} along with
5852 @option{-fsized-deallocation}.
5853
5854 @item -Wsizeof-pointer-memaccess
5855 @opindex Wsizeof-pointer-memaccess
5856 @opindex Wno-sizeof-pointer-memaccess
5857 Warn for suspicious length parameters to certain string and memory built-in
5858 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
5859 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
5860 but a pointer, and suggests a possible fix, or about
5861 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
5862 @option{-Wall}.
5863
5864 @item -Wsizeof-array-argument
5865 @opindex Wsizeof-array-argument
5866 @opindex Wno-sizeof-array-argument
5867 Warn when the @code{sizeof} operator is applied to a parameter that is
5868 declared as an array in a function definition. This warning is enabled by
5869 default for C and C++ programs.
5870
5871 @item -Wmemset-elt-size
5872 @opindex Wmemset-elt-size
5873 @opindex Wno-memset-elt-size
5874 Warn for suspicious calls to the @code{memset} built-in function, if the
5875 first argument references an array, and the third argument is a number
5876 equal to the number of elements, but not equal to the size of the array
5877 in memory. This indicates that the user has omitted a multiplication by
5878 the element size. This warning is enabled by @option{-Wall}.
5879
5880 @item -Wmemset-transposed-args
5881 @opindex Wmemset-transposed-args
5882 @opindex Wno-memset-transposed-args
5883 Warn for suspicious calls to the @code{memset} built-in function, if the
5884 second argument is not zero and the third argument is zero. This warns e.g.@
5885 about @code{memset (buf, sizeof buf, 0)} where most probably
5886 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
5887 is only emitted if the third argument is literal zero. If it is some
5888 expression that is folded to zero, a cast of zero to some type, etc.,
5889 it is far less likely that the user has mistakenly exchanged the arguments
5890 and no warning is emitted. This warning is enabled by @option{-Wall}.
5891
5892 @item -Waddress
5893 @opindex Waddress
5894 @opindex Wno-address
5895 Warn about suspicious uses of memory addresses. These include using
5896 the address of a function in a conditional expression, such as
5897 @code{void func(void); if (func)}, and comparisons against the memory
5898 address of a string literal, such as @code{if (x == "abc")}. Such
5899 uses typically indicate a programmer error: the address of a function
5900 always evaluates to true, so their use in a conditional usually
5901 indicate that the programmer forgot the parentheses in a function
5902 call; and comparisons against string literals result in unspecified
5903 behavior and are not portable in C, so they usually indicate that the
5904 programmer intended to use @code{strcmp}. This warning is enabled by
5905 @option{-Wall}.
5906
5907 @item -Wlogical-op
5908 @opindex Wlogical-op
5909 @opindex Wno-logical-op
5910 Warn about suspicious uses of logical operators in expressions.
5911 This includes using logical operators in contexts where a
5912 bit-wise operator is likely to be expected. Also warns when
5913 the operands of a logical operator are the same:
5914 @smallexample
5915 extern int a;
5916 if (a < 0 && a < 0) @{ @dots{} @}
5917 @end smallexample
5918
5919 @item -Wlogical-not-parentheses
5920 @opindex Wlogical-not-parentheses
5921 @opindex Wno-logical-not-parentheses
5922 Warn about logical not used on the left hand side operand of a comparison.
5923 This option does not warn if the right operand is considered to be a boolean
5924 expression. Its purpose is to detect suspicious code like the following:
5925 @smallexample
5926 int a;
5927 @dots{}
5928 if (!a > 1) @{ @dots{} @}
5929 @end smallexample
5930
5931 It is possible to suppress the warning by wrapping the LHS into
5932 parentheses:
5933 @smallexample
5934 if ((!a) > 1) @{ @dots{} @}
5935 @end smallexample
5936
5937 This warning is enabled by @option{-Wall}.
5938
5939 @item -Waggregate-return
5940 @opindex Waggregate-return
5941 @opindex Wno-aggregate-return
5942 Warn if any functions that return structures or unions are defined or
5943 called. (In languages where you can return an array, this also elicits
5944 a warning.)
5945
5946 @item -Wno-aggressive-loop-optimizations
5947 @opindex Wno-aggressive-loop-optimizations
5948 @opindex Waggressive-loop-optimizations
5949 Warn if in a loop with constant number of iterations the compiler detects
5950 undefined behavior in some statement during one or more of the iterations.
5951
5952 @item -Wno-attributes
5953 @opindex Wno-attributes
5954 @opindex Wattributes
5955 Do not warn if an unexpected @code{__attribute__} is used, such as
5956 unrecognized attributes, function attributes applied to variables,
5957 etc. This does not stop errors for incorrect use of supported
5958 attributes.
5959
5960 @item -Wno-builtin-declaration-mismatch
5961 @opindex Wno-builtin-declaration-mismatch
5962 @opindex Wbuiltin-declaration-mismatch
5963 Warn if a built-in function is declared with the wrong signature.
5964 This warning is enabled by default.
5965
5966 @item -Wno-builtin-macro-redefined
5967 @opindex Wno-builtin-macro-redefined
5968 @opindex Wbuiltin-macro-redefined
5969 Do not warn if certain built-in macros are redefined. This suppresses
5970 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
5971 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
5972
5973 @item -Wstrict-prototypes @r{(C and Objective-C only)}
5974 @opindex Wstrict-prototypes
5975 @opindex Wno-strict-prototypes
5976 Warn if a function is declared or defined without specifying the
5977 argument types. (An old-style function definition is permitted without
5978 a warning if preceded by a declaration that specifies the argument
5979 types.)
5980
5981 @item -Wold-style-declaration @r{(C and Objective-C only)}
5982 @opindex Wold-style-declaration
5983 @opindex Wno-old-style-declaration
5984 Warn for obsolescent usages, according to the C Standard, in a
5985 declaration. For example, warn if storage-class specifiers like
5986 @code{static} are not the first things in a declaration. This warning
5987 is also enabled by @option{-Wextra}.
5988
5989 @item -Wold-style-definition @r{(C and Objective-C only)}
5990 @opindex Wold-style-definition
5991 @opindex Wno-old-style-definition
5992 Warn if an old-style function definition is used. A warning is given
5993 even if there is a previous prototype.
5994
5995 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
5996 @opindex Wmissing-parameter-type
5997 @opindex Wno-missing-parameter-type
5998 A function parameter is declared without a type specifier in K&R-style
5999 functions:
6000
6001 @smallexample
6002 void foo(bar) @{ @}
6003 @end smallexample
6004
6005 This warning is also enabled by @option{-Wextra}.
6006
6007 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6008 @opindex Wmissing-prototypes
6009 @opindex Wno-missing-prototypes
6010 Warn if a global function is defined without a previous prototype
6011 declaration. This warning is issued even if the definition itself
6012 provides a prototype. Use this option to detect global functions
6013 that do not have a matching prototype declaration in a header file.
6014 This option is not valid for C++ because all function declarations
6015 provide prototypes and a non-matching declaration declares an
6016 overload rather than conflict with an earlier declaration.
6017 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6018
6019 @item -Wmissing-declarations
6020 @opindex Wmissing-declarations
6021 @opindex Wno-missing-declarations
6022 Warn if a global function is defined without a previous declaration.
6023 Do so even if the definition itself provides a prototype.
6024 Use this option to detect global functions that are not declared in
6025 header files. In C, no warnings are issued for functions with previous
6026 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6027 missing prototypes. In C++, no warnings are issued for function templates,
6028 or for inline functions, or for functions in anonymous namespaces.
6029
6030 @item -Wmissing-field-initializers
6031 @opindex Wmissing-field-initializers
6032 @opindex Wno-missing-field-initializers
6033 @opindex W
6034 @opindex Wextra
6035 @opindex Wno-extra
6036 Warn if a structure's initializer has some fields missing. For
6037 example, the following code causes such a warning, because
6038 @code{x.h} is implicitly zero:
6039
6040 @smallexample
6041 struct s @{ int f, g, h; @};
6042 struct s x = @{ 3, 4 @};
6043 @end smallexample
6044
6045 This option does not warn about designated initializers, so the following
6046 modification does not trigger a warning:
6047
6048 @smallexample
6049 struct s @{ int f, g, h; @};
6050 struct s x = @{ .f = 3, .g = 4 @};
6051 @end smallexample
6052
6053 In C++ this option does not warn either about the empty @{ @}
6054 initializer, for example:
6055
6056 @smallexample
6057 struct s @{ int f, g, h; @};
6058 s x = @{ @};
6059 @end smallexample
6060
6061 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6062 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6063
6064 @item -Wno-multichar
6065 @opindex Wno-multichar
6066 @opindex Wmultichar
6067 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6068 Usually they indicate a typo in the user's code, as they have
6069 implementation-defined values, and should not be used in portable code.
6070
6071 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
6072 @opindex Wnormalized=
6073 @opindex Wnormalized
6074 @opindex Wno-normalized
6075 @cindex NFC
6076 @cindex NFKC
6077 @cindex character set, input normalization
6078 In ISO C and ISO C++, two identifiers are different if they are
6079 different sequences of characters. However, sometimes when characters
6080 outside the basic ASCII character set are used, you can have two
6081 different character sequences that look the same. To avoid confusion,
6082 the ISO 10646 standard sets out some @dfn{normalization rules} which
6083 when applied ensure that two sequences that look the same are turned into
6084 the same sequence. GCC can warn you if you are using identifiers that
6085 have not been normalized; this option controls that warning.
6086
6087 There are four levels of warning supported by GCC@. The default is
6088 @option{-Wnormalized=nfc}, which warns about any identifier that is
6089 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6090 recommended form for most uses. It is equivalent to
6091 @option{-Wnormalized}.
6092
6093 Unfortunately, there are some characters allowed in identifiers by
6094 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6095 identifiers. That is, there's no way to use these symbols in portable
6096 ISO C or C++ and have all your identifiers in NFC@.
6097 @option{-Wnormalized=id} suppresses the warning for these characters.
6098 It is hoped that future versions of the standards involved will correct
6099 this, which is why this option is not the default.
6100
6101 You can switch the warning off for all characters by writing
6102 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6103 only do this if you are using some other normalization scheme (like
6104 ``D''), because otherwise you can easily create bugs that are
6105 literally impossible to see.
6106
6107 Some characters in ISO 10646 have distinct meanings but look identical
6108 in some fonts or display methodologies, especially once formatting has
6109 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6110 LETTER N'', displays just like a regular @code{n} that has been
6111 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6112 normalization scheme to convert all these into a standard form as
6113 well, and GCC warns if your code is not in NFKC if you use
6114 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6115 about every identifier that contains the letter O because it might be
6116 confused with the digit 0, and so is not the default, but may be
6117 useful as a local coding convention if the programming environment
6118 cannot be fixed to display these characters distinctly.
6119
6120 @item -Wno-deprecated
6121 @opindex Wno-deprecated
6122 @opindex Wdeprecated
6123 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6124
6125 @item -Wno-deprecated-declarations
6126 @opindex Wno-deprecated-declarations
6127 @opindex Wdeprecated-declarations
6128 Do not warn about uses of functions (@pxref{Function Attributes}),
6129 variables (@pxref{Variable Attributes}), and types (@pxref{Type
6130 Attributes}) marked as deprecated by using the @code{deprecated}
6131 attribute.
6132
6133 @item -Wno-overflow
6134 @opindex Wno-overflow
6135 @opindex Woverflow
6136 Do not warn about compile-time overflow in constant expressions.
6137
6138 @item -Wno-odr
6139 @opindex Wno-odr
6140 @opindex Wodr
6141 Warn about One Definition Rule violations during link-time optimization.
6142 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
6143
6144 @item -Wopenmp-simd
6145 @opindex Wopenm-simd
6146 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
6147 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
6148 option can be used to relax the cost model.
6149
6150 @item -Woverride-init @r{(C and Objective-C only)}
6151 @opindex Woverride-init
6152 @opindex Wno-override-init
6153 @opindex W
6154 @opindex Wextra
6155 @opindex Wno-extra
6156 Warn if an initialized field without side effects is overridden when
6157 using designated initializers (@pxref{Designated Inits, , Designated
6158 Initializers}).
6159
6160 This warning is included in @option{-Wextra}. To get other
6161 @option{-Wextra} warnings without this one, use @option{-Wextra
6162 -Wno-override-init}.
6163
6164 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
6165 @opindex Woverride-init-side-effects
6166 @opindex Wno-override-init-side-effects
6167 Warn if an initialized field with side effects is overridden when
6168 using designated initializers (@pxref{Designated Inits, , Designated
6169 Initializers}). This warning is enabled by default.
6170
6171 @item -Wpacked
6172 @opindex Wpacked
6173 @opindex Wno-packed
6174 Warn if a structure is given the packed attribute, but the packed
6175 attribute has no effect on the layout or size of the structure.
6176 Such structures may be mis-aligned for little benefit. For
6177 instance, in this code, the variable @code{f.x} in @code{struct bar}
6178 is misaligned even though @code{struct bar} does not itself
6179 have the packed attribute:
6180
6181 @smallexample
6182 @group
6183 struct foo @{
6184 int x;
6185 char a, b, c, d;
6186 @} __attribute__((packed));
6187 struct bar @{
6188 char z;
6189 struct foo f;
6190 @};
6191 @end group
6192 @end smallexample
6193
6194 @item -Wpacked-bitfield-compat
6195 @opindex Wpacked-bitfield-compat
6196 @opindex Wno-packed-bitfield-compat
6197 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
6198 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
6199 the change can lead to differences in the structure layout. GCC
6200 informs you when the offset of such a field has changed in GCC 4.4.
6201 For example there is no longer a 4-bit padding between field @code{a}
6202 and @code{b} in this structure:
6203
6204 @smallexample
6205 struct foo
6206 @{
6207 char a:4;
6208 char b:8;
6209 @} __attribute__ ((packed));
6210 @end smallexample
6211
6212 This warning is enabled by default. Use
6213 @option{-Wno-packed-bitfield-compat} to disable this warning.
6214
6215 @item -Wpadded
6216 @opindex Wpadded
6217 @opindex Wno-padded
6218 Warn if padding is included in a structure, either to align an element
6219 of the structure or to align the whole structure. Sometimes when this
6220 happens it is possible to rearrange the fields of the structure to
6221 reduce the padding and so make the structure smaller.
6222
6223 @item -Wredundant-decls
6224 @opindex Wredundant-decls
6225 @opindex Wno-redundant-decls
6226 Warn if anything is declared more than once in the same scope, even in
6227 cases where multiple declaration is valid and changes nothing.
6228
6229 @item -Wrestrict
6230 @opindex Wrestrict
6231 @opindex Wno-restrict
6232 Warn when an argument passed to a restrict-qualified parameter
6233 aliases with another argument.
6234
6235 @item -Wnested-externs @r{(C and Objective-C only)}
6236 @opindex Wnested-externs
6237 @opindex Wno-nested-externs
6238 Warn if an @code{extern} declaration is encountered within a function.
6239
6240 @item -Wno-inherited-variadic-ctor
6241 @opindex Winherited-variadic-ctor
6242 @opindex Wno-inherited-variadic-ctor
6243 Suppress warnings about use of C++11 inheriting constructors when the
6244 base class inherited from has a C variadic constructor; the warning is
6245 on by default because the ellipsis is not inherited.
6246
6247 @item -Winline
6248 @opindex Winline
6249 @opindex Wno-inline
6250 Warn if a function that is declared as inline cannot be inlined.
6251 Even with this option, the compiler does not warn about failures to
6252 inline functions declared in system headers.
6253
6254 The compiler uses a variety of heuristics to determine whether or not
6255 to inline a function. For example, the compiler takes into account
6256 the size of the function being inlined and the amount of inlining
6257 that has already been done in the current function. Therefore,
6258 seemingly insignificant changes in the source program can cause the
6259 warnings produced by @option{-Winline} to appear or disappear.
6260
6261 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
6262 @opindex Wno-invalid-offsetof
6263 @opindex Winvalid-offsetof
6264 Suppress warnings from applying the @code{offsetof} macro to a non-POD
6265 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
6266 to a non-standard-layout type is undefined. In existing C++ implementations,
6267 however, @code{offsetof} typically gives meaningful results.
6268 This flag is for users who are aware that they are
6269 writing nonportable code and who have deliberately chosen to ignore the
6270 warning about it.
6271
6272 The restrictions on @code{offsetof} may be relaxed in a future version
6273 of the C++ standard.
6274
6275 @item -Wint-in-bool-context
6276 @opindex Wint-in-bool-context
6277 @opindex Wno-int-in-bool-context
6278 Warn for suspicious use of integer values where boolean values are expected,
6279 such as conditional expressions (?:) using non-boolean integer constants in
6280 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
6281 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
6282 for all kinds of multiplications regardless of the data type.
6283 This warning is enabled by @option{-Wall}.
6284
6285 @item -Wno-int-to-pointer-cast
6286 @opindex Wno-int-to-pointer-cast
6287 @opindex Wint-to-pointer-cast
6288 Suppress warnings from casts to pointer type of an integer of a
6289 different size. In C++, casting to a pointer type of smaller size is
6290 an error. @option{Wint-to-pointer-cast} is enabled by default.
6291
6292
6293 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
6294 @opindex Wno-pointer-to-int-cast
6295 @opindex Wpointer-to-int-cast
6296 Suppress warnings from casts from a pointer to an integer type of a
6297 different size.
6298
6299 @item -Winvalid-pch
6300 @opindex Winvalid-pch
6301 @opindex Wno-invalid-pch
6302 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
6303 the search path but can't be used.
6304
6305 @item -Wlong-long
6306 @opindex Wlong-long
6307 @opindex Wno-long-long
6308 Warn if @code{long long} type is used. This is enabled by either
6309 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
6310 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
6311
6312 @item -Wvariadic-macros
6313 @opindex Wvariadic-macros
6314 @opindex Wno-variadic-macros
6315 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6316 alternate syntax is used in ISO C99 mode. This is enabled by either
6317 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
6318 messages, use @option{-Wno-variadic-macros}.
6319
6320 @item -Wvarargs
6321 @opindex Wvarargs
6322 @opindex Wno-varargs
6323 Warn upon questionable usage of the macros used to handle variable
6324 arguments like @code{va_start}. This is default. To inhibit the
6325 warning messages, use @option{-Wno-varargs}.
6326
6327 @item -Wvector-operation-performance
6328 @opindex Wvector-operation-performance
6329 @opindex Wno-vector-operation-performance
6330 Warn if vector operation is not implemented via SIMD capabilities of the
6331 architecture. Mainly useful for the performance tuning.
6332 Vector operation can be implemented @code{piecewise}, which means that the
6333 scalar operation is performed on every vector element;
6334 @code{in parallel}, which means that the vector operation is implemented
6335 using scalars of wider type, which normally is more performance efficient;
6336 and @code{as a single scalar}, which means that vector fits into a
6337 scalar type.
6338
6339 @item -Wno-virtual-move-assign
6340 @opindex Wvirtual-move-assign
6341 @opindex Wno-virtual-move-assign
6342 Suppress warnings about inheriting from a virtual base with a
6343 non-trivial C++11 move assignment operator. This is dangerous because
6344 if the virtual base is reachable along more than one path, it is
6345 moved multiple times, which can mean both objects end up in the
6346 moved-from state. If the move assignment operator is written to avoid
6347 moving from a moved-from object, this warning can be disabled.
6348
6349 @item -Wvla
6350 @opindex Wvla
6351 @opindex Wno-vla
6352 Warn if a variable-length array is used in the code.
6353 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
6354 the variable-length array.
6355
6356 @item -Wvla-larger-than=@var{n}
6357 If this option is used, the compiler will warn on uses of
6358 variable-length arrays where the size is either unbounded, or bounded
6359 by an argument that can be larger than @var{n} bytes. This is similar
6360 to how @option{-Walloca-larger-than=@var{n}} works, but with
6361 variable-length arrays.
6362
6363 Note that GCC may optimize small variable-length arrays of a known
6364 value into plain arrays, so this warning may not get triggered for
6365 such arrays.
6366
6367 This warning is not enabled by @option{-Wall}, and is only active when
6368 @option{-ftree-vrp} is active (default for @option{-O2} and above).
6369
6370 See also @option{-Walloca-larger-than=@var{n}}.
6371
6372 @item -Wvolatile-register-var
6373 @opindex Wvolatile-register-var
6374 @opindex Wno-volatile-register-var
6375 Warn if a register variable is declared volatile. The volatile
6376 modifier does not inhibit all optimizations that may eliminate reads
6377 and/or writes to register variables. This warning is enabled by
6378 @option{-Wall}.
6379
6380 @item -Wdisabled-optimization
6381 @opindex Wdisabled-optimization
6382 @opindex Wno-disabled-optimization
6383 Warn if a requested optimization pass is disabled. This warning does
6384 not generally indicate that there is anything wrong with your code; it
6385 merely indicates that GCC's optimizers are unable to handle the code
6386 effectively. Often, the problem is that your code is too big or too
6387 complex; GCC refuses to optimize programs when the optimization
6388 itself is likely to take inordinate amounts of time.
6389
6390 @item -Wpointer-sign @r{(C and Objective-C only)}
6391 @opindex Wpointer-sign
6392 @opindex Wno-pointer-sign
6393 Warn for pointer argument passing or assignment with different signedness.
6394 This option is only supported for C and Objective-C@. It is implied by
6395 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
6396 @option{-Wno-pointer-sign}.
6397
6398 @item -Wstack-protector
6399 @opindex Wstack-protector
6400 @opindex Wno-stack-protector
6401 This option is only active when @option{-fstack-protector} is active. It
6402 warns about functions that are not protected against stack smashing.
6403
6404 @item -Woverlength-strings
6405 @opindex Woverlength-strings
6406 @opindex Wno-overlength-strings
6407 Warn about string constants that are longer than the ``minimum
6408 maximum'' length specified in the C standard. Modern compilers
6409 generally allow string constants that are much longer than the
6410 standard's minimum limit, but very portable programs should avoid
6411 using longer strings.
6412
6413 The limit applies @emph{after} string constant concatenation, and does
6414 not count the trailing NUL@. In C90, the limit was 509 characters; in
6415 C99, it was raised to 4095. C++98 does not specify a normative
6416 minimum maximum, so we do not diagnose overlength strings in C++@.
6417
6418 This option is implied by @option{-Wpedantic}, and can be disabled with
6419 @option{-Wno-overlength-strings}.
6420
6421 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
6422 @opindex Wunsuffixed-float-constants
6423
6424 Issue a warning for any floating constant that does not have
6425 a suffix. When used together with @option{-Wsystem-headers} it
6426 warns about such constants in system header files. This can be useful
6427 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
6428 from the decimal floating-point extension to C99.
6429
6430 @item -Wno-designated-init @r{(C and Objective-C only)}
6431 Suppress warnings when a positional initializer is used to initialize
6432 a structure that has been marked with the @code{designated_init}
6433 attribute.
6434
6435 @item -Whsa
6436 Issue a warning when HSAIL cannot be emitted for the compiled function or
6437 OpenMP construct.
6438
6439 @end table
6440
6441 @node Debugging Options
6442 @section Options for Debugging Your Program
6443 @cindex options, debugging
6444 @cindex debugging information options
6445
6446 To tell GCC to emit extra information for use by a debugger, in almost
6447 all cases you need only to add @option{-g} to your other options.
6448
6449 GCC allows you to use @option{-g} with
6450 @option{-O}. The shortcuts taken by optimized code may occasionally
6451 be surprising: some variables you declared may not exist
6452 at all; flow of control may briefly move where you did not expect it;
6453 some statements may not be executed because they compute constant
6454 results or their values are already at hand; some statements may
6455 execute in different places because they have been moved out of loops.
6456 Nevertheless it is possible to debug optimized output. This makes
6457 it reasonable to use the optimizer for programs that might have bugs.
6458
6459 If you are not using some other optimization option, consider
6460 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
6461 With no @option{-O} option at all, some compiler passes that collect
6462 information useful for debugging do not run at all, so that
6463 @option{-Og} may result in a better debugging experience.
6464
6465 @table @gcctabopt
6466 @item -g
6467 @opindex g
6468 Produce debugging information in the operating system's native format
6469 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
6470 information.
6471
6472 On most systems that use stabs format, @option{-g} enables use of extra
6473 debugging information that only GDB can use; this extra information
6474 makes debugging work better in GDB but probably makes other debuggers
6475 crash or
6476 refuse to read the program. If you want to control for certain whether
6477 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
6478 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
6479
6480 @item -ggdb
6481 @opindex ggdb
6482 Produce debugging information for use by GDB@. This means to use the
6483 most expressive format available (DWARF, stabs, or the native format
6484 if neither of those are supported), including GDB extensions if at all
6485 possible.
6486
6487 @item -gdwarf
6488 @itemx -gdwarf-@var{version}
6489 @opindex gdwarf
6490 Produce debugging information in DWARF format (if that is supported).
6491 The value of @var{version} may be either 2, 3, 4 or 5; the default version
6492 for most targets is 4. DWARF Version 5 is only experimental.
6493
6494 Note that with DWARF Version 2, some ports require and always
6495 use some non-conflicting DWARF 3 extensions in the unwind tables.
6496
6497 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
6498 for maximum benefit.
6499
6500 GCC no longer supports DWARF Version 1, which is substantially
6501 different than Version 2 and later. For historical reasons, some
6502 other DWARF-related options (including @option{-feliminate-dwarf2-dups}
6503 and @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
6504 in their names, but apply to all currently-supported versions of DWARF.
6505
6506 @item -gstabs
6507 @opindex gstabs
6508 Produce debugging information in stabs format (if that is supported),
6509 without GDB extensions. This is the format used by DBX on most BSD
6510 systems. On MIPS, Alpha and System V Release 4 systems this option
6511 produces stabs debugging output that is not understood by DBX or SDB@.
6512 On System V Release 4 systems this option requires the GNU assembler.
6513
6514 @item -gstabs+
6515 @opindex gstabs+
6516 Produce debugging information in stabs format (if that is supported),
6517 using GNU extensions understood only by the GNU debugger (GDB)@. The
6518 use of these extensions is likely to make other debuggers crash or
6519 refuse to read the program.
6520
6521 @item -gcoff
6522 @opindex gcoff
6523 Produce debugging information in COFF format (if that is supported).
6524 This is the format used by SDB on most System V systems prior to
6525 System V Release 4.
6526
6527 @item -gxcoff
6528 @opindex gxcoff
6529 Produce debugging information in XCOFF format (if that is supported).
6530 This is the format used by the DBX debugger on IBM RS/6000 systems.
6531
6532 @item -gxcoff+
6533 @opindex gxcoff+
6534 Produce debugging information in XCOFF format (if that is supported),
6535 using GNU extensions understood only by the GNU debugger (GDB)@. The
6536 use of these extensions is likely to make other debuggers crash or
6537 refuse to read the program, and may cause assemblers other than the GNU
6538 assembler (GAS) to fail with an error.
6539
6540 @item -gvms
6541 @opindex gvms
6542 Produce debugging information in Alpha/VMS debug format (if that is
6543 supported). This is the format used by DEBUG on Alpha/VMS systems.
6544
6545 @item -g@var{level}
6546 @itemx -ggdb@var{level}
6547 @itemx -gstabs@var{level}
6548 @itemx -gcoff@var{level}
6549 @itemx -gxcoff@var{level}
6550 @itemx -gvms@var{level}
6551 Request debugging information and also use @var{level} to specify how
6552 much information. The default level is 2.
6553
6554 Level 0 produces no debug information at all. Thus, @option{-g0} negates
6555 @option{-g}.
6556
6557 Level 1 produces minimal information, enough for making backtraces in
6558 parts of the program that you don't plan to debug. This includes
6559 descriptions of functions and external variables, and line number
6560 tables, but no information about local variables.
6561
6562 Level 3 includes extra information, such as all the macro definitions
6563 present in the program. Some debuggers support macro expansion when
6564 you use @option{-g3}.
6565
6566 @option{-gdwarf} does not accept a concatenated debug level, to avoid
6567 confusion with @option{-gdwarf-@var{level}}.
6568 Instead use an additional @option{-g@var{level}} option to change the
6569 debug level for DWARF.
6570
6571 @item -feliminate-unused-debug-symbols
6572 @opindex feliminate-unused-debug-symbols
6573 Produce debugging information in stabs format (if that is supported),
6574 for only symbols that are actually used.
6575
6576 @item -femit-class-debug-always
6577 @opindex femit-class-debug-always
6578 Instead of emitting debugging information for a C++ class in only one
6579 object file, emit it in all object files using the class. This option
6580 should be used only with debuggers that are unable to handle the way GCC
6581 normally emits debugging information for classes because using this
6582 option increases the size of debugging information by as much as a
6583 factor of two.
6584
6585 @item -fno-merge-debug-strings
6586 @opindex fmerge-debug-strings
6587 @opindex fno-merge-debug-strings
6588 Direct the linker to not merge together strings in the debugging
6589 information that are identical in different object files. Merging is
6590 not supported by all assemblers or linkers. Merging decreases the size
6591 of the debug information in the output file at the cost of increasing
6592 link processing time. Merging is enabled by default.
6593
6594 @item -fdebug-prefix-map=@var{old}=@var{new}
6595 @opindex fdebug-prefix-map
6596 When compiling files in directory @file{@var{old}}, record debugging
6597 information describing them as in @file{@var{new}} instead.
6598
6599 @item -fvar-tracking
6600 @opindex fvar-tracking
6601 Run variable tracking pass. It computes where variables are stored at each
6602 position in code. Better debugging information is then generated
6603 (if the debugging information format supports this information).
6604
6605 It is enabled by default when compiling with optimization (@option{-Os},
6606 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6607 the debug info format supports it.
6608
6609 @item -fvar-tracking-assignments
6610 @opindex fvar-tracking-assignments
6611 @opindex fno-var-tracking-assignments
6612 Annotate assignments to user variables early in the compilation and
6613 attempt to carry the annotations over throughout the compilation all the
6614 way to the end, in an attempt to improve debug information while
6615 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6616
6617 It can be enabled even if var-tracking is disabled, in which case
6618 annotations are created and maintained, but discarded at the end.
6619 By default, this flag is enabled together with @option{-fvar-tracking},
6620 except when selective scheduling is enabled.
6621
6622 @item -gsplit-dwarf
6623 @opindex gsplit-dwarf
6624 Separate as much DWARF debugging information as possible into a
6625 separate output file with the extension @file{.dwo}. This option allows
6626 the build system to avoid linking files with debug information. To
6627 be useful, this option requires a debugger capable of reading @file{.dwo}
6628 files.
6629
6630 @item -gpubnames
6631 @opindex gpubnames
6632 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
6633
6634 @item -ggnu-pubnames
6635 @opindex ggnu-pubnames
6636 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
6637 suitable for conversion into a GDB@ index. This option is only useful
6638 with a linker that can produce GDB@ index version 7.
6639
6640 @item -fdebug-types-section
6641 @opindex fdebug-types-section
6642 @opindex fno-debug-types-section
6643 When using DWARF Version 4 or higher, type DIEs can be put into
6644 their own @code{.debug_types} section instead of making them part of the
6645 @code{.debug_info} section. It is more efficient to put them in a separate
6646 comdat sections since the linker can then remove duplicates.
6647 But not all DWARF consumers support @code{.debug_types} sections yet
6648 and on some objects @code{.debug_types} produces larger instead of smaller
6649 debugging information.
6650
6651 @item -grecord-gcc-switches
6652 @item -gno-record-gcc-switches
6653 @opindex grecord-gcc-switches
6654 @opindex gno-record-gcc-switches
6655 This switch causes the command-line options used to invoke the
6656 compiler that may affect code generation to be appended to the
6657 DW_AT_producer attribute in DWARF debugging information. The options
6658 are concatenated with spaces separating them from each other and from
6659 the compiler version.
6660 It is enabled by default.
6661 See also @option{-frecord-gcc-switches} for another
6662 way of storing compiler options into the object file.
6663
6664 @item -gstrict-dwarf
6665 @opindex gstrict-dwarf
6666 Disallow using extensions of later DWARF standard version than selected
6667 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
6668 DWARF extensions from later standard versions is allowed.
6669
6670 @item -gno-strict-dwarf
6671 @opindex gno-strict-dwarf
6672 Allow using extensions of later DWARF standard version than selected with
6673 @option{-gdwarf-@var{version}}.
6674
6675 @item -gz@r{[}=@var{type}@r{]}
6676 @opindex gz
6677 Produce compressed debug sections in DWARF format, if that is supported.
6678 If @var{type} is not given, the default type depends on the capabilities
6679 of the assembler and linker used. @var{type} may be one of
6680 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
6681 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
6682 compression in traditional GNU format). If the linker doesn't support
6683 writing compressed debug sections, the option is rejected. Otherwise,
6684 if the assembler does not support them, @option{-gz} is silently ignored
6685 when producing object files.
6686
6687 @item -feliminate-dwarf2-dups
6688 @opindex feliminate-dwarf2-dups
6689 Compress DWARF debugging information by eliminating duplicated
6690 information about each symbol. This option only makes sense when
6691 generating DWARF debugging information.
6692
6693 @item -femit-struct-debug-baseonly
6694 @opindex femit-struct-debug-baseonly
6695 Emit debug information for struct-like types
6696 only when the base name of the compilation source file
6697 matches the base name of file in which the struct is defined.
6698
6699 This option substantially reduces the size of debugging information,
6700 but at significant potential loss in type information to the debugger.
6701 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6702 See @option{-femit-struct-debug-detailed} for more detailed control.
6703
6704 This option works only with DWARF debug output.
6705
6706 @item -femit-struct-debug-reduced
6707 @opindex femit-struct-debug-reduced
6708 Emit debug information for struct-like types
6709 only when the base name of the compilation source file
6710 matches the base name of file in which the type is defined,
6711 unless the struct is a template or defined in a system header.
6712
6713 This option significantly reduces the size of debugging information,
6714 with some potential loss in type information to the debugger.
6715 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
6716 See @option{-femit-struct-debug-detailed} for more detailed control.
6717
6718 This option works only with DWARF debug output.
6719
6720 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
6721 @opindex femit-struct-debug-detailed
6722 Specify the struct-like types
6723 for which the compiler generates debug information.
6724 The intent is to reduce duplicate struct debug information
6725 between different object files within the same program.
6726
6727 This option is a detailed version of
6728 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6729 which serves for most needs.
6730
6731 A specification has the syntax@*
6732 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6733
6734 The optional first word limits the specification to
6735 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6736 A struct type is used directly when it is the type of a variable, member.
6737 Indirect uses arise through pointers to structs.
6738 That is, when use of an incomplete struct is valid, the use is indirect.
6739 An example is
6740 @samp{struct one direct; struct two * indirect;}.
6741
6742 The optional second word limits the specification to
6743 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6744 Generic structs are a bit complicated to explain.
6745 For C++, these are non-explicit specializations of template classes,
6746 or non-template classes within the above.
6747 Other programming languages have generics,
6748 but @option{-femit-struct-debug-detailed} does not yet implement them.
6749
6750 The third word specifies the source files for those
6751 structs for which the compiler should emit debug information.
6752 The values @samp{none} and @samp{any} have the normal meaning.
6753 The value @samp{base} means that
6754 the base of name of the file in which the type declaration appears
6755 must match the base of the name of the main compilation file.
6756 In practice, this means that when compiling @file{foo.c}, debug information
6757 is generated for types declared in that file and @file{foo.h},
6758 but not other header files.
6759 The value @samp{sys} means those types satisfying @samp{base}
6760 or declared in system or compiler headers.
6761
6762 You may need to experiment to determine the best settings for your application.
6763
6764 The default is @option{-femit-struct-debug-detailed=all}.
6765
6766 This option works only with DWARF debug output.
6767
6768 @item -fno-dwarf2-cfi-asm
6769 @opindex fdwarf2-cfi-asm
6770 @opindex fno-dwarf2-cfi-asm
6771 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
6772 instead of using GAS @code{.cfi_*} directives.
6773
6774 @item -fno-eliminate-unused-debug-types
6775 @opindex feliminate-unused-debug-types
6776 @opindex fno-eliminate-unused-debug-types
6777 Normally, when producing DWARF output, GCC avoids producing debug symbol
6778 output for types that are nowhere used in the source file being compiled.
6779 Sometimes it is useful to have GCC emit debugging
6780 information for all types declared in a compilation
6781 unit, regardless of whether or not they are actually used
6782 in that compilation unit, for example
6783 if, in the debugger, you want to cast a value to a type that is
6784 not actually used in your program (but is declared). More often,
6785 however, this results in a significant amount of wasted space.
6786 @end table
6787
6788 @node Optimize Options
6789 @section Options That Control Optimization
6790 @cindex optimize options
6791 @cindex options, optimization
6792
6793 These options control various sorts of optimizations.
6794
6795 Without any optimization option, the compiler's goal is to reduce the
6796 cost of compilation and to make debugging produce the expected
6797 results. Statements are independent: if you stop the program with a
6798 breakpoint between statements, you can then assign a new value to any
6799 variable or change the program counter to any other statement in the
6800 function and get exactly the results you expect from the source
6801 code.
6802
6803 Turning on optimization flags makes the compiler attempt to improve
6804 the performance and/or code size at the expense of compilation time
6805 and possibly the ability to debug the program.
6806
6807 The compiler performs optimization based on the knowledge it has of the
6808 program. Compiling multiple files at once to a single output file mode allows
6809 the compiler to use information gained from all of the files when compiling
6810 each of them.
6811
6812 Not all optimizations are controlled directly by a flag. Only
6813 optimizations that have a flag are listed in this section.
6814
6815 Most optimizations are only enabled if an @option{-O} level is set on
6816 the command line. Otherwise they are disabled, even if individual
6817 optimization flags are specified.
6818
6819 Depending on the target and how GCC was configured, a slightly different
6820 set of optimizations may be enabled at each @option{-O} level than
6821 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
6822 to find out the exact set of optimizations that are enabled at each level.
6823 @xref{Overall Options}, for examples.
6824
6825 @table @gcctabopt
6826 @item -O
6827 @itemx -O1
6828 @opindex O
6829 @opindex O1
6830 Optimize. Optimizing compilation takes somewhat more time, and a lot
6831 more memory for a large function.
6832
6833 With @option{-O}, the compiler tries to reduce code size and execution
6834 time, without performing any optimizations that take a great deal of
6835 compilation time.
6836
6837 @option{-O} turns on the following optimization flags:
6838 @gccoptlist{
6839 -fauto-inc-dec @gol
6840 -fbranch-count-reg @gol
6841 -fcombine-stack-adjustments @gol
6842 -fcompare-elim @gol
6843 -fcprop-registers @gol
6844 -fdce @gol
6845 -fdefer-pop @gol
6846 -fdelayed-branch @gol
6847 -fdse @gol
6848 -fforward-propagate @gol
6849 -fguess-branch-probability @gol
6850 -fif-conversion2 @gol
6851 -fif-conversion @gol
6852 -finline-functions-called-once @gol
6853 -fipa-pure-const @gol
6854 -fipa-profile @gol
6855 -fipa-reference @gol
6856 -fmerge-constants @gol
6857 -fmove-loop-invariants @gol
6858 -freorder-blocks @gol
6859 -fshrink-wrap @gol
6860 -fshrink-wrap-separate @gol
6861 -fsplit-wide-types @gol
6862 -fssa-backprop @gol
6863 -fssa-phiopt @gol
6864 -fstore-merging @gol
6865 -ftree-bit-ccp @gol
6866 -ftree-ccp @gol
6867 -ftree-ch @gol
6868 -ftree-coalesce-vars @gol
6869 -ftree-copy-prop @gol
6870 -ftree-dce @gol
6871 -ftree-dominator-opts @gol
6872 -ftree-dse @gol
6873 -ftree-forwprop @gol
6874 -ftree-fre @gol
6875 -ftree-phiprop @gol
6876 -ftree-sink @gol
6877 -ftree-slsr @gol
6878 -ftree-sra @gol
6879 -ftree-pta @gol
6880 -ftree-ter @gol
6881 -funit-at-a-time}
6882
6883 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6884 where doing so does not interfere with debugging.
6885
6886 @item -O2
6887 @opindex O2
6888 Optimize even more. GCC performs nearly all supported optimizations
6889 that do not involve a space-speed tradeoff.
6890 As compared to @option{-O}, this option increases both compilation time
6891 and the performance of the generated code.
6892
6893 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6894 also turns on the following optimization flags:
6895 @gccoptlist{-fthread-jumps @gol
6896 -falign-functions -falign-jumps @gol
6897 -falign-loops -falign-labels @gol
6898 -fcaller-saves @gol
6899 -fcrossjumping @gol
6900 -fcse-follow-jumps -fcse-skip-blocks @gol
6901 -fdelete-null-pointer-checks @gol
6902 -fdevirtualize -fdevirtualize-speculatively @gol
6903 -fexpensive-optimizations @gol
6904 -fgcse -fgcse-lm @gol
6905 -fhoist-adjacent-loads @gol
6906 -finline-small-functions @gol
6907 -findirect-inlining @gol
6908 -fipa-cp @gol
6909 -fipa-cp-alignment @gol
6910 -fipa-bit-cp @gol
6911 -fipa-sra @gol
6912 -fipa-icf @gol
6913 -fisolate-erroneous-paths-dereference @gol
6914 -flra-remat @gol
6915 -foptimize-sibling-calls @gol
6916 -foptimize-strlen @gol
6917 -fpartial-inlining @gol
6918 -fpeephole2 @gol
6919 -freorder-blocks-algorithm=stc @gol
6920 -freorder-blocks-and-partition -freorder-functions @gol
6921 -frerun-cse-after-loop @gol
6922 -fsched-interblock -fsched-spec @gol
6923 -fschedule-insns -fschedule-insns2 @gol
6924 -fstrict-aliasing -fstrict-overflow @gol
6925 -ftree-builtin-call-dce @gol
6926 -ftree-switch-conversion -ftree-tail-merge @gol
6927 -fcode-hoisting @gol
6928 -ftree-pre @gol
6929 -ftree-vrp @gol
6930 -fipa-ra}
6931
6932 Please note the warning under @option{-fgcse} about
6933 invoking @option{-O2} on programs that use computed gotos.
6934
6935 @item -O3
6936 @opindex O3
6937 Optimize yet more. @option{-O3} turns on all optimizations specified
6938 by @option{-O2} and also turns on the @option{-finline-functions},
6939 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6940 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
6941 @option{-ftree-loop-distribute-patterns}, @option{-fsplit-paths}
6942 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
6943 @option{-ftree-partial-pre}, @option{-fpeel-loops}
6944 and @option{-fipa-cp-clone} options.
6945
6946 @item -O0
6947 @opindex O0
6948 Reduce compilation time and make debugging produce the expected
6949 results. This is the default.
6950
6951 @item -Os
6952 @opindex Os
6953 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6954 do not typically increase code size. It also performs further
6955 optimizations designed to reduce code size.
6956
6957 @option{-Os} disables the following optimization flags:
6958 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6959 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
6960 -freorder-blocks-and-partition -fprefetch-loop-arrays}
6961
6962 @item -Ofast
6963 @opindex Ofast
6964 Disregard strict standards compliance. @option{-Ofast} enables all
6965 @option{-O3} optimizations. It also enables optimizations that are not
6966 valid for all standard-compliant programs.
6967 It turns on @option{-ffast-math} and the Fortran-specific
6968 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6969
6970 @item -Og
6971 @opindex Og
6972 Optimize debugging experience. @option{-Og} enables optimizations
6973 that do not interfere with debugging. It should be the optimization
6974 level of choice for the standard edit-compile-debug cycle, offering
6975 a reasonable level of optimization while maintaining fast compilation
6976 and a good debugging experience.
6977 @end table
6978
6979 If you use multiple @option{-O} options, with or without level numbers,
6980 the last such option is the one that is effective.
6981
6982 Options of the form @option{-f@var{flag}} specify machine-independent
6983 flags. Most flags have both positive and negative forms; the negative
6984 form of @option{-ffoo} is @option{-fno-foo}. In the table
6985 below, only one of the forms is listed---the one you typically
6986 use. You can figure out the other form by either removing @samp{no-}
6987 or adding it.
6988
6989 The following options control specific optimizations. They are either
6990 activated by @option{-O} options or are related to ones that are. You
6991 can use the following flags in the rare cases when ``fine-tuning'' of
6992 optimizations to be performed is desired.
6993
6994 @table @gcctabopt
6995 @item -fno-defer-pop
6996 @opindex fno-defer-pop
6997 Always pop the arguments to each function call as soon as that function
6998 returns. For machines that must pop arguments after a function call,
6999 the compiler normally lets arguments accumulate on the stack for several
7000 function calls and pops them all at once.
7001
7002 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7003
7004 @item -fforward-propagate
7005 @opindex fforward-propagate
7006 Perform a forward propagation pass on RTL@. The pass tries to combine two
7007 instructions and checks if the result can be simplified. If loop unrolling
7008 is active, two passes are performed and the second is scheduled after
7009 loop unrolling.
7010
7011 This option is enabled by default at optimization levels @option{-O},
7012 @option{-O2}, @option{-O3}, @option{-Os}.
7013
7014 @item -ffp-contract=@var{style}
7015 @opindex ffp-contract
7016 @option{-ffp-contract=off} disables floating-point expression contraction.
7017 @option{-ffp-contract=fast} enables floating-point expression contraction
7018 such as forming of fused multiply-add operations if the target has
7019 native support for them.
7020 @option{-ffp-contract=on} enables floating-point expression contraction
7021 if allowed by the language standard. This is currently not implemented
7022 and treated equal to @option{-ffp-contract=off}.
7023
7024 The default is @option{-ffp-contract=fast}.
7025
7026 @item -fomit-frame-pointer
7027 @opindex fomit-frame-pointer
7028 Don't keep the frame pointer in a register for functions that
7029 don't need one. This avoids the instructions to save, set up and
7030 restore frame pointers; it also makes an extra register available
7031 in many functions. @strong{It also makes debugging impossible on
7032 some machines.}
7033
7034 On some machines, such as the VAX, this flag has no effect, because
7035 the standard calling sequence automatically handles the frame pointer
7036 and nothing is saved by pretending it doesn't exist. The
7037 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
7038 whether a target machine supports this flag. @xref{Registers,,Register
7039 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
7040
7041 The default setting (when not optimizing for
7042 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
7043 @option{-fomit-frame-pointer}. You can configure GCC with the
7044 @option{--enable-frame-pointer} configure option to change the default.
7045
7046 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7047
7048 @item -foptimize-sibling-calls
7049 @opindex foptimize-sibling-calls
7050 Optimize sibling and tail recursive calls.
7051
7052 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7053
7054 @item -foptimize-strlen
7055 @opindex foptimize-strlen
7056 Optimize various standard C string functions (e.g. @code{strlen},
7057 @code{strchr} or @code{strcpy}) and
7058 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7059
7060 Enabled at levels @option{-O2}, @option{-O3}.
7061
7062 @item -fno-inline
7063 @opindex fno-inline
7064 Do not expand any functions inline apart from those marked with
7065 the @code{always_inline} attribute. This is the default when not
7066 optimizing.
7067
7068 Single functions can be exempted from inlining by marking them
7069 with the @code{noinline} attribute.
7070
7071 @item -finline-small-functions
7072 @opindex finline-small-functions
7073 Integrate functions into their callers when their body is smaller than expected
7074 function call code (so overall size of program gets smaller). The compiler
7075 heuristically decides which functions are simple enough to be worth integrating
7076 in this way. This inlining applies to all functions, even those not declared
7077 inline.
7078
7079 Enabled at level @option{-O2}.
7080
7081 @item -findirect-inlining
7082 @opindex findirect-inlining
7083 Inline also indirect calls that are discovered to be known at compile
7084 time thanks to previous inlining. This option has any effect only
7085 when inlining itself is turned on by the @option{-finline-functions}
7086 or @option{-finline-small-functions} options.
7087
7088 Enabled at level @option{-O2}.
7089
7090 @item -finline-functions
7091 @opindex finline-functions
7092 Consider all functions for inlining, even if they are not declared inline.
7093 The compiler heuristically decides which functions are worth integrating
7094 in this way.
7095
7096 If all calls to a given function are integrated, and the function is
7097 declared @code{static}, then the function is normally not output as
7098 assembler code in its own right.
7099
7100 Enabled at level @option{-O3}.
7101
7102 @item -finline-functions-called-once
7103 @opindex finline-functions-called-once
7104 Consider all @code{static} functions called once for inlining into their
7105 caller even if they are not marked @code{inline}. If a call to a given
7106 function is integrated, then the function is not output as assembler code
7107 in its own right.
7108
7109 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7110
7111 @item -fearly-inlining
7112 @opindex fearly-inlining
7113 Inline functions marked by @code{always_inline} and functions whose body seems
7114 smaller than the function call overhead early before doing
7115 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7116 makes profiling significantly cheaper and usually inlining faster on programs
7117 having large chains of nested wrapper functions.
7118
7119 Enabled by default.
7120
7121 @item -fipa-sra
7122 @opindex fipa-sra
7123 Perform interprocedural scalar replacement of aggregates, removal of
7124 unused parameters and replacement of parameters passed by reference
7125 by parameters passed by value.
7126
7127 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7128
7129 @item -finline-limit=@var{n}
7130 @opindex finline-limit
7131 By default, GCC limits the size of functions that can be inlined. This flag
7132 allows coarse control of this limit. @var{n} is the size of functions that
7133 can be inlined in number of pseudo instructions.
7134
7135 Inlining is actually controlled by a number of parameters, which may be
7136 specified individually by using @option{--param @var{name}=@var{value}}.
7137 The @option{-finline-limit=@var{n}} option sets some of these parameters
7138 as follows:
7139
7140 @table @gcctabopt
7141 @item max-inline-insns-single
7142 is set to @var{n}/2.
7143 @item max-inline-insns-auto
7144 is set to @var{n}/2.
7145 @end table
7146
7147 See below for a documentation of the individual
7148 parameters controlling inlining and for the defaults of these parameters.
7149
7150 @emph{Note:} there may be no value to @option{-finline-limit} that results
7151 in default behavior.
7152
7153 @emph{Note:} pseudo instruction represents, in this particular context, an
7154 abstract measurement of function's size. In no way does it represent a count
7155 of assembly instructions and as such its exact meaning might change from one
7156 release to an another.
7157
7158 @item -fno-keep-inline-dllexport
7159 @opindex fno-keep-inline-dllexport
7160 This is a more fine-grained version of @option{-fkeep-inline-functions},
7161 which applies only to functions that are declared using the @code{dllexport}
7162 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
7163 Functions}.)
7164
7165 @item -fkeep-inline-functions
7166 @opindex fkeep-inline-functions
7167 In C, emit @code{static} functions that are declared @code{inline}
7168 into the object file, even if the function has been inlined into all
7169 of its callers. This switch does not affect functions using the
7170 @code{extern inline} extension in GNU C90@. In C++, emit any and all
7171 inline functions into the object file.
7172
7173 @item -fkeep-static-functions
7174 @opindex fkeep-static-functions
7175 Emit @code{static} functions into the object file, even if the function
7176 is never used.
7177
7178 @item -fkeep-static-consts
7179 @opindex fkeep-static-consts
7180 Emit variables declared @code{static const} when optimization isn't turned
7181 on, even if the variables aren't referenced.
7182
7183 GCC enables this option by default. If you want to force the compiler to
7184 check if a variable is referenced, regardless of whether or not
7185 optimization is turned on, use the @option{-fno-keep-static-consts} option.
7186
7187 @item -fmerge-constants
7188 @opindex fmerge-constants
7189 Attempt to merge identical constants (string constants and floating-point
7190 constants) across compilation units.
7191
7192 This option is the default for optimized compilation if the assembler and
7193 linker support it. Use @option{-fno-merge-constants} to inhibit this
7194 behavior.
7195
7196 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7197
7198 @item -fmerge-all-constants
7199 @opindex fmerge-all-constants
7200 Attempt to merge identical constants and identical variables.
7201
7202 This option implies @option{-fmerge-constants}. In addition to
7203 @option{-fmerge-constants} this considers e.g.@: even constant initialized
7204 arrays or initialized constant variables with integral or floating-point
7205 types. Languages like C or C++ require each variable, including multiple
7206 instances of the same variable in recursive calls, to have distinct locations,
7207 so using this option results in non-conforming
7208 behavior.
7209
7210 @item -fmodulo-sched
7211 @opindex fmodulo-sched
7212 Perform swing modulo scheduling immediately before the first scheduling
7213 pass. This pass looks at innermost loops and reorders their
7214 instructions by overlapping different iterations.
7215
7216 @item -fmodulo-sched-allow-regmoves
7217 @opindex fmodulo-sched-allow-regmoves
7218 Perform more aggressive SMS-based modulo scheduling with register moves
7219 allowed. By setting this flag certain anti-dependences edges are
7220 deleted, which triggers the generation of reg-moves based on the
7221 life-range analysis. This option is effective only with
7222 @option{-fmodulo-sched} enabled.
7223
7224 @item -fno-branch-count-reg
7225 @opindex fno-branch-count-reg
7226 Avoid running a pass scanning for opportunities to use ``decrement and
7227 branch'' instructions on a count register instead of generating sequences
7228 of instructions that decrement a register, compare it against zero, and
7229 then branch based upon the result. This option is only meaningful on
7230 architectures that support such instructions, which include x86, PowerPC,
7231 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
7232 doesn't remove the decrement and branch instructions from the generated
7233 instruction stream introduced by other optimization passes.
7234
7235 Enabled by default at @option{-O1} and higher.
7236
7237 The default is @option{-fbranch-count-reg}.
7238
7239 @item -fno-function-cse
7240 @opindex fno-function-cse
7241 Do not put function addresses in registers; make each instruction that
7242 calls a constant function contain the function's address explicitly.
7243
7244 This option results in less efficient code, but some strange hacks
7245 that alter the assembler output may be confused by the optimizations
7246 performed when this option is not used.
7247
7248 The default is @option{-ffunction-cse}
7249
7250 @item -fno-zero-initialized-in-bss
7251 @opindex fno-zero-initialized-in-bss
7252 If the target supports a BSS section, GCC by default puts variables that
7253 are initialized to zero into BSS@. This can save space in the resulting
7254 code.
7255
7256 This option turns off this behavior because some programs explicitly
7257 rely on variables going to the data section---e.g., so that the
7258 resulting executable can find the beginning of that section and/or make
7259 assumptions based on that.
7260
7261 The default is @option{-fzero-initialized-in-bss}.
7262
7263 @item -fthread-jumps
7264 @opindex fthread-jumps
7265 Perform optimizations that check to see if a jump branches to a
7266 location where another comparison subsumed by the first is found. If
7267 so, the first branch is redirected to either the destination of the
7268 second branch or a point immediately following it, depending on whether
7269 the condition is known to be true or false.
7270
7271 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7272
7273 @item -fsplit-wide-types
7274 @opindex fsplit-wide-types
7275 When using a type that occupies multiple registers, such as @code{long
7276 long} on a 32-bit system, split the registers apart and allocate them
7277 independently. This normally generates better code for those types,
7278 but may make debugging more difficult.
7279
7280 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
7281 @option{-Os}.
7282
7283 @item -fcse-follow-jumps
7284 @opindex fcse-follow-jumps
7285 In common subexpression elimination (CSE), scan through jump instructions
7286 when the target of the jump is not reached by any other path. For
7287 example, when CSE encounters an @code{if} statement with an
7288 @code{else} clause, CSE follows the jump when the condition
7289 tested is false.
7290
7291 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7292
7293 @item -fcse-skip-blocks
7294 @opindex fcse-skip-blocks
7295 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
7296 follow jumps that conditionally skip over blocks. When CSE
7297 encounters a simple @code{if} statement with no else clause,
7298 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
7299 body of the @code{if}.
7300
7301 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7302
7303 @item -frerun-cse-after-loop
7304 @opindex frerun-cse-after-loop
7305 Re-run common subexpression elimination after loop optimizations are
7306 performed.
7307
7308 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7309
7310 @item -fgcse
7311 @opindex fgcse
7312 Perform a global common subexpression elimination pass.
7313 This pass also performs global constant and copy propagation.
7314
7315 @emph{Note:} When compiling a program using computed gotos, a GCC
7316 extension, you may get better run-time performance if you disable
7317 the global common subexpression elimination pass by adding
7318 @option{-fno-gcse} to the command line.
7319
7320 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7321
7322 @item -fgcse-lm
7323 @opindex fgcse-lm
7324 When @option{-fgcse-lm} is enabled, global common subexpression elimination
7325 attempts to move loads that are only killed by stores into themselves. This
7326 allows a loop containing a load/store sequence to be changed to a load outside
7327 the loop, and a copy/store within the loop.
7328
7329 Enabled by default when @option{-fgcse} is enabled.
7330
7331 @item -fgcse-sm
7332 @opindex fgcse-sm
7333 When @option{-fgcse-sm} is enabled, a store motion pass is run after
7334 global common subexpression elimination. This pass attempts to move
7335 stores out of loops. When used in conjunction with @option{-fgcse-lm},
7336 loops containing a load/store sequence can be changed to a load before
7337 the loop and a store after the loop.
7338
7339 Not enabled at any optimization level.
7340
7341 @item -fgcse-las
7342 @opindex fgcse-las
7343 When @option{-fgcse-las} is enabled, the global common subexpression
7344 elimination pass eliminates redundant loads that come after stores to the
7345 same memory location (both partial and full redundancies).
7346
7347 Not enabled at any optimization level.
7348
7349 @item -fgcse-after-reload
7350 @opindex fgcse-after-reload
7351 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
7352 pass is performed after reload. The purpose of this pass is to clean up
7353 redundant spilling.
7354
7355 @item -faggressive-loop-optimizations
7356 @opindex faggressive-loop-optimizations
7357 This option tells the loop optimizer to use language constraints to
7358 derive bounds for the number of iterations of a loop. This assumes that
7359 loop code does not invoke undefined behavior by for example causing signed
7360 integer overflows or out-of-bound array accesses. The bounds for the
7361 number of iterations of a loop are used to guide loop unrolling and peeling
7362 and loop exit test optimizations.
7363 This option is enabled by default.
7364
7365 @item -funconstrained-commons
7366 @opindex funconstrained-commons
7367 This option tells the compiler that variables declared in common blocks
7368 (e.g. Fortran) may later be overridden with longer trailing arrays. This
7369 prevents certain optimizations that depend on knowing the array bounds.
7370
7371 @item -fcrossjumping
7372 @opindex fcrossjumping
7373 Perform cross-jumping transformation.
7374 This transformation unifies equivalent code and saves code size. The
7375 resulting code may or may not perform better than without cross-jumping.
7376
7377 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7378
7379 @item -fauto-inc-dec
7380 @opindex fauto-inc-dec
7381 Combine increments or decrements of addresses with memory accesses.
7382 This pass is always skipped on architectures that do not have
7383 instructions to support this. Enabled by default at @option{-O} and
7384 higher on architectures that support this.
7385
7386 @item -fdce
7387 @opindex fdce
7388 Perform dead code elimination (DCE) on RTL@.
7389 Enabled by default at @option{-O} and higher.
7390
7391 @item -fdse
7392 @opindex fdse
7393 Perform dead store elimination (DSE) on RTL@.
7394 Enabled by default at @option{-O} and higher.
7395
7396 @item -fif-conversion
7397 @opindex fif-conversion
7398 Attempt to transform conditional jumps into branch-less equivalents. This
7399 includes use of conditional moves, min, max, set flags and abs instructions, and
7400 some tricks doable by standard arithmetics. The use of conditional execution
7401 on chips where it is available is controlled by @option{-fif-conversion2}.
7402
7403 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7404
7405 @item -fif-conversion2
7406 @opindex fif-conversion2
7407 Use conditional execution (where available) to transform conditional jumps into
7408 branch-less equivalents.
7409
7410 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7411
7412 @item -fdeclone-ctor-dtor
7413 @opindex fdeclone-ctor-dtor
7414 The C++ ABI requires multiple entry points for constructors and
7415 destructors: one for a base subobject, one for a complete object, and
7416 one for a virtual destructor that calls operator delete afterwards.
7417 For a hierarchy with virtual bases, the base and complete variants are
7418 clones, which means two copies of the function. With this option, the
7419 base and complete variants are changed to be thunks that call a common
7420 implementation.
7421
7422 Enabled by @option{-Os}.
7423
7424 @item -fdelete-null-pointer-checks
7425 @opindex fdelete-null-pointer-checks
7426 Assume that programs cannot safely dereference null pointers, and that
7427 no code or data element resides at address zero.
7428 This option enables simple constant
7429 folding optimizations at all optimization levels. In addition, other
7430 optimization passes in GCC use this flag to control global dataflow
7431 analyses that eliminate useless checks for null pointers; these assume
7432 that a memory access to address zero always results in a trap, so
7433 that if a pointer is checked after it has already been dereferenced,
7434 it cannot be null.
7435
7436 Note however that in some environments this assumption is not true.
7437 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
7438 for programs that depend on that behavior.
7439
7440 This option is enabled by default on most targets. On Nios II ELF, it
7441 defaults to off. On AVR and CR16, this option is completely disabled.
7442
7443 Passes that use the dataflow information
7444 are enabled independently at different optimization levels.
7445
7446 @item -fdevirtualize
7447 @opindex fdevirtualize
7448 Attempt to convert calls to virtual functions to direct calls. This
7449 is done both within a procedure and interprocedurally as part of
7450 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
7451 propagation (@option{-fipa-cp}).
7452 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7453
7454 @item -fdevirtualize-speculatively
7455 @opindex fdevirtualize-speculatively
7456 Attempt to convert calls to virtual functions to speculative direct calls.
7457 Based on the analysis of the type inheritance graph, determine for a given call
7458 the set of likely targets. If the set is small, preferably of size 1, change
7459 the call into a conditional deciding between direct and indirect calls. The
7460 speculative calls enable more optimizations, such as inlining. When they seem
7461 useless after further optimization, they are converted back into original form.
7462
7463 @item -fdevirtualize-at-ltrans
7464 @opindex fdevirtualize-at-ltrans
7465 Stream extra information needed for aggressive devirtualization when running
7466 the link-time optimizer in local transformation mode.
7467 This option enables more devirtualization but
7468 significantly increases the size of streamed data. For this reason it is
7469 disabled by default.
7470
7471 @item -fexpensive-optimizations
7472 @opindex fexpensive-optimizations
7473 Perform a number of minor optimizations that are relatively expensive.
7474
7475 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7476
7477 @item -free
7478 @opindex free
7479 Attempt to remove redundant extension instructions. This is especially
7480 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
7481 registers after writing to their lower 32-bit half.
7482
7483 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
7484 @option{-O3}, @option{-Os}.
7485
7486 @item -fno-lifetime-dse
7487 @opindex fno-lifetime-dse
7488 In C++ the value of an object is only affected by changes within its
7489 lifetime: when the constructor begins, the object has an indeterminate
7490 value, and any changes during the lifetime of the object are dead when
7491 the object is destroyed. Normally dead store elimination will take
7492 advantage of this; if your code relies on the value of the object
7493 storage persisting beyond the lifetime of the object, you can use this
7494 flag to disable this optimization. To preserve stores before the
7495 constructor starts (e.g. because your operator new clears the object
7496 storage) but still treat the object as dead after the destructor you,
7497 can use @option{-flifetime-dse=1}. The default behavior can be
7498 explicitly selected with @option{-flifetime-dse=2}.
7499 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
7500
7501 @item -flive-range-shrinkage
7502 @opindex flive-range-shrinkage
7503 Attempt to decrease register pressure through register live range
7504 shrinkage. This is helpful for fast processors with small or moderate
7505 size register sets.
7506
7507 @item -fira-algorithm=@var{algorithm}
7508 @opindex fira-algorithm
7509 Use the specified coloring algorithm for the integrated register
7510 allocator. The @var{algorithm} argument can be @samp{priority}, which
7511 specifies Chow's priority coloring, or @samp{CB}, which specifies
7512 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
7513 for all architectures, but for those targets that do support it, it is
7514 the default because it generates better code.
7515
7516 @item -fira-region=@var{region}
7517 @opindex fira-region
7518 Use specified regions for the integrated register allocator. The
7519 @var{region} argument should be one of the following:
7520
7521 @table @samp
7522
7523 @item all
7524 Use all loops as register allocation regions.
7525 This can give the best results for machines with a small and/or
7526 irregular register set.
7527
7528 @item mixed
7529 Use all loops except for loops with small register pressure
7530 as the regions. This value usually gives
7531 the best results in most cases and for most architectures,
7532 and is enabled by default when compiling with optimization for speed
7533 (@option{-O}, @option{-O2}, @dots{}).
7534
7535 @item one
7536 Use all functions as a single region.
7537 This typically results in the smallest code size, and is enabled by default for
7538 @option{-Os} or @option{-O0}.
7539
7540 @end table
7541
7542 @item -fira-hoist-pressure
7543 @opindex fira-hoist-pressure
7544 Use IRA to evaluate register pressure in the code hoisting pass for
7545 decisions to hoist expressions. This option usually results in smaller
7546 code, but it can slow the compiler down.
7547
7548 This option is enabled at level @option{-Os} for all targets.
7549
7550 @item -fira-loop-pressure
7551 @opindex fira-loop-pressure
7552 Use IRA to evaluate register pressure in loops for decisions to move
7553 loop invariants. This option usually results in generation
7554 of faster and smaller code on machines with large register files (>= 32
7555 registers), but it can slow the compiler down.
7556
7557 This option is enabled at level @option{-O3} for some targets.
7558
7559 @item -fno-ira-share-save-slots
7560 @opindex fno-ira-share-save-slots
7561 Disable sharing of stack slots used for saving call-used hard
7562 registers living through a call. Each hard register gets a
7563 separate stack slot, and as a result function stack frames are
7564 larger.
7565
7566 @item -fno-ira-share-spill-slots
7567 @opindex fno-ira-share-spill-slots
7568 Disable sharing of stack slots allocated for pseudo-registers. Each
7569 pseudo-register that does not get a hard register gets a separate
7570 stack slot, and as a result function stack frames are larger.
7571
7572 @item -flra-remat
7573 @opindex flra-remat
7574 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7575 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7576 values if it is profitable.
7577
7578 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7579
7580 @item -fdelayed-branch
7581 @opindex fdelayed-branch
7582 If supported for the target machine, attempt to reorder instructions
7583 to exploit instruction slots available after delayed branch
7584 instructions.
7585
7586 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7587
7588 @item -fschedule-insns
7589 @opindex fschedule-insns
7590 If supported for the target machine, attempt to reorder instructions to
7591 eliminate execution stalls due to required data being unavailable. This
7592 helps machines that have slow floating point or memory load instructions
7593 by allowing other instructions to be issued until the result of the load
7594 or floating-point instruction is required.
7595
7596 Enabled at levels @option{-O2}, @option{-O3}.
7597
7598 @item -fschedule-insns2
7599 @opindex fschedule-insns2
7600 Similar to @option{-fschedule-insns}, but requests an additional pass of
7601 instruction scheduling after register allocation has been done. This is
7602 especially useful on machines with a relatively small number of
7603 registers and where memory load instructions take more than one cycle.
7604
7605 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7606
7607 @item -fno-sched-interblock
7608 @opindex fno-sched-interblock
7609 Don't schedule instructions across basic blocks. This is normally
7610 enabled by default when scheduling before register allocation, i.e.@:
7611 with @option{-fschedule-insns} or at @option{-O2} or higher.
7612
7613 @item -fno-sched-spec
7614 @opindex fno-sched-spec
7615 Don't allow speculative motion of non-load instructions. This is normally
7616 enabled by default when scheduling before register allocation, i.e.@:
7617 with @option{-fschedule-insns} or at @option{-O2} or higher.
7618
7619 @item -fsched-pressure
7620 @opindex fsched-pressure
7621 Enable register pressure sensitive insn scheduling before register
7622 allocation. This only makes sense when scheduling before register
7623 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7624 @option{-O2} or higher. Usage of this option can improve the
7625 generated code and decrease its size by preventing register pressure
7626 increase above the number of available hard registers and subsequent
7627 spills in register allocation.
7628
7629 @item -fsched-spec-load
7630 @opindex fsched-spec-load
7631 Allow speculative motion of some load instructions. This only makes
7632 sense when scheduling before register allocation, i.e.@: with
7633 @option{-fschedule-insns} or at @option{-O2} or higher.
7634
7635 @item -fsched-spec-load-dangerous
7636 @opindex fsched-spec-load-dangerous
7637 Allow speculative motion of more load instructions. This only makes
7638 sense when scheduling before register allocation, i.e.@: with
7639 @option{-fschedule-insns} or at @option{-O2} or higher.
7640
7641 @item -fsched-stalled-insns
7642 @itemx -fsched-stalled-insns=@var{n}
7643 @opindex fsched-stalled-insns
7644 Define how many insns (if any) can be moved prematurely from the queue
7645 of stalled insns into the ready list during the second scheduling pass.
7646 @option{-fno-sched-stalled-insns} means that no insns are moved
7647 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7648 on how many queued insns can be moved prematurely.
7649 @option{-fsched-stalled-insns} without a value is equivalent to
7650 @option{-fsched-stalled-insns=1}.
7651
7652 @item -fsched-stalled-insns-dep
7653 @itemx -fsched-stalled-insns-dep=@var{n}
7654 @opindex fsched-stalled-insns-dep
7655 Define how many insn groups (cycles) are examined for a dependency
7656 on a stalled insn that is a candidate for premature removal from the queue
7657 of stalled insns. This has an effect only during the second scheduling pass,
7658 and only if @option{-fsched-stalled-insns} is used.
7659 @option{-fno-sched-stalled-insns-dep} is equivalent to
7660 @option{-fsched-stalled-insns-dep=0}.
7661 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7662 @option{-fsched-stalled-insns-dep=1}.
7663
7664 @item -fsched2-use-superblocks
7665 @opindex fsched2-use-superblocks
7666 When scheduling after register allocation, use superblock scheduling.
7667 This allows motion across basic block boundaries,
7668 resulting in faster schedules. This option is experimental, as not all machine
7669 descriptions used by GCC model the CPU closely enough to avoid unreliable
7670 results from the algorithm.
7671
7672 This only makes sense when scheduling after register allocation, i.e.@: with
7673 @option{-fschedule-insns2} or at @option{-O2} or higher.
7674
7675 @item -fsched-group-heuristic
7676 @opindex fsched-group-heuristic
7677 Enable the group heuristic in the scheduler. This heuristic favors
7678 the instruction that belongs to a schedule group. This is enabled
7679 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7680 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7681
7682 @item -fsched-critical-path-heuristic
7683 @opindex fsched-critical-path-heuristic
7684 Enable the critical-path heuristic in the scheduler. This heuristic favors
7685 instructions on the critical path. This is enabled by default when
7686 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7687 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7688
7689 @item -fsched-spec-insn-heuristic
7690 @opindex fsched-spec-insn-heuristic
7691 Enable the speculative instruction heuristic in the scheduler. This
7692 heuristic favors speculative instructions with greater dependency weakness.
7693 This is enabled by default when scheduling is enabled, i.e.@:
7694 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7695 or at @option{-O2} or higher.
7696
7697 @item -fsched-rank-heuristic
7698 @opindex fsched-rank-heuristic
7699 Enable the rank heuristic in the scheduler. This heuristic favors
7700 the instruction belonging to a basic block with greater size or frequency.
7701 This is enabled by default when scheduling is enabled, i.e.@:
7702 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7703 at @option{-O2} or higher.
7704
7705 @item -fsched-last-insn-heuristic
7706 @opindex fsched-last-insn-heuristic
7707 Enable the last-instruction heuristic in the scheduler. This heuristic
7708 favors the instruction that is less dependent on the last instruction
7709 scheduled. This is enabled by default when scheduling is enabled,
7710 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7711 at @option{-O2} or higher.
7712
7713 @item -fsched-dep-count-heuristic
7714 @opindex fsched-dep-count-heuristic
7715 Enable the dependent-count heuristic in the scheduler. This heuristic
7716 favors the instruction that has more instructions depending on it.
7717 This is enabled by default when scheduling is enabled, i.e.@:
7718 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7719 at @option{-O2} or higher.
7720
7721 @item -freschedule-modulo-scheduled-loops
7722 @opindex freschedule-modulo-scheduled-loops
7723 Modulo scheduling is performed before traditional scheduling. If a loop
7724 is modulo scheduled, later scheduling passes may change its schedule.
7725 Use this option to control that behavior.
7726
7727 @item -fselective-scheduling
7728 @opindex fselective-scheduling
7729 Schedule instructions using selective scheduling algorithm. Selective
7730 scheduling runs instead of the first scheduler pass.
7731
7732 @item -fselective-scheduling2
7733 @opindex fselective-scheduling2
7734 Schedule instructions using selective scheduling algorithm. Selective
7735 scheduling runs instead of the second scheduler pass.
7736
7737 @item -fsel-sched-pipelining
7738 @opindex fsel-sched-pipelining
7739 Enable software pipelining of innermost loops during selective scheduling.
7740 This option has no effect unless one of @option{-fselective-scheduling} or
7741 @option{-fselective-scheduling2} is turned on.
7742
7743 @item -fsel-sched-pipelining-outer-loops
7744 @opindex fsel-sched-pipelining-outer-loops
7745 When pipelining loops during selective scheduling, also pipeline outer loops.
7746 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7747
7748 @item -fsemantic-interposition
7749 @opindex fsemantic-interposition
7750 Some object formats, like ELF, allow interposing of symbols by the
7751 dynamic linker.
7752 This means that for symbols exported from the DSO, the compiler cannot perform
7753 interprocedural propagation, inlining and other optimizations in anticipation
7754 that the function or variable in question may change. While this feature is
7755 useful, for example, to rewrite memory allocation functions by a debugging
7756 implementation, it is expensive in the terms of code quality.
7757 With @option{-fno-semantic-interposition} the compiler assumes that
7758 if interposition happens for functions the overwriting function will have
7759 precisely the same semantics (and side effects).
7760 Similarly if interposition happens
7761 for variables, the constructor of the variable will be the same. The flag
7762 has no effect for functions explicitly declared inline
7763 (where it is never allowed for interposition to change semantics)
7764 and for symbols explicitly declared weak.
7765
7766 @item -fshrink-wrap
7767 @opindex fshrink-wrap
7768 Emit function prologues only before parts of the function that need it,
7769 rather than at the top of the function. This flag is enabled by default at
7770 @option{-O} and higher.
7771
7772 @item -fshrink-wrap-separate
7773 @opindex fshrink-wrap-separate
7774 Shrink-wrap separate parts of the prologue and epilogue separately, so that
7775 those parts are only executed when needed.
7776 This option is on by default, but has no effect unless @option{-fshrink-wrap}
7777 is also turned on and the target supports this.
7778
7779 @item -fcaller-saves
7780 @opindex fcaller-saves
7781 Enable allocation of values to registers that are clobbered by
7782 function calls, by emitting extra instructions to save and restore the
7783 registers around such calls. Such allocation is done only when it
7784 seems to result in better code.
7785
7786 This option is always enabled by default on certain machines, usually
7787 those which have no call-preserved registers to use instead.
7788
7789 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7790
7791 @item -fcombine-stack-adjustments
7792 @opindex fcombine-stack-adjustments
7793 Tracks stack adjustments (pushes and pops) and stack memory references
7794 and then tries to find ways to combine them.
7795
7796 Enabled by default at @option{-O1} and higher.
7797
7798 @item -fipa-ra
7799 @opindex fipa-ra
7800 Use caller save registers for allocation if those registers are not used by
7801 any called function. In that case it is not necessary to save and restore
7802 them around calls. This is only possible if called functions are part of
7803 same compilation unit as current function and they are compiled before it.
7804
7805 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
7806 is disabled if generated code will be instrumented for profiling
7807 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
7808 exactly (this happens on targets that do not expose prologues
7809 and epilogues in RTL).
7810
7811 @item -fconserve-stack
7812 @opindex fconserve-stack
7813 Attempt to minimize stack usage. The compiler attempts to use less
7814 stack space, even if that makes the program slower. This option
7815 implies setting the @option{large-stack-frame} parameter to 100
7816 and the @option{large-stack-frame-growth} parameter to 400.
7817
7818 @item -ftree-reassoc
7819 @opindex ftree-reassoc
7820 Perform reassociation on trees. This flag is enabled by default
7821 at @option{-O} and higher.
7822
7823 @item -fcode-hoisting
7824 @opindex fcode-hoisting
7825 Perform code hoisting. Code hoisting tries to move the
7826 evaluation of expressions executed on all paths to the function exit
7827 as early as possible. This is especially useful as a code size
7828 optimization, but it often helps for code speed as well.
7829 This flag is enabled by default at @option{-O2} and higher.
7830
7831 @item -ftree-pre
7832 @opindex ftree-pre
7833 Perform partial redundancy elimination (PRE) on trees. This flag is
7834 enabled by default at @option{-O2} and @option{-O3}.
7835
7836 @item -ftree-partial-pre
7837 @opindex ftree-partial-pre
7838 Make partial redundancy elimination (PRE) more aggressive. This flag is
7839 enabled by default at @option{-O3}.
7840
7841 @item -ftree-forwprop
7842 @opindex ftree-forwprop
7843 Perform forward propagation on trees. This flag is enabled by default
7844 at @option{-O} and higher.
7845
7846 @item -ftree-fre
7847 @opindex ftree-fre
7848 Perform full redundancy elimination (FRE) on trees. The difference
7849 between FRE and PRE is that FRE only considers expressions
7850 that are computed on all paths leading to the redundant computation.
7851 This analysis is faster than PRE, though it exposes fewer redundancies.
7852 This flag is enabled by default at @option{-O} and higher.
7853
7854 @item -ftree-phiprop
7855 @opindex ftree-phiprop
7856 Perform hoisting of loads from conditional pointers on trees. This
7857 pass is enabled by default at @option{-O} and higher.
7858
7859 @item -fhoist-adjacent-loads
7860 @opindex fhoist-adjacent-loads
7861 Speculatively hoist loads from both branches of an if-then-else if the
7862 loads are from adjacent locations in the same structure and the target
7863 architecture has a conditional move instruction. This flag is enabled
7864 by default at @option{-O2} and higher.
7865
7866 @item -ftree-copy-prop
7867 @opindex ftree-copy-prop
7868 Perform copy propagation on trees. This pass eliminates unnecessary
7869 copy operations. This flag is enabled by default at @option{-O} and
7870 higher.
7871
7872 @item -fipa-pure-const
7873 @opindex fipa-pure-const
7874 Discover which functions are pure or constant.
7875 Enabled by default at @option{-O} and higher.
7876
7877 @item -fipa-reference
7878 @opindex fipa-reference
7879 Discover which static variables do not escape the
7880 compilation unit.
7881 Enabled by default at @option{-O} and higher.
7882
7883 @item -fipa-pta
7884 @opindex fipa-pta
7885 Perform interprocedural pointer analysis and interprocedural modification
7886 and reference analysis. This option can cause excessive memory and
7887 compile-time usage on large compilation units. It is not enabled by
7888 default at any optimization level.
7889
7890 @item -fipa-profile
7891 @opindex fipa-profile
7892 Perform interprocedural profile propagation. The functions called only from
7893 cold functions are marked as cold. Also functions executed once (such as
7894 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7895 functions and loop less parts of functions executed once are then optimized for
7896 size.
7897 Enabled by default at @option{-O} and higher.
7898
7899 @item -fipa-cp
7900 @opindex fipa-cp
7901 Perform interprocedural constant propagation.
7902 This optimization analyzes the program to determine when values passed
7903 to functions are constants and then optimizes accordingly.
7904 This optimization can substantially increase performance
7905 if the application has constants passed to functions.
7906 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7907
7908 @item -fipa-cp-clone
7909 @opindex fipa-cp-clone
7910 Perform function cloning to make interprocedural constant propagation stronger.
7911 When enabled, interprocedural constant propagation performs function cloning
7912 when externally visible function can be called with constant arguments.
7913 Because this optimization can create multiple copies of functions,
7914 it may significantly increase code size
7915 (see @option{--param ipcp-unit-growth=@var{value}}).
7916 This flag is enabled by default at @option{-O3}.
7917
7918 @item -fipa-cp-alignment
7919 @opindex -fipa-cp-alignment
7920 When enabled, this optimization propagates alignment of function
7921 parameters to support better vectorization and string operations.
7922
7923 This flag is enabled by default at @option{-O2} and @option{-Os}. It
7924 requires that @option{-fipa-cp} is enabled.
7925 @option{-fipa-cp-alignment} is obsolete, use @option{-fipa-bit-cp} instead.
7926
7927 @item -fipa-bit-cp
7928 @opindex -fipa-bit-cp
7929 When enabled, perform ipa bitwise constant propagation. This flag is
7930 enabled by default at @option{-O2}. It requires that @option{-fipa-cp}
7931 is enabled.
7932
7933 @item -fipa-icf
7934 @opindex fipa-icf
7935 Perform Identical Code Folding for functions and read-only variables.
7936 The optimization reduces code size and may disturb unwind stacks by replacing
7937 a function by equivalent one with a different name. The optimization works
7938 more effectively with link time optimization enabled.
7939
7940 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
7941 works on different levels and thus the optimizations are not same - there are
7942 equivalences that are found only by GCC and equivalences found only by Gold.
7943
7944 This flag is enabled by default at @option{-O2} and @option{-Os}.
7945
7946 @item -fisolate-erroneous-paths-dereference
7947 @opindex fisolate-erroneous-paths-dereference
7948 Detect paths that trigger erroneous or undefined behavior due to
7949 dereferencing a null pointer. Isolate those paths from the main control
7950 flow and turn the statement with erroneous or undefined behavior into a trap.
7951 This flag is enabled by default at @option{-O2} and higher and depends on
7952 @option{-fdelete-null-pointer-checks} also being enabled.
7953
7954 @item -fisolate-erroneous-paths-attribute
7955 @opindex fisolate-erroneous-paths-attribute
7956 Detect paths that trigger erroneous or undefined behavior due a null value
7957 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
7958 attribute. Isolate those paths from the main control flow and turn the
7959 statement with erroneous or undefined behavior into a trap. This is not
7960 currently enabled, but may be enabled by @option{-O2} in the future.
7961
7962 @item -ftree-sink
7963 @opindex ftree-sink
7964 Perform forward store motion on trees. This flag is
7965 enabled by default at @option{-O} and higher.
7966
7967 @item -ftree-bit-ccp
7968 @opindex ftree-bit-ccp
7969 Perform sparse conditional bit constant propagation on trees and propagate
7970 pointer alignment information.
7971 This pass only operates on local scalar variables and is enabled by default
7972 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7973
7974 @item -ftree-ccp
7975 @opindex ftree-ccp
7976 Perform sparse conditional constant propagation (CCP) on trees. This
7977 pass only operates on local scalar variables and is enabled by default
7978 at @option{-O} and higher.
7979
7980 @item -fssa-backprop
7981 @opindex fssa-backprop
7982 Propagate information about uses of a value up the definition chain
7983 in order to simplify the definitions. For example, this pass strips
7984 sign operations if the sign of a value never matters. The flag is
7985 enabled by default at @option{-O} and higher.
7986
7987 @item -fssa-phiopt
7988 @opindex fssa-phiopt
7989 Perform pattern matching on SSA PHI nodes to optimize conditional
7990 code. This pass is enabled by default at @option{-O} and higher.
7991
7992 @item -ftree-switch-conversion
7993 @opindex ftree-switch-conversion
7994 Perform conversion of simple initializations in a switch to
7995 initializations from a scalar array. This flag is enabled by default
7996 at @option{-O2} and higher.
7997
7998 @item -ftree-tail-merge
7999 @opindex ftree-tail-merge
8000 Look for identical code sequences. When found, replace one with a jump to the
8001 other. This optimization is known as tail merging or cross jumping. This flag
8002 is enabled by default at @option{-O2} and higher. The compilation time
8003 in this pass can
8004 be limited using @option{max-tail-merge-comparisons} parameter and
8005 @option{max-tail-merge-iterations} parameter.
8006
8007 @item -ftree-dce
8008 @opindex ftree-dce
8009 Perform dead code elimination (DCE) on trees. This flag is enabled by
8010 default at @option{-O} and higher.
8011
8012 @item -ftree-builtin-call-dce
8013 @opindex ftree-builtin-call-dce
8014 Perform conditional dead code elimination (DCE) for calls to built-in functions
8015 that may set @code{errno} but are otherwise side-effect free. This flag is
8016 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8017 specified.
8018
8019 @item -ftree-dominator-opts
8020 @opindex ftree-dominator-opts
8021 Perform a variety of simple scalar cleanups (constant/copy
8022 propagation, redundancy elimination, range propagation and expression
8023 simplification) based on a dominator tree traversal. This also
8024 performs jump threading (to reduce jumps to jumps). This flag is
8025 enabled by default at @option{-O} and higher.
8026
8027 @item -ftree-dse
8028 @opindex ftree-dse
8029 Perform dead store elimination (DSE) on trees. A dead store is a store into
8030 a memory location that is later overwritten by another store without
8031 any intervening loads. In this case the earlier store can be deleted. This
8032 flag is enabled by default at @option{-O} and higher.
8033
8034 @item -ftree-ch
8035 @opindex ftree-ch
8036 Perform loop header copying on trees. This is beneficial since it increases
8037 effectiveness of code motion optimizations. It also saves one jump. This flag
8038 is enabled by default at @option{-O} and higher. It is not enabled
8039 for @option{-Os}, since it usually increases code size.
8040
8041 @item -ftree-loop-optimize
8042 @opindex ftree-loop-optimize
8043 Perform loop optimizations on trees. This flag is enabled by default
8044 at @option{-O} and higher.
8045
8046 @item -ftree-loop-linear
8047 @itemx -floop-interchange
8048 @itemx -floop-strip-mine
8049 @itemx -floop-block
8050 @itemx -floop-unroll-and-jam
8051 @opindex ftree-loop-linear
8052 @opindex floop-interchange
8053 @opindex floop-strip-mine
8054 @opindex floop-block
8055 @opindex floop-unroll-and-jam
8056 Perform loop nest optimizations. Same as
8057 @option{-floop-nest-optimize}. To use this code transformation, GCC has
8058 to be configured with @option{--with-isl} to enable the Graphite loop
8059 transformation infrastructure.
8060
8061 @item -fgraphite-identity
8062 @opindex fgraphite-identity
8063 Enable the identity transformation for graphite. For every SCoP we generate
8064 the polyhedral representation and transform it back to gimple. Using
8065 @option{-fgraphite-identity} we can check the costs or benefits of the
8066 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8067 are also performed by the code generator isl, like index splitting and
8068 dead code elimination in loops.
8069
8070 @item -floop-nest-optimize
8071 @opindex floop-nest-optimize
8072 Enable the isl based loop nest optimizer. This is a generic loop nest
8073 optimizer based on the Pluto optimization algorithms. It calculates a loop
8074 structure optimized for data-locality and parallelism. This option
8075 is experimental.
8076
8077 @item -floop-parallelize-all
8078 @opindex floop-parallelize-all
8079 Use the Graphite data dependence analysis to identify loops that can
8080 be parallelized. Parallelize all the loops that can be analyzed to
8081 not contain loop carried dependences without checking that it is
8082 profitable to parallelize the loops.
8083
8084 @item -ftree-coalesce-vars
8085 @opindex ftree-coalesce-vars
8086 While transforming the program out of the SSA representation, attempt to
8087 reduce copying by coalescing versions of different user-defined
8088 variables, instead of just compiler temporaries. This may severely
8089 limit the ability to debug an optimized program compiled with
8090 @option{-fno-var-tracking-assignments}. In the negated form, this flag
8091 prevents SSA coalescing of user variables. This option is enabled by
8092 default if optimization is enabled, and it does very little otherwise.
8093
8094 @item -ftree-loop-if-convert
8095 @opindex ftree-loop-if-convert
8096 Attempt to transform conditional jumps in the innermost loops to
8097 branch-less equivalents. The intent is to remove control-flow from
8098 the innermost loops in order to improve the ability of the
8099 vectorization pass to handle these loops. This is enabled by default
8100 if vectorization is enabled.
8101
8102 @item -ftree-loop-distribution
8103 @opindex ftree-loop-distribution
8104 Perform loop distribution. This flag can improve cache performance on
8105 big loop bodies and allow further loop optimizations, like
8106 parallelization or vectorization, to take place. For example, the loop
8107 @smallexample
8108 DO I = 1, N
8109 A(I) = B(I) + C
8110 D(I) = E(I) * F
8111 ENDDO
8112 @end smallexample
8113 is transformed to
8114 @smallexample
8115 DO I = 1, N
8116 A(I) = B(I) + C
8117 ENDDO
8118 DO I = 1, N
8119 D(I) = E(I) * F
8120 ENDDO
8121 @end smallexample
8122
8123 @item -ftree-loop-distribute-patterns
8124 @opindex ftree-loop-distribute-patterns
8125 Perform loop distribution of patterns that can be code generated with
8126 calls to a library. This flag is enabled by default at @option{-O3}.
8127
8128 This pass distributes the initialization loops and generates a call to
8129 memset zero. For example, the loop
8130 @smallexample
8131 DO I = 1, N
8132 A(I) = 0
8133 B(I) = A(I) + I
8134 ENDDO
8135 @end smallexample
8136 is transformed to
8137 @smallexample
8138 DO I = 1, N
8139 A(I) = 0
8140 ENDDO
8141 DO I = 1, N
8142 B(I) = A(I) + I
8143 ENDDO
8144 @end smallexample
8145 and the initialization loop is transformed into a call to memset zero.
8146
8147 @item -ftree-loop-im
8148 @opindex ftree-loop-im
8149 Perform loop invariant motion on trees. This pass moves only invariants that
8150 are hard to handle at RTL level (function calls, operations that expand to
8151 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8152 operands of conditions that are invariant out of the loop, so that we can use
8153 just trivial invariantness analysis in loop unswitching. The pass also includes
8154 store motion.
8155
8156 @item -ftree-loop-ivcanon
8157 @opindex ftree-loop-ivcanon
8158 Create a canonical counter for number of iterations in loops for which
8159 determining number of iterations requires complicated analysis. Later
8160 optimizations then may determine the number easily. Useful especially
8161 in connection with unrolling.
8162
8163 @item -fivopts
8164 @opindex fivopts
8165 Perform induction variable optimizations (strength reduction, induction
8166 variable merging and induction variable elimination) on trees.
8167
8168 @item -ftree-parallelize-loops=n
8169 @opindex ftree-parallelize-loops
8170 Parallelize loops, i.e., split their iteration space to run in n threads.
8171 This is only possible for loops whose iterations are independent
8172 and can be arbitrarily reordered. The optimization is only
8173 profitable on multiprocessor machines, for loops that are CPU-intensive,
8174 rather than constrained e.g.@: by memory bandwidth. This option
8175 implies @option{-pthread}, and thus is only supported on targets
8176 that have support for @option{-pthread}.
8177
8178 @item -ftree-pta
8179 @opindex ftree-pta
8180 Perform function-local points-to analysis on trees. This flag is
8181 enabled by default at @option{-O} and higher.
8182
8183 @item -ftree-sra
8184 @opindex ftree-sra
8185 Perform scalar replacement of aggregates. This pass replaces structure
8186 references with scalars to prevent committing structures to memory too
8187 early. This flag is enabled by default at @option{-O} and higher.
8188
8189 @item -fstore-merging
8190 @opindex fstore-merging
8191 Perform merging of narrow stores to consecutive memory addresses. This pass
8192 merges contiguous stores of immediate values narrower than a word into fewer
8193 wider stores to reduce the number of instructions. This is enabled by default
8194 at @option{-O} and higher.
8195
8196 @item -ftree-ter
8197 @opindex ftree-ter
8198 Perform temporary expression replacement during the SSA->normal phase. Single
8199 use/single def temporaries are replaced at their use location with their
8200 defining expression. This results in non-GIMPLE code, but gives the expanders
8201 much more complex trees to work on resulting in better RTL generation. This is
8202 enabled by default at @option{-O} and higher.
8203
8204 @item -ftree-slsr
8205 @opindex ftree-slsr
8206 Perform straight-line strength reduction on trees. This recognizes related
8207 expressions involving multiplications and replaces them by less expensive
8208 calculations when possible. This is enabled by default at @option{-O} and
8209 higher.
8210
8211 @item -ftree-vectorize
8212 @opindex ftree-vectorize
8213 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8214 and @option{-ftree-slp-vectorize} if not explicitly specified.
8215
8216 @item -ftree-loop-vectorize
8217 @opindex ftree-loop-vectorize
8218 Perform loop vectorization on trees. This flag is enabled by default at
8219 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8220
8221 @item -ftree-slp-vectorize
8222 @opindex ftree-slp-vectorize
8223 Perform basic block vectorization on trees. This flag is enabled by default at
8224 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8225
8226 @item -fvect-cost-model=@var{model}
8227 @opindex fvect-cost-model
8228 Alter the cost model used for vectorization. The @var{model} argument
8229 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
8230 With the @samp{unlimited} model the vectorized code-path is assumed
8231 to be profitable while with the @samp{dynamic} model a runtime check
8232 guards the vectorized code-path to enable it only for iteration
8233 counts that will likely execute faster than when executing the original
8234 scalar loop. The @samp{cheap} model disables vectorization of
8235 loops where doing so would be cost prohibitive for example due to
8236 required runtime checks for data dependence or alignment but otherwise
8237 is equal to the @samp{dynamic} model.
8238 The default cost model depends on other optimization flags and is
8239 either @samp{dynamic} or @samp{cheap}.
8240
8241 @item -fsimd-cost-model=@var{model}
8242 @opindex fsimd-cost-model
8243 Alter the cost model used for vectorization of loops marked with the OpenMP
8244 or Cilk Plus simd directive. The @var{model} argument should be one of
8245 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
8246 have the same meaning as described in @option{-fvect-cost-model} and by
8247 default a cost model defined with @option{-fvect-cost-model} is used.
8248
8249 @item -ftree-vrp
8250 @opindex ftree-vrp
8251 Perform Value Range Propagation on trees. This is similar to the
8252 constant propagation pass, but instead of values, ranges of values are
8253 propagated. This allows the optimizers to remove unnecessary range
8254 checks like array bound checks and null pointer checks. This is
8255 enabled by default at @option{-O2} and higher. Null pointer check
8256 elimination is only done if @option{-fdelete-null-pointer-checks} is
8257 enabled.
8258
8259 @item -fsplit-paths
8260 @opindex fsplit-paths
8261 Split paths leading to loop backedges. This can improve dead code
8262 elimination and common subexpression elimination. This is enabled by
8263 default at @option{-O2} and above.
8264
8265 @item -fsplit-ivs-in-unroller
8266 @opindex fsplit-ivs-in-unroller
8267 Enables expression of values of induction variables in later iterations
8268 of the unrolled loop using the value in the first iteration. This breaks
8269 long dependency chains, thus improving efficiency of the scheduling passes.
8270
8271 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8272 same effect. However, that is not reliable in cases where the loop body
8273 is more complicated than a single basic block. It also does not work at all
8274 on some architectures due to restrictions in the CSE pass.
8275
8276 This optimization is enabled by default.
8277
8278 @item -fvariable-expansion-in-unroller
8279 @opindex fvariable-expansion-in-unroller
8280 With this option, the compiler creates multiple copies of some
8281 local variables when unrolling a loop, which can result in superior code.
8282
8283 @item -fpartial-inlining
8284 @opindex fpartial-inlining
8285 Inline parts of functions. This option has any effect only
8286 when inlining itself is turned on by the @option{-finline-functions}
8287 or @option{-finline-small-functions} options.
8288
8289 Enabled at level @option{-O2}.
8290
8291 @item -fpredictive-commoning
8292 @opindex fpredictive-commoning
8293 Perform predictive commoning optimization, i.e., reusing computations
8294 (especially memory loads and stores) performed in previous
8295 iterations of loops.
8296
8297 This option is enabled at level @option{-O3}.
8298
8299 @item -fprefetch-loop-arrays
8300 @opindex fprefetch-loop-arrays
8301 If supported by the target machine, generate instructions to prefetch
8302 memory to improve the performance of loops that access large arrays.
8303
8304 This option may generate better or worse code; results are highly
8305 dependent on the structure of loops within the source code.
8306
8307 Disabled at level @option{-Os}.
8308
8309 @item -fno-printf-return-value
8310 @opindex fno-printf-return-value
8311 Do not substitute constants for known return value of formatted output
8312 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
8313 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
8314 transformation allows GCC to optimize or even eliminate branches based
8315 on the known return value of these functions called with arguments that
8316 are either constant, or whose values are known to be in a range that
8317 makes determining the exact return value possible. For example, when
8318 @option{-fprintf-return-value} is in effect, both the branch and the
8319 body of the @code{if} statement (but not the call to @code{snprint})
8320 can be optimized away when @code{i} is a 32-bit or smaller integer
8321 because the return value is guaranteed to be at most 8.
8322
8323 @smallexample
8324 char buf[9];
8325 if (snprintf (buf, "%08x", i) >= sizeof buf)
8326 @dots{}
8327 @end smallexample
8328
8329 The @option{-fprintf-return-value} option relies on other optimizations
8330 and yields best results with @option{-O2}. It works in tandem with the
8331 @option{-Wformat-length} option. The @option{-fprintf-return-value}
8332 option is enabled by default.
8333
8334 @item -fno-peephole
8335 @itemx -fno-peephole2
8336 @opindex fno-peephole
8337 @opindex fno-peephole2
8338 Disable any machine-specific peephole optimizations. The difference
8339 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
8340 are implemented in the compiler; some targets use one, some use the
8341 other, a few use both.
8342
8343 @option{-fpeephole} is enabled by default.
8344 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8345
8346 @item -fno-guess-branch-probability
8347 @opindex fno-guess-branch-probability
8348 Do not guess branch probabilities using heuristics.
8349
8350 GCC uses heuristics to guess branch probabilities if they are
8351 not provided by profiling feedback (@option{-fprofile-arcs}). These
8352 heuristics are based on the control flow graph. If some branch probabilities
8353 are specified by @code{__builtin_expect}, then the heuristics are
8354 used to guess branch probabilities for the rest of the control flow graph,
8355 taking the @code{__builtin_expect} info into account. The interactions
8356 between the heuristics and @code{__builtin_expect} can be complex, and in
8357 some cases, it may be useful to disable the heuristics so that the effects
8358 of @code{__builtin_expect} are easier to understand.
8359
8360 The default is @option{-fguess-branch-probability} at levels
8361 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8362
8363 @item -freorder-blocks
8364 @opindex freorder-blocks
8365 Reorder basic blocks in the compiled function in order to reduce number of
8366 taken branches and improve code locality.
8367
8368 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8369
8370 @item -freorder-blocks-algorithm=@var{algorithm}
8371 @opindex freorder-blocks-algorithm
8372 Use the specified algorithm for basic block reordering. The
8373 @var{algorithm} argument can be @samp{simple}, which does not increase
8374 code size (except sometimes due to secondary effects like alignment),
8375 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
8376 put all often executed code together, minimizing the number of branches
8377 executed by making extra copies of code.
8378
8379 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
8380 @samp{stc} at levels @option{-O2}, @option{-O3}.
8381
8382 @item -freorder-blocks-and-partition
8383 @opindex freorder-blocks-and-partition
8384 In addition to reordering basic blocks in the compiled function, in order
8385 to reduce number of taken branches, partitions hot and cold basic blocks
8386 into separate sections of the assembly and @file{.o} files, to improve
8387 paging and cache locality performance.
8388
8389 This optimization is automatically turned off in the presence of
8390 exception handling, for linkonce sections, for functions with a user-defined
8391 section attribute and on any architecture that does not support named
8392 sections.
8393
8394 Enabled for x86 at levels @option{-O2}, @option{-O3}.
8395
8396 @item -freorder-functions
8397 @opindex freorder-functions
8398 Reorder functions in the object file in order to
8399 improve code locality. This is implemented by using special
8400 subsections @code{.text.hot} for most frequently executed functions and
8401 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
8402 the linker so object file format must support named sections and linker must
8403 place them in a reasonable way.
8404
8405 Also profile feedback must be available to make this option effective. See
8406 @option{-fprofile-arcs} for details.
8407
8408 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8409
8410 @item -fstrict-aliasing
8411 @opindex fstrict-aliasing
8412 Allow the compiler to assume the strictest aliasing rules applicable to
8413 the language being compiled. For C (and C++), this activates
8414 optimizations based on the type of expressions. In particular, an
8415 object of one type is assumed never to reside at the same address as an
8416 object of a different type, unless the types are almost the same. For
8417 example, an @code{unsigned int} can alias an @code{int}, but not a
8418 @code{void*} or a @code{double}. A character type may alias any other
8419 type.
8420
8421 @anchor{Type-punning}Pay special attention to code like this:
8422 @smallexample
8423 union a_union @{
8424 int i;
8425 double d;
8426 @};
8427
8428 int f() @{
8429 union a_union t;
8430 t.d = 3.0;
8431 return t.i;
8432 @}
8433 @end smallexample
8434 The practice of reading from a different union member than the one most
8435 recently written to (called ``type-punning'') is common. Even with
8436 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
8437 is accessed through the union type. So, the code above works as
8438 expected. @xref{Structures unions enumerations and bit-fields
8439 implementation}. However, this code might not:
8440 @smallexample
8441 int f() @{
8442 union a_union t;
8443 int* ip;
8444 t.d = 3.0;
8445 ip = &t.i;
8446 return *ip;
8447 @}
8448 @end smallexample
8449
8450 Similarly, access by taking the address, casting the resulting pointer
8451 and dereferencing the result has undefined behavior, even if the cast
8452 uses a union type, e.g.:
8453 @smallexample
8454 int f() @{
8455 double d = 3.0;
8456 return ((union a_union *) &d)->i;
8457 @}
8458 @end smallexample
8459
8460 The @option{-fstrict-aliasing} option is enabled at levels
8461 @option{-O2}, @option{-O3}, @option{-Os}.
8462
8463 @item -fstrict-overflow
8464 @opindex fstrict-overflow
8465 Allow the compiler to assume strict signed overflow rules, depending
8466 on the language being compiled. For C (and C++) this means that
8467 overflow when doing arithmetic with signed numbers is undefined, which
8468 means that the compiler may assume that it does not happen. This
8469 permits various optimizations. For example, the compiler assumes
8470 that an expression like @code{i + 10 > i} is always true for
8471 signed @code{i}. This assumption is only valid if signed overflow is
8472 undefined, as the expression is false if @code{i + 10} overflows when
8473 using twos complement arithmetic. When this option is in effect any
8474 attempt to determine whether an operation on signed numbers
8475 overflows must be written carefully to not actually involve overflow.
8476
8477 This option also allows the compiler to assume strict pointer
8478 semantics: given a pointer to an object, if adding an offset to that
8479 pointer does not produce a pointer to the same object, the addition is
8480 undefined. This permits the compiler to conclude that @code{p + u >
8481 p} is always true for a pointer @code{p} and unsigned integer
8482 @code{u}. This assumption is only valid because pointer wraparound is
8483 undefined, as the expression is false if @code{p + u} overflows using
8484 twos complement arithmetic.
8485
8486 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
8487 that integer signed overflow is fully defined: it wraps. When
8488 @option{-fwrapv} is used, there is no difference between
8489 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
8490 integers. With @option{-fwrapv} certain types of overflow are
8491 permitted. For example, if the compiler gets an overflow when doing
8492 arithmetic on constants, the overflowed value can still be used with
8493 @option{-fwrapv}, but not otherwise.
8494
8495 The @option{-fstrict-overflow} option is enabled at levels
8496 @option{-O2}, @option{-O3}, @option{-Os}.
8497
8498 @item -falign-functions
8499 @itemx -falign-functions=@var{n}
8500 @opindex falign-functions
8501 Align the start of functions to the next power-of-two greater than
8502 @var{n}, skipping up to @var{n} bytes. For instance,
8503 @option{-falign-functions=32} aligns functions to the next 32-byte
8504 boundary, but @option{-falign-functions=24} aligns to the next
8505 32-byte boundary only if this can be done by skipping 23 bytes or less.
8506
8507 @option{-fno-align-functions} and @option{-falign-functions=1} are
8508 equivalent and mean that functions are not aligned.
8509
8510 Some assemblers only support this flag when @var{n} is a power of two;
8511 in that case, it is rounded up.
8512
8513 If @var{n} is not specified or is zero, use a machine-dependent default.
8514
8515 Enabled at levels @option{-O2}, @option{-O3}.
8516
8517 @item -flimit-function-alignment
8518 If this option is enabled, the compiler tries to avoid unnecessarily
8519 overaligning functions. It attempts to instruct the assembler to align
8520 by the amount specified by @option{-falign-functions}, but not to
8521 skip more bytes than the size of the function.
8522
8523 @item -falign-labels
8524 @itemx -falign-labels=@var{n}
8525 @opindex falign-labels
8526 Align all branch targets to a power-of-two boundary, skipping up to
8527 @var{n} bytes like @option{-falign-functions}. This option can easily
8528 make code slower, because it must insert dummy operations for when the
8529 branch target is reached in the usual flow of the code.
8530
8531 @option{-fno-align-labels} and @option{-falign-labels=1} are
8532 equivalent and mean that labels are not aligned.
8533
8534 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
8535 are greater than this value, then their values are used instead.
8536
8537 If @var{n} is not specified or is zero, use a machine-dependent default
8538 which is very likely to be @samp{1}, meaning no alignment.
8539
8540 Enabled at levels @option{-O2}, @option{-O3}.
8541
8542 @item -falign-loops
8543 @itemx -falign-loops=@var{n}
8544 @opindex falign-loops
8545 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
8546 like @option{-falign-functions}. If the loops are
8547 executed many times, this makes up for any execution of the dummy
8548 operations.
8549
8550 @option{-fno-align-loops} and @option{-falign-loops=1} are
8551 equivalent and mean that loops are not aligned.
8552
8553 If @var{n} is not specified or is zero, use a machine-dependent default.
8554
8555 Enabled at levels @option{-O2}, @option{-O3}.
8556
8557 @item -falign-jumps
8558 @itemx -falign-jumps=@var{n}
8559 @opindex falign-jumps
8560 Align branch targets to a power-of-two boundary, for branch targets
8561 where the targets can only be reached by jumping, skipping up to @var{n}
8562 bytes like @option{-falign-functions}. In this case, no dummy operations
8563 need be executed.
8564
8565 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
8566 equivalent and mean that loops are not aligned.
8567
8568 If @var{n} is not specified or is zero, use a machine-dependent default.
8569
8570 Enabled at levels @option{-O2}, @option{-O3}.
8571
8572 @item -funit-at-a-time
8573 @opindex funit-at-a-time
8574 This option is left for compatibility reasons. @option{-funit-at-a-time}
8575 has no effect, while @option{-fno-unit-at-a-time} implies
8576 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8577
8578 Enabled by default.
8579
8580 @item -fno-toplevel-reorder
8581 @opindex fno-toplevel-reorder
8582 Do not reorder top-level functions, variables, and @code{asm}
8583 statements. Output them in the same order that they appear in the
8584 input file. When this option is used, unreferenced static variables
8585 are not removed. This option is intended to support existing code
8586 that relies on a particular ordering. For new code, it is better to
8587 use attributes when possible.
8588
8589 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8590 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8591 targets.
8592
8593 @item -fweb
8594 @opindex fweb
8595 Constructs webs as commonly used for register allocation purposes and assign
8596 each web individual pseudo register. This allows the register allocation pass
8597 to operate on pseudos directly, but also strengthens several other optimization
8598 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8599 however, make debugging impossible, since variables no longer stay in a
8600 ``home register''.
8601
8602 Enabled by default with @option{-funroll-loops}.
8603
8604 @item -fwhole-program
8605 @opindex fwhole-program
8606 Assume that the current compilation unit represents the whole program being
8607 compiled. All public functions and variables with the exception of @code{main}
8608 and those merged by attribute @code{externally_visible} become static functions
8609 and in effect are optimized more aggressively by interprocedural optimizers.
8610
8611 This option should not be used in combination with @option{-flto}.
8612 Instead relying on a linker plugin should provide safer and more precise
8613 information.
8614
8615 @item -flto[=@var{n}]
8616 @opindex flto
8617 This option runs the standard link-time optimizer. When invoked
8618 with source code, it generates GIMPLE (one of GCC's internal
8619 representations) and writes it to special ELF sections in the object
8620 file. When the object files are linked together, all the function
8621 bodies are read from these ELF sections and instantiated as if they
8622 had been part of the same translation unit.
8623
8624 To use the link-time optimizer, @option{-flto} and optimization
8625 options should be specified at compile time and during the final link.
8626 It is recommended that you compile all the files participating in the
8627 same link with the same options and also specify those options at
8628 link time.
8629 For example:
8630
8631 @smallexample
8632 gcc -c -O2 -flto foo.c
8633 gcc -c -O2 -flto bar.c
8634 gcc -o myprog -flto -O2 foo.o bar.o
8635 @end smallexample
8636
8637 The first two invocations to GCC save a bytecode representation
8638 of GIMPLE into special ELF sections inside @file{foo.o} and
8639 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8640 @file{foo.o} and @file{bar.o}, merges the two files into a single
8641 internal image, and compiles the result as usual. Since both
8642 @file{foo.o} and @file{bar.o} are merged into a single image, this
8643 causes all the interprocedural analyses and optimizations in GCC to
8644 work across the two files as if they were a single one. This means,
8645 for example, that the inliner is able to inline functions in
8646 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8647
8648 Another (simpler) way to enable link-time optimization is:
8649
8650 @smallexample
8651 gcc -o myprog -flto -O2 foo.c bar.c
8652 @end smallexample
8653
8654 The above generates bytecode for @file{foo.c} and @file{bar.c},
8655 merges them together into a single GIMPLE representation and optimizes
8656 them as usual to produce @file{myprog}.
8657
8658 The only important thing to keep in mind is that to enable link-time
8659 optimizations you need to use the GCC driver to perform the link step.
8660 GCC then automatically performs link-time optimization if any of the
8661 objects involved were compiled with the @option{-flto} command-line option.
8662 You generally
8663 should specify the optimization options to be used for link-time
8664 optimization though GCC tries to be clever at guessing an
8665 optimization level to use from the options used at compile time
8666 if you fail to specify one at link time. You can always override
8667 the automatic decision to do link-time optimization at link time
8668 by passing @option{-fno-lto} to the link command.
8669
8670 To make whole program optimization effective, it is necessary to make
8671 certain whole program assumptions. The compiler needs to know
8672 what functions and variables can be accessed by libraries and runtime
8673 outside of the link-time optimized unit. When supported by the linker,
8674 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8675 to the compiler about used and externally visible symbols. When
8676 the linker plugin is not available, @option{-fwhole-program} should be
8677 used to allow the compiler to make these assumptions, which leads
8678 to more aggressive optimization decisions.
8679
8680 When @option{-fuse-linker-plugin} is not enabled, when a file is
8681 compiled with @option{-flto}, the generated object file is larger than
8682 a regular object file because it contains GIMPLE bytecodes and the usual
8683 final code (see @option{-ffat-lto-objects}. This means that
8684 object files with LTO information can be linked as normal object
8685 files; if @option{-fno-lto} is passed to the linker, no
8686 interprocedural optimizations are applied. Note that when
8687 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
8688 but you cannot perform a regular, non-LTO link on them.
8689
8690 Additionally, the optimization flags used to compile individual files
8691 are not necessarily related to those used at link time. For instance,
8692
8693 @smallexample
8694 gcc -c -O0 -ffat-lto-objects -flto foo.c
8695 gcc -c -O0 -ffat-lto-objects -flto bar.c
8696 gcc -o myprog -O3 foo.o bar.o
8697 @end smallexample
8698
8699 This produces individual object files with unoptimized assembler
8700 code, but the resulting binary @file{myprog} is optimized at
8701 @option{-O3}. If, instead, the final binary is generated with
8702 @option{-fno-lto}, then @file{myprog} is not optimized.
8703
8704 When producing the final binary, GCC only
8705 applies link-time optimizations to those files that contain bytecode.
8706 Therefore, you can mix and match object files and libraries with
8707 GIMPLE bytecodes and final object code. GCC automatically selects
8708 which files to optimize in LTO mode and which files to link without
8709 further processing.
8710
8711 There are some code generation flags preserved by GCC when
8712 generating bytecodes, as they need to be used during the final link
8713 stage. Generally options specified at link time override those
8714 specified at compile time.
8715
8716 If you do not specify an optimization level option @option{-O} at
8717 link time, then GCC uses the highest optimization level
8718 used when compiling the object files.
8719
8720 Currently, the following options and their settings are taken from
8721 the first object file that explicitly specifies them:
8722 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
8723 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
8724 and all the @option{-m} target flags.
8725
8726 Certain ABI-changing flags are required to match in all compilation units,
8727 and trying to override this at link time with a conflicting value
8728 is ignored. This includes options such as @option{-freg-struct-return}
8729 and @option{-fpcc-struct-return}.
8730
8731 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8732 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8733 are passed through to the link stage and merged conservatively for
8734 conflicting translation units. Specifically
8735 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8736 precedence; and for example @option{-ffp-contract=off} takes precedence
8737 over @option{-ffp-contract=fast}. You can override them at link time.
8738
8739 If LTO encounters objects with C linkage declared with incompatible
8740 types in separate translation units to be linked together (undefined
8741 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8742 issued. The behavior is still undefined at run time. Similar
8743 diagnostics may be raised for other languages.
8744
8745 Another feature of LTO is that it is possible to apply interprocedural
8746 optimizations on files written in different languages:
8747
8748 @smallexample
8749 gcc -c -flto foo.c
8750 g++ -c -flto bar.cc
8751 gfortran -c -flto baz.f90
8752 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8753 @end smallexample
8754
8755 Notice that the final link is done with @command{g++} to get the C++
8756 runtime libraries and @option{-lgfortran} is added to get the Fortran
8757 runtime libraries. In general, when mixing languages in LTO mode, you
8758 should use the same link command options as when mixing languages in a
8759 regular (non-LTO) compilation.
8760
8761 If object files containing GIMPLE bytecode are stored in a library archive, say
8762 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8763 are using a linker with plugin support. To create static libraries suitable
8764 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
8765 and @command{ranlib};
8766 to show the symbols of object files with GIMPLE bytecode, use
8767 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
8768 and @command{nm} have been compiled with plugin support. At link time, use the the
8769 flag @option{-fuse-linker-plugin} to ensure that the library participates in
8770 the LTO optimization process:
8771
8772 @smallexample
8773 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8774 @end smallexample
8775
8776 With the linker plugin enabled, the linker extracts the needed
8777 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8778 to make them part of the aggregated GIMPLE image to be optimized.
8779
8780 If you are not using a linker with plugin support and/or do not
8781 enable the linker plugin, then the objects inside @file{libfoo.a}
8782 are extracted and linked as usual, but they do not participate
8783 in the LTO optimization process. In order to make a static library suitable
8784 for both LTO optimization and usual linkage, compile its object files with
8785 @option{-flto} @option{-ffat-lto-objects}.
8786
8787 Link-time optimizations do not require the presence of the whole program to
8788 operate. If the program does not require any symbols to be exported, it is
8789 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8790 the interprocedural optimizers to use more aggressive assumptions which may
8791 lead to improved optimization opportunities.
8792 Use of @option{-fwhole-program} is not needed when linker plugin is
8793 active (see @option{-fuse-linker-plugin}).
8794
8795 The current implementation of LTO makes no
8796 attempt to generate bytecode that is portable between different
8797 types of hosts. The bytecode files are versioned and there is a
8798 strict version check, so bytecode files generated in one version of
8799 GCC do not work with an older or newer version of GCC.
8800
8801 Link-time optimization does not work well with generation of debugging
8802 information. Combining @option{-flto} with
8803 @option{-g} is currently experimental and expected to produce unexpected
8804 results.
8805
8806 If you specify the optional @var{n}, the optimization and code
8807 generation done at link time is executed in parallel using @var{n}
8808 parallel jobs by utilizing an installed @command{make} program. The
8809 environment variable @env{MAKE} may be used to override the program
8810 used. The default value for @var{n} is 1.
8811
8812 You can also specify @option{-flto=jobserver} to use GNU make's
8813 job server mode to determine the number of parallel jobs. This
8814 is useful when the Makefile calling GCC is already executing in parallel.
8815 You must prepend a @samp{+} to the command recipe in the parent Makefile
8816 for this to work. This option likely only works if @env{MAKE} is
8817 GNU make.
8818
8819 @item -flto-partition=@var{alg}
8820 @opindex flto-partition
8821 Specify the partitioning algorithm used by the link-time optimizer.
8822 The value is either @samp{1to1} to specify a partitioning mirroring
8823 the original source files or @samp{balanced} to specify partitioning
8824 into equally sized chunks (whenever possible) or @samp{max} to create
8825 new partition for every symbol where possible. Specifying @samp{none}
8826 as an algorithm disables partitioning and streaming completely.
8827 The default value is @samp{balanced}. While @samp{1to1} can be used
8828 as an workaround for various code ordering issues, the @samp{max}
8829 partitioning is intended for internal testing only.
8830 The value @samp{one} specifies that exactly one partition should be
8831 used while the value @samp{none} bypasses partitioning and executes
8832 the link-time optimization step directly from the WPA phase.
8833
8834 @item -flto-odr-type-merging
8835 @opindex flto-odr-type-merging
8836 Enable streaming of mangled types names of C++ types and their unification
8837 at link time. This increases size of LTO object files, but enables
8838 diagnostics about One Definition Rule violations.
8839
8840 @item -flto-compression-level=@var{n}
8841 @opindex flto-compression-level
8842 This option specifies the level of compression used for intermediate
8843 language written to LTO object files, and is only meaningful in
8844 conjunction with LTO mode (@option{-flto}). Valid
8845 values are 0 (no compression) to 9 (maximum compression). Values
8846 outside this range are clamped to either 0 or 9. If the option is not
8847 given, a default balanced compression setting is used.
8848
8849 @item -fuse-linker-plugin
8850 @opindex fuse-linker-plugin
8851 Enables the use of a linker plugin during link-time optimization. This
8852 option relies on plugin support in the linker, which is available in gold
8853 or in GNU ld 2.21 or newer.
8854
8855 This option enables the extraction of object files with GIMPLE bytecode out
8856 of library archives. This improves the quality of optimization by exposing
8857 more code to the link-time optimizer. This information specifies what
8858 symbols can be accessed externally (by non-LTO object or during dynamic
8859 linking). Resulting code quality improvements on binaries (and shared
8860 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
8861 See @option{-flto} for a description of the effect of this flag and how to
8862 use it.
8863
8864 This option is enabled by default when LTO support in GCC is enabled
8865 and GCC was configured for use with
8866 a linker supporting plugins (GNU ld 2.21 or newer or gold).
8867
8868 @item -ffat-lto-objects
8869 @opindex ffat-lto-objects
8870 Fat LTO objects are object files that contain both the intermediate language
8871 and the object code. This makes them usable for both LTO linking and normal
8872 linking. This option is effective only when compiling with @option{-flto}
8873 and is ignored at link time.
8874
8875 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
8876 requires the complete toolchain to be aware of LTO. It requires a linker with
8877 linker plugin support for basic functionality. Additionally,
8878 @command{nm}, @command{ar} and @command{ranlib}
8879 need to support linker plugins to allow a full-featured build environment
8880 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
8881 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
8882 to these tools. With non fat LTO makefiles need to be modified to use them.
8883
8884 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
8885 support.
8886
8887 @item -fcompare-elim
8888 @opindex fcompare-elim
8889 After register allocation and post-register allocation instruction splitting,
8890 identify arithmetic instructions that compute processor flags similar to a
8891 comparison operation based on that arithmetic. If possible, eliminate the
8892 explicit comparison operation.
8893
8894 This pass only applies to certain targets that cannot explicitly represent
8895 the comparison operation before register allocation is complete.
8896
8897 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8898
8899 @item -fcprop-registers
8900 @opindex fcprop-registers
8901 After register allocation and post-register allocation instruction splitting,
8902 perform a copy-propagation pass to try to reduce scheduling dependencies
8903 and occasionally eliminate the copy.
8904
8905 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8906
8907 @item -fprofile-correction
8908 @opindex fprofile-correction
8909 Profiles collected using an instrumented binary for multi-threaded programs may
8910 be inconsistent due to missed counter updates. When this option is specified,
8911 GCC uses heuristics to correct or smooth out such inconsistencies. By
8912 default, GCC emits an error message when an inconsistent profile is detected.
8913
8914 @item -fprofile-use
8915 @itemx -fprofile-use=@var{path}
8916 @opindex fprofile-use
8917 Enable profile feedback-directed optimizations,
8918 and the following optimizations
8919 which are generally profitable only with profile feedback available:
8920 @option{-fbranch-probabilities}, @option{-fvpt},
8921 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8922 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
8923
8924 Before you can use this option, you must first generate profiling information.
8925 @xref{Instrumentation Options}, for information about the
8926 @option{-fprofile-generate} option.
8927
8928 By default, GCC emits an error message if the feedback profiles do not
8929 match the source code. This error can be turned into a warning by using
8930 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8931 code.
8932
8933 If @var{path} is specified, GCC looks at the @var{path} to find
8934 the profile feedback data files. See @option{-fprofile-dir}.
8935
8936 @item -fauto-profile
8937 @itemx -fauto-profile=@var{path}
8938 @opindex fauto-profile
8939 Enable sampling-based feedback-directed optimizations,
8940 and the following optimizations
8941 which are generally profitable only with profile feedback available:
8942 @option{-fbranch-probabilities}, @option{-fvpt},
8943 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8944 @option{-ftree-vectorize},
8945 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
8946 @option{-fpredictive-commoning}, @option{-funswitch-loops},
8947 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
8948
8949 @var{path} is the name of a file containing AutoFDO profile information.
8950 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
8951
8952 Producing an AutoFDO profile data file requires running your program
8953 with the @command{perf} utility on a supported GNU/Linux target system.
8954 For more information, see @uref{https://perf.wiki.kernel.org/}.
8955
8956 E.g.
8957 @smallexample
8958 perf record -e br_inst_retired:near_taken -b -o perf.data \
8959 -- your_program
8960 @end smallexample
8961
8962 Then use the @command{create_gcov} tool to convert the raw profile data
8963 to a format that can be used by GCC.@ You must also supply the
8964 unstripped binary for your program to this tool.
8965 See @uref{https://github.com/google/autofdo}.
8966
8967 E.g.
8968 @smallexample
8969 create_gcov --binary=your_program.unstripped --profile=perf.data \
8970 --gcov=profile.afdo
8971 @end smallexample
8972 @end table
8973
8974 The following options control compiler behavior regarding floating-point
8975 arithmetic. These options trade off between speed and
8976 correctness. All must be specifically enabled.
8977
8978 @table @gcctabopt
8979 @item -ffloat-store
8980 @opindex ffloat-store
8981 Do not store floating-point variables in registers, and inhibit other
8982 options that might change whether a floating-point value is taken from a
8983 register or memory.
8984
8985 @cindex floating-point precision
8986 This option prevents undesirable excess precision on machines such as
8987 the 68000 where the floating registers (of the 68881) keep more
8988 precision than a @code{double} is supposed to have. Similarly for the
8989 x86 architecture. For most programs, the excess precision does only
8990 good, but a few programs rely on the precise definition of IEEE floating
8991 point. Use @option{-ffloat-store} for such programs, after modifying
8992 them to store all pertinent intermediate computations into variables.
8993
8994 @item -fexcess-precision=@var{style}
8995 @opindex fexcess-precision
8996 This option allows further control over excess precision on machines
8997 where floating-point operations occur in a format with more precision or
8998 range than the IEEE standard and interchange floating-point types. By
8999 default, @option{-fexcess-precision=fast} is in effect; this means that
9000 operations may be carried out in a wider precision than the types specified
9001 in the source if that would result in faster code, and it is unpredictable
9002 when rounding to the types specified in the source code takes place.
9003 When compiling C, if @option{-fexcess-precision=standard} is specified then
9004 excess precision follows the rules specified in ISO C99; in particular,
9005 both casts and assignments cause values to be rounded to their
9006 semantic types (whereas @option{-ffloat-store} only affects
9007 assignments). This option is enabled by default for C if a strict
9008 conformance option such as @option{-std=c99} is used.
9009
9010 @opindex mfpmath
9011 @option{-fexcess-precision=standard} is not implemented for languages
9012 other than C, and has no effect if
9013 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
9014 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
9015 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9016 semantics apply without excess precision, and in the latter, rounding
9017 is unpredictable.
9018
9019 @item -ffast-math
9020 @opindex ffast-math
9021 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9022 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9023 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
9024
9025 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9026
9027 This option is not turned on by any @option{-O} option besides
9028 @option{-Ofast} since it can result in incorrect output for programs
9029 that depend on an exact implementation of IEEE or ISO rules/specifications
9030 for math functions. It may, however, yield faster code for programs
9031 that do not require the guarantees of these specifications.
9032
9033 @item -fno-math-errno
9034 @opindex fno-math-errno
9035 Do not set @code{errno} after calling math functions that are executed
9036 with a single instruction, e.g., @code{sqrt}. A program that relies on
9037 IEEE exceptions for math error handling may want to use this flag
9038 for speed while maintaining IEEE arithmetic compatibility.
9039
9040 This option is not turned on by any @option{-O} option since
9041 it can result in incorrect output for programs that depend on
9042 an exact implementation of IEEE or ISO rules/specifications for
9043 math functions. It may, however, yield faster code for programs
9044 that do not require the guarantees of these specifications.
9045
9046 The default is @option{-fmath-errno}.
9047
9048 On Darwin systems, the math library never sets @code{errno}. There is
9049 therefore no reason for the compiler to consider the possibility that
9050 it might, and @option{-fno-math-errno} is the default.
9051
9052 @item -funsafe-math-optimizations
9053 @opindex funsafe-math-optimizations
9054
9055 Allow optimizations for floating-point arithmetic that (a) assume
9056 that arguments and results are valid and (b) may violate IEEE or
9057 ANSI standards. When used at link time, it may include libraries
9058 or startup files that change the default FPU control word or other
9059 similar optimizations.
9060
9061 This option is not turned on by any @option{-O} option since
9062 it can result in incorrect output for programs that depend on
9063 an exact implementation of IEEE or ISO rules/specifications for
9064 math functions. It may, however, yield faster code for programs
9065 that do not require the guarantees of these specifications.
9066 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9067 @option{-fassociative-math} and @option{-freciprocal-math}.
9068
9069 The default is @option{-fno-unsafe-math-optimizations}.
9070
9071 @item -fassociative-math
9072 @opindex fassociative-math
9073
9074 Allow re-association of operands in series of floating-point operations.
9075 This violates the ISO C and C++ language standard by possibly changing
9076 computation result. NOTE: re-ordering may change the sign of zero as
9077 well as ignore NaNs and inhibit or create underflow or overflow (and
9078 thus cannot be used on code that relies on rounding behavior like
9079 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9080 and thus may not be used when ordered comparisons are required.
9081 This option requires that both @option{-fno-signed-zeros} and
9082 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9083 much sense with @option{-frounding-math}. For Fortran the option
9084 is automatically enabled when both @option{-fno-signed-zeros} and
9085 @option{-fno-trapping-math} are in effect.
9086
9087 The default is @option{-fno-associative-math}.
9088
9089 @item -freciprocal-math
9090 @opindex freciprocal-math
9091
9092 Allow the reciprocal of a value to be used instead of dividing by
9093 the value if this enables optimizations. For example @code{x / y}
9094 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9095 is subject to common subexpression elimination. Note that this loses
9096 precision and increases the number of flops operating on the value.
9097
9098 The default is @option{-fno-reciprocal-math}.
9099
9100 @item -ffinite-math-only
9101 @opindex ffinite-math-only
9102 Allow optimizations for floating-point arithmetic that assume
9103 that arguments and results are not NaNs or +-Infs.
9104
9105 This option is not turned on by any @option{-O} option since
9106 it can result in incorrect output for programs that depend on
9107 an exact implementation of IEEE or ISO rules/specifications for
9108 math functions. It may, however, yield faster code for programs
9109 that do not require the guarantees of these specifications.
9110
9111 The default is @option{-fno-finite-math-only}.
9112
9113 @item -fno-signed-zeros
9114 @opindex fno-signed-zeros
9115 Allow optimizations for floating-point arithmetic that ignore the
9116 signedness of zero. IEEE arithmetic specifies the behavior of
9117 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9118 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9119 This option implies that the sign of a zero result isn't significant.
9120
9121 The default is @option{-fsigned-zeros}.
9122
9123 @item -fno-trapping-math
9124 @opindex fno-trapping-math
9125 Compile code assuming that floating-point operations cannot generate
9126 user-visible traps. These traps include division by zero, overflow,
9127 underflow, inexact result and invalid operation. This option requires
9128 that @option{-fno-signaling-nans} be in effect. Setting this option may
9129 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9130
9131 This option should never be turned on by any @option{-O} option since
9132 it can result in incorrect output for programs that depend on
9133 an exact implementation of IEEE or ISO rules/specifications for
9134 math functions.
9135
9136 The default is @option{-ftrapping-math}.
9137
9138 @item -frounding-math
9139 @opindex frounding-math
9140 Disable transformations and optimizations that assume default floating-point
9141 rounding behavior. This is round-to-zero for all floating point
9142 to integer conversions, and round-to-nearest for all other arithmetic
9143 truncations. This option should be specified for programs that change
9144 the FP rounding mode dynamically, or that may be executed with a
9145 non-default rounding mode. This option disables constant folding of
9146 floating-point expressions at compile time (which may be affected by
9147 rounding mode) and arithmetic transformations that are unsafe in the
9148 presence of sign-dependent rounding modes.
9149
9150 The default is @option{-fno-rounding-math}.
9151
9152 This option is experimental and does not currently guarantee to
9153 disable all GCC optimizations that are affected by rounding mode.
9154 Future versions of GCC may provide finer control of this setting
9155 using C99's @code{FENV_ACCESS} pragma. This command-line option
9156 will be used to specify the default state for @code{FENV_ACCESS}.
9157
9158 @item -fsignaling-nans
9159 @opindex fsignaling-nans
9160 Compile code assuming that IEEE signaling NaNs may generate user-visible
9161 traps during floating-point operations. Setting this option disables
9162 optimizations that may change the number of exceptions visible with
9163 signaling NaNs. This option implies @option{-ftrapping-math}.
9164
9165 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9166 be defined.
9167
9168 The default is @option{-fno-signaling-nans}.
9169
9170 This option is experimental and does not currently guarantee to
9171 disable all GCC optimizations that affect signaling NaN behavior.
9172
9173 @item -fno-fp-int-builtin-inexact
9174 @opindex fno-fp-int-builtin-inexact
9175 Do not allow the built-in functions @code{ceil}, @code{floor},
9176 @code{round} and @code{trunc}, and their @code{float} and @code{long
9177 double} variants, to generate code that raises the ``inexact''
9178 floating-point exception for noninteger arguments. ISO C99 and C11
9179 allow these functions to raise the ``inexact'' exception, but ISO/IEC
9180 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
9181 functions to do so.
9182
9183 The default is @option{-ffp-int-builtin-inexact}, allowing the
9184 exception to be raised. This option does nothing unless
9185 @option{-ftrapping-math} is in effect.
9186
9187 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
9188 generate a call to a library function then the ``inexact'' exception
9189 may be raised if the library implementation does not follow TS 18661.
9190
9191 @item -fsingle-precision-constant
9192 @opindex fsingle-precision-constant
9193 Treat floating-point constants as single precision instead of
9194 implicitly converting them to double-precision constants.
9195
9196 @item -fcx-limited-range
9197 @opindex fcx-limited-range
9198 When enabled, this option states that a range reduction step is not
9199 needed when performing complex division. Also, there is no checking
9200 whether the result of a complex multiplication or division is @code{NaN
9201 + I*NaN}, with an attempt to rescue the situation in that case. The
9202 default is @option{-fno-cx-limited-range}, but is enabled by
9203 @option{-ffast-math}.
9204
9205 This option controls the default setting of the ISO C99
9206 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9207 all languages.
9208
9209 @item -fcx-fortran-rules
9210 @opindex fcx-fortran-rules
9211 Complex multiplication and division follow Fortran rules. Range
9212 reduction is done as part of complex division, but there is no checking
9213 whether the result of a complex multiplication or division is @code{NaN
9214 + I*NaN}, with an attempt to rescue the situation in that case.
9215
9216 The default is @option{-fno-cx-fortran-rules}.
9217
9218 @end table
9219
9220 The following options control optimizations that may improve
9221 performance, but are not enabled by any @option{-O} options. This
9222 section includes experimental options that may produce broken code.
9223
9224 @table @gcctabopt
9225 @item -fbranch-probabilities
9226 @opindex fbranch-probabilities
9227 After running a program compiled with @option{-fprofile-arcs}
9228 (@pxref{Instrumentation Options}),
9229 you can compile it a second time using
9230 @option{-fbranch-probabilities}, to improve optimizations based on
9231 the number of times each branch was taken. When a program
9232 compiled with @option{-fprofile-arcs} exits, it saves arc execution
9233 counts to a file called @file{@var{sourcename}.gcda} for each source
9234 file. The information in this data file is very dependent on the
9235 structure of the generated code, so you must use the same source code
9236 and the same optimization options for both compilations.
9237
9238 With @option{-fbranch-probabilities}, GCC puts a
9239 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
9240 These can be used to improve optimization. Currently, they are only
9241 used in one place: in @file{reorg.c}, instead of guessing which path a
9242 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
9243 exactly determine which path is taken more often.
9244
9245 @item -fprofile-values
9246 @opindex fprofile-values
9247 If combined with @option{-fprofile-arcs}, it adds code so that some
9248 data about values of expressions in the program is gathered.
9249
9250 With @option{-fbranch-probabilities}, it reads back the data gathered
9251 from profiling values of expressions for usage in optimizations.
9252
9253 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
9254
9255 @item -fprofile-reorder-functions
9256 @opindex fprofile-reorder-functions
9257 Function reordering based on profile instrumentation collects
9258 first time of execution of a function and orders these functions
9259 in ascending order.
9260
9261 Enabled with @option{-fprofile-use}.
9262
9263 @item -fvpt
9264 @opindex fvpt
9265 If combined with @option{-fprofile-arcs}, this option instructs the compiler
9266 to add code to gather information about values of expressions.
9267
9268 With @option{-fbranch-probabilities}, it reads back the data gathered
9269 and actually performs the optimizations based on them.
9270 Currently the optimizations include specialization of division operations
9271 using the knowledge about the value of the denominator.
9272
9273 @item -frename-registers
9274 @opindex frename-registers
9275 Attempt to avoid false dependencies in scheduled code by making use
9276 of registers left over after register allocation. This optimization
9277 most benefits processors with lots of registers. Depending on the
9278 debug information format adopted by the target, however, it can
9279 make debugging impossible, since variables no longer stay in
9280 a ``home register''.
9281
9282 Enabled by default with @option{-funroll-loops}.
9283
9284 @item -fschedule-fusion
9285 @opindex fschedule-fusion
9286 Performs a target dependent pass over the instruction stream to schedule
9287 instructions of same type together because target machine can execute them
9288 more efficiently if they are adjacent to each other in the instruction flow.
9289
9290 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9291
9292 @item -ftracer
9293 @opindex ftracer
9294 Perform tail duplication to enlarge superblock size. This transformation
9295 simplifies the control flow of the function allowing other optimizations to do
9296 a better job.
9297
9298 Enabled with @option{-fprofile-use}.
9299
9300 @item -funroll-loops
9301 @opindex funroll-loops
9302 Unroll loops whose number of iterations can be determined at compile time or
9303 upon entry to the loop. @option{-funroll-loops} implies
9304 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9305 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9306 a small constant number of iterations). This option makes code larger, and may
9307 or may not make it run faster.
9308
9309 Enabled with @option{-fprofile-use}.
9310
9311 @item -funroll-all-loops
9312 @opindex funroll-all-loops
9313 Unroll all loops, even if their number of iterations is uncertain when
9314 the loop is entered. This usually makes programs run more slowly.
9315 @option{-funroll-all-loops} implies the same options as
9316 @option{-funroll-loops}.
9317
9318 @item -fpeel-loops
9319 @opindex fpeel-loops
9320 Peels loops for which there is enough information that they do not
9321 roll much (from profile feedback or static analysis). It also turns on
9322 complete loop peeling (i.e.@: complete removal of loops with small constant
9323 number of iterations).
9324
9325 Enabled with @option{-O3} and/or @option{-fprofile-use}.
9326
9327 @item -fmove-loop-invariants
9328 @opindex fmove-loop-invariants
9329 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
9330 at level @option{-O1}
9331
9332 @item -fsplit-loops
9333 @opindex fsplit-loops
9334 Split a loop into two if it contains a condition that's always true
9335 for one side of the iteration space and false for the other.
9336
9337 @item -funswitch-loops
9338 @opindex funswitch-loops
9339 Move branches with loop invariant conditions out of the loop, with duplicates
9340 of the loop on both branches (modified according to result of the condition).
9341
9342 @item -ffunction-sections
9343 @itemx -fdata-sections
9344 @opindex ffunction-sections
9345 @opindex fdata-sections
9346 Place each function or data item into its own section in the output
9347 file if the target supports arbitrary sections. The name of the
9348 function or the name of the data item determines the section's name
9349 in the output file.
9350
9351 Use these options on systems where the linker can perform optimizations
9352 to improve locality of reference in the instruction space. Most systems
9353 using the ELF object format and SPARC processors running Solaris 2 have
9354 linkers with such optimizations. AIX may have these optimizations in
9355 the future.
9356
9357 Only use these options when there are significant benefits from doing
9358 so. When you specify these options, the assembler and linker
9359 create larger object and executable files and are also slower.
9360 You cannot use @command{gprof} on all systems if you
9361 specify this option, and you may have problems with debugging if
9362 you specify both this option and @option{-g}.
9363
9364 @item -fbranch-target-load-optimize
9365 @opindex fbranch-target-load-optimize
9366 Perform branch target register load optimization before prologue / epilogue
9367 threading.
9368 The use of target registers can typically be exposed only during reload,
9369 thus hoisting loads out of loops and doing inter-block scheduling needs
9370 a separate optimization pass.
9371
9372 @item -fbranch-target-load-optimize2
9373 @opindex fbranch-target-load-optimize2
9374 Perform branch target register load optimization after prologue / epilogue
9375 threading.
9376
9377 @item -fbtr-bb-exclusive
9378 @opindex fbtr-bb-exclusive
9379 When performing branch target register load optimization, don't reuse
9380 branch target registers within any basic block.
9381
9382 @item -fstdarg-opt
9383 @opindex fstdarg-opt
9384 Optimize the prologue of variadic argument functions with respect to usage of
9385 those arguments.
9386
9387 @item -fsection-anchors
9388 @opindex fsection-anchors
9389 Try to reduce the number of symbolic address calculations by using
9390 shared ``anchor'' symbols to address nearby objects. This transformation
9391 can help to reduce the number of GOT entries and GOT accesses on some
9392 targets.
9393
9394 For example, the implementation of the following function @code{foo}:
9395
9396 @smallexample
9397 static int a, b, c;
9398 int foo (void) @{ return a + b + c; @}
9399 @end smallexample
9400
9401 @noindent
9402 usually calculates the addresses of all three variables, but if you
9403 compile it with @option{-fsection-anchors}, it accesses the variables
9404 from a common anchor point instead. The effect is similar to the
9405 following pseudocode (which isn't valid C):
9406
9407 @smallexample
9408 int foo (void)
9409 @{
9410 register int *xr = &x;
9411 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9412 @}
9413 @end smallexample
9414
9415 Not all targets support this option.
9416
9417 @item --param @var{name}=@var{value}
9418 @opindex param
9419 In some places, GCC uses various constants to control the amount of
9420 optimization that is done. For example, GCC does not inline functions
9421 that contain more than a certain number of instructions. You can
9422 control some of these constants on the command line using the
9423 @option{--param} option.
9424
9425 The names of specific parameters, and the meaning of the values, are
9426 tied to the internals of the compiler, and are subject to change
9427 without notice in future releases.
9428
9429 In each case, the @var{value} is an integer. The allowable choices for
9430 @var{name} are:
9431
9432 @table @gcctabopt
9433 @item predictable-branch-outcome
9434 When branch is predicted to be taken with probability lower than this threshold
9435 (in percent), then it is considered well predictable. The default is 10.
9436
9437 @item max-rtl-if-conversion-insns
9438 RTL if-conversion tries to remove conditional branches around a block and
9439 replace them with conditionally executed instructions. This parameter
9440 gives the maximum number of instructions in a block which should be
9441 considered for if-conversion. The default is 10, though the compiler will
9442 also use other heuristics to decide whether if-conversion is likely to be
9443 profitable.
9444
9445 @item max-rtl-if-conversion-predictable-cost
9446 @item max-rtl-if-conversion-unpredictable-cost
9447 RTL if-conversion will try to remove conditional branches around a block
9448 and replace them with conditionally executed instructions. These parameters
9449 give the maximum permissible cost for the sequence that would be generated
9450 by if-conversion depending on whether the branch is statically determined
9451 to be predictable or not. The units for this parameter are the same as
9452 those for the GCC internal seq_cost metric. The compiler will try to
9453 provide a reasonable default for this parameter using the BRANCH_COST
9454 target macro.
9455
9456 @item max-crossjump-edges
9457 The maximum number of incoming edges to consider for cross-jumping.
9458 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
9459 the number of edges incoming to each block. Increasing values mean
9460 more aggressive optimization, making the compilation time increase with
9461 probably small improvement in executable size.
9462
9463 @item min-crossjump-insns
9464 The minimum number of instructions that must be matched at the end
9465 of two blocks before cross-jumping is performed on them. This
9466 value is ignored in the case where all instructions in the block being
9467 cross-jumped from are matched. The default value is 5.
9468
9469 @item max-grow-copy-bb-insns
9470 The maximum code size expansion factor when copying basic blocks
9471 instead of jumping. The expansion is relative to a jump instruction.
9472 The default value is 8.
9473
9474 @item max-goto-duplication-insns
9475 The maximum number of instructions to duplicate to a block that jumps
9476 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
9477 passes, GCC factors computed gotos early in the compilation process,
9478 and unfactors them as late as possible. Only computed jumps at the
9479 end of a basic blocks with no more than max-goto-duplication-insns are
9480 unfactored. The default value is 8.
9481
9482 @item max-delay-slot-insn-search
9483 The maximum number of instructions to consider when looking for an
9484 instruction to fill a delay slot. If more than this arbitrary number of
9485 instructions are searched, the time savings from filling the delay slot
9486 are minimal, so stop searching. Increasing values mean more
9487 aggressive optimization, making the compilation time increase with probably
9488 small improvement in execution time.
9489
9490 @item max-delay-slot-live-search
9491 When trying to fill delay slots, the maximum number of instructions to
9492 consider when searching for a block with valid live register
9493 information. Increasing this arbitrarily chosen value means more
9494 aggressive optimization, increasing the compilation time. This parameter
9495 should be removed when the delay slot code is rewritten to maintain the
9496 control-flow graph.
9497
9498 @item max-gcse-memory
9499 The approximate maximum amount of memory that can be allocated in
9500 order to perform the global common subexpression elimination
9501 optimization. If more memory than specified is required, the
9502 optimization is not done.
9503
9504 @item max-gcse-insertion-ratio
9505 If the ratio of expression insertions to deletions is larger than this value
9506 for any expression, then RTL PRE inserts or removes the expression and thus
9507 leaves partially redundant computations in the instruction stream. The default value is 20.
9508
9509 @item max-pending-list-length
9510 The maximum number of pending dependencies scheduling allows
9511 before flushing the current state and starting over. Large functions
9512 with few branches or calls can create excessively large lists which
9513 needlessly consume memory and resources.
9514
9515 @item max-modulo-backtrack-attempts
9516 The maximum number of backtrack attempts the scheduler should make
9517 when modulo scheduling a loop. Larger values can exponentially increase
9518 compilation time.
9519
9520 @item max-inline-insns-single
9521 Several parameters control the tree inliner used in GCC@.
9522 This number sets the maximum number of instructions (counted in GCC's
9523 internal representation) in a single function that the tree inliner
9524 considers for inlining. This only affects functions declared
9525 inline and methods implemented in a class declaration (C++).
9526 The default value is 400.
9527
9528 @item max-inline-insns-auto
9529 When you use @option{-finline-functions} (included in @option{-O3}),
9530 a lot of functions that would otherwise not be considered for inlining
9531 by the compiler are investigated. To those functions, a different
9532 (more restrictive) limit compared to functions declared inline can
9533 be applied.
9534 The default value is 40.
9535
9536 @item inline-min-speedup
9537 When estimated performance improvement of caller + callee runtime exceeds this
9538 threshold (in precent), the function can be inlined regardless the limit on
9539 @option{--param max-inline-insns-single} and @option{--param
9540 max-inline-insns-auto}.
9541
9542 @item large-function-insns
9543 The limit specifying really large functions. For functions larger than this
9544 limit after inlining, inlining is constrained by
9545 @option{--param large-function-growth}. This parameter is useful primarily
9546 to avoid extreme compilation time caused by non-linear algorithms used by the
9547 back end.
9548 The default value is 2700.
9549
9550 @item large-function-growth
9551 Specifies maximal growth of large function caused by inlining in percents.
9552 The default value is 100 which limits large function growth to 2.0 times
9553 the original size.
9554
9555 @item large-unit-insns
9556 The limit specifying large translation unit. Growth caused by inlining of
9557 units larger than this limit is limited by @option{--param inline-unit-growth}.
9558 For small units this might be too tight.
9559 For example, consider a unit consisting of function A
9560 that is inline and B that just calls A three times. If B is small relative to
9561 A, the growth of unit is 300\% and yet such inlining is very sane. For very
9562 large units consisting of small inlineable functions, however, the overall unit
9563 growth limit is needed to avoid exponential explosion of code size. Thus for
9564 smaller units, the size is increased to @option{--param large-unit-insns}
9565 before applying @option{--param inline-unit-growth}. The default is 10000.
9566
9567 @item inline-unit-growth
9568 Specifies maximal overall growth of the compilation unit caused by inlining.
9569 The default value is 20 which limits unit growth to 1.2 times the original
9570 size. Cold functions (either marked cold via an attribute or by profile
9571 feedback) are not accounted into the unit size.
9572
9573 @item ipcp-unit-growth
9574 Specifies maximal overall growth of the compilation unit caused by
9575 interprocedural constant propagation. The default value is 10 which limits
9576 unit growth to 1.1 times the original size.
9577
9578 @item large-stack-frame
9579 The limit specifying large stack frames. While inlining the algorithm is trying
9580 to not grow past this limit too much. The default value is 256 bytes.
9581
9582 @item large-stack-frame-growth
9583 Specifies maximal growth of large stack frames caused by inlining in percents.
9584 The default value is 1000 which limits large stack frame growth to 11 times
9585 the original size.
9586
9587 @item max-inline-insns-recursive
9588 @itemx max-inline-insns-recursive-auto
9589 Specifies the maximum number of instructions an out-of-line copy of a
9590 self-recursive inline
9591 function can grow into by performing recursive inlining.
9592
9593 @option{--param max-inline-insns-recursive} applies to functions
9594 declared inline.
9595 For functions not declared inline, recursive inlining
9596 happens only when @option{-finline-functions} (included in @option{-O3}) is
9597 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
9598 default value is 450.
9599
9600 @item max-inline-recursive-depth
9601 @itemx max-inline-recursive-depth-auto
9602 Specifies the maximum recursion depth used for recursive inlining.
9603
9604 @option{--param max-inline-recursive-depth} applies to functions
9605 declared inline. For functions not declared inline, recursive inlining
9606 happens only when @option{-finline-functions} (included in @option{-O3}) is
9607 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
9608 default value is 8.
9609
9610 @item min-inline-recursive-probability
9611 Recursive inlining is profitable only for function having deep recursion
9612 in average and can hurt for function having little recursion depth by
9613 increasing the prologue size or complexity of function body to other
9614 optimizers.
9615
9616 When profile feedback is available (see @option{-fprofile-generate}) the actual
9617 recursion depth can be guessed from the probability that function recurses
9618 via a given call expression. This parameter limits inlining only to call
9619 expressions whose probability exceeds the given threshold (in percents).
9620 The default value is 10.
9621
9622 @item early-inlining-insns
9623 Specify growth that the early inliner can make. In effect it increases
9624 the amount of inlining for code having a large abstraction penalty.
9625 The default value is 14.
9626
9627 @item max-early-inliner-iterations
9628 Limit of iterations of the early inliner. This basically bounds
9629 the number of nested indirect calls the early inliner can resolve.
9630 Deeper chains are still handled by late inlining.
9631
9632 @item comdat-sharing-probability
9633 Probability (in percent) that C++ inline function with comdat visibility
9634 are shared across multiple compilation units. The default value is 20.
9635
9636 @item profile-func-internal-id
9637 A parameter to control whether to use function internal id in profile
9638 database lookup. If the value is 0, the compiler uses an id that
9639 is based on function assembler name and filename, which makes old profile
9640 data more tolerant to source changes such as function reordering etc.
9641 The default value is 0.
9642
9643 @item min-vect-loop-bound
9644 The minimum number of iterations under which loops are not vectorized
9645 when @option{-ftree-vectorize} is used. The number of iterations after
9646 vectorization needs to be greater than the value specified by this option
9647 to allow vectorization. The default value is 0.
9648
9649 @item gcse-cost-distance-ratio
9650 Scaling factor in calculation of maximum distance an expression
9651 can be moved by GCSE optimizations. This is currently supported only in the
9652 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9653 is with simple expressions, i.e., the expressions that have cost
9654 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9655 hoisting of simple expressions. The default value is 10.
9656
9657 @item gcse-unrestricted-cost
9658 Cost, roughly measured as the cost of a single typical machine
9659 instruction, at which GCSE optimizations do not constrain
9660 the distance an expression can travel. This is currently
9661 supported only in the code hoisting pass. The lesser the cost,
9662 the more aggressive code hoisting is. Specifying 0
9663 allows all expressions to travel unrestricted distances.
9664 The default value is 3.
9665
9666 @item max-hoist-depth
9667 The depth of search in the dominator tree for expressions to hoist.
9668 This is used to avoid quadratic behavior in hoisting algorithm.
9669 The value of 0 does not limit on the search, but may slow down compilation
9670 of huge functions. The default value is 30.
9671
9672 @item max-tail-merge-comparisons
9673 The maximum amount of similar bbs to compare a bb with. This is used to
9674 avoid quadratic behavior in tree tail merging. The default value is 10.
9675
9676 @item max-tail-merge-iterations
9677 The maximum amount of iterations of the pass over the function. This is used to
9678 limit compilation time in tree tail merging. The default value is 2.
9679
9680 @item store-merging-allow-unaligned
9681 Allow the store merging pass to introduce unaligned stores if it is legal to
9682 do so. The default value is 1.
9683
9684 @item max-stores-to-merge
9685 The maximum number of stores to attempt to merge into wider stores in the store
9686 merging pass. The minimum value is 2 and the default is 64.
9687
9688 @item max-unrolled-insns
9689 The maximum number of instructions that a loop may have to be unrolled.
9690 If a loop is unrolled, this parameter also determines how many times
9691 the loop code is unrolled.
9692
9693 @item max-average-unrolled-insns
9694 The maximum number of instructions biased by probabilities of their execution
9695 that a loop may have to be unrolled. If a loop is unrolled,
9696 this parameter also determines how many times the loop code is unrolled.
9697
9698 @item max-unroll-times
9699 The maximum number of unrollings of a single loop.
9700
9701 @item max-peeled-insns
9702 The maximum number of instructions that a loop may have to be peeled.
9703 If a loop is peeled, this parameter also determines how many times
9704 the loop code is peeled.
9705
9706 @item max-peel-times
9707 The maximum number of peelings of a single loop.
9708
9709 @item max-peel-branches
9710 The maximum number of branches on the hot path through the peeled sequence.
9711
9712 @item max-completely-peeled-insns
9713 The maximum number of insns of a completely peeled loop.
9714
9715 @item max-completely-peel-times
9716 The maximum number of iterations of a loop to be suitable for complete peeling.
9717
9718 @item max-completely-peel-loop-nest-depth
9719 The maximum depth of a loop nest suitable for complete peeling.
9720
9721 @item max-unswitch-insns
9722 The maximum number of insns of an unswitched loop.
9723
9724 @item max-unswitch-level
9725 The maximum number of branches unswitched in a single loop.
9726
9727 @item max-loop-headers-insns
9728 The maximum number of insns in loop header duplicated by he copy loop headers
9729 pass.
9730
9731 @item lim-expensive
9732 The minimum cost of an expensive expression in the loop invariant motion.
9733
9734 @item iv-consider-all-candidates-bound
9735 Bound on number of candidates for induction variables, below which
9736 all candidates are considered for each use in induction variable
9737 optimizations. If there are more candidates than this,
9738 only the most relevant ones are considered to avoid quadratic time complexity.
9739
9740 @item iv-max-considered-uses
9741 The induction variable optimizations give up on loops that contain more
9742 induction variable uses.
9743
9744 @item iv-always-prune-cand-set-bound
9745 If the number of candidates in the set is smaller than this value,
9746 always try to remove unnecessary ivs from the set
9747 when adding a new one.
9748
9749 @item avg-loop-niter
9750 Average number of iterations of a loop.
9751
9752 @item scev-max-expr-size
9753 Bound on size of expressions used in the scalar evolutions analyzer.
9754 Large expressions slow the analyzer.
9755
9756 @item scev-max-expr-complexity
9757 Bound on the complexity of the expressions in the scalar evolutions analyzer.
9758 Complex expressions slow the analyzer.
9759
9760 @item max-tree-if-conversion-phi-args
9761 Maximum number of arguments in a PHI supported by TREE if conversion
9762 unless the loop is marked with simd pragma.
9763
9764 @item vect-max-version-for-alignment-checks
9765 The maximum number of run-time checks that can be performed when
9766 doing loop versioning for alignment in the vectorizer.
9767
9768 @item vect-max-version-for-alias-checks
9769 The maximum number of run-time checks that can be performed when
9770 doing loop versioning for alias in the vectorizer.
9771
9772 @item vect-max-peeling-for-alignment
9773 The maximum number of loop peels to enhance access alignment
9774 for vectorizer. Value -1 means no limit.
9775
9776 @item max-iterations-to-track
9777 The maximum number of iterations of a loop the brute-force algorithm
9778 for analysis of the number of iterations of the loop tries to evaluate.
9779
9780 @item hot-bb-count-ws-permille
9781 A basic block profile count is considered hot if it contributes to
9782 the given permillage (i.e. 0...1000) of the entire profiled execution.
9783
9784 @item hot-bb-frequency-fraction
9785 Select fraction of the entry block frequency of executions of basic block in
9786 function given basic block needs to have to be considered hot.
9787
9788 @item max-predicted-iterations
9789 The maximum number of loop iterations we predict statically. This is useful
9790 in cases where a function contains a single loop with known bound and
9791 another loop with unknown bound.
9792 The known number of iterations is predicted correctly, while
9793 the unknown number of iterations average to roughly 10. This means that the
9794 loop without bounds appears artificially cold relative to the other one.
9795
9796 @item builtin-expect-probability
9797 Control the probability of the expression having the specified value. This
9798 parameter takes a percentage (i.e. 0 ... 100) as input.
9799 The default probability of 90 is obtained empirically.
9800
9801 @item align-threshold
9802
9803 Select fraction of the maximal frequency of executions of a basic block in
9804 a function to align the basic block.
9805
9806 @item align-loop-iterations
9807
9808 A loop expected to iterate at least the selected number of iterations is
9809 aligned.
9810
9811 @item tracer-dynamic-coverage
9812 @itemx tracer-dynamic-coverage-feedback
9813
9814 This value is used to limit superblock formation once the given percentage of
9815 executed instructions is covered. This limits unnecessary code size
9816 expansion.
9817
9818 The @option{tracer-dynamic-coverage-feedback} parameter
9819 is used only when profile
9820 feedback is available. The real profiles (as opposed to statically estimated
9821 ones) are much less balanced allowing the threshold to be larger value.
9822
9823 @item tracer-max-code-growth
9824 Stop tail duplication once code growth has reached given percentage. This is
9825 a rather artificial limit, as most of the duplicates are eliminated later in
9826 cross jumping, so it may be set to much higher values than is the desired code
9827 growth.
9828
9829 @item tracer-min-branch-ratio
9830
9831 Stop reverse growth when the reverse probability of best edge is less than this
9832 threshold (in percent).
9833
9834 @item tracer-min-branch-probability
9835 @itemx tracer-min-branch-probability-feedback
9836
9837 Stop forward growth if the best edge has probability lower than this
9838 threshold.
9839
9840 Similarly to @option{tracer-dynamic-coverage} two parameters are
9841 provided. @option{tracer-min-branch-probability-feedback} is used for
9842 compilation with profile feedback and @option{tracer-min-branch-probability}
9843 compilation without. The value for compilation with profile feedback
9844 needs to be more conservative (higher) in order to make tracer
9845 effective.
9846
9847 @item max-cse-path-length
9848
9849 The maximum number of basic blocks on path that CSE considers.
9850 The default is 10.
9851
9852 @item max-cse-insns
9853 The maximum number of instructions CSE processes before flushing.
9854 The default is 1000.
9855
9856 @item ggc-min-expand
9857
9858 GCC uses a garbage collector to manage its own memory allocation. This
9859 parameter specifies the minimum percentage by which the garbage
9860 collector's heap should be allowed to expand between collections.
9861 Tuning this may improve compilation speed; it has no effect on code
9862 generation.
9863
9864 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9865 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
9866 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
9867 GCC is not able to calculate RAM on a particular platform, the lower
9868 bound of 30% is used. Setting this parameter and
9869 @option{ggc-min-heapsize} to zero causes a full collection to occur at
9870 every opportunity. This is extremely slow, but can be useful for
9871 debugging.
9872
9873 @item ggc-min-heapsize
9874
9875 Minimum size of the garbage collector's heap before it begins bothering
9876 to collect garbage. The first collection occurs after the heap expands
9877 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
9878 tuning this may improve compilation speed, and has no effect on code
9879 generation.
9880
9881 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9882 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9883 with a lower bound of 4096 (four megabytes) and an upper bound of
9884 131072 (128 megabytes). If GCC is not able to calculate RAM on a
9885 particular platform, the lower bound is used. Setting this parameter
9886 very large effectively disables garbage collection. Setting this
9887 parameter and @option{ggc-min-expand} to zero causes a full collection
9888 to occur at every opportunity.
9889
9890 @item max-reload-search-insns
9891 The maximum number of instruction reload should look backward for equivalent
9892 register. Increasing values mean more aggressive optimization, making the
9893 compilation time increase with probably slightly better performance.
9894 The default value is 100.
9895
9896 @item max-cselib-memory-locations
9897 The maximum number of memory locations cselib should take into account.
9898 Increasing values mean more aggressive optimization, making the compilation time
9899 increase with probably slightly better performance. The default value is 500.
9900
9901 @item max-sched-ready-insns
9902 The maximum number of instructions ready to be issued the scheduler should
9903 consider at any given time during the first scheduling pass. Increasing
9904 values mean more thorough searches, making the compilation time increase
9905 with probably little benefit. The default value is 100.
9906
9907 @item max-sched-region-blocks
9908 The maximum number of blocks in a region to be considered for
9909 interblock scheduling. The default value is 10.
9910
9911 @item max-pipeline-region-blocks
9912 The maximum number of blocks in a region to be considered for
9913 pipelining in the selective scheduler. The default value is 15.
9914
9915 @item max-sched-region-insns
9916 The maximum number of insns in a region to be considered for
9917 interblock scheduling. The default value is 100.
9918
9919 @item max-pipeline-region-insns
9920 The maximum number of insns in a region to be considered for
9921 pipelining in the selective scheduler. The default value is 200.
9922
9923 @item min-spec-prob
9924 The minimum probability (in percents) of reaching a source block
9925 for interblock speculative scheduling. The default value is 40.
9926
9927 @item max-sched-extend-regions-iters
9928 The maximum number of iterations through CFG to extend regions.
9929 A value of 0 (the default) disables region extensions.
9930
9931 @item max-sched-insn-conflict-delay
9932 The maximum conflict delay for an insn to be considered for speculative motion.
9933 The default value is 3.
9934
9935 @item sched-spec-prob-cutoff
9936 The minimal probability of speculation success (in percents), so that
9937 speculative insns are scheduled.
9938 The default value is 40.
9939
9940 @item sched-state-edge-prob-cutoff
9941 The minimum probability an edge must have for the scheduler to save its
9942 state across it.
9943 The default value is 10.
9944
9945 @item sched-mem-true-dep-cost
9946 Minimal distance (in CPU cycles) between store and load targeting same
9947 memory locations. The default value is 1.
9948
9949 @item selsched-max-lookahead
9950 The maximum size of the lookahead window of selective scheduling. It is a
9951 depth of search for available instructions.
9952 The default value is 50.
9953
9954 @item selsched-max-sched-times
9955 The maximum number of times that an instruction is scheduled during
9956 selective scheduling. This is the limit on the number of iterations
9957 through which the instruction may be pipelined. The default value is 2.
9958
9959 @item selsched-insns-to-rename
9960 The maximum number of best instructions in the ready list that are considered
9961 for renaming in the selective scheduler. The default value is 2.
9962
9963 @item sms-min-sc
9964 The minimum value of stage count that swing modulo scheduler
9965 generates. The default value is 2.
9966
9967 @item max-last-value-rtl
9968 The maximum size measured as number of RTLs that can be recorded in an expression
9969 in combiner for a pseudo register as last known value of that register. The default
9970 is 10000.
9971
9972 @item max-combine-insns
9973 The maximum number of instructions the RTL combiner tries to combine.
9974 The default value is 2 at @option{-Og} and 4 otherwise.
9975
9976 @item integer-share-limit
9977 Small integer constants can use a shared data structure, reducing the
9978 compiler's memory usage and increasing its speed. This sets the maximum
9979 value of a shared integer constant. The default value is 256.
9980
9981 @item ssp-buffer-size
9982 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
9983 protection when @option{-fstack-protection} is used.
9984
9985 @item min-size-for-stack-sharing
9986 The minimum size of variables taking part in stack slot sharing when not
9987 optimizing. The default value is 32.
9988
9989 @item max-jump-thread-duplication-stmts
9990 Maximum number of statements allowed in a block that needs to be
9991 duplicated when threading jumps.
9992
9993 @item max-fields-for-field-sensitive
9994 Maximum number of fields in a structure treated in
9995 a field sensitive manner during pointer analysis. The default is zero
9996 for @option{-O0} and @option{-O1},
9997 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
9998
9999 @item prefetch-latency
10000 Estimate on average number of instructions that are executed before
10001 prefetch finishes. The distance prefetched ahead is proportional
10002 to this constant. Increasing this number may also lead to less
10003 streams being prefetched (see @option{simultaneous-prefetches}).
10004
10005 @item simultaneous-prefetches
10006 Maximum number of prefetches that can run at the same time.
10007
10008 @item l1-cache-line-size
10009 The size of cache line in L1 cache, in bytes.
10010
10011 @item l1-cache-size
10012 The size of L1 cache, in kilobytes.
10013
10014 @item l2-cache-size
10015 The size of L2 cache, in kilobytes.
10016
10017 @item min-insn-to-prefetch-ratio
10018 The minimum ratio between the number of instructions and the
10019 number of prefetches to enable prefetching in a loop.
10020
10021 @item prefetch-min-insn-to-mem-ratio
10022 The minimum ratio between the number of instructions and the
10023 number of memory references to enable prefetching in a loop.
10024
10025 @item use-canonical-types
10026 Whether the compiler should use the ``canonical'' type system. By
10027 default, this should always be 1, which uses a more efficient internal
10028 mechanism for comparing types in C++ and Objective-C++. However, if
10029 bugs in the canonical type system are causing compilation failures,
10030 set this value to 0 to disable canonical types.
10031
10032 @item switch-conversion-max-branch-ratio
10033 Switch initialization conversion refuses to create arrays that are
10034 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10035 branches in the switch.
10036
10037 @item max-partial-antic-length
10038 Maximum length of the partial antic set computed during the tree
10039 partial redundancy elimination optimization (@option{-ftree-pre}) when
10040 optimizing at @option{-O3} and above. For some sorts of source code
10041 the enhanced partial redundancy elimination optimization can run away,
10042 consuming all of the memory available on the host machine. This
10043 parameter sets a limit on the length of the sets that are computed,
10044 which prevents the runaway behavior. Setting a value of 0 for
10045 this parameter allows an unlimited set length.
10046
10047 @item sccvn-max-scc-size
10048 Maximum size of a strongly connected component (SCC) during SCCVN
10049 processing. If this limit is hit, SCCVN processing for the whole
10050 function is not done and optimizations depending on it are
10051 disabled. The default maximum SCC size is 10000.
10052
10053 @item sccvn-max-alias-queries-per-access
10054 Maximum number of alias-oracle queries we perform when looking for
10055 redundancies for loads and stores. If this limit is hit the search
10056 is aborted and the load or store is not considered redundant. The
10057 number of queries is algorithmically limited to the number of
10058 stores on all paths from the load to the function entry.
10059 The default maximum number of queries is 1000.
10060
10061 @item ira-max-loops-num
10062 IRA uses regional register allocation by default. If a function
10063 contains more loops than the number given by this parameter, only at most
10064 the given number of the most frequently-executed loops form regions
10065 for regional register allocation. The default value of the
10066 parameter is 100.
10067
10068 @item ira-max-conflict-table-size
10069 Although IRA uses a sophisticated algorithm to compress the conflict
10070 table, the table can still require excessive amounts of memory for
10071 huge functions. If the conflict table for a function could be more
10072 than the size in MB given by this parameter, the register allocator
10073 instead uses a faster, simpler, and lower-quality
10074 algorithm that does not require building a pseudo-register conflict table.
10075 The default value of the parameter is 2000.
10076
10077 @item ira-loop-reserved-regs
10078 IRA can be used to evaluate more accurate register pressure in loops
10079 for decisions to move loop invariants (see @option{-O3}). The number
10080 of available registers reserved for some other purposes is given
10081 by this parameter. The default value of the parameter is 2, which is
10082 the minimal number of registers needed by typical instructions.
10083 This value is the best found from numerous experiments.
10084
10085 @item lra-inheritance-ebb-probability-cutoff
10086 LRA tries to reuse values reloaded in registers in subsequent insns.
10087 This optimization is called inheritance. EBB is used as a region to
10088 do this optimization. The parameter defines a minimal fall-through
10089 edge probability in percentage used to add BB to inheritance EBB in
10090 LRA. The default value of the parameter is 40. The value was chosen
10091 from numerous runs of SPEC2000 on x86-64.
10092
10093 @item loop-invariant-max-bbs-in-loop
10094 Loop invariant motion can be very expensive, both in compilation time and
10095 in amount of needed compile-time memory, with very large loops. Loops
10096 with more basic blocks than this parameter won't have loop invariant
10097 motion optimization performed on them. The default value of the
10098 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10099
10100 @item loop-max-datarefs-for-datadeps
10101 Building data dependencies is expensive for very large loops. This
10102 parameter limits the number of data references in loops that are
10103 considered for data dependence analysis. These large loops are no
10104 handled by the optimizations using loop data dependencies.
10105 The default value is 1000.
10106
10107 @item max-vartrack-size
10108 Sets a maximum number of hash table slots to use during variable
10109 tracking dataflow analysis of any function. If this limit is exceeded
10110 with variable tracking at assignments enabled, analysis for that
10111 function is retried without it, after removing all debug insns from
10112 the function. If the limit is exceeded even without debug insns, var
10113 tracking analysis is completely disabled for the function. Setting
10114 the parameter to zero makes it unlimited.
10115
10116 @item max-vartrack-expr-depth
10117 Sets a maximum number of recursion levels when attempting to map
10118 variable names or debug temporaries to value expressions. This trades
10119 compilation time for more complete debug information. If this is set too
10120 low, value expressions that are available and could be represented in
10121 debug information may end up not being used; setting this higher may
10122 enable the compiler to find more complex debug expressions, but compile
10123 time and memory use may grow. The default is 12.
10124
10125 @item min-nondebug-insn-uid
10126 Use uids starting at this parameter for nondebug insns. The range below
10127 the parameter is reserved exclusively for debug insns created by
10128 @option{-fvar-tracking-assignments}, but debug insns may get
10129 (non-overlapping) uids above it if the reserved range is exhausted.
10130
10131 @item ipa-sra-ptr-growth-factor
10132 IPA-SRA replaces a pointer to an aggregate with one or more new
10133 parameters only when their cumulative size is less or equal to
10134 @option{ipa-sra-ptr-growth-factor} times the size of the original
10135 pointer parameter.
10136
10137 @item sra-max-scalarization-size-Ospeed
10138 @item sra-max-scalarization-size-Osize
10139 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
10140 replace scalar parts of aggregates with uses of independent scalar
10141 variables. These parameters control the maximum size, in storage units,
10142 of aggregate which is considered for replacement when compiling for
10143 speed
10144 (@option{sra-max-scalarization-size-Ospeed}) or size
10145 (@option{sra-max-scalarization-size-Osize}) respectively.
10146
10147 @item tm-max-aggregate-size
10148 When making copies of thread-local variables in a transaction, this
10149 parameter specifies the size in bytes after which variables are
10150 saved with the logging functions as opposed to save/restore code
10151 sequence pairs. This option only applies when using
10152 @option{-fgnu-tm}.
10153
10154 @item graphite-max-nb-scop-params
10155 To avoid exponential effects in the Graphite loop transforms, the
10156 number of parameters in a Static Control Part (SCoP) is bounded. The
10157 default value is 10 parameters. A variable whose value is unknown at
10158 compilation time and defined outside a SCoP is a parameter of the SCoP.
10159
10160 @item graphite-max-bbs-per-function
10161 To avoid exponential effects in the detection of SCoPs, the size of
10162 the functions analyzed by Graphite is bounded. The default value is
10163 100 basic blocks.
10164
10165 @item loop-block-tile-size
10166 Loop blocking or strip mining transforms, enabled with
10167 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10168 loop in the loop nest by a given number of iterations. The strip
10169 length can be changed using the @option{loop-block-tile-size}
10170 parameter. The default value is 51 iterations.
10171
10172 @item loop-unroll-jam-size
10173 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
10174 default value is 4.
10175
10176 @item loop-unroll-jam-depth
10177 Specify the dimension to be unrolled (counting from the most inner loop)
10178 for the @option{-floop-unroll-and-jam}. The default value is 2.
10179
10180 @item ipa-cp-value-list-size
10181 IPA-CP attempts to track all possible values and types passed to a function's
10182 parameter in order to propagate them and perform devirtualization.
10183 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10184 stores per one formal parameter of a function.
10185
10186 @item ipa-cp-eval-threshold
10187 IPA-CP calculates its own score of cloning profitability heuristics
10188 and performs those cloning opportunities with scores that exceed
10189 @option{ipa-cp-eval-threshold}.
10190
10191 @item ipa-cp-recursion-penalty
10192 Percentage penalty the recursive functions will receive when they
10193 are evaluated for cloning.
10194
10195 @item ipa-cp-single-call-penalty
10196 Percentage penalty functions containg a single call to another
10197 function will receive when they are evaluated for cloning.
10198
10199
10200 @item ipa-max-agg-items
10201 IPA-CP is also capable to propagate a number of scalar values passed
10202 in an aggregate. @option{ipa-max-agg-items} controls the maximum
10203 number of such values per one parameter.
10204
10205 @item ipa-cp-loop-hint-bonus
10206 When IPA-CP determines that a cloning candidate would make the number
10207 of iterations of a loop known, it adds a bonus of
10208 @option{ipa-cp-loop-hint-bonus} to the profitability score of
10209 the candidate.
10210
10211 @item ipa-cp-array-index-hint-bonus
10212 When IPA-CP determines that a cloning candidate would make the index of
10213 an array access known, it adds a bonus of
10214 @option{ipa-cp-array-index-hint-bonus} to the profitability
10215 score of the candidate.
10216
10217 @item ipa-max-aa-steps
10218 During its analysis of function bodies, IPA-CP employs alias analysis
10219 in order to track values pointed to by function parameters. In order
10220 not spend too much time analyzing huge functions, it gives up and
10221 consider all memory clobbered after examining
10222 @option{ipa-max-aa-steps} statements modifying memory.
10223
10224 @item lto-partitions
10225 Specify desired number of partitions produced during WHOPR compilation.
10226 The number of partitions should exceed the number of CPUs used for compilation.
10227 The default value is 32.
10228
10229 @item lto-min-partition
10230 Size of minimal partition for WHOPR (in estimated instructions).
10231 This prevents expenses of splitting very small programs into too many
10232 partitions.
10233
10234 @item lto-max-partition
10235 Size of max partition for WHOPR (in estimated instructions).
10236 to provide an upper bound for individual size of partition.
10237 Meant to be used only with balanced partitioning.
10238
10239 @item cxx-max-namespaces-for-diagnostic-help
10240 The maximum number of namespaces to consult for suggestions when C++
10241 name lookup fails for an identifier. The default is 1000.
10242
10243 @item sink-frequency-threshold
10244 The maximum relative execution frequency (in percents) of the target block
10245 relative to a statement's original block to allow statement sinking of a
10246 statement. Larger numbers result in more aggressive statement sinking.
10247 The default value is 75. A small positive adjustment is applied for
10248 statements with memory operands as those are even more profitable so sink.
10249
10250 @item max-stores-to-sink
10251 The maximum number of conditional store pairs that can be sunk. Set to 0
10252 if either vectorization (@option{-ftree-vectorize}) or if-conversion
10253 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
10254
10255 @item allow-store-data-races
10256 Allow optimizers to introduce new data races on stores.
10257 Set to 1 to allow, otherwise to 0. This option is enabled by default
10258 at optimization level @option{-Ofast}.
10259
10260 @item case-values-threshold
10261 The smallest number of different values for which it is best to use a
10262 jump-table instead of a tree of conditional branches. If the value is
10263 0, use the default for the machine. The default is 0.
10264
10265 @item tree-reassoc-width
10266 Set the maximum number of instructions executed in parallel in
10267 reassociated tree. This parameter overrides target dependent
10268 heuristics used by default if has non zero value.
10269
10270 @item sched-pressure-algorithm
10271 Choose between the two available implementations of
10272 @option{-fsched-pressure}. Algorithm 1 is the original implementation
10273 and is the more likely to prevent instructions from being reordered.
10274 Algorithm 2 was designed to be a compromise between the relatively
10275 conservative approach taken by algorithm 1 and the rather aggressive
10276 approach taken by the default scheduler. It relies more heavily on
10277 having a regular register file and accurate register pressure classes.
10278 See @file{haifa-sched.c} in the GCC sources for more details.
10279
10280 The default choice depends on the target.
10281
10282 @item max-slsr-cand-scan
10283 Set the maximum number of existing candidates that are considered when
10284 seeking a basis for a new straight-line strength reduction candidate.
10285
10286 @item asan-globals
10287 Enable buffer overflow detection for global objects. This kind
10288 of protection is enabled by default if you are using
10289 @option{-fsanitize=address} option.
10290 To disable global objects protection use @option{--param asan-globals=0}.
10291
10292 @item asan-stack
10293 Enable buffer overflow detection for stack objects. This kind of
10294 protection is enabled by default when using @option{-fsanitize=address}.
10295 To disable stack protection use @option{--param asan-stack=0} option.
10296
10297 @item asan-instrument-reads
10298 Enable buffer overflow detection for memory reads. This kind of
10299 protection is enabled by default when using @option{-fsanitize=address}.
10300 To disable memory reads protection use
10301 @option{--param asan-instrument-reads=0}.
10302
10303 @item asan-instrument-writes
10304 Enable buffer overflow detection for memory writes. This kind of
10305 protection is enabled by default when using @option{-fsanitize=address}.
10306 To disable memory writes protection use
10307 @option{--param asan-instrument-writes=0} option.
10308
10309 @item asan-memintrin
10310 Enable detection for built-in functions. This kind of protection
10311 is enabled by default when using @option{-fsanitize=address}.
10312 To disable built-in functions protection use
10313 @option{--param asan-memintrin=0}.
10314
10315 @item asan-use-after-return
10316 Enable detection of use-after-return. This kind of protection
10317 is enabled by default when using @option{-fsanitize=address} option.
10318 To disable use-after-return detection use
10319 @option{--param asan-use-after-return=0}.
10320
10321 Note: The check is disabled by default at runtime. To enable the check,
10322 you should set environment variable @env{ASAN_OPTIONS} to
10323 @code{detect_stack_use_after_return=1}.
10324
10325 @item asan-instrumentation-with-call-threshold
10326 If number of memory accesses in function being instrumented
10327 is greater or equal to this number, use callbacks instead of inline checks.
10328 E.g. to disable inline code use
10329 @option{--param asan-instrumentation-with-call-threshold=0}.
10330
10331 @item use-after-scope-direct-emission-threshold
10332 If size of a local variables in bytes is smaller of equal to this number,
10333 direct instruction emission is utilized to poison and unpoison local variables.
10334
10335 @item chkp-max-ctor-size
10336 Static constructors generated by Pointer Bounds Checker may become very
10337 large and significantly increase compile time at optimization level
10338 @option{-O1} and higher. This parameter is a maximum nubmer of statements
10339 in a single generated constructor. Default value is 5000.
10340
10341 @item max-fsm-thread-path-insns
10342 Maximum number of instructions to copy when duplicating blocks on a
10343 finite state automaton jump thread path. The default is 100.
10344
10345 @item max-fsm-thread-length
10346 Maximum number of basic blocks on a finite state automaton jump thread
10347 path. The default is 10.
10348
10349 @item max-fsm-thread-paths
10350 Maximum number of new jump thread paths to create for a finite state
10351 automaton. The default is 50.
10352
10353 @item parloops-chunk-size
10354 Chunk size of omp schedule for loops parallelized by parloops. The default
10355 is 0.
10356
10357 @item parloops-schedule
10358 Schedule type of omp schedule for loops parallelized by parloops (static,
10359 dynamic, guided, auto, runtime). The default is static.
10360
10361 @item max-ssa-name-query-depth
10362 Maximum depth of recursion when querying properties of SSA names in things
10363 like fold routines. One level of recursion corresponds to following a
10364 use-def chain.
10365
10366 @item hsa-gen-debug-stores
10367 Enable emission of special debug stores within HSA kernels which are
10368 then read and reported by libgomp plugin. Generation of these stores
10369 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
10370 enable it.
10371
10372 @item max-speculative-devirt-maydefs
10373 The maximum number of may-defs we analyze when looking for a must-def
10374 specifying the dynamic type of an object that invokes a virtual call
10375 we may be able to devirtualize speculatively.
10376
10377 @item max-vrp-switch-assertions
10378 The maximum number of assertions to add along the default edge of a switch
10379 statement during VRP. The default is 10.
10380 @end table
10381 @end table
10382
10383 @node Instrumentation Options
10384 @section Program Instrumentation Options
10385 @cindex instrumentation options
10386 @cindex program instrumentation options
10387 @cindex run-time error checking options
10388 @cindex profiling options
10389 @cindex options, program instrumentation
10390 @cindex options, run-time error checking
10391 @cindex options, profiling
10392
10393 GCC supports a number of command-line options that control adding
10394 run-time instrumentation to the code it normally generates.
10395 For example, one purpose of instrumentation is collect profiling
10396 statistics for use in finding program hot spots, code coverage
10397 analysis, or profile-guided optimizations.
10398 Another class of program instrumentation is adding run-time checking
10399 to detect programming errors like invalid pointer
10400 dereferences or out-of-bounds array accesses, as well as deliberately
10401 hostile attacks such as stack smashing or C++ vtable hijacking.
10402 There is also a general hook which can be used to implement other
10403 forms of tracing or function-level instrumentation for debug or
10404 program analysis purposes.
10405
10406 @table @gcctabopt
10407 @cindex @command{prof}
10408 @item -p
10409 @opindex p
10410 Generate extra code to write profile information suitable for the
10411 analysis program @command{prof}. You must use this option when compiling
10412 the source files you want data about, and you must also use it when
10413 linking.
10414
10415 @cindex @command{gprof}
10416 @item -pg
10417 @opindex pg
10418 Generate extra code to write profile information suitable for the
10419 analysis program @command{gprof}. You must use this option when compiling
10420 the source files you want data about, and you must also use it when
10421 linking.
10422
10423 @item -fprofile-arcs
10424 @opindex fprofile-arcs
10425 Add code so that program flow @dfn{arcs} are instrumented. During
10426 execution the program records how many times each branch and call is
10427 executed and how many times it is taken or returns. When the compiled
10428 program exits it saves this data to a file called
10429 @file{@var{auxname}.gcda} for each source file. The data may be used for
10430 profile-directed optimizations (@option{-fbranch-probabilities}), or for
10431 test coverage analysis (@option{-ftest-coverage}). Each object file's
10432 @var{auxname} is generated from the name of the output file, if
10433 explicitly specified and it is not the final executable, otherwise it is
10434 the basename of the source file. In both cases any suffix is removed
10435 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
10436 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
10437 @xref{Cross-profiling}.
10438
10439 @cindex @command{gcov}
10440 @item --coverage
10441 @opindex coverage
10442
10443 This option is used to compile and link code instrumented for coverage
10444 analysis. The option is a synonym for @option{-fprofile-arcs}
10445 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
10446 linking). See the documentation for those options for more details.
10447
10448 @itemize
10449
10450 @item
10451 Compile the source files with @option{-fprofile-arcs} plus optimization
10452 and code generation options. For test coverage analysis, use the
10453 additional @option{-ftest-coverage} option. You do not need to profile
10454 every source file in a program.
10455
10456 @item
10457 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
10458 (the latter implies the former).
10459
10460 @item
10461 Run the program on a representative workload to generate the arc profile
10462 information. This may be repeated any number of times. You can run
10463 concurrent instances of your program, and provided that the file system
10464 supports locking, the data files will be correctly updated. Also
10465 @code{fork} calls are detected and correctly handled (double counting
10466 will not happen).
10467
10468 @item
10469 For profile-directed optimizations, compile the source files again with
10470 the same optimization and code generation options plus
10471 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
10472 Control Optimization}).
10473
10474 @item
10475 For test coverage analysis, use @command{gcov} to produce human readable
10476 information from the @file{.gcno} and @file{.gcda} files. Refer to the
10477 @command{gcov} documentation for further information.
10478
10479 @end itemize
10480
10481 With @option{-fprofile-arcs}, for each function of your program GCC
10482 creates a program flow graph, then finds a spanning tree for the graph.
10483 Only arcs that are not on the spanning tree have to be instrumented: the
10484 compiler adds code to count the number of times that these arcs are
10485 executed. When an arc is the only exit or only entrance to a block, the
10486 instrumentation code can be added to the block; otherwise, a new basic
10487 block must be created to hold the instrumentation code.
10488
10489 @need 2000
10490 @item -ftest-coverage
10491 @opindex ftest-coverage
10492 Produce a notes file that the @command{gcov} code-coverage utility
10493 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
10494 show program coverage. Each source file's note file is called
10495 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
10496 above for a description of @var{auxname} and instructions on how to
10497 generate test coverage data. Coverage data matches the source files
10498 more closely if you do not optimize.
10499
10500 @item -fprofile-dir=@var{path}
10501 @opindex fprofile-dir
10502
10503 Set the directory to search for the profile data files in to @var{path}.
10504 This option affects only the profile data generated by
10505 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
10506 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
10507 and its related options. Both absolute and relative paths can be used.
10508 By default, GCC uses the current directory as @var{path}, thus the
10509 profile data file appears in the same directory as the object file.
10510
10511 @item -fprofile-generate
10512 @itemx -fprofile-generate=@var{path}
10513 @opindex fprofile-generate
10514
10515 Enable options usually used for instrumenting application to produce
10516 profile useful for later recompilation with profile feedback based
10517 optimization. You must use @option{-fprofile-generate} both when
10518 compiling and when linking your program.
10519
10520 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
10521
10522 If @var{path} is specified, GCC looks at the @var{path} to find
10523 the profile feedback data files. See @option{-fprofile-dir}.
10524
10525 To optimize the program based on the collected profile information, use
10526 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
10527
10528 @item -fprofile-update=@var{method}
10529 @opindex fprofile-update
10530
10531 Alter the update method for an application instrumented for profile
10532 feedback based optimization. The @var{method} argument should be one of
10533 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
10534 The first one is useful for single-threaded applications,
10535 while the second one prevents profile corruption by emitting thread-safe code.
10536
10537 @strong{Warning:} When an application does not properly join all threads
10538 (or creates an detached thread), a profile file can be still corrupted.
10539
10540 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
10541 when supported by a target, or to @samp{single} otherwise. The GCC driver
10542 automatically selects @samp{prefer-atomic} when @option{-pthread}
10543 is present in the command line.
10544
10545 @item -fsanitize=address
10546 @opindex fsanitize=address
10547 Enable AddressSanitizer, a fast memory error detector.
10548 Memory access instructions are instrumented to detect
10549 out-of-bounds and use-after-free bugs.
10550 The option enables @option{-fsanitize-address-use-after-scope}.
10551 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
10552 more details. The run-time behavior can be influenced using the
10553 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
10554 the available options are shown at startup of the instrumented program. See
10555 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
10556 for a list of supported options.
10557 The option can't be combined with @option{-fsanitize=thread}.
10558
10559 @item -fsanitize=kernel-address
10560 @opindex fsanitize=kernel-address
10561 Enable AddressSanitizer for Linux kernel.
10562 The option enables @option{-fsanitize-address-use-after-scope}.
10563 See @uref{https://github.com/google/kasan/wiki} for more details.
10564
10565 @item -fsanitize=thread
10566 @opindex fsanitize=thread
10567 Enable ThreadSanitizer, a fast data race detector.
10568 Memory access instructions are instrumented to detect
10569 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
10570 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
10571 environment variable; see
10572 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
10573 supported options.
10574 The option can't be combined with @option{-fsanitize=address}
10575 and/or @option{-fsanitize=leak}.
10576
10577 @item -fsanitize=leak
10578 @opindex fsanitize=leak
10579 Enable LeakSanitizer, a memory leak detector.
10580 This option only matters for linking of executables and
10581 the executable is linked against a library that overrides @code{malloc}
10582 and other allocator functions. See
10583 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
10584 details. The run-time behavior can be influenced using the
10585 @env{LSAN_OPTIONS} environment variable.
10586 The option can't be combined with @option{-fsanitize=thread}.
10587
10588 @item -fsanitize=undefined
10589 @opindex fsanitize=undefined
10590 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
10591 Various computations are instrumented to detect undefined behavior
10592 at runtime. Current suboptions are:
10593
10594 @table @gcctabopt
10595
10596 @item -fsanitize=shift
10597 @opindex fsanitize=shift
10598 This option enables checking that the result of a shift operation is
10599 not undefined. Note that what exactly is considered undefined differs
10600 slightly between C and C++, as well as between ISO C90 and C99, etc.
10601 This option has two suboptions, @option{-fsanitize=shift-base} and
10602 @option{-fsanitize=shift-exponent}.
10603
10604 @item -fsanitize=shift-exponent
10605 @opindex fsanitize=shift-exponent
10606 This option enables checking that the second argument of a shift operation
10607 is not negative and is smaller than the precision of the promoted first
10608 argument.
10609
10610 @item -fsanitize=shift-base
10611 @opindex fsanitize=shift-base
10612 If the second argument of a shift operation is within range, check that the
10613 result of a shift operation is not undefined. Note that what exactly is
10614 considered undefined differs slightly between C and C++, as well as between
10615 ISO C90 and C99, etc.
10616
10617 @item -fsanitize=integer-divide-by-zero
10618 @opindex fsanitize=integer-divide-by-zero
10619 Detect integer division by zero as well as @code{INT_MIN / -1} division.
10620
10621 @item -fsanitize=unreachable
10622 @opindex fsanitize=unreachable
10623 With this option, the compiler turns the @code{__builtin_unreachable}
10624 call into a diagnostics message call instead. When reaching the
10625 @code{__builtin_unreachable} call, the behavior is undefined.
10626
10627 @item -fsanitize=vla-bound
10628 @opindex fsanitize=vla-bound
10629 This option instructs the compiler to check that the size of a variable
10630 length array is positive.
10631
10632 @item -fsanitize=null
10633 @opindex fsanitize=null
10634 This option enables pointer checking. Particularly, the application
10635 built with this option turned on will issue an error message when it
10636 tries to dereference a NULL pointer, or if a reference (possibly an
10637 rvalue reference) is bound to a NULL pointer, or if a method is invoked
10638 on an object pointed by a NULL pointer.
10639
10640 @item -fsanitize=return
10641 @opindex fsanitize=return
10642 This option enables return statement checking. Programs
10643 built with this option turned on will issue an error message
10644 when the end of a non-void function is reached without actually
10645 returning a value. This option works in C++ only.
10646
10647 @item -fsanitize=signed-integer-overflow
10648 @opindex fsanitize=signed-integer-overflow
10649 This option enables signed integer overflow checking. We check that
10650 the result of @code{+}, @code{*}, and both unary and binary @code{-}
10651 does not overflow in the signed arithmetics. Note, integer promotion
10652 rules must be taken into account. That is, the following is not an
10653 overflow:
10654 @smallexample
10655 signed char a = SCHAR_MAX;
10656 a++;
10657 @end smallexample
10658
10659 @item -fsanitize=bounds
10660 @opindex fsanitize=bounds
10661 This option enables instrumentation of array bounds. Various out of bounds
10662 accesses are detected. Flexible array members, flexible array member-like
10663 arrays, and initializers of variables with static storage are not instrumented.
10664
10665 @item -fsanitize=bounds-strict
10666 @opindex fsanitize=bounds-strict
10667 This option enables strict instrumentation of array bounds. Most out of bounds
10668 accesses are detected, including flexible array members and flexible array
10669 member-like arrays. Initializers of variables with static storage are not
10670 instrumented.
10671
10672 @item -fsanitize=alignment
10673 @opindex fsanitize=alignment
10674
10675 This option enables checking of alignment of pointers when they are
10676 dereferenced, or when a reference is bound to insufficiently aligned target,
10677 or when a method or constructor is invoked on insufficiently aligned object.
10678
10679 @item -fsanitize=object-size
10680 @opindex fsanitize=object-size
10681 This option enables instrumentation of memory references using the
10682 @code{__builtin_object_size} function. Various out of bounds pointer
10683 accesses are detected.
10684
10685 @item -fsanitize=float-divide-by-zero
10686 @opindex fsanitize=float-divide-by-zero
10687 Detect floating-point division by zero. Unlike other similar options,
10688 @option{-fsanitize=float-divide-by-zero} is not enabled by
10689 @option{-fsanitize=undefined}, since floating-point division by zero can
10690 be a legitimate way of obtaining infinities and NaNs.
10691
10692 @item -fsanitize=float-cast-overflow
10693 @opindex fsanitize=float-cast-overflow
10694 This option enables floating-point type to integer conversion checking.
10695 We check that the result of the conversion does not overflow.
10696 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
10697 not enabled by @option{-fsanitize=undefined}.
10698 This option does not work well with @code{FE_INVALID} exceptions enabled.
10699
10700 @item -fsanitize=nonnull-attribute
10701 @opindex fsanitize=nonnull-attribute
10702
10703 This option enables instrumentation of calls, checking whether null values
10704 are not passed to arguments marked as requiring a non-null value by the
10705 @code{nonnull} function attribute.
10706
10707 @item -fsanitize=returns-nonnull-attribute
10708 @opindex fsanitize=returns-nonnull-attribute
10709
10710 This option enables instrumentation of return statements in functions
10711 marked with @code{returns_nonnull} function attribute, to detect returning
10712 of null values from such functions.
10713
10714 @item -fsanitize=bool
10715 @opindex fsanitize=bool
10716
10717 This option enables instrumentation of loads from bool. If a value other
10718 than 0/1 is loaded, a run-time error is issued.
10719
10720 @item -fsanitize=enum
10721 @opindex fsanitize=enum
10722
10723 This option enables instrumentation of loads from an enum type. If
10724 a value outside the range of values for the enum type is loaded,
10725 a run-time error is issued.
10726
10727 @item -fsanitize=vptr
10728 @opindex fsanitize=vptr
10729
10730 This option enables instrumentation of C++ member function calls, member
10731 accesses and some conversions between pointers to base and derived classes,
10732 to verify the referenced object has the correct dynamic type.
10733
10734 @end table
10735
10736 While @option{-ftrapv} causes traps for signed overflows to be emitted,
10737 @option{-fsanitize=undefined} gives a diagnostic message.
10738 This currently works only for the C family of languages.
10739
10740 @item -fno-sanitize=all
10741 @opindex fno-sanitize=all
10742
10743 This option disables all previously enabled sanitizers.
10744 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
10745 together.
10746
10747 @item -fasan-shadow-offset=@var{number}
10748 @opindex fasan-shadow-offset
10749 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
10750 It is useful for experimenting with different shadow memory layouts in
10751 Kernel AddressSanitizer.
10752
10753 @item -fsanitize-sections=@var{s1},@var{s2},...
10754 @opindex fsanitize-sections
10755 Sanitize global variables in selected user-defined sections. @var{si} may
10756 contain wildcards.
10757
10758 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
10759 @opindex fsanitize-recover
10760 @opindex fno-sanitize-recover
10761 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
10762 mentioned in comma-separated list of @var{opts}. Enabling this option
10763 for a sanitizer component causes it to attempt to continue
10764 running the program as if no error happened. This means multiple
10765 runtime errors can be reported in a single program run, and the exit
10766 code of the program may indicate success even when errors
10767 have been reported. The @option{-fno-sanitize-recover=} option
10768 can be used to alter
10769 this behavior: only the first detected error is reported
10770 and program then exits with a non-zero exit code.
10771
10772 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
10773 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
10774 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
10775 @option{-fsanitize=bounds-strict},
10776 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
10777 For these sanitizers error recovery is turned on by default,
10778 except @option{-fsanitize=address}, for which this feature is experimental.
10779 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
10780 accepted, the former enables recovery for all sanitizers that support it,
10781 the latter disables recovery for all sanitizers that support it.
10782
10783 Even if a recovery mode is turned on the compiler side, it needs to be also
10784 enabled on the runtime library side, otherwise the failures are still fatal.
10785 The runtime library defaults to @code{halt_on_error=0} for
10786 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
10787 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
10788 setting the @code{halt_on_error} flag in the corresponding environment variable.
10789
10790 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
10791 @smallexample
10792 -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
10793 @end smallexample
10794 @noindent
10795 Similarly @option{-fno-sanitize-recover} is equivalent to
10796 @smallexample
10797 -fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
10798 @end smallexample
10799
10800 @item -fsanitize-address-use-after-scope
10801 @opindex fsanitize-address-use-after-scope
10802 Enable sanitization of local variables to detect use-after-scope bugs.
10803 The option sets @option{-fstack-reuse} to @samp{none}.
10804
10805 @item -fsanitize-undefined-trap-on-error
10806 @opindex fsanitize-undefined-trap-on-error
10807 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
10808 report undefined behavior using @code{__builtin_trap} rather than
10809 a @code{libubsan} library routine. The advantage of this is that the
10810 @code{libubsan} library is not needed and is not linked in, so this
10811 is usable even in freestanding environments.
10812
10813 @item -fsanitize-coverage=trace-pc
10814 @opindex fsanitize-coverage=trace-pc
10815 Enable coverage-guided fuzzing code instrumentation.
10816 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
10817
10818 @item -fbounds-check
10819 @opindex fbounds-check
10820 For front ends that support it, generate additional code to check that
10821 indices used to access arrays are within the declared range. This is
10822 currently only supported by the Fortran front end, where this option
10823 defaults to false.
10824
10825 @item -fcheck-pointer-bounds
10826 @opindex fcheck-pointer-bounds
10827 @opindex fno-check-pointer-bounds
10828 @cindex Pointer Bounds Checker options
10829 Enable Pointer Bounds Checker instrumentation. Each memory reference
10830 is instrumented with checks of the pointer used for memory access against
10831 bounds associated with that pointer.
10832
10833 Currently there
10834 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
10835 and @option{-mmpx} are required to enable this feature.
10836 MPX-based instrumentation requires
10837 a runtime library to enable MPX in hardware and handle bounds
10838 violation signals. By default when @option{-fcheck-pointer-bounds}
10839 and @option{-mmpx} options are used to link a program, the GCC driver
10840 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
10841 Bounds checking on calls to dynamic libraries requires a linker
10842 with @option{-z bndplt} support; if GCC was configured with a linker
10843 without support for this option (including the Gold linker and older
10844 versions of ld), a warning is given if you link with @option{-mmpx}
10845 without also specifying @option{-static}, since the overall effectiveness
10846 of the bounds checking protection is reduced.
10847 See also @option{-static-libmpxwrappers}.
10848
10849 MPX-based instrumentation
10850 may be used for debugging and also may be included in production code
10851 to increase program security. Depending on usage, you may
10852 have different requirements for the runtime library. The current version
10853 of the MPX runtime library is more oriented for use as a debugging
10854 tool. MPX runtime library usage implies @option{-lpthread}. See
10855 also @option{-static-libmpx}. The runtime library behavior can be
10856 influenced using various @env{CHKP_RT_*} environment variables. See
10857 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
10858 for more details.
10859
10860 Generated instrumentation may be controlled by various
10861 @option{-fchkp-*} options and by the @code{bnd_variable_size}
10862 structure field attribute (@pxref{Type Attributes}) and
10863 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
10864 (@pxref{Function Attributes}). GCC also provides a number of built-in
10865 functions for controlling the Pointer Bounds Checker. @xref{Pointer
10866 Bounds Checker builtins}, for more information.
10867
10868 @item -fchkp-check-incomplete-type
10869 @opindex fchkp-check-incomplete-type
10870 @opindex fno-chkp-check-incomplete-type
10871 Generate pointer bounds checks for variables with incomplete type.
10872 Enabled by default.
10873
10874 @item -fchkp-narrow-bounds
10875 @opindex fchkp-narrow-bounds
10876 @opindex fno-chkp-narrow-bounds
10877 Controls bounds used by Pointer Bounds Checker for pointers to object
10878 fields. If narrowing is enabled then field bounds are used. Otherwise
10879 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
10880 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
10881
10882 @item -fchkp-first-field-has-own-bounds
10883 @opindex fchkp-first-field-has-own-bounds
10884 @opindex fno-chkp-first-field-has-own-bounds
10885 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
10886 first field in the structure. By default a pointer to the first field has
10887 the same bounds as a pointer to the whole structure.
10888
10889 @item -fchkp-narrow-to-innermost-array
10890 @opindex fchkp-narrow-to-innermost-array
10891 @opindex fno-chkp-narrow-to-innermost-array
10892 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
10893 case of nested static array access. By default this option is disabled and
10894 bounds of the outermost array are used.
10895
10896 @item -fchkp-optimize
10897 @opindex fchkp-optimize
10898 @opindex fno-chkp-optimize
10899 Enables Pointer Bounds Checker optimizations. Enabled by default at
10900 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
10901
10902 @item -fchkp-use-fast-string-functions
10903 @opindex fchkp-use-fast-string-functions
10904 @opindex fno-chkp-use-fast-string-functions
10905 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
10906 by Pointer Bounds Checker. Disabled by default.
10907
10908 @item -fchkp-use-nochk-string-functions
10909 @opindex fchkp-use-nochk-string-functions
10910 @opindex fno-chkp-use-nochk-string-functions
10911 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
10912 by Pointer Bounds Checker. Disabled by default.
10913
10914 @item -fchkp-use-static-bounds
10915 @opindex fchkp-use-static-bounds
10916 @opindex fno-chkp-use-static-bounds
10917 Allow Pointer Bounds Checker to generate static bounds holding
10918 bounds of static variables. Enabled by default.
10919
10920 @item -fchkp-use-static-const-bounds
10921 @opindex fchkp-use-static-const-bounds
10922 @opindex fno-chkp-use-static-const-bounds
10923 Use statically-initialized bounds for constant bounds instead of
10924 generating them each time they are required. By default enabled when
10925 @option{-fchkp-use-static-bounds} is enabled.
10926
10927 @item -fchkp-treat-zero-dynamic-size-as-infinite
10928 @opindex fchkp-treat-zero-dynamic-size-as-infinite
10929 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
10930 With this option, objects with incomplete type whose
10931 dynamically-obtained size is zero are treated as having infinite size
10932 instead by Pointer Bounds
10933 Checker. This option may be helpful if a program is linked with a library
10934 missing size information for some symbols. Disabled by default.
10935
10936 @item -fchkp-check-read
10937 @opindex fchkp-check-read
10938 @opindex fno-chkp-check-read
10939 Instructs Pointer Bounds Checker to generate checks for all read
10940 accesses to memory. Enabled by default.
10941
10942 @item -fchkp-check-write
10943 @opindex fchkp-check-write
10944 @opindex fno-chkp-check-write
10945 Instructs Pointer Bounds Checker to generate checks for all write
10946 accesses to memory. Enabled by default.
10947
10948 @item -fchkp-store-bounds
10949 @opindex fchkp-store-bounds
10950 @opindex fno-chkp-store-bounds
10951 Instructs Pointer Bounds Checker to generate bounds stores for
10952 pointer writes. Enabled by default.
10953
10954 @item -fchkp-instrument-calls
10955 @opindex fchkp-instrument-calls
10956 @opindex fno-chkp-instrument-calls
10957 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
10958 Enabled by default.
10959
10960 @item -fchkp-instrument-marked-only
10961 @opindex fchkp-instrument-marked-only
10962 @opindex fno-chkp-instrument-marked-only
10963 Instructs Pointer Bounds Checker to instrument only functions
10964 marked with the @code{bnd_instrument} attribute
10965 (@pxref{Function Attributes}). Disabled by default.
10966
10967 @item -fchkp-use-wrappers
10968 @opindex fchkp-use-wrappers
10969 @opindex fno-chkp-use-wrappers
10970 Allows Pointer Bounds Checker to replace calls to built-in functions
10971 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
10972 is used to link a program, the GCC driver automatically links
10973 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
10974 Enabled by default.
10975
10976 @item -fstack-protector
10977 @opindex fstack-protector
10978 Emit extra code to check for buffer overflows, such as stack smashing
10979 attacks. This is done by adding a guard variable to functions with
10980 vulnerable objects. This includes functions that call @code{alloca}, and
10981 functions with buffers larger than 8 bytes. The guards are initialized
10982 when a function is entered and then checked when the function exits.
10983 If a guard check fails, an error message is printed and the program exits.
10984
10985 @item -fstack-protector-all
10986 @opindex fstack-protector-all
10987 Like @option{-fstack-protector} except that all functions are protected.
10988
10989 @item -fstack-protector-strong
10990 @opindex fstack-protector-strong
10991 Like @option{-fstack-protector} but includes additional functions to
10992 be protected --- those that have local array definitions, or have
10993 references to local frame addresses.
10994
10995 @item -fstack-protector-explicit
10996 @opindex fstack-protector-explicit
10997 Like @option{-fstack-protector} but only protects those functions which
10998 have the @code{stack_protect} attribute.
10999
11000 @item -fstack-check
11001 @opindex fstack-check
11002 Generate code to verify that you do not go beyond the boundary of the
11003 stack. You should specify this flag if you are running in an
11004 environment with multiple threads, but you only rarely need to specify it in
11005 a single-threaded environment since stack overflow is automatically
11006 detected on nearly all systems if there is only one stack.
11007
11008 Note that this switch does not actually cause checking to be done; the
11009 operating system or the language runtime must do that. The switch causes
11010 generation of code to ensure that they see the stack being extended.
11011
11012 You can additionally specify a string parameter: @samp{no} means no
11013 checking, @samp{generic} means force the use of old-style checking,
11014 @samp{specific} means use the best checking method and is equivalent
11015 to bare @option{-fstack-check}.
11016
11017 Old-style checking is a generic mechanism that requires no specific
11018 target support in the compiler but comes with the following drawbacks:
11019
11020 @enumerate
11021 @item
11022 Modified allocation strategy for large objects: they are always
11023 allocated dynamically if their size exceeds a fixed threshold.
11024
11025 @item
11026 Fixed limit on the size of the static frame of functions: when it is
11027 topped by a particular function, stack checking is not reliable and
11028 a warning is issued by the compiler.
11029
11030 @item
11031 Inefficiency: because of both the modified allocation strategy and the
11032 generic implementation, code performance is hampered.
11033 @end enumerate
11034
11035 Note that old-style stack checking is also the fallback method for
11036 @samp{specific} if no target support has been added in the compiler.
11037
11038 @item -fstack-limit-register=@var{reg}
11039 @itemx -fstack-limit-symbol=@var{sym}
11040 @itemx -fno-stack-limit
11041 @opindex fstack-limit-register
11042 @opindex fstack-limit-symbol
11043 @opindex fno-stack-limit
11044 Generate code to ensure that the stack does not grow beyond a certain value,
11045 either the value of a register or the address of a symbol. If a larger
11046 stack is required, a signal is raised at run time. For most targets,
11047 the signal is raised before the stack overruns the boundary, so
11048 it is possible to catch the signal without taking special precautions.
11049
11050 For instance, if the stack starts at absolute address @samp{0x80000000}
11051 and grows downwards, you can use the flags
11052 @option{-fstack-limit-symbol=__stack_limit} and
11053 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11054 of 128KB@. Note that this may only work with the GNU linker.
11055
11056 You can locally override stack limit checking by using the
11057 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
11058
11059 @item -fsplit-stack
11060 @opindex fsplit-stack
11061 Generate code to automatically split the stack before it overflows.
11062 The resulting program has a discontiguous stack which can only
11063 overflow if the program is unable to allocate any more memory. This
11064 is most useful when running threaded programs, as it is no longer
11065 necessary to calculate a good stack size to use for each thread. This
11066 is currently only implemented for the x86 targets running
11067 GNU/Linux.
11068
11069 When code compiled with @option{-fsplit-stack} calls code compiled
11070 without @option{-fsplit-stack}, there may not be much stack space
11071 available for the latter code to run. If compiling all code,
11072 including library code, with @option{-fsplit-stack} is not an option,
11073 then the linker can fix up these calls so that the code compiled
11074 without @option{-fsplit-stack} always has a large stack. Support for
11075 this is implemented in the gold linker in GNU binutils release 2.21
11076 and later.
11077
11078 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
11079 @opindex fvtable-verify
11080 This option is only available when compiling C++ code.
11081 It turns on (or off, if using @option{-fvtable-verify=none}) the security
11082 feature that verifies at run time, for every virtual call, that
11083 the vtable pointer through which the call is made is valid for the type of
11084 the object, and has not been corrupted or overwritten. If an invalid vtable
11085 pointer is detected at run time, an error is reported and execution of the
11086 program is immediately halted.
11087
11088 This option causes run-time data structures to be built at program startup,
11089 which are used for verifying the vtable pointers.
11090 The options @samp{std} and @samp{preinit}
11091 control the timing of when these data structures are built. In both cases the
11092 data structures are built before execution reaches @code{main}. Using
11093 @option{-fvtable-verify=std} causes the data structures to be built after
11094 shared libraries have been loaded and initialized.
11095 @option{-fvtable-verify=preinit} causes them to be built before shared
11096 libraries have been loaded and initialized.
11097
11098 If this option appears multiple times in the command line with different
11099 values specified, @samp{none} takes highest priority over both @samp{std} and
11100 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
11101
11102 @item -fvtv-debug
11103 @opindex fvtv-debug
11104 When used in conjunction with @option{-fvtable-verify=std} or
11105 @option{-fvtable-verify=preinit}, causes debug versions of the
11106 runtime functions for the vtable verification feature to be called.
11107 This flag also causes the compiler to log information about which
11108 vtable pointers it finds for each class.
11109 This information is written to a file named @file{vtv_set_ptr_data.log}
11110 in the directory named by the environment variable @env{VTV_LOGS_DIR}
11111 if that is defined or the current working directory otherwise.
11112
11113 Note: This feature @emph{appends} data to the log file. If you want a fresh log
11114 file, be sure to delete any existing one.
11115
11116 @item -fvtv-counts
11117 @opindex fvtv-counts
11118 This is a debugging flag. When used in conjunction with
11119 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
11120 causes the compiler to keep track of the total number of virtual calls
11121 it encounters and the number of verifications it inserts. It also
11122 counts the number of calls to certain run-time library functions
11123 that it inserts and logs this information for each compilation unit.
11124 The compiler writes this information to a file named
11125 @file{vtv_count_data.log} in the directory named by the environment
11126 variable @env{VTV_LOGS_DIR} if that is defined or the current working
11127 directory otherwise. It also counts the size of the vtable pointer sets
11128 for each class, and writes this information to @file{vtv_class_set_sizes.log}
11129 in the same directory.
11130
11131 Note: This feature @emph{appends} data to the log files. To get fresh log
11132 files, be sure to delete any existing ones.
11133
11134 @item -finstrument-functions
11135 @opindex finstrument-functions
11136 Generate instrumentation calls for entry and exit to functions. Just
11137 after function entry and just before function exit, the following
11138 profiling functions are called with the address of the current
11139 function and its call site. (On some platforms,
11140 @code{__builtin_return_address} does not work beyond the current
11141 function, so the call site information may not be available to the
11142 profiling functions otherwise.)
11143
11144 @smallexample
11145 void __cyg_profile_func_enter (void *this_fn,
11146 void *call_site);
11147 void __cyg_profile_func_exit (void *this_fn,
11148 void *call_site);
11149 @end smallexample
11150
11151 The first argument is the address of the start of the current function,
11152 which may be looked up exactly in the symbol table.
11153
11154 This instrumentation is also done for functions expanded inline in other
11155 functions. The profiling calls indicate where, conceptually, the
11156 inline function is entered and exited. This means that addressable
11157 versions of such functions must be available. If all your uses of a
11158 function are expanded inline, this may mean an additional expansion of
11159 code size. If you use @code{extern inline} in your C code, an
11160 addressable version of such functions must be provided. (This is
11161 normally the case anyway, but if you get lucky and the optimizer always
11162 expands the functions inline, you might have gotten away without
11163 providing static copies.)
11164
11165 A function may be given the attribute @code{no_instrument_function}, in
11166 which case this instrumentation is not done. This can be used, for
11167 example, for the profiling functions listed above, high-priority
11168 interrupt routines, and any functions from which the profiling functions
11169 cannot safely be called (perhaps signal handlers, if the profiling
11170 routines generate output or allocate memory).
11171
11172 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
11173 @opindex finstrument-functions-exclude-file-list
11174
11175 Set the list of functions that are excluded from instrumentation (see
11176 the description of @option{-finstrument-functions}). If the file that
11177 contains a function definition matches with one of @var{file}, then
11178 that function is not instrumented. The match is done on substrings:
11179 if the @var{file} parameter is a substring of the file name, it is
11180 considered to be a match.
11181
11182 For example:
11183
11184 @smallexample
11185 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
11186 @end smallexample
11187
11188 @noindent
11189 excludes any inline function defined in files whose pathnames
11190 contain @file{/bits/stl} or @file{include/sys}.
11191
11192 If, for some reason, you want to include letter @samp{,} in one of
11193 @var{sym}, write @samp{\,}. For example,
11194 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
11195 (note the single quote surrounding the option).
11196
11197 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
11198 @opindex finstrument-functions-exclude-function-list
11199
11200 This is similar to @option{-finstrument-functions-exclude-file-list},
11201 but this option sets the list of function names to be excluded from
11202 instrumentation. The function name to be matched is its user-visible
11203 name, such as @code{vector<int> blah(const vector<int> &)}, not the
11204 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
11205 match is done on substrings: if the @var{sym} parameter is a substring
11206 of the function name, it is considered to be a match. For C99 and C++
11207 extended identifiers, the function name must be given in UTF-8, not
11208 using universal character names.
11209
11210 @end table
11211
11212
11213 @node Preprocessor Options
11214 @section Options Controlling the Preprocessor
11215 @cindex preprocessor options
11216 @cindex options, preprocessor
11217
11218 These options control the C preprocessor, which is run on each C source
11219 file before actual compilation.
11220
11221 If you use the @option{-E} option, nothing is done except preprocessing.
11222 Some of these options make sense only together with @option{-E} because
11223 they cause the preprocessor output to be unsuitable for actual
11224 compilation.
11225
11226 @table @gcctabopt
11227 @item -Wp,@var{option}
11228 @opindex Wp
11229 You can use @option{-Wp,@var{option}} to bypass the compiler driver
11230 and pass @var{option} directly through to the preprocessor. If
11231 @var{option} contains commas, it is split into multiple options at the
11232 commas. However, many options are modified, translated or interpreted
11233 by the compiler driver before being passed to the preprocessor, and
11234 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
11235 interface is undocumented and subject to change, so whenever possible
11236 you should avoid using @option{-Wp} and let the driver handle the
11237 options instead.
11238
11239 @item -Xpreprocessor @var{option}
11240 @opindex Xpreprocessor
11241 Pass @var{option} as an option to the preprocessor. You can use this to
11242 supply system-specific preprocessor options that GCC does not
11243 recognize.
11244
11245 If you want to pass an option that takes an argument, you must use
11246 @option{-Xpreprocessor} twice, once for the option and once for the argument.
11247
11248 @item -no-integrated-cpp
11249 @opindex no-integrated-cpp
11250 Perform preprocessing as a separate pass before compilation.
11251 By default, GCC performs preprocessing as an integrated part of
11252 input tokenization and parsing.
11253 If this option is provided, the appropriate language front end
11254 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
11255 and Objective-C, respectively) is instead invoked twice,
11256 once for preprocessing only and once for actual compilation
11257 of the preprocessed input.
11258 This option may be useful in conjunction with the @option{-B} or
11259 @option{-wrapper} options to specify an alternate preprocessor or
11260 perform additional processing of the program source between
11261 normal preprocessing and compilation.
11262 @end table
11263
11264 @include cppopts.texi
11265
11266 @node Assembler Options
11267 @section Passing Options to the Assembler
11268
11269 @c prevent bad page break with this line
11270 You can pass options to the assembler.
11271
11272 @table @gcctabopt
11273 @item -Wa,@var{option}
11274 @opindex Wa
11275 Pass @var{option} as an option to the assembler. If @var{option}
11276 contains commas, it is split into multiple options at the commas.
11277
11278 @item -Xassembler @var{option}
11279 @opindex Xassembler
11280 Pass @var{option} as an option to the assembler. You can use this to
11281 supply system-specific assembler options that GCC does not
11282 recognize.
11283
11284 If you want to pass an option that takes an argument, you must use
11285 @option{-Xassembler} twice, once for the option and once for the argument.
11286
11287 @end table
11288
11289 @node Link Options
11290 @section Options for Linking
11291 @cindex link options
11292 @cindex options, linking
11293
11294 These options come into play when the compiler links object files into
11295 an executable output file. They are meaningless if the compiler is
11296 not doing a link step.
11297
11298 @table @gcctabopt
11299 @cindex file names
11300 @item @var{object-file-name}
11301 A file name that does not end in a special recognized suffix is
11302 considered to name an object file or library. (Object files are
11303 distinguished from libraries by the linker according to the file
11304 contents.) If linking is done, these object files are used as input
11305 to the linker.
11306
11307 @item -c
11308 @itemx -S
11309 @itemx -E
11310 @opindex c
11311 @opindex S
11312 @opindex E
11313 If any of these options is used, then the linker is not run, and
11314 object file names should not be used as arguments. @xref{Overall
11315 Options}.
11316
11317 @item -fuse-ld=bfd
11318 @opindex fuse-ld=bfd
11319 Use the @command{bfd} linker instead of the default linker.
11320
11321 @item -fuse-ld=gold
11322 @opindex fuse-ld=gold
11323 Use the @command{gold} linker instead of the default linker.
11324
11325 @cindex Libraries
11326 @item -l@var{library}
11327 @itemx -l @var{library}
11328 @opindex l
11329 Search the library named @var{library} when linking. (The second
11330 alternative with the library as a separate argument is only for
11331 POSIX compliance and is not recommended.)
11332
11333 It makes a difference where in the command you write this option; the
11334 linker searches and processes libraries and object files in the order they
11335 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
11336 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
11337 to functions in @samp{z}, those functions may not be loaded.
11338
11339 The linker searches a standard list of directories for the library,
11340 which is actually a file named @file{lib@var{library}.a}. The linker
11341 then uses this file as if it had been specified precisely by name.
11342
11343 The directories searched include several standard system directories
11344 plus any that you specify with @option{-L}.
11345
11346 Normally the files found this way are library files---archive files
11347 whose members are object files. The linker handles an archive file by
11348 scanning through it for members which define symbols that have so far
11349 been referenced but not defined. But if the file that is found is an
11350 ordinary object file, it is linked in the usual fashion. The only
11351 difference between using an @option{-l} option and specifying a file name
11352 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
11353 and searches several directories.
11354
11355 @item -lobjc
11356 @opindex lobjc
11357 You need this special case of the @option{-l} option in order to
11358 link an Objective-C or Objective-C++ program.
11359
11360 @item -nostartfiles
11361 @opindex nostartfiles
11362 Do not use the standard system startup files when linking.
11363 The standard system libraries are used normally, unless @option{-nostdlib}
11364 or @option{-nodefaultlibs} is used.
11365
11366 @item -nodefaultlibs
11367 @opindex nodefaultlibs
11368 Do not use the standard system libraries when linking.
11369 Only the libraries you specify are passed to the linker, and options
11370 specifying linkage of the system libraries, such as @option{-static-libgcc}
11371 or @option{-shared-libgcc}, are ignored.
11372 The standard startup files are used normally, unless @option{-nostartfiles}
11373 is used.
11374
11375 The compiler may generate calls to @code{memcmp},
11376 @code{memset}, @code{memcpy} and @code{memmove}.
11377 These entries are usually resolved by entries in
11378 libc. These entry points should be supplied through some other
11379 mechanism when this option is specified.
11380
11381 @item -nostdlib
11382 @opindex nostdlib
11383 Do not use the standard system startup files or libraries when linking.
11384 No startup files and only the libraries you specify are passed to
11385 the linker, and options specifying linkage of the system libraries, such as
11386 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
11387
11388 The compiler may generate calls to @code{memcmp}, @code{memset},
11389 @code{memcpy} and @code{memmove}.
11390 These entries are usually resolved by entries in
11391 libc. These entry points should be supplied through some other
11392 mechanism when this option is specified.
11393
11394 @cindex @option{-lgcc}, use with @option{-nostdlib}
11395 @cindex @option{-nostdlib} and unresolved references
11396 @cindex unresolved references and @option{-nostdlib}
11397 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
11398 @cindex @option{-nodefaultlibs} and unresolved references
11399 @cindex unresolved references and @option{-nodefaultlibs}
11400 One of the standard libraries bypassed by @option{-nostdlib} and
11401 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
11402 which GCC uses to overcome shortcomings of particular machines, or special
11403 needs for some languages.
11404 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
11405 Collection (GCC) Internals},
11406 for more discussion of @file{libgcc.a}.)
11407 In most cases, you need @file{libgcc.a} even when you want to avoid
11408 other standard libraries. In other words, when you specify @option{-nostdlib}
11409 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
11410 This ensures that you have no unresolved references to internal GCC
11411 library subroutines.
11412 (An example of such an internal subroutine is @code{__main}, used to ensure C++
11413 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
11414 GNU Compiler Collection (GCC) Internals}.)
11415
11416 @item -pie
11417 @opindex pie
11418 Produce a position independent executable on targets that support it.
11419 For predictable results, you must also specify the same set of options
11420 used for compilation (@option{-fpie}, @option{-fPIE},
11421 or model suboptions) when you specify this linker option.
11422
11423 @item -no-pie
11424 @opindex no-pie
11425 Don't produce a position independent executable.
11426
11427 @item -rdynamic
11428 @opindex rdynamic
11429 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
11430 that support it. This instructs the linker to add all symbols, not
11431 only used ones, to the dynamic symbol table. This option is needed
11432 for some uses of @code{dlopen} or to allow obtaining backtraces
11433 from within a program.
11434
11435 @item -s
11436 @opindex s
11437 Remove all symbol table and relocation information from the executable.
11438
11439 @item -static
11440 @opindex static
11441 On systems that support dynamic linking, this prevents linking with the shared
11442 libraries. On other systems, this option has no effect.
11443
11444 @item -shared
11445 @opindex shared
11446 Produce a shared object which can then be linked with other objects to
11447 form an executable. Not all systems support this option. For predictable
11448 results, you must also specify the same set of options used for compilation
11449 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
11450 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
11451 needs to build supplementary stub code for constructors to work. On
11452 multi-libbed systems, @samp{gcc -shared} must select the correct support
11453 libraries to link against. Failing to supply the correct flags may lead
11454 to subtle defects. Supplying them in cases where they are not necessary
11455 is innocuous.}
11456
11457 @item -shared-libgcc
11458 @itemx -static-libgcc
11459 @opindex shared-libgcc
11460 @opindex static-libgcc
11461 On systems that provide @file{libgcc} as a shared library, these options
11462 force the use of either the shared or static version, respectively.
11463 If no shared version of @file{libgcc} was built when the compiler was
11464 configured, these options have no effect.
11465
11466 There are several situations in which an application should use the
11467 shared @file{libgcc} instead of the static version. The most common
11468 of these is when the application wishes to throw and catch exceptions
11469 across different shared libraries. In that case, each of the libraries
11470 as well as the application itself should use the shared @file{libgcc}.
11471
11472 Therefore, the G++ and driver automatically adds @option{-shared-libgcc}
11473 whenever you build a shared library or a main executable, because C++
11474 programs typically use exceptions, so this is the right thing to do.
11475
11476 If, instead, you use the GCC driver to create shared libraries, you may
11477 find that they are not always linked with the shared @file{libgcc}.
11478 If GCC finds, at its configuration time, that you have a non-GNU linker
11479 or a GNU linker that does not support option @option{--eh-frame-hdr},
11480 it links the shared version of @file{libgcc} into shared libraries
11481 by default. Otherwise, it takes advantage of the linker and optimizes
11482 away the linking with the shared version of @file{libgcc}, linking with
11483 the static version of libgcc by default. This allows exceptions to
11484 propagate through such shared libraries, without incurring relocation
11485 costs at library load time.
11486
11487 However, if a library or main executable is supposed to throw or catch
11488 exceptions, you must link it using the G++ driver, as appropriate
11489 for the languages used in the program, or using the option
11490 @option{-shared-libgcc}, such that it is linked with the shared
11491 @file{libgcc}.
11492
11493 @item -static-libasan
11494 @opindex static-libasan
11495 When the @option{-fsanitize=address} option is used to link a program,
11496 the GCC driver automatically links against @option{libasan}. If
11497 @file{libasan} is available as a shared library, and the @option{-static}
11498 option is not used, then this links against the shared version of
11499 @file{libasan}. The @option{-static-libasan} option directs the GCC
11500 driver to link @file{libasan} statically, without necessarily linking
11501 other libraries statically.
11502
11503 @item -static-libtsan
11504 @opindex static-libtsan
11505 When the @option{-fsanitize=thread} option is used to link a program,
11506 the GCC driver automatically links against @option{libtsan}. If
11507 @file{libtsan} is available as a shared library, and the @option{-static}
11508 option is not used, then this links against the shared version of
11509 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
11510 driver to link @file{libtsan} statically, without necessarily linking
11511 other libraries statically.
11512
11513 @item -static-liblsan
11514 @opindex static-liblsan
11515 When the @option{-fsanitize=leak} option is used to link a program,
11516 the GCC driver automatically links against @option{liblsan}. If
11517 @file{liblsan} is available as a shared library, and the @option{-static}
11518 option is not used, then this links against the shared version of
11519 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
11520 driver to link @file{liblsan} statically, without necessarily linking
11521 other libraries statically.
11522
11523 @item -static-libubsan
11524 @opindex static-libubsan
11525 When the @option{-fsanitize=undefined} option is used to link a program,
11526 the GCC driver automatically links against @option{libubsan}. If
11527 @file{libubsan} is available as a shared library, and the @option{-static}
11528 option is not used, then this links against the shared version of
11529 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
11530 driver to link @file{libubsan} statically, without necessarily linking
11531 other libraries statically.
11532
11533 @item -static-libmpx
11534 @opindex static-libmpx
11535 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
11536 used to link a program, the GCC driver automatically links against
11537 @file{libmpx}. If @file{libmpx} is available as a shared library,
11538 and the @option{-static} option is not used, then this links against
11539 the shared version of @file{libmpx}. The @option{-static-libmpx}
11540 option directs the GCC driver to link @file{libmpx} statically,
11541 without necessarily linking other libraries statically.
11542
11543 @item -static-libmpxwrappers
11544 @opindex static-libmpxwrappers
11545 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
11546 to link a program without also using @option{-fno-chkp-use-wrappers}, the
11547 GCC driver automatically links against @file{libmpxwrappers}. If
11548 @file{libmpxwrappers} is available as a shared library, and the
11549 @option{-static} option is not used, then this links against the shared
11550 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
11551 option directs the GCC driver to link @file{libmpxwrappers} statically,
11552 without necessarily linking other libraries statically.
11553
11554 @item -static-libstdc++
11555 @opindex static-libstdc++
11556 When the @command{g++} program is used to link a C++ program, it
11557 normally automatically links against @option{libstdc++}. If
11558 @file{libstdc++} is available as a shared library, and the
11559 @option{-static} option is not used, then this links against the
11560 shared version of @file{libstdc++}. That is normally fine. However, it
11561 is sometimes useful to freeze the version of @file{libstdc++} used by
11562 the program without going all the way to a fully static link. The
11563 @option{-static-libstdc++} option directs the @command{g++} driver to
11564 link @file{libstdc++} statically, without necessarily linking other
11565 libraries statically.
11566
11567 @item -symbolic
11568 @opindex symbolic
11569 Bind references to global symbols when building a shared object. Warn
11570 about any unresolved references (unless overridden by the link editor
11571 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
11572 this option.
11573
11574 @item -T @var{script}
11575 @opindex T
11576 @cindex linker script
11577 Use @var{script} as the linker script. This option is supported by most
11578 systems using the GNU linker. On some targets, such as bare-board
11579 targets without an operating system, the @option{-T} option may be required
11580 when linking to avoid references to undefined symbols.
11581
11582 @item -Xlinker @var{option}
11583 @opindex Xlinker
11584 Pass @var{option} as an option to the linker. You can use this to
11585 supply system-specific linker options that GCC does not recognize.
11586
11587 If you want to pass an option that takes a separate argument, you must use
11588 @option{-Xlinker} twice, once for the option and once for the argument.
11589 For example, to pass @option{-assert definitions}, you must write
11590 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
11591 @option{-Xlinker "-assert definitions"}, because this passes the entire
11592 string as a single argument, which is not what the linker expects.
11593
11594 When using the GNU linker, it is usually more convenient to pass
11595 arguments to linker options using the @option{@var{option}=@var{value}}
11596 syntax than as separate arguments. For example, you can specify
11597 @option{-Xlinker -Map=output.map} rather than
11598 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
11599 this syntax for command-line options.
11600
11601 @item -Wl,@var{option}
11602 @opindex Wl
11603 Pass @var{option} as an option to the linker. If @var{option} contains
11604 commas, it is split into multiple options at the commas. You can use this
11605 syntax to pass an argument to the option.
11606 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
11607 linker. When using the GNU linker, you can also get the same effect with
11608 @option{-Wl,-Map=output.map}.
11609
11610 @item -u @var{symbol}
11611 @opindex u
11612 Pretend the symbol @var{symbol} is undefined, to force linking of
11613 library modules to define it. You can use @option{-u} multiple times with
11614 different symbols to force loading of additional library modules.
11615
11616 @item -z @var{keyword}
11617 @opindex z
11618 @option{-z} is passed directly on to the linker along with the keyword
11619 @var{keyword}. See the section in the documentation of your linker for
11620 permitted values and their meanings.
11621 @end table
11622
11623 @node Directory Options
11624 @section Options for Directory Search
11625 @cindex directory options
11626 @cindex options, directory search
11627 @cindex search path
11628
11629 These options specify directories to search for header files, for
11630 libraries and for parts of the compiler:
11631
11632 @table @gcctabopt
11633 @item -I@var{dir}
11634 @opindex I
11635 Add the directory @var{dir} to the head of the list of directories to be
11636 searched for header files. This can be used to override a system header
11637 file, substituting your own version, since these directories are
11638 searched before the system header file directories. However, you should
11639 not use this option to add directories that contain vendor-supplied
11640 system header files (use @option{-isystem} for that). If you use more than
11641 one @option{-I} option, the directories are scanned in left-to-right
11642 order; the standard system directories come after.
11643
11644 If a standard system include directory, or a directory specified with
11645 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
11646 option is ignored. The directory is still searched but as a
11647 system directory at its normal position in the system include chain.
11648 This is to ensure that GCC's procedure to fix buggy system headers and
11649 the ordering for the @code{include_next} directive are not inadvertently changed.
11650 If you really need to change the search order for system directories,
11651 use the @option{-nostdinc} and/or @option{-isystem} options.
11652
11653 @item -iplugindir=@var{dir}
11654 @opindex iplugindir=
11655 Set the directory to search for plugins that are passed
11656 by @option{-fplugin=@var{name}} instead of
11657 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
11658 to be used by the user, but only passed by the driver.
11659
11660 @item -iquote@var{dir}
11661 @opindex iquote
11662 Add the directory @var{dir} to the head of the list of directories to
11663 be searched for header files only for the case of @code{#include
11664 "@var{file}"}; they are not searched for @code{#include <@var{file}>},
11665 otherwise just like @option{-I}.
11666
11667 @item -L@var{dir}
11668 @opindex L
11669 Add directory @var{dir} to the list of directories to be searched
11670 for @option{-l}.
11671
11672 @item -B@var{prefix}
11673 @opindex B
11674 This option specifies where to find the executables, libraries,
11675 include files, and data files of the compiler itself.
11676
11677 The compiler driver program runs one or more of the subprograms
11678 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
11679 @var{prefix} as a prefix for each program it tries to run, both with and
11680 without @samp{@var{machine}/@var{version}/} for the corresponding target
11681 machine and compiler version.
11682
11683 For each subprogram to be run, the compiler driver first tries the
11684 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
11685 is not specified, the driver tries two standard prefixes,
11686 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
11687 those results in a file name that is found, the unmodified program
11688 name is searched for using the directories specified in your
11689 @env{PATH} environment variable.
11690
11691 The compiler checks to see if the path provided by @option{-B}
11692 refers to a directory, and if necessary it adds a directory
11693 separator character at the end of the path.
11694
11695 @option{-B} prefixes that effectively specify directory names also apply
11696 to libraries in the linker, because the compiler translates these
11697 options into @option{-L} options for the linker. They also apply to
11698 include files in the preprocessor, because the compiler translates these
11699 options into @option{-isystem} options for the preprocessor. In this case,
11700 the compiler appends @samp{include} to the prefix.
11701
11702 The runtime support file @file{libgcc.a} can also be searched for using
11703 the @option{-B} prefix, if needed. If it is not found there, the two
11704 standard prefixes above are tried, and that is all. The file is left
11705 out of the link if it is not found by those means.
11706
11707 Another way to specify a prefix much like the @option{-B} prefix is to use
11708 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
11709 Variables}.
11710
11711 As a special kludge, if the path provided by @option{-B} is
11712 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
11713 9, then it is replaced by @file{[dir/]include}. This is to help
11714 with boot-strapping the compiler.
11715
11716 @item -no-canonical-prefixes
11717 @opindex no-canonical-prefixes
11718 Do not expand any symbolic links, resolve references to @samp{/../}
11719 or @samp{/./}, or make the path absolute when generating a relative
11720 prefix.
11721
11722 @item --sysroot=@var{dir}
11723 @opindex sysroot
11724 Use @var{dir} as the logical root directory for headers and libraries.
11725 For example, if the compiler normally searches for headers in
11726 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
11727 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
11728
11729 If you use both this option and the @option{-isysroot} option, then
11730 the @option{--sysroot} option applies to libraries, but the
11731 @option{-isysroot} option applies to header files.
11732
11733 The GNU linker (beginning with version 2.16) has the necessary support
11734 for this option. If your linker does not support this option, the
11735 header file aspect of @option{--sysroot} still works, but the
11736 library aspect does not.
11737
11738 @item --no-sysroot-suffix
11739 @opindex no-sysroot-suffix
11740 For some targets, a suffix is added to the root directory specified
11741 with @option{--sysroot}, depending on the other options used, so that
11742 headers may for example be found in
11743 @file{@var{dir}/@var{suffix}/usr/include} instead of
11744 @file{@var{dir}/usr/include}. This option disables the addition of
11745 such a suffix.
11746
11747 @item -I-
11748 @opindex I-
11749 This option has been deprecated. Please use @option{-iquote} instead for
11750 @option{-I} directories before the @option{-I-} and remove the @option{-I-}
11751 option.
11752 Any directories you specify with @option{-I} options before the @option{-I-}
11753 option are searched only for the case of @code{#include "@var{file}"};
11754 they are not searched for @code{#include <@var{file}>}.
11755
11756 If additional directories are specified with @option{-I} options after
11757 the @option{-I-} option, these directories are searched for all @code{#include}
11758 directives. (Ordinarily @emph{all} @option{-I} directories are used
11759 this way.)
11760
11761 In addition, the @option{-I-} option inhibits the use of the current
11762 directory (where the current input file came from) as the first search
11763 directory for @code{#include "@var{file}"}. There is no way to
11764 override this effect of @option{-I-}. With @option{-I.} you can specify
11765 searching the directory that is current when the compiler is
11766 invoked. That is not exactly the same as what the preprocessor does
11767 by default, but it is often satisfactory.
11768
11769 @option{-I-} does not inhibit the use of the standard system directories
11770 for header files. Thus, @option{-I-} and @option{-nostdinc} are
11771 independent.
11772 @end table
11773
11774 @node Code Gen Options
11775 @section Options for Code Generation Conventions
11776 @cindex code generation conventions
11777 @cindex options, code generation
11778 @cindex run-time options
11779
11780 These machine-independent options control the interface conventions
11781 used in code generation.
11782
11783 Most of them have both positive and negative forms; the negative form
11784 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
11785 one of the forms is listed---the one that is not the default. You
11786 can figure out the other form by either removing @samp{no-} or adding
11787 it.
11788
11789 @table @gcctabopt
11790 @item -fstack-reuse=@var{reuse-level}
11791 @opindex fstack_reuse
11792 This option controls stack space reuse for user declared local/auto variables
11793 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
11794 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
11795 local variables and temporaries, @samp{named_vars} enables the reuse only for
11796 user defined local variables with names, and @samp{none} disables stack reuse
11797 completely. The default value is @samp{all}. The option is needed when the
11798 program extends the lifetime of a scoped local variable or a compiler generated
11799 temporary beyond the end point defined by the language. When a lifetime of
11800 a variable ends, and if the variable lives in memory, the optimizing compiler
11801 has the freedom to reuse its stack space with other temporaries or scoped
11802 local variables whose live range does not overlap with it. Legacy code extending
11803 local lifetime is likely to break with the stack reuse optimization.
11804
11805 For example,
11806
11807 @smallexample
11808 int *p;
11809 @{
11810 int local1;
11811
11812 p = &local1;
11813 local1 = 10;
11814 ....
11815 @}
11816 @{
11817 int local2;
11818 local2 = 20;
11819 ...
11820 @}
11821
11822 if (*p == 10) // out of scope use of local1
11823 @{
11824
11825 @}
11826 @end smallexample
11827
11828 Another example:
11829 @smallexample
11830
11831 struct A
11832 @{
11833 A(int k) : i(k), j(k) @{ @}
11834 int i;
11835 int j;
11836 @};
11837
11838 A *ap;
11839
11840 void foo(const A& ar)
11841 @{
11842 ap = &ar;
11843 @}
11844
11845 void bar()
11846 @{
11847 foo(A(10)); // temp object's lifetime ends when foo returns
11848
11849 @{
11850 A a(20);
11851 ....
11852 @}
11853 ap->i+= 10; // ap references out of scope temp whose space
11854 // is reused with a. What is the value of ap->i?
11855 @}
11856
11857 @end smallexample
11858
11859 The lifetime of a compiler generated temporary is well defined by the C++
11860 standard. When a lifetime of a temporary ends, and if the temporary lives
11861 in memory, the optimizing compiler has the freedom to reuse its stack
11862 space with other temporaries or scoped local variables whose live range
11863 does not overlap with it. However some of the legacy code relies on
11864 the behavior of older compilers in which temporaries' stack space is
11865 not reused, the aggressive stack reuse can lead to runtime errors. This
11866 option is used to control the temporary stack reuse optimization.
11867
11868 @item -ftrapv
11869 @opindex ftrapv
11870 This option generates traps for signed overflow on addition, subtraction,
11871 multiplication operations.
11872 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11873 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11874 @option{-fwrapv} being effective. Note that only active options override, so
11875 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11876 results in @option{-ftrapv} being effective.
11877
11878 @item -fwrapv
11879 @opindex fwrapv
11880 This option instructs the compiler to assume that signed arithmetic
11881 overflow of addition, subtraction and multiplication wraps around
11882 using twos-complement representation. This flag enables some optimizations
11883 and disables others.
11884 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11885 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11886 @option{-fwrapv} being effective. Note that only active options override, so
11887 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11888 results in @option{-ftrapv} being effective.
11889
11890 @item -fexceptions
11891 @opindex fexceptions
11892 Enable exception handling. Generates extra code needed to propagate
11893 exceptions. For some targets, this implies GCC generates frame
11894 unwind information for all functions, which can produce significant data
11895 size overhead, although it does not affect execution. If you do not
11896 specify this option, GCC enables it by default for languages like
11897 C++ that normally require exception handling, and disables it for
11898 languages like C that do not normally require it. However, you may need
11899 to enable this option when compiling C code that needs to interoperate
11900 properly with exception handlers written in C++. You may also wish to
11901 disable this option if you are compiling older C++ programs that don't
11902 use exception handling.
11903
11904 @item -fnon-call-exceptions
11905 @opindex fnon-call-exceptions
11906 Generate code that allows trapping instructions to throw exceptions.
11907 Note that this requires platform-specific runtime support that does
11908 not exist everywhere. Moreover, it only allows @emph{trapping}
11909 instructions to throw exceptions, i.e.@: memory references or floating-point
11910 instructions. It does not allow exceptions to be thrown from
11911 arbitrary signal handlers such as @code{SIGALRM}.
11912
11913 @item -fdelete-dead-exceptions
11914 @opindex fdelete-dead-exceptions
11915 Consider that instructions that may throw exceptions but don't otherwise
11916 contribute to the execution of the program can be optimized away.
11917 This option is enabled by default for the Ada front end, as permitted by
11918 the Ada language specification.
11919 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
11920
11921 @item -funwind-tables
11922 @opindex funwind-tables
11923 Similar to @option{-fexceptions}, except that it just generates any needed
11924 static data, but does not affect the generated code in any other way.
11925 You normally do not need to enable this option; instead, a language processor
11926 that needs this handling enables it on your behalf.
11927
11928 @item -fasynchronous-unwind-tables
11929 @opindex fasynchronous-unwind-tables
11930 Generate unwind table in DWARF format, if supported by target machine. The
11931 table is exact at each instruction boundary, so it can be used for stack
11932 unwinding from asynchronous events (such as debugger or garbage collector).
11933
11934 @item -fno-gnu-unique
11935 @opindex fno-gnu-unique
11936 On systems with recent GNU assembler and C library, the C++ compiler
11937 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
11938 of template static data members and static local variables in inline
11939 functions are unique even in the presence of @code{RTLD_LOCAL}; this
11940 is necessary to avoid problems with a library used by two different
11941 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
11942 therefore disagreeing with the other one about the binding of the
11943 symbol. But this causes @code{dlclose} to be ignored for affected
11944 DSOs; if your program relies on reinitialization of a DSO via
11945 @code{dlclose} and @code{dlopen}, you can use
11946 @option{-fno-gnu-unique}.
11947
11948 @item -fpcc-struct-return
11949 @opindex fpcc-struct-return
11950 Return ``short'' @code{struct} and @code{union} values in memory like
11951 longer ones, rather than in registers. This convention is less
11952 efficient, but it has the advantage of allowing intercallability between
11953 GCC-compiled files and files compiled with other compilers, particularly
11954 the Portable C Compiler (pcc).
11955
11956 The precise convention for returning structures in memory depends
11957 on the target configuration macros.
11958
11959 Short structures and unions are those whose size and alignment match
11960 that of some integer type.
11961
11962 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11963 switch is not binary compatible with code compiled with the
11964 @option{-freg-struct-return} switch.
11965 Use it to conform to a non-default application binary interface.
11966
11967 @item -freg-struct-return
11968 @opindex freg-struct-return
11969 Return @code{struct} and @code{union} values in registers when possible.
11970 This is more efficient for small structures than
11971 @option{-fpcc-struct-return}.
11972
11973 If you specify neither @option{-fpcc-struct-return} nor
11974 @option{-freg-struct-return}, GCC defaults to whichever convention is
11975 standard for the target. If there is no standard convention, GCC
11976 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11977 the principal compiler. In those cases, we can choose the standard, and
11978 we chose the more efficient register return alternative.
11979
11980 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11981 switch is not binary compatible with code compiled with the
11982 @option{-fpcc-struct-return} switch.
11983 Use it to conform to a non-default application binary interface.
11984
11985 @item -fshort-enums
11986 @opindex fshort-enums
11987 Allocate to an @code{enum} type only as many bytes as it needs for the
11988 declared range of possible values. Specifically, the @code{enum} type
11989 is equivalent to the smallest integer type that has enough room.
11990
11991 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11992 code that is not binary compatible with code generated without that switch.
11993 Use it to conform to a non-default application binary interface.
11994
11995 @item -fshort-wchar
11996 @opindex fshort-wchar
11997 Override the underlying type for @code{wchar_t} to be @code{short
11998 unsigned int} instead of the default for the target. This option is
11999 useful for building programs to run under WINE@.
12000
12001 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
12002 code that is not binary compatible with code generated without that switch.
12003 Use it to conform to a non-default application binary interface.
12004
12005 @item -fno-common
12006 @opindex fno-common
12007 @cindex tentative definitions
12008 In C code, this option controls the placement of global variables
12009 defined without an initializer, known as @dfn{tentative definitions}
12010 in the C standard. Tentative definitions are distinct from declarations
12011 of a variable with the @code{extern} keyword, which do not allocate storage.
12012
12013 Unix C compilers have traditionally allocated storage for
12014 uninitialized global variables in a common block. This allows the
12015 linker to resolve all tentative definitions of the same variable
12016 in different compilation units to the same object, or to a non-tentative
12017 definition.
12018 This is the behavior specified by @option{-fcommon}, and is the default for
12019 GCC on most targets.
12020 On the other hand, this behavior is not required by ISO
12021 C, and on some targets may carry a speed or code size penalty on
12022 variable references.
12023
12024 The @option{-fno-common} option specifies that the compiler should instead
12025 place uninitialized global variables in the data section of the object file.
12026 This inhibits the merging of tentative definitions by the linker so
12027 you get a multiple-definition error if the same
12028 variable is defined in more than one compilation unit.
12029 Compiling with @option{-fno-common} is useful on targets for which
12030 it provides better performance, or if you wish to verify that the
12031 program will work on other systems that always treat uninitialized
12032 variable definitions this way.
12033
12034 @item -fno-ident
12035 @opindex fno-ident
12036 Ignore the @code{#ident} directive.
12037
12038 @item -finhibit-size-directive
12039 @opindex finhibit-size-directive
12040 Don't output a @code{.size} assembler directive, or anything else that
12041 would cause trouble if the function is split in the middle, and the
12042 two halves are placed at locations far apart in memory. This option is
12043 used when compiling @file{crtstuff.c}; you should not need to use it
12044 for anything else.
12045
12046 @item -fverbose-asm
12047 @opindex fverbose-asm
12048 Put extra commentary information in the generated assembly code to
12049 make it more readable. This option is generally only of use to those
12050 who actually need to read the generated assembly code (perhaps while
12051 debugging the compiler itself).
12052
12053 @option{-fno-verbose-asm}, the default, causes the
12054 extra information to be omitted and is useful when comparing two assembler
12055 files.
12056
12057 The added comments include:
12058
12059 @itemize @bullet
12060
12061 @item
12062 information on the compiler version and command-line options,
12063
12064 @item
12065 the source code lines associated with the assembly instructions,
12066 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
12067
12068 @item
12069 hints on which high-level expressions correspond to
12070 the various assembly instruction operands.
12071
12072 @end itemize
12073
12074 For example, given this C source file:
12075
12076 @smallexample
12077 int test (int n)
12078 @{
12079 int i;
12080 int total = 0;
12081
12082 for (i = 0; i < n; i++)
12083 total += i * i;
12084
12085 return total;
12086 @}
12087 @end smallexample
12088
12089 compiling to (x86_64) assembly via @option{-S} and emitting the result
12090 direct to stdout via @option{-o} @option{-}
12091
12092 @smallexample
12093 gcc -S test.c -fverbose-asm -Os -o -
12094 @end smallexample
12095
12096 gives output similar to this:
12097
12098 @smallexample
12099 .file "test.c"
12100 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
12101 [...snip...]
12102 # options passed:
12103 [...snip...]
12104
12105 .text
12106 .globl test
12107 .type test, @@function
12108 test:
12109 .LFB0:
12110 .cfi_startproc
12111 # test.c:4: int total = 0;
12112 xorl %eax, %eax # <retval>
12113 # test.c:6: for (i = 0; i < n; i++)
12114 xorl %edx, %edx # i
12115 .L2:
12116 # test.c:6: for (i = 0; i < n; i++)
12117 cmpl %edi, %edx # n, i
12118 jge .L5 #,
12119 # test.c:7: total += i * i;
12120 movl %edx, %ecx # i, tmp92
12121 imull %edx, %ecx # i, tmp92
12122 # test.c:6: for (i = 0; i < n; i++)
12123 incl %edx # i
12124 # test.c:7: total += i * i;
12125 addl %ecx, %eax # tmp92, <retval>
12126 jmp .L2 #
12127 .L5:
12128 # test.c:10: @}
12129 ret
12130 .cfi_endproc
12131 .LFE0:
12132 .size test, .-test
12133 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
12134 .section .note.GNU-stack,"",@@progbits
12135 @end smallexample
12136
12137 The comments are intended for humans rather than machines and hence the
12138 precise format of the comments is subject to change.
12139
12140 @item -frecord-gcc-switches
12141 @opindex frecord-gcc-switches
12142 This switch causes the command line used to invoke the
12143 compiler to be recorded into the object file that is being created.
12144 This switch is only implemented on some targets and the exact format
12145 of the recording is target and binary file format dependent, but it
12146 usually takes the form of a section containing ASCII text. This
12147 switch is related to the @option{-fverbose-asm} switch, but that
12148 switch only records information in the assembler output file as
12149 comments, so it never reaches the object file.
12150 See also @option{-grecord-gcc-switches} for another
12151 way of storing compiler options into the object file.
12152
12153 @item -fpic
12154 @opindex fpic
12155 @cindex global offset table
12156 @cindex PIC
12157 Generate position-independent code (PIC) suitable for use in a shared
12158 library, if supported for the target machine. Such code accesses all
12159 constant addresses through a global offset table (GOT)@. The dynamic
12160 loader resolves the GOT entries when the program starts (the dynamic
12161 loader is not part of GCC; it is part of the operating system). If
12162 the GOT size for the linked executable exceeds a machine-specific
12163 maximum size, you get an error message from the linker indicating that
12164 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
12165 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
12166 on the m68k and RS/6000. The x86 has no such limit.)
12167
12168 Position-independent code requires special support, and therefore works
12169 only on certain machines. For the x86, GCC supports PIC for System V
12170 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
12171 position-independent.
12172
12173 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12174 are defined to 1.
12175
12176 @item -fPIC
12177 @opindex fPIC
12178 If supported for the target machine, emit position-independent code,
12179 suitable for dynamic linking and avoiding any limit on the size of the
12180 global offset table. This option makes a difference on AArch64, m68k,
12181 PowerPC and SPARC@.
12182
12183 Position-independent code requires special support, and therefore works
12184 only on certain machines.
12185
12186 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12187 are defined to 2.
12188
12189 @item -fpie
12190 @itemx -fPIE
12191 @opindex fpie
12192 @opindex fPIE
12193 These options are similar to @option{-fpic} and @option{-fPIC}, but
12194 generated position independent code can be only linked into executables.
12195 Usually these options are used when @option{-pie} GCC option is
12196 used during linking.
12197
12198 @option{-fpie} and @option{-fPIE} both define the macros
12199 @code{__pie__} and @code{__PIE__}. The macros have the value 1
12200 for @option{-fpie} and 2 for @option{-fPIE}.
12201
12202 @item -fno-plt
12203 @opindex fno-plt
12204 Do not use the PLT for external function calls in position-independent code.
12205 Instead, load the callee address at call sites from the GOT and branch to it.
12206 This leads to more efficient code by eliminating PLT stubs and exposing
12207 GOT loads to optimizations. On architectures such as 32-bit x86 where
12208 PLT stubs expect the GOT pointer in a specific register, this gives more
12209 register allocation freedom to the compiler.
12210 Lazy binding requires use of the PLT;
12211 with @option{-fno-plt} all external symbols are resolved at load time.
12212
12213 Alternatively, the function attribute @code{noplt} can be used to avoid calls
12214 through the PLT for specific external functions.
12215
12216 In position-dependent code, a few targets also convert calls to
12217 functions that are marked to not use the PLT to use the GOT instead.
12218
12219 @item -fno-jump-tables
12220 @opindex fno-jump-tables
12221 Do not use jump tables for switch statements even where it would be
12222 more efficient than other code generation strategies. This option is
12223 of use in conjunction with @option{-fpic} or @option{-fPIC} for
12224 building code that forms part of a dynamic linker and cannot
12225 reference the address of a jump table. On some targets, jump tables
12226 do not require a GOT and this option is not needed.
12227
12228 @item -ffixed-@var{reg}
12229 @opindex ffixed
12230 Treat the register named @var{reg} as a fixed register; generated code
12231 should never refer to it (except perhaps as a stack pointer, frame
12232 pointer or in some other fixed role).
12233
12234 @var{reg} must be the name of a register. The register names accepted
12235 are machine-specific and are defined in the @code{REGISTER_NAMES}
12236 macro in the machine description macro file.
12237
12238 This flag does not have a negative form, because it specifies a
12239 three-way choice.
12240
12241 @item -fcall-used-@var{reg}
12242 @opindex fcall-used
12243 Treat the register named @var{reg} as an allocable register that is
12244 clobbered by function calls. It may be allocated for temporaries or
12245 variables that do not live across a call. Functions compiled this way
12246 do not save and restore the register @var{reg}.
12247
12248 It is an error to use this flag with the frame pointer or stack pointer.
12249 Use of this flag for other registers that have fixed pervasive roles in
12250 the machine's execution model produces disastrous results.
12251
12252 This flag does not have a negative form, because it specifies a
12253 three-way choice.
12254
12255 @item -fcall-saved-@var{reg}
12256 @opindex fcall-saved
12257 Treat the register named @var{reg} as an allocable register saved by
12258 functions. It may be allocated even for temporaries or variables that
12259 live across a call. Functions compiled this way save and restore
12260 the register @var{reg} if they use it.
12261
12262 It is an error to use this flag with the frame pointer or stack pointer.
12263 Use of this flag for other registers that have fixed pervasive roles in
12264 the machine's execution model produces disastrous results.
12265
12266 A different sort of disaster results from the use of this flag for
12267 a register in which function values may be returned.
12268
12269 This flag does not have a negative form, because it specifies a
12270 three-way choice.
12271
12272 @item -fpack-struct[=@var{n}]
12273 @opindex fpack-struct
12274 Without a value specified, pack all structure members together without
12275 holes. When a value is specified (which must be a small power of two), pack
12276 structure members according to this value, representing the maximum
12277 alignment (that is, objects with default alignment requirements larger than
12278 this are output potentially unaligned at the next fitting location.
12279
12280 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
12281 code that is not binary compatible with code generated without that switch.
12282 Additionally, it makes the code suboptimal.
12283 Use it to conform to a non-default application binary interface.
12284
12285 @item -fleading-underscore
12286 @opindex fleading-underscore
12287 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
12288 change the way C symbols are represented in the object file. One use
12289 is to help link with legacy assembly code.
12290
12291 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
12292 generate code that is not binary compatible with code generated without that
12293 switch. Use it to conform to a non-default application binary interface.
12294 Not all targets provide complete support for this switch.
12295
12296 @item -ftls-model=@var{model}
12297 @opindex ftls-model
12298 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
12299 The @var{model} argument should be one of @samp{global-dynamic},
12300 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
12301 Note that the choice is subject to optimization: the compiler may use
12302 a more efficient model for symbols not visible outside of the translation
12303 unit, or if @option{-fpic} is not given on the command line.
12304
12305 The default without @option{-fpic} is @samp{initial-exec}; with
12306 @option{-fpic} the default is @samp{global-dynamic}.
12307
12308 @item -ftrampolines
12309 @opindex ftrampolines
12310 For targets that normally need trampolines for nested functions, always
12311 generate them instead of using descriptors. Otherwise, for targets that
12312 do not need them, like for example HP-PA or IA-64, do nothing.
12313
12314 A trampoline is a small piece of code that is created at run time on the
12315 stack when the address of a nested function is taken, and is used to call
12316 the nested function indirectly. Therefore, it requires the stack to be
12317 made executable in order for the program to work properly.
12318
12319 @option{-fno-trampolines} is enabled by default on a language by language
12320 basis to let the compiler avoid generating them, if it computes that this
12321 is safe, and replace them with descriptors. Descriptors are made up of data
12322 only, but the generated code must be prepared to deal with them. As of this
12323 writing, @option{-fno-trampolines} is enabled by default only for Ada.
12324
12325 Moreover, code compiled with @option{-ftrampolines} and code compiled with
12326 @option{-fno-trampolines} are not binary compatible if nested functions are
12327 present. This option must therefore be used on a program-wide basis and be
12328 manipulated with extreme care.
12329
12330 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
12331 @opindex fvisibility
12332 Set the default ELF image symbol visibility to the specified option---all
12333 symbols are marked with this unless overridden within the code.
12334 Using this feature can very substantially improve linking and
12335 load times of shared object libraries, produce more optimized
12336 code, provide near-perfect API export and prevent symbol clashes.
12337 It is @strong{strongly} recommended that you use this in any shared objects
12338 you distribute.
12339
12340 Despite the nomenclature, @samp{default} always means public; i.e.,
12341 available to be linked against from outside the shared object.
12342 @samp{protected} and @samp{internal} are pretty useless in real-world
12343 usage so the only other commonly used option is @samp{hidden}.
12344 The default if @option{-fvisibility} isn't specified is
12345 @samp{default}, i.e., make every symbol public.
12346
12347 A good explanation of the benefits offered by ensuring ELF
12348 symbols have the correct visibility is given by ``How To Write
12349 Shared Libraries'' by Ulrich Drepper (which can be found at
12350 @w{@uref{http://www.akkadia.org/drepper/}})---however a superior
12351 solution made possible by this option to marking things hidden when
12352 the default is public is to make the default hidden and mark things
12353 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
12354 and @code{__attribute__ ((visibility("default")))} instead of
12355 @code{__declspec(dllexport)} you get almost identical semantics with
12356 identical syntax. This is a great boon to those working with
12357 cross-platform projects.
12358
12359 For those adding visibility support to existing code, you may find
12360 @code{#pragma GCC visibility} of use. This works by you enclosing
12361 the declarations you wish to set visibility for with (for example)
12362 @code{#pragma GCC visibility push(hidden)} and
12363 @code{#pragma GCC visibility pop}.
12364 Bear in mind that symbol visibility should be viewed @strong{as
12365 part of the API interface contract} and thus all new code should
12366 always specify visibility when it is not the default; i.e., declarations
12367 only for use within the local DSO should @strong{always} be marked explicitly
12368 as hidden as so to avoid PLT indirection overheads---making this
12369 abundantly clear also aids readability and self-documentation of the code.
12370 Note that due to ISO C++ specification requirements, @code{operator new} and
12371 @code{operator delete} must always be of default visibility.
12372
12373 Be aware that headers from outside your project, in particular system
12374 headers and headers from any other library you use, may not be
12375 expecting to be compiled with visibility other than the default. You
12376 may need to explicitly say @code{#pragma GCC visibility push(default)}
12377 before including any such headers.
12378
12379 @code{extern} declarations are not affected by @option{-fvisibility}, so
12380 a lot of code can be recompiled with @option{-fvisibility=hidden} with
12381 no modifications. However, this means that calls to @code{extern}
12382 functions with no explicit visibility use the PLT, so it is more
12383 effective to use @code{__attribute ((visibility))} and/or
12384 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
12385 declarations should be treated as hidden.
12386
12387 Note that @option{-fvisibility} does affect C++ vague linkage
12388 entities. This means that, for instance, an exception class that is
12389 be thrown between DSOs must be explicitly marked with default
12390 visibility so that the @samp{type_info} nodes are unified between
12391 the DSOs.
12392
12393 An overview of these techniques, their benefits and how to use them
12394 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
12395
12396 @item -fstrict-volatile-bitfields
12397 @opindex fstrict-volatile-bitfields
12398 This option should be used if accesses to volatile bit-fields (or other
12399 structure fields, although the compiler usually honors those types
12400 anyway) should use a single access of the width of the
12401 field's type, aligned to a natural alignment if possible. For
12402 example, targets with memory-mapped peripheral registers might require
12403 all such accesses to be 16 bits wide; with this flag you can
12404 declare all peripheral bit-fields as @code{unsigned short} (assuming short
12405 is 16 bits on these targets) to force GCC to use 16-bit accesses
12406 instead of, perhaps, a more efficient 32-bit access.
12407
12408 If this option is disabled, the compiler uses the most efficient
12409 instruction. In the previous example, that might be a 32-bit load
12410 instruction, even though that accesses bytes that do not contain
12411 any portion of the bit-field, or memory-mapped registers unrelated to
12412 the one being updated.
12413
12414 In some cases, such as when the @code{packed} attribute is applied to a
12415 structure field, it may not be possible to access the field with a single
12416 read or write that is correctly aligned for the target machine. In this
12417 case GCC falls back to generating multiple accesses rather than code that
12418 will fault or truncate the result at run time.
12419
12420 Note: Due to restrictions of the C/C++11 memory model, write accesses are
12421 not allowed to touch non bit-field members. It is therefore recommended
12422 to define all bits of the field's type as bit-field members.
12423
12424 The default value of this option is determined by the application binary
12425 interface for the target processor.
12426
12427 @item -fsync-libcalls
12428 @opindex fsync-libcalls
12429 This option controls whether any out-of-line instance of the @code{__sync}
12430 family of functions may be used to implement the C++11 @code{__atomic}
12431 family of functions.
12432
12433 The default value of this option is enabled, thus the only useful form
12434 of the option is @option{-fno-sync-libcalls}. This option is used in
12435 the implementation of the @file{libatomic} runtime library.
12436
12437 @end table
12438
12439 @node Developer Options
12440 @section GCC Developer Options
12441 @cindex developer options
12442 @cindex debugging GCC
12443 @cindex debug dump options
12444 @cindex dump options
12445 @cindex compilation statistics
12446
12447 This section describes command-line options that are primarily of
12448 interest to GCC developers, including options to support compiler
12449 testing and investigation of compiler bugs and compile-time
12450 performance problems. This includes options that produce debug dumps
12451 at various points in the compilation; that print statistics such as
12452 memory use and execution time; and that print information about GCC's
12453 configuration, such as where it searches for libraries. You should
12454 rarely need to use any of these options for ordinary compilation and
12455 linking tasks.
12456
12457 @table @gcctabopt
12458
12459 @item -d@var{letters}
12460 @itemx -fdump-rtl-@var{pass}
12461 @itemx -fdump-rtl-@var{pass}=@var{filename}
12462 @opindex d
12463 @opindex fdump-rtl-@var{pass}
12464 Says to make debugging dumps during compilation at times specified by
12465 @var{letters}. This is used for debugging the RTL-based passes of the
12466 compiler. The file names for most of the dumps are made by appending
12467 a pass number and a word to the @var{dumpname}, and the files are
12468 created in the directory of the output file. In case of
12469 @option{=@var{filename}} option, the dump is output on the given file
12470 instead of the pass numbered dump files. Note that the pass number is
12471 assigned as passes are registered into the pass manager. Most passes
12472 are registered in the order that they will execute and for these passes
12473 the number corresponds to the pass execution order. However, passes
12474 registered by plugins, passes specific to compilation targets, or
12475 passes that are otherwise registered after all the other passes are
12476 numbered higher than a pass named "final", even if they are executed
12477 earlier. @var{dumpname} is generated from the name of the output
12478 file if explicitly specified and not an executable, otherwise it is
12479 the basename of the source file. These switches may have different
12480 effects when @option{-E} is used for preprocessing.
12481
12482 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
12483 @option{-d} option @var{letters}. Here are the possible
12484 letters for use in @var{pass} and @var{letters}, and their meanings:
12485
12486 @table @gcctabopt
12487
12488 @item -fdump-rtl-alignments
12489 @opindex fdump-rtl-alignments
12490 Dump after branch alignments have been computed.
12491
12492 @item -fdump-rtl-asmcons
12493 @opindex fdump-rtl-asmcons
12494 Dump after fixing rtl statements that have unsatisfied in/out constraints.
12495
12496 @item -fdump-rtl-auto_inc_dec
12497 @opindex fdump-rtl-auto_inc_dec
12498 Dump after auto-inc-dec discovery. This pass is only run on
12499 architectures that have auto inc or auto dec instructions.
12500
12501 @item -fdump-rtl-barriers
12502 @opindex fdump-rtl-barriers
12503 Dump after cleaning up the barrier instructions.
12504
12505 @item -fdump-rtl-bbpart
12506 @opindex fdump-rtl-bbpart
12507 Dump after partitioning hot and cold basic blocks.
12508
12509 @item -fdump-rtl-bbro
12510 @opindex fdump-rtl-bbro
12511 Dump after block reordering.
12512
12513 @item -fdump-rtl-btl1
12514 @itemx -fdump-rtl-btl2
12515 @opindex fdump-rtl-btl2
12516 @opindex fdump-rtl-btl2
12517 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
12518 after the two branch
12519 target load optimization passes.
12520
12521 @item -fdump-rtl-bypass
12522 @opindex fdump-rtl-bypass
12523 Dump after jump bypassing and control flow optimizations.
12524
12525 @item -fdump-rtl-combine
12526 @opindex fdump-rtl-combine
12527 Dump after the RTL instruction combination pass.
12528
12529 @item -fdump-rtl-compgotos
12530 @opindex fdump-rtl-compgotos
12531 Dump after duplicating the computed gotos.
12532
12533 @item -fdump-rtl-ce1
12534 @itemx -fdump-rtl-ce2
12535 @itemx -fdump-rtl-ce3
12536 @opindex fdump-rtl-ce1
12537 @opindex fdump-rtl-ce2
12538 @opindex fdump-rtl-ce3
12539 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
12540 @option{-fdump-rtl-ce3} enable dumping after the three
12541 if conversion passes.
12542
12543 @item -fdump-rtl-cprop_hardreg
12544 @opindex fdump-rtl-cprop_hardreg
12545 Dump after hard register copy propagation.
12546
12547 @item -fdump-rtl-csa
12548 @opindex fdump-rtl-csa
12549 Dump after combining stack adjustments.
12550
12551 @item -fdump-rtl-cse1
12552 @itemx -fdump-rtl-cse2
12553 @opindex fdump-rtl-cse1
12554 @opindex fdump-rtl-cse2
12555 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
12556 the two common subexpression elimination passes.
12557
12558 @item -fdump-rtl-dce
12559 @opindex fdump-rtl-dce
12560 Dump after the standalone dead code elimination passes.
12561
12562 @item -fdump-rtl-dbr
12563 @opindex fdump-rtl-dbr
12564 Dump after delayed branch scheduling.
12565
12566 @item -fdump-rtl-dce1
12567 @itemx -fdump-rtl-dce2
12568 @opindex fdump-rtl-dce1
12569 @opindex fdump-rtl-dce2
12570 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
12571 the two dead store elimination passes.
12572
12573 @item -fdump-rtl-eh
12574 @opindex fdump-rtl-eh
12575 Dump after finalization of EH handling code.
12576
12577 @item -fdump-rtl-eh_ranges
12578 @opindex fdump-rtl-eh_ranges
12579 Dump after conversion of EH handling range regions.
12580
12581 @item -fdump-rtl-expand
12582 @opindex fdump-rtl-expand
12583 Dump after RTL generation.
12584
12585 @item -fdump-rtl-fwprop1
12586 @itemx -fdump-rtl-fwprop2
12587 @opindex fdump-rtl-fwprop1
12588 @opindex fdump-rtl-fwprop2
12589 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
12590 dumping after the two forward propagation passes.
12591
12592 @item -fdump-rtl-gcse1
12593 @itemx -fdump-rtl-gcse2
12594 @opindex fdump-rtl-gcse1
12595 @opindex fdump-rtl-gcse2
12596 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
12597 after global common subexpression elimination.
12598
12599 @item -fdump-rtl-init-regs
12600 @opindex fdump-rtl-init-regs
12601 Dump after the initialization of the registers.
12602
12603 @item -fdump-rtl-initvals
12604 @opindex fdump-rtl-initvals
12605 Dump after the computation of the initial value sets.
12606
12607 @item -fdump-rtl-into_cfglayout
12608 @opindex fdump-rtl-into_cfglayout
12609 Dump after converting to cfglayout mode.
12610
12611 @item -fdump-rtl-ira
12612 @opindex fdump-rtl-ira
12613 Dump after iterated register allocation.
12614
12615 @item -fdump-rtl-jump
12616 @opindex fdump-rtl-jump
12617 Dump after the second jump optimization.
12618
12619 @item -fdump-rtl-loop2
12620 @opindex fdump-rtl-loop2
12621 @option{-fdump-rtl-loop2} enables dumping after the rtl
12622 loop optimization passes.
12623
12624 @item -fdump-rtl-mach
12625 @opindex fdump-rtl-mach
12626 Dump after performing the machine dependent reorganization pass, if that
12627 pass exists.
12628
12629 @item -fdump-rtl-mode_sw
12630 @opindex fdump-rtl-mode_sw
12631 Dump after removing redundant mode switches.
12632
12633 @item -fdump-rtl-rnreg
12634 @opindex fdump-rtl-rnreg
12635 Dump after register renumbering.
12636
12637 @item -fdump-rtl-outof_cfglayout
12638 @opindex fdump-rtl-outof_cfglayout
12639 Dump after converting from cfglayout mode.
12640
12641 @item -fdump-rtl-peephole2
12642 @opindex fdump-rtl-peephole2
12643 Dump after the peephole pass.
12644
12645 @item -fdump-rtl-postreload
12646 @opindex fdump-rtl-postreload
12647 Dump after post-reload optimizations.
12648
12649 @item -fdump-rtl-pro_and_epilogue
12650 @opindex fdump-rtl-pro_and_epilogue
12651 Dump after generating the function prologues and epilogues.
12652
12653 @item -fdump-rtl-sched1
12654 @itemx -fdump-rtl-sched2
12655 @opindex fdump-rtl-sched1
12656 @opindex fdump-rtl-sched2
12657 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
12658 after the basic block scheduling passes.
12659
12660 @item -fdump-rtl-ree
12661 @opindex fdump-rtl-ree
12662 Dump after sign/zero extension elimination.
12663
12664 @item -fdump-rtl-seqabstr
12665 @opindex fdump-rtl-seqabstr
12666 Dump after common sequence discovery.
12667
12668 @item -fdump-rtl-shorten
12669 @opindex fdump-rtl-shorten
12670 Dump after shortening branches.
12671
12672 @item -fdump-rtl-sibling
12673 @opindex fdump-rtl-sibling
12674 Dump after sibling call optimizations.
12675
12676 @item -fdump-rtl-split1
12677 @itemx -fdump-rtl-split2
12678 @itemx -fdump-rtl-split3
12679 @itemx -fdump-rtl-split4
12680 @itemx -fdump-rtl-split5
12681 @opindex fdump-rtl-split1
12682 @opindex fdump-rtl-split2
12683 @opindex fdump-rtl-split3
12684 @opindex fdump-rtl-split4
12685 @opindex fdump-rtl-split5
12686 These options enable dumping after five rounds of
12687 instruction splitting.
12688
12689 @item -fdump-rtl-sms
12690 @opindex fdump-rtl-sms
12691 Dump after modulo scheduling. This pass is only run on some
12692 architectures.
12693
12694 @item -fdump-rtl-stack
12695 @opindex fdump-rtl-stack
12696 Dump after conversion from GCC's ``flat register file'' registers to the
12697 x87's stack-like registers. This pass is only run on x86 variants.
12698
12699 @item -fdump-rtl-subreg1
12700 @itemx -fdump-rtl-subreg2
12701 @opindex fdump-rtl-subreg1
12702 @opindex fdump-rtl-subreg2
12703 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
12704 the two subreg expansion passes.
12705
12706 @item -fdump-rtl-unshare
12707 @opindex fdump-rtl-unshare
12708 Dump after all rtl has been unshared.
12709
12710 @item -fdump-rtl-vartrack
12711 @opindex fdump-rtl-vartrack
12712 Dump after variable tracking.
12713
12714 @item -fdump-rtl-vregs
12715 @opindex fdump-rtl-vregs
12716 Dump after converting virtual registers to hard registers.
12717
12718 @item -fdump-rtl-web
12719 @opindex fdump-rtl-web
12720 Dump after live range splitting.
12721
12722 @item -fdump-rtl-regclass
12723 @itemx -fdump-rtl-subregs_of_mode_init
12724 @itemx -fdump-rtl-subregs_of_mode_finish
12725 @itemx -fdump-rtl-dfinit
12726 @itemx -fdump-rtl-dfinish
12727 @opindex fdump-rtl-regclass
12728 @opindex fdump-rtl-subregs_of_mode_init
12729 @opindex fdump-rtl-subregs_of_mode_finish
12730 @opindex fdump-rtl-dfinit
12731 @opindex fdump-rtl-dfinish
12732 These dumps are defined but always produce empty files.
12733
12734 @item -da
12735 @itemx -fdump-rtl-all
12736 @opindex da
12737 @opindex fdump-rtl-all
12738 Produce all the dumps listed above.
12739
12740 @item -dA
12741 @opindex dA
12742 Annotate the assembler output with miscellaneous debugging information.
12743
12744 @item -dD
12745 @opindex dD
12746 Dump all macro definitions, at the end of preprocessing, in addition to
12747 normal output.
12748
12749 @item -dH
12750 @opindex dH
12751 Produce a core dump whenever an error occurs.
12752
12753 @item -dp
12754 @opindex dp
12755 Annotate the assembler output with a comment indicating which
12756 pattern and alternative is used. The length of each instruction is
12757 also printed.
12758
12759 @item -dP
12760 @opindex dP
12761 Dump the RTL in the assembler output as a comment before each instruction.
12762 Also turns on @option{-dp} annotation.
12763
12764 @item -dx
12765 @opindex dx
12766 Just generate RTL for a function instead of compiling it. Usually used
12767 with @option{-fdump-rtl-expand}.
12768 @end table
12769
12770 @item -fdump-noaddr
12771 @opindex fdump-noaddr
12772 When doing debugging dumps, suppress address output. This makes it more
12773 feasible to use diff on debugging dumps for compiler invocations with
12774 different compiler binaries and/or different
12775 text / bss / data / heap / stack / dso start locations.
12776
12777 @item -freport-bug
12778 @opindex freport-bug
12779 Collect and dump debug information into a temporary file if an
12780 internal compiler error (ICE) occurs.
12781
12782 @item -fdump-unnumbered
12783 @opindex fdump-unnumbered
12784 When doing debugging dumps, suppress instruction numbers and address output.
12785 This makes it more feasible to use diff on debugging dumps for compiler
12786 invocations with different options, in particular with and without
12787 @option{-g}.
12788
12789 @item -fdump-unnumbered-links
12790 @opindex fdump-unnumbered-links
12791 When doing debugging dumps (see @option{-d} option above), suppress
12792 instruction numbers for the links to the previous and next instructions
12793 in a sequence.
12794
12795 @item -fdump-translation-unit @r{(C++ only)}
12796 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
12797 @opindex fdump-translation-unit
12798 Dump a representation of the tree structure for the entire translation
12799 unit to a file. The file name is made by appending @file{.tu} to the
12800 source file name, and the file is created in the same directory as the
12801 output file. If the @samp{-@var{options}} form is used, @var{options}
12802 controls the details of the dump as described for the
12803 @option{-fdump-tree} options.
12804
12805 @item -fdump-class-hierarchy @r{(C++ only)}
12806 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
12807 @opindex fdump-class-hierarchy
12808 Dump a representation of each class's hierarchy and virtual function
12809 table layout to a file. The file name is made by appending
12810 @file{.class} to the source file name, and the file is created in the
12811 same directory as the output file. If the @samp{-@var{options}} form
12812 is used, @var{options} controls the details of the dump as described
12813 for the @option{-fdump-tree} options.
12814
12815 @item -fdump-ipa-@var{switch}
12816 @opindex fdump-ipa
12817 Control the dumping at various stages of inter-procedural analysis
12818 language tree to a file. The file name is generated by appending a
12819 switch specific suffix to the source file name, and the file is created
12820 in the same directory as the output file. The following dumps are
12821 possible:
12822
12823 @table @samp
12824 @item all
12825 Enables all inter-procedural analysis dumps.
12826
12827 @item cgraph
12828 Dumps information about call-graph optimization, unused function removal,
12829 and inlining decisions.
12830
12831 @item inline
12832 Dump after function inlining.
12833
12834 @end table
12835
12836 @item -fdump-passes
12837 @opindex fdump-passes
12838 Dump the list of optimization passes that are turned on and off by
12839 the current command-line options.
12840
12841 @item -fdump-statistics-@var{option}
12842 @opindex fdump-statistics
12843 Enable and control dumping of pass statistics in a separate file. The
12844 file name is generated by appending a suffix ending in
12845 @samp{.statistics} to the source file name, and the file is created in
12846 the same directory as the output file. If the @samp{-@var{option}}
12847 form is used, @samp{-stats} causes counters to be summed over the
12848 whole compilation unit while @samp{-details} dumps every event as
12849 the passes generate them. The default with no option is to sum
12850 counters for each function compiled.
12851
12852 @item -fdump-tree-@var{switch}
12853 @itemx -fdump-tree-@var{switch}-@var{options}
12854 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
12855 @opindex fdump-tree
12856 Control the dumping at various stages of processing the intermediate
12857 language tree to a file. The file name is generated by appending a
12858 switch-specific suffix to the source file name, and the file is
12859 created in the same directory as the output file. In case of
12860 @option{=@var{filename}} option, the dump is output on the given file
12861 instead of the auto named dump files. If the @samp{-@var{options}}
12862 form is used, @var{options} is a list of @samp{-} separated options
12863 which control the details of the dump. Not all options are applicable
12864 to all dumps; those that are not meaningful are ignored. The
12865 following options are available
12866
12867 @table @samp
12868 @item address
12869 Print the address of each node. Usually this is not meaningful as it
12870 changes according to the environment and source file. Its primary use
12871 is for tying up a dump file with a debug environment.
12872 @item asmname
12873 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
12874 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
12875 use working backward from mangled names in the assembly file.
12876 @item slim
12877 When dumping front-end intermediate representations, inhibit dumping
12878 of members of a scope or body of a function merely because that scope
12879 has been reached. Only dump such items when they are directly reachable
12880 by some other path.
12881
12882 When dumping pretty-printed trees, this option inhibits dumping the
12883 bodies of control structures.
12884
12885 When dumping RTL, print the RTL in slim (condensed) form instead of
12886 the default LISP-like representation.
12887 @item raw
12888 Print a raw representation of the tree. By default, trees are
12889 pretty-printed into a C-like representation.
12890 @item details
12891 Enable more detailed dumps (not honored by every dump option). Also
12892 include information from the optimization passes.
12893 @item stats
12894 Enable dumping various statistics about the pass (not honored by every dump
12895 option).
12896 @item blocks
12897 Enable showing basic block boundaries (disabled in raw dumps).
12898 @item graph
12899 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
12900 dump a representation of the control flow graph suitable for viewing with
12901 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
12902 the file is pretty-printed as a subgraph, so that GraphViz can render them
12903 all in a single plot.
12904
12905 This option currently only works for RTL dumps, and the RTL is always
12906 dumped in slim form.
12907 @item vops
12908 Enable showing virtual operands for every statement.
12909 @item lineno
12910 Enable showing line numbers for statements.
12911 @item uid
12912 Enable showing the unique ID (@code{DECL_UID}) for each variable.
12913 @item verbose
12914 Enable showing the tree dump for each statement.
12915 @item eh
12916 Enable showing the EH region number holding each statement.
12917 @item scev
12918 Enable showing scalar evolution analysis details.
12919 @item optimized
12920 Enable showing optimization information (only available in certain
12921 passes).
12922 @item missed
12923 Enable showing missed optimization information (only available in certain
12924 passes).
12925 @item note
12926 Enable other detailed optimization information (only available in
12927 certain passes).
12928 @item =@var{filename}
12929 Instead of an auto named dump file, output into the given file
12930 name. The file names @file{stdout} and @file{stderr} are treated
12931 specially and are considered already open standard streams. For
12932 example,
12933
12934 @smallexample
12935 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
12936 -fdump-tree-pre=stderr file.c
12937 @end smallexample
12938
12939 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
12940 output on to @file{stderr}. If two conflicting dump filenames are
12941 given for the same pass, then the latter option overrides the earlier
12942 one.
12943
12944 @item split-paths
12945 @opindex fdump-tree-split-paths
12946 Dump each function after splitting paths to loop backedges. The file
12947 name is made by appending @file{.split-paths} to the source file name.
12948
12949 @item all
12950 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
12951 and @option{lineno}.
12952
12953 @item optall
12954 Turn on all optimization options, i.e., @option{optimized},
12955 @option{missed}, and @option{note}.
12956 @end table
12957
12958 The following tree dumps are possible:
12959 @table @samp
12960
12961 @item original
12962 @opindex fdump-tree-original
12963 Dump before any tree based optimization, to @file{@var{file}.original}.
12964
12965 @item optimized
12966 @opindex fdump-tree-optimized
12967 Dump after all tree based optimization, to @file{@var{file}.optimized}.
12968
12969 @item gimple
12970 @opindex fdump-tree-gimple
12971 Dump each function before and after the gimplification pass to a file. The
12972 file name is made by appending @file{.gimple} to the source file name.
12973
12974 @item cfg
12975 @opindex fdump-tree-cfg
12976 Dump the control flow graph of each function to a file. The file name is
12977 made by appending @file{.cfg} to the source file name.
12978
12979 @item ch
12980 @opindex fdump-tree-ch
12981 Dump each function after copying loop headers. The file name is made by
12982 appending @file{.ch} to the source file name.
12983
12984 @item ssa
12985 @opindex fdump-tree-ssa
12986 Dump SSA related information to a file. The file name is made by appending
12987 @file{.ssa} to the source file name.
12988
12989 @item alias
12990 @opindex fdump-tree-alias
12991 Dump aliasing information for each function. The file name is made by
12992 appending @file{.alias} to the source file name.
12993
12994 @item ccp
12995 @opindex fdump-tree-ccp
12996 Dump each function after CCP@. The file name is made by appending
12997 @file{.ccp} to the source file name.
12998
12999 @item storeccp
13000 @opindex fdump-tree-storeccp
13001 Dump each function after STORE-CCP@. The file name is made by appending
13002 @file{.storeccp} to the source file name.
13003
13004 @item pre
13005 @opindex fdump-tree-pre
13006 Dump trees after partial redundancy elimination and/or code hoisting.
13007 The file name is made by appending @file{.pre} to the source file name.
13008
13009 @item fre
13010 @opindex fdump-tree-fre
13011 Dump trees after full redundancy elimination. The file name is made
13012 by appending @file{.fre} to the source file name.
13013
13014 @item copyprop
13015 @opindex fdump-tree-copyprop
13016 Dump trees after copy propagation. The file name is made
13017 by appending @file{.copyprop} to the source file name.
13018
13019 @item store_copyprop
13020 @opindex fdump-tree-store_copyprop
13021 Dump trees after store copy-propagation. The file name is made
13022 by appending @file{.store_copyprop} to the source file name.
13023
13024 @item dce
13025 @opindex fdump-tree-dce
13026 Dump each function after dead code elimination. The file name is made by
13027 appending @file{.dce} to the source file name.
13028
13029 @item sra
13030 @opindex fdump-tree-sra
13031 Dump each function after performing scalar replacement of aggregates. The
13032 file name is made by appending @file{.sra} to the source file name.
13033
13034 @item sink
13035 @opindex fdump-tree-sink
13036 Dump each function after performing code sinking. The file name is made
13037 by appending @file{.sink} to the source file name.
13038
13039 @item dom
13040 @opindex fdump-tree-dom
13041 Dump each function after applying dominator tree optimizations. The file
13042 name is made by appending @file{.dom} to the source file name.
13043
13044 @item dse
13045 @opindex fdump-tree-dse
13046 Dump each function after applying dead store elimination. The file
13047 name is made by appending @file{.dse} to the source file name.
13048
13049 @item phiopt
13050 @opindex fdump-tree-phiopt
13051 Dump each function after optimizing PHI nodes into straightline code. The file
13052 name is made by appending @file{.phiopt} to the source file name.
13053
13054 @item backprop
13055 @opindex fdump-tree-backprop
13056 Dump each function after back-propagating use information up the definition
13057 chain. The file name is made by appending @file{.backprop} to the
13058 source file name.
13059
13060 @item forwprop
13061 @opindex fdump-tree-forwprop
13062 Dump each function after forward propagating single use variables. The file
13063 name is made by appending @file{.forwprop} to the source file name.
13064
13065 @item nrv
13066 @opindex fdump-tree-nrv
13067 Dump each function after applying the named return value optimization on
13068 generic trees. The file name is made by appending @file{.nrv} to the source
13069 file name.
13070
13071 @item vect
13072 @opindex fdump-tree-vect
13073 Dump each function after applying vectorization of loops. The file name is
13074 made by appending @file{.vect} to the source file name.
13075
13076 @item slp
13077 @opindex fdump-tree-slp
13078 Dump each function after applying vectorization of basic blocks. The file name
13079 is made by appending @file{.slp} to the source file name.
13080
13081 @item vrp
13082 @opindex fdump-tree-vrp
13083 Dump each function after Value Range Propagation (VRP). The file name
13084 is made by appending @file{.vrp} to the source file name.
13085
13086 @item early vrp
13087 @opindex fdump-tree-evrp
13088 Dump each function after Early Value Range Propagation (EVRP). The file name
13089 is made by appending @file{.evrp} to the source file name.
13090
13091 @item oaccdevlow
13092 @opindex fdump-tree-oaccdevlow
13093 Dump each function after applying device-specific OpenACC transformations.
13094 The file name is made by appending @file{.oaccdevlow} to the source file name.
13095
13096 @item all
13097 @opindex fdump-tree-all
13098 Enable all the available tree dumps with the flags provided in this option.
13099 @end table
13100
13101 @item -fopt-info
13102 @itemx -fopt-info-@var{options}
13103 @itemx -fopt-info-@var{options}=@var{filename}
13104 @opindex fopt-info
13105 Controls optimization dumps from various optimization passes. If the
13106 @samp{-@var{options}} form is used, @var{options} is a list of
13107 @samp{-} separated option keywords to select the dump details and
13108 optimizations.
13109
13110 The @var{options} can be divided into two groups: options describing the
13111 verbosity of the dump, and options describing which optimizations
13112 should be included. The options from both the groups can be freely
13113 mixed as they are non-overlapping. However, in case of any conflicts,
13114 the later options override the earlier options on the command
13115 line.
13116
13117 The following options control the dump verbosity:
13118
13119 @table @samp
13120 @item optimized
13121 Print information when an optimization is successfully applied. It is
13122 up to a pass to decide which information is relevant. For example, the
13123 vectorizer passes print the source location of loops which are
13124 successfully vectorized.
13125 @item missed
13126 Print information about missed optimizations. Individual passes
13127 control which information to include in the output.
13128 @item note
13129 Print verbose information about optimizations, such as certain
13130 transformations, more detailed messages about decisions etc.
13131 @item all
13132 Print detailed optimization information. This includes
13133 @samp{optimized}, @samp{missed}, and @samp{note}.
13134 @end table
13135
13136 One or more of the following option keywords can be used to describe a
13137 group of optimizations:
13138
13139 @table @samp
13140 @item ipa
13141 Enable dumps from all interprocedural optimizations.
13142 @item loop
13143 Enable dumps from all loop optimizations.
13144 @item inline
13145 Enable dumps from all inlining optimizations.
13146 @item vec
13147 Enable dumps from all vectorization optimizations.
13148 @item optall
13149 Enable dumps from all optimizations. This is a superset of
13150 the optimization groups listed above.
13151 @end table
13152
13153 If @var{options} is
13154 omitted, it defaults to @samp{optimized-optall}, which means to dump all
13155 info about successful optimizations from all the passes.
13156
13157 If the @var{filename} is provided, then the dumps from all the
13158 applicable optimizations are concatenated into the @var{filename}.
13159 Otherwise the dump is output onto @file{stderr}. Though multiple
13160 @option{-fopt-info} options are accepted, only one of them can include
13161 a @var{filename}. If other filenames are provided then all but the
13162 first such option are ignored.
13163
13164 Note that the output @var{filename} is overwritten
13165 in case of multiple translation units. If a combined output from
13166 multiple translation units is desired, @file{stderr} should be used
13167 instead.
13168
13169 In the following example, the optimization info is output to
13170 @file{stderr}:
13171
13172 @smallexample
13173 gcc -O3 -fopt-info
13174 @end smallexample
13175
13176 This example:
13177 @smallexample
13178 gcc -O3 -fopt-info-missed=missed.all
13179 @end smallexample
13180
13181 @noindent
13182 outputs missed optimization report from all the passes into
13183 @file{missed.all}, and this one:
13184
13185 @smallexample
13186 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
13187 @end smallexample
13188
13189 @noindent
13190 prints information about missed optimization opportunities from
13191 vectorization passes on @file{stderr}.
13192 Note that @option{-fopt-info-vec-missed} is equivalent to
13193 @option{-fopt-info-missed-vec}.
13194
13195 As another example,
13196 @smallexample
13197 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
13198 @end smallexample
13199
13200 @noindent
13201 outputs information about missed optimizations as well as
13202 optimized locations from all the inlining passes into
13203 @file{inline.txt}.
13204
13205 Finally, consider:
13206
13207 @smallexample
13208 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
13209 @end smallexample
13210
13211 @noindent
13212 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
13213 in conflict since only one output file is allowed. In this case, only
13214 the first option takes effect and the subsequent options are
13215 ignored. Thus only @file{vec.miss} is produced which contains
13216 dumps from the vectorizer about missed opportunities.
13217
13218 @item -fsched-verbose=@var{n}
13219 @opindex fsched-verbose
13220 On targets that use instruction scheduling, this option controls the
13221 amount of debugging output the scheduler prints to the dump files.
13222
13223 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
13224 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
13225 For @var{n} greater than one, it also output basic block probabilities,
13226 detailed ready list information and unit/insn info. For @var{n} greater
13227 than two, it includes RTL at abort point, control-flow and regions info.
13228 And for @var{n} over four, @option{-fsched-verbose} also includes
13229 dependence info.
13230
13231
13232
13233 @item -fenable-@var{kind}-@var{pass}
13234 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
13235 @opindex fdisable-
13236 @opindex fenable-
13237
13238 This is a set of options that are used to explicitly disable/enable
13239 optimization passes. These options are intended for use for debugging GCC.
13240 Compiler users should use regular options for enabling/disabling
13241 passes instead.
13242
13243 @table @gcctabopt
13244
13245 @item -fdisable-ipa-@var{pass}
13246 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13247 statically invoked in the compiler multiple times, the pass name should be
13248 appended with a sequential number starting from 1.
13249
13250 @item -fdisable-rtl-@var{pass}
13251 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
13252 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
13253 statically invoked in the compiler multiple times, the pass name should be
13254 appended with a sequential number starting from 1. @var{range-list} is a
13255 comma-separated list of function ranges or assembler names. Each range is a number
13256 pair separated by a colon. The range is inclusive in both ends. If the range
13257 is trivial, the number pair can be simplified as a single number. If the
13258 function's call graph node's @var{uid} falls within one of the specified ranges,
13259 the @var{pass} is disabled for that function. The @var{uid} is shown in the
13260 function header of a dump file, and the pass names can be dumped by using
13261 option @option{-fdump-passes}.
13262
13263 @item -fdisable-tree-@var{pass}
13264 @itemx -fdisable-tree-@var{pass}=@var{range-list}
13265 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
13266 option arguments.
13267
13268 @item -fenable-ipa-@var{pass}
13269 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13270 statically invoked in the compiler multiple times, the pass name should be
13271 appended with a sequential number starting from 1.
13272
13273 @item -fenable-rtl-@var{pass}
13274 @itemx -fenable-rtl-@var{pass}=@var{range-list}
13275 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
13276 description and examples.
13277
13278 @item -fenable-tree-@var{pass}
13279 @itemx -fenable-tree-@var{pass}=@var{range-list}
13280 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
13281 of option arguments.
13282
13283 @end table
13284
13285 Here are some examples showing uses of these options.
13286
13287 @smallexample
13288
13289 # disable ccp1 for all functions
13290 -fdisable-tree-ccp1
13291 # disable complete unroll for function whose cgraph node uid is 1
13292 -fenable-tree-cunroll=1
13293 # disable gcse2 for functions at the following ranges [1,1],
13294 # [300,400], and [400,1000]
13295 # disable gcse2 for functions foo and foo2
13296 -fdisable-rtl-gcse2=foo,foo2
13297 # disable early inlining
13298 -fdisable-tree-einline
13299 # disable ipa inlining
13300 -fdisable-ipa-inline
13301 # enable tree full unroll
13302 -fenable-tree-unroll
13303
13304 @end smallexample
13305
13306 @item -fchecking
13307 @itemx -fchecking=@var{n}
13308 @opindex fchecking
13309 @opindex fno-checking
13310 Enable internal consistency checking. The default depends on
13311 the compiler configuration. @option{-fchecking=2} enables further
13312 internal consistency checking that might affect code generation.
13313
13314 @item -frandom-seed=@var{string}
13315 @opindex frandom-seed
13316 This option provides a seed that GCC uses in place of
13317 random numbers in generating certain symbol names
13318 that have to be different in every compiled file. It is also used to
13319 place unique stamps in coverage data files and the object files that
13320 produce them. You can use the @option{-frandom-seed} option to produce
13321 reproducibly identical object files.
13322
13323 The @var{string} can either be a number (decimal, octal or hex) or an
13324 arbitrary string (in which case it's converted to a number by
13325 computing CRC32).
13326
13327 The @var{string} should be different for every file you compile.
13328
13329 @item -save-temps
13330 @itemx -save-temps=cwd
13331 @opindex save-temps
13332 Store the usual ``temporary'' intermediate files permanently; place them
13333 in the current directory and name them based on the source file. Thus,
13334 compiling @file{foo.c} with @option{-c -save-temps} produces files
13335 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
13336 preprocessed @file{foo.i} output file even though the compiler now
13337 normally uses an integrated preprocessor.
13338
13339 When used in combination with the @option{-x} command-line option,
13340 @option{-save-temps} is sensible enough to avoid over writing an
13341 input source file with the same extension as an intermediate file.
13342 The corresponding intermediate file may be obtained by renaming the
13343 source file before using @option{-save-temps}.
13344
13345 If you invoke GCC in parallel, compiling several different source
13346 files that share a common base name in different subdirectories or the
13347 same source file compiled for multiple output destinations, it is
13348 likely that the different parallel compilers will interfere with each
13349 other, and overwrite the temporary files. For instance:
13350
13351 @smallexample
13352 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
13353 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
13354 @end smallexample
13355
13356 may result in @file{foo.i} and @file{foo.o} being written to
13357 simultaneously by both compilers.
13358
13359 @item -save-temps=obj
13360 @opindex save-temps=obj
13361 Store the usual ``temporary'' intermediate files permanently. If the
13362 @option{-o} option is used, the temporary files are based on the
13363 object file. If the @option{-o} option is not used, the
13364 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
13365
13366 For example:
13367
13368 @smallexample
13369 gcc -save-temps=obj -c foo.c
13370 gcc -save-temps=obj -c bar.c -o dir/xbar.o
13371 gcc -save-temps=obj foobar.c -o dir2/yfoobar
13372 @end smallexample
13373
13374 @noindent
13375 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
13376 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
13377 @file{dir2/yfoobar.o}.
13378
13379 @item -time@r{[}=@var{file}@r{]}
13380 @opindex time
13381 Report the CPU time taken by each subprocess in the compilation
13382 sequence. For C source files, this is the compiler proper and assembler
13383 (plus the linker if linking is done).
13384
13385 Without the specification of an output file, the output looks like this:
13386
13387 @smallexample
13388 # cc1 0.12 0.01
13389 # as 0.00 0.01
13390 @end smallexample
13391
13392 The first number on each line is the ``user time'', that is time spent
13393 executing the program itself. The second number is ``system time'',
13394 time spent executing operating system routines on behalf of the program.
13395 Both numbers are in seconds.
13396
13397 With the specification of an output file, the output is appended to the
13398 named file, and it looks like this:
13399
13400 @smallexample
13401 0.12 0.01 cc1 @var{options}
13402 0.00 0.01 as @var{options}
13403 @end smallexample
13404
13405 The ``user time'' and the ``system time'' are moved before the program
13406 name, and the options passed to the program are displayed, so that one
13407 can later tell what file was being compiled, and with which options.
13408
13409 @item -fdump-final-insns@r{[}=@var{file}@r{]}
13410 @opindex fdump-final-insns
13411 Dump the final internal representation (RTL) to @var{file}. If the
13412 optional argument is omitted (or if @var{file} is @code{.}), the name
13413 of the dump file is determined by appending @code{.gkd} to the
13414 compilation output file name.
13415
13416 @item -fcompare-debug@r{[}=@var{opts}@r{]}
13417 @opindex fcompare-debug
13418 @opindex fno-compare-debug
13419 If no error occurs during compilation, run the compiler a second time,
13420 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
13421 passed to the second compilation. Dump the final internal
13422 representation in both compilations, and print an error if they differ.
13423
13424 If the equal sign is omitted, the default @option{-gtoggle} is used.
13425
13426 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
13427 and nonzero, implicitly enables @option{-fcompare-debug}. If
13428 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
13429 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
13430 is used.
13431
13432 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
13433 is equivalent to @option{-fno-compare-debug}, which disables the dumping
13434 of the final representation and the second compilation, preventing even
13435 @env{GCC_COMPARE_DEBUG} from taking effect.
13436
13437 To verify full coverage during @option{-fcompare-debug} testing, set
13438 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
13439 which GCC rejects as an invalid option in any actual compilation
13440 (rather than preprocessing, assembly or linking). To get just a
13441 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
13442 not overridden} will do.
13443
13444 @item -fcompare-debug-second
13445 @opindex fcompare-debug-second
13446 This option is implicitly passed to the compiler for the second
13447 compilation requested by @option{-fcompare-debug}, along with options to
13448 silence warnings, and omitting other options that would cause
13449 side-effect compiler outputs to files or to the standard output. Dump
13450 files and preserved temporary files are renamed so as to contain the
13451 @code{.gk} additional extension during the second compilation, to avoid
13452 overwriting those generated by the first.
13453
13454 When this option is passed to the compiler driver, it causes the
13455 @emph{first} compilation to be skipped, which makes it useful for little
13456 other than debugging the compiler proper.
13457
13458 @item -gtoggle
13459 @opindex gtoggle
13460 Turn off generation of debug info, if leaving out this option
13461 generates it, or turn it on at level 2 otherwise. The position of this
13462 argument in the command line does not matter; it takes effect after all
13463 other options are processed, and it does so only once, no matter how
13464 many times it is given. This is mainly intended to be used with
13465 @option{-fcompare-debug}.
13466
13467 @item -fvar-tracking-assignments-toggle
13468 @opindex fvar-tracking-assignments-toggle
13469 @opindex fno-var-tracking-assignments-toggle
13470 Toggle @option{-fvar-tracking-assignments}, in the same way that
13471 @option{-gtoggle} toggles @option{-g}.
13472
13473 @item -Q
13474 @opindex Q
13475 Makes the compiler print out each function name as it is compiled, and
13476 print some statistics about each pass when it finishes.
13477
13478 @item -ftime-report
13479 @opindex ftime-report
13480 Makes the compiler print some statistics about the time consumed by each
13481 pass when it finishes.
13482
13483 @item -ftime-report-details
13484 @opindex ftime-report-details
13485 Record the time consumed by infrastructure parts separately for each pass.
13486
13487 @item -fira-verbose=@var{n}
13488 @opindex fira-verbose
13489 Control the verbosity of the dump file for the integrated register allocator.
13490 The default value is 5. If the value @var{n} is greater or equal to 10,
13491 the dump output is sent to stderr using the same format as @var{n} minus 10.
13492
13493 @item -flto-report
13494 @opindex flto-report
13495 Prints a report with internal details on the workings of the link-time
13496 optimizer. The contents of this report vary from version to version.
13497 It is meant to be useful to GCC developers when processing object
13498 files in LTO mode (via @option{-flto}).
13499
13500 Disabled by default.
13501
13502 @item -flto-report-wpa
13503 @opindex flto-report-wpa
13504 Like @option{-flto-report}, but only print for the WPA phase of Link
13505 Time Optimization.
13506
13507 @item -fmem-report
13508 @opindex fmem-report
13509 Makes the compiler print some statistics about permanent memory
13510 allocation when it finishes.
13511
13512 @item -fmem-report-wpa
13513 @opindex fmem-report-wpa
13514 Makes the compiler print some statistics about permanent memory
13515 allocation for the WPA phase only.
13516
13517 @item -fpre-ipa-mem-report
13518 @opindex fpre-ipa-mem-report
13519 @item -fpost-ipa-mem-report
13520 @opindex fpost-ipa-mem-report
13521 Makes the compiler print some statistics about permanent memory
13522 allocation before or after interprocedural optimization.
13523
13524 @item -fprofile-report
13525 @opindex fprofile-report
13526 Makes the compiler print some statistics about consistency of the
13527 (estimated) profile and effect of individual passes.
13528
13529 @item -fstack-usage
13530 @opindex fstack-usage
13531 Makes the compiler output stack usage information for the program, on a
13532 per-function basis. The filename for the dump is made by appending
13533 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
13534 the output file, if explicitly specified and it is not an executable,
13535 otherwise it is the basename of the source file. An entry is made up
13536 of three fields:
13537
13538 @itemize
13539 @item
13540 The name of the function.
13541 @item
13542 A number of bytes.
13543 @item
13544 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
13545 @end itemize
13546
13547 The qualifier @code{static} means that the function manipulates the stack
13548 statically: a fixed number of bytes are allocated for the frame on function
13549 entry and released on function exit; no stack adjustments are otherwise made
13550 in the function. The second field is this fixed number of bytes.
13551
13552 The qualifier @code{dynamic} means that the function manipulates the stack
13553 dynamically: in addition to the static allocation described above, stack
13554 adjustments are made in the body of the function, for example to push/pop
13555 arguments around function calls. If the qualifier @code{bounded} is also
13556 present, the amount of these adjustments is bounded at compile time and
13557 the second field is an upper bound of the total amount of stack used by
13558 the function. If it is not present, the amount of these adjustments is
13559 not bounded at compile time and the second field only represents the
13560 bounded part.
13561
13562 @item -fstats
13563 @opindex fstats
13564 Emit statistics about front-end processing at the end of the compilation.
13565 This option is supported only by the C++ front end, and
13566 the information is generally only useful to the G++ development team.
13567
13568 @item -fdbg-cnt-list
13569 @opindex fdbg-cnt-list
13570 Print the name and the counter upper bound for all debug counters.
13571
13572
13573 @item -fdbg-cnt=@var{counter-value-list}
13574 @opindex fdbg-cnt
13575 Set the internal debug counter upper bound. @var{counter-value-list}
13576 is a comma-separated list of @var{name}:@var{value} pairs
13577 which sets the upper bound of each debug counter @var{name} to @var{value}.
13578 All debug counters have the initial upper bound of @code{UINT_MAX};
13579 thus @code{dbg_cnt} returns true always unless the upper bound
13580 is set by this option.
13581 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
13582 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
13583
13584 @item -print-file-name=@var{library}
13585 @opindex print-file-name
13586 Print the full absolute name of the library file @var{library} that
13587 would be used when linking---and don't do anything else. With this
13588 option, GCC does not compile or link anything; it just prints the
13589 file name.
13590
13591 @item -print-multi-directory
13592 @opindex print-multi-directory
13593 Print the directory name corresponding to the multilib selected by any
13594 other switches present in the command line. This directory is supposed
13595 to exist in @env{GCC_EXEC_PREFIX}.
13596
13597 @item -print-multi-lib
13598 @opindex print-multi-lib
13599 Print the mapping from multilib directory names to compiler switches
13600 that enable them. The directory name is separated from the switches by
13601 @samp{;}, and each switch starts with an @samp{@@} instead of the
13602 @samp{-}, without spaces between multiple switches. This is supposed to
13603 ease shell processing.
13604
13605 @item -print-multi-os-directory
13606 @opindex print-multi-os-directory
13607 Print the path to OS libraries for the selected
13608 multilib, relative to some @file{lib} subdirectory. If OS libraries are
13609 present in the @file{lib} subdirectory and no multilibs are used, this is
13610 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
13611 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
13612 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
13613 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
13614
13615 @item -print-multiarch
13616 @opindex print-multiarch
13617 Print the path to OS libraries for the selected multiarch,
13618 relative to some @file{lib} subdirectory.
13619
13620 @item -print-prog-name=@var{program}
13621 @opindex print-prog-name
13622 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
13623
13624 @item -print-libgcc-file-name
13625 @opindex print-libgcc-file-name
13626 Same as @option{-print-file-name=libgcc.a}.
13627
13628 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
13629 but you do want to link with @file{libgcc.a}. You can do:
13630
13631 @smallexample
13632 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
13633 @end smallexample
13634
13635 @item -print-search-dirs
13636 @opindex print-search-dirs
13637 Print the name of the configured installation directory and a list of
13638 program and library directories @command{gcc} searches---and don't do anything else.
13639
13640 This is useful when @command{gcc} prints the error message
13641 @samp{installation problem, cannot exec cpp0: No such file or directory}.
13642 To resolve this you either need to put @file{cpp0} and the other compiler
13643 components where @command{gcc} expects to find them, or you can set the environment
13644 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
13645 Don't forget the trailing @samp{/}.
13646 @xref{Environment Variables}.
13647
13648 @item -print-sysroot
13649 @opindex print-sysroot
13650 Print the target sysroot directory that is used during
13651 compilation. This is the target sysroot specified either at configure
13652 time or using the @option{--sysroot} option, possibly with an extra
13653 suffix that depends on compilation options. If no target sysroot is
13654 specified, the option prints nothing.
13655
13656 @item -print-sysroot-headers-suffix
13657 @opindex print-sysroot-headers-suffix
13658 Print the suffix added to the target sysroot when searching for
13659 headers, or give an error if the compiler is not configured with such
13660 a suffix---and don't do anything else.
13661
13662 @item -dumpmachine
13663 @opindex dumpmachine
13664 Print the compiler's target machine (for example,
13665 @samp{i686-pc-linux-gnu})---and don't do anything else.
13666
13667 @item -dumpversion
13668 @opindex dumpversion
13669 Print the compiler version (for example, @code{3.0})---and don't do
13670 anything else.
13671
13672 @item -dumpspecs
13673 @opindex dumpspecs
13674 Print the compiler's built-in specs---and don't do anything else. (This
13675 is used when GCC itself is being built.) @xref{Spec Files}.
13676 @end table
13677
13678 @node Submodel Options
13679 @section Machine-Dependent Options
13680 @cindex submodel options
13681 @cindex specifying hardware config
13682 @cindex hardware models and configurations, specifying
13683 @cindex target-dependent options
13684 @cindex machine-dependent options
13685
13686 Each target machine supported by GCC can have its own options---for
13687 example, to allow you to compile for a particular processor variant or
13688 ABI, or to control optimizations specific to that machine. By
13689 convention, the names of machine-specific options start with
13690 @samp{-m}.
13691
13692 Some configurations of the compiler also support additional target-specific
13693 options, usually for compatibility with other compilers on the same
13694 platform.
13695
13696 @c This list is ordered alphanumerically by subsection name.
13697 @c It should be the same order and spelling as these options are listed
13698 @c in Machine Dependent Options
13699
13700 @menu
13701 * AArch64 Options::
13702 * Adapteva Epiphany Options::
13703 * ARC Options::
13704 * ARM Options::
13705 * AVR Options::
13706 * Blackfin Options::
13707 * C6X Options::
13708 * CRIS Options::
13709 * CR16 Options::
13710 * Darwin Options::
13711 * DEC Alpha Options::
13712 * FR30 Options::
13713 * FT32 Options::
13714 * FRV Options::
13715 * GNU/Linux Options::
13716 * H8/300 Options::
13717 * HPPA Options::
13718 * IA-64 Options::
13719 * LM32 Options::
13720 * M32C Options::
13721 * M32R/D Options::
13722 * M680x0 Options::
13723 * MCore Options::
13724 * MeP Options::
13725 * MicroBlaze Options::
13726 * MIPS Options::
13727 * MMIX Options::
13728 * MN10300 Options::
13729 * Moxie Options::
13730 * MSP430 Options::
13731 * NDS32 Options::
13732 * Nios II Options::
13733 * Nvidia PTX Options::
13734 * PDP-11 Options::
13735 * picoChip Options::
13736 * PowerPC Options::
13737 * RL78 Options::
13738 * RS/6000 and PowerPC Options::
13739 * RX Options::
13740 * S/390 and zSeries Options::
13741 * Score Options::
13742 * SH Options::
13743 * Solaris 2 Options::
13744 * SPARC Options::
13745 * SPU Options::
13746 * System V Options::
13747 * TILE-Gx Options::
13748 * TILEPro Options::
13749 * V850 Options::
13750 * VAX Options::
13751 * Visium Options::
13752 * VMS Options::
13753 * VxWorks Options::
13754 * x86 Options::
13755 * x86 Windows Options::
13756 * Xstormy16 Options::
13757 * Xtensa Options::
13758 * zSeries Options::
13759 @end menu
13760
13761 @node AArch64 Options
13762 @subsection AArch64 Options
13763 @cindex AArch64 Options
13764
13765 These options are defined for AArch64 implementations:
13766
13767 @table @gcctabopt
13768
13769 @item -mabi=@var{name}
13770 @opindex mabi
13771 Generate code for the specified data model. Permissible values
13772 are @samp{ilp32} for SysV-like data model where int, long int and pointers
13773 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
13774 but long int and pointers are 64 bits.
13775
13776 The default depends on the specific target configuration. Note that
13777 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
13778 entire program with the same ABI, and link with a compatible set of libraries.
13779
13780 @item -mbig-endian
13781 @opindex mbig-endian
13782 Generate big-endian code. This is the default when GCC is configured for an
13783 @samp{aarch64_be-*-*} target.
13784
13785 @item -mgeneral-regs-only
13786 @opindex mgeneral-regs-only
13787 Generate code which uses only the general-purpose registers. This will prevent
13788 the compiler from using floating-point and Advanced SIMD registers but will not
13789 impose any restrictions on the assembler.
13790
13791 @item -mlittle-endian
13792 @opindex mlittle-endian
13793 Generate little-endian code. This is the default when GCC is configured for an
13794 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
13795
13796 @item -mcmodel=tiny
13797 @opindex mcmodel=tiny
13798 Generate code for the tiny code model. The program and its statically defined
13799 symbols must be within 1MB of each other. Programs can be statically or
13800 dynamically linked.
13801
13802 @item -mcmodel=small
13803 @opindex mcmodel=small
13804 Generate code for the small code model. The program and its statically defined
13805 symbols must be within 4GB of each other. Programs can be statically or
13806 dynamically linked. This is the default code model.
13807
13808 @item -mcmodel=large
13809 @opindex mcmodel=large
13810 Generate code for the large code model. This makes no assumptions about
13811 addresses and sizes of sections. Programs can be statically linked only.
13812
13813 @item -mstrict-align
13814 @opindex mstrict-align
13815 Avoid generating memory accesses that may not be aligned on a natural object
13816 boundary as described in the architecture specification.
13817
13818 @item -momit-leaf-frame-pointer
13819 @itemx -mno-omit-leaf-frame-pointer
13820 @opindex momit-leaf-frame-pointer
13821 @opindex mno-omit-leaf-frame-pointer
13822 Omit or keep the frame pointer in leaf functions. The former behavior is the
13823 default.
13824
13825 @item -mtls-dialect=desc
13826 @opindex mtls-dialect=desc
13827 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
13828 of TLS variables. This is the default.
13829
13830 @item -mtls-dialect=traditional
13831 @opindex mtls-dialect=traditional
13832 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
13833 of TLS variables.
13834
13835 @item -mtls-size=@var{size}
13836 @opindex mtls-size
13837 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
13838 This option requires binutils 2.26 or newer.
13839
13840 @item -mfix-cortex-a53-835769
13841 @itemx -mno-fix-cortex-a53-835769
13842 @opindex mfix-cortex-a53-835769
13843 @opindex mno-fix-cortex-a53-835769
13844 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
13845 This involves inserting a NOP instruction between memory instructions and
13846 64-bit integer multiply-accumulate instructions.
13847
13848 @item -mfix-cortex-a53-843419
13849 @itemx -mno-fix-cortex-a53-843419
13850 @opindex mfix-cortex-a53-843419
13851 @opindex mno-fix-cortex-a53-843419
13852 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
13853 This erratum workaround is made at link time and this will only pass the
13854 corresponding flag to the linker.
13855
13856 @item -mlow-precision-recip-sqrt
13857 @item -mno-low-precision-recip-sqrt
13858 @opindex mlow-precision-recip-sqrt
13859 @opindex mno-low-precision-recip-sqrt
13860 Enable or disable the reciprocal square root approximation.
13861 This option only has an effect if @option{-ffast-math} or
13862 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13863 precision of reciprocal square root results to about 16 bits for
13864 single precision and to 32 bits for double precision.
13865
13866 @item -mlow-precision-sqrt
13867 @item -mno-low-precision-sqrt
13868 @opindex -mlow-precision-sqrt
13869 @opindex -mno-low-precision-sqrt
13870 Enable or disable the square root approximation.
13871 This option only has an effect if @option{-ffast-math} or
13872 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13873 precision of square root results to about 16 bits for
13874 single precision and to 32 bits for double precision.
13875 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
13876
13877 @item -mlow-precision-div
13878 @item -mno-low-precision-div
13879 @opindex -mlow-precision-div
13880 @opindex -mno-low-precision-div
13881 Enable or disable the division approximation.
13882 This option only has an effect if @option{-ffast-math} or
13883 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13884 precision of division results to about 16 bits for
13885 single precision and to 32 bits for double precision.
13886
13887 @item -march=@var{name}
13888 @opindex march
13889 Specify the name of the target architecture and, optionally, one or
13890 more feature modifiers. This option has the form
13891 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
13892
13893 The permissible values for @var{arch} are @samp{armv8-a},
13894 @samp{armv8.1-a}, @samp{armv8.2-a} or @var{native}.
13895
13896 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
13897 support for the ARMv8.2-A architecture extensions.
13898
13899 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
13900 support for the ARMv8.1-A architecture extension. In particular, it
13901 enables the @samp{+crc} and @samp{+lse} features.
13902
13903 The value @samp{native} is available on native AArch64 GNU/Linux and
13904 causes the compiler to pick the architecture of the host system. This
13905 option has no effect if the compiler is unable to recognize the
13906 architecture of the host system,
13907
13908 The permissible values for @var{feature} are listed in the sub-section
13909 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13910 Feature Modifiers}. Where conflicting feature modifiers are
13911 specified, the right-most feature is used.
13912
13913 GCC uses @var{name} to determine what kind of instructions it can emit
13914 when generating assembly code. If @option{-march} is specified
13915 without either of @option{-mtune} or @option{-mcpu} also being
13916 specified, the code is tuned to perform well across a range of target
13917 processors implementing the target architecture.
13918
13919 @item -mtune=@var{name}
13920 @opindex mtune
13921 Specify the name of the target processor for which GCC should tune the
13922 performance of the code. Permissible values for this option are:
13923 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
13924 @samp{cortex-a72}, @samp{cortex-a73}, @samp{exynos-m1}, @samp{falkor},
13925 @samp{qdf24xx}, @samp{thunderx}, @samp{xgene1}, @samp{vulcan},
13926 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
13927 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}, @samp{native}.
13928
13929 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
13930 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}
13931 specify that GCC should tune for a big.LITTLE system.
13932
13933 Additionally on native AArch64 GNU/Linux systems the value
13934 @samp{native} tunes performance to the host system. This option has no effect
13935 if the compiler is unable to recognize the processor of the host system.
13936
13937 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
13938 are specified, the code is tuned to perform well across a range
13939 of target processors.
13940
13941 This option cannot be suffixed by feature modifiers.
13942
13943 @item -mcpu=@var{name}
13944 @opindex mcpu
13945 Specify the name of the target processor, optionally suffixed by one
13946 or more feature modifiers. This option has the form
13947 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
13948 the permissible values for @var{cpu} are the same as those available
13949 for @option{-mtune}. The permissible values for @var{feature} are
13950 documented in the sub-section on
13951 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13952 Feature Modifiers}. Where conflicting feature modifiers are
13953 specified, the right-most feature is used.
13954
13955 GCC uses @var{name} to determine what kind of instructions it can emit when
13956 generating assembly code (as if by @option{-march}) and to determine
13957 the target processor for which to tune for performance (as if
13958 by @option{-mtune}). Where this option is used in conjunction
13959 with @option{-march} or @option{-mtune}, those options take precedence
13960 over the appropriate part of this option.
13961
13962 @item -moverride=@var{string}
13963 @opindex moverride
13964 Override tuning decisions made by the back-end in response to a
13965 @option{-mtune=} switch. The syntax, semantics, and accepted values
13966 for @var{string} in this option are not guaranteed to be consistent
13967 across releases.
13968
13969 This option is only intended to be useful when developing GCC.
13970
13971 @item -mpc-relative-literal-loads
13972 @opindex mpc-relative-literal-loads
13973 Enable PC-relative literal loads. With this option literal pools are
13974 accessed using a single instruction and emitted after each function. This
13975 limits the maximum size of functions to 1MB. This is enabled by default for
13976 @option{-mcmodel=tiny}.
13977
13978 @end table
13979
13980 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
13981 @anchor{aarch64-feature-modifiers}
13982 @cindex @option{-march} feature modifiers
13983 @cindex @option{-mcpu} feature modifiers
13984 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
13985 the following and their inverses @option{no@var{feature}}:
13986
13987 @table @samp
13988 @item crc
13989 Enable CRC extension. This is on by default for
13990 @option{-march=armv8.1-a}.
13991 @item crypto
13992 Enable Crypto extension. This also enables Advanced SIMD and floating-point
13993 instructions.
13994 @item fp
13995 Enable floating-point instructions. This is on by default for all possible
13996 values for options @option{-march} and @option{-mcpu}.
13997 @item simd
13998 Enable Advanced SIMD instructions. This also enables floating-point
13999 instructions. This is on by default for all possible values for options
14000 @option{-march} and @option{-mcpu}.
14001 @item lse
14002 Enable Large System Extension instructions. This is on by default for
14003 @option{-march=armv8.1-a}.
14004 @item fp16
14005 Enable FP16 extension. This also enables floating-point instructions.
14006
14007 @end table
14008
14009 Feature @option{crypto} implies @option{simd}, which implies @option{fp}.
14010 Conversely, @option{nofp} implies @option{nosimd}, which implies
14011 @option{nocrypto}.
14012
14013 @node Adapteva Epiphany Options
14014 @subsection Adapteva Epiphany Options
14015
14016 These @samp{-m} options are defined for Adapteva Epiphany:
14017
14018 @table @gcctabopt
14019 @item -mhalf-reg-file
14020 @opindex mhalf-reg-file
14021 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
14022 That allows code to run on hardware variants that lack these registers.
14023
14024 @item -mprefer-short-insn-regs
14025 @opindex mprefer-short-insn-regs
14026 Preferentially allocate registers that allow short instruction generation.
14027 This can result in increased instruction count, so this may either reduce or
14028 increase overall code size.
14029
14030 @item -mbranch-cost=@var{num}
14031 @opindex mbranch-cost
14032 Set the cost of branches to roughly @var{num} ``simple'' instructions.
14033 This cost is only a heuristic and is not guaranteed to produce
14034 consistent results across releases.
14035
14036 @item -mcmove
14037 @opindex mcmove
14038 Enable the generation of conditional moves.
14039
14040 @item -mnops=@var{num}
14041 @opindex mnops
14042 Emit @var{num} NOPs before every other generated instruction.
14043
14044 @item -mno-soft-cmpsf
14045 @opindex mno-soft-cmpsf
14046 For single-precision floating-point comparisons, emit an @code{fsub} instruction
14047 and test the flags. This is faster than a software comparison, but can
14048 get incorrect results in the presence of NaNs, or when two different small
14049 numbers are compared such that their difference is calculated as zero.
14050 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
14051 software comparisons.
14052
14053 @item -mstack-offset=@var{num}
14054 @opindex mstack-offset
14055 Set the offset between the top of the stack and the stack pointer.
14056 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
14057 can be used by leaf functions without stack allocation.
14058 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
14059 Note also that this option changes the ABI; compiling a program with a
14060 different stack offset than the libraries have been compiled with
14061 generally does not work.
14062 This option can be useful if you want to evaluate if a different stack
14063 offset would give you better code, but to actually use a different stack
14064 offset to build working programs, it is recommended to configure the
14065 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
14066
14067 @item -mno-round-nearest
14068 @opindex mno-round-nearest
14069 Make the scheduler assume that the rounding mode has been set to
14070 truncating. The default is @option{-mround-nearest}.
14071
14072 @item -mlong-calls
14073 @opindex mlong-calls
14074 If not otherwise specified by an attribute, assume all calls might be beyond
14075 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
14076 function address into a register before performing a (otherwise direct) call.
14077 This is the default.
14078
14079 @item -mshort-calls
14080 @opindex short-calls
14081 If not otherwise specified by an attribute, assume all direct calls are
14082 in the range of the @code{b} / @code{bl} instructions, so use these instructions
14083 for direct calls. The default is @option{-mlong-calls}.
14084
14085 @item -msmall16
14086 @opindex msmall16
14087 Assume addresses can be loaded as 16-bit unsigned values. This does not
14088 apply to function addresses for which @option{-mlong-calls} semantics
14089 are in effect.
14090
14091 @item -mfp-mode=@var{mode}
14092 @opindex mfp-mode
14093 Set the prevailing mode of the floating-point unit.
14094 This determines the floating-point mode that is provided and expected
14095 at function call and return time. Making this mode match the mode you
14096 predominantly need at function start can make your programs smaller and
14097 faster by avoiding unnecessary mode switches.
14098
14099 @var{mode} can be set to one the following values:
14100
14101 @table @samp
14102 @item caller
14103 Any mode at function entry is valid, and retained or restored when
14104 the function returns, and when it calls other functions.
14105 This mode is useful for compiling libraries or other compilation units
14106 you might want to incorporate into different programs with different
14107 prevailing FPU modes, and the convenience of being able to use a single
14108 object file outweighs the size and speed overhead for any extra
14109 mode switching that might be needed, compared with what would be needed
14110 with a more specific choice of prevailing FPU mode.
14111
14112 @item truncate
14113 This is the mode used for floating-point calculations with
14114 truncating (i.e.@: round towards zero) rounding mode. That includes
14115 conversion from floating point to integer.
14116
14117 @item round-nearest
14118 This is the mode used for floating-point calculations with
14119 round-to-nearest-or-even rounding mode.
14120
14121 @item int
14122 This is the mode used to perform integer calculations in the FPU, e.g.@:
14123 integer multiply, or integer multiply-and-accumulate.
14124 @end table
14125
14126 The default is @option{-mfp-mode=caller}
14127
14128 @item -mnosplit-lohi
14129 @itemx -mno-postinc
14130 @itemx -mno-postmodify
14131 @opindex mnosplit-lohi
14132 @opindex mno-postinc
14133 @opindex mno-postmodify
14134 Code generation tweaks that disable, respectively, splitting of 32-bit
14135 loads, generation of post-increment addresses, and generation of
14136 post-modify addresses. The defaults are @option{msplit-lohi},
14137 @option{-mpost-inc}, and @option{-mpost-modify}.
14138
14139 @item -mnovect-double
14140 @opindex mno-vect-double
14141 Change the preferred SIMD mode to SImode. The default is
14142 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
14143
14144 @item -max-vect-align=@var{num}
14145 @opindex max-vect-align
14146 The maximum alignment for SIMD vector mode types.
14147 @var{num} may be 4 or 8. The default is 8.
14148 Note that this is an ABI change, even though many library function
14149 interfaces are unaffected if they don't use SIMD vector modes
14150 in places that affect size and/or alignment of relevant types.
14151
14152 @item -msplit-vecmove-early
14153 @opindex msplit-vecmove-early
14154 Split vector moves into single word moves before reload. In theory this
14155 can give better register allocation, but so far the reverse seems to be
14156 generally the case.
14157
14158 @item -m1reg-@var{reg}
14159 @opindex m1reg-
14160 Specify a register to hold the constant @minus{}1, which makes loading small negative
14161 constants and certain bitmasks faster.
14162 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
14163 which specify use of that register as a fixed register,
14164 and @samp{none}, which means that no register is used for this
14165 purpose. The default is @option{-m1reg-none}.
14166
14167 @end table
14168
14169 @node ARC Options
14170 @subsection ARC Options
14171 @cindex ARC options
14172
14173 The following options control the architecture variant for which code
14174 is being compiled:
14175
14176 @c architecture variants
14177 @table @gcctabopt
14178
14179 @item -mbarrel-shifter
14180 @opindex mbarrel-shifter
14181 Generate instructions supported by barrel shifter. This is the default
14182 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
14183
14184 @item -mcpu=@var{cpu}
14185 @opindex mcpu
14186 Set architecture type, register usage, and instruction scheduling
14187 parameters for @var{cpu}. There are also shortcut alias options
14188 available for backward compatibility and convenience. Supported
14189 values for @var{cpu} are
14190
14191 @table @samp
14192 @opindex mA6
14193 @opindex mARC600
14194 @item arc600
14195 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
14196
14197 @item arc601
14198 @opindex mARC601
14199 Compile for ARC601. Alias: @option{-mARC601}.
14200
14201 @item arc700
14202 @opindex mA7
14203 @opindex mARC700
14204 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
14205 This is the default when configured with @option{--with-cpu=arc700}@.
14206
14207 @item arcem
14208 Compile for ARC EM.
14209
14210 @item archs
14211 Compile for ARC HS.
14212
14213 @item em
14214 @opindex em
14215 Compile for ARC EM cpu with no hardware extension.
14216
14217 @item em4
14218 @opindex em4
14219 Compile for ARC EM4 cpu.
14220
14221 @item em4_dmips
14222 @opindex em4_dmips
14223 Compile for ARC EM4 DMIPS cpu.
14224
14225 @item em4_fpus
14226 @opindex em4_fpus
14227 Compile for ARC EM4 DMIPS cpu with single precision floating point
14228 extension.
14229
14230 @item em4_fpuda
14231 @opindex em4_fpuda
14232 Compile for ARC EM4 DMIPS cpu with single precision floating point and
14233 double assists instructions.
14234
14235 @item hs
14236 @opindex hs
14237 Compile for ARC HS cpu with no hardware extension, except the atomic
14238 instructions.
14239
14240 @item hs34
14241 @opindex hs34
14242 Compile for ARC HS34 cpu.
14243
14244 @item hs38
14245 @opindex hs38
14246 Compile for ARC HS38 cpu.
14247
14248 @item hs38_linux
14249 @opindex hs38_linux
14250 Compile for ARC HS38 cpu with all hardware extensions on.
14251
14252 @item arc600_norm
14253 @opindex arc600_norm
14254 Compile for ARC 600 cpu with norm instruction enabled.
14255
14256 @item arc600_mul32x16
14257 @opindex arc600_mul32x16
14258 Compile for ARC 600 cpu with norm and mul32x16 instructions enabled.
14259
14260 @item arc600_mul64
14261 @opindex arc600_mul64
14262 Compile for ARC 600 cpu with norm and mul64 instructions enabled.
14263
14264 @item arc601_norm
14265 @opindex arc601_norm
14266 Compile for ARC 601 cpu with norm instruction enabled.
14267
14268 @item arc601_mul32x16
14269 @opindex arc601_mul32x16
14270 Compile for ARC 601 cpu with norm and mul32x16 instructions enabled.
14271
14272 @item arc601_mul64
14273 @opindex arc601_mul64
14274 Compile for ARC 601 cpu with norm and mul64 instructions enabled.
14275
14276 @item nps400
14277 @opindex nps400
14278 Compile for ARC 700 on NPS400 chip.
14279
14280 @end table
14281
14282 @item -mdpfp
14283 @opindex mdpfp
14284 @itemx -mdpfp-compact
14285 @opindex mdpfp-compact
14286 FPX: Generate Double Precision FPX instructions, tuned for the compact
14287 implementation.
14288
14289 @item -mdpfp-fast
14290 @opindex mdpfp-fast
14291 FPX: Generate Double Precision FPX instructions, tuned for the fast
14292 implementation.
14293
14294 @item -mno-dpfp-lrsr
14295 @opindex mno-dpfp-lrsr
14296 Disable LR and SR instructions from using FPX extension aux registers.
14297
14298 @item -mea
14299 @opindex mea
14300 Generate Extended arithmetic instructions. Currently only
14301 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
14302 supported. This is always enabled for @option{-mcpu=ARC700}.
14303
14304 @item -mno-mpy
14305 @opindex mno-mpy
14306 Do not generate mpy instructions for ARC700. This instruction is
14307 deprecated.
14308
14309 @item -mmul32x16
14310 @opindex mmul32x16
14311 Generate 32x16 bit multiply and mac instructions.
14312
14313 @item -mmul64
14314 @opindex mmul64
14315 Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}.
14316
14317 @item -mnorm
14318 @opindex mnorm
14319 Generate norm instruction. This is the default if @option{-mcpu=ARC700}
14320 is in effect.
14321
14322 @item -mspfp
14323 @opindex mspfp
14324 @itemx -mspfp-compact
14325 @opindex mspfp-compact
14326 FPX: Generate Single Precision FPX instructions, tuned for the compact
14327 implementation.
14328
14329 @item -mspfp-fast
14330 @opindex mspfp-fast
14331 FPX: Generate Single Precision FPX instructions, tuned for the fast
14332 implementation.
14333
14334 @item -msimd
14335 @opindex msimd
14336 Enable generation of ARC SIMD instructions via target-specific
14337 builtins. Only valid for @option{-mcpu=ARC700}.
14338
14339 @item -msoft-float
14340 @opindex msoft-float
14341 This option ignored; it is provided for compatibility purposes only.
14342 Software floating point code is emitted by default, and this default
14343 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
14344 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
14345 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
14346
14347 @item -mswap
14348 @opindex mswap
14349 Generate swap instructions.
14350
14351 @item -matomic
14352 @opindex matomic
14353 This enables Locked Load/Store Conditional extension to implement
14354 atomic memopry built-in functions. Not available for ARC 6xx or ARC
14355 EM cores.
14356
14357 @item -mdiv-rem
14358 @opindex mdiv-rem
14359 Enable DIV/REM instructions for ARCv2 cores.
14360
14361 @item -mcode-density
14362 @opindex mcode-density
14363 Enable code density instructions for ARC EM, default on for ARC HS.
14364
14365 @item -mll64
14366 @opindex mll64
14367 Enable double load/store operations for ARC HS cores.
14368
14369 @item -mtp-regno=@var{regno}
14370 @opindex mtp-regno
14371 Specify thread pointer register number.
14372
14373 @item -mmpy-option=@var{multo}
14374 @opindex mmpy-option
14375 Compile ARCv2 code with a multiplier design option. @samp{wlh1} is
14376 the default value. The recognized values for @var{multo} are:
14377
14378 @table @samp
14379 @item 0
14380 No multiplier available.
14381
14382 @item 1
14383 @opindex w
14384 The multiply option is set to w: 16x16 multiplier, fully pipelined.
14385 The following instructions are enabled: MPYW, and MPYUW.
14386
14387 @item 2
14388 @opindex wlh1
14389 The multiply option is set to wlh1: 32x32 multiplier, fully
14390 pipelined (1 stage). The following instructions are additionally
14391 enabled: MPY, MPYU, MPYM, MPYMU, and MPY_S.
14392
14393 @item 3
14394 @opindex wlh2
14395 The multiply option is set to wlh2: 32x32 multiplier, fully pipelined
14396 (2 stages). The following instructions are additionally enabled: MPY,
14397 MPYU, MPYM, MPYMU, and MPY_S.
14398
14399 @item 4
14400 @opindex wlh3
14401 The multiply option is set to wlh3: Two 16x16 multiplier, blocking,
14402 sequential. The following instructions are additionally enabled: MPY,
14403 MPYU, MPYM, MPYMU, and MPY_S.
14404
14405 @item 5
14406 @opindex wlh4
14407 The multiply option is set to wlh4: One 16x16 multiplier, blocking,
14408 sequential. The following instructions are additionally enabled: MPY,
14409 MPYU, MPYM, MPYMU, and MPY_S.
14410
14411 @item 6
14412 @opindex wlh5
14413 The multiply option is set to wlh5: One 32x4 multiplier, blocking,
14414 sequential. The following instructions are additionally enabled: MPY,
14415 MPYU, MPYM, MPYMU, and MPY_S.
14416
14417 @end table
14418
14419 This option is only available for ARCv2 cores@.
14420
14421 @item -mfpu=@var{fpu}
14422 @opindex mfpu
14423 Enables specific floating-point hardware extension for ARCv2
14424 core. Supported values for @var{fpu} are:
14425
14426 @table @samp
14427
14428 @item fpus
14429 @opindex fpus
14430 Enables support for single precision floating point hardware
14431 extensions@.
14432
14433 @item fpud
14434 @opindex fpud
14435 Enables support for double precision floating point hardware
14436 extensions. The single precision floating point extension is also
14437 enabled. Not available for ARC EM@.
14438
14439 @item fpuda
14440 @opindex fpuda
14441 Enables support for double precision floating point hardware
14442 extensions using double precision assist instructions. The single
14443 precision floating point extension is also enabled. This option is
14444 only available for ARC EM@.
14445
14446 @item fpuda_div
14447 @opindex fpuda_div
14448 Enables support for double precision floating point hardware
14449 extensions using double precision assist instructions, and simple
14450 precision square-root and divide hardware extensions. The single
14451 precision floating point extension is also enabled. This option is
14452 only available for ARC EM@.
14453
14454 @item fpuda_fma
14455 @opindex fpuda_fma
14456 Enables support for double precision floating point hardware
14457 extensions using double precision assist instructions, and simple
14458 precision fused multiple and add hardware extension. The single
14459 precision floating point extension is also enabled. This option is
14460 only available for ARC EM@.
14461
14462 @item fpuda_all
14463 @opindex fpuda_all
14464 Enables support for double precision floating point hardware
14465 extensions using double precision assist instructions, and all simple
14466 precision hardware extensions. The single precision floating point
14467 extension is also enabled. This option is only available for ARC EM@.
14468
14469 @item fpus_div
14470 @opindex fpus_div
14471 Enables support for single precision floating point, and single
14472 precision square-root and divide hardware extensions@.
14473
14474 @item fpud_div
14475 @opindex fpud_div
14476 Enables support for double precision floating point, and double
14477 precision square-root and divide hardware extensions. This option
14478 includes option @samp{fpus_div}. Not available for ARC EM@.
14479
14480 @item fpus_fma
14481 @opindex fpus_fma
14482 Enables support for single precision floating point, and single
14483 precision fused multiple and add hardware extensions@.
14484
14485 @item fpud_fma
14486 @opindex fpud_fma
14487 Enables support for double precision floating point, and double
14488 precision fused multiple and add hardware extensions. This option
14489 includes option @samp{fpus_fma}. Not available for ARC EM@.
14490
14491 @item fpus_all
14492 @opindex fpus_all
14493 Enables support for all single precision floating point hardware
14494 extensions@.
14495
14496 @item fpud_all
14497 @opindex fpud_all
14498 Enables support for all single and double precision floating point
14499 hardware extensions. Not available for ARC EM@.
14500
14501 @end table
14502
14503 @end table
14504
14505 The following options are passed through to the assembler, and also
14506 define preprocessor macro symbols.
14507
14508 @c Flags used by the assembler, but for which we define preprocessor
14509 @c macro symbols as well.
14510 @table @gcctabopt
14511 @item -mdsp-packa
14512 @opindex mdsp-packa
14513 Passed down to the assembler to enable the DSP Pack A extensions.
14514 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
14515 deprecated.
14516
14517 @item -mdvbf
14518 @opindex mdvbf
14519 Passed down to the assembler to enable the dual viterbi butterfly
14520 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
14521 option is deprecated.
14522
14523 @c ARC700 4.10 extension instruction
14524 @item -mlock
14525 @opindex mlock
14526 Passed down to the assembler to enable the Locked Load/Store
14527 Conditional extension. Also sets the preprocessor symbol
14528 @code{__Xlock}.
14529
14530 @item -mmac-d16
14531 @opindex mmac-d16
14532 Passed down to the assembler. Also sets the preprocessor symbol
14533 @code{__Xxmac_d16}. This option is deprecated.
14534
14535 @item -mmac-24
14536 @opindex mmac-24
14537 Passed down to the assembler. Also sets the preprocessor symbol
14538 @code{__Xxmac_24}. This option is deprecated.
14539
14540 @c ARC700 4.10 extension instruction
14541 @item -mrtsc
14542 @opindex mrtsc
14543 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
14544 extension instruction. Also sets the preprocessor symbol
14545 @code{__Xrtsc}. This option is deprecated.
14546
14547 @c ARC700 4.10 extension instruction
14548 @item -mswape
14549 @opindex mswape
14550 Passed down to the assembler to enable the swap byte ordering
14551 extension instruction. Also sets the preprocessor symbol
14552 @code{__Xswape}.
14553
14554 @item -mtelephony
14555 @opindex mtelephony
14556 Passed down to the assembler to enable dual and single operand
14557 instructions for telephony. Also sets the preprocessor symbol
14558 @code{__Xtelephony}. This option is deprecated.
14559
14560 @item -mxy
14561 @opindex mxy
14562 Passed down to the assembler to enable the XY Memory extension. Also
14563 sets the preprocessor symbol @code{__Xxy}.
14564
14565 @end table
14566
14567 The following options control how the assembly code is annotated:
14568
14569 @c Assembly annotation options
14570 @table @gcctabopt
14571 @item -misize
14572 @opindex misize
14573 Annotate assembler instructions with estimated addresses.
14574
14575 @item -mannotate-align
14576 @opindex mannotate-align
14577 Explain what alignment considerations lead to the decision to make an
14578 instruction short or long.
14579
14580 @end table
14581
14582 The following options are passed through to the linker:
14583
14584 @c options passed through to the linker
14585 @table @gcctabopt
14586 @item -marclinux
14587 @opindex marclinux
14588 Passed through to the linker, to specify use of the @code{arclinux} emulation.
14589 This option is enabled by default in tool chains built for
14590 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
14591 when profiling is not requested.
14592
14593 @item -marclinux_prof
14594 @opindex marclinux_prof
14595 Passed through to the linker, to specify use of the
14596 @code{arclinux_prof} emulation. This option is enabled by default in
14597 tool chains built for @w{@code{arc-linux-uclibc}} and
14598 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
14599
14600 @end table
14601
14602 The following options control the semantics of generated code:
14603
14604 @c semantically relevant code generation options
14605 @table @gcctabopt
14606 @item -mlong-calls
14607 @opindex mlong-calls
14608 Generate call insns as register indirect calls, thus providing access
14609 to the full 32-bit address range.
14610
14611 @item -mmedium-calls
14612 @opindex mmedium-calls
14613 Don't use less than 25 bit addressing range for calls, which is the
14614 offset available for an unconditional branch-and-link
14615 instruction. Conditional execution of function calls is suppressed, to
14616 allow use of the 25-bit range, rather than the 21-bit range with
14617 conditional branch-and-link. This is the default for tool chains built
14618 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
14619
14620 @item -mno-sdata
14621 @opindex mno-sdata
14622 Do not generate sdata references. This is the default for tool chains
14623 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
14624 targets.
14625
14626 @item -mucb-mcount
14627 @opindex mucb-mcount
14628 Instrument with mcount calls as used in UCB code. I.e. do the
14629 counting in the callee, not the caller. By default ARC instrumentation
14630 counts in the caller.
14631
14632 @item -mvolatile-cache
14633 @opindex mvolatile-cache
14634 Use ordinarily cached memory accesses for volatile references. This is the
14635 default.
14636
14637 @item -mno-volatile-cache
14638 @opindex mno-volatile-cache
14639 Enable cache bypass for volatile references.
14640
14641 @end table
14642
14643 The following options fine tune code generation:
14644 @c code generation tuning options
14645 @table @gcctabopt
14646 @item -malign-call
14647 @opindex malign-call
14648 Do alignment optimizations for call instructions.
14649
14650 @item -mauto-modify-reg
14651 @opindex mauto-modify-reg
14652 Enable the use of pre/post modify with register displacement.
14653
14654 @item -mbbit-peephole
14655 @opindex mbbit-peephole
14656 Enable bbit peephole2.
14657
14658 @item -mno-brcc
14659 @opindex mno-brcc
14660 This option disables a target-specific pass in @file{arc_reorg} to
14661 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
14662 generation driven by the combiner pass.
14663
14664 @item -mcase-vector-pcrel
14665 @opindex mcase-vector-pcrel
14666 Use pc-relative switch case tables - this enables case table shortening.
14667 This is the default for @option{-Os}.
14668
14669 @item -mcompact-casesi
14670 @opindex mcompact-casesi
14671 Enable compact casesi pattern. This is the default for @option{-Os},
14672 and only available for ARCv1 cores.
14673
14674 @item -mno-cond-exec
14675 @opindex mno-cond-exec
14676 Disable ARCompact specific pass to generate conditional execution instructions.
14677 Due to delay slot scheduling and interactions between operand numbers,
14678 literal sizes, instruction lengths, and the support for conditional execution,
14679 the target-independent pass to generate conditional execution is often lacking,
14680 so the ARC port has kept a special pass around that tries to find more
14681 conditional execution generating opportunities after register allocation,
14682 branch shortening, and delay slot scheduling have been done. This pass
14683 generally, but not always, improves performance and code size, at the cost of
14684 extra compilation time, which is why there is an option to switch it off.
14685 If you have a problem with call instructions exceeding their allowable
14686 offset range because they are conditionalized, you should consider using
14687 @option{-mmedium-calls} instead.
14688
14689 @item -mearly-cbranchsi
14690 @opindex mearly-cbranchsi
14691 Enable pre-reload use of the cbranchsi pattern.
14692
14693 @item -mexpand-adddi
14694 @opindex mexpand-adddi
14695 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
14696 @code{add.f}, @code{adc} etc.
14697
14698 @item -mindexed-loads
14699 @opindex mindexed-loads
14700 Enable the use of indexed loads. This can be problematic because some
14701 optimizers then assume that indexed stores exist, which is not
14702 the case.
14703
14704 @opindex mlra
14705 Enable Local Register Allocation. This is still experimental for ARC,
14706 so by default the compiler uses standard reload
14707 (i.e. @option{-mno-lra}).
14708
14709 @item -mlra-priority-none
14710 @opindex mlra-priority-none
14711 Don't indicate any priority for target registers.
14712
14713 @item -mlra-priority-compact
14714 @opindex mlra-priority-compact
14715 Indicate target register priority for r0..r3 / r12..r15.
14716
14717 @item -mlra-priority-noncompact
14718 @opindex mlra-priority-noncompact
14719 Reduce target register priority for r0..r3 / r12..r15.
14720
14721 @item -mno-millicode
14722 @opindex mno-millicode
14723 When optimizing for size (using @option{-Os}), prologues and epilogues
14724 that have to save or restore a large number of registers are often
14725 shortened by using call to a special function in libgcc; this is
14726 referred to as a @emph{millicode} call. As these calls can pose
14727 performance issues, and/or cause linking issues when linking in a
14728 nonstandard way, this option is provided to turn off millicode call
14729 generation.
14730
14731 @item -mmixed-code
14732 @opindex mmixed-code
14733 Tweak register allocation to help 16-bit instruction generation.
14734 This generally has the effect of decreasing the average instruction size
14735 while increasing the instruction count.
14736
14737 @item -mq-class
14738 @opindex mq-class
14739 Enable 'q' instruction alternatives.
14740 This is the default for @option{-Os}.
14741
14742 @item -mRcq
14743 @opindex mRcq
14744 Enable Rcq constraint handling - most short code generation depends on this.
14745 This is the default.
14746
14747 @item -mRcw
14748 @opindex mRcw
14749 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
14750 This is the default.
14751
14752 @item -msize-level=@var{level}
14753 @opindex msize-level
14754 Fine-tune size optimization with regards to instruction lengths and alignment.
14755 The recognized values for @var{level} are:
14756 @table @samp
14757 @item 0
14758 No size optimization. This level is deprecated and treated like @samp{1}.
14759
14760 @item 1
14761 Short instructions are used opportunistically.
14762
14763 @item 2
14764 In addition, alignment of loops and of code after barriers are dropped.
14765
14766 @item 3
14767 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
14768
14769 @end table
14770
14771 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
14772 the behavior when this is not set is equivalent to level @samp{1}.
14773
14774 @item -mtune=@var{cpu}
14775 @opindex mtune
14776 Set instruction scheduling parameters for @var{cpu}, overriding any implied
14777 by @option{-mcpu=}.
14778
14779 Supported values for @var{cpu} are
14780
14781 @table @samp
14782 @item ARC600
14783 Tune for ARC600 cpu.
14784
14785 @item ARC601
14786 Tune for ARC601 cpu.
14787
14788 @item ARC700
14789 Tune for ARC700 cpu with standard multiplier block.
14790
14791 @item ARC700-xmac
14792 Tune for ARC700 cpu with XMAC block.
14793
14794 @item ARC725D
14795 Tune for ARC725D cpu.
14796
14797 @item ARC750D
14798 Tune for ARC750D cpu.
14799
14800 @end table
14801
14802 @item -mmultcost=@var{num}
14803 @opindex mmultcost
14804 Cost to assume for a multiply instruction, with @samp{4} being equal to a
14805 normal instruction.
14806
14807 @item -munalign-prob-threshold=@var{probability}
14808 @opindex munalign-prob-threshold
14809 Set probability threshold for unaligning branches.
14810 When tuning for @samp{ARC700} and optimizing for speed, branches without
14811 filled delay slot are preferably emitted unaligned and long, unless
14812 profiling indicates that the probability for the branch to be taken
14813 is below @var{probability}. @xref{Cross-profiling}.
14814 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
14815
14816 @end table
14817
14818 The following options are maintained for backward compatibility, but
14819 are now deprecated and will be removed in a future release:
14820
14821 @c Deprecated options
14822 @table @gcctabopt
14823
14824 @item -margonaut
14825 @opindex margonaut
14826 Obsolete FPX.
14827
14828 @item -mbig-endian
14829 @opindex mbig-endian
14830 @itemx -EB
14831 @opindex EB
14832 Compile code for big endian targets. Use of these options is now
14833 deprecated. Users wanting big-endian code, should use the
14834 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
14835 building the tool chain, for which big-endian is the default.
14836
14837 @item -mlittle-endian
14838 @opindex mlittle-endian
14839 @itemx -EL
14840 @opindex EL
14841 Compile code for little endian targets. Use of these options is now
14842 deprecated. Users wanting little-endian code should use the
14843 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
14844 building the tool chain, for which little-endian is the default.
14845
14846 @item -mbarrel_shifter
14847 @opindex mbarrel_shifter
14848 Replaced by @option{-mbarrel-shifter}.
14849
14850 @item -mdpfp_compact
14851 @opindex mdpfp_compact
14852 Replaced by @option{-mdpfp-compact}.
14853
14854 @item -mdpfp_fast
14855 @opindex mdpfp_fast
14856 Replaced by @option{-mdpfp-fast}.
14857
14858 @item -mdsp_packa
14859 @opindex mdsp_packa
14860 Replaced by @option{-mdsp-packa}.
14861
14862 @item -mEA
14863 @opindex mEA
14864 Replaced by @option{-mea}.
14865
14866 @item -mmac_24
14867 @opindex mmac_24
14868 Replaced by @option{-mmac-24}.
14869
14870 @item -mmac_d16
14871 @opindex mmac_d16
14872 Replaced by @option{-mmac-d16}.
14873
14874 @item -mspfp_compact
14875 @opindex mspfp_compact
14876 Replaced by @option{-mspfp-compact}.
14877
14878 @item -mspfp_fast
14879 @opindex mspfp_fast
14880 Replaced by @option{-mspfp-fast}.
14881
14882 @item -mtune=@var{cpu}
14883 @opindex mtune
14884 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
14885 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
14886 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
14887
14888 @item -multcost=@var{num}
14889 @opindex multcost
14890 Replaced by @option{-mmultcost}.
14891
14892 @end table
14893
14894 @node ARM Options
14895 @subsection ARM Options
14896 @cindex ARM options
14897
14898 These @samp{-m} options are defined for the ARM port:
14899
14900 @table @gcctabopt
14901 @item -mabi=@var{name}
14902 @opindex mabi
14903 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
14904 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
14905
14906 @item -mapcs-frame
14907 @opindex mapcs-frame
14908 Generate a stack frame that is compliant with the ARM Procedure Call
14909 Standard for all functions, even if this is not strictly necessary for
14910 correct execution of the code. Specifying @option{-fomit-frame-pointer}
14911 with this option causes the stack frames not to be generated for
14912 leaf functions. The default is @option{-mno-apcs-frame}.
14913 This option is deprecated.
14914
14915 @item -mapcs
14916 @opindex mapcs
14917 This is a synonym for @option{-mapcs-frame} and is deprecated.
14918
14919 @ignore
14920 @c not currently implemented
14921 @item -mapcs-stack-check
14922 @opindex mapcs-stack-check
14923 Generate code to check the amount of stack space available upon entry to
14924 every function (that actually uses some stack space). If there is
14925 insufficient space available then either the function
14926 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
14927 called, depending upon the amount of stack space required. The runtime
14928 system is required to provide these functions. The default is
14929 @option{-mno-apcs-stack-check}, since this produces smaller code.
14930
14931 @c not currently implemented
14932 @item -mapcs-reentrant
14933 @opindex mapcs-reentrant
14934 Generate reentrant, position-independent code. The default is
14935 @option{-mno-apcs-reentrant}.
14936 @end ignore
14937
14938 @item -mthumb-interwork
14939 @opindex mthumb-interwork
14940 Generate code that supports calling between the ARM and Thumb
14941 instruction sets. Without this option, on pre-v5 architectures, the
14942 two instruction sets cannot be reliably used inside one program. The
14943 default is @option{-mno-thumb-interwork}, since slightly larger code
14944 is generated when @option{-mthumb-interwork} is specified. In AAPCS
14945 configurations this option is meaningless.
14946
14947 @item -mno-sched-prolog
14948 @opindex mno-sched-prolog
14949 Prevent the reordering of instructions in the function prologue, or the
14950 merging of those instruction with the instructions in the function's
14951 body. This means that all functions start with a recognizable set
14952 of instructions (or in fact one of a choice from a small set of
14953 different function prologues), and this information can be used to
14954 locate the start of functions inside an executable piece of code. The
14955 default is @option{-msched-prolog}.
14956
14957 @item -mfloat-abi=@var{name}
14958 @opindex mfloat-abi
14959 Specifies which floating-point ABI to use. Permissible values
14960 are: @samp{soft}, @samp{softfp} and @samp{hard}.
14961
14962 Specifying @samp{soft} causes GCC to generate output containing
14963 library calls for floating-point operations.
14964 @samp{softfp} allows the generation of code using hardware floating-point
14965 instructions, but still uses the soft-float calling conventions.
14966 @samp{hard} allows generation of floating-point instructions
14967 and uses FPU-specific calling conventions.
14968
14969 The default depends on the specific target configuration. Note that
14970 the hard-float and soft-float ABIs are not link-compatible; you must
14971 compile your entire program with the same ABI, and link with a
14972 compatible set of libraries.
14973
14974 @item -mlittle-endian
14975 @opindex mlittle-endian
14976 Generate code for a processor running in little-endian mode. This is
14977 the default for all standard configurations.
14978
14979 @item -mbig-endian
14980 @opindex mbig-endian
14981 Generate code for a processor running in big-endian mode; the default is
14982 to compile code for a little-endian processor.
14983
14984 @item -march=@var{name}
14985 @opindex march
14986 This specifies the name of the target ARM architecture. GCC uses this
14987 name to determine what kind of instructions it can emit when generating
14988 assembly code. This option can be used in conjunction with or instead
14989 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
14990 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
14991 @samp{armv5}, @samp{armv5e}, @samp{armv5t}, @samp{armv5te},
14992 @samp{armv6}, @samp{armv6-m}, @samp{armv6j}, @samp{armv6k},
14993 @samp{armv6kz}, @samp{armv6s-m},
14994 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk},
14995 @samp{armv7}, @samp{armv7-a}, @samp{armv7-m}, @samp{armv7-r}, @samp{armv7e-m},
14996 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a},
14997 @samp{armv8.1-a+crc}, @samp{armv8-m.base}, @samp{armv8-m.main},
14998 @samp{armv8-m.main+dsp}, @samp{iwmmxt}, @samp{iwmmxt2}.
14999
15000 Architecture revisions older than @samp{armv4t} are deprecated.
15001
15002 @option{-march=armv6s-m} is the @samp{armv6-m} architecture with support for
15003 the (now mandatory) SVC instruction.
15004
15005 @option{-march=armv6zk} is an alias for @samp{armv6kz}, existing for backwards
15006 compatibility.
15007
15008 @option{-march=armv7ve} is the @samp{armv7-a} architecture with virtualization
15009 extensions.
15010
15011 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
15012 architecture together with the optional CRC32 extensions.
15013
15014 @option{-march=armv8.1-a} enables compiler support for the ARMv8.1-A
15015 architecture. This also enables the features provided by
15016 @option{-march=armv8-a+crc}.
15017
15018 @option{-march=armv8.2-a} enables compiler support for the ARMv8.2-A
15019 architecture. This also enables the features provided by
15020 @option{-march=armv8.1-a}.
15021
15022 @option{-march=armv8.2-a+fp16} enables compiler support for the
15023 ARMv8.2-A architecture with the optional FP16 instructions extension.
15024 This also enables the features provided by @option{-march=armv8.1-a}
15025 and implies @option{-mfp16-format=ieee}.
15026
15027 @option{-march=native} causes the compiler to auto-detect the architecture
15028 of the build computer. At present, this feature is only supported on
15029 GNU/Linux, and not all architectures are recognized. If the auto-detect
15030 is unsuccessful the option has no effect.
15031
15032 @item -mtune=@var{name}
15033 @opindex mtune
15034 This option specifies the name of the target ARM processor for
15035 which GCC should tune the performance of the code.
15036 For some ARM implementations better performance can be obtained by using
15037 this option.
15038 Permissible names are: @samp{arm2}, @samp{arm250},
15039 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
15040 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
15041 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
15042 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
15043 @samp{arm720},
15044 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
15045 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
15046 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
15047 @samp{strongarm1110},
15048 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
15049 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
15050 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
15051 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
15052 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
15053 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
15054 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
15055 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
15056 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
15057 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
15058 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-r4},
15059 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
15060 @samp{cortex-m33},
15061 @samp{cortex-m23},
15062 @samp{cortex-m7},
15063 @samp{cortex-m4},
15064 @samp{cortex-m3},
15065 @samp{cortex-m1},
15066 @samp{cortex-m0},
15067 @samp{cortex-m0plus},
15068 @samp{cortex-m1.small-multiply},
15069 @samp{cortex-m0.small-multiply},
15070 @samp{cortex-m0plus.small-multiply},
15071 @samp{exynos-m1},
15072 @samp{falkor},
15073 @samp{qdf24xx},
15074 @samp{marvell-pj4},
15075 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
15076 @samp{fa526}, @samp{fa626},
15077 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
15078 @samp{xgene1}.
15079
15080 Additionally, this option can specify that GCC should tune the performance
15081 of the code for a big.LITTLE system. Permissible names are:
15082 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
15083 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15084 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}.
15085
15086 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
15087 performance for a blend of processors within architecture @var{arch}.
15088 The aim is to generate code that run well on the current most popular
15089 processors, balancing between optimizations that benefit some CPUs in the
15090 range, and avoiding performance pitfalls of other CPUs. The effects of
15091 this option may change in future GCC versions as CPU models come and go.
15092
15093 @option{-mtune=native} causes the compiler to auto-detect the CPU
15094 of the build computer. At present, this feature is only supported on
15095 GNU/Linux, and not all architectures are recognized. If the auto-detect is
15096 unsuccessful the option has no effect.
15097
15098 @item -mcpu=@var{name}
15099 @opindex mcpu
15100 This specifies the name of the target ARM processor. GCC uses this name
15101 to derive the name of the target ARM architecture (as if specified
15102 by @option{-march}) and the ARM processor type for which to tune for
15103 performance (as if specified by @option{-mtune}). Where this option
15104 is used in conjunction with @option{-march} or @option{-mtune},
15105 those options take precedence over the appropriate part of this option.
15106
15107 Permissible names for this option are the same as those for
15108 @option{-mtune}.
15109
15110 @option{-mcpu=generic-@var{arch}} is also permissible, and is
15111 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
15112 See @option{-mtune} for more information.
15113
15114 @option{-mcpu=native} causes the compiler to auto-detect the CPU
15115 of the build computer. At present, this feature is only supported on
15116 GNU/Linux, and not all architectures are recognized. If the auto-detect
15117 is unsuccessful the option has no effect.
15118
15119 @item -mfpu=@var{name}
15120 @opindex mfpu
15121 This specifies what floating-point hardware (or hardware emulation) is
15122 available on the target. Permissible names are: @samp{vfpv2}, @samp{vfpv3},
15123 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
15124 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
15125 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
15126 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
15127 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
15128 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
15129 is an alias for @samp{vfpv2}.
15130
15131 If @option{-msoft-float} is specified this specifies the format of
15132 floating-point values.
15133
15134 If the selected floating-point hardware includes the NEON extension
15135 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
15136 operations are not generated by GCC's auto-vectorization pass unless
15137 @option{-funsafe-math-optimizations} is also specified. This is
15138 because NEON hardware does not fully implement the IEEE 754 standard for
15139 floating-point arithmetic (in particular denormal values are treated as
15140 zero), so the use of NEON instructions may lead to a loss of precision.
15141
15142 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}).
15143
15144 @item -mfp16-format=@var{name}
15145 @opindex mfp16-format
15146 Specify the format of the @code{__fp16} half-precision floating-point type.
15147 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
15148 the default is @samp{none}, in which case the @code{__fp16} type is not
15149 defined. @xref{Half-Precision}, for more information.
15150
15151 @item -mstructure-size-boundary=@var{n}
15152 @opindex mstructure-size-boundary
15153 The sizes of all structures and unions are rounded up to a multiple
15154 of the number of bits set by this option. Permissible values are 8, 32
15155 and 64. The default value varies for different toolchains. For the COFF
15156 targeted toolchain the default value is 8. A value of 64 is only allowed
15157 if the underlying ABI supports it.
15158
15159 Specifying a larger number can produce faster, more efficient code, but
15160 can also increase the size of the program. Different values are potentially
15161 incompatible. Code compiled with one value cannot necessarily expect to
15162 work with code or libraries compiled with another value, if they exchange
15163 information using structures or unions.
15164
15165 @item -mabort-on-noreturn
15166 @opindex mabort-on-noreturn
15167 Generate a call to the function @code{abort} at the end of a
15168 @code{noreturn} function. It is executed if the function tries to
15169 return.
15170
15171 @item -mlong-calls
15172 @itemx -mno-long-calls
15173 @opindex mlong-calls
15174 @opindex mno-long-calls
15175 Tells the compiler to perform function calls by first loading the
15176 address of the function into a register and then performing a subroutine
15177 call on this register. This switch is needed if the target function
15178 lies outside of the 64-megabyte addressing range of the offset-based
15179 version of subroutine call instruction.
15180
15181 Even if this switch is enabled, not all function calls are turned
15182 into long calls. The heuristic is that static functions, functions
15183 that have the @code{short_call} attribute, functions that are inside
15184 the scope of a @code{#pragma no_long_calls} directive, and functions whose
15185 definitions have already been compiled within the current compilation
15186 unit are not turned into long calls. The exceptions to this rule are
15187 that weak function definitions, functions with the @code{long_call}
15188 attribute or the @code{section} attribute, and functions that are within
15189 the scope of a @code{#pragma long_calls} directive are always
15190 turned into long calls.
15191
15192 This feature is not enabled by default. Specifying
15193 @option{-mno-long-calls} restores the default behavior, as does
15194 placing the function calls within the scope of a @code{#pragma
15195 long_calls_off} directive. Note these switches have no effect on how
15196 the compiler generates code to handle function calls via function
15197 pointers.
15198
15199 @item -msingle-pic-base
15200 @opindex msingle-pic-base
15201 Treat the register used for PIC addressing as read-only, rather than
15202 loading it in the prologue for each function. The runtime system is
15203 responsible for initializing this register with an appropriate value
15204 before execution begins.
15205
15206 @item -mpic-register=@var{reg}
15207 @opindex mpic-register
15208 Specify the register to be used for PIC addressing.
15209 For standard PIC base case, the default is any suitable register
15210 determined by compiler. For single PIC base case, the default is
15211 @samp{R9} if target is EABI based or stack-checking is enabled,
15212 otherwise the default is @samp{R10}.
15213
15214 @item -mpic-data-is-text-relative
15215 @opindex mpic-data-is-text-relative
15216 Assume that the displacement between the text and data segments is fixed
15217 at static link time. This permits using PC-relative addressing
15218 operations to access data known to be in the data segment. For
15219 non-VxWorks RTP targets, this option is enabled by default. When
15220 disabled on such targets, it will enable @option{-msingle-pic-base} by
15221 default.
15222
15223 @item -mpoke-function-name
15224 @opindex mpoke-function-name
15225 Write the name of each function into the text section, directly
15226 preceding the function prologue. The generated code is similar to this:
15227
15228 @smallexample
15229 t0
15230 .ascii "arm_poke_function_name", 0
15231 .align
15232 t1
15233 .word 0xff000000 + (t1 - t0)
15234 arm_poke_function_name
15235 mov ip, sp
15236 stmfd sp!, @{fp, ip, lr, pc@}
15237 sub fp, ip, #4
15238 @end smallexample
15239
15240 When performing a stack backtrace, code can inspect the value of
15241 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
15242 location @code{pc - 12} and the top 8 bits are set, then we know that
15243 there is a function name embedded immediately preceding this location
15244 and has length @code{((pc[-3]) & 0xff000000)}.
15245
15246 @item -mthumb
15247 @itemx -marm
15248 @opindex marm
15249 @opindex mthumb
15250
15251 Select between generating code that executes in ARM and Thumb
15252 states. The default for most configurations is to generate code
15253 that executes in ARM state, but the default can be changed by
15254 configuring GCC with the @option{--with-mode=}@var{state}
15255 configure option.
15256
15257 You can also override the ARM and Thumb mode for each function
15258 by using the @code{target("thumb")} and @code{target("arm")} function attributes
15259 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
15260
15261 @item -mtpcs-frame
15262 @opindex mtpcs-frame
15263 Generate a stack frame that is compliant with the Thumb Procedure Call
15264 Standard for all non-leaf functions. (A leaf function is one that does
15265 not call any other functions.) The default is @option{-mno-tpcs-frame}.
15266
15267 @item -mtpcs-leaf-frame
15268 @opindex mtpcs-leaf-frame
15269 Generate a stack frame that is compliant with the Thumb Procedure Call
15270 Standard for all leaf functions. (A leaf function is one that does
15271 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
15272
15273 @item -mcallee-super-interworking
15274 @opindex mcallee-super-interworking
15275 Gives all externally visible functions in the file being compiled an ARM
15276 instruction set header which switches to Thumb mode before executing the
15277 rest of the function. This allows these functions to be called from
15278 non-interworking code. This option is not valid in AAPCS configurations
15279 because interworking is enabled by default.
15280
15281 @item -mcaller-super-interworking
15282 @opindex mcaller-super-interworking
15283 Allows calls via function pointers (including virtual functions) to
15284 execute correctly regardless of whether the target code has been
15285 compiled for interworking or not. There is a small overhead in the cost
15286 of executing a function pointer if this option is enabled. This option
15287 is not valid in AAPCS configurations because interworking is enabled
15288 by default.
15289
15290 @item -mtp=@var{name}
15291 @opindex mtp
15292 Specify the access model for the thread local storage pointer. The valid
15293 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
15294 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
15295 (supported in the arm6k architecture), and @samp{auto}, which uses the
15296 best available method for the selected processor. The default setting is
15297 @samp{auto}.
15298
15299 @item -mtls-dialect=@var{dialect}
15300 @opindex mtls-dialect
15301 Specify the dialect to use for accessing thread local storage. Two
15302 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
15303 @samp{gnu} dialect selects the original GNU scheme for supporting
15304 local and global dynamic TLS models. The @samp{gnu2} dialect
15305 selects the GNU descriptor scheme, which provides better performance
15306 for shared libraries. The GNU descriptor scheme is compatible with
15307 the original scheme, but does require new assembler, linker and
15308 library support. Initial and local exec TLS models are unaffected by
15309 this option and always use the original scheme.
15310
15311 @item -mword-relocations
15312 @opindex mword-relocations
15313 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
15314 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
15315 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
15316 is specified.
15317
15318 @item -mfix-cortex-m3-ldrd
15319 @opindex mfix-cortex-m3-ldrd
15320 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
15321 with overlapping destination and base registers are used. This option avoids
15322 generating these instructions. This option is enabled by default when
15323 @option{-mcpu=cortex-m3} is specified.
15324
15325 @item -munaligned-access
15326 @itemx -mno-unaligned-access
15327 @opindex munaligned-access
15328 @opindex mno-unaligned-access
15329 Enables (or disables) reading and writing of 16- and 32- bit values
15330 from addresses that are not 16- or 32- bit aligned. By default
15331 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
15332 ARMv8-M Baseline architectures, and enabled for all other
15333 architectures. If unaligned access is not enabled then words in packed
15334 data structures are accessed a byte at a time.
15335
15336 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
15337 generated object file to either true or false, depending upon the
15338 setting of this option. If unaligned access is enabled then the
15339 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
15340 defined.
15341
15342 @item -mneon-for-64bits
15343 @opindex mneon-for-64bits
15344 Enables using Neon to handle scalar 64-bits operations. This is
15345 disabled by default since the cost of moving data from core registers
15346 to Neon is high.
15347
15348 @item -mslow-flash-data
15349 @opindex mslow-flash-data
15350 Assume loading data from flash is slower than fetching instruction.
15351 Therefore literal load is minimized for better performance.
15352 This option is only supported when compiling for ARMv7 M-profile and
15353 off by default.
15354
15355 @item -masm-syntax-unified
15356 @opindex masm-syntax-unified
15357 Assume inline assembler is using unified asm syntax. The default is
15358 currently off which implies divided syntax. This option has no impact
15359 on Thumb2. However, this may change in future releases of GCC.
15360 Divided syntax should be considered deprecated.
15361
15362 @item -mrestrict-it
15363 @opindex mrestrict-it
15364 Restricts generation of IT blocks to conform to the rules of ARMv8.
15365 IT blocks can only contain a single 16-bit instruction from a select
15366 set of instructions. This option is on by default for ARMv8 Thumb mode.
15367
15368 @item -mprint-tune-info
15369 @opindex mprint-tune-info
15370 Print CPU tuning information as comment in assembler file. This is
15371 an option used only for regression testing of the compiler and not
15372 intended for ordinary use in compiling code. This option is disabled
15373 by default.
15374
15375 @item -mpure-code
15376 @opindex mpure-code
15377 Do not allow constant data to be placed in code sections.
15378 Additionally, when compiling for ELF object format give all text sections the
15379 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
15380 is only available when generating non-pic code for ARMv7-M targets.
15381
15382 @item -mcmse
15383 @opindex mcmse
15384 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
15385 Development Tools Engineering Specification", which can be found on
15386 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
15387 @end table
15388
15389 @node AVR Options
15390 @subsection AVR Options
15391 @cindex AVR Options
15392
15393 These options are defined for AVR implementations:
15394
15395 @table @gcctabopt
15396 @item -mmcu=@var{mcu}
15397 @opindex mmcu
15398 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
15399
15400 The default for this option is@tie{}@samp{avr2}.
15401
15402 GCC supports the following AVR devices and ISAs:
15403
15404 @include avr-mmcu.texi
15405
15406 @item -mabsdata
15407 @opindex mabsdata
15408
15409 Assume that all data in static storage can be accessed by LDS / STS
15410 instructions. This option has only an effect on reduced Tiny devices like
15411 ATtiny40. See also the @code{absdata}
15412 @ref{AVR Variable Attributes,variable attribute}.
15413
15414 @item -maccumulate-args
15415 @opindex maccumulate-args
15416 Accumulate outgoing function arguments and acquire/release the needed
15417 stack space for outgoing function arguments once in function
15418 prologue/epilogue. Without this option, outgoing arguments are pushed
15419 before calling a function and popped afterwards.
15420
15421 Popping the arguments after the function call can be expensive on
15422 AVR so that accumulating the stack space might lead to smaller
15423 executables because arguments need not to be removed from the
15424 stack after such a function call.
15425
15426 This option can lead to reduced code size for functions that perform
15427 several calls to functions that get their arguments on the stack like
15428 calls to printf-like functions.
15429
15430 @item -mbranch-cost=@var{cost}
15431 @opindex mbranch-cost
15432 Set the branch costs for conditional branch instructions to
15433 @var{cost}. Reasonable values for @var{cost} are small, non-negative
15434 integers. The default branch cost is 0.
15435
15436 @item -mcall-prologues
15437 @opindex mcall-prologues
15438 Functions prologues/epilogues are expanded as calls to appropriate
15439 subroutines. Code size is smaller.
15440
15441 @item -mint8
15442 @opindex mint8
15443 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
15444 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
15445 and @code{long long} is 4 bytes. Please note that this option does not
15446 conform to the C standards, but it results in smaller code
15447 size.
15448
15449 @item -mn-flash=@var{num}
15450 @opindex mn-flash
15451 Assume that the flash memory has a size of
15452 @var{num} times 64@tie{}KiB.
15453
15454 @item -mno-interrupts
15455 @opindex mno-interrupts
15456 Generated code is not compatible with hardware interrupts.
15457 Code size is smaller.
15458
15459 @item -mrelax
15460 @opindex mrelax
15461 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
15462 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
15463 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
15464 the assembler's command line and the @option{--relax} option to the
15465 linker's command line.
15466
15467 Jump relaxing is performed by the linker because jump offsets are not
15468 known before code is located. Therefore, the assembler code generated by the
15469 compiler is the same, but the instructions in the executable may
15470 differ from instructions in the assembler code.
15471
15472 Relaxing must be turned on if linker stubs are needed, see the
15473 section on @code{EIND} and linker stubs below.
15474
15475 @item -mrmw
15476 @opindex mrmw
15477 Assume that the device supports the Read-Modify-Write
15478 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
15479
15480 @item -msp8
15481 @opindex msp8
15482 Treat the stack pointer register as an 8-bit register,
15483 i.e.@: assume the high byte of the stack pointer is zero.
15484 In general, you don't need to set this option by hand.
15485
15486 This option is used internally by the compiler to select and
15487 build multilibs for architectures @code{avr2} and @code{avr25}.
15488 These architectures mix devices with and without @code{SPH}.
15489 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
15490 the compiler driver adds or removes this option from the compiler
15491 proper's command line, because the compiler then knows if the device
15492 or architecture has an 8-bit stack pointer and thus no @code{SPH}
15493 register or not.
15494
15495 @item -mstrict-X
15496 @opindex mstrict-X
15497 Use address register @code{X} in a way proposed by the hardware. This means
15498 that @code{X} is only used in indirect, post-increment or
15499 pre-decrement addressing.
15500
15501 Without this option, the @code{X} register may be used in the same way
15502 as @code{Y} or @code{Z} which then is emulated by additional
15503 instructions.
15504 For example, loading a value with @code{X+const} addressing with a
15505 small non-negative @code{const < 64} to a register @var{Rn} is
15506 performed as
15507
15508 @example
15509 adiw r26, const ; X += const
15510 ld @var{Rn}, X ; @var{Rn} = *X
15511 sbiw r26, const ; X -= const
15512 @end example
15513
15514 @item -mtiny-stack
15515 @opindex mtiny-stack
15516 Only change the lower 8@tie{}bits of the stack pointer.
15517
15518 @item -mfract-convert-truncate
15519 @opindex mfract-convert-truncate
15520 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
15521
15522 @item -nodevicelib
15523 @opindex nodevicelib
15524 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
15525
15526 @item -Waddr-space-convert
15527 @opindex Waddr-space-convert
15528 Warn about conversions between address spaces in the case where the
15529 resulting address space is not contained in the incoming address space.
15530
15531 @item -Wmisspelled-isr
15532 @opindex Wmisspelled-isr
15533 Warn if the ISR is misspelled, i.e. without __vector prefix.
15534 Enabled by default.
15535 @end table
15536
15537 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
15538 @cindex @code{EIND}
15539 Pointers in the implementation are 16@tie{}bits wide.
15540 The address of a function or label is represented as word address so
15541 that indirect jumps and calls can target any code address in the
15542 range of 64@tie{}Ki words.
15543
15544 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
15545 bytes of program memory space, there is a special function register called
15546 @code{EIND} that serves as most significant part of the target address
15547 when @code{EICALL} or @code{EIJMP} instructions are used.
15548
15549 Indirect jumps and calls on these devices are handled as follows by
15550 the compiler and are subject to some limitations:
15551
15552 @itemize @bullet
15553
15554 @item
15555 The compiler never sets @code{EIND}.
15556
15557 @item
15558 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
15559 instructions or might read @code{EIND} directly in order to emulate an
15560 indirect call/jump by means of a @code{RET} instruction.
15561
15562 @item
15563 The compiler assumes that @code{EIND} never changes during the startup
15564 code or during the application. In particular, @code{EIND} is not
15565 saved/restored in function or interrupt service routine
15566 prologue/epilogue.
15567
15568 @item
15569 For indirect calls to functions and computed goto, the linker
15570 generates @emph{stubs}. Stubs are jump pads sometimes also called
15571 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
15572 The stub contains a direct jump to the desired address.
15573
15574 @item
15575 Linker relaxation must be turned on so that the linker generates
15576 the stubs correctly in all situations. See the compiler option
15577 @option{-mrelax} and the linker option @option{--relax}.
15578 There are corner cases where the linker is supposed to generate stubs
15579 but aborts without relaxation and without a helpful error message.
15580
15581 @item
15582 The default linker script is arranged for code with @code{EIND = 0}.
15583 If code is supposed to work for a setup with @code{EIND != 0}, a custom
15584 linker script has to be used in order to place the sections whose
15585 name start with @code{.trampolines} into the segment where @code{EIND}
15586 points to.
15587
15588 @item
15589 The startup code from libgcc never sets @code{EIND}.
15590 Notice that startup code is a blend of code from libgcc and AVR-LibC.
15591 For the impact of AVR-LibC on @code{EIND}, see the
15592 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
15593
15594 @item
15595 It is legitimate for user-specific startup code to set up @code{EIND}
15596 early, for example by means of initialization code located in
15597 section @code{.init3}. Such code runs prior to general startup code
15598 that initializes RAM and calls constructors, but after the bit
15599 of startup code from AVR-LibC that sets @code{EIND} to the segment
15600 where the vector table is located.
15601 @example
15602 #include <avr/io.h>
15603
15604 static void
15605 __attribute__((section(".init3"),naked,used,no_instrument_function))
15606 init3_set_eind (void)
15607 @{
15608 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
15609 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
15610 @}
15611 @end example
15612
15613 @noindent
15614 The @code{__trampolines_start} symbol is defined in the linker script.
15615
15616 @item
15617 Stubs are generated automatically by the linker if
15618 the following two conditions are met:
15619 @itemize @minus
15620
15621 @item The address of a label is taken by means of the @code{gs} modifier
15622 (short for @emph{generate stubs}) like so:
15623 @example
15624 LDI r24, lo8(gs(@var{func}))
15625 LDI r25, hi8(gs(@var{func}))
15626 @end example
15627 @item The final location of that label is in a code segment
15628 @emph{outside} the segment where the stubs are located.
15629 @end itemize
15630
15631 @item
15632 The compiler emits such @code{gs} modifiers for code labels in the
15633 following situations:
15634 @itemize @minus
15635 @item Taking address of a function or code label.
15636 @item Computed goto.
15637 @item If prologue-save function is used, see @option{-mcall-prologues}
15638 command-line option.
15639 @item Switch/case dispatch tables. If you do not want such dispatch
15640 tables you can specify the @option{-fno-jump-tables} command-line option.
15641 @item C and C++ constructors/destructors called during startup/shutdown.
15642 @item If the tools hit a @code{gs()} modifier explained above.
15643 @end itemize
15644
15645 @item
15646 Jumping to non-symbolic addresses like so is @emph{not} supported:
15647
15648 @example
15649 int main (void)
15650 @{
15651 /* Call function at word address 0x2 */
15652 return ((int(*)(void)) 0x2)();
15653 @}
15654 @end example
15655
15656 Instead, a stub has to be set up, i.e.@: the function has to be called
15657 through a symbol (@code{func_4} in the example):
15658
15659 @example
15660 int main (void)
15661 @{
15662 extern int func_4 (void);
15663
15664 /* Call function at byte address 0x4 */
15665 return func_4();
15666 @}
15667 @end example
15668
15669 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
15670 Alternatively, @code{func_4} can be defined in the linker script.
15671 @end itemize
15672
15673 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
15674 @cindex @code{RAMPD}
15675 @cindex @code{RAMPX}
15676 @cindex @code{RAMPY}
15677 @cindex @code{RAMPZ}
15678 Some AVR devices support memories larger than the 64@tie{}KiB range
15679 that can be accessed with 16-bit pointers. To access memory locations
15680 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
15681 register is used as high part of the address:
15682 The @code{X}, @code{Y}, @code{Z} address register is concatenated
15683 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
15684 register, respectively, to get a wide address. Similarly,
15685 @code{RAMPD} is used together with direct addressing.
15686
15687 @itemize
15688 @item
15689 The startup code initializes the @code{RAMP} special function
15690 registers with zero.
15691
15692 @item
15693 If a @ref{AVR Named Address Spaces,named address space} other than
15694 generic or @code{__flash} is used, then @code{RAMPZ} is set
15695 as needed before the operation.
15696
15697 @item
15698 If the device supports RAM larger than 64@tie{}KiB and the compiler
15699 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
15700 is reset to zero after the operation.
15701
15702 @item
15703 If the device comes with a specific @code{RAMP} register, the ISR
15704 prologue/epilogue saves/restores that SFR and initializes it with
15705 zero in case the ISR code might (implicitly) use it.
15706
15707 @item
15708 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
15709 If you use inline assembler to read from locations outside the
15710 16-bit address range and change one of the @code{RAMP} registers,
15711 you must reset it to zero after the access.
15712
15713 @end itemize
15714
15715 @subsubsection AVR Built-in Macros
15716
15717 GCC defines several built-in macros so that the user code can test
15718 for the presence or absence of features. Almost any of the following
15719 built-in macros are deduced from device capabilities and thus
15720 triggered by the @option{-mmcu=} command-line option.
15721
15722 For even more AVR-specific built-in macros see
15723 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
15724
15725 @table @code
15726
15727 @item __AVR_ARCH__
15728 Build-in macro that resolves to a decimal number that identifies the
15729 architecture and depends on the @option{-mmcu=@var{mcu}} option.
15730 Possible values are:
15731
15732 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
15733 @code{4}, @code{5}, @code{51}, @code{6}
15734
15735 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
15736 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
15737
15738 respectively and
15739
15740 @code{100}, @code{102}, @code{104},
15741 @code{105}, @code{106}, @code{107}
15742
15743 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
15744 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
15745 If @var{mcu} specifies a device, this built-in macro is set
15746 accordingly. For example, with @option{-mmcu=atmega8} the macro is
15747 defined to @code{4}.
15748
15749 @item __AVR_@var{Device}__
15750 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
15751 the device's name. For example, @option{-mmcu=atmega8} defines the
15752 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
15753 @code{__AVR_ATtiny261A__}, etc.
15754
15755 The built-in macros' names follow
15756 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
15757 the device name as from the AVR user manual. The difference between
15758 @var{Device} in the built-in macro and @var{device} in
15759 @option{-mmcu=@var{device}} is that the latter is always lowercase.
15760
15761 If @var{device} is not a device but only a core architecture like
15762 @samp{avr51}, this macro is not defined.
15763
15764 @item __AVR_DEVICE_NAME__
15765 Setting @option{-mmcu=@var{device}} defines this built-in macro to
15766 the device's name. For example, with @option{-mmcu=atmega8} the macro
15767 is defined to @code{atmega8}.
15768
15769 If @var{device} is not a device but only a core architecture like
15770 @samp{avr51}, this macro is not defined.
15771
15772 @item __AVR_XMEGA__
15773 The device / architecture belongs to the XMEGA family of devices.
15774
15775 @item __AVR_HAVE_ELPM__
15776 The device has the @code{ELPM} instruction.
15777
15778 @item __AVR_HAVE_ELPMX__
15779 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
15780 R@var{n},Z+} instructions.
15781
15782 @item __AVR_HAVE_MOVW__
15783 The device has the @code{MOVW} instruction to perform 16-bit
15784 register-register moves.
15785
15786 @item __AVR_HAVE_LPMX__
15787 The device has the @code{LPM R@var{n},Z} and
15788 @code{LPM R@var{n},Z+} instructions.
15789
15790 @item __AVR_HAVE_MUL__
15791 The device has a hardware multiplier.
15792
15793 @item __AVR_HAVE_JMP_CALL__
15794 The device has the @code{JMP} and @code{CALL} instructions.
15795 This is the case for devices with at least 16@tie{}KiB of program
15796 memory.
15797
15798 @item __AVR_HAVE_EIJMP_EICALL__
15799 @itemx __AVR_3_BYTE_PC__
15800 The device has the @code{EIJMP} and @code{EICALL} instructions.
15801 This is the case for devices with more than 128@tie{}KiB of program memory.
15802 This also means that the program counter
15803 (PC) is 3@tie{}bytes wide.
15804
15805 @item __AVR_2_BYTE_PC__
15806 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
15807 with up to 128@tie{}KiB of program memory.
15808
15809 @item __AVR_HAVE_8BIT_SP__
15810 @itemx __AVR_HAVE_16BIT_SP__
15811 The stack pointer (SP) register is treated as 8-bit respectively
15812 16-bit register by the compiler.
15813 The definition of these macros is affected by @option{-mtiny-stack}.
15814
15815 @item __AVR_HAVE_SPH__
15816 @itemx __AVR_SP8__
15817 The device has the SPH (high part of stack pointer) special function
15818 register or has an 8-bit stack pointer, respectively.
15819 The definition of these macros is affected by @option{-mmcu=} and
15820 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
15821 by @option{-msp8}.
15822
15823 @item __AVR_HAVE_RAMPD__
15824 @itemx __AVR_HAVE_RAMPX__
15825 @itemx __AVR_HAVE_RAMPY__
15826 @itemx __AVR_HAVE_RAMPZ__
15827 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
15828 @code{RAMPZ} special function register, respectively.
15829
15830 @item __NO_INTERRUPTS__
15831 This macro reflects the @option{-mno-interrupts} command-line option.
15832
15833 @item __AVR_ERRATA_SKIP__
15834 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
15835 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
15836 instructions because of a hardware erratum. Skip instructions are
15837 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
15838 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
15839 set.
15840
15841 @item __AVR_ISA_RMW__
15842 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
15843
15844 @item __AVR_SFR_OFFSET__=@var{offset}
15845 Instructions that can address I/O special function registers directly
15846 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
15847 address as if addressed by an instruction to access RAM like @code{LD}
15848 or @code{STS}. This offset depends on the device architecture and has
15849 to be subtracted from the RAM address in order to get the
15850 respective I/O@tie{}address.
15851
15852 @item __WITH_AVRLIBC__
15853 The compiler is configured to be used together with AVR-Libc.
15854 See the @option{--with-avrlibc} configure option.
15855
15856 @end table
15857
15858 @node Blackfin Options
15859 @subsection Blackfin Options
15860 @cindex Blackfin Options
15861
15862 @table @gcctabopt
15863 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
15864 @opindex mcpu=
15865 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
15866 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
15867 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
15868 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
15869 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
15870 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
15871 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
15872 @samp{bf561}, @samp{bf592}.
15873
15874 The optional @var{sirevision} specifies the silicon revision of the target
15875 Blackfin processor. Any workarounds available for the targeted silicon revision
15876 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
15877 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
15878 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
15879 hexadecimal digits representing the major and minor numbers in the silicon
15880 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
15881 is not defined. If @var{sirevision} is @samp{any}, the
15882 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
15883 If this optional @var{sirevision} is not used, GCC assumes the latest known
15884 silicon revision of the targeted Blackfin processor.
15885
15886 GCC defines a preprocessor macro for the specified @var{cpu}.
15887 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
15888 provided by libgloss to be linked in if @option{-msim} is not given.
15889
15890 Without this option, @samp{bf532} is used as the processor by default.
15891
15892 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
15893 only the preprocessor macro is defined.
15894
15895 @item -msim
15896 @opindex msim
15897 Specifies that the program will be run on the simulator. This causes
15898 the simulator BSP provided by libgloss to be linked in. This option
15899 has effect only for @samp{bfin-elf} toolchain.
15900 Certain other options, such as @option{-mid-shared-library} and
15901 @option{-mfdpic}, imply @option{-msim}.
15902
15903 @item -momit-leaf-frame-pointer
15904 @opindex momit-leaf-frame-pointer
15905 Don't keep the frame pointer in a register for leaf functions. This
15906 avoids the instructions to save, set up and restore frame pointers and
15907 makes an extra register available in leaf functions. The option
15908 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
15909 which might make debugging harder.
15910
15911 @item -mspecld-anomaly
15912 @opindex mspecld-anomaly
15913 When enabled, the compiler ensures that the generated code does not
15914 contain speculative loads after jump instructions. If this option is used,
15915 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
15916
15917 @item -mno-specld-anomaly
15918 @opindex mno-specld-anomaly
15919 Don't generate extra code to prevent speculative loads from occurring.
15920
15921 @item -mcsync-anomaly
15922 @opindex mcsync-anomaly
15923 When enabled, the compiler ensures that the generated code does not
15924 contain CSYNC or SSYNC instructions too soon after conditional branches.
15925 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
15926
15927 @item -mno-csync-anomaly
15928 @opindex mno-csync-anomaly
15929 Don't generate extra code to prevent CSYNC or SSYNC instructions from
15930 occurring too soon after a conditional branch.
15931
15932 @item -mlow-64k
15933 @opindex mlow-64k
15934 When enabled, the compiler is free to take advantage of the knowledge that
15935 the entire program fits into the low 64k of memory.
15936
15937 @item -mno-low-64k
15938 @opindex mno-low-64k
15939 Assume that the program is arbitrarily large. This is the default.
15940
15941 @item -mstack-check-l1
15942 @opindex mstack-check-l1
15943 Do stack checking using information placed into L1 scratchpad memory by the
15944 uClinux kernel.
15945
15946 @item -mid-shared-library
15947 @opindex mid-shared-library
15948 Generate code that supports shared libraries via the library ID method.
15949 This allows for execute in place and shared libraries in an environment
15950 without virtual memory management. This option implies @option{-fPIC}.
15951 With a @samp{bfin-elf} target, this option implies @option{-msim}.
15952
15953 @item -mno-id-shared-library
15954 @opindex mno-id-shared-library
15955 Generate code that doesn't assume ID-based shared libraries are being used.
15956 This is the default.
15957
15958 @item -mleaf-id-shared-library
15959 @opindex mleaf-id-shared-library
15960 Generate code that supports shared libraries via the library ID method,
15961 but assumes that this library or executable won't link against any other
15962 ID shared libraries. That allows the compiler to use faster code for jumps
15963 and calls.
15964
15965 @item -mno-leaf-id-shared-library
15966 @opindex mno-leaf-id-shared-library
15967 Do not assume that the code being compiled won't link against any ID shared
15968 libraries. Slower code is generated for jump and call insns.
15969
15970 @item -mshared-library-id=n
15971 @opindex mshared-library-id
15972 Specifies the identification number of the ID-based shared library being
15973 compiled. Specifying a value of 0 generates more compact code; specifying
15974 other values forces the allocation of that number to the current
15975 library but is no more space- or time-efficient than omitting this option.
15976
15977 @item -msep-data
15978 @opindex msep-data
15979 Generate code that allows the data segment to be located in a different
15980 area of memory from the text segment. This allows for execute in place in
15981 an environment without virtual memory management by eliminating relocations
15982 against the text section.
15983
15984 @item -mno-sep-data
15985 @opindex mno-sep-data
15986 Generate code that assumes that the data segment follows the text segment.
15987 This is the default.
15988
15989 @item -mlong-calls
15990 @itemx -mno-long-calls
15991 @opindex mlong-calls
15992 @opindex mno-long-calls
15993 Tells the compiler to perform function calls by first loading the
15994 address of the function into a register and then performing a subroutine
15995 call on this register. This switch is needed if the target function
15996 lies outside of the 24-bit addressing range of the offset-based
15997 version of subroutine call instruction.
15998
15999 This feature is not enabled by default. Specifying
16000 @option{-mno-long-calls} restores the default behavior. Note these
16001 switches have no effect on how the compiler generates code to handle
16002 function calls via function pointers.
16003
16004 @item -mfast-fp
16005 @opindex mfast-fp
16006 Link with the fast floating-point library. This library relaxes some of
16007 the IEEE floating-point standard's rules for checking inputs against
16008 Not-a-Number (NAN), in the interest of performance.
16009
16010 @item -minline-plt
16011 @opindex minline-plt
16012 Enable inlining of PLT entries in function calls to functions that are
16013 not known to bind locally. It has no effect without @option{-mfdpic}.
16014
16015 @item -mmulticore
16016 @opindex mmulticore
16017 Build a standalone application for multicore Blackfin processors.
16018 This option causes proper start files and link scripts supporting
16019 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
16020 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
16021
16022 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
16023 selects the one-application-per-core programming model. Without
16024 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
16025 programming model is used. In this model, the main function of Core B
16026 should be named as @code{coreb_main}.
16027
16028 If this option is not used, the single-core application programming
16029 model is used.
16030
16031 @item -mcorea
16032 @opindex mcorea
16033 Build a standalone application for Core A of BF561 when using
16034 the one-application-per-core programming model. Proper start files
16035 and link scripts are used to support Core A, and the macro
16036 @code{__BFIN_COREA} is defined.
16037 This option can only be used in conjunction with @option{-mmulticore}.
16038
16039 @item -mcoreb
16040 @opindex mcoreb
16041 Build a standalone application for Core B of BF561 when using
16042 the one-application-per-core programming model. Proper start files
16043 and link scripts are used to support Core B, and the macro
16044 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
16045 should be used instead of @code{main}.
16046 This option can only be used in conjunction with @option{-mmulticore}.
16047
16048 @item -msdram
16049 @opindex msdram
16050 Build a standalone application for SDRAM. Proper start files and
16051 link scripts are used to put the application into SDRAM, and the macro
16052 @code{__BFIN_SDRAM} is defined.
16053 The loader should initialize SDRAM before loading the application.
16054
16055 @item -micplb
16056 @opindex micplb
16057 Assume that ICPLBs are enabled at run time. This has an effect on certain
16058 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
16059 are enabled; for standalone applications the default is off.
16060 @end table
16061
16062 @node C6X Options
16063 @subsection C6X Options
16064 @cindex C6X Options
16065
16066 @table @gcctabopt
16067 @item -march=@var{name}
16068 @opindex march
16069 This specifies the name of the target architecture. GCC uses this
16070 name to determine what kind of instructions it can emit when generating
16071 assembly code. Permissible names are: @samp{c62x},
16072 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
16073
16074 @item -mbig-endian
16075 @opindex mbig-endian
16076 Generate code for a big-endian target.
16077
16078 @item -mlittle-endian
16079 @opindex mlittle-endian
16080 Generate code for a little-endian target. This is the default.
16081
16082 @item -msim
16083 @opindex msim
16084 Choose startup files and linker script suitable for the simulator.
16085
16086 @item -msdata=default
16087 @opindex msdata=default
16088 Put small global and static data in the @code{.neardata} section,
16089 which is pointed to by register @code{B14}. Put small uninitialized
16090 global and static data in the @code{.bss} section, which is adjacent
16091 to the @code{.neardata} section. Put small read-only data into the
16092 @code{.rodata} section. The corresponding sections used for large
16093 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
16094
16095 @item -msdata=all
16096 @opindex msdata=all
16097 Put all data, not just small objects, into the sections reserved for
16098 small data, and use addressing relative to the @code{B14} register to
16099 access them.
16100
16101 @item -msdata=none
16102 @opindex msdata=none
16103 Make no use of the sections reserved for small data, and use absolute
16104 addresses to access all data. Put all initialized global and static
16105 data in the @code{.fardata} section, and all uninitialized data in the
16106 @code{.far} section. Put all constant data into the @code{.const}
16107 section.
16108 @end table
16109
16110 @node CRIS Options
16111 @subsection CRIS Options
16112 @cindex CRIS Options
16113
16114 These options are defined specifically for the CRIS ports.
16115
16116 @table @gcctabopt
16117 @item -march=@var{architecture-type}
16118 @itemx -mcpu=@var{architecture-type}
16119 @opindex march
16120 @opindex mcpu
16121 Generate code for the specified architecture. The choices for
16122 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
16123 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
16124 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
16125 @samp{v10}.
16126
16127 @item -mtune=@var{architecture-type}
16128 @opindex mtune
16129 Tune to @var{architecture-type} everything applicable about the generated
16130 code, except for the ABI and the set of available instructions. The
16131 choices for @var{architecture-type} are the same as for
16132 @option{-march=@var{architecture-type}}.
16133
16134 @item -mmax-stack-frame=@var{n}
16135 @opindex mmax-stack-frame
16136 Warn when the stack frame of a function exceeds @var{n} bytes.
16137
16138 @item -metrax4
16139 @itemx -metrax100
16140 @opindex metrax4
16141 @opindex metrax100
16142 The options @option{-metrax4} and @option{-metrax100} are synonyms for
16143 @option{-march=v3} and @option{-march=v8} respectively.
16144
16145 @item -mmul-bug-workaround
16146 @itemx -mno-mul-bug-workaround
16147 @opindex mmul-bug-workaround
16148 @opindex mno-mul-bug-workaround
16149 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
16150 models where it applies. This option is active by default.
16151
16152 @item -mpdebug
16153 @opindex mpdebug
16154 Enable CRIS-specific verbose debug-related information in the assembly
16155 code. This option also has the effect of turning off the @samp{#NO_APP}
16156 formatted-code indicator to the assembler at the beginning of the
16157 assembly file.
16158
16159 @item -mcc-init
16160 @opindex mcc-init
16161 Do not use condition-code results from previous instruction; always emit
16162 compare and test instructions before use of condition codes.
16163
16164 @item -mno-side-effects
16165 @opindex mno-side-effects
16166 Do not emit instructions with side effects in addressing modes other than
16167 post-increment.
16168
16169 @item -mstack-align
16170 @itemx -mno-stack-align
16171 @itemx -mdata-align
16172 @itemx -mno-data-align
16173 @itemx -mconst-align
16174 @itemx -mno-const-align
16175 @opindex mstack-align
16176 @opindex mno-stack-align
16177 @opindex mdata-align
16178 @opindex mno-data-align
16179 @opindex mconst-align
16180 @opindex mno-const-align
16181 These options (@samp{no-} options) arrange (eliminate arrangements) for the
16182 stack frame, individual data and constants to be aligned for the maximum
16183 single data access size for the chosen CPU model. The default is to
16184 arrange for 32-bit alignment. ABI details such as structure layout are
16185 not affected by these options.
16186
16187 @item -m32-bit
16188 @itemx -m16-bit
16189 @itemx -m8-bit
16190 @opindex m32-bit
16191 @opindex m16-bit
16192 @opindex m8-bit
16193 Similar to the stack- data- and const-align options above, these options
16194 arrange for stack frame, writable data and constants to all be 32-bit,
16195 16-bit or 8-bit aligned. The default is 32-bit alignment.
16196
16197 @item -mno-prologue-epilogue
16198 @itemx -mprologue-epilogue
16199 @opindex mno-prologue-epilogue
16200 @opindex mprologue-epilogue
16201 With @option{-mno-prologue-epilogue}, the normal function prologue and
16202 epilogue which set up the stack frame are omitted and no return
16203 instructions or return sequences are generated in the code. Use this
16204 option only together with visual inspection of the compiled code: no
16205 warnings or errors are generated when call-saved registers must be saved,
16206 or storage for local variables needs to be allocated.
16207
16208 @item -mno-gotplt
16209 @itemx -mgotplt
16210 @opindex mno-gotplt
16211 @opindex mgotplt
16212 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
16213 instruction sequences that load addresses for functions from the PLT part
16214 of the GOT rather than (traditional on other architectures) calls to the
16215 PLT@. The default is @option{-mgotplt}.
16216
16217 @item -melf
16218 @opindex melf
16219 Legacy no-op option only recognized with the cris-axis-elf and
16220 cris-axis-linux-gnu targets.
16221
16222 @item -mlinux
16223 @opindex mlinux
16224 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
16225
16226 @item -sim
16227 @opindex sim
16228 This option, recognized for the cris-axis-elf, arranges
16229 to link with input-output functions from a simulator library. Code,
16230 initialized data and zero-initialized data are allocated consecutively.
16231
16232 @item -sim2
16233 @opindex sim2
16234 Like @option{-sim}, but pass linker options to locate initialized data at
16235 0x40000000 and zero-initialized data at 0x80000000.
16236 @end table
16237
16238 @node CR16 Options
16239 @subsection CR16 Options
16240 @cindex CR16 Options
16241
16242 These options are defined specifically for the CR16 ports.
16243
16244 @table @gcctabopt
16245
16246 @item -mmac
16247 @opindex mmac
16248 Enable the use of multiply-accumulate instructions. Disabled by default.
16249
16250 @item -mcr16cplus
16251 @itemx -mcr16c
16252 @opindex mcr16cplus
16253 @opindex mcr16c
16254 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
16255 is default.
16256
16257 @item -msim
16258 @opindex msim
16259 Links the library libsim.a which is in compatible with simulator. Applicable
16260 to ELF compiler only.
16261
16262 @item -mint32
16263 @opindex mint32
16264 Choose integer type as 32-bit wide.
16265
16266 @item -mbit-ops
16267 @opindex mbit-ops
16268 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
16269
16270 @item -mdata-model=@var{model}
16271 @opindex mdata-model
16272 Choose a data model. The choices for @var{model} are @samp{near},
16273 @samp{far} or @samp{medium}. @samp{medium} is default.
16274 However, @samp{far} is not valid with @option{-mcr16c}, as the
16275 CR16C architecture does not support the far data model.
16276 @end table
16277
16278 @node Darwin Options
16279 @subsection Darwin Options
16280 @cindex Darwin options
16281
16282 These options are defined for all architectures running the Darwin operating
16283 system.
16284
16285 FSF GCC on Darwin does not create ``fat'' object files; it creates
16286 an object file for the single architecture that GCC was built to
16287 target. Apple's GCC on Darwin does create ``fat'' files if multiple
16288 @option{-arch} options are used; it does so by running the compiler or
16289 linker multiple times and joining the results together with
16290 @file{lipo}.
16291
16292 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
16293 @samp{i686}) is determined by the flags that specify the ISA
16294 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
16295 @option{-force_cpusubtype_ALL} option can be used to override this.
16296
16297 The Darwin tools vary in their behavior when presented with an ISA
16298 mismatch. The assembler, @file{as}, only permits instructions to
16299 be used that are valid for the subtype of the file it is generating,
16300 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
16301 The linker for shared libraries, @file{/usr/bin/libtool}, fails
16302 and prints an error if asked to create a shared library with a less
16303 restrictive subtype than its input files (for instance, trying to put
16304 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
16305 for executables, @command{ld}, quietly gives the executable the most
16306 restrictive subtype of any of its input files.
16307
16308 @table @gcctabopt
16309 @item -F@var{dir}
16310 @opindex F
16311 Add the framework directory @var{dir} to the head of the list of
16312 directories to be searched for header files. These directories are
16313 interleaved with those specified by @option{-I} options and are
16314 scanned in a left-to-right order.
16315
16316 A framework directory is a directory with frameworks in it. A
16317 framework is a directory with a @file{Headers} and/or
16318 @file{PrivateHeaders} directory contained directly in it that ends
16319 in @file{.framework}. The name of a framework is the name of this
16320 directory excluding the @file{.framework}. Headers associated with
16321 the framework are found in one of those two directories, with
16322 @file{Headers} being searched first. A subframework is a framework
16323 directory that is in a framework's @file{Frameworks} directory.
16324 Includes of subframework headers can only appear in a header of a
16325 framework that contains the subframework, or in a sibling subframework
16326 header. Two subframeworks are siblings if they occur in the same
16327 framework. A subframework should not have the same name as a
16328 framework; a warning is issued if this is violated. Currently a
16329 subframework cannot have subframeworks; in the future, the mechanism
16330 may be extended to support this. The standard frameworks can be found
16331 in @file{/System/Library/Frameworks} and
16332 @file{/Library/Frameworks}. An example include looks like
16333 @code{#include <Framework/header.h>}, where @file{Framework} denotes
16334 the name of the framework and @file{header.h} is found in the
16335 @file{PrivateHeaders} or @file{Headers} directory.
16336
16337 @item -iframework@var{dir}
16338 @opindex iframework
16339 Like @option{-F} except the directory is a treated as a system
16340 directory. The main difference between this @option{-iframework} and
16341 @option{-F} is that with @option{-iframework} the compiler does not
16342 warn about constructs contained within header files found via
16343 @var{dir}. This option is valid only for the C family of languages.
16344
16345 @item -gused
16346 @opindex gused
16347 Emit debugging information for symbols that are used. For stabs
16348 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
16349 This is by default ON@.
16350
16351 @item -gfull
16352 @opindex gfull
16353 Emit debugging information for all symbols and types.
16354
16355 @item -mmacosx-version-min=@var{version}
16356 The earliest version of MacOS X that this executable will run on
16357 is @var{version}. Typical values of @var{version} include @code{10.1},
16358 @code{10.2}, and @code{10.3.9}.
16359
16360 If the compiler was built to use the system's headers by default,
16361 then the default for this option is the system version on which the
16362 compiler is running, otherwise the default is to make choices that
16363 are compatible with as many systems and code bases as possible.
16364
16365 @item -mkernel
16366 @opindex mkernel
16367 Enable kernel development mode. The @option{-mkernel} option sets
16368 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
16369 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
16370 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
16371 applicable. This mode also sets @option{-mno-altivec},
16372 @option{-msoft-float}, @option{-fno-builtin} and
16373 @option{-mlong-branch} for PowerPC targets.
16374
16375 @item -mone-byte-bool
16376 @opindex mone-byte-bool
16377 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
16378 By default @code{sizeof(bool)} is @code{4} when compiling for
16379 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
16380 option has no effect on x86.
16381
16382 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
16383 to generate code that is not binary compatible with code generated
16384 without that switch. Using this switch may require recompiling all
16385 other modules in a program, including system libraries. Use this
16386 switch to conform to a non-default data model.
16387
16388 @item -mfix-and-continue
16389 @itemx -ffix-and-continue
16390 @itemx -findirect-data
16391 @opindex mfix-and-continue
16392 @opindex ffix-and-continue
16393 @opindex findirect-data
16394 Generate code suitable for fast turnaround development, such as to
16395 allow GDB to dynamically load @file{.o} files into already-running
16396 programs. @option{-findirect-data} and @option{-ffix-and-continue}
16397 are provided for backwards compatibility.
16398
16399 @item -all_load
16400 @opindex all_load
16401 Loads all members of static archive libraries.
16402 See man ld(1) for more information.
16403
16404 @item -arch_errors_fatal
16405 @opindex arch_errors_fatal
16406 Cause the errors having to do with files that have the wrong architecture
16407 to be fatal.
16408
16409 @item -bind_at_load
16410 @opindex bind_at_load
16411 Causes the output file to be marked such that the dynamic linker will
16412 bind all undefined references when the file is loaded or launched.
16413
16414 @item -bundle
16415 @opindex bundle
16416 Produce a Mach-o bundle format file.
16417 See man ld(1) for more information.
16418
16419 @item -bundle_loader @var{executable}
16420 @opindex bundle_loader
16421 This option specifies the @var{executable} that will load the build
16422 output file being linked. See man ld(1) for more information.
16423
16424 @item -dynamiclib
16425 @opindex dynamiclib
16426 When passed this option, GCC produces a dynamic library instead of
16427 an executable when linking, using the Darwin @file{libtool} command.
16428
16429 @item -force_cpusubtype_ALL
16430 @opindex force_cpusubtype_ALL
16431 This causes GCC's output file to have the @samp{ALL} subtype, instead of
16432 one controlled by the @option{-mcpu} or @option{-march} option.
16433
16434 @item -allowable_client @var{client_name}
16435 @itemx -client_name
16436 @itemx -compatibility_version
16437 @itemx -current_version
16438 @itemx -dead_strip
16439 @itemx -dependency-file
16440 @itemx -dylib_file
16441 @itemx -dylinker_install_name
16442 @itemx -dynamic
16443 @itemx -exported_symbols_list
16444 @itemx -filelist
16445 @need 800
16446 @itemx -flat_namespace
16447 @itemx -force_flat_namespace
16448 @itemx -headerpad_max_install_names
16449 @itemx -image_base
16450 @itemx -init
16451 @itemx -install_name
16452 @itemx -keep_private_externs
16453 @itemx -multi_module
16454 @itemx -multiply_defined
16455 @itemx -multiply_defined_unused
16456 @need 800
16457 @itemx -noall_load
16458 @itemx -no_dead_strip_inits_and_terms
16459 @itemx -nofixprebinding
16460 @itemx -nomultidefs
16461 @itemx -noprebind
16462 @itemx -noseglinkedit
16463 @itemx -pagezero_size
16464 @itemx -prebind
16465 @itemx -prebind_all_twolevel_modules
16466 @itemx -private_bundle
16467 @need 800
16468 @itemx -read_only_relocs
16469 @itemx -sectalign
16470 @itemx -sectobjectsymbols
16471 @itemx -whyload
16472 @itemx -seg1addr
16473 @itemx -sectcreate
16474 @itemx -sectobjectsymbols
16475 @itemx -sectorder
16476 @itemx -segaddr
16477 @itemx -segs_read_only_addr
16478 @need 800
16479 @itemx -segs_read_write_addr
16480 @itemx -seg_addr_table
16481 @itemx -seg_addr_table_filename
16482 @itemx -seglinkedit
16483 @itemx -segprot
16484 @itemx -segs_read_only_addr
16485 @itemx -segs_read_write_addr
16486 @itemx -single_module
16487 @itemx -static
16488 @itemx -sub_library
16489 @need 800
16490 @itemx -sub_umbrella
16491 @itemx -twolevel_namespace
16492 @itemx -umbrella
16493 @itemx -undefined
16494 @itemx -unexported_symbols_list
16495 @itemx -weak_reference_mismatches
16496 @itemx -whatsloaded
16497 @opindex allowable_client
16498 @opindex client_name
16499 @opindex compatibility_version
16500 @opindex current_version
16501 @opindex dead_strip
16502 @opindex dependency-file
16503 @opindex dylib_file
16504 @opindex dylinker_install_name
16505 @opindex dynamic
16506 @opindex exported_symbols_list
16507 @opindex filelist
16508 @opindex flat_namespace
16509 @opindex force_flat_namespace
16510 @opindex headerpad_max_install_names
16511 @opindex image_base
16512 @opindex init
16513 @opindex install_name
16514 @opindex keep_private_externs
16515 @opindex multi_module
16516 @opindex multiply_defined
16517 @opindex multiply_defined_unused
16518 @opindex noall_load
16519 @opindex no_dead_strip_inits_and_terms
16520 @opindex nofixprebinding
16521 @opindex nomultidefs
16522 @opindex noprebind
16523 @opindex noseglinkedit
16524 @opindex pagezero_size
16525 @opindex prebind
16526 @opindex prebind_all_twolevel_modules
16527 @opindex private_bundle
16528 @opindex read_only_relocs
16529 @opindex sectalign
16530 @opindex sectobjectsymbols
16531 @opindex whyload
16532 @opindex seg1addr
16533 @opindex sectcreate
16534 @opindex sectobjectsymbols
16535 @opindex sectorder
16536 @opindex segaddr
16537 @opindex segs_read_only_addr
16538 @opindex segs_read_write_addr
16539 @opindex seg_addr_table
16540 @opindex seg_addr_table_filename
16541 @opindex seglinkedit
16542 @opindex segprot
16543 @opindex segs_read_only_addr
16544 @opindex segs_read_write_addr
16545 @opindex single_module
16546 @opindex static
16547 @opindex sub_library
16548 @opindex sub_umbrella
16549 @opindex twolevel_namespace
16550 @opindex umbrella
16551 @opindex undefined
16552 @opindex unexported_symbols_list
16553 @opindex weak_reference_mismatches
16554 @opindex whatsloaded
16555 These options are passed to the Darwin linker. The Darwin linker man page
16556 describes them in detail.
16557 @end table
16558
16559 @node DEC Alpha Options
16560 @subsection DEC Alpha Options
16561
16562 These @samp{-m} options are defined for the DEC Alpha implementations:
16563
16564 @table @gcctabopt
16565 @item -mno-soft-float
16566 @itemx -msoft-float
16567 @opindex mno-soft-float
16568 @opindex msoft-float
16569 Use (do not use) the hardware floating-point instructions for
16570 floating-point operations. When @option{-msoft-float} is specified,
16571 functions in @file{libgcc.a} are used to perform floating-point
16572 operations. Unless they are replaced by routines that emulate the
16573 floating-point operations, or compiled in such a way as to call such
16574 emulations routines, these routines issue floating-point
16575 operations. If you are compiling for an Alpha without floating-point
16576 operations, you must ensure that the library is built so as not to call
16577 them.
16578
16579 Note that Alpha implementations without floating-point operations are
16580 required to have floating-point registers.
16581
16582 @item -mfp-reg
16583 @itemx -mno-fp-regs
16584 @opindex mfp-reg
16585 @opindex mno-fp-regs
16586 Generate code that uses (does not use) the floating-point register set.
16587 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
16588 register set is not used, floating-point operands are passed in integer
16589 registers as if they were integers and floating-point results are passed
16590 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
16591 so any function with a floating-point argument or return value called by code
16592 compiled with @option{-mno-fp-regs} must also be compiled with that
16593 option.
16594
16595 A typical use of this option is building a kernel that does not use,
16596 and hence need not save and restore, any floating-point registers.
16597
16598 @item -mieee
16599 @opindex mieee
16600 The Alpha architecture implements floating-point hardware optimized for
16601 maximum performance. It is mostly compliant with the IEEE floating-point
16602 standard. However, for full compliance, software assistance is
16603 required. This option generates code fully IEEE-compliant code
16604 @emph{except} that the @var{inexact-flag} is not maintained (see below).
16605 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
16606 defined during compilation. The resulting code is less efficient but is
16607 able to correctly support denormalized numbers and exceptional IEEE
16608 values such as not-a-number and plus/minus infinity. Other Alpha
16609 compilers call this option @option{-ieee_with_no_inexact}.
16610
16611 @item -mieee-with-inexact
16612 @opindex mieee-with-inexact
16613 This is like @option{-mieee} except the generated code also maintains
16614 the IEEE @var{inexact-flag}. Turning on this option causes the
16615 generated code to implement fully-compliant IEEE math. In addition to
16616 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
16617 macro. On some Alpha implementations the resulting code may execute
16618 significantly slower than the code generated by default. Since there is
16619 very little code that depends on the @var{inexact-flag}, you should
16620 normally not specify this option. Other Alpha compilers call this
16621 option @option{-ieee_with_inexact}.
16622
16623 @item -mfp-trap-mode=@var{trap-mode}
16624 @opindex mfp-trap-mode
16625 This option controls what floating-point related traps are enabled.
16626 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
16627 The trap mode can be set to one of four values:
16628
16629 @table @samp
16630 @item n
16631 This is the default (normal) setting. The only traps that are enabled
16632 are the ones that cannot be disabled in software (e.g., division by zero
16633 trap).
16634
16635 @item u
16636 In addition to the traps enabled by @samp{n}, underflow traps are enabled
16637 as well.
16638
16639 @item su
16640 Like @samp{u}, but the instructions are marked to be safe for software
16641 completion (see Alpha architecture manual for details).
16642
16643 @item sui
16644 Like @samp{su}, but inexact traps are enabled as well.
16645 @end table
16646
16647 @item -mfp-rounding-mode=@var{rounding-mode}
16648 @opindex mfp-rounding-mode
16649 Selects the IEEE rounding mode. Other Alpha compilers call this option
16650 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
16651 of:
16652
16653 @table @samp
16654 @item n
16655 Normal IEEE rounding mode. Floating-point numbers are rounded towards
16656 the nearest machine number or towards the even machine number in case
16657 of a tie.
16658
16659 @item m
16660 Round towards minus infinity.
16661
16662 @item c
16663 Chopped rounding mode. Floating-point numbers are rounded towards zero.
16664
16665 @item d
16666 Dynamic rounding mode. A field in the floating-point control register
16667 (@var{fpcr}, see Alpha architecture reference manual) controls the
16668 rounding mode in effect. The C library initializes this register for
16669 rounding towards plus infinity. Thus, unless your program modifies the
16670 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
16671 @end table
16672
16673 @item -mtrap-precision=@var{trap-precision}
16674 @opindex mtrap-precision
16675 In the Alpha architecture, floating-point traps are imprecise. This
16676 means without software assistance it is impossible to recover from a
16677 floating trap and program execution normally needs to be terminated.
16678 GCC can generate code that can assist operating system trap handlers
16679 in determining the exact location that caused a floating-point trap.
16680 Depending on the requirements of an application, different levels of
16681 precisions can be selected:
16682
16683 @table @samp
16684 @item p
16685 Program precision. This option is the default and means a trap handler
16686 can only identify which program caused a floating-point exception.
16687
16688 @item f
16689 Function precision. The trap handler can determine the function that
16690 caused a floating-point exception.
16691
16692 @item i
16693 Instruction precision. The trap handler can determine the exact
16694 instruction that caused a floating-point exception.
16695 @end table
16696
16697 Other Alpha compilers provide the equivalent options called
16698 @option{-scope_safe} and @option{-resumption_safe}.
16699
16700 @item -mieee-conformant
16701 @opindex mieee-conformant
16702 This option marks the generated code as IEEE conformant. You must not
16703 use this option unless you also specify @option{-mtrap-precision=i} and either
16704 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
16705 is to emit the line @samp{.eflag 48} in the function prologue of the
16706 generated assembly file.
16707
16708 @item -mbuild-constants
16709 @opindex mbuild-constants
16710 Normally GCC examines a 32- or 64-bit integer constant to
16711 see if it can construct it from smaller constants in two or three
16712 instructions. If it cannot, it outputs the constant as a literal and
16713 generates code to load it from the data segment at run time.
16714
16715 Use this option to require GCC to construct @emph{all} integer constants
16716 using code, even if it takes more instructions (the maximum is six).
16717
16718 You typically use this option to build a shared library dynamic
16719 loader. Itself a shared library, it must relocate itself in memory
16720 before it can find the variables and constants in its own data segment.
16721
16722 @item -mbwx
16723 @itemx -mno-bwx
16724 @itemx -mcix
16725 @itemx -mno-cix
16726 @itemx -mfix
16727 @itemx -mno-fix
16728 @itemx -mmax
16729 @itemx -mno-max
16730 @opindex mbwx
16731 @opindex mno-bwx
16732 @opindex mcix
16733 @opindex mno-cix
16734 @opindex mfix
16735 @opindex mno-fix
16736 @opindex mmax
16737 @opindex mno-max
16738 Indicate whether GCC should generate code to use the optional BWX,
16739 CIX, FIX and MAX instruction sets. The default is to use the instruction
16740 sets supported by the CPU type specified via @option{-mcpu=} option or that
16741 of the CPU on which GCC was built if none is specified.
16742
16743 @item -mfloat-vax
16744 @itemx -mfloat-ieee
16745 @opindex mfloat-vax
16746 @opindex mfloat-ieee
16747 Generate code that uses (does not use) VAX F and G floating-point
16748 arithmetic instead of IEEE single and double precision.
16749
16750 @item -mexplicit-relocs
16751 @itemx -mno-explicit-relocs
16752 @opindex mexplicit-relocs
16753 @opindex mno-explicit-relocs
16754 Older Alpha assemblers provided no way to generate symbol relocations
16755 except via assembler macros. Use of these macros does not allow
16756 optimal instruction scheduling. GNU binutils as of version 2.12
16757 supports a new syntax that allows the compiler to explicitly mark
16758 which relocations should apply to which instructions. This option
16759 is mostly useful for debugging, as GCC detects the capabilities of
16760 the assembler when it is built and sets the default accordingly.
16761
16762 @item -msmall-data
16763 @itemx -mlarge-data
16764 @opindex msmall-data
16765 @opindex mlarge-data
16766 When @option{-mexplicit-relocs} is in effect, static data is
16767 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
16768 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
16769 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
16770 16-bit relocations off of the @code{$gp} register. This limits the
16771 size of the small data area to 64KB, but allows the variables to be
16772 directly accessed via a single instruction.
16773
16774 The default is @option{-mlarge-data}. With this option the data area
16775 is limited to just below 2GB@. Programs that require more than 2GB of
16776 data must use @code{malloc} or @code{mmap} to allocate the data in the
16777 heap instead of in the program's data segment.
16778
16779 When generating code for shared libraries, @option{-fpic} implies
16780 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
16781
16782 @item -msmall-text
16783 @itemx -mlarge-text
16784 @opindex msmall-text
16785 @opindex mlarge-text
16786 When @option{-msmall-text} is used, the compiler assumes that the
16787 code of the entire program (or shared library) fits in 4MB, and is
16788 thus reachable with a branch instruction. When @option{-msmall-data}
16789 is used, the compiler can assume that all local symbols share the
16790 same @code{$gp} value, and thus reduce the number of instructions
16791 required for a function call from 4 to 1.
16792
16793 The default is @option{-mlarge-text}.
16794
16795 @item -mcpu=@var{cpu_type}
16796 @opindex mcpu
16797 Set the instruction set and instruction scheduling parameters for
16798 machine type @var{cpu_type}. You can specify either the @samp{EV}
16799 style name or the corresponding chip number. GCC supports scheduling
16800 parameters for the EV4, EV5 and EV6 family of processors and
16801 chooses the default values for the instruction set from the processor
16802 you specify. If you do not specify a processor type, GCC defaults
16803 to the processor on which the compiler was built.
16804
16805 Supported values for @var{cpu_type} are
16806
16807 @table @samp
16808 @item ev4
16809 @itemx ev45
16810 @itemx 21064
16811 Schedules as an EV4 and has no instruction set extensions.
16812
16813 @item ev5
16814 @itemx 21164
16815 Schedules as an EV5 and has no instruction set extensions.
16816
16817 @item ev56
16818 @itemx 21164a
16819 Schedules as an EV5 and supports the BWX extension.
16820
16821 @item pca56
16822 @itemx 21164pc
16823 @itemx 21164PC
16824 Schedules as an EV5 and supports the BWX and MAX extensions.
16825
16826 @item ev6
16827 @itemx 21264
16828 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
16829
16830 @item ev67
16831 @itemx 21264a
16832 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
16833 @end table
16834
16835 Native toolchains also support the value @samp{native},
16836 which selects the best architecture option for the host processor.
16837 @option{-mcpu=native} has no effect if GCC does not recognize
16838 the processor.
16839
16840 @item -mtune=@var{cpu_type}
16841 @opindex mtune
16842 Set only the instruction scheduling parameters for machine type
16843 @var{cpu_type}. The instruction set is not changed.
16844
16845 Native toolchains also support the value @samp{native},
16846 which selects the best architecture option for the host processor.
16847 @option{-mtune=native} has no effect if GCC does not recognize
16848 the processor.
16849
16850 @item -mmemory-latency=@var{time}
16851 @opindex mmemory-latency
16852 Sets the latency the scheduler should assume for typical memory
16853 references as seen by the application. This number is highly
16854 dependent on the memory access patterns used by the application
16855 and the size of the external cache on the machine.
16856
16857 Valid options for @var{time} are
16858
16859 @table @samp
16860 @item @var{number}
16861 A decimal number representing clock cycles.
16862
16863 @item L1
16864 @itemx L2
16865 @itemx L3
16866 @itemx main
16867 The compiler contains estimates of the number of clock cycles for
16868 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
16869 (also called Dcache, Scache, and Bcache), as well as to main memory.
16870 Note that L3 is only valid for EV5.
16871
16872 @end table
16873 @end table
16874
16875 @node FR30 Options
16876 @subsection FR30 Options
16877 @cindex FR30 Options
16878
16879 These options are defined specifically for the FR30 port.
16880
16881 @table @gcctabopt
16882
16883 @item -msmall-model
16884 @opindex msmall-model
16885 Use the small address space model. This can produce smaller code, but
16886 it does assume that all symbolic values and addresses fit into a
16887 20-bit range.
16888
16889 @item -mno-lsim
16890 @opindex mno-lsim
16891 Assume that runtime support has been provided and so there is no need
16892 to include the simulator library (@file{libsim.a}) on the linker
16893 command line.
16894
16895 @end table
16896
16897 @node FT32 Options
16898 @subsection FT32 Options
16899 @cindex FT32 Options
16900
16901 These options are defined specifically for the FT32 port.
16902
16903 @table @gcctabopt
16904
16905 @item -msim
16906 @opindex msim
16907 Specifies that the program will be run on the simulator. This causes
16908 an alternate runtime startup and library to be linked.
16909 You must not use this option when generating programs that will run on
16910 real hardware; you must provide your own runtime library for whatever
16911 I/O functions are needed.
16912
16913 @item -mlra
16914 @opindex mlra
16915 Enable Local Register Allocation. This is still experimental for FT32,
16916 so by default the compiler uses standard reload.
16917
16918 @item -mnodiv
16919 @opindex mnodiv
16920 Do not use div and mod instructions.
16921
16922 @end table
16923
16924 @node FRV Options
16925 @subsection FRV Options
16926 @cindex FRV Options
16927
16928 @table @gcctabopt
16929 @item -mgpr-32
16930 @opindex mgpr-32
16931
16932 Only use the first 32 general-purpose registers.
16933
16934 @item -mgpr-64
16935 @opindex mgpr-64
16936
16937 Use all 64 general-purpose registers.
16938
16939 @item -mfpr-32
16940 @opindex mfpr-32
16941
16942 Use only the first 32 floating-point registers.
16943
16944 @item -mfpr-64
16945 @opindex mfpr-64
16946
16947 Use all 64 floating-point registers.
16948
16949 @item -mhard-float
16950 @opindex mhard-float
16951
16952 Use hardware instructions for floating-point operations.
16953
16954 @item -msoft-float
16955 @opindex msoft-float
16956
16957 Use library routines for floating-point operations.
16958
16959 @item -malloc-cc
16960 @opindex malloc-cc
16961
16962 Dynamically allocate condition code registers.
16963
16964 @item -mfixed-cc
16965 @opindex mfixed-cc
16966
16967 Do not try to dynamically allocate condition code registers, only
16968 use @code{icc0} and @code{fcc0}.
16969
16970 @item -mdword
16971 @opindex mdword
16972
16973 Change ABI to use double word insns.
16974
16975 @item -mno-dword
16976 @opindex mno-dword
16977
16978 Do not use double word instructions.
16979
16980 @item -mdouble
16981 @opindex mdouble
16982
16983 Use floating-point double instructions.
16984
16985 @item -mno-double
16986 @opindex mno-double
16987
16988 Do not use floating-point double instructions.
16989
16990 @item -mmedia
16991 @opindex mmedia
16992
16993 Use media instructions.
16994
16995 @item -mno-media
16996 @opindex mno-media
16997
16998 Do not use media instructions.
16999
17000 @item -mmuladd
17001 @opindex mmuladd
17002
17003 Use multiply and add/subtract instructions.
17004
17005 @item -mno-muladd
17006 @opindex mno-muladd
17007
17008 Do not use multiply and add/subtract instructions.
17009
17010 @item -mfdpic
17011 @opindex mfdpic
17012
17013 Select the FDPIC ABI, which uses function descriptors to represent
17014 pointers to functions. Without any PIC/PIE-related options, it
17015 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
17016 assumes GOT entries and small data are within a 12-bit range from the
17017 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
17018 are computed with 32 bits.
17019 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17020
17021 @item -minline-plt
17022 @opindex minline-plt
17023
17024 Enable inlining of PLT entries in function calls to functions that are
17025 not known to bind locally. It has no effect without @option{-mfdpic}.
17026 It's enabled by default if optimizing for speed and compiling for
17027 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
17028 optimization option such as @option{-O3} or above is present in the
17029 command line.
17030
17031 @item -mTLS
17032 @opindex mTLS
17033
17034 Assume a large TLS segment when generating thread-local code.
17035
17036 @item -mtls
17037 @opindex mtls
17038
17039 Do not assume a large TLS segment when generating thread-local code.
17040
17041 @item -mgprel-ro
17042 @opindex mgprel-ro
17043
17044 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
17045 that is known to be in read-only sections. It's enabled by default,
17046 except for @option{-fpic} or @option{-fpie}: even though it may help
17047 make the global offset table smaller, it trades 1 instruction for 4.
17048 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
17049 one of which may be shared by multiple symbols, and it avoids the need
17050 for a GOT entry for the referenced symbol, so it's more likely to be a
17051 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
17052
17053 @item -multilib-library-pic
17054 @opindex multilib-library-pic
17055
17056 Link with the (library, not FD) pic libraries. It's implied by
17057 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
17058 @option{-fpic} without @option{-mfdpic}. You should never have to use
17059 it explicitly.
17060
17061 @item -mlinked-fp
17062 @opindex mlinked-fp
17063
17064 Follow the EABI requirement of always creating a frame pointer whenever
17065 a stack frame is allocated. This option is enabled by default and can
17066 be disabled with @option{-mno-linked-fp}.
17067
17068 @item -mlong-calls
17069 @opindex mlong-calls
17070
17071 Use indirect addressing to call functions outside the current
17072 compilation unit. This allows the functions to be placed anywhere
17073 within the 32-bit address space.
17074
17075 @item -malign-labels
17076 @opindex malign-labels
17077
17078 Try to align labels to an 8-byte boundary by inserting NOPs into the
17079 previous packet. This option only has an effect when VLIW packing
17080 is enabled. It doesn't create new packets; it merely adds NOPs to
17081 existing ones.
17082
17083 @item -mlibrary-pic
17084 @opindex mlibrary-pic
17085
17086 Generate position-independent EABI code.
17087
17088 @item -macc-4
17089 @opindex macc-4
17090
17091 Use only the first four media accumulator registers.
17092
17093 @item -macc-8
17094 @opindex macc-8
17095
17096 Use all eight media accumulator registers.
17097
17098 @item -mpack
17099 @opindex mpack
17100
17101 Pack VLIW instructions.
17102
17103 @item -mno-pack
17104 @opindex mno-pack
17105
17106 Do not pack VLIW instructions.
17107
17108 @item -mno-eflags
17109 @opindex mno-eflags
17110
17111 Do not mark ABI switches in e_flags.
17112
17113 @item -mcond-move
17114 @opindex mcond-move
17115
17116 Enable the use of conditional-move instructions (default).
17117
17118 This switch is mainly for debugging the compiler and will likely be removed
17119 in a future version.
17120
17121 @item -mno-cond-move
17122 @opindex mno-cond-move
17123
17124 Disable the use of conditional-move instructions.
17125
17126 This switch is mainly for debugging the compiler and will likely be removed
17127 in a future version.
17128
17129 @item -mscc
17130 @opindex mscc
17131
17132 Enable the use of conditional set instructions (default).
17133
17134 This switch is mainly for debugging the compiler and will likely be removed
17135 in a future version.
17136
17137 @item -mno-scc
17138 @opindex mno-scc
17139
17140 Disable the use of conditional set instructions.
17141
17142 This switch is mainly for debugging the compiler and will likely be removed
17143 in a future version.
17144
17145 @item -mcond-exec
17146 @opindex mcond-exec
17147
17148 Enable the use of conditional execution (default).
17149
17150 This switch is mainly for debugging the compiler and will likely be removed
17151 in a future version.
17152
17153 @item -mno-cond-exec
17154 @opindex mno-cond-exec
17155
17156 Disable the use of conditional execution.
17157
17158 This switch is mainly for debugging the compiler and will likely be removed
17159 in a future version.
17160
17161 @item -mvliw-branch
17162 @opindex mvliw-branch
17163
17164 Run a pass to pack branches into VLIW instructions (default).
17165
17166 This switch is mainly for debugging the compiler and will likely be removed
17167 in a future version.
17168
17169 @item -mno-vliw-branch
17170 @opindex mno-vliw-branch
17171
17172 Do not run a pass to pack branches into VLIW instructions.
17173
17174 This switch is mainly for debugging the compiler and will likely be removed
17175 in a future version.
17176
17177 @item -mmulti-cond-exec
17178 @opindex mmulti-cond-exec
17179
17180 Enable optimization of @code{&&} and @code{||} in conditional execution
17181 (default).
17182
17183 This switch is mainly for debugging the compiler and will likely be removed
17184 in a future version.
17185
17186 @item -mno-multi-cond-exec
17187 @opindex mno-multi-cond-exec
17188
17189 Disable optimization of @code{&&} and @code{||} in conditional execution.
17190
17191 This switch is mainly for debugging the compiler and will likely be removed
17192 in a future version.
17193
17194 @item -mnested-cond-exec
17195 @opindex mnested-cond-exec
17196
17197 Enable nested conditional execution optimizations (default).
17198
17199 This switch is mainly for debugging the compiler and will likely be removed
17200 in a future version.
17201
17202 @item -mno-nested-cond-exec
17203 @opindex mno-nested-cond-exec
17204
17205 Disable nested conditional execution optimizations.
17206
17207 This switch is mainly for debugging the compiler and will likely be removed
17208 in a future version.
17209
17210 @item -moptimize-membar
17211 @opindex moptimize-membar
17212
17213 This switch removes redundant @code{membar} instructions from the
17214 compiler-generated code. It is enabled by default.
17215
17216 @item -mno-optimize-membar
17217 @opindex mno-optimize-membar
17218
17219 This switch disables the automatic removal of redundant @code{membar}
17220 instructions from the generated code.
17221
17222 @item -mtomcat-stats
17223 @opindex mtomcat-stats
17224
17225 Cause gas to print out tomcat statistics.
17226
17227 @item -mcpu=@var{cpu}
17228 @opindex mcpu
17229
17230 Select the processor type for which to generate code. Possible values are
17231 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
17232 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
17233
17234 @end table
17235
17236 @node GNU/Linux Options
17237 @subsection GNU/Linux Options
17238
17239 These @samp{-m} options are defined for GNU/Linux targets:
17240
17241 @table @gcctabopt
17242 @item -mglibc
17243 @opindex mglibc
17244 Use the GNU C library. This is the default except
17245 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
17246 @samp{*-*-linux-*android*} targets.
17247
17248 @item -muclibc
17249 @opindex muclibc
17250 Use uClibc C library. This is the default on
17251 @samp{*-*-linux-*uclibc*} targets.
17252
17253 @item -mmusl
17254 @opindex mmusl
17255 Use the musl C library. This is the default on
17256 @samp{*-*-linux-*musl*} targets.
17257
17258 @item -mbionic
17259 @opindex mbionic
17260 Use Bionic C library. This is the default on
17261 @samp{*-*-linux-*android*} targets.
17262
17263 @item -mandroid
17264 @opindex mandroid
17265 Compile code compatible with Android platform. This is the default on
17266 @samp{*-*-linux-*android*} targets.
17267
17268 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
17269 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
17270 this option makes the GCC driver pass Android-specific options to the linker.
17271 Finally, this option causes the preprocessor macro @code{__ANDROID__}
17272 to be defined.
17273
17274 @item -tno-android-cc
17275 @opindex tno-android-cc
17276 Disable compilation effects of @option{-mandroid}, i.e., do not enable
17277 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
17278 @option{-fno-rtti} by default.
17279
17280 @item -tno-android-ld
17281 @opindex tno-android-ld
17282 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
17283 linking options to the linker.
17284
17285 @end table
17286
17287 @node H8/300 Options
17288 @subsection H8/300 Options
17289
17290 These @samp{-m} options are defined for the H8/300 implementations:
17291
17292 @table @gcctabopt
17293 @item -mrelax
17294 @opindex mrelax
17295 Shorten some address references at link time, when possible; uses the
17296 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
17297 ld, Using ld}, for a fuller description.
17298
17299 @item -mh
17300 @opindex mh
17301 Generate code for the H8/300H@.
17302
17303 @item -ms
17304 @opindex ms
17305 Generate code for the H8S@.
17306
17307 @item -mn
17308 @opindex mn
17309 Generate code for the H8S and H8/300H in the normal mode. This switch
17310 must be used either with @option{-mh} or @option{-ms}.
17311
17312 @item -ms2600
17313 @opindex ms2600
17314 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
17315
17316 @item -mexr
17317 @opindex mexr
17318 Extended registers are stored on stack before execution of function
17319 with monitor attribute. Default option is @option{-mexr}.
17320 This option is valid only for H8S targets.
17321
17322 @item -mno-exr
17323 @opindex mno-exr
17324 Extended registers are not stored on stack before execution of function
17325 with monitor attribute. Default option is @option{-mno-exr}.
17326 This option is valid only for H8S targets.
17327
17328 @item -mint32
17329 @opindex mint32
17330 Make @code{int} data 32 bits by default.
17331
17332 @item -malign-300
17333 @opindex malign-300
17334 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
17335 The default for the H8/300H and H8S is to align longs and floats on
17336 4-byte boundaries.
17337 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
17338 This option has no effect on the H8/300.
17339 @end table
17340
17341 @node HPPA Options
17342 @subsection HPPA Options
17343 @cindex HPPA Options
17344
17345 These @samp{-m} options are defined for the HPPA family of computers:
17346
17347 @table @gcctabopt
17348 @item -march=@var{architecture-type}
17349 @opindex march
17350 Generate code for the specified architecture. The choices for
17351 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
17352 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
17353 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
17354 architecture option for your machine. Code compiled for lower numbered
17355 architectures runs on higher numbered architectures, but not the
17356 other way around.
17357
17358 @item -mpa-risc-1-0
17359 @itemx -mpa-risc-1-1
17360 @itemx -mpa-risc-2-0
17361 @opindex mpa-risc-1-0
17362 @opindex mpa-risc-1-1
17363 @opindex mpa-risc-2-0
17364 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
17365
17366 @item -mjump-in-delay
17367 @opindex mjump-in-delay
17368 This option is ignored and provided for compatibility purposes only.
17369
17370 @item -mdisable-fpregs
17371 @opindex mdisable-fpregs
17372 Prevent floating-point registers from being used in any manner. This is
17373 necessary for compiling kernels that perform lazy context switching of
17374 floating-point registers. If you use this option and attempt to perform
17375 floating-point operations, the compiler aborts.
17376
17377 @item -mdisable-indexing
17378 @opindex mdisable-indexing
17379 Prevent the compiler from using indexing address modes. This avoids some
17380 rather obscure problems when compiling MIG generated code under MACH@.
17381
17382 @item -mno-space-regs
17383 @opindex mno-space-regs
17384 Generate code that assumes the target has no space registers. This allows
17385 GCC to generate faster indirect calls and use unscaled index address modes.
17386
17387 Such code is suitable for level 0 PA systems and kernels.
17388
17389 @item -mfast-indirect-calls
17390 @opindex mfast-indirect-calls
17391 Generate code that assumes calls never cross space boundaries. This
17392 allows GCC to emit code that performs faster indirect calls.
17393
17394 This option does not work in the presence of shared libraries or nested
17395 functions.
17396
17397 @item -mfixed-range=@var{register-range}
17398 @opindex mfixed-range
17399 Generate code treating the given register range as fixed registers.
17400 A fixed register is one that the register allocator cannot use. This is
17401 useful when compiling kernel code. A register range is specified as
17402 two registers separated by a dash. Multiple register ranges can be
17403 specified separated by a comma.
17404
17405 @item -mlong-load-store
17406 @opindex mlong-load-store
17407 Generate 3-instruction load and store sequences as sometimes required by
17408 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
17409 the HP compilers.
17410
17411 @item -mportable-runtime
17412 @opindex mportable-runtime
17413 Use the portable calling conventions proposed by HP for ELF systems.
17414
17415 @item -mgas
17416 @opindex mgas
17417 Enable the use of assembler directives only GAS understands.
17418
17419 @item -mschedule=@var{cpu-type}
17420 @opindex mschedule
17421 Schedule code according to the constraints for the machine type
17422 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
17423 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
17424 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
17425 proper scheduling option for your machine. The default scheduling is
17426 @samp{8000}.
17427
17428 @item -mlinker-opt
17429 @opindex mlinker-opt
17430 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
17431 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
17432 linkers in which they give bogus error messages when linking some programs.
17433
17434 @item -msoft-float
17435 @opindex msoft-float
17436 Generate output containing library calls for floating point.
17437 @strong{Warning:} the requisite libraries are not available for all HPPA
17438 targets. Normally the facilities of the machine's usual C compiler are
17439 used, but this cannot be done directly in cross-compilation. You must make
17440 your own arrangements to provide suitable library functions for
17441 cross-compilation.
17442
17443 @option{-msoft-float} changes the calling convention in the output file;
17444 therefore, it is only useful if you compile @emph{all} of a program with
17445 this option. In particular, you need to compile @file{libgcc.a}, the
17446 library that comes with GCC, with @option{-msoft-float} in order for
17447 this to work.
17448
17449 @item -msio
17450 @opindex msio
17451 Generate the predefine, @code{_SIO}, for server IO@. The default is
17452 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
17453 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
17454 options are available under HP-UX and HI-UX@.
17455
17456 @item -mgnu-ld
17457 @opindex mgnu-ld
17458 Use options specific to GNU @command{ld}.
17459 This passes @option{-shared} to @command{ld} when
17460 building a shared library. It is the default when GCC is configured,
17461 explicitly or implicitly, with the GNU linker. This option does not
17462 affect which @command{ld} is called; it only changes what parameters
17463 are passed to that @command{ld}.
17464 The @command{ld} that is called is determined by the
17465 @option{--with-ld} configure option, GCC's program search path, and
17466 finally by the user's @env{PATH}. The linker used by GCC can be printed
17467 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
17468 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
17469
17470 @item -mhp-ld
17471 @opindex mhp-ld
17472 Use options specific to HP @command{ld}.
17473 This passes @option{-b} to @command{ld} when building
17474 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
17475 links. It is the default when GCC is configured, explicitly or
17476 implicitly, with the HP linker. This option does not affect
17477 which @command{ld} is called; it only changes what parameters are passed to that
17478 @command{ld}.
17479 The @command{ld} that is called is determined by the @option{--with-ld}
17480 configure option, GCC's program search path, and finally by the user's
17481 @env{PATH}. The linker used by GCC can be printed using @samp{which
17482 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
17483 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
17484
17485 @item -mlong-calls
17486 @opindex mno-long-calls
17487 Generate code that uses long call sequences. This ensures that a call
17488 is always able to reach linker generated stubs. The default is to generate
17489 long calls only when the distance from the call site to the beginning
17490 of the function or translation unit, as the case may be, exceeds a
17491 predefined limit set by the branch type being used. The limits for
17492 normal calls are 7,600,000 and 240,000 bytes, respectively for the
17493 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
17494 240,000 bytes.
17495
17496 Distances are measured from the beginning of functions when using the
17497 @option{-ffunction-sections} option, or when using the @option{-mgas}
17498 and @option{-mno-portable-runtime} options together under HP-UX with
17499 the SOM linker.
17500
17501 It is normally not desirable to use this option as it degrades
17502 performance. However, it may be useful in large applications,
17503 particularly when partial linking is used to build the application.
17504
17505 The types of long calls used depends on the capabilities of the
17506 assembler and linker, and the type of code being generated. The
17507 impact on systems that support long absolute calls, and long pic
17508 symbol-difference or pc-relative calls should be relatively small.
17509 However, an indirect call is used on 32-bit ELF systems in pic code
17510 and it is quite long.
17511
17512 @item -munix=@var{unix-std}
17513 @opindex march
17514 Generate compiler predefines and select a startfile for the specified
17515 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
17516 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
17517 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
17518 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
17519 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
17520 and later.
17521
17522 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
17523 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
17524 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
17525 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
17526 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
17527 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
17528
17529 It is @emph{important} to note that this option changes the interfaces
17530 for various library routines. It also affects the operational behavior
17531 of the C library. Thus, @emph{extreme} care is needed in using this
17532 option.
17533
17534 Library code that is intended to operate with more than one UNIX
17535 standard must test, set and restore the variable @code{__xpg4_extended_mask}
17536 as appropriate. Most GNU software doesn't provide this capability.
17537
17538 @item -nolibdld
17539 @opindex nolibdld
17540 Suppress the generation of link options to search libdld.sl when the
17541 @option{-static} option is specified on HP-UX 10 and later.
17542
17543 @item -static
17544 @opindex static
17545 The HP-UX implementation of setlocale in libc has a dependency on
17546 libdld.sl. There isn't an archive version of libdld.sl. Thus,
17547 when the @option{-static} option is specified, special link options
17548 are needed to resolve this dependency.
17549
17550 On HP-UX 10 and later, the GCC driver adds the necessary options to
17551 link with libdld.sl when the @option{-static} option is specified.
17552 This causes the resulting binary to be dynamic. On the 64-bit port,
17553 the linkers generate dynamic binaries by default in any case. The
17554 @option{-nolibdld} option can be used to prevent the GCC driver from
17555 adding these link options.
17556
17557 @item -threads
17558 @opindex threads
17559 Add support for multithreading with the @dfn{dce thread} library
17560 under HP-UX@. This option sets flags for both the preprocessor and
17561 linker.
17562 @end table
17563
17564 @node IA-64 Options
17565 @subsection IA-64 Options
17566 @cindex IA-64 Options
17567
17568 These are the @samp{-m} options defined for the Intel IA-64 architecture.
17569
17570 @table @gcctabopt
17571 @item -mbig-endian
17572 @opindex mbig-endian
17573 Generate code for a big-endian target. This is the default for HP-UX@.
17574
17575 @item -mlittle-endian
17576 @opindex mlittle-endian
17577 Generate code for a little-endian target. This is the default for AIX5
17578 and GNU/Linux.
17579
17580 @item -mgnu-as
17581 @itemx -mno-gnu-as
17582 @opindex mgnu-as
17583 @opindex mno-gnu-as
17584 Generate (or don't) code for the GNU assembler. This is the default.
17585 @c Also, this is the default if the configure option @option{--with-gnu-as}
17586 @c is used.
17587
17588 @item -mgnu-ld
17589 @itemx -mno-gnu-ld
17590 @opindex mgnu-ld
17591 @opindex mno-gnu-ld
17592 Generate (or don't) code for the GNU linker. This is the default.
17593 @c Also, this is the default if the configure option @option{--with-gnu-ld}
17594 @c is used.
17595
17596 @item -mno-pic
17597 @opindex mno-pic
17598 Generate code that does not use a global pointer register. The result
17599 is not position independent code, and violates the IA-64 ABI@.
17600
17601 @item -mvolatile-asm-stop
17602 @itemx -mno-volatile-asm-stop
17603 @opindex mvolatile-asm-stop
17604 @opindex mno-volatile-asm-stop
17605 Generate (or don't) a stop bit immediately before and after volatile asm
17606 statements.
17607
17608 @item -mregister-names
17609 @itemx -mno-register-names
17610 @opindex mregister-names
17611 @opindex mno-register-names
17612 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
17613 the stacked registers. This may make assembler output more readable.
17614
17615 @item -mno-sdata
17616 @itemx -msdata
17617 @opindex mno-sdata
17618 @opindex msdata
17619 Disable (or enable) optimizations that use the small data section. This may
17620 be useful for working around optimizer bugs.
17621
17622 @item -mconstant-gp
17623 @opindex mconstant-gp
17624 Generate code that uses a single constant global pointer value. This is
17625 useful when compiling kernel code.
17626
17627 @item -mauto-pic
17628 @opindex mauto-pic
17629 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
17630 This is useful when compiling firmware code.
17631
17632 @item -minline-float-divide-min-latency
17633 @opindex minline-float-divide-min-latency
17634 Generate code for inline divides of floating-point values
17635 using the minimum latency algorithm.
17636
17637 @item -minline-float-divide-max-throughput
17638 @opindex minline-float-divide-max-throughput
17639 Generate code for inline divides of floating-point values
17640 using the maximum throughput algorithm.
17641
17642 @item -mno-inline-float-divide
17643 @opindex mno-inline-float-divide
17644 Do not generate inline code for divides of floating-point values.
17645
17646 @item -minline-int-divide-min-latency
17647 @opindex minline-int-divide-min-latency
17648 Generate code for inline divides of integer values
17649 using the minimum latency algorithm.
17650
17651 @item -minline-int-divide-max-throughput
17652 @opindex minline-int-divide-max-throughput
17653 Generate code for inline divides of integer values
17654 using the maximum throughput algorithm.
17655
17656 @item -mno-inline-int-divide
17657 @opindex mno-inline-int-divide
17658 Do not generate inline code for divides of integer values.
17659
17660 @item -minline-sqrt-min-latency
17661 @opindex minline-sqrt-min-latency
17662 Generate code for inline square roots
17663 using the minimum latency algorithm.
17664
17665 @item -minline-sqrt-max-throughput
17666 @opindex minline-sqrt-max-throughput
17667 Generate code for inline square roots
17668 using the maximum throughput algorithm.
17669
17670 @item -mno-inline-sqrt
17671 @opindex mno-inline-sqrt
17672 Do not generate inline code for @code{sqrt}.
17673
17674 @item -mfused-madd
17675 @itemx -mno-fused-madd
17676 @opindex mfused-madd
17677 @opindex mno-fused-madd
17678 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
17679 instructions. The default is to use these instructions.
17680
17681 @item -mno-dwarf2-asm
17682 @itemx -mdwarf2-asm
17683 @opindex mno-dwarf2-asm
17684 @opindex mdwarf2-asm
17685 Don't (or do) generate assembler code for the DWARF line number debugging
17686 info. This may be useful when not using the GNU assembler.
17687
17688 @item -mearly-stop-bits
17689 @itemx -mno-early-stop-bits
17690 @opindex mearly-stop-bits
17691 @opindex mno-early-stop-bits
17692 Allow stop bits to be placed earlier than immediately preceding the
17693 instruction that triggered the stop bit. This can improve instruction
17694 scheduling, but does not always do so.
17695
17696 @item -mfixed-range=@var{register-range}
17697 @opindex mfixed-range
17698 Generate code treating the given register range as fixed registers.
17699 A fixed register is one that the register allocator cannot use. This is
17700 useful when compiling kernel code. A register range is specified as
17701 two registers separated by a dash. Multiple register ranges can be
17702 specified separated by a comma.
17703
17704 @item -mtls-size=@var{tls-size}
17705 @opindex mtls-size
17706 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
17707 64.
17708
17709 @item -mtune=@var{cpu-type}
17710 @opindex mtune
17711 Tune the instruction scheduling for a particular CPU, Valid values are
17712 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
17713 and @samp{mckinley}.
17714
17715 @item -milp32
17716 @itemx -mlp64
17717 @opindex milp32
17718 @opindex mlp64
17719 Generate code for a 32-bit or 64-bit environment.
17720 The 32-bit environment sets int, long and pointer to 32 bits.
17721 The 64-bit environment sets int to 32 bits and long and pointer
17722 to 64 bits. These are HP-UX specific flags.
17723
17724 @item -mno-sched-br-data-spec
17725 @itemx -msched-br-data-spec
17726 @opindex mno-sched-br-data-spec
17727 @opindex msched-br-data-spec
17728 (Dis/En)able data speculative scheduling before reload.
17729 This results in generation of @code{ld.a} instructions and
17730 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17731 The default setting is disabled.
17732
17733 @item -msched-ar-data-spec
17734 @itemx -mno-sched-ar-data-spec
17735 @opindex msched-ar-data-spec
17736 @opindex mno-sched-ar-data-spec
17737 (En/Dis)able data speculative scheduling after reload.
17738 This results in generation of @code{ld.a} instructions and
17739 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17740 The default setting is enabled.
17741
17742 @item -mno-sched-control-spec
17743 @itemx -msched-control-spec
17744 @opindex mno-sched-control-spec
17745 @opindex msched-control-spec
17746 (Dis/En)able control speculative scheduling. This feature is
17747 available only during region scheduling (i.e.@: before reload).
17748 This results in generation of the @code{ld.s} instructions and
17749 the corresponding check instructions @code{chk.s}.
17750 The default setting is disabled.
17751
17752 @item -msched-br-in-data-spec
17753 @itemx -mno-sched-br-in-data-spec
17754 @opindex msched-br-in-data-spec
17755 @opindex mno-sched-br-in-data-spec
17756 (En/Dis)able speculative scheduling of the instructions that
17757 are dependent on the data speculative loads before reload.
17758 This is effective only with @option{-msched-br-data-spec} enabled.
17759 The default setting is enabled.
17760
17761 @item -msched-ar-in-data-spec
17762 @itemx -mno-sched-ar-in-data-spec
17763 @opindex msched-ar-in-data-spec
17764 @opindex mno-sched-ar-in-data-spec
17765 (En/Dis)able speculative scheduling of the instructions that
17766 are dependent on the data speculative loads after reload.
17767 This is effective only with @option{-msched-ar-data-spec} enabled.
17768 The default setting is enabled.
17769
17770 @item -msched-in-control-spec
17771 @itemx -mno-sched-in-control-spec
17772 @opindex msched-in-control-spec
17773 @opindex mno-sched-in-control-spec
17774 (En/Dis)able speculative scheduling of the instructions that
17775 are dependent on the control speculative loads.
17776 This is effective only with @option{-msched-control-spec} enabled.
17777 The default setting is enabled.
17778
17779 @item -mno-sched-prefer-non-data-spec-insns
17780 @itemx -msched-prefer-non-data-spec-insns
17781 @opindex mno-sched-prefer-non-data-spec-insns
17782 @opindex msched-prefer-non-data-spec-insns
17783 If enabled, data-speculative instructions are chosen for schedule
17784 only if there are no other choices at the moment. This makes
17785 the use of the data speculation much more conservative.
17786 The default setting is disabled.
17787
17788 @item -mno-sched-prefer-non-control-spec-insns
17789 @itemx -msched-prefer-non-control-spec-insns
17790 @opindex mno-sched-prefer-non-control-spec-insns
17791 @opindex msched-prefer-non-control-spec-insns
17792 If enabled, control-speculative instructions are chosen for schedule
17793 only if there are no other choices at the moment. This makes
17794 the use of the control speculation much more conservative.
17795 The default setting is disabled.
17796
17797 @item -mno-sched-count-spec-in-critical-path
17798 @itemx -msched-count-spec-in-critical-path
17799 @opindex mno-sched-count-spec-in-critical-path
17800 @opindex msched-count-spec-in-critical-path
17801 If enabled, speculative dependencies are considered during
17802 computation of the instructions priorities. This makes the use of the
17803 speculation a bit more conservative.
17804 The default setting is disabled.
17805
17806 @item -msched-spec-ldc
17807 @opindex msched-spec-ldc
17808 Use a simple data speculation check. This option is on by default.
17809
17810 @item -msched-control-spec-ldc
17811 @opindex msched-spec-ldc
17812 Use a simple check for control speculation. This option is on by default.
17813
17814 @item -msched-stop-bits-after-every-cycle
17815 @opindex msched-stop-bits-after-every-cycle
17816 Place a stop bit after every cycle when scheduling. This option is on
17817 by default.
17818
17819 @item -msched-fp-mem-deps-zero-cost
17820 @opindex msched-fp-mem-deps-zero-cost
17821 Assume that floating-point stores and loads are not likely to cause a conflict
17822 when placed into the same instruction group. This option is disabled by
17823 default.
17824
17825 @item -msel-sched-dont-check-control-spec
17826 @opindex msel-sched-dont-check-control-spec
17827 Generate checks for control speculation in selective scheduling.
17828 This flag is disabled by default.
17829
17830 @item -msched-max-memory-insns=@var{max-insns}
17831 @opindex msched-max-memory-insns
17832 Limit on the number of memory insns per instruction group, giving lower
17833 priority to subsequent memory insns attempting to schedule in the same
17834 instruction group. Frequently useful to prevent cache bank conflicts.
17835 The default value is 1.
17836
17837 @item -msched-max-memory-insns-hard-limit
17838 @opindex msched-max-memory-insns-hard-limit
17839 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
17840 disallowing more than that number in an instruction group.
17841 Otherwise, the limit is ``soft'', meaning that non-memory operations
17842 are preferred when the limit is reached, but memory operations may still
17843 be scheduled.
17844
17845 @end table
17846
17847 @node LM32 Options
17848 @subsection LM32 Options
17849 @cindex LM32 options
17850
17851 These @option{-m} options are defined for the LatticeMico32 architecture:
17852
17853 @table @gcctabopt
17854 @item -mbarrel-shift-enabled
17855 @opindex mbarrel-shift-enabled
17856 Enable barrel-shift instructions.
17857
17858 @item -mdivide-enabled
17859 @opindex mdivide-enabled
17860 Enable divide and modulus instructions.
17861
17862 @item -mmultiply-enabled
17863 @opindex multiply-enabled
17864 Enable multiply instructions.
17865
17866 @item -msign-extend-enabled
17867 @opindex msign-extend-enabled
17868 Enable sign extend instructions.
17869
17870 @item -muser-enabled
17871 @opindex muser-enabled
17872 Enable user-defined instructions.
17873
17874 @end table
17875
17876 @node M32C Options
17877 @subsection M32C Options
17878 @cindex M32C options
17879
17880 @table @gcctabopt
17881 @item -mcpu=@var{name}
17882 @opindex mcpu=
17883 Select the CPU for which code is generated. @var{name} may be one of
17884 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
17885 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
17886 the M32C/80 series.
17887
17888 @item -msim
17889 @opindex msim
17890 Specifies that the program will be run on the simulator. This causes
17891 an alternate runtime library to be linked in which supports, for
17892 example, file I/O@. You must not use this option when generating
17893 programs that will run on real hardware; you must provide your own
17894 runtime library for whatever I/O functions are needed.
17895
17896 @item -memregs=@var{number}
17897 @opindex memregs=
17898 Specifies the number of memory-based pseudo-registers GCC uses
17899 during code generation. These pseudo-registers are used like real
17900 registers, so there is a tradeoff between GCC's ability to fit the
17901 code into available registers, and the performance penalty of using
17902 memory instead of registers. Note that all modules in a program must
17903 be compiled with the same value for this option. Because of that, you
17904 must not use this option with GCC's default runtime libraries.
17905
17906 @end table
17907
17908 @node M32R/D Options
17909 @subsection M32R/D Options
17910 @cindex M32R/D options
17911
17912 These @option{-m} options are defined for Renesas M32R/D architectures:
17913
17914 @table @gcctabopt
17915 @item -m32r2
17916 @opindex m32r2
17917 Generate code for the M32R/2@.
17918
17919 @item -m32rx
17920 @opindex m32rx
17921 Generate code for the M32R/X@.
17922
17923 @item -m32r
17924 @opindex m32r
17925 Generate code for the M32R@. This is the default.
17926
17927 @item -mmodel=small
17928 @opindex mmodel=small
17929 Assume all objects live in the lower 16MB of memory (so that their addresses
17930 can be loaded with the @code{ld24} instruction), and assume all subroutines
17931 are reachable with the @code{bl} instruction.
17932 This is the default.
17933
17934 The addressability of a particular object can be set with the
17935 @code{model} attribute.
17936
17937 @item -mmodel=medium
17938 @opindex mmodel=medium
17939 Assume objects may be anywhere in the 32-bit address space (the compiler
17940 generates @code{seth/add3} instructions to load their addresses), and
17941 assume all subroutines are reachable with the @code{bl} instruction.
17942
17943 @item -mmodel=large
17944 @opindex mmodel=large
17945 Assume objects may be anywhere in the 32-bit address space (the compiler
17946 generates @code{seth/add3} instructions to load their addresses), and
17947 assume subroutines may not be reachable with the @code{bl} instruction
17948 (the compiler generates the much slower @code{seth/add3/jl}
17949 instruction sequence).
17950
17951 @item -msdata=none
17952 @opindex msdata=none
17953 Disable use of the small data area. Variables are put into
17954 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
17955 @code{section} attribute has been specified).
17956 This is the default.
17957
17958 The small data area consists of sections @code{.sdata} and @code{.sbss}.
17959 Objects may be explicitly put in the small data area with the
17960 @code{section} attribute using one of these sections.
17961
17962 @item -msdata=sdata
17963 @opindex msdata=sdata
17964 Put small global and static data in the small data area, but do not
17965 generate special code to reference them.
17966
17967 @item -msdata=use
17968 @opindex msdata=use
17969 Put small global and static data in the small data area, and generate
17970 special instructions to reference them.
17971
17972 @item -G @var{num}
17973 @opindex G
17974 @cindex smaller data references
17975 Put global and static objects less than or equal to @var{num} bytes
17976 into the small data or BSS sections instead of the normal data or BSS
17977 sections. The default value of @var{num} is 8.
17978 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
17979 for this option to have any effect.
17980
17981 All modules should be compiled with the same @option{-G @var{num}} value.
17982 Compiling with different values of @var{num} may or may not work; if it
17983 doesn't the linker gives an error message---incorrect code is not
17984 generated.
17985
17986 @item -mdebug
17987 @opindex mdebug
17988 Makes the M32R-specific code in the compiler display some statistics
17989 that might help in debugging programs.
17990
17991 @item -malign-loops
17992 @opindex malign-loops
17993 Align all loops to a 32-byte boundary.
17994
17995 @item -mno-align-loops
17996 @opindex mno-align-loops
17997 Do not enforce a 32-byte alignment for loops. This is the default.
17998
17999 @item -missue-rate=@var{number}
18000 @opindex missue-rate=@var{number}
18001 Issue @var{number} instructions per cycle. @var{number} can only be 1
18002 or 2.
18003
18004 @item -mbranch-cost=@var{number}
18005 @opindex mbranch-cost=@var{number}
18006 @var{number} can only be 1 or 2. If it is 1 then branches are
18007 preferred over conditional code, if it is 2, then the opposite applies.
18008
18009 @item -mflush-trap=@var{number}
18010 @opindex mflush-trap=@var{number}
18011 Specifies the trap number to use to flush the cache. The default is
18012 12. Valid numbers are between 0 and 15 inclusive.
18013
18014 @item -mno-flush-trap
18015 @opindex mno-flush-trap
18016 Specifies that the cache cannot be flushed by using a trap.
18017
18018 @item -mflush-func=@var{name}
18019 @opindex mflush-func=@var{name}
18020 Specifies the name of the operating system function to call to flush
18021 the cache. The default is @samp{_flush_cache}, but a function call
18022 is only used if a trap is not available.
18023
18024 @item -mno-flush-func
18025 @opindex mno-flush-func
18026 Indicates that there is no OS function for flushing the cache.
18027
18028 @end table
18029
18030 @node M680x0 Options
18031 @subsection M680x0 Options
18032 @cindex M680x0 options
18033
18034 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
18035 The default settings depend on which architecture was selected when
18036 the compiler was configured; the defaults for the most common choices
18037 are given below.
18038
18039 @table @gcctabopt
18040 @item -march=@var{arch}
18041 @opindex march
18042 Generate code for a specific M680x0 or ColdFire instruction set
18043 architecture. Permissible values of @var{arch} for M680x0
18044 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
18045 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
18046 architectures are selected according to Freescale's ISA classification
18047 and the permissible values are: @samp{isaa}, @samp{isaaplus},
18048 @samp{isab} and @samp{isac}.
18049
18050 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
18051 code for a ColdFire target. The @var{arch} in this macro is one of the
18052 @option{-march} arguments given above.
18053
18054 When used together, @option{-march} and @option{-mtune} select code
18055 that runs on a family of similar processors but that is optimized
18056 for a particular microarchitecture.
18057
18058 @item -mcpu=@var{cpu}
18059 @opindex mcpu
18060 Generate code for a specific M680x0 or ColdFire processor.
18061 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
18062 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
18063 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
18064 below, which also classifies the CPUs into families:
18065
18066 @multitable @columnfractions 0.20 0.80
18067 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
18068 @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}
18069 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
18070 @item @samp{5206e} @tab @samp{5206e}
18071 @item @samp{5208} @tab @samp{5207} @samp{5208}
18072 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
18073 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
18074 @item @samp{5216} @tab @samp{5214} @samp{5216}
18075 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
18076 @item @samp{5225} @tab @samp{5224} @samp{5225}
18077 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
18078 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
18079 @item @samp{5249} @tab @samp{5249}
18080 @item @samp{5250} @tab @samp{5250}
18081 @item @samp{5271} @tab @samp{5270} @samp{5271}
18082 @item @samp{5272} @tab @samp{5272}
18083 @item @samp{5275} @tab @samp{5274} @samp{5275}
18084 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
18085 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
18086 @item @samp{5307} @tab @samp{5307}
18087 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
18088 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
18089 @item @samp{5407} @tab @samp{5407}
18090 @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}
18091 @end multitable
18092
18093 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
18094 @var{arch} is compatible with @var{cpu}. Other combinations of
18095 @option{-mcpu} and @option{-march} are rejected.
18096
18097 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
18098 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
18099 where the value of @var{family} is given by the table above.
18100
18101 @item -mtune=@var{tune}
18102 @opindex mtune
18103 Tune the code for a particular microarchitecture within the
18104 constraints set by @option{-march} and @option{-mcpu}.
18105 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
18106 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
18107 and @samp{cpu32}. The ColdFire microarchitectures
18108 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
18109
18110 You can also use @option{-mtune=68020-40} for code that needs
18111 to run relatively well on 68020, 68030 and 68040 targets.
18112 @option{-mtune=68020-60} is similar but includes 68060 targets
18113 as well. These two options select the same tuning decisions as
18114 @option{-m68020-40} and @option{-m68020-60} respectively.
18115
18116 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
18117 when tuning for 680x0 architecture @var{arch}. It also defines
18118 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
18119 option is used. If GCC is tuning for a range of architectures,
18120 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
18121 it defines the macros for every architecture in the range.
18122
18123 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
18124 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
18125 of the arguments given above.
18126
18127 @item -m68000
18128 @itemx -mc68000
18129 @opindex m68000
18130 @opindex mc68000
18131 Generate output for a 68000. This is the default
18132 when the compiler is configured for 68000-based systems.
18133 It is equivalent to @option{-march=68000}.
18134
18135 Use this option for microcontrollers with a 68000 or EC000 core,
18136 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
18137
18138 @item -m68010
18139 @opindex m68010
18140 Generate output for a 68010. This is the default
18141 when the compiler is configured for 68010-based systems.
18142 It is equivalent to @option{-march=68010}.
18143
18144 @item -m68020
18145 @itemx -mc68020
18146 @opindex m68020
18147 @opindex mc68020
18148 Generate output for a 68020. This is the default
18149 when the compiler is configured for 68020-based systems.
18150 It is equivalent to @option{-march=68020}.
18151
18152 @item -m68030
18153 @opindex m68030
18154 Generate output for a 68030. This is the default when the compiler is
18155 configured for 68030-based systems. It is equivalent to
18156 @option{-march=68030}.
18157
18158 @item -m68040
18159 @opindex m68040
18160 Generate output for a 68040. This is the default when the compiler is
18161 configured for 68040-based systems. It is equivalent to
18162 @option{-march=68040}.
18163
18164 This option inhibits the use of 68881/68882 instructions that have to be
18165 emulated by software on the 68040. Use this option if your 68040 does not
18166 have code to emulate those instructions.
18167
18168 @item -m68060
18169 @opindex m68060
18170 Generate output for a 68060. This is the default when the compiler is
18171 configured for 68060-based systems. It is equivalent to
18172 @option{-march=68060}.
18173
18174 This option inhibits the use of 68020 and 68881/68882 instructions that
18175 have to be emulated by software on the 68060. Use this option if your 68060
18176 does not have code to emulate those instructions.
18177
18178 @item -mcpu32
18179 @opindex mcpu32
18180 Generate output for a CPU32. This is the default
18181 when the compiler is configured for CPU32-based systems.
18182 It is equivalent to @option{-march=cpu32}.
18183
18184 Use this option for microcontrollers with a
18185 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
18186 68336, 68340, 68341, 68349 and 68360.
18187
18188 @item -m5200
18189 @opindex m5200
18190 Generate output for a 520X ColdFire CPU@. This is the default
18191 when the compiler is configured for 520X-based systems.
18192 It is equivalent to @option{-mcpu=5206}, and is now deprecated
18193 in favor of that option.
18194
18195 Use this option for microcontroller with a 5200 core, including
18196 the MCF5202, MCF5203, MCF5204 and MCF5206.
18197
18198 @item -m5206e
18199 @opindex m5206e
18200 Generate output for a 5206e ColdFire CPU@. The option is now
18201 deprecated in favor of the equivalent @option{-mcpu=5206e}.
18202
18203 @item -m528x
18204 @opindex m528x
18205 Generate output for a member of the ColdFire 528X family.
18206 The option is now deprecated in favor of the equivalent
18207 @option{-mcpu=528x}.
18208
18209 @item -m5307
18210 @opindex m5307
18211 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
18212 in favor of the equivalent @option{-mcpu=5307}.
18213
18214 @item -m5407
18215 @opindex m5407
18216 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
18217 in favor of the equivalent @option{-mcpu=5407}.
18218
18219 @item -mcfv4e
18220 @opindex mcfv4e
18221 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
18222 This includes use of hardware floating-point instructions.
18223 The option is equivalent to @option{-mcpu=547x}, and is now
18224 deprecated in favor of that option.
18225
18226 @item -m68020-40
18227 @opindex m68020-40
18228 Generate output for a 68040, without using any of the new instructions.
18229 This results in code that can run relatively efficiently on either a
18230 68020/68881 or a 68030 or a 68040. The generated code does use the
18231 68881 instructions that are emulated on the 68040.
18232
18233 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
18234
18235 @item -m68020-60
18236 @opindex m68020-60
18237 Generate output for a 68060, without using any of the new instructions.
18238 This results in code that can run relatively efficiently on either a
18239 68020/68881 or a 68030 or a 68040. The generated code does use the
18240 68881 instructions that are emulated on the 68060.
18241
18242 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
18243
18244 @item -mhard-float
18245 @itemx -m68881
18246 @opindex mhard-float
18247 @opindex m68881
18248 Generate floating-point instructions. This is the default for 68020
18249 and above, and for ColdFire devices that have an FPU@. It defines the
18250 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
18251 on ColdFire targets.
18252
18253 @item -msoft-float
18254 @opindex msoft-float
18255 Do not generate floating-point instructions; use library calls instead.
18256 This is the default for 68000, 68010, and 68832 targets. It is also
18257 the default for ColdFire devices that have no FPU.
18258
18259 @item -mdiv
18260 @itemx -mno-div
18261 @opindex mdiv
18262 @opindex mno-div
18263 Generate (do not generate) ColdFire hardware divide and remainder
18264 instructions. If @option{-march} is used without @option{-mcpu},
18265 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
18266 architectures. Otherwise, the default is taken from the target CPU
18267 (either the default CPU, or the one specified by @option{-mcpu}). For
18268 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
18269 @option{-mcpu=5206e}.
18270
18271 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
18272
18273 @item -mshort
18274 @opindex mshort
18275 Consider type @code{int} to be 16 bits wide, like @code{short int}.
18276 Additionally, parameters passed on the stack are also aligned to a
18277 16-bit boundary even on targets whose API mandates promotion to 32-bit.
18278
18279 @item -mno-short
18280 @opindex mno-short
18281 Do not consider type @code{int} to be 16 bits wide. This is the default.
18282
18283 @item -mnobitfield
18284 @itemx -mno-bitfield
18285 @opindex mnobitfield
18286 @opindex mno-bitfield
18287 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
18288 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
18289
18290 @item -mbitfield
18291 @opindex mbitfield
18292 Do use the bit-field instructions. The @option{-m68020} option implies
18293 @option{-mbitfield}. This is the default if you use a configuration
18294 designed for a 68020.
18295
18296 @item -mrtd
18297 @opindex mrtd
18298 Use a different function-calling convention, in which functions
18299 that take a fixed number of arguments return with the @code{rtd}
18300 instruction, which pops their arguments while returning. This
18301 saves one instruction in the caller since there is no need to pop
18302 the arguments there.
18303
18304 This calling convention is incompatible with the one normally
18305 used on Unix, so you cannot use it if you need to call libraries
18306 compiled with the Unix compiler.
18307
18308 Also, you must provide function prototypes for all functions that
18309 take variable numbers of arguments (including @code{printf});
18310 otherwise incorrect code is generated for calls to those
18311 functions.
18312
18313 In addition, seriously incorrect code results if you call a
18314 function with too many arguments. (Normally, extra arguments are
18315 harmlessly ignored.)
18316
18317 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
18318 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
18319
18320 @item -mno-rtd
18321 @opindex mno-rtd
18322 Do not use the calling conventions selected by @option{-mrtd}.
18323 This is the default.
18324
18325 @item -malign-int
18326 @itemx -mno-align-int
18327 @opindex malign-int
18328 @opindex mno-align-int
18329 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
18330 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
18331 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
18332 Aligning variables on 32-bit boundaries produces code that runs somewhat
18333 faster on processors with 32-bit busses at the expense of more memory.
18334
18335 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
18336 aligns structures containing the above types differently than
18337 most published application binary interface specifications for the m68k.
18338
18339 @item -mpcrel
18340 @opindex mpcrel
18341 Use the pc-relative addressing mode of the 68000 directly, instead of
18342 using a global offset table. At present, this option implies @option{-fpic},
18343 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
18344 not presently supported with @option{-mpcrel}, though this could be supported for
18345 68020 and higher processors.
18346
18347 @item -mno-strict-align
18348 @itemx -mstrict-align
18349 @opindex mno-strict-align
18350 @opindex mstrict-align
18351 Do not (do) assume that unaligned memory references are handled by
18352 the system.
18353
18354 @item -msep-data
18355 Generate code that allows the data segment to be located in a different
18356 area of memory from the text segment. This allows for execute-in-place in
18357 an environment without virtual memory management. This option implies
18358 @option{-fPIC}.
18359
18360 @item -mno-sep-data
18361 Generate code that assumes that the data segment follows the text segment.
18362 This is the default.
18363
18364 @item -mid-shared-library
18365 Generate code that supports shared libraries via the library ID method.
18366 This allows for execute-in-place and shared libraries in an environment
18367 without virtual memory management. This option implies @option{-fPIC}.
18368
18369 @item -mno-id-shared-library
18370 Generate code that doesn't assume ID-based shared libraries are being used.
18371 This is the default.
18372
18373 @item -mshared-library-id=n
18374 Specifies the identification number of the ID-based shared library being
18375 compiled. Specifying a value of 0 generates more compact code; specifying
18376 other values forces the allocation of that number to the current
18377 library, but is no more space- or time-efficient than omitting this option.
18378
18379 @item -mxgot
18380 @itemx -mno-xgot
18381 @opindex mxgot
18382 @opindex mno-xgot
18383 When generating position-independent code for ColdFire, generate code
18384 that works if the GOT has more than 8192 entries. This code is
18385 larger and slower than code generated without this option. On M680x0
18386 processors, this option is not needed; @option{-fPIC} suffices.
18387
18388 GCC normally uses a single instruction to load values from the GOT@.
18389 While this is relatively efficient, it only works if the GOT
18390 is smaller than about 64k. Anything larger causes the linker
18391 to report an error such as:
18392
18393 @cindex relocation truncated to fit (ColdFire)
18394 @smallexample
18395 relocation truncated to fit: R_68K_GOT16O foobar
18396 @end smallexample
18397
18398 If this happens, you should recompile your code with @option{-mxgot}.
18399 It should then work with very large GOTs. However, code generated with
18400 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
18401 the value of a global symbol.
18402
18403 Note that some linkers, including newer versions of the GNU linker,
18404 can create multiple GOTs and sort GOT entries. If you have such a linker,
18405 you should only need to use @option{-mxgot} when compiling a single
18406 object file that accesses more than 8192 GOT entries. Very few do.
18407
18408 These options have no effect unless GCC is generating
18409 position-independent code.
18410
18411 @end table
18412
18413 @node MCore Options
18414 @subsection MCore Options
18415 @cindex MCore options
18416
18417 These are the @samp{-m} options defined for the Motorola M*Core
18418 processors.
18419
18420 @table @gcctabopt
18421
18422 @item -mhardlit
18423 @itemx -mno-hardlit
18424 @opindex mhardlit
18425 @opindex mno-hardlit
18426 Inline constants into the code stream if it can be done in two
18427 instructions or less.
18428
18429 @item -mdiv
18430 @itemx -mno-div
18431 @opindex mdiv
18432 @opindex mno-div
18433 Use the divide instruction. (Enabled by default).
18434
18435 @item -mrelax-immediate
18436 @itemx -mno-relax-immediate
18437 @opindex mrelax-immediate
18438 @opindex mno-relax-immediate
18439 Allow arbitrary-sized immediates in bit operations.
18440
18441 @item -mwide-bitfields
18442 @itemx -mno-wide-bitfields
18443 @opindex mwide-bitfields
18444 @opindex mno-wide-bitfields
18445 Always treat bit-fields as @code{int}-sized.
18446
18447 @item -m4byte-functions
18448 @itemx -mno-4byte-functions
18449 @opindex m4byte-functions
18450 @opindex mno-4byte-functions
18451 Force all functions to be aligned to a 4-byte boundary.
18452
18453 @item -mcallgraph-data
18454 @itemx -mno-callgraph-data
18455 @opindex mcallgraph-data
18456 @opindex mno-callgraph-data
18457 Emit callgraph information.
18458
18459 @item -mslow-bytes
18460 @itemx -mno-slow-bytes
18461 @opindex mslow-bytes
18462 @opindex mno-slow-bytes
18463 Prefer word access when reading byte quantities.
18464
18465 @item -mlittle-endian
18466 @itemx -mbig-endian
18467 @opindex mlittle-endian
18468 @opindex mbig-endian
18469 Generate code for a little-endian target.
18470
18471 @item -m210
18472 @itemx -m340
18473 @opindex m210
18474 @opindex m340
18475 Generate code for the 210 processor.
18476
18477 @item -mno-lsim
18478 @opindex mno-lsim
18479 Assume that runtime support has been provided and so omit the
18480 simulator library (@file{libsim.a)} from the linker command line.
18481
18482 @item -mstack-increment=@var{size}
18483 @opindex mstack-increment
18484 Set the maximum amount for a single stack increment operation. Large
18485 values can increase the speed of programs that contain functions
18486 that need a large amount of stack space, but they can also trigger a
18487 segmentation fault if the stack is extended too much. The default
18488 value is 0x1000.
18489
18490 @end table
18491
18492 @node MeP Options
18493 @subsection MeP Options
18494 @cindex MeP options
18495
18496 @table @gcctabopt
18497
18498 @item -mabsdiff
18499 @opindex mabsdiff
18500 Enables the @code{abs} instruction, which is the absolute difference
18501 between two registers.
18502
18503 @item -mall-opts
18504 @opindex mall-opts
18505 Enables all the optional instructions---average, multiply, divide, bit
18506 operations, leading zero, absolute difference, min/max, clip, and
18507 saturation.
18508
18509
18510 @item -maverage
18511 @opindex maverage
18512 Enables the @code{ave} instruction, which computes the average of two
18513 registers.
18514
18515 @item -mbased=@var{n}
18516 @opindex mbased=
18517 Variables of size @var{n} bytes or smaller are placed in the
18518 @code{.based} section by default. Based variables use the @code{$tp}
18519 register as a base register, and there is a 128-byte limit to the
18520 @code{.based} section.
18521
18522 @item -mbitops
18523 @opindex mbitops
18524 Enables the bit operation instructions---bit test (@code{btstm}), set
18525 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
18526 test-and-set (@code{tas}).
18527
18528 @item -mc=@var{name}
18529 @opindex mc=
18530 Selects which section constant data is placed in. @var{name} may
18531 be @samp{tiny}, @samp{near}, or @samp{far}.
18532
18533 @item -mclip
18534 @opindex mclip
18535 Enables the @code{clip} instruction. Note that @option{-mclip} is not
18536 useful unless you also provide @option{-mminmax}.
18537
18538 @item -mconfig=@var{name}
18539 @opindex mconfig=
18540 Selects one of the built-in core configurations. Each MeP chip has
18541 one or more modules in it; each module has a core CPU and a variety of
18542 coprocessors, optional instructions, and peripherals. The
18543 @code{MeP-Integrator} tool, not part of GCC, provides these
18544 configurations through this option; using this option is the same as
18545 using all the corresponding command-line options. The default
18546 configuration is @samp{default}.
18547
18548 @item -mcop
18549 @opindex mcop
18550 Enables the coprocessor instructions. By default, this is a 32-bit
18551 coprocessor. Note that the coprocessor is normally enabled via the
18552 @option{-mconfig=} option.
18553
18554 @item -mcop32
18555 @opindex mcop32
18556 Enables the 32-bit coprocessor's instructions.
18557
18558 @item -mcop64
18559 @opindex mcop64
18560 Enables the 64-bit coprocessor's instructions.
18561
18562 @item -mivc2
18563 @opindex mivc2
18564 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
18565
18566 @item -mdc
18567 @opindex mdc
18568 Causes constant variables to be placed in the @code{.near} section.
18569
18570 @item -mdiv
18571 @opindex mdiv
18572 Enables the @code{div} and @code{divu} instructions.
18573
18574 @item -meb
18575 @opindex meb
18576 Generate big-endian code.
18577
18578 @item -mel
18579 @opindex mel
18580 Generate little-endian code.
18581
18582 @item -mio-volatile
18583 @opindex mio-volatile
18584 Tells the compiler that any variable marked with the @code{io}
18585 attribute is to be considered volatile.
18586
18587 @item -ml
18588 @opindex ml
18589 Causes variables to be assigned to the @code{.far} section by default.
18590
18591 @item -mleadz
18592 @opindex mleadz
18593 Enables the @code{leadz} (leading zero) instruction.
18594
18595 @item -mm
18596 @opindex mm
18597 Causes variables to be assigned to the @code{.near} section by default.
18598
18599 @item -mminmax
18600 @opindex mminmax
18601 Enables the @code{min} and @code{max} instructions.
18602
18603 @item -mmult
18604 @opindex mmult
18605 Enables the multiplication and multiply-accumulate instructions.
18606
18607 @item -mno-opts
18608 @opindex mno-opts
18609 Disables all the optional instructions enabled by @option{-mall-opts}.
18610
18611 @item -mrepeat
18612 @opindex mrepeat
18613 Enables the @code{repeat} and @code{erepeat} instructions, used for
18614 low-overhead looping.
18615
18616 @item -ms
18617 @opindex ms
18618 Causes all variables to default to the @code{.tiny} section. Note
18619 that there is a 65536-byte limit to this section. Accesses to these
18620 variables use the @code{%gp} base register.
18621
18622 @item -msatur
18623 @opindex msatur
18624 Enables the saturation instructions. Note that the compiler does not
18625 currently generate these itself, but this option is included for
18626 compatibility with other tools, like @code{as}.
18627
18628 @item -msdram
18629 @opindex msdram
18630 Link the SDRAM-based runtime instead of the default ROM-based runtime.
18631
18632 @item -msim
18633 @opindex msim
18634 Link the simulator run-time libraries.
18635
18636 @item -msimnovec
18637 @opindex msimnovec
18638 Link the simulator runtime libraries, excluding built-in support
18639 for reset and exception vectors and tables.
18640
18641 @item -mtf
18642 @opindex mtf
18643 Causes all functions to default to the @code{.far} section. Without
18644 this option, functions default to the @code{.near} section.
18645
18646 @item -mtiny=@var{n}
18647 @opindex mtiny=
18648 Variables that are @var{n} bytes or smaller are allocated to the
18649 @code{.tiny} section. These variables use the @code{$gp} base
18650 register. The default for this option is 4, but note that there's a
18651 65536-byte limit to the @code{.tiny} section.
18652
18653 @end table
18654
18655 @node MicroBlaze Options
18656 @subsection MicroBlaze Options
18657 @cindex MicroBlaze Options
18658
18659 @table @gcctabopt
18660
18661 @item -msoft-float
18662 @opindex msoft-float
18663 Use software emulation for floating point (default).
18664
18665 @item -mhard-float
18666 @opindex mhard-float
18667 Use hardware floating-point instructions.
18668
18669 @item -mmemcpy
18670 @opindex mmemcpy
18671 Do not optimize block moves, use @code{memcpy}.
18672
18673 @item -mno-clearbss
18674 @opindex mno-clearbss
18675 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
18676
18677 @item -mcpu=@var{cpu-type}
18678 @opindex mcpu=
18679 Use features of, and schedule code for, the given CPU.
18680 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
18681 where @var{X} is a major version, @var{YY} is the minor version, and
18682 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
18683 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
18684
18685 @item -mxl-soft-mul
18686 @opindex mxl-soft-mul
18687 Use software multiply emulation (default).
18688
18689 @item -mxl-soft-div
18690 @opindex mxl-soft-div
18691 Use software emulation for divides (default).
18692
18693 @item -mxl-barrel-shift
18694 @opindex mxl-barrel-shift
18695 Use the hardware barrel shifter.
18696
18697 @item -mxl-pattern-compare
18698 @opindex mxl-pattern-compare
18699 Use pattern compare instructions.
18700
18701 @item -msmall-divides
18702 @opindex msmall-divides
18703 Use table lookup optimization for small signed integer divisions.
18704
18705 @item -mxl-stack-check
18706 @opindex mxl-stack-check
18707 This option is deprecated. Use @option{-fstack-check} instead.
18708
18709 @item -mxl-gp-opt
18710 @opindex mxl-gp-opt
18711 Use GP-relative @code{.sdata}/@code{.sbss} sections.
18712
18713 @item -mxl-multiply-high
18714 @opindex mxl-multiply-high
18715 Use multiply high instructions for high part of 32x32 multiply.
18716
18717 @item -mxl-float-convert
18718 @opindex mxl-float-convert
18719 Use hardware floating-point conversion instructions.
18720
18721 @item -mxl-float-sqrt
18722 @opindex mxl-float-sqrt
18723 Use hardware floating-point square root instruction.
18724
18725 @item -mbig-endian
18726 @opindex mbig-endian
18727 Generate code for a big-endian target.
18728
18729 @item -mlittle-endian
18730 @opindex mlittle-endian
18731 Generate code for a little-endian target.
18732
18733 @item -mxl-reorder
18734 @opindex mxl-reorder
18735 Use reorder instructions (swap and byte reversed load/store).
18736
18737 @item -mxl-mode-@var{app-model}
18738 Select application model @var{app-model}. Valid models are
18739 @table @samp
18740 @item executable
18741 normal executable (default), uses startup code @file{crt0.o}.
18742
18743 @item xmdstub
18744 for use with Xilinx Microprocessor Debugger (XMD) based
18745 software intrusive debug agent called xmdstub. This uses startup file
18746 @file{crt1.o} and sets the start address of the program to 0x800.
18747
18748 @item bootstrap
18749 for applications that are loaded using a bootloader.
18750 This model uses startup file @file{crt2.o} which does not contain a processor
18751 reset vector handler. This is suitable for transferring control on a
18752 processor reset to the bootloader rather than the application.
18753
18754 @item novectors
18755 for applications that do not require any of the
18756 MicroBlaze vectors. This option may be useful for applications running
18757 within a monitoring application. This model uses @file{crt3.o} as a startup file.
18758 @end table
18759
18760 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
18761 @option{-mxl-mode-@var{app-model}}.
18762
18763 @end table
18764
18765 @node MIPS Options
18766 @subsection MIPS Options
18767 @cindex MIPS options
18768
18769 @table @gcctabopt
18770
18771 @item -EB
18772 @opindex EB
18773 Generate big-endian code.
18774
18775 @item -EL
18776 @opindex EL
18777 Generate little-endian code. This is the default for @samp{mips*el-*-*}
18778 configurations.
18779
18780 @item -march=@var{arch}
18781 @opindex march
18782 Generate code that runs on @var{arch}, which can be the name of a
18783 generic MIPS ISA, or the name of a particular processor.
18784 The ISA names are:
18785 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
18786 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
18787 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
18788 @samp{mips64r5} and @samp{mips64r6}.
18789 The processor names are:
18790 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
18791 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
18792 @samp{5kc}, @samp{5kf},
18793 @samp{20kc},
18794 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
18795 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
18796 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
18797 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
18798 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
18799 @samp{i6400},
18800 @samp{interaptiv},
18801 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
18802 @samp{m4k},
18803 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
18804 @samp{m5100}, @samp{m5101},
18805 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
18806 @samp{orion},
18807 @samp{p5600},
18808 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
18809 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
18810 @samp{rm7000}, @samp{rm9000},
18811 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
18812 @samp{sb1},
18813 @samp{sr71000},
18814 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
18815 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
18816 @samp{xlr} and @samp{xlp}.
18817 The special value @samp{from-abi} selects the
18818 most compatible architecture for the selected ABI (that is,
18819 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
18820
18821 The native Linux/GNU toolchain also supports the value @samp{native},
18822 which selects the best architecture option for the host processor.
18823 @option{-march=native} has no effect if GCC does not recognize
18824 the processor.
18825
18826 In processor names, a final @samp{000} can be abbreviated as @samp{k}
18827 (for example, @option{-march=r2k}). Prefixes are optional, and
18828 @samp{vr} may be written @samp{r}.
18829
18830 Names of the form @samp{@var{n}f2_1} refer to processors with
18831 FPUs clocked at half the rate of the core, names of the form
18832 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
18833 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
18834 processors with FPUs clocked a ratio of 3:2 with respect to the core.
18835 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
18836 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
18837 accepted as synonyms for @samp{@var{n}f1_1}.
18838
18839 GCC defines two macros based on the value of this option. The first
18840 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
18841 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
18842 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
18843 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
18844 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
18845
18846 Note that the @code{_MIPS_ARCH} macro uses the processor names given
18847 above. In other words, it has the full prefix and does not
18848 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
18849 the macro names the resolved architecture (either @code{"mips1"} or
18850 @code{"mips3"}). It names the default architecture when no
18851 @option{-march} option is given.
18852
18853 @item -mtune=@var{arch}
18854 @opindex mtune
18855 Optimize for @var{arch}. Among other things, this option controls
18856 the way instructions are scheduled, and the perceived cost of arithmetic
18857 operations. The list of @var{arch} values is the same as for
18858 @option{-march}.
18859
18860 When this option is not used, GCC optimizes for the processor
18861 specified by @option{-march}. By using @option{-march} and
18862 @option{-mtune} together, it is possible to generate code that
18863 runs on a family of processors, but optimize the code for one
18864 particular member of that family.
18865
18866 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
18867 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
18868 @option{-march} ones described above.
18869
18870 @item -mips1
18871 @opindex mips1
18872 Equivalent to @option{-march=mips1}.
18873
18874 @item -mips2
18875 @opindex mips2
18876 Equivalent to @option{-march=mips2}.
18877
18878 @item -mips3
18879 @opindex mips3
18880 Equivalent to @option{-march=mips3}.
18881
18882 @item -mips4
18883 @opindex mips4
18884 Equivalent to @option{-march=mips4}.
18885
18886 @item -mips32
18887 @opindex mips32
18888 Equivalent to @option{-march=mips32}.
18889
18890 @item -mips32r3
18891 @opindex mips32r3
18892 Equivalent to @option{-march=mips32r3}.
18893
18894 @item -mips32r5
18895 @opindex mips32r5
18896 Equivalent to @option{-march=mips32r5}.
18897
18898 @item -mips32r6
18899 @opindex mips32r6
18900 Equivalent to @option{-march=mips32r6}.
18901
18902 @item -mips64
18903 @opindex mips64
18904 Equivalent to @option{-march=mips64}.
18905
18906 @item -mips64r2
18907 @opindex mips64r2
18908 Equivalent to @option{-march=mips64r2}.
18909
18910 @item -mips64r3
18911 @opindex mips64r3
18912 Equivalent to @option{-march=mips64r3}.
18913
18914 @item -mips64r5
18915 @opindex mips64r5
18916 Equivalent to @option{-march=mips64r5}.
18917
18918 @item -mips64r6
18919 @opindex mips64r6
18920 Equivalent to @option{-march=mips64r6}.
18921
18922 @item -mips16
18923 @itemx -mno-mips16
18924 @opindex mips16
18925 @opindex mno-mips16
18926 Generate (do not generate) MIPS16 code. If GCC is targeting a
18927 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
18928
18929 MIPS16 code generation can also be controlled on a per-function basis
18930 by means of @code{mips16} and @code{nomips16} attributes.
18931 @xref{Function Attributes}, for more information.
18932
18933 @item -mflip-mips16
18934 @opindex mflip-mips16
18935 Generate MIPS16 code on alternating functions. This option is provided
18936 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
18937 not intended for ordinary use in compiling user code.
18938
18939 @item -minterlink-compressed
18940 @item -mno-interlink-compressed
18941 @opindex minterlink-compressed
18942 @opindex mno-interlink-compressed
18943 Require (do not require) that code using the standard (uncompressed) MIPS ISA
18944 be link-compatible with MIPS16 and microMIPS code, and vice versa.
18945
18946 For example, code using the standard ISA encoding cannot jump directly
18947 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
18948 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
18949 knows that the target of the jump is not compressed.
18950
18951 @item -minterlink-mips16
18952 @itemx -mno-interlink-mips16
18953 @opindex minterlink-mips16
18954 @opindex mno-interlink-mips16
18955 Aliases of @option{-minterlink-compressed} and
18956 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
18957 and are retained for backwards compatibility.
18958
18959 @item -mabi=32
18960 @itemx -mabi=o64
18961 @itemx -mabi=n32
18962 @itemx -mabi=64
18963 @itemx -mabi=eabi
18964 @opindex mabi=32
18965 @opindex mabi=o64
18966 @opindex mabi=n32
18967 @opindex mabi=64
18968 @opindex mabi=eabi
18969 Generate code for the given ABI@.
18970
18971 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
18972 generates 64-bit code when you select a 64-bit architecture, but you
18973 can use @option{-mgp32} to get 32-bit code instead.
18974
18975 For information about the O64 ABI, see
18976 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
18977
18978 GCC supports a variant of the o32 ABI in which floating-point registers
18979 are 64 rather than 32 bits wide. You can select this combination with
18980 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
18981 and @code{mfhc1} instructions and is therefore only supported for
18982 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
18983
18984 The register assignments for arguments and return values remain the
18985 same, but each scalar value is passed in a single 64-bit register
18986 rather than a pair of 32-bit registers. For example, scalar
18987 floating-point values are returned in @samp{$f0} only, not a
18988 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
18989 remains the same in that the even-numbered double-precision registers
18990 are saved.
18991
18992 Two additional variants of the o32 ABI are supported to enable
18993 a transition from 32-bit to 64-bit registers. These are FPXX
18994 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
18995 The FPXX extension mandates that all code must execute correctly
18996 when run using 32-bit or 64-bit registers. The code can be interlinked
18997 with either FP32 or FP64, but not both.
18998 The FP64A extension is similar to the FP64 extension but forbids the
18999 use of odd-numbered single-precision registers. This can be used
19000 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
19001 processors and allows both FP32 and FP64A code to interlink and
19002 run in the same process without changing FPU modes.
19003
19004 @item -mabicalls
19005 @itemx -mno-abicalls
19006 @opindex mabicalls
19007 @opindex mno-abicalls
19008 Generate (do not generate) code that is suitable for SVR4-style
19009 dynamic objects. @option{-mabicalls} is the default for SVR4-based
19010 systems.
19011
19012 @item -mshared
19013 @itemx -mno-shared
19014 Generate (do not generate) code that is fully position-independent,
19015 and that can therefore be linked into shared libraries. This option
19016 only affects @option{-mabicalls}.
19017
19018 All @option{-mabicalls} code has traditionally been position-independent,
19019 regardless of options like @option{-fPIC} and @option{-fpic}. However,
19020 as an extension, the GNU toolchain allows executables to use absolute
19021 accesses for locally-binding symbols. It can also use shorter GP
19022 initialization sequences and generate direct calls to locally-defined
19023 functions. This mode is selected by @option{-mno-shared}.
19024
19025 @option{-mno-shared} depends on binutils 2.16 or higher and generates
19026 objects that can only be linked by the GNU linker. However, the option
19027 does not affect the ABI of the final executable; it only affects the ABI
19028 of relocatable objects. Using @option{-mno-shared} generally makes
19029 executables both smaller and quicker.
19030
19031 @option{-mshared} is the default.
19032
19033 @item -mplt
19034 @itemx -mno-plt
19035 @opindex mplt
19036 @opindex mno-plt
19037 Assume (do not assume) that the static and dynamic linkers
19038 support PLTs and copy relocations. This option only affects
19039 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
19040 has no effect without @option{-msym32}.
19041
19042 You can make @option{-mplt} the default by configuring
19043 GCC with @option{--with-mips-plt}. The default is
19044 @option{-mno-plt} otherwise.
19045
19046 @item -mxgot
19047 @itemx -mno-xgot
19048 @opindex mxgot
19049 @opindex mno-xgot
19050 Lift (do not lift) the usual restrictions on the size of the global
19051 offset table.
19052
19053 GCC normally uses a single instruction to load values from the GOT@.
19054 While this is relatively efficient, it only works if the GOT
19055 is smaller than about 64k. Anything larger causes the linker
19056 to report an error such as:
19057
19058 @cindex relocation truncated to fit (MIPS)
19059 @smallexample
19060 relocation truncated to fit: R_MIPS_GOT16 foobar
19061 @end smallexample
19062
19063 If this happens, you should recompile your code with @option{-mxgot}.
19064 This works with very large GOTs, although the code is also
19065 less efficient, since it takes three instructions to fetch the
19066 value of a global symbol.
19067
19068 Note that some linkers can create multiple GOTs. If you have such a
19069 linker, you should only need to use @option{-mxgot} when a single object
19070 file accesses more than 64k's worth of GOT entries. Very few do.
19071
19072 These options have no effect unless GCC is generating position
19073 independent code.
19074
19075 @item -mgp32
19076 @opindex mgp32
19077 Assume that general-purpose registers are 32 bits wide.
19078
19079 @item -mgp64
19080 @opindex mgp64
19081 Assume that general-purpose registers are 64 bits wide.
19082
19083 @item -mfp32
19084 @opindex mfp32
19085 Assume that floating-point registers are 32 bits wide.
19086
19087 @item -mfp64
19088 @opindex mfp64
19089 Assume that floating-point registers are 64 bits wide.
19090
19091 @item -mfpxx
19092 @opindex mfpxx
19093 Do not assume the width of floating-point registers.
19094
19095 @item -mhard-float
19096 @opindex mhard-float
19097 Use floating-point coprocessor instructions.
19098
19099 @item -msoft-float
19100 @opindex msoft-float
19101 Do not use floating-point coprocessor instructions. Implement
19102 floating-point calculations using library calls instead.
19103
19104 @item -mno-float
19105 @opindex mno-float
19106 Equivalent to @option{-msoft-float}, but additionally asserts that the
19107 program being compiled does not perform any floating-point operations.
19108 This option is presently supported only by some bare-metal MIPS
19109 configurations, where it may select a special set of libraries
19110 that lack all floating-point support (including, for example, the
19111 floating-point @code{printf} formats).
19112 If code compiled with @option{-mno-float} accidentally contains
19113 floating-point operations, it is likely to suffer a link-time
19114 or run-time failure.
19115
19116 @item -msingle-float
19117 @opindex msingle-float
19118 Assume that the floating-point coprocessor only supports single-precision
19119 operations.
19120
19121 @item -mdouble-float
19122 @opindex mdouble-float
19123 Assume that the floating-point coprocessor supports double-precision
19124 operations. This is the default.
19125
19126 @item -modd-spreg
19127 @itemx -mno-odd-spreg
19128 @opindex modd-spreg
19129 @opindex mno-odd-spreg
19130 Enable the use of odd-numbered single-precision floating-point registers
19131 for the o32 ABI. This is the default for processors that are known to
19132 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
19133 is set by default.
19134
19135 @item -mabs=2008
19136 @itemx -mabs=legacy
19137 @opindex mabs=2008
19138 @opindex mabs=legacy
19139 These options control the treatment of the special not-a-number (NaN)
19140 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
19141 @code{neg.@i{fmt}} machine instructions.
19142
19143 By default or when @option{-mabs=legacy} is used the legacy
19144 treatment is selected. In this case these instructions are considered
19145 arithmetic and avoided where correct operation is required and the
19146 input operand might be a NaN. A longer sequence of instructions that
19147 manipulate the sign bit of floating-point datum manually is used
19148 instead unless the @option{-ffinite-math-only} option has also been
19149 specified.
19150
19151 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
19152 this case these instructions are considered non-arithmetic and therefore
19153 operating correctly in all cases, including in particular where the
19154 input operand is a NaN. These instructions are therefore always used
19155 for the respective operations.
19156
19157 @item -mnan=2008
19158 @itemx -mnan=legacy
19159 @opindex mnan=2008
19160 @opindex mnan=legacy
19161 These options control the encoding of the special not-a-number (NaN)
19162 IEEE 754 floating-point data.
19163
19164 The @option{-mnan=legacy} option selects the legacy encoding. In this
19165 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
19166 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
19167 by the first bit of their trailing significand field being 1.
19168
19169 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
19170 this case qNaNs are denoted by the first bit of their trailing
19171 significand field being 1, whereas sNaNs are denoted by the first bit of
19172 their trailing significand field being 0.
19173
19174 The default is @option{-mnan=legacy} unless GCC has been configured with
19175 @option{--with-nan=2008}.
19176
19177 @item -mllsc
19178 @itemx -mno-llsc
19179 @opindex mllsc
19180 @opindex mno-llsc
19181 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
19182 implement atomic memory built-in functions. When neither option is
19183 specified, GCC uses the instructions if the target architecture
19184 supports them.
19185
19186 @option{-mllsc} is useful if the runtime environment can emulate the
19187 instructions and @option{-mno-llsc} can be useful when compiling for
19188 nonstandard ISAs. You can make either option the default by
19189 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
19190 respectively. @option{--with-llsc} is the default for some
19191 configurations; see the installation documentation for details.
19192
19193 @item -mdsp
19194 @itemx -mno-dsp
19195 @opindex mdsp
19196 @opindex mno-dsp
19197 Use (do not use) revision 1 of the MIPS DSP ASE@.
19198 @xref{MIPS DSP Built-in Functions}. This option defines the
19199 preprocessor macro @code{__mips_dsp}. It also defines
19200 @code{__mips_dsp_rev} to 1.
19201
19202 @item -mdspr2
19203 @itemx -mno-dspr2
19204 @opindex mdspr2
19205 @opindex mno-dspr2
19206 Use (do not use) revision 2 of the MIPS DSP ASE@.
19207 @xref{MIPS DSP Built-in Functions}. This option defines the
19208 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
19209 It also defines @code{__mips_dsp_rev} to 2.
19210
19211 @item -msmartmips
19212 @itemx -mno-smartmips
19213 @opindex msmartmips
19214 @opindex mno-smartmips
19215 Use (do not use) the MIPS SmartMIPS ASE.
19216
19217 @item -mpaired-single
19218 @itemx -mno-paired-single
19219 @opindex mpaired-single
19220 @opindex mno-paired-single
19221 Use (do not use) paired-single floating-point instructions.
19222 @xref{MIPS Paired-Single Support}. This option requires
19223 hardware floating-point support to be enabled.
19224
19225 @item -mdmx
19226 @itemx -mno-mdmx
19227 @opindex mdmx
19228 @opindex mno-mdmx
19229 Use (do not use) MIPS Digital Media Extension instructions.
19230 This option can only be used when generating 64-bit code and requires
19231 hardware floating-point support to be enabled.
19232
19233 @item -mips3d
19234 @itemx -mno-mips3d
19235 @opindex mips3d
19236 @opindex mno-mips3d
19237 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
19238 The option @option{-mips3d} implies @option{-mpaired-single}.
19239
19240 @item -mmicromips
19241 @itemx -mno-micromips
19242 @opindex mmicromips
19243 @opindex mno-mmicromips
19244 Generate (do not generate) microMIPS code.
19245
19246 MicroMIPS code generation can also be controlled on a per-function basis
19247 by means of @code{micromips} and @code{nomicromips} attributes.
19248 @xref{Function Attributes}, for more information.
19249
19250 @item -mmt
19251 @itemx -mno-mt
19252 @opindex mmt
19253 @opindex mno-mt
19254 Use (do not use) MT Multithreading instructions.
19255
19256 @item -mmcu
19257 @itemx -mno-mcu
19258 @opindex mmcu
19259 @opindex mno-mcu
19260 Use (do not use) the MIPS MCU ASE instructions.
19261
19262 @item -meva
19263 @itemx -mno-eva
19264 @opindex meva
19265 @opindex mno-eva
19266 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
19267
19268 @item -mvirt
19269 @itemx -mno-virt
19270 @opindex mvirt
19271 @opindex mno-virt
19272 Use (do not use) the MIPS Virtualization Application Specific instructions.
19273
19274 @item -mxpa
19275 @itemx -mno-xpa
19276 @opindex mxpa
19277 @opindex mno-xpa
19278 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
19279
19280 @item -mlong64
19281 @opindex mlong64
19282 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
19283 an explanation of the default and the way that the pointer size is
19284 determined.
19285
19286 @item -mlong32
19287 @opindex mlong32
19288 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
19289
19290 The default size of @code{int}s, @code{long}s and pointers depends on
19291 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
19292 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
19293 32-bit @code{long}s. Pointers are the same size as @code{long}s,
19294 or the same size as integer registers, whichever is smaller.
19295
19296 @item -msym32
19297 @itemx -mno-sym32
19298 @opindex msym32
19299 @opindex mno-sym32
19300 Assume (do not assume) that all symbols have 32-bit values, regardless
19301 of the selected ABI@. This option is useful in combination with
19302 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
19303 to generate shorter and faster references to symbolic addresses.
19304
19305 @item -G @var{num}
19306 @opindex G
19307 Put definitions of externally-visible data in a small data section
19308 if that data is no bigger than @var{num} bytes. GCC can then generate
19309 more efficient accesses to the data; see @option{-mgpopt} for details.
19310
19311 The default @option{-G} option depends on the configuration.
19312
19313 @item -mlocal-sdata
19314 @itemx -mno-local-sdata
19315 @opindex mlocal-sdata
19316 @opindex mno-local-sdata
19317 Extend (do not extend) the @option{-G} behavior to local data too,
19318 such as to static variables in C@. @option{-mlocal-sdata} is the
19319 default for all configurations.
19320
19321 If the linker complains that an application is using too much small data,
19322 you might want to try rebuilding the less performance-critical parts with
19323 @option{-mno-local-sdata}. You might also want to build large
19324 libraries with @option{-mno-local-sdata}, so that the libraries leave
19325 more room for the main program.
19326
19327 @item -mextern-sdata
19328 @itemx -mno-extern-sdata
19329 @opindex mextern-sdata
19330 @opindex mno-extern-sdata
19331 Assume (do not assume) that externally-defined data is in
19332 a small data section if the size of that data is within the @option{-G} limit.
19333 @option{-mextern-sdata} is the default for all configurations.
19334
19335 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
19336 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
19337 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
19338 is placed in a small data section. If @var{Var} is defined by another
19339 module, you must either compile that module with a high-enough
19340 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
19341 definition. If @var{Var} is common, you must link the application
19342 with a high-enough @option{-G} setting.
19343
19344 The easiest way of satisfying these restrictions is to compile
19345 and link every module with the same @option{-G} option. However,
19346 you may wish to build a library that supports several different
19347 small data limits. You can do this by compiling the library with
19348 the highest supported @option{-G} setting and additionally using
19349 @option{-mno-extern-sdata} to stop the library from making assumptions
19350 about externally-defined data.
19351
19352 @item -mgpopt
19353 @itemx -mno-gpopt
19354 @opindex mgpopt
19355 @opindex mno-gpopt
19356 Use (do not use) GP-relative accesses for symbols that are known to be
19357 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
19358 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
19359 configurations.
19360
19361 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
19362 might not hold the value of @code{_gp}. For example, if the code is
19363 part of a library that might be used in a boot monitor, programs that
19364 call boot monitor routines pass an unknown value in @code{$gp}.
19365 (In such situations, the boot monitor itself is usually compiled
19366 with @option{-G0}.)
19367
19368 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
19369 @option{-mno-extern-sdata}.
19370
19371 @item -membedded-data
19372 @itemx -mno-embedded-data
19373 @opindex membedded-data
19374 @opindex mno-embedded-data
19375 Allocate variables to the read-only data section first if possible, then
19376 next in the small data section if possible, otherwise in data. This gives
19377 slightly slower code than the default, but reduces the amount of RAM required
19378 when executing, and thus may be preferred for some embedded systems.
19379
19380 @item -muninit-const-in-rodata
19381 @itemx -mno-uninit-const-in-rodata
19382 @opindex muninit-const-in-rodata
19383 @opindex mno-uninit-const-in-rodata
19384 Put uninitialized @code{const} variables in the read-only data section.
19385 This option is only meaningful in conjunction with @option{-membedded-data}.
19386
19387 @item -mcode-readable=@var{setting}
19388 @opindex mcode-readable
19389 Specify whether GCC may generate code that reads from executable sections.
19390 There are three possible settings:
19391
19392 @table @gcctabopt
19393 @item -mcode-readable=yes
19394 Instructions may freely access executable sections. This is the
19395 default setting.
19396
19397 @item -mcode-readable=pcrel
19398 MIPS16 PC-relative load instructions can access executable sections,
19399 but other instructions must not do so. This option is useful on 4KSc
19400 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
19401 It is also useful on processors that can be configured to have a dual
19402 instruction/data SRAM interface and that, like the M4K, automatically
19403 redirect PC-relative loads to the instruction RAM.
19404
19405 @item -mcode-readable=no
19406 Instructions must not access executable sections. This option can be
19407 useful on targets that are configured to have a dual instruction/data
19408 SRAM interface but that (unlike the M4K) do not automatically redirect
19409 PC-relative loads to the instruction RAM.
19410 @end table
19411
19412 @item -msplit-addresses
19413 @itemx -mno-split-addresses
19414 @opindex msplit-addresses
19415 @opindex mno-split-addresses
19416 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
19417 relocation operators. This option has been superseded by
19418 @option{-mexplicit-relocs} but is retained for backwards compatibility.
19419
19420 @item -mexplicit-relocs
19421 @itemx -mno-explicit-relocs
19422 @opindex mexplicit-relocs
19423 @opindex mno-explicit-relocs
19424 Use (do not use) assembler relocation operators when dealing with symbolic
19425 addresses. The alternative, selected by @option{-mno-explicit-relocs},
19426 is to use assembler macros instead.
19427
19428 @option{-mexplicit-relocs} is the default if GCC was configured
19429 to use an assembler that supports relocation operators.
19430
19431 @item -mcheck-zero-division
19432 @itemx -mno-check-zero-division
19433 @opindex mcheck-zero-division
19434 @opindex mno-check-zero-division
19435 Trap (do not trap) on integer division by zero.
19436
19437 The default is @option{-mcheck-zero-division}.
19438
19439 @item -mdivide-traps
19440 @itemx -mdivide-breaks
19441 @opindex mdivide-traps
19442 @opindex mdivide-breaks
19443 MIPS systems check for division by zero by generating either a
19444 conditional trap or a break instruction. Using traps results in
19445 smaller code, but is only supported on MIPS II and later. Also, some
19446 versions of the Linux kernel have a bug that prevents trap from
19447 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
19448 allow conditional traps on architectures that support them and
19449 @option{-mdivide-breaks} to force the use of breaks.
19450
19451 The default is usually @option{-mdivide-traps}, but this can be
19452 overridden at configure time using @option{--with-divide=breaks}.
19453 Divide-by-zero checks can be completely disabled using
19454 @option{-mno-check-zero-division}.
19455
19456 @item -mmemcpy
19457 @itemx -mno-memcpy
19458 @opindex mmemcpy
19459 @opindex mno-memcpy
19460 Force (do not force) the use of @code{memcpy} for non-trivial block
19461 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
19462 most constant-sized copies.
19463
19464 @item -mlong-calls
19465 @itemx -mno-long-calls
19466 @opindex mlong-calls
19467 @opindex mno-long-calls
19468 Disable (do not disable) use of the @code{jal} instruction. Calling
19469 functions using @code{jal} is more efficient but requires the caller
19470 and callee to be in the same 256 megabyte segment.
19471
19472 This option has no effect on abicalls code. The default is
19473 @option{-mno-long-calls}.
19474
19475 @item -mmad
19476 @itemx -mno-mad
19477 @opindex mmad
19478 @opindex mno-mad
19479 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
19480 instructions, as provided by the R4650 ISA@.
19481
19482 @item -mimadd
19483 @itemx -mno-imadd
19484 @opindex mimadd
19485 @opindex mno-imadd
19486 Enable (disable) use of the @code{madd} and @code{msub} integer
19487 instructions. The default is @option{-mimadd} on architectures
19488 that support @code{madd} and @code{msub} except for the 74k
19489 architecture where it was found to generate slower code.
19490
19491 @item -mfused-madd
19492 @itemx -mno-fused-madd
19493 @opindex mfused-madd
19494 @opindex mno-fused-madd
19495 Enable (disable) use of the floating-point multiply-accumulate
19496 instructions, when they are available. The default is
19497 @option{-mfused-madd}.
19498
19499 On the R8000 CPU when multiply-accumulate instructions are used,
19500 the intermediate product is calculated to infinite precision
19501 and is not subject to the FCSR Flush to Zero bit. This may be
19502 undesirable in some circumstances. On other processors the result
19503 is numerically identical to the equivalent computation using
19504 separate multiply, add, subtract and negate instructions.
19505
19506 @item -nocpp
19507 @opindex nocpp
19508 Tell the MIPS assembler to not run its preprocessor over user
19509 assembler files (with a @samp{.s} suffix) when assembling them.
19510
19511 @item -mfix-24k
19512 @item -mno-fix-24k
19513 @opindex mfix-24k
19514 @opindex mno-fix-24k
19515 Work around the 24K E48 (lost data on stores during refill) errata.
19516 The workarounds are implemented by the assembler rather than by GCC@.
19517
19518 @item -mfix-r4000
19519 @itemx -mno-fix-r4000
19520 @opindex mfix-r4000
19521 @opindex mno-fix-r4000
19522 Work around certain R4000 CPU errata:
19523 @itemize @minus
19524 @item
19525 A double-word or a variable shift may give an incorrect result if executed
19526 immediately after starting an integer division.
19527 @item
19528 A double-word or a variable shift may give an incorrect result if executed
19529 while an integer multiplication is in progress.
19530 @item
19531 An integer division may give an incorrect result if started in a delay slot
19532 of a taken branch or a jump.
19533 @end itemize
19534
19535 @item -mfix-r4400
19536 @itemx -mno-fix-r4400
19537 @opindex mfix-r4400
19538 @opindex mno-fix-r4400
19539 Work around certain R4400 CPU errata:
19540 @itemize @minus
19541 @item
19542 A double-word or a variable shift may give an incorrect result if executed
19543 immediately after starting an integer division.
19544 @end itemize
19545
19546 @item -mfix-r10000
19547 @itemx -mno-fix-r10000
19548 @opindex mfix-r10000
19549 @opindex mno-fix-r10000
19550 Work around certain R10000 errata:
19551 @itemize @minus
19552 @item
19553 @code{ll}/@code{sc} sequences may not behave atomically on revisions
19554 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
19555 @end itemize
19556
19557 This option can only be used if the target architecture supports
19558 branch-likely instructions. @option{-mfix-r10000} is the default when
19559 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
19560 otherwise.
19561
19562 @item -mfix-rm7000
19563 @itemx -mno-fix-rm7000
19564 @opindex mfix-rm7000
19565 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
19566 workarounds are implemented by the assembler rather than by GCC@.
19567
19568 @item -mfix-vr4120
19569 @itemx -mno-fix-vr4120
19570 @opindex mfix-vr4120
19571 Work around certain VR4120 errata:
19572 @itemize @minus
19573 @item
19574 @code{dmultu} does not always produce the correct result.
19575 @item
19576 @code{div} and @code{ddiv} do not always produce the correct result if one
19577 of the operands is negative.
19578 @end itemize
19579 The workarounds for the division errata rely on special functions in
19580 @file{libgcc.a}. At present, these functions are only provided by
19581 the @code{mips64vr*-elf} configurations.
19582
19583 Other VR4120 errata require a NOP to be inserted between certain pairs of
19584 instructions. These errata are handled by the assembler, not by GCC itself.
19585
19586 @item -mfix-vr4130
19587 @opindex mfix-vr4130
19588 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
19589 workarounds are implemented by the assembler rather than by GCC,
19590 although GCC avoids using @code{mflo} and @code{mfhi} if the
19591 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
19592 instructions are available instead.
19593
19594 @item -mfix-sb1
19595 @itemx -mno-fix-sb1
19596 @opindex mfix-sb1
19597 Work around certain SB-1 CPU core errata.
19598 (This flag currently works around the SB-1 revision 2
19599 ``F1'' and ``F2'' floating-point errata.)
19600
19601 @item -mr10k-cache-barrier=@var{setting}
19602 @opindex mr10k-cache-barrier
19603 Specify whether GCC should insert cache barriers to avoid the
19604 side-effects of speculation on R10K processors.
19605
19606 In common with many processors, the R10K tries to predict the outcome
19607 of a conditional branch and speculatively executes instructions from
19608 the ``taken'' branch. It later aborts these instructions if the
19609 predicted outcome is wrong. However, on the R10K, even aborted
19610 instructions can have side effects.
19611
19612 This problem only affects kernel stores and, depending on the system,
19613 kernel loads. As an example, a speculatively-executed store may load
19614 the target memory into cache and mark the cache line as dirty, even if
19615 the store itself is later aborted. If a DMA operation writes to the
19616 same area of memory before the ``dirty'' line is flushed, the cached
19617 data overwrites the DMA-ed data. See the R10K processor manual
19618 for a full description, including other potential problems.
19619
19620 One workaround is to insert cache barrier instructions before every memory
19621 access that might be speculatively executed and that might have side
19622 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
19623 controls GCC's implementation of this workaround. It assumes that
19624 aborted accesses to any byte in the following regions does not have
19625 side effects:
19626
19627 @enumerate
19628 @item
19629 the memory occupied by the current function's stack frame;
19630
19631 @item
19632 the memory occupied by an incoming stack argument;
19633
19634 @item
19635 the memory occupied by an object with a link-time-constant address.
19636 @end enumerate
19637
19638 It is the kernel's responsibility to ensure that speculative
19639 accesses to these regions are indeed safe.
19640
19641 If the input program contains a function declaration such as:
19642
19643 @smallexample
19644 void foo (void);
19645 @end smallexample
19646
19647 then the implementation of @code{foo} must allow @code{j foo} and
19648 @code{jal foo} to be executed speculatively. GCC honors this
19649 restriction for functions it compiles itself. It expects non-GCC
19650 functions (such as hand-written assembly code) to do the same.
19651
19652 The option has three forms:
19653
19654 @table @gcctabopt
19655 @item -mr10k-cache-barrier=load-store
19656 Insert a cache barrier before a load or store that might be
19657 speculatively executed and that might have side effects even
19658 if aborted.
19659
19660 @item -mr10k-cache-barrier=store
19661 Insert a cache barrier before a store that might be speculatively
19662 executed and that might have side effects even if aborted.
19663
19664 @item -mr10k-cache-barrier=none
19665 Disable the insertion of cache barriers. This is the default setting.
19666 @end table
19667
19668 @item -mflush-func=@var{func}
19669 @itemx -mno-flush-func
19670 @opindex mflush-func
19671 Specifies the function to call to flush the I and D caches, or to not
19672 call any such function. If called, the function must take the same
19673 arguments as the common @code{_flush_func}, that is, the address of the
19674 memory range for which the cache is being flushed, the size of the
19675 memory range, and the number 3 (to flush both caches). The default
19676 depends on the target GCC was configured for, but commonly is either
19677 @code{_flush_func} or @code{__cpu_flush}.
19678
19679 @item mbranch-cost=@var{num}
19680 @opindex mbranch-cost
19681 Set the cost of branches to roughly @var{num} ``simple'' instructions.
19682 This cost is only a heuristic and is not guaranteed to produce
19683 consistent results across releases. A zero cost redundantly selects
19684 the default, which is based on the @option{-mtune} setting.
19685
19686 @item -mbranch-likely
19687 @itemx -mno-branch-likely
19688 @opindex mbranch-likely
19689 @opindex mno-branch-likely
19690 Enable or disable use of Branch Likely instructions, regardless of the
19691 default for the selected architecture. By default, Branch Likely
19692 instructions may be generated if they are supported by the selected
19693 architecture. An exception is for the MIPS32 and MIPS64 architectures
19694 and processors that implement those architectures; for those, Branch
19695 Likely instructions are not be generated by default because the MIPS32
19696 and MIPS64 architectures specifically deprecate their use.
19697
19698 @item -mcompact-branches=never
19699 @itemx -mcompact-branches=optimal
19700 @itemx -mcompact-branches=always
19701 @opindex mcompact-branches=never
19702 @opindex mcompact-branches=optimal
19703 @opindex mcompact-branches=always
19704 These options control which form of branches will be generated. The
19705 default is @option{-mcompact-branches=optimal}.
19706
19707 The @option{-mcompact-branches=never} option ensures that compact branch
19708 instructions will never be generated.
19709
19710 The @option{-mcompact-branches=always} option ensures that a compact
19711 branch instruction will be generated if available. If a compact branch
19712 instruction is not available, a delay slot form of the branch will be
19713 used instead.
19714
19715 This option is supported from MIPS Release 6 onwards.
19716
19717 The @option{-mcompact-branches=optimal} option will cause a delay slot
19718 branch to be used if one is available in the current ISA and the delay
19719 slot is successfully filled. If the delay slot is not filled, a compact
19720 branch will be chosen if one is available.
19721
19722 @item -mfp-exceptions
19723 @itemx -mno-fp-exceptions
19724 @opindex mfp-exceptions
19725 Specifies whether FP exceptions are enabled. This affects how
19726 FP instructions are scheduled for some processors.
19727 The default is that FP exceptions are
19728 enabled.
19729
19730 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
19731 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
19732 FP pipe.
19733
19734 @item -mvr4130-align
19735 @itemx -mno-vr4130-align
19736 @opindex mvr4130-align
19737 The VR4130 pipeline is two-way superscalar, but can only issue two
19738 instructions together if the first one is 8-byte aligned. When this
19739 option is enabled, GCC aligns pairs of instructions that it
19740 thinks should execute in parallel.
19741
19742 This option only has an effect when optimizing for the VR4130.
19743 It normally makes code faster, but at the expense of making it bigger.
19744 It is enabled by default at optimization level @option{-O3}.
19745
19746 @item -msynci
19747 @itemx -mno-synci
19748 @opindex msynci
19749 Enable (disable) generation of @code{synci} instructions on
19750 architectures that support it. The @code{synci} instructions (if
19751 enabled) are generated when @code{__builtin___clear_cache} is
19752 compiled.
19753
19754 This option defaults to @option{-mno-synci}, but the default can be
19755 overridden by configuring GCC with @option{--with-synci}.
19756
19757 When compiling code for single processor systems, it is generally safe
19758 to use @code{synci}. However, on many multi-core (SMP) systems, it
19759 does not invalidate the instruction caches on all cores and may lead
19760 to undefined behavior.
19761
19762 @item -mrelax-pic-calls
19763 @itemx -mno-relax-pic-calls
19764 @opindex mrelax-pic-calls
19765 Try to turn PIC calls that are normally dispatched via register
19766 @code{$25} into direct calls. This is only possible if the linker can
19767 resolve the destination at link time and if the destination is within
19768 range for a direct call.
19769
19770 @option{-mrelax-pic-calls} is the default if GCC was configured to use
19771 an assembler and a linker that support the @code{.reloc} assembly
19772 directive and @option{-mexplicit-relocs} is in effect. With
19773 @option{-mno-explicit-relocs}, this optimization can be performed by the
19774 assembler and the linker alone without help from the compiler.
19775
19776 @item -mmcount-ra-address
19777 @itemx -mno-mcount-ra-address
19778 @opindex mmcount-ra-address
19779 @opindex mno-mcount-ra-address
19780 Emit (do not emit) code that allows @code{_mcount} to modify the
19781 calling function's return address. When enabled, this option extends
19782 the usual @code{_mcount} interface with a new @var{ra-address}
19783 parameter, which has type @code{intptr_t *} and is passed in register
19784 @code{$12}. @code{_mcount} can then modify the return address by
19785 doing both of the following:
19786 @itemize
19787 @item
19788 Returning the new address in register @code{$31}.
19789 @item
19790 Storing the new address in @code{*@var{ra-address}},
19791 if @var{ra-address} is nonnull.
19792 @end itemize
19793
19794 The default is @option{-mno-mcount-ra-address}.
19795
19796 @item -mframe-header-opt
19797 @itemx -mno-frame-header-opt
19798 @opindex mframe-header-opt
19799 Enable (disable) frame header optimization in the o32 ABI. When using the
19800 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
19801 function to write out register arguments. When enabled, this optimization
19802 will suppress the allocation of the frame header if it can be determined that
19803 it is unused.
19804
19805 This optimization is off by default at all optimization levels.
19806
19807 @end table
19808
19809 @node MMIX Options
19810 @subsection MMIX Options
19811 @cindex MMIX Options
19812
19813 These options are defined for the MMIX:
19814
19815 @table @gcctabopt
19816 @item -mlibfuncs
19817 @itemx -mno-libfuncs
19818 @opindex mlibfuncs
19819 @opindex mno-libfuncs
19820 Specify that intrinsic library functions are being compiled, passing all
19821 values in registers, no matter the size.
19822
19823 @item -mepsilon
19824 @itemx -mno-epsilon
19825 @opindex mepsilon
19826 @opindex mno-epsilon
19827 Generate floating-point comparison instructions that compare with respect
19828 to the @code{rE} epsilon register.
19829
19830 @item -mabi=mmixware
19831 @itemx -mabi=gnu
19832 @opindex mabi=mmixware
19833 @opindex mabi=gnu
19834 Generate code that passes function parameters and return values that (in
19835 the called function) are seen as registers @code{$0} and up, as opposed to
19836 the GNU ABI which uses global registers @code{$231} and up.
19837
19838 @item -mzero-extend
19839 @itemx -mno-zero-extend
19840 @opindex mzero-extend
19841 @opindex mno-zero-extend
19842 When reading data from memory in sizes shorter than 64 bits, use (do not
19843 use) zero-extending load instructions by default, rather than
19844 sign-extending ones.
19845
19846 @item -mknuthdiv
19847 @itemx -mno-knuthdiv
19848 @opindex mknuthdiv
19849 @opindex mno-knuthdiv
19850 Make the result of a division yielding a remainder have the same sign as
19851 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
19852 remainder follows the sign of the dividend. Both methods are
19853 arithmetically valid, the latter being almost exclusively used.
19854
19855 @item -mtoplevel-symbols
19856 @itemx -mno-toplevel-symbols
19857 @opindex mtoplevel-symbols
19858 @opindex mno-toplevel-symbols
19859 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
19860 code can be used with the @code{PREFIX} assembly directive.
19861
19862 @item -melf
19863 @opindex melf
19864 Generate an executable in the ELF format, rather than the default
19865 @samp{mmo} format used by the @command{mmix} simulator.
19866
19867 @item -mbranch-predict
19868 @itemx -mno-branch-predict
19869 @opindex mbranch-predict
19870 @opindex mno-branch-predict
19871 Use (do not use) the probable-branch instructions, when static branch
19872 prediction indicates a probable branch.
19873
19874 @item -mbase-addresses
19875 @itemx -mno-base-addresses
19876 @opindex mbase-addresses
19877 @opindex mno-base-addresses
19878 Generate (do not generate) code that uses @emph{base addresses}. Using a
19879 base address automatically generates a request (handled by the assembler
19880 and the linker) for a constant to be set up in a global register. The
19881 register is used for one or more base address requests within the range 0
19882 to 255 from the value held in the register. The generally leads to short
19883 and fast code, but the number of different data items that can be
19884 addressed is limited. This means that a program that uses lots of static
19885 data may require @option{-mno-base-addresses}.
19886
19887 @item -msingle-exit
19888 @itemx -mno-single-exit
19889 @opindex msingle-exit
19890 @opindex mno-single-exit
19891 Force (do not force) generated code to have a single exit point in each
19892 function.
19893 @end table
19894
19895 @node MN10300 Options
19896 @subsection MN10300 Options
19897 @cindex MN10300 options
19898
19899 These @option{-m} options are defined for Matsushita MN10300 architectures:
19900
19901 @table @gcctabopt
19902 @item -mmult-bug
19903 @opindex mmult-bug
19904 Generate code to avoid bugs in the multiply instructions for the MN10300
19905 processors. This is the default.
19906
19907 @item -mno-mult-bug
19908 @opindex mno-mult-bug
19909 Do not generate code to avoid bugs in the multiply instructions for the
19910 MN10300 processors.
19911
19912 @item -mam33
19913 @opindex mam33
19914 Generate code using features specific to the AM33 processor.
19915
19916 @item -mno-am33
19917 @opindex mno-am33
19918 Do not generate code using features specific to the AM33 processor. This
19919 is the default.
19920
19921 @item -mam33-2
19922 @opindex mam33-2
19923 Generate code using features specific to the AM33/2.0 processor.
19924
19925 @item -mam34
19926 @opindex mam34
19927 Generate code using features specific to the AM34 processor.
19928
19929 @item -mtune=@var{cpu-type}
19930 @opindex mtune
19931 Use the timing characteristics of the indicated CPU type when
19932 scheduling instructions. This does not change the targeted processor
19933 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
19934 @samp{am33-2} or @samp{am34}.
19935
19936 @item -mreturn-pointer-on-d0
19937 @opindex mreturn-pointer-on-d0
19938 When generating a function that returns a pointer, return the pointer
19939 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
19940 only in @code{a0}, and attempts to call such functions without a prototype
19941 result in errors. Note that this option is on by default; use
19942 @option{-mno-return-pointer-on-d0} to disable it.
19943
19944 @item -mno-crt0
19945 @opindex mno-crt0
19946 Do not link in the C run-time initialization object file.
19947
19948 @item -mrelax
19949 @opindex mrelax
19950 Indicate to the linker that it should perform a relaxation optimization pass
19951 to shorten branches, calls and absolute memory addresses. This option only
19952 has an effect when used on the command line for the final link step.
19953
19954 This option makes symbolic debugging impossible.
19955
19956 @item -mliw
19957 @opindex mliw
19958 Allow the compiler to generate @emph{Long Instruction Word}
19959 instructions if the target is the @samp{AM33} or later. This is the
19960 default. This option defines the preprocessor macro @code{__LIW__}.
19961
19962 @item -mnoliw
19963 @opindex mnoliw
19964 Do not allow the compiler to generate @emph{Long Instruction Word}
19965 instructions. This option defines the preprocessor macro
19966 @code{__NO_LIW__}.
19967
19968 @item -msetlb
19969 @opindex msetlb
19970 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
19971 instructions if the target is the @samp{AM33} or later. This is the
19972 default. This option defines the preprocessor macro @code{__SETLB__}.
19973
19974 @item -mnosetlb
19975 @opindex mnosetlb
19976 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
19977 instructions. This option defines the preprocessor macro
19978 @code{__NO_SETLB__}.
19979
19980 @end table
19981
19982 @node Moxie Options
19983 @subsection Moxie Options
19984 @cindex Moxie Options
19985
19986 @table @gcctabopt
19987
19988 @item -meb
19989 @opindex meb
19990 Generate big-endian code. This is the default for @samp{moxie-*-*}
19991 configurations.
19992
19993 @item -mel
19994 @opindex mel
19995 Generate little-endian code.
19996
19997 @item -mmul.x
19998 @opindex mmul.x
19999 Generate mul.x and umul.x instructions. This is the default for
20000 @samp{moxiebox-*-*} configurations.
20001
20002 @item -mno-crt0
20003 @opindex mno-crt0
20004 Do not link in the C run-time initialization object file.
20005
20006 @end table
20007
20008 @node MSP430 Options
20009 @subsection MSP430 Options
20010 @cindex MSP430 Options
20011
20012 These options are defined for the MSP430:
20013
20014 @table @gcctabopt
20015
20016 @item -masm-hex
20017 @opindex masm-hex
20018 Force assembly output to always use hex constants. Normally such
20019 constants are signed decimals, but this option is available for
20020 testsuite and/or aesthetic purposes.
20021
20022 @item -mmcu=
20023 @opindex mmcu=
20024 Select the MCU to target. This is used to create a C preprocessor
20025 symbol based upon the MCU name, converted to upper case and pre- and
20026 post-fixed with @samp{__}. This in turn is used by the
20027 @file{msp430.h} header file to select an MCU-specific supplementary
20028 header file.
20029
20030 The option also sets the ISA to use. If the MCU name is one that is
20031 known to only support the 430 ISA then that is selected, otherwise the
20032 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
20033 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
20034 name selects the 430X ISA.
20035
20036 In addition an MCU-specific linker script is added to the linker
20037 command line. The script's name is the name of the MCU with
20038 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
20039 command line defines the C preprocessor symbol @code{__XXX__} and
20040 cause the linker to search for a script called @file{xxx.ld}.
20041
20042 This option is also passed on to the assembler.
20043
20044 @item -mwarn-mcu
20045 @itemx -mno-warn-mcu
20046 @opindex mwarn-mcu
20047 @opindex mno-warn-mcu
20048 This option enables or disables warnings about conflicts between the
20049 MCU name specified by the @option{-mmcu} option and the ISA set by the
20050 @option{-mcpu} option and/or the hardware multiply support set by the
20051 @option{-mhwmult} option. It also toggles warnings about unrecognized
20052 MCU names. This option is on by default.
20053
20054 @item -mcpu=
20055 @opindex mcpu=
20056 Specifies the ISA to use. Accepted values are @samp{msp430},
20057 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
20058 @option{-mmcu=} option should be used to select the ISA.
20059
20060 @item -msim
20061 @opindex msim
20062 Link to the simulator runtime libraries and linker script. Overrides
20063 any scripts that would be selected by the @option{-mmcu=} option.
20064
20065 @item -mlarge
20066 @opindex mlarge
20067 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
20068
20069 @item -msmall
20070 @opindex msmall
20071 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
20072
20073 @item -mrelax
20074 @opindex mrelax
20075 This option is passed to the assembler and linker, and allows the
20076 linker to perform certain optimizations that cannot be done until
20077 the final link.
20078
20079 @item mhwmult=
20080 @opindex mhwmult=
20081 Describes the type of hardware multiply supported by the target.
20082 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
20083 for the original 16-bit-only multiply supported by early MCUs.
20084 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
20085 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
20086 A value of @samp{auto} can also be given. This tells GCC to deduce
20087 the hardware multiply support based upon the MCU name provided by the
20088 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
20089 the MCU name is not recognized then no hardware multiply support is
20090 assumed. @code{auto} is the default setting.
20091
20092 Hardware multiplies are normally performed by calling a library
20093 routine. This saves space in the generated code. When compiling at
20094 @option{-O3} or higher however the hardware multiplier is invoked
20095 inline. This makes for bigger, but faster code.
20096
20097 The hardware multiply routines disable interrupts whilst running and
20098 restore the previous interrupt state when they finish. This makes
20099 them safe to use inside interrupt handlers as well as in normal code.
20100
20101 @item -minrt
20102 @opindex minrt
20103 Enable the use of a minimum runtime environment - no static
20104 initializers or constructors. This is intended for memory-constrained
20105 devices. The compiler includes special symbols in some objects
20106 that tell the linker and runtime which code fragments are required.
20107
20108 @item -mcode-region=
20109 @itemx -mdata-region=
20110 @opindex mcode-region
20111 @opindex mdata-region
20112 These options tell the compiler where to place functions and data that
20113 do not have one of the @code{lower}, @code{upper}, @code{either} or
20114 @code{section} attributes. Possible values are @code{lower},
20115 @code{upper}, @code{either} or @code{any}. The first three behave
20116 like the corresponding attribute. The fourth possible value -
20117 @code{any} - is the default. It leaves placement entirely up to the
20118 linker script and how it assigns the standard sections
20119 (@code{.text}, @code{.data}, etc) to the memory regions.
20120
20121 @item -msilicon-errata=
20122 @opindex msilicon-errata
20123 This option passes on a request to assembler to enable the fixes for
20124 the named silicon errata.
20125
20126 @item -msilicon-errata-warn=
20127 @opindex msilicon-errata-warn
20128 This option passes on a request to the assembler to enable warning
20129 messages when a silicon errata might need to be applied.
20130
20131 @end table
20132
20133 @node NDS32 Options
20134 @subsection NDS32 Options
20135 @cindex NDS32 Options
20136
20137 These options are defined for NDS32 implementations:
20138
20139 @table @gcctabopt
20140
20141 @item -mbig-endian
20142 @opindex mbig-endian
20143 Generate code in big-endian mode.
20144
20145 @item -mlittle-endian
20146 @opindex mlittle-endian
20147 Generate code in little-endian mode.
20148
20149 @item -mreduced-regs
20150 @opindex mreduced-regs
20151 Use reduced-set registers for register allocation.
20152
20153 @item -mfull-regs
20154 @opindex mfull-regs
20155 Use full-set registers for register allocation.
20156
20157 @item -mcmov
20158 @opindex mcmov
20159 Generate conditional move instructions.
20160
20161 @item -mno-cmov
20162 @opindex mno-cmov
20163 Do not generate conditional move instructions.
20164
20165 @item -mperf-ext
20166 @opindex mperf-ext
20167 Generate performance extension instructions.
20168
20169 @item -mno-perf-ext
20170 @opindex mno-perf-ext
20171 Do not generate performance extension instructions.
20172
20173 @item -mv3push
20174 @opindex mv3push
20175 Generate v3 push25/pop25 instructions.
20176
20177 @item -mno-v3push
20178 @opindex mno-v3push
20179 Do not generate v3 push25/pop25 instructions.
20180
20181 @item -m16-bit
20182 @opindex m16-bit
20183 Generate 16-bit instructions.
20184
20185 @item -mno-16-bit
20186 @opindex mno-16-bit
20187 Do not generate 16-bit instructions.
20188
20189 @item -misr-vector-size=@var{num}
20190 @opindex misr-vector-size
20191 Specify the size of each interrupt vector, which must be 4 or 16.
20192
20193 @item -mcache-block-size=@var{num}
20194 @opindex mcache-block-size
20195 Specify the size of each cache block,
20196 which must be a power of 2 between 4 and 512.
20197
20198 @item -march=@var{arch}
20199 @opindex march
20200 Specify the name of the target architecture.
20201
20202 @item -mcmodel=@var{code-model}
20203 @opindex mcmodel
20204 Set the code model to one of
20205 @table @asis
20206 @item @samp{small}
20207 All the data and read-only data segments must be within 512KB addressing space.
20208 The text segment must be within 16MB addressing space.
20209 @item @samp{medium}
20210 The data segment must be within 512KB while the read-only data segment can be
20211 within 4GB addressing space. The text segment should be still within 16MB
20212 addressing space.
20213 @item @samp{large}
20214 All the text and data segments can be within 4GB addressing space.
20215 @end table
20216
20217 @item -mctor-dtor
20218 @opindex mctor-dtor
20219 Enable constructor/destructor feature.
20220
20221 @item -mrelax
20222 @opindex mrelax
20223 Guide linker to relax instructions.
20224
20225 @end table
20226
20227 @node Nios II Options
20228 @subsection Nios II Options
20229 @cindex Nios II options
20230 @cindex Altera Nios II options
20231
20232 These are the options defined for the Altera Nios II processor.
20233
20234 @table @gcctabopt
20235
20236 @item -G @var{num}
20237 @opindex G
20238 @cindex smaller data references
20239 Put global and static objects less than or equal to @var{num} bytes
20240 into the small data or BSS sections instead of the normal data or BSS
20241 sections. The default value of @var{num} is 8.
20242
20243 @item -mgpopt=@var{option}
20244 @item -mgpopt
20245 @itemx -mno-gpopt
20246 @opindex mgpopt
20247 @opindex mno-gpopt
20248 Generate (do not generate) GP-relative accesses. The following
20249 @var{option} names are recognized:
20250
20251 @table @samp
20252
20253 @item none
20254 Do not generate GP-relative accesses.
20255
20256 @item local
20257 Generate GP-relative accesses for small data objects that are not
20258 external, weak, or uninitialized common symbols.
20259 Also use GP-relative addressing for objects that
20260 have been explicitly placed in a small data section via a @code{section}
20261 attribute.
20262
20263 @item global
20264 As for @samp{local}, but also generate GP-relative accesses for
20265 small data objects that are external, weak, or common. If you use this option,
20266 you must ensure that all parts of your program (including libraries) are
20267 compiled with the same @option{-G} setting.
20268
20269 @item data
20270 Generate GP-relative accesses for all data objects in the program. If you
20271 use this option, the entire data and BSS segments
20272 of your program must fit in 64K of memory and you must use an appropriate
20273 linker script to allocate them within the addressable range of the
20274 global pointer.
20275
20276 @item all
20277 Generate GP-relative addresses for function pointers as well as data
20278 pointers. If you use this option, the entire text, data, and BSS segments
20279 of your program must fit in 64K of memory and you must use an appropriate
20280 linker script to allocate them within the addressable range of the
20281 global pointer.
20282
20283 @end table
20284
20285 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
20286 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
20287
20288 The default is @option{-mgpopt} except when @option{-fpic} or
20289 @option{-fPIC} is specified to generate position-independent code.
20290 Note that the Nios II ABI does not permit GP-relative accesses from
20291 shared libraries.
20292
20293 You may need to specify @option{-mno-gpopt} explicitly when building
20294 programs that include large amounts of small data, including large
20295 GOT data sections. In this case, the 16-bit offset for GP-relative
20296 addressing may not be large enough to allow access to the entire
20297 small data section.
20298
20299 @item -mel
20300 @itemx -meb
20301 @opindex mel
20302 @opindex meb
20303 Generate little-endian (default) or big-endian (experimental) code,
20304 respectively.
20305
20306 @item -march=@var{arch}
20307 @opindex march
20308 This specifies the name of the target Nios II architecture. GCC uses this
20309 name to determine what kind of instructions it can emit when generating
20310 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
20311
20312 The preprocessor macro @code{__nios2_arch__} is available to programs,
20313 with value 1 or 2, indicating the targeted ISA level.
20314
20315 @item -mbypass-cache
20316 @itemx -mno-bypass-cache
20317 @opindex mno-bypass-cache
20318 @opindex mbypass-cache
20319 Force all load and store instructions to always bypass cache by
20320 using I/O variants of the instructions. The default is not to
20321 bypass the cache.
20322
20323 @item -mno-cache-volatile
20324 @itemx -mcache-volatile
20325 @opindex mcache-volatile
20326 @opindex mno-cache-volatile
20327 Volatile memory access bypass the cache using the I/O variants of
20328 the load and store instructions. The default is not to bypass the cache.
20329
20330 @item -mno-fast-sw-div
20331 @itemx -mfast-sw-div
20332 @opindex mno-fast-sw-div
20333 @opindex mfast-sw-div
20334 Do not use table-based fast divide for small numbers. The default
20335 is to use the fast divide at @option{-O3} and above.
20336
20337 @item -mno-hw-mul
20338 @itemx -mhw-mul
20339 @itemx -mno-hw-mulx
20340 @itemx -mhw-mulx
20341 @itemx -mno-hw-div
20342 @itemx -mhw-div
20343 @opindex mno-hw-mul
20344 @opindex mhw-mul
20345 @opindex mno-hw-mulx
20346 @opindex mhw-mulx
20347 @opindex mno-hw-div
20348 @opindex mhw-div
20349 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
20350 instructions by the compiler. The default is to emit @code{mul}
20351 and not emit @code{div} and @code{mulx}.
20352
20353 @item -mbmx
20354 @itemx -mno-bmx
20355 @itemx -mcdx
20356 @itemx -mno-cdx
20357 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
20358 CDX (code density) instructions. Enabling these instructions also
20359 requires @option{-march=r2}. Since these instructions are optional
20360 extensions to the R2 architecture, the default is not to emit them.
20361
20362 @item -mcustom-@var{insn}=@var{N}
20363 @itemx -mno-custom-@var{insn}
20364 @opindex mcustom-@var{insn}
20365 @opindex mno-custom-@var{insn}
20366 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
20367 custom instruction with encoding @var{N} when generating code that uses
20368 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
20369 instruction 253 for single-precision floating-point add operations instead
20370 of the default behavior of using a library call.
20371
20372 The following values of @var{insn} are supported. Except as otherwise
20373 noted, floating-point operations are expected to be implemented with
20374 normal IEEE 754 semantics and correspond directly to the C operators or the
20375 equivalent GCC built-in functions (@pxref{Other Builtins}).
20376
20377 Single-precision floating point:
20378 @table @asis
20379
20380 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
20381 Binary arithmetic operations.
20382
20383 @item @samp{fnegs}
20384 Unary negation.
20385
20386 @item @samp{fabss}
20387 Unary absolute value.
20388
20389 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
20390 Comparison operations.
20391
20392 @item @samp{fmins}, @samp{fmaxs}
20393 Floating-point minimum and maximum. These instructions are only
20394 generated if @option{-ffinite-math-only} is specified.
20395
20396 @item @samp{fsqrts}
20397 Unary square root operation.
20398
20399 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
20400 Floating-point trigonometric and exponential functions. These instructions
20401 are only generated if @option{-funsafe-math-optimizations} is also specified.
20402
20403 @end table
20404
20405 Double-precision floating point:
20406 @table @asis
20407
20408 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
20409 Binary arithmetic operations.
20410
20411 @item @samp{fnegd}
20412 Unary negation.
20413
20414 @item @samp{fabsd}
20415 Unary absolute value.
20416
20417 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
20418 Comparison operations.
20419
20420 @item @samp{fmind}, @samp{fmaxd}
20421 Double-precision minimum and maximum. These instructions are only
20422 generated if @option{-ffinite-math-only} is specified.
20423
20424 @item @samp{fsqrtd}
20425 Unary square root operation.
20426
20427 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
20428 Double-precision trigonometric and exponential functions. These instructions
20429 are only generated if @option{-funsafe-math-optimizations} is also specified.
20430
20431 @end table
20432
20433 Conversions:
20434 @table @asis
20435 @item @samp{fextsd}
20436 Conversion from single precision to double precision.
20437
20438 @item @samp{ftruncds}
20439 Conversion from double precision to single precision.
20440
20441 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
20442 Conversion from floating point to signed or unsigned integer types, with
20443 truncation towards zero.
20444
20445 @item @samp{round}
20446 Conversion from single-precision floating point to signed integer,
20447 rounding to the nearest integer and ties away from zero.
20448 This corresponds to the @code{__builtin_lroundf} function when
20449 @option{-fno-math-errno} is used.
20450
20451 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
20452 Conversion from signed or unsigned integer types to floating-point types.
20453
20454 @end table
20455
20456 In addition, all of the following transfer instructions for internal
20457 registers X and Y must be provided to use any of the double-precision
20458 floating-point instructions. Custom instructions taking two
20459 double-precision source operands expect the first operand in the
20460 64-bit register X. The other operand (or only operand of a unary
20461 operation) is given to the custom arithmetic instruction with the
20462 least significant half in source register @var{src1} and the most
20463 significant half in @var{src2}. A custom instruction that returns a
20464 double-precision result returns the most significant 32 bits in the
20465 destination register and the other half in 32-bit register Y.
20466 GCC automatically generates the necessary code sequences to write
20467 register X and/or read register Y when double-precision floating-point
20468 instructions are used.
20469
20470 @table @asis
20471
20472 @item @samp{fwrx}
20473 Write @var{src1} into the least significant half of X and @var{src2} into
20474 the most significant half of X.
20475
20476 @item @samp{fwry}
20477 Write @var{src1} into Y.
20478
20479 @item @samp{frdxhi}, @samp{frdxlo}
20480 Read the most or least (respectively) significant half of X and store it in
20481 @var{dest}.
20482
20483 @item @samp{frdy}
20484 Read the value of Y and store it into @var{dest}.
20485 @end table
20486
20487 Note that you can gain more local control over generation of Nios II custom
20488 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
20489 and @code{target("no-custom-@var{insn}")} function attributes
20490 (@pxref{Function Attributes})
20491 or pragmas (@pxref{Function Specific Option Pragmas}).
20492
20493 @item -mcustom-fpu-cfg=@var{name}
20494 @opindex mcustom-fpu-cfg
20495
20496 This option enables a predefined, named set of custom instruction encodings
20497 (see @option{-mcustom-@var{insn}} above).
20498 Currently, the following sets are defined:
20499
20500 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
20501 @gccoptlist{-mcustom-fmuls=252 @gol
20502 -mcustom-fadds=253 @gol
20503 -mcustom-fsubs=254 @gol
20504 -fsingle-precision-constant}
20505
20506 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
20507 @gccoptlist{-mcustom-fmuls=252 @gol
20508 -mcustom-fadds=253 @gol
20509 -mcustom-fsubs=254 @gol
20510 -mcustom-fdivs=255 @gol
20511 -fsingle-precision-constant}
20512
20513 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
20514 @gccoptlist{-mcustom-floatus=243 @gol
20515 -mcustom-fixsi=244 @gol
20516 -mcustom-floatis=245 @gol
20517 -mcustom-fcmpgts=246 @gol
20518 -mcustom-fcmples=249 @gol
20519 -mcustom-fcmpeqs=250 @gol
20520 -mcustom-fcmpnes=251 @gol
20521 -mcustom-fmuls=252 @gol
20522 -mcustom-fadds=253 @gol
20523 -mcustom-fsubs=254 @gol
20524 -mcustom-fdivs=255 @gol
20525 -fsingle-precision-constant}
20526
20527 Custom instruction assignments given by individual
20528 @option{-mcustom-@var{insn}=} options override those given by
20529 @option{-mcustom-fpu-cfg=}, regardless of the
20530 order of the options on the command line.
20531
20532 Note that you can gain more local control over selection of a FPU
20533 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
20534 function attribute (@pxref{Function Attributes})
20535 or pragma (@pxref{Function Specific Option Pragmas}).
20536
20537 @end table
20538
20539 These additional @samp{-m} options are available for the Altera Nios II
20540 ELF (bare-metal) target:
20541
20542 @table @gcctabopt
20543
20544 @item -mhal
20545 @opindex mhal
20546 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
20547 startup and termination code, and is typically used in conjunction with
20548 @option{-msys-crt0=} to specify the location of the alternate startup code
20549 provided by the HAL BSP.
20550
20551 @item -msmallc
20552 @opindex msmallc
20553 Link with a limited version of the C library, @option{-lsmallc}, rather than
20554 Newlib.
20555
20556 @item -msys-crt0=@var{startfile}
20557 @opindex msys-crt0
20558 @var{startfile} is the file name of the startfile (crt0) to use
20559 when linking. This option is only useful in conjunction with @option{-mhal}.
20560
20561 @item -msys-lib=@var{systemlib}
20562 @opindex msys-lib
20563 @var{systemlib} is the library name of the library that provides
20564 low-level system calls required by the C library,
20565 e.g. @code{read} and @code{write}.
20566 This option is typically used to link with a library provided by a HAL BSP.
20567
20568 @end table
20569
20570 @node Nvidia PTX Options
20571 @subsection Nvidia PTX Options
20572 @cindex Nvidia PTX options
20573 @cindex nvptx options
20574
20575 These options are defined for Nvidia PTX:
20576
20577 @table @gcctabopt
20578
20579 @item -m32
20580 @itemx -m64
20581 @opindex m32
20582 @opindex m64
20583 Generate code for 32-bit or 64-bit ABI.
20584
20585 @item -mmainkernel
20586 @opindex mmainkernel
20587 Link in code for a __main kernel. This is for stand-alone instead of
20588 offloading execution.
20589
20590 @item -moptimize
20591 @opindex moptimize
20592 Apply partitioned execution optimizations. This is the default when any
20593 level of optimization is selected.
20594
20595 @item -msoft-stack
20596 @opindex msoft-stack
20597 Generate code that does not use @code{.local} memory
20598 directly for stack storage. Instead, a per-warp stack pointer is
20599 maintained explicitly. This enables variable-length stack allocation (with
20600 variable-length arrays or @code{alloca}), and when global memory is used for
20601 underlying storage, makes it possible to access automatic variables from other
20602 threads, or with atomic instructions. This code generation variant is used
20603 for OpenMP offloading, but the option is exposed on its own for the purpose
20604 of testing the compiler; to generate code suitable for linking into programs
20605 using OpenMP offloading, use option @option{-mgomp}.
20606
20607 @item -muniform-simt
20608 @opindex muniform-simt
20609 Switch to code generation variant that allows to execute all threads in each
20610 warp, while maintaining memory state and side effects as if only one thread
20611 in each warp was active outside of OpenMP SIMD regions. All atomic operations
20612 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
20613 current lane index equals the master lane index), and the register being
20614 assigned is copied via a shuffle instruction from the master lane. Outside of
20615 SIMD regions lane 0 is the master; inside, each thread sees itself as the
20616 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
20617 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
20618 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
20619 with current lane index to compute the master lane index.
20620
20621 @item -mgomp
20622 @opindex mgomp
20623 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
20624 @option{-muniform-simt} options, and selects corresponding multilib variant.
20625
20626 @end table
20627
20628 @node PDP-11 Options
20629 @subsection PDP-11 Options
20630 @cindex PDP-11 Options
20631
20632 These options are defined for the PDP-11:
20633
20634 @table @gcctabopt
20635 @item -mfpu
20636 @opindex mfpu
20637 Use hardware FPP floating point. This is the default. (FIS floating
20638 point on the PDP-11/40 is not supported.)
20639
20640 @item -msoft-float
20641 @opindex msoft-float
20642 Do not use hardware floating point.
20643
20644 @item -mac0
20645 @opindex mac0
20646 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
20647
20648 @item -mno-ac0
20649 @opindex mno-ac0
20650 Return floating-point results in memory. This is the default.
20651
20652 @item -m40
20653 @opindex m40
20654 Generate code for a PDP-11/40.
20655
20656 @item -m45
20657 @opindex m45
20658 Generate code for a PDP-11/45. This is the default.
20659
20660 @item -m10
20661 @opindex m10
20662 Generate code for a PDP-11/10.
20663
20664 @item -mbcopy-builtin
20665 @opindex mbcopy-builtin
20666 Use inline @code{movmemhi} patterns for copying memory. This is the
20667 default.
20668
20669 @item -mbcopy
20670 @opindex mbcopy
20671 Do not use inline @code{movmemhi} patterns for copying memory.
20672
20673 @item -mint16
20674 @itemx -mno-int32
20675 @opindex mint16
20676 @opindex mno-int32
20677 Use 16-bit @code{int}. This is the default.
20678
20679 @item -mint32
20680 @itemx -mno-int16
20681 @opindex mint32
20682 @opindex mno-int16
20683 Use 32-bit @code{int}.
20684
20685 @item -mfloat64
20686 @itemx -mno-float32
20687 @opindex mfloat64
20688 @opindex mno-float32
20689 Use 64-bit @code{float}. This is the default.
20690
20691 @item -mfloat32
20692 @itemx -mno-float64
20693 @opindex mfloat32
20694 @opindex mno-float64
20695 Use 32-bit @code{float}.
20696
20697 @item -mabshi
20698 @opindex mabshi
20699 Use @code{abshi2} pattern. This is the default.
20700
20701 @item -mno-abshi
20702 @opindex mno-abshi
20703 Do not use @code{abshi2} pattern.
20704
20705 @item -mbranch-expensive
20706 @opindex mbranch-expensive
20707 Pretend that branches are expensive. This is for experimenting with
20708 code generation only.
20709
20710 @item -mbranch-cheap
20711 @opindex mbranch-cheap
20712 Do not pretend that branches are expensive. This is the default.
20713
20714 @item -munix-asm
20715 @opindex munix-asm
20716 Use Unix assembler syntax. This is the default when configured for
20717 @samp{pdp11-*-bsd}.
20718
20719 @item -mdec-asm
20720 @opindex mdec-asm
20721 Use DEC assembler syntax. This is the default when configured for any
20722 PDP-11 target other than @samp{pdp11-*-bsd}.
20723 @end table
20724
20725 @node picoChip Options
20726 @subsection picoChip Options
20727 @cindex picoChip options
20728
20729 These @samp{-m} options are defined for picoChip implementations:
20730
20731 @table @gcctabopt
20732
20733 @item -mae=@var{ae_type}
20734 @opindex mcpu
20735 Set the instruction set, register set, and instruction scheduling
20736 parameters for array element type @var{ae_type}. Supported values
20737 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
20738
20739 @option{-mae=ANY} selects a completely generic AE type. Code
20740 generated with this option runs on any of the other AE types. The
20741 code is not as efficient as it would be if compiled for a specific
20742 AE type, and some types of operation (e.g., multiplication) do not
20743 work properly on all types of AE.
20744
20745 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
20746 for compiled code, and is the default.
20747
20748 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
20749 option may suffer from poor performance of byte (char) manipulation,
20750 since the DSP AE does not provide hardware support for byte load/stores.
20751
20752 @item -msymbol-as-address
20753 Enable the compiler to directly use a symbol name as an address in a
20754 load/store instruction, without first loading it into a
20755 register. Typically, the use of this option generates larger
20756 programs, which run faster than when the option isn't used. However, the
20757 results vary from program to program, so it is left as a user option,
20758 rather than being permanently enabled.
20759
20760 @item -mno-inefficient-warnings
20761 Disables warnings about the generation of inefficient code. These
20762 warnings can be generated, for example, when compiling code that
20763 performs byte-level memory operations on the MAC AE type. The MAC AE has
20764 no hardware support for byte-level memory operations, so all byte
20765 load/stores must be synthesized from word load/store operations. This is
20766 inefficient and a warning is generated to indicate
20767 that you should rewrite the code to avoid byte operations, or to target
20768 an AE type that has the necessary hardware support. This option disables
20769 these warnings.
20770
20771 @end table
20772
20773 @node PowerPC Options
20774 @subsection PowerPC Options
20775 @cindex PowerPC options
20776
20777 These are listed under @xref{RS/6000 and PowerPC Options}.
20778
20779 @node RL78 Options
20780 @subsection RL78 Options
20781 @cindex RL78 Options
20782
20783 @table @gcctabopt
20784
20785 @item -msim
20786 @opindex msim
20787 Links in additional target libraries to support operation within a
20788 simulator.
20789
20790 @item -mmul=none
20791 @itemx -mmul=g10
20792 @itemx -mmul=g13
20793 @itemx -mmul=g14
20794 @itemx -mmul=rl78
20795 @opindex mmul
20796 Specifies the type of hardware multiplication and division support to
20797 be used. The simplest is @code{none}, which uses software for both
20798 multiplication and division. This is the default. The @code{g13}
20799 value is for the hardware multiply/divide peripheral found on the
20800 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
20801 the multiplication and division instructions supported by the RL78/G14
20802 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
20803 the value @code{mg10} is an alias for @code{none}.
20804
20805 In addition a C preprocessor macro is defined, based upon the setting
20806 of this option. Possible values are: @code{__RL78_MUL_NONE__},
20807 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
20808
20809 @item -mcpu=g10
20810 @itemx -mcpu=g13
20811 @itemx -mcpu=g14
20812 @itemx -mcpu=rl78
20813 @opindex mcpu
20814 Specifies the RL78 core to target. The default is the G14 core, also
20815 known as an S3 core or just RL78. The G13 or S2 core does not have
20816 multiply or divide instructions, instead it uses a hardware peripheral
20817 for these operations. The G10 or S1 core does not have register
20818 banks, so it uses a different calling convention.
20819
20820 If this option is set it also selects the type of hardware multiply
20821 support to use, unless this is overridden by an explicit
20822 @option{-mmul=none} option on the command line. Thus specifying
20823 @option{-mcpu=g13} enables the use of the G13 hardware multiply
20824 peripheral and specifying @option{-mcpu=g10} disables the use of
20825 hardware multiplications altogether.
20826
20827 Note, although the RL78/G14 core is the default target, specifying
20828 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
20829 change the behavior of the toolchain since it also enables G14
20830 hardware multiply support. If these options are not specified on the
20831 command line then software multiplication routines will be used even
20832 though the code targets the RL78 core. This is for backwards
20833 compatibility with older toolchains which did not have hardware
20834 multiply and divide support.
20835
20836 In addition a C preprocessor macro is defined, based upon the setting
20837 of this option. Possible values are: @code{__RL78_G10__},
20838 @code{__RL78_G13__} or @code{__RL78_G14__}.
20839
20840 @item -mg10
20841 @itemx -mg13
20842 @itemx -mg14
20843 @itemx -mrl78
20844 @opindex mg10
20845 @opindex mg13
20846 @opindex mg14
20847 @opindex mrl78
20848 These are aliases for the corresponding @option{-mcpu=} option. They
20849 are provided for backwards compatibility.
20850
20851 @item -mallregs
20852 @opindex mallregs
20853 Allow the compiler to use all of the available registers. By default
20854 registers @code{r24..r31} are reserved for use in interrupt handlers.
20855 With this option enabled these registers can be used in ordinary
20856 functions as well.
20857
20858 @item -m64bit-doubles
20859 @itemx -m32bit-doubles
20860 @opindex m64bit-doubles
20861 @opindex m32bit-doubles
20862 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
20863 or 32 bits (@option{-m32bit-doubles}) in size. The default is
20864 @option{-m32bit-doubles}.
20865
20866 @item -msave-mduc-in-interrupts
20867 @item -mno-save-mduc-in-interrupts
20868 @opindex msave-mduc-in-interrupts
20869 @opindex mno-save-mduc-in-interrupts
20870 Specifies that interrupt handler functions should preserve the
20871 MDUC registers. This is only necessary if normal code might use
20872 the MDUC registers, for example because it performs multiplication
20873 and division operations. The default is to ignore the MDUC registers
20874 as this makes the interrupt handlers faster. The target option -mg13
20875 needs to be passed for this to work as this feature is only available
20876 on the G13 target (S2 core). The MDUC registers will only be saved
20877 if the interrupt handler performs a multiplication or division
20878 operation or it calls another function.
20879
20880 @end table
20881
20882 @node RS/6000 and PowerPC Options
20883 @subsection IBM RS/6000 and PowerPC Options
20884 @cindex RS/6000 and PowerPC Options
20885 @cindex IBM RS/6000 and PowerPC Options
20886
20887 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
20888 @table @gcctabopt
20889 @item -mpowerpc-gpopt
20890 @itemx -mno-powerpc-gpopt
20891 @itemx -mpowerpc-gfxopt
20892 @itemx -mno-powerpc-gfxopt
20893 @need 800
20894 @itemx -mpowerpc64
20895 @itemx -mno-powerpc64
20896 @itemx -mmfcrf
20897 @itemx -mno-mfcrf
20898 @itemx -mpopcntb
20899 @itemx -mno-popcntb
20900 @itemx -mpopcntd
20901 @itemx -mno-popcntd
20902 @itemx -mfprnd
20903 @itemx -mno-fprnd
20904 @need 800
20905 @itemx -mcmpb
20906 @itemx -mno-cmpb
20907 @itemx -mmfpgpr
20908 @itemx -mno-mfpgpr
20909 @itemx -mhard-dfp
20910 @itemx -mno-hard-dfp
20911 @opindex mpowerpc-gpopt
20912 @opindex mno-powerpc-gpopt
20913 @opindex mpowerpc-gfxopt
20914 @opindex mno-powerpc-gfxopt
20915 @opindex mpowerpc64
20916 @opindex mno-powerpc64
20917 @opindex mmfcrf
20918 @opindex mno-mfcrf
20919 @opindex mpopcntb
20920 @opindex mno-popcntb
20921 @opindex mpopcntd
20922 @opindex mno-popcntd
20923 @opindex mfprnd
20924 @opindex mno-fprnd
20925 @opindex mcmpb
20926 @opindex mno-cmpb
20927 @opindex mmfpgpr
20928 @opindex mno-mfpgpr
20929 @opindex mhard-dfp
20930 @opindex mno-hard-dfp
20931 You use these options to specify which instructions are available on the
20932 processor you are using. The default value of these options is
20933 determined when configuring GCC@. Specifying the
20934 @option{-mcpu=@var{cpu_type}} overrides the specification of these
20935 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
20936 rather than the options listed above.
20937
20938 Specifying @option{-mpowerpc-gpopt} allows
20939 GCC to use the optional PowerPC architecture instructions in the
20940 General Purpose group, including floating-point square root. Specifying
20941 @option{-mpowerpc-gfxopt} allows GCC to
20942 use the optional PowerPC architecture instructions in the Graphics
20943 group, including floating-point select.
20944
20945 The @option{-mmfcrf} option allows GCC to generate the move from
20946 condition register field instruction implemented on the POWER4
20947 processor and other processors that support the PowerPC V2.01
20948 architecture.
20949 The @option{-mpopcntb} option allows GCC to generate the popcount and
20950 double-precision FP reciprocal estimate instruction implemented on the
20951 POWER5 processor and other processors that support the PowerPC V2.02
20952 architecture.
20953 The @option{-mpopcntd} option allows GCC to generate the popcount
20954 instruction implemented on the POWER7 processor and other processors
20955 that support the PowerPC V2.06 architecture.
20956 The @option{-mfprnd} option allows GCC to generate the FP round to
20957 integer instructions implemented on the POWER5+ processor and other
20958 processors that support the PowerPC V2.03 architecture.
20959 The @option{-mcmpb} option allows GCC to generate the compare bytes
20960 instruction implemented on the POWER6 processor and other processors
20961 that support the PowerPC V2.05 architecture.
20962 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
20963 general-purpose register instructions implemented on the POWER6X
20964 processor and other processors that support the extended PowerPC V2.05
20965 architecture.
20966 The @option{-mhard-dfp} option allows GCC to generate the decimal
20967 floating-point instructions implemented on some POWER processors.
20968
20969 The @option{-mpowerpc64} option allows GCC to generate the additional
20970 64-bit instructions that are found in the full PowerPC64 architecture
20971 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
20972 @option{-mno-powerpc64}.
20973
20974 @item -mcpu=@var{cpu_type}
20975 @opindex mcpu
20976 Set architecture type, register usage, and
20977 instruction scheduling parameters for machine type @var{cpu_type}.
20978 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
20979 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
20980 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
20981 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
20982 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
20983 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
20984 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
20985 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
20986 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
20987 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
20988 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
20989 and @samp{rs64}.
20990
20991 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
20992 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
20993 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
20994 architecture machine types, with an appropriate, generic processor
20995 model assumed for scheduling purposes.
20996
20997 The other options specify a specific processor. Code generated under
20998 those options runs best on that processor, and may not run at all on
20999 others.
21000
21001 The @option{-mcpu} options automatically enable or disable the
21002 following options:
21003
21004 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
21005 -mpopcntb -mpopcntd -mpowerpc64 @gol
21006 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
21007 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
21008 -mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol
21009 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
21010
21011 The particular options set for any particular CPU varies between
21012 compiler versions, depending on what setting seems to produce optimal
21013 code for that CPU; it doesn't necessarily reflect the actual hardware's
21014 capabilities. If you wish to set an individual option to a particular
21015 value, you may specify it after the @option{-mcpu} option, like
21016 @option{-mcpu=970 -mno-altivec}.
21017
21018 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
21019 not enabled or disabled by the @option{-mcpu} option at present because
21020 AIX does not have full support for these options. You may still
21021 enable or disable them individually if you're sure it'll work in your
21022 environment.
21023
21024 @item -mtune=@var{cpu_type}
21025 @opindex mtune
21026 Set the instruction scheduling parameters for machine type
21027 @var{cpu_type}, but do not set the architecture type or register usage,
21028 as @option{-mcpu=@var{cpu_type}} does. The same
21029 values for @var{cpu_type} are used for @option{-mtune} as for
21030 @option{-mcpu}. If both are specified, the code generated uses the
21031 architecture and registers set by @option{-mcpu}, but the
21032 scheduling parameters set by @option{-mtune}.
21033
21034 @item -mcmodel=small
21035 @opindex mcmodel=small
21036 Generate PowerPC64 code for the small model: The TOC is limited to
21037 64k.
21038
21039 @item -mcmodel=medium
21040 @opindex mcmodel=medium
21041 Generate PowerPC64 code for the medium model: The TOC and other static
21042 data may be up to a total of 4G in size.
21043
21044 @item -mcmodel=large
21045 @opindex mcmodel=large
21046 Generate PowerPC64 code for the large model: The TOC may be up to 4G
21047 in size. Other data and code is only limited by the 64-bit address
21048 space.
21049
21050 @item -maltivec
21051 @itemx -mno-altivec
21052 @opindex maltivec
21053 @opindex mno-altivec
21054 Generate code that uses (does not use) AltiVec instructions, and also
21055 enable the use of built-in functions that allow more direct access to
21056 the AltiVec instruction set. You may also need to set
21057 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
21058 enhancements.
21059
21060 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
21061 @option{-maltivec=be}, the element order for AltiVec intrinsics such
21062 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
21063 match array element order corresponding to the endianness of the
21064 target. That is, element zero identifies the leftmost element in a
21065 vector register when targeting a big-endian platform, and identifies
21066 the rightmost element in a vector register when targeting a
21067 little-endian platform.
21068
21069 @item -maltivec=be
21070 @opindex maltivec=be
21071 Generate AltiVec instructions using big-endian element order,
21072 regardless of whether the target is big- or little-endian. This is
21073 the default when targeting a big-endian platform.
21074
21075 The element order is used to interpret element numbers in AltiVec
21076 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
21077 @code{vec_insert}. By default, these match array element order
21078 corresponding to the endianness for the target.
21079
21080 @item -maltivec=le
21081 @opindex maltivec=le
21082 Generate AltiVec instructions using little-endian element order,
21083 regardless of whether the target is big- or little-endian. This is
21084 the default when targeting a little-endian platform. This option is
21085 currently ignored when targeting a big-endian platform.
21086
21087 The element order is used to interpret element numbers in AltiVec
21088 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
21089 @code{vec_insert}. By default, these match array element order
21090 corresponding to the endianness for the target.
21091
21092 @item -mvrsave
21093 @itemx -mno-vrsave
21094 @opindex mvrsave
21095 @opindex mno-vrsave
21096 Generate VRSAVE instructions when generating AltiVec code.
21097
21098 @item -mgen-cell-microcode
21099 @opindex mgen-cell-microcode
21100 Generate Cell microcode instructions.
21101
21102 @item -mwarn-cell-microcode
21103 @opindex mwarn-cell-microcode
21104 Warn when a Cell microcode instruction is emitted. An example
21105 of a Cell microcode instruction is a variable shift.
21106
21107 @item -msecure-plt
21108 @opindex msecure-plt
21109 Generate code that allows @command{ld} and @command{ld.so}
21110 to build executables and shared
21111 libraries with non-executable @code{.plt} and @code{.got} sections.
21112 This is a PowerPC
21113 32-bit SYSV ABI option.
21114
21115 @item -mbss-plt
21116 @opindex mbss-plt
21117 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
21118 fills in, and
21119 requires @code{.plt} and @code{.got}
21120 sections that are both writable and executable.
21121 This is a PowerPC 32-bit SYSV ABI option.
21122
21123 @item -misel
21124 @itemx -mno-isel
21125 @opindex misel
21126 @opindex mno-isel
21127 This switch enables or disables the generation of ISEL instructions.
21128
21129 @item -misel=@var{yes/no}
21130 This switch has been deprecated. Use @option{-misel} and
21131 @option{-mno-isel} instead.
21132
21133 @item -mlra
21134 @opindex mlra
21135 Enable Local Register Allocation. This is still experimental for PowerPC,
21136 so by default the compiler uses standard reload
21137 (i.e. @option{-mno-lra}).
21138
21139 @item -mspe
21140 @itemx -mno-spe
21141 @opindex mspe
21142 @opindex mno-spe
21143 This switch enables or disables the generation of SPE simd
21144 instructions.
21145
21146 @item -mpaired
21147 @itemx -mno-paired
21148 @opindex mpaired
21149 @opindex mno-paired
21150 This switch enables or disables the generation of PAIRED simd
21151 instructions.
21152
21153 @item -mspe=@var{yes/no}
21154 This option has been deprecated. Use @option{-mspe} and
21155 @option{-mno-spe} instead.
21156
21157 @item -mvsx
21158 @itemx -mno-vsx
21159 @opindex mvsx
21160 @opindex mno-vsx
21161 Generate code that uses (does not use) vector/scalar (VSX)
21162 instructions, and also enable the use of built-in functions that allow
21163 more direct access to the VSX instruction set.
21164
21165 @item -mcrypto
21166 @itemx -mno-crypto
21167 @opindex mcrypto
21168 @opindex mno-crypto
21169 Enable the use (disable) of the built-in functions that allow direct
21170 access to the cryptographic instructions that were added in version
21171 2.07 of the PowerPC ISA.
21172
21173 @item -mdirect-move
21174 @itemx -mno-direct-move
21175 @opindex mdirect-move
21176 @opindex mno-direct-move
21177 Generate code that uses (does not use) the instructions to move data
21178 between the general purpose registers and the vector/scalar (VSX)
21179 registers that were added in version 2.07 of the PowerPC ISA.
21180
21181 @item -mhtm
21182 @itemx -mno-htm
21183 @opindex mhtm
21184 @opindex mno-htm
21185 Enable (disable) the use of the built-in functions that allow direct
21186 access to the Hardware Transactional Memory (HTM) instructions that
21187 were added in version 2.07 of the PowerPC ISA.
21188
21189 @item -mpower8-fusion
21190 @itemx -mno-power8-fusion
21191 @opindex mpower8-fusion
21192 @opindex mno-power8-fusion
21193 Generate code that keeps (does not keeps) some integer operations
21194 adjacent so that the instructions can be fused together on power8 and
21195 later processors.
21196
21197 @item -mpower8-vector
21198 @itemx -mno-power8-vector
21199 @opindex mpower8-vector
21200 @opindex mno-power8-vector
21201 Generate code that uses (does not use) the vector and scalar
21202 instructions that were added in version 2.07 of the PowerPC ISA. Also
21203 enable the use of built-in functions that allow more direct access to
21204 the vector instructions.
21205
21206 @item -mquad-memory
21207 @itemx -mno-quad-memory
21208 @opindex mquad-memory
21209 @opindex mno-quad-memory
21210 Generate code that uses (does not use) the non-atomic quad word memory
21211 instructions. The @option{-mquad-memory} option requires use of
21212 64-bit mode.
21213
21214 @item -mquad-memory-atomic
21215 @itemx -mno-quad-memory-atomic
21216 @opindex mquad-memory-atomic
21217 @opindex mno-quad-memory-atomic
21218 Generate code that uses (does not use) the atomic quad word memory
21219 instructions. The @option{-mquad-memory-atomic} option requires use of
21220 64-bit mode.
21221
21222 @item -mupper-regs-di
21223 @itemx -mno-upper-regs-di
21224 @opindex mupper-regs-di
21225 @opindex mno-upper-regs-di
21226 Generate code that uses (does not use) the scalar instructions that
21227 target all 64 registers in the vector/scalar floating point register
21228 set that were added in version 2.06 of the PowerPC ISA when processing
21229 integers. @option{-mupper-regs-di} is turned on by default if you use
21230 any of the @option{-mcpu=power7}, @option{-mcpu=power8},
21231 @option{-mcpu=power9}, or @option{-mvsx} options.
21232
21233 @item -mupper-regs-df
21234 @itemx -mno-upper-regs-df
21235 @opindex mupper-regs-df
21236 @opindex mno-upper-regs-df
21237 Generate code that uses (does not use) the scalar double precision
21238 instructions that target all 64 registers in the vector/scalar
21239 floating point register set that were added in version 2.06 of the
21240 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
21241 use any of the @option{-mcpu=power7}, @option{-mcpu=power8},
21242 @option{-mcpu=power9}, or @option{-mvsx} options.
21243
21244 @item -mupper-regs-sf
21245 @itemx -mno-upper-regs-sf
21246 @opindex mupper-regs-sf
21247 @opindex mno-upper-regs-sf
21248 Generate code that uses (does not use) the scalar single precision
21249 instructions that target all 64 registers in the vector/scalar
21250 floating point register set that were added in version 2.07 of the
21251 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
21252 use either of the @option{-mcpu=power8}, @option{-mpower8-vector}, or
21253 @option{-mcpu=power9} options.
21254
21255 @item -mupper-regs
21256 @itemx -mno-upper-regs
21257 @opindex mupper-regs
21258 @opindex mno-upper-regs
21259 Generate code that uses (does not use) the scalar
21260 instructions that target all 64 registers in the vector/scalar
21261 floating point register set, depending on the model of the machine.
21262
21263 If the @option{-mno-upper-regs} option is used, it turns off both
21264 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
21265
21266 @item -mfloat128
21267 @itemx -mno-float128
21268 @opindex mfloat128
21269 @opindex mno-float128
21270 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
21271 and use either software emulation for IEEE 128-bit floating point or
21272 hardware instructions.
21273
21274 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or
21275 @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128}
21276 option. The @option{-mfloat128} option only works on PowerPC 64-bit
21277 Linux systems.
21278
21279 If you use the ISA 3.0 instruction set (@option{-mcpu=power9}), the
21280 @option{-mfloat128} option will also enable the generation of ISA 3.0
21281 IEEE 128-bit floating point instructions. Otherwise, IEEE 128-bit
21282 floating point will be done with software emulation.
21283
21284 @item -mfloat128-hardware
21285 @itemx -mno-float128-hardware
21286 @opindex mfloat128-hardware
21287 @opindex mno-float128-hardware
21288 Enable/disable using ISA 3.0 hardware instructions to support the
21289 @var{__float128} data type.
21290
21291 If you use @option{-mfloat128-hardware}, it will enable the option
21292 @option{-mfloat128} as well.
21293
21294 If you select ISA 3.0 instructions with @option{-mcpu=power9}, but do
21295 not use either @option{-mfloat128} or @option{-mfloat128-hardware},
21296 the IEEE 128-bit floating point support will not be enabled.
21297
21298 @item -mfloat-gprs=@var{yes/single/double/no}
21299 @itemx -mfloat-gprs
21300 @opindex mfloat-gprs
21301 This switch enables or disables the generation of floating-point
21302 operations on the general-purpose registers for architectures that
21303 support it.
21304
21305 The argument @samp{yes} or @samp{single} enables the use of
21306 single-precision floating-point operations.
21307
21308 The argument @samp{double} enables the use of single and
21309 double-precision floating-point operations.
21310
21311 The argument @samp{no} disables floating-point operations on the
21312 general-purpose registers.
21313
21314 This option is currently only available on the MPC854x.
21315
21316 @item -m32
21317 @itemx -m64
21318 @opindex m32
21319 @opindex m64
21320 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
21321 targets (including GNU/Linux). The 32-bit environment sets int, long
21322 and pointer to 32 bits and generates code that runs on any PowerPC
21323 variant. The 64-bit environment sets int to 32 bits and long and
21324 pointer to 64 bits, and generates code for PowerPC64, as for
21325 @option{-mpowerpc64}.
21326
21327 @item -mfull-toc
21328 @itemx -mno-fp-in-toc
21329 @itemx -mno-sum-in-toc
21330 @itemx -mminimal-toc
21331 @opindex mfull-toc
21332 @opindex mno-fp-in-toc
21333 @opindex mno-sum-in-toc
21334 @opindex mminimal-toc
21335 Modify generation of the TOC (Table Of Contents), which is created for
21336 every executable file. The @option{-mfull-toc} option is selected by
21337 default. In that case, GCC allocates at least one TOC entry for
21338 each unique non-automatic variable reference in your program. GCC
21339 also places floating-point constants in the TOC@. However, only
21340 16,384 entries are available in the TOC@.
21341
21342 If you receive a linker error message that saying you have overflowed
21343 the available TOC space, you can reduce the amount of TOC space used
21344 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
21345 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
21346 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
21347 generate code to calculate the sum of an address and a constant at
21348 run time instead of putting that sum into the TOC@. You may specify one
21349 or both of these options. Each causes GCC to produce very slightly
21350 slower and larger code at the expense of conserving TOC space.
21351
21352 If you still run out of space in the TOC even when you specify both of
21353 these options, specify @option{-mminimal-toc} instead. This option causes
21354 GCC to make only one TOC entry for every file. When you specify this
21355 option, GCC produces code that is slower and larger but which
21356 uses extremely little TOC space. You may wish to use this option
21357 only on files that contain less frequently-executed code.
21358
21359 @item -maix64
21360 @itemx -maix32
21361 @opindex maix64
21362 @opindex maix32
21363 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
21364 @code{long} type, and the infrastructure needed to support them.
21365 Specifying @option{-maix64} implies @option{-mpowerpc64},
21366 while @option{-maix32} disables the 64-bit ABI and
21367 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
21368
21369 @item -mxl-compat
21370 @itemx -mno-xl-compat
21371 @opindex mxl-compat
21372 @opindex mno-xl-compat
21373 Produce code that conforms more closely to IBM XL compiler semantics
21374 when using AIX-compatible ABI@. Pass floating-point arguments to
21375 prototyped functions beyond the register save area (RSA) on the stack
21376 in addition to argument FPRs. Do not assume that most significant
21377 double in 128-bit long double value is properly rounded when comparing
21378 values and converting to double. Use XL symbol names for long double
21379 support routines.
21380
21381 The AIX calling convention was extended but not initially documented to
21382 handle an obscure K&R C case of calling a function that takes the
21383 address of its arguments with fewer arguments than declared. IBM XL
21384 compilers access floating-point arguments that do not fit in the
21385 RSA from the stack when a subroutine is compiled without
21386 optimization. Because always storing floating-point arguments on the
21387 stack is inefficient and rarely needed, this option is not enabled by
21388 default and only is necessary when calling subroutines compiled by IBM
21389 XL compilers without optimization.
21390
21391 @item -mpe
21392 @opindex mpe
21393 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
21394 application written to use message passing with special startup code to
21395 enable the application to run. The system must have PE installed in the
21396 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
21397 must be overridden with the @option{-specs=} option to specify the
21398 appropriate directory location. The Parallel Environment does not
21399 support threads, so the @option{-mpe} option and the @option{-pthread}
21400 option are incompatible.
21401
21402 @item -malign-natural
21403 @itemx -malign-power
21404 @opindex malign-natural
21405 @opindex malign-power
21406 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
21407 @option{-malign-natural} overrides the ABI-defined alignment of larger
21408 types, such as floating-point doubles, on their natural size-based boundary.
21409 The option @option{-malign-power} instructs GCC to follow the ABI-specified
21410 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
21411
21412 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
21413 is not supported.
21414
21415 @item -msoft-float
21416 @itemx -mhard-float
21417 @opindex msoft-float
21418 @opindex mhard-float
21419 Generate code that does not use (uses) the floating-point register set.
21420 Software floating-point emulation is provided if you use the
21421 @option{-msoft-float} option, and pass the option to GCC when linking.
21422
21423 @item -msingle-float
21424 @itemx -mdouble-float
21425 @opindex msingle-float
21426 @opindex mdouble-float
21427 Generate code for single- or double-precision floating-point operations.
21428 @option{-mdouble-float} implies @option{-msingle-float}.
21429
21430 @item -msimple-fpu
21431 @opindex msimple-fpu
21432 Do not generate @code{sqrt} and @code{div} instructions for hardware
21433 floating-point unit.
21434
21435 @item -mfpu=@var{name}
21436 @opindex mfpu
21437 Specify type of floating-point unit. Valid values for @var{name} are
21438 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
21439 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
21440 @samp{sp_full} (equivalent to @option{-msingle-float}),
21441 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
21442
21443 @item -mxilinx-fpu
21444 @opindex mxilinx-fpu
21445 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
21446
21447 @item -mmultiple
21448 @itemx -mno-multiple
21449 @opindex mmultiple
21450 @opindex mno-multiple
21451 Generate code that uses (does not use) the load multiple word
21452 instructions and the store multiple word instructions. These
21453 instructions are generated by default on POWER systems, and not
21454 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
21455 PowerPC systems, since those instructions do not work when the
21456 processor is in little-endian mode. The exceptions are PPC740 and
21457 PPC750 which permit these instructions in little-endian mode.
21458
21459 @item -mstring
21460 @itemx -mno-string
21461 @opindex mstring
21462 @opindex mno-string
21463 Generate code that uses (does not use) the load string instructions
21464 and the store string word instructions to save multiple registers and
21465 do small block moves. These instructions are generated by default on
21466 POWER systems, and not generated on PowerPC systems. Do not use
21467 @option{-mstring} on little-endian PowerPC systems, since those
21468 instructions do not work when the processor is in little-endian mode.
21469 The exceptions are PPC740 and PPC750 which permit these instructions
21470 in little-endian mode.
21471
21472 @item -mupdate
21473 @itemx -mno-update
21474 @opindex mupdate
21475 @opindex mno-update
21476 Generate code that uses (does not use) the load or store instructions
21477 that update the base register to the address of the calculated memory
21478 location. These instructions are generated by default. If you use
21479 @option{-mno-update}, there is a small window between the time that the
21480 stack pointer is updated and the address of the previous frame is
21481 stored, which means code that walks the stack frame across interrupts or
21482 signals may get corrupted data.
21483
21484 @item -mavoid-indexed-addresses
21485 @itemx -mno-avoid-indexed-addresses
21486 @opindex mavoid-indexed-addresses
21487 @opindex mno-avoid-indexed-addresses
21488 Generate code that tries to avoid (not avoid) the use of indexed load
21489 or store instructions. These instructions can incur a performance
21490 penalty on Power6 processors in certain situations, such as when
21491 stepping through large arrays that cross a 16M boundary. This option
21492 is enabled by default when targeting Power6 and disabled otherwise.
21493
21494 @item -mfused-madd
21495 @itemx -mno-fused-madd
21496 @opindex mfused-madd
21497 @opindex mno-fused-madd
21498 Generate code that uses (does not use) the floating-point multiply and
21499 accumulate instructions. These instructions are generated by default
21500 if hardware floating point is used. The machine-dependent
21501 @option{-mfused-madd} option is now mapped to the machine-independent
21502 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
21503 mapped to @option{-ffp-contract=off}.
21504
21505 @item -mmulhw
21506 @itemx -mno-mulhw
21507 @opindex mmulhw
21508 @opindex mno-mulhw
21509 Generate code that uses (does not use) the half-word multiply and
21510 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
21511 These instructions are generated by default when targeting those
21512 processors.
21513
21514 @item -mdlmzb
21515 @itemx -mno-dlmzb
21516 @opindex mdlmzb
21517 @opindex mno-dlmzb
21518 Generate code that uses (does not use) the string-search @samp{dlmzb}
21519 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
21520 generated by default when targeting those processors.
21521
21522 @item -mno-bit-align
21523 @itemx -mbit-align
21524 @opindex mno-bit-align
21525 @opindex mbit-align
21526 On System V.4 and embedded PowerPC systems do not (do) force structures
21527 and unions that contain bit-fields to be aligned to the base type of the
21528 bit-field.
21529
21530 For example, by default a structure containing nothing but 8
21531 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
21532 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
21533 the structure is aligned to a 1-byte boundary and is 1 byte in
21534 size.
21535
21536 @item -mno-strict-align
21537 @itemx -mstrict-align
21538 @opindex mno-strict-align
21539 @opindex mstrict-align
21540 On System V.4 and embedded PowerPC systems do not (do) assume that
21541 unaligned memory references are handled by the system.
21542
21543 @item -mrelocatable
21544 @itemx -mno-relocatable
21545 @opindex mrelocatable
21546 @opindex mno-relocatable
21547 Generate code that allows (does not allow) a static executable to be
21548 relocated to a different address at run time. A simple embedded
21549 PowerPC system loader should relocate the entire contents of
21550 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
21551 a table of 32-bit addresses generated by this option. For this to
21552 work, all objects linked together must be compiled with
21553 @option{-mrelocatable} or @option{-mrelocatable-lib}.
21554 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
21555
21556 @item -mrelocatable-lib
21557 @itemx -mno-relocatable-lib
21558 @opindex mrelocatable-lib
21559 @opindex mno-relocatable-lib
21560 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
21561 @code{.fixup} section to allow static executables to be relocated at
21562 run time, but @option{-mrelocatable-lib} does not use the smaller stack
21563 alignment of @option{-mrelocatable}. Objects compiled with
21564 @option{-mrelocatable-lib} may be linked with objects compiled with
21565 any combination of the @option{-mrelocatable} options.
21566
21567 @item -mno-toc
21568 @itemx -mtoc
21569 @opindex mno-toc
21570 @opindex mtoc
21571 On System V.4 and embedded PowerPC systems do not (do) assume that
21572 register 2 contains a pointer to a global area pointing to the addresses
21573 used in the program.
21574
21575 @item -mlittle
21576 @itemx -mlittle-endian
21577 @opindex mlittle
21578 @opindex mlittle-endian
21579 On System V.4 and embedded PowerPC systems compile code for the
21580 processor in little-endian mode. The @option{-mlittle-endian} option is
21581 the same as @option{-mlittle}.
21582
21583 @item -mbig
21584 @itemx -mbig-endian
21585 @opindex mbig
21586 @opindex mbig-endian
21587 On System V.4 and embedded PowerPC systems compile code for the
21588 processor in big-endian mode. The @option{-mbig-endian} option is
21589 the same as @option{-mbig}.
21590
21591 @item -mdynamic-no-pic
21592 @opindex mdynamic-no-pic
21593 On Darwin and Mac OS X systems, compile code so that it is not
21594 relocatable, but that its external references are relocatable. The
21595 resulting code is suitable for applications, but not shared
21596 libraries.
21597
21598 @item -msingle-pic-base
21599 @opindex msingle-pic-base
21600 Treat the register used for PIC addressing as read-only, rather than
21601 loading it in the prologue for each function. The runtime system is
21602 responsible for initializing this register with an appropriate value
21603 before execution begins.
21604
21605 @item -mprioritize-restricted-insns=@var{priority}
21606 @opindex mprioritize-restricted-insns
21607 This option controls the priority that is assigned to
21608 dispatch-slot restricted instructions during the second scheduling
21609 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
21610 or @samp{2} to assign no, highest, or second-highest (respectively)
21611 priority to dispatch-slot restricted
21612 instructions.
21613
21614 @item -msched-costly-dep=@var{dependence_type}
21615 @opindex msched-costly-dep
21616 This option controls which dependences are considered costly
21617 by the target during instruction scheduling. The argument
21618 @var{dependence_type} takes one of the following values:
21619
21620 @table @asis
21621 @item @samp{no}
21622 No dependence is costly.
21623
21624 @item @samp{all}
21625 All dependences are costly.
21626
21627 @item @samp{true_store_to_load}
21628 A true dependence from store to load is costly.
21629
21630 @item @samp{store_to_load}
21631 Any dependence from store to load is costly.
21632
21633 @item @var{number}
21634 Any dependence for which the latency is greater than or equal to
21635 @var{number} is costly.
21636 @end table
21637
21638 @item -minsert-sched-nops=@var{scheme}
21639 @opindex minsert-sched-nops
21640 This option controls which NOP insertion scheme is used during
21641 the second scheduling pass. The argument @var{scheme} takes one of the
21642 following values:
21643
21644 @table @asis
21645 @item @samp{no}
21646 Don't insert NOPs.
21647
21648 @item @samp{pad}
21649 Pad with NOPs any dispatch group that has vacant issue slots,
21650 according to the scheduler's grouping.
21651
21652 @item @samp{regroup_exact}
21653 Insert NOPs to force costly dependent insns into
21654 separate groups. Insert exactly as many NOPs as needed to force an insn
21655 to a new group, according to the estimated processor grouping.
21656
21657 @item @var{number}
21658 Insert NOPs to force costly dependent insns into
21659 separate groups. Insert @var{number} NOPs to force an insn to a new group.
21660 @end table
21661
21662 @item -mcall-sysv
21663 @opindex mcall-sysv
21664 On System V.4 and embedded PowerPC systems compile code using calling
21665 conventions that adhere to the March 1995 draft of the System V
21666 Application Binary Interface, PowerPC processor supplement. This is the
21667 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
21668
21669 @item -mcall-sysv-eabi
21670 @itemx -mcall-eabi
21671 @opindex mcall-sysv-eabi
21672 @opindex mcall-eabi
21673 Specify both @option{-mcall-sysv} and @option{-meabi} options.
21674
21675 @item -mcall-sysv-noeabi
21676 @opindex mcall-sysv-noeabi
21677 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
21678
21679 @item -mcall-aixdesc
21680 @opindex m
21681 On System V.4 and embedded PowerPC systems compile code for the AIX
21682 operating system.
21683
21684 @item -mcall-linux
21685 @opindex mcall-linux
21686 On System V.4 and embedded PowerPC systems compile code for the
21687 Linux-based GNU system.
21688
21689 @item -mcall-freebsd
21690 @opindex mcall-freebsd
21691 On System V.4 and embedded PowerPC systems compile code for the
21692 FreeBSD operating system.
21693
21694 @item -mcall-netbsd
21695 @opindex mcall-netbsd
21696 On System V.4 and embedded PowerPC systems compile code for the
21697 NetBSD operating system.
21698
21699 @item -mcall-openbsd
21700 @opindex mcall-netbsd
21701 On System V.4 and embedded PowerPC systems compile code for the
21702 OpenBSD operating system.
21703
21704 @item -maix-struct-return
21705 @opindex maix-struct-return
21706 Return all structures in memory (as specified by the AIX ABI)@.
21707
21708 @item -msvr4-struct-return
21709 @opindex msvr4-struct-return
21710 Return structures smaller than 8 bytes in registers (as specified by the
21711 SVR4 ABI)@.
21712
21713 @item -mabi=@var{abi-type}
21714 @opindex mabi
21715 Extend the current ABI with a particular extension, or remove such extension.
21716 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
21717 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
21718 @samp{elfv1}, @samp{elfv2}@.
21719
21720 @item -mabi=spe
21721 @opindex mabi=spe
21722 Extend the current ABI with SPE ABI extensions. This does not change
21723 the default ABI, instead it adds the SPE ABI extensions to the current
21724 ABI@.
21725
21726 @item -mabi=no-spe
21727 @opindex mabi=no-spe
21728 Disable Book-E SPE ABI extensions for the current ABI@.
21729
21730 @item -mabi=ibmlongdouble
21731 @opindex mabi=ibmlongdouble
21732 Change the current ABI to use IBM extended-precision long double.
21733 This is a PowerPC 32-bit SYSV ABI option.
21734
21735 @item -mabi=ieeelongdouble
21736 @opindex mabi=ieeelongdouble
21737 Change the current ABI to use IEEE extended-precision long double.
21738 This is a PowerPC 32-bit Linux ABI option.
21739
21740 @item -mabi=elfv1
21741 @opindex mabi=elfv1
21742 Change the current ABI to use the ELFv1 ABI.
21743 This is the default ABI for big-endian PowerPC 64-bit Linux.
21744 Overriding the default ABI requires special system support and is
21745 likely to fail in spectacular ways.
21746
21747 @item -mabi=elfv2
21748 @opindex mabi=elfv2
21749 Change the current ABI to use the ELFv2 ABI.
21750 This is the default ABI for little-endian PowerPC 64-bit Linux.
21751 Overriding the default ABI requires special system support and is
21752 likely to fail in spectacular ways.
21753
21754 @item -mgnu-attribute
21755 @itemx -mno-gnu-attribute
21756 @opindex mgnu-attribute
21757 @opindex mno-gnu-attribute
21758 Emit .gnu_attribute assembly directives to set tag/value pairs in a
21759 .gnu.attributes section that specify ABI variations in function
21760 parameters or return values.
21761
21762 @item -mprototype
21763 @itemx -mno-prototype
21764 @opindex mprototype
21765 @opindex mno-prototype
21766 On System V.4 and embedded PowerPC systems assume that all calls to
21767 variable argument functions are properly prototyped. Otherwise, the
21768 compiler must insert an instruction before every non-prototyped call to
21769 set or clear bit 6 of the condition code register (@code{CR}) to
21770 indicate whether floating-point values are passed in the floating-point
21771 registers in case the function takes variable arguments. With
21772 @option{-mprototype}, only calls to prototyped variable argument functions
21773 set or clear the bit.
21774
21775 @item -msim
21776 @opindex msim
21777 On embedded PowerPC systems, assume that the startup module is called
21778 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
21779 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
21780 configurations.
21781
21782 @item -mmvme
21783 @opindex mmvme
21784 On embedded PowerPC systems, assume that the startup module is called
21785 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
21786 @file{libc.a}.
21787
21788 @item -mads
21789 @opindex mads
21790 On embedded PowerPC systems, assume that the startup module is called
21791 @file{crt0.o} and the standard C libraries are @file{libads.a} and
21792 @file{libc.a}.
21793
21794 @item -myellowknife
21795 @opindex myellowknife
21796 On embedded PowerPC systems, assume that the startup module is called
21797 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
21798 @file{libc.a}.
21799
21800 @item -mvxworks
21801 @opindex mvxworks
21802 On System V.4 and embedded PowerPC systems, specify that you are
21803 compiling for a VxWorks system.
21804
21805 @item -memb
21806 @opindex memb
21807 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
21808 header to indicate that @samp{eabi} extended relocations are used.
21809
21810 @item -meabi
21811 @itemx -mno-eabi
21812 @opindex meabi
21813 @opindex mno-eabi
21814 On System V.4 and embedded PowerPC systems do (do not) adhere to the
21815 Embedded Applications Binary Interface (EABI), which is a set of
21816 modifications to the System V.4 specifications. Selecting @option{-meabi}
21817 means that the stack is aligned to an 8-byte boundary, a function
21818 @code{__eabi} is called from @code{main} to set up the EABI
21819 environment, and the @option{-msdata} option can use both @code{r2} and
21820 @code{r13} to point to two separate small data areas. Selecting
21821 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
21822 no EABI initialization function is called from @code{main}, and the
21823 @option{-msdata} option only uses @code{r13} to point to a single
21824 small data area. The @option{-meabi} option is on by default if you
21825 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
21826
21827 @item -msdata=eabi
21828 @opindex msdata=eabi
21829 On System V.4 and embedded PowerPC systems, put small initialized
21830 @code{const} global and static data in the @code{.sdata2} section, which
21831 is pointed to by register @code{r2}. Put small initialized
21832 non-@code{const} global and static data in the @code{.sdata} section,
21833 which is pointed to by register @code{r13}. Put small uninitialized
21834 global and static data in the @code{.sbss} section, which is adjacent to
21835 the @code{.sdata} section. The @option{-msdata=eabi} option is
21836 incompatible with the @option{-mrelocatable} option. The
21837 @option{-msdata=eabi} option also sets the @option{-memb} option.
21838
21839 @item -msdata=sysv
21840 @opindex msdata=sysv
21841 On System V.4 and embedded PowerPC systems, put small global and static
21842 data in the @code{.sdata} section, which is pointed to by register
21843 @code{r13}. Put small uninitialized global and static data in the
21844 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
21845 The @option{-msdata=sysv} option is incompatible with the
21846 @option{-mrelocatable} option.
21847
21848 @item -msdata=default
21849 @itemx -msdata
21850 @opindex msdata=default
21851 @opindex msdata
21852 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
21853 compile code the same as @option{-msdata=eabi}, otherwise compile code the
21854 same as @option{-msdata=sysv}.
21855
21856 @item -msdata=data
21857 @opindex msdata=data
21858 On System V.4 and embedded PowerPC systems, put small global
21859 data in the @code{.sdata} section. Put small uninitialized global
21860 data in the @code{.sbss} section. Do not use register @code{r13}
21861 to address small data however. This is the default behavior unless
21862 other @option{-msdata} options are used.
21863
21864 @item -msdata=none
21865 @itemx -mno-sdata
21866 @opindex msdata=none
21867 @opindex mno-sdata
21868 On embedded PowerPC systems, put all initialized global and static data
21869 in the @code{.data} section, and all uninitialized data in the
21870 @code{.bss} section.
21871
21872 @item -mblock-move-inline-limit=@var{num}
21873 @opindex mblock-move-inline-limit
21874 Inline all block moves (such as calls to @code{memcpy} or structure
21875 copies) less than or equal to @var{num} bytes. The minimum value for
21876 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
21877 targets. The default value is target-specific.
21878
21879 @item -G @var{num}
21880 @opindex G
21881 @cindex smaller data references (PowerPC)
21882 @cindex .sdata/.sdata2 references (PowerPC)
21883 On embedded PowerPC systems, put global and static items less than or
21884 equal to @var{num} bytes into the small data or BSS sections instead of
21885 the normal data or BSS section. By default, @var{num} is 8. The
21886 @option{-G @var{num}} switch is also passed to the linker.
21887 All modules should be compiled with the same @option{-G @var{num}} value.
21888
21889 @item -mregnames
21890 @itemx -mno-regnames
21891 @opindex mregnames
21892 @opindex mno-regnames
21893 On System V.4 and embedded PowerPC systems do (do not) emit register
21894 names in the assembly language output using symbolic forms.
21895
21896 @item -mlongcall
21897 @itemx -mno-longcall
21898 @opindex mlongcall
21899 @opindex mno-longcall
21900 By default assume that all calls are far away so that a longer and more
21901 expensive calling sequence is required. This is required for calls
21902 farther than 32 megabytes (33,554,432 bytes) from the current location.
21903 A short call is generated if the compiler knows
21904 the call cannot be that far away. This setting can be overridden by
21905 the @code{shortcall} function attribute, or by @code{#pragma
21906 longcall(0)}.
21907
21908 Some linkers are capable of detecting out-of-range calls and generating
21909 glue code on the fly. On these systems, long calls are unnecessary and
21910 generate slower code. As of this writing, the AIX linker can do this,
21911 as can the GNU linker for PowerPC/64. It is planned to add this feature
21912 to the GNU linker for 32-bit PowerPC systems as well.
21913
21914 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
21915 callee, L42}, plus a @dfn{branch island} (glue code). The two target
21916 addresses represent the callee and the branch island. The
21917 Darwin/PPC linker prefers the first address and generates a @code{bl
21918 callee} if the PPC @code{bl} instruction reaches the callee directly;
21919 otherwise, the linker generates @code{bl L42} to call the branch
21920 island. The branch island is appended to the body of the
21921 calling function; it computes the full 32-bit address of the callee
21922 and jumps to it.
21923
21924 On Mach-O (Darwin) systems, this option directs the compiler emit to
21925 the glue for every direct call, and the Darwin linker decides whether
21926 to use or discard it.
21927
21928 In the future, GCC may ignore all longcall specifications
21929 when the linker is known to generate glue.
21930
21931 @item -mtls-markers
21932 @itemx -mno-tls-markers
21933 @opindex mtls-markers
21934 @opindex mno-tls-markers
21935 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
21936 specifying the function argument. The relocation allows the linker to
21937 reliably associate function call with argument setup instructions for
21938 TLS optimization, which in turn allows GCC to better schedule the
21939 sequence.
21940
21941 @item -pthread
21942 @opindex pthread
21943 Adds support for multithreading with the @dfn{pthreads} library.
21944 This option sets flags for both the preprocessor and linker.
21945
21946 @item -mrecip
21947 @itemx -mno-recip
21948 @opindex mrecip
21949 This option enables use of the reciprocal estimate and
21950 reciprocal square root estimate instructions with additional
21951 Newton-Raphson steps to increase precision instead of doing a divide or
21952 square root and divide for floating-point arguments. You should use
21953 the @option{-ffast-math} option when using @option{-mrecip} (or at
21954 least @option{-funsafe-math-optimizations},
21955 @option{-ffinite-math-only}, @option{-freciprocal-math} and
21956 @option{-fno-trapping-math}). Note that while the throughput of the
21957 sequence is generally higher than the throughput of the non-reciprocal
21958 instruction, the precision of the sequence can be decreased by up to 2
21959 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
21960 roots.
21961
21962 @item -mrecip=@var{opt}
21963 @opindex mrecip=opt
21964 This option controls which reciprocal estimate instructions
21965 may be used. @var{opt} is a comma-separated list of options, which may
21966 be preceded by a @code{!} to invert the option:
21967
21968 @table @samp
21969
21970 @item all
21971 Enable all estimate instructions.
21972
21973 @item default
21974 Enable the default instructions, equivalent to @option{-mrecip}.
21975
21976 @item none
21977 Disable all estimate instructions, equivalent to @option{-mno-recip}.
21978
21979 @item div
21980 Enable the reciprocal approximation instructions for both
21981 single and double precision.
21982
21983 @item divf
21984 Enable the single-precision reciprocal approximation instructions.
21985
21986 @item divd
21987 Enable the double-precision reciprocal approximation instructions.
21988
21989 @item rsqrt
21990 Enable the reciprocal square root approximation instructions for both
21991 single and double precision.
21992
21993 @item rsqrtf
21994 Enable the single-precision reciprocal square root approximation instructions.
21995
21996 @item rsqrtd
21997 Enable the double-precision reciprocal square root approximation instructions.
21998
21999 @end table
22000
22001 So, for example, @option{-mrecip=all,!rsqrtd} enables
22002 all of the reciprocal estimate instructions, except for the
22003 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
22004 which handle the double-precision reciprocal square root calculations.
22005
22006 @item -mrecip-precision
22007 @itemx -mno-recip-precision
22008 @opindex mrecip-precision
22009 Assume (do not assume) that the reciprocal estimate instructions
22010 provide higher-precision estimates than is mandated by the PowerPC
22011 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
22012 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
22013 The double-precision square root estimate instructions are not generated by
22014 default on low-precision machines, since they do not provide an
22015 estimate that converges after three steps.
22016
22017 @item -mveclibabi=@var{type}
22018 @opindex mveclibabi
22019 Specifies the ABI type to use for vectorizing intrinsics using an
22020 external library. The only type supported at present is @samp{mass},
22021 which specifies to use IBM's Mathematical Acceleration Subsystem
22022 (MASS) libraries for vectorizing intrinsics using external libraries.
22023 GCC currently emits calls to @code{acosd2}, @code{acosf4},
22024 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
22025 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
22026 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
22027 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
22028 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
22029 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
22030 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
22031 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
22032 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
22033 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
22034 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
22035 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
22036 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
22037 for power7. Both @option{-ftree-vectorize} and
22038 @option{-funsafe-math-optimizations} must also be enabled. The MASS
22039 libraries must be specified at link time.
22040
22041 @item -mfriz
22042 @itemx -mno-friz
22043 @opindex mfriz
22044 Generate (do not generate) the @code{friz} instruction when the
22045 @option{-funsafe-math-optimizations} option is used to optimize
22046 rounding of floating-point values to 64-bit integer and back to floating
22047 point. The @code{friz} instruction does not return the same value if
22048 the floating-point number is too large to fit in an integer.
22049
22050 @item -mpointers-to-nested-functions
22051 @itemx -mno-pointers-to-nested-functions
22052 @opindex mpointers-to-nested-functions
22053 Generate (do not generate) code to load up the static chain register
22054 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
22055 systems where a function pointer points to a 3-word descriptor giving
22056 the function address, TOC value to be loaded in register @code{r2}, and
22057 static chain value to be loaded in register @code{r11}. The
22058 @option{-mpointers-to-nested-functions} is on by default. You cannot
22059 call through pointers to nested functions or pointers
22060 to functions compiled in other languages that use the static chain if
22061 you use @option{-mno-pointers-to-nested-functions}.
22062
22063 @item -msave-toc-indirect
22064 @itemx -mno-save-toc-indirect
22065 @opindex msave-toc-indirect
22066 Generate (do not generate) code to save the TOC value in the reserved
22067 stack location in the function prologue if the function calls through
22068 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
22069 saved in the prologue, it is saved just before the call through the
22070 pointer. The @option{-mno-save-toc-indirect} option is the default.
22071
22072 @item -mcompat-align-parm
22073 @itemx -mno-compat-align-parm
22074 @opindex mcompat-align-parm
22075 Generate (do not generate) code to pass structure parameters with a
22076 maximum alignment of 64 bits, for compatibility with older versions
22077 of GCC.
22078
22079 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
22080 structure parameter on a 128-bit boundary when that structure contained
22081 a member requiring 128-bit alignment. This is corrected in more
22082 recent versions of GCC. This option may be used to generate code
22083 that is compatible with functions compiled with older versions of
22084 GCC.
22085
22086 The @option{-mno-compat-align-parm} option is the default.
22087 @end table
22088
22089 @node RX Options
22090 @subsection RX Options
22091 @cindex RX Options
22092
22093 These command-line options are defined for RX targets:
22094
22095 @table @gcctabopt
22096 @item -m64bit-doubles
22097 @itemx -m32bit-doubles
22098 @opindex m64bit-doubles
22099 @opindex m32bit-doubles
22100 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
22101 or 32 bits (@option{-m32bit-doubles}) in size. The default is
22102 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
22103 works on 32-bit values, which is why the default is
22104 @option{-m32bit-doubles}.
22105
22106 @item -fpu
22107 @itemx -nofpu
22108 @opindex fpu
22109 @opindex nofpu
22110 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
22111 floating-point hardware. The default is enabled for the RX600
22112 series and disabled for the RX200 series.
22113
22114 Floating-point instructions are only generated for 32-bit floating-point
22115 values, however, so the FPU hardware is not used for doubles if the
22116 @option{-m64bit-doubles} option is used.
22117
22118 @emph{Note} If the @option{-fpu} option is enabled then
22119 @option{-funsafe-math-optimizations} is also enabled automatically.
22120 This is because the RX FPU instructions are themselves unsafe.
22121
22122 @item -mcpu=@var{name}
22123 @opindex mcpu
22124 Selects the type of RX CPU to be targeted. Currently three types are
22125 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
22126 the specific @samp{RX610} CPU. The default is @samp{RX600}.
22127
22128 The only difference between @samp{RX600} and @samp{RX610} is that the
22129 @samp{RX610} does not support the @code{MVTIPL} instruction.
22130
22131 The @samp{RX200} series does not have a hardware floating-point unit
22132 and so @option{-nofpu} is enabled by default when this type is
22133 selected.
22134
22135 @item -mbig-endian-data
22136 @itemx -mlittle-endian-data
22137 @opindex mbig-endian-data
22138 @opindex mlittle-endian-data
22139 Store data (but not code) in the big-endian format. The default is
22140 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
22141 format.
22142
22143 @item -msmall-data-limit=@var{N}
22144 @opindex msmall-data-limit
22145 Specifies the maximum size in bytes of global and static variables
22146 which can be placed into the small data area. Using the small data
22147 area can lead to smaller and faster code, but the size of area is
22148 limited and it is up to the programmer to ensure that the area does
22149 not overflow. Also when the small data area is used one of the RX's
22150 registers (usually @code{r13}) is reserved for use pointing to this
22151 area, so it is no longer available for use by the compiler. This
22152 could result in slower and/or larger code if variables are pushed onto
22153 the stack instead of being held in this register.
22154
22155 Note, common variables (variables that have not been initialized) and
22156 constants are not placed into the small data area as they are assigned
22157 to other sections in the output executable.
22158
22159 The default value is zero, which disables this feature. Note, this
22160 feature is not enabled by default with higher optimization levels
22161 (@option{-O2} etc) because of the potentially detrimental effects of
22162 reserving a register. It is up to the programmer to experiment and
22163 discover whether this feature is of benefit to their program. See the
22164 description of the @option{-mpid} option for a description of how the
22165 actual register to hold the small data area pointer is chosen.
22166
22167 @item -msim
22168 @itemx -mno-sim
22169 @opindex msim
22170 @opindex mno-sim
22171 Use the simulator runtime. The default is to use the libgloss
22172 board-specific runtime.
22173
22174 @item -mas100-syntax
22175 @itemx -mno-as100-syntax
22176 @opindex mas100-syntax
22177 @opindex mno-as100-syntax
22178 When generating assembler output use a syntax that is compatible with
22179 Renesas's AS100 assembler. This syntax can also be handled by the GAS
22180 assembler, but it has some restrictions so it is not generated by default.
22181
22182 @item -mmax-constant-size=@var{N}
22183 @opindex mmax-constant-size
22184 Specifies the maximum size, in bytes, of a constant that can be used as
22185 an operand in a RX instruction. Although the RX instruction set does
22186 allow constants of up to 4 bytes in length to be used in instructions,
22187 a longer value equates to a longer instruction. Thus in some
22188 circumstances it can be beneficial to restrict the size of constants
22189 that are used in instructions. Constants that are too big are instead
22190 placed into a constant pool and referenced via register indirection.
22191
22192 The value @var{N} can be between 0 and 4. A value of 0 (the default)
22193 or 4 means that constants of any size are allowed.
22194
22195 @item -mrelax
22196 @opindex mrelax
22197 Enable linker relaxation. Linker relaxation is a process whereby the
22198 linker attempts to reduce the size of a program by finding shorter
22199 versions of various instructions. Disabled by default.
22200
22201 @item -mint-register=@var{N}
22202 @opindex mint-register
22203 Specify the number of registers to reserve for fast interrupt handler
22204 functions. The value @var{N} can be between 0 and 4. A value of 1
22205 means that register @code{r13} is reserved for the exclusive use
22206 of fast interrupt handlers. A value of 2 reserves @code{r13} and
22207 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
22208 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
22209 A value of 0, the default, does not reserve any registers.
22210
22211 @item -msave-acc-in-interrupts
22212 @opindex msave-acc-in-interrupts
22213 Specifies that interrupt handler functions should preserve the
22214 accumulator register. This is only necessary if normal code might use
22215 the accumulator register, for example because it performs 64-bit
22216 multiplications. The default is to ignore the accumulator as this
22217 makes the interrupt handlers faster.
22218
22219 @item -mpid
22220 @itemx -mno-pid
22221 @opindex mpid
22222 @opindex mno-pid
22223 Enables the generation of position independent data. When enabled any
22224 access to constant data is done via an offset from a base address
22225 held in a register. This allows the location of constant data to be
22226 determined at run time without requiring the executable to be
22227 relocated, which is a benefit to embedded applications with tight
22228 memory constraints. Data that can be modified is not affected by this
22229 option.
22230
22231 Note, using this feature reserves a register, usually @code{r13}, for
22232 the constant data base address. This can result in slower and/or
22233 larger code, especially in complicated functions.
22234
22235 The actual register chosen to hold the constant data base address
22236 depends upon whether the @option{-msmall-data-limit} and/or the
22237 @option{-mint-register} command-line options are enabled. Starting
22238 with register @code{r13} and proceeding downwards, registers are
22239 allocated first to satisfy the requirements of @option{-mint-register},
22240 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
22241 is possible for the small data area register to be @code{r8} if both
22242 @option{-mint-register=4} and @option{-mpid} are specified on the
22243 command line.
22244
22245 By default this feature is not enabled. The default can be restored
22246 via the @option{-mno-pid} command-line option.
22247
22248 @item -mno-warn-multiple-fast-interrupts
22249 @itemx -mwarn-multiple-fast-interrupts
22250 @opindex mno-warn-multiple-fast-interrupts
22251 @opindex mwarn-multiple-fast-interrupts
22252 Prevents GCC from issuing a warning message if it finds more than one
22253 fast interrupt handler when it is compiling a file. The default is to
22254 issue a warning for each extra fast interrupt handler found, as the RX
22255 only supports one such interrupt.
22256
22257 @item -mallow-string-insns
22258 @itemx -mno-allow-string-insns
22259 @opindex mallow-string-insns
22260 @opindex mno-allow-string-insns
22261 Enables or disables the use of the string manipulation instructions
22262 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
22263 @code{SWHILE} and also the @code{RMPA} instruction. These
22264 instructions may prefetch data, which is not safe to do if accessing
22265 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
22266 for more information).
22267
22268 The default is to allow these instructions, but it is not possible for
22269 GCC to reliably detect all circumstances where a string instruction
22270 might be used to access an I/O register, so their use cannot be
22271 disabled automatically. Instead it is reliant upon the programmer to
22272 use the @option{-mno-allow-string-insns} option if their program
22273 accesses I/O space.
22274
22275 When the instructions are enabled GCC defines the C preprocessor
22276 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
22277 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
22278
22279 @item -mjsr
22280 @itemx -mno-jsr
22281 @opindex mjsr
22282 @opindex mno-jsr
22283 Use only (or not only) @code{JSR} instructions to access functions.
22284 This option can be used when code size exceeds the range of @code{BSR}
22285 instructions. Note that @option{-mno-jsr} does not mean to not use
22286 @code{JSR} but instead means that any type of branch may be used.
22287 @end table
22288
22289 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
22290 has special significance to the RX port when used with the
22291 @code{interrupt} function attribute. This attribute indicates a
22292 function intended to process fast interrupts. GCC ensures
22293 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
22294 and/or @code{r13} and only provided that the normal use of the
22295 corresponding registers have been restricted via the
22296 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
22297 options.
22298
22299 @node S/390 and zSeries Options
22300 @subsection S/390 and zSeries Options
22301 @cindex S/390 and zSeries Options
22302
22303 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
22304
22305 @table @gcctabopt
22306 @item -mhard-float
22307 @itemx -msoft-float
22308 @opindex mhard-float
22309 @opindex msoft-float
22310 Use (do not use) the hardware floating-point instructions and registers
22311 for floating-point operations. When @option{-msoft-float} is specified,
22312 functions in @file{libgcc.a} are used to perform floating-point
22313 operations. When @option{-mhard-float} is specified, the compiler
22314 generates IEEE floating-point instructions. This is the default.
22315
22316 @item -mhard-dfp
22317 @itemx -mno-hard-dfp
22318 @opindex mhard-dfp
22319 @opindex mno-hard-dfp
22320 Use (do not use) the hardware decimal-floating-point instructions for
22321 decimal-floating-point operations. When @option{-mno-hard-dfp} is
22322 specified, functions in @file{libgcc.a} are used to perform
22323 decimal-floating-point operations. When @option{-mhard-dfp} is
22324 specified, the compiler generates decimal-floating-point hardware
22325 instructions. This is the default for @option{-march=z9-ec} or higher.
22326
22327 @item -mlong-double-64
22328 @itemx -mlong-double-128
22329 @opindex mlong-double-64
22330 @opindex mlong-double-128
22331 These switches control the size of @code{long double} type. A size
22332 of 64 bits makes the @code{long double} type equivalent to the @code{double}
22333 type. This is the default.
22334
22335 @item -mbackchain
22336 @itemx -mno-backchain
22337 @opindex mbackchain
22338 @opindex mno-backchain
22339 Store (do not store) the address of the caller's frame as backchain pointer
22340 into the callee's stack frame.
22341 A backchain may be needed to allow debugging using tools that do not understand
22342 DWARF call frame information.
22343 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
22344 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
22345 the backchain is placed into the topmost word of the 96/160 byte register
22346 save area.
22347
22348 In general, code compiled with @option{-mbackchain} is call-compatible with
22349 code compiled with @option{-mmo-backchain}; however, use of the backchain
22350 for debugging purposes usually requires that the whole binary is built with
22351 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
22352 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
22353 to build a linux kernel use @option{-msoft-float}.
22354
22355 The default is to not maintain the backchain.
22356
22357 @item -mpacked-stack
22358 @itemx -mno-packed-stack
22359 @opindex mpacked-stack
22360 @opindex mno-packed-stack
22361 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
22362 specified, the compiler uses the all fields of the 96/160 byte register save
22363 area only for their default purpose; unused fields still take up stack space.
22364 When @option{-mpacked-stack} is specified, register save slots are densely
22365 packed at the top of the register save area; unused space is reused for other
22366 purposes, allowing for more efficient use of the available stack space.
22367 However, when @option{-mbackchain} is also in effect, the topmost word of
22368 the save area is always used to store the backchain, and the return address
22369 register is always saved two words below the backchain.
22370
22371 As long as the stack frame backchain is not used, code generated with
22372 @option{-mpacked-stack} is call-compatible with code generated with
22373 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
22374 S/390 or zSeries generated code that uses the stack frame backchain at run
22375 time, not just for debugging purposes. Such code is not call-compatible
22376 with code compiled with @option{-mpacked-stack}. Also, note that the
22377 combination of @option{-mbackchain},
22378 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
22379 to build a linux kernel use @option{-msoft-float}.
22380
22381 The default is to not use the packed stack layout.
22382
22383 @item -msmall-exec
22384 @itemx -mno-small-exec
22385 @opindex msmall-exec
22386 @opindex mno-small-exec
22387 Generate (or do not generate) code using the @code{bras} instruction
22388 to do subroutine calls.
22389 This only works reliably if the total executable size does not
22390 exceed 64k. The default is to use the @code{basr} instruction instead,
22391 which does not have this limitation.
22392
22393 @item -m64
22394 @itemx -m31
22395 @opindex m64
22396 @opindex m31
22397 When @option{-m31} is specified, generate code compliant to the
22398 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
22399 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
22400 particular to generate 64-bit instructions. For the @samp{s390}
22401 targets, the default is @option{-m31}, while the @samp{s390x}
22402 targets default to @option{-m64}.
22403
22404 @item -mzarch
22405 @itemx -mesa
22406 @opindex mzarch
22407 @opindex mesa
22408 When @option{-mzarch} is specified, generate code using the
22409 instructions available on z/Architecture.
22410 When @option{-mesa} is specified, generate code using the
22411 instructions available on ESA/390. Note that @option{-mesa} is
22412 not possible with @option{-m64}.
22413 When generating code compliant to the GNU/Linux for S/390 ABI,
22414 the default is @option{-mesa}. When generating code compliant
22415 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
22416
22417 @item -mhtm
22418 @itemx -mno-htm
22419 @opindex mhtm
22420 @opindex mno-htm
22421 The @option{-mhtm} option enables a set of builtins making use of
22422 instructions available with the transactional execution facility
22423 introduced with the IBM zEnterprise EC12 machine generation
22424 @ref{S/390 System z Built-in Functions}.
22425 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
22426
22427 @item -mvx
22428 @itemx -mno-vx
22429 @opindex mvx
22430 @opindex mno-vx
22431 When @option{-mvx} is specified, generate code using the instructions
22432 available with the vector extension facility introduced with the IBM
22433 z13 machine generation.
22434 This option changes the ABI for some vector type values with regard to
22435 alignment and calling conventions. In case vector type values are
22436 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
22437 command will be added to mark the resulting binary with the ABI used.
22438 @option{-mvx} is enabled by default when using @option{-march=z13}.
22439
22440 @item -mzvector
22441 @itemx -mno-zvector
22442 @opindex mzvector
22443 @opindex mno-zvector
22444 The @option{-mzvector} option enables vector language extensions and
22445 builtins using instructions available with the vector extension
22446 facility introduced with the IBM z13 machine generation.
22447 This option adds support for @samp{vector} to be used as a keyword to
22448 define vector type variables and arguments. @samp{vector} is only
22449 available when GNU extensions are enabled. It will not be expanded
22450 when requesting strict standard compliance e.g. with @option{-std=c99}.
22451 In addition to the GCC low-level builtins @option{-mzvector} enables
22452 a set of builtins added for compatibility with AltiVec-style
22453 implementations like Power and Cell. In order to make use of these
22454 builtins the header file @file{vecintrin.h} needs to be included.
22455 @option{-mzvector} is disabled by default.
22456
22457 @item -mmvcle
22458 @itemx -mno-mvcle
22459 @opindex mmvcle
22460 @opindex mno-mvcle
22461 Generate (or do not generate) code using the @code{mvcle} instruction
22462 to perform block moves. When @option{-mno-mvcle} is specified,
22463 use a @code{mvc} loop instead. This is the default unless optimizing for
22464 size.
22465
22466 @item -mdebug
22467 @itemx -mno-debug
22468 @opindex mdebug
22469 @opindex mno-debug
22470 Print (or do not print) additional debug information when compiling.
22471 The default is to not print debug information.
22472
22473 @item -march=@var{cpu-type}
22474 @opindex march
22475 Generate code that runs on @var{cpu-type}, which is the name of a
22476 system representing a certain processor type. Possible values for
22477 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
22478 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
22479 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
22480 @samp{native}.
22481
22482 The default is @option{-march=z900}. @samp{g5}/@samp{arch3} and
22483 @samp{g6} are deprecated and will be removed with future releases.
22484
22485 Specifying @samp{native} as cpu type can be used to select the best
22486 architecture option for the host processor.
22487 @option{-march=native} has no effect if GCC does not recognize the
22488 processor.
22489
22490 @item -mtune=@var{cpu-type}
22491 @opindex mtune
22492 Tune to @var{cpu-type} everything applicable about the generated code,
22493 except for the ABI and the set of available instructions.
22494 The list of @var{cpu-type} values is the same as for @option{-march}.
22495 The default is the value used for @option{-march}.
22496
22497 @item -mtpf-trace
22498 @itemx -mno-tpf-trace
22499 @opindex mtpf-trace
22500 @opindex mno-tpf-trace
22501 Generate code that adds (does not add) in TPF OS specific branches to trace
22502 routines in the operating system. This option is off by default, even
22503 when compiling for the TPF OS@.
22504
22505 @item -mfused-madd
22506 @itemx -mno-fused-madd
22507 @opindex mfused-madd
22508 @opindex mno-fused-madd
22509 Generate code that uses (does not use) the floating-point multiply and
22510 accumulate instructions. These instructions are generated by default if
22511 hardware floating point is used.
22512
22513 @item -mwarn-framesize=@var{framesize}
22514 @opindex mwarn-framesize
22515 Emit a warning if the current function exceeds the given frame size. Because
22516 this is a compile-time check it doesn't need to be a real problem when the program
22517 runs. It is intended to identify functions that most probably cause
22518 a stack overflow. It is useful to be used in an environment with limited stack
22519 size e.g.@: the linux kernel.
22520
22521 @item -mwarn-dynamicstack
22522 @opindex mwarn-dynamicstack
22523 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
22524 arrays. This is generally a bad idea with a limited stack size.
22525
22526 @item -mstack-guard=@var{stack-guard}
22527 @itemx -mstack-size=@var{stack-size}
22528 @opindex mstack-guard
22529 @opindex mstack-size
22530 If these options are provided the S/390 back end emits additional instructions in
22531 the function prologue that trigger a trap if the stack size is @var{stack-guard}
22532 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
22533 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
22534 the frame size of the compiled function is chosen.
22535 These options are intended to be used to help debugging stack overflow problems.
22536 The additionally emitted code causes only little overhead and hence can also be
22537 used in production-like systems without greater performance degradation. The given
22538 values have to be exact powers of 2 and @var{stack-size} has to be greater than
22539 @var{stack-guard} without exceeding 64k.
22540 In order to be efficient the extra code makes the assumption that the stack starts
22541 at an address aligned to the value given by @var{stack-size}.
22542 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
22543
22544 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
22545 @opindex mhotpatch
22546 If the hotpatch option is enabled, a ``hot-patching'' function
22547 prologue is generated for all functions in the compilation unit.
22548 The funtion label is prepended with the given number of two-byte
22549 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
22550 the label, 2 * @var{post-halfwords} bytes are appended, using the
22551 largest NOP like instructions the architecture allows (maximum
22552 1000000).
22553
22554 If both arguments are zero, hotpatching is disabled.
22555
22556 This option can be overridden for individual functions with the
22557 @code{hotpatch} attribute.
22558 @end table
22559
22560 @node Score Options
22561 @subsection Score Options
22562 @cindex Score Options
22563
22564 These options are defined for Score implementations:
22565
22566 @table @gcctabopt
22567 @item -meb
22568 @opindex meb
22569 Compile code for big-endian mode. This is the default.
22570
22571 @item -mel
22572 @opindex mel
22573 Compile code for little-endian mode.
22574
22575 @item -mnhwloop
22576 @opindex mnhwloop
22577 Disable generation of @code{bcnz} instructions.
22578
22579 @item -muls
22580 @opindex muls
22581 Enable generation of unaligned load and store instructions.
22582
22583 @item -mmac
22584 @opindex mmac
22585 Enable the use of multiply-accumulate instructions. Disabled by default.
22586
22587 @item -mscore5
22588 @opindex mscore5
22589 Specify the SCORE5 as the target architecture.
22590
22591 @item -mscore5u
22592 @opindex mscore5u
22593 Specify the SCORE5U of the target architecture.
22594
22595 @item -mscore7
22596 @opindex mscore7
22597 Specify the SCORE7 as the target architecture. This is the default.
22598
22599 @item -mscore7d
22600 @opindex mscore7d
22601 Specify the SCORE7D as the target architecture.
22602 @end table
22603
22604 @node SH Options
22605 @subsection SH Options
22606
22607 These @samp{-m} options are defined for the SH implementations:
22608
22609 @table @gcctabopt
22610 @item -m1
22611 @opindex m1
22612 Generate code for the SH1.
22613
22614 @item -m2
22615 @opindex m2
22616 Generate code for the SH2.
22617
22618 @item -m2e
22619 Generate code for the SH2e.
22620
22621 @item -m2a-nofpu
22622 @opindex m2a-nofpu
22623 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
22624 that the floating-point unit is not used.
22625
22626 @item -m2a-single-only
22627 @opindex m2a-single-only
22628 Generate code for the SH2a-FPU, in such a way that no double-precision
22629 floating-point operations are used.
22630
22631 @item -m2a-single
22632 @opindex m2a-single
22633 Generate code for the SH2a-FPU assuming the floating-point unit is in
22634 single-precision mode by default.
22635
22636 @item -m2a
22637 @opindex m2a
22638 Generate code for the SH2a-FPU assuming the floating-point unit is in
22639 double-precision mode by default.
22640
22641 @item -m3
22642 @opindex m3
22643 Generate code for the SH3.
22644
22645 @item -m3e
22646 @opindex m3e
22647 Generate code for the SH3e.
22648
22649 @item -m4-nofpu
22650 @opindex m4-nofpu
22651 Generate code for the SH4 without a floating-point unit.
22652
22653 @item -m4-single-only
22654 @opindex m4-single-only
22655 Generate code for the SH4 with a floating-point unit that only
22656 supports single-precision arithmetic.
22657
22658 @item -m4-single
22659 @opindex m4-single
22660 Generate code for the SH4 assuming the floating-point unit is in
22661 single-precision mode by default.
22662
22663 @item -m4
22664 @opindex m4
22665 Generate code for the SH4.
22666
22667 @item -m4-100
22668 @opindex m4-100
22669 Generate code for SH4-100.
22670
22671 @item -m4-100-nofpu
22672 @opindex m4-100-nofpu
22673 Generate code for SH4-100 in such a way that the
22674 floating-point unit is not used.
22675
22676 @item -m4-100-single
22677 @opindex m4-100-single
22678 Generate code for SH4-100 assuming the floating-point unit is in
22679 single-precision mode by default.
22680
22681 @item -m4-100-single-only
22682 @opindex m4-100-single-only
22683 Generate code for SH4-100 in such a way that no double-precision
22684 floating-point operations are used.
22685
22686 @item -m4-200
22687 @opindex m4-200
22688 Generate code for SH4-200.
22689
22690 @item -m4-200-nofpu
22691 @opindex m4-200-nofpu
22692 Generate code for SH4-200 without in such a way that the
22693 floating-point unit is not used.
22694
22695 @item -m4-200-single
22696 @opindex m4-200-single
22697 Generate code for SH4-200 assuming the floating-point unit is in
22698 single-precision mode by default.
22699
22700 @item -m4-200-single-only
22701 @opindex m4-200-single-only
22702 Generate code for SH4-200 in such a way that no double-precision
22703 floating-point operations are used.
22704
22705 @item -m4-300
22706 @opindex m4-300
22707 Generate code for SH4-300.
22708
22709 @item -m4-300-nofpu
22710 @opindex m4-300-nofpu
22711 Generate code for SH4-300 without in such a way that the
22712 floating-point unit is not used.
22713
22714 @item -m4-300-single
22715 @opindex m4-300-single
22716 Generate code for SH4-300 in such a way that no double-precision
22717 floating-point operations are used.
22718
22719 @item -m4-300-single-only
22720 @opindex m4-300-single-only
22721 Generate code for SH4-300 in such a way that no double-precision
22722 floating-point operations are used.
22723
22724 @item -m4-340
22725 @opindex m4-340
22726 Generate code for SH4-340 (no MMU, no FPU).
22727
22728 @item -m4-500
22729 @opindex m4-500
22730 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
22731 assembler.
22732
22733 @item -m4a-nofpu
22734 @opindex m4a-nofpu
22735 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
22736 floating-point unit is not used.
22737
22738 @item -m4a-single-only
22739 @opindex m4a-single-only
22740 Generate code for the SH4a, in such a way that no double-precision
22741 floating-point operations are used.
22742
22743 @item -m4a-single
22744 @opindex m4a-single
22745 Generate code for the SH4a assuming the floating-point unit is in
22746 single-precision mode by default.
22747
22748 @item -m4a
22749 @opindex m4a
22750 Generate code for the SH4a.
22751
22752 @item -m4al
22753 @opindex m4al
22754 Same as @option{-m4a-nofpu}, except that it implicitly passes
22755 @option{-dsp} to the assembler. GCC doesn't generate any DSP
22756 instructions at the moment.
22757
22758 @item -mb
22759 @opindex mb
22760 Compile code for the processor in big-endian mode.
22761
22762 @item -ml
22763 @opindex ml
22764 Compile code for the processor in little-endian mode.
22765
22766 @item -mdalign
22767 @opindex mdalign
22768 Align doubles at 64-bit boundaries. Note that this changes the calling
22769 conventions, and thus some functions from the standard C library do
22770 not work unless you recompile it first with @option{-mdalign}.
22771
22772 @item -mrelax
22773 @opindex mrelax
22774 Shorten some address references at link time, when possible; uses the
22775 linker option @option{-relax}.
22776
22777 @item -mbigtable
22778 @opindex mbigtable
22779 Use 32-bit offsets in @code{switch} tables. The default is to use
22780 16-bit offsets.
22781
22782 @item -mbitops
22783 @opindex mbitops
22784 Enable the use of bit manipulation instructions on SH2A.
22785
22786 @item -mfmovd
22787 @opindex mfmovd
22788 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
22789 alignment constraints.
22790
22791 @item -mrenesas
22792 @opindex mrenesas
22793 Comply with the calling conventions defined by Renesas.
22794
22795 @item -mno-renesas
22796 @opindex mno-renesas
22797 Comply with the calling conventions defined for GCC before the Renesas
22798 conventions were available. This option is the default for all
22799 targets of the SH toolchain.
22800
22801 @item -mnomacsave
22802 @opindex mnomacsave
22803 Mark the @code{MAC} register as call-clobbered, even if
22804 @option{-mrenesas} is given.
22805
22806 @item -mieee
22807 @itemx -mno-ieee
22808 @opindex mieee
22809 @opindex mno-ieee
22810 Control the IEEE compliance of floating-point comparisons, which affects the
22811 handling of cases where the result of a comparison is unordered. By default
22812 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
22813 enabled @option{-mno-ieee} is implicitly set, which results in faster
22814 floating-point greater-equal and less-equal comparisons. The implicit settings
22815 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
22816
22817 @item -minline-ic_invalidate
22818 @opindex minline-ic_invalidate
22819 Inline code to invalidate instruction cache entries after setting up
22820 nested function trampolines.
22821 This option has no effect if @option{-musermode} is in effect and the selected
22822 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
22823 instruction.
22824 If the selected code generation option does not allow the use of the @code{icbi}
22825 instruction, and @option{-musermode} is not in effect, the inlined code
22826 manipulates the instruction cache address array directly with an associative
22827 write. This not only requires privileged mode at run time, but it also
22828 fails if the cache line had been mapped via the TLB and has become unmapped.
22829
22830 @item -misize
22831 @opindex misize
22832 Dump instruction size and location in the assembly code.
22833
22834 @item -mpadstruct
22835 @opindex mpadstruct
22836 This option is deprecated. It pads structures to multiple of 4 bytes,
22837 which is incompatible with the SH ABI@.
22838
22839 @item -matomic-model=@var{model}
22840 @opindex matomic-model=@var{model}
22841 Sets the model of atomic operations and additional parameters as a comma
22842 separated list. For details on the atomic built-in functions see
22843 @ref{__atomic Builtins}. The following models and parameters are supported:
22844
22845 @table @samp
22846
22847 @item none
22848 Disable compiler generated atomic sequences and emit library calls for atomic
22849 operations. This is the default if the target is not @code{sh*-*-linux*}.
22850
22851 @item soft-gusa
22852 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
22853 built-in functions. The generated atomic sequences require additional support
22854 from the interrupt/exception handling code of the system and are only suitable
22855 for SH3* and SH4* single-core systems. This option is enabled by default when
22856 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
22857 this option also partially utilizes the hardware atomic instructions
22858 @code{movli.l} and @code{movco.l} to create more efficient code, unless
22859 @samp{strict} is specified.
22860
22861 @item soft-tcb
22862 Generate software atomic sequences that use a variable in the thread control
22863 block. This is a variation of the gUSA sequences which can also be used on
22864 SH1* and SH2* targets. The generated atomic sequences require additional
22865 support from the interrupt/exception handling code of the system and are only
22866 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
22867 parameter has to be specified as well.
22868
22869 @item soft-imask
22870 Generate software atomic sequences that temporarily disable interrupts by
22871 setting @code{SR.IMASK = 1111}. This model works only when the program runs
22872 in privileged mode and is only suitable for single-core systems. Additional
22873 support from the interrupt/exception handling code of the system is not
22874 required. This model is enabled by default when the target is
22875 @code{sh*-*-linux*} and SH1* or SH2*.
22876
22877 @item hard-llcs
22878 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
22879 instructions only. This is only available on SH4A and is suitable for
22880 multi-core systems. Since the hardware instructions support only 32 bit atomic
22881 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
22882 Code compiled with this option is also compatible with other software
22883 atomic model interrupt/exception handling systems if executed on an SH4A
22884 system. Additional support from the interrupt/exception handling code of the
22885 system is not required for this model.
22886
22887 @item gbr-offset=
22888 This parameter specifies the offset in bytes of the variable in the thread
22889 control block structure that should be used by the generated atomic sequences
22890 when the @samp{soft-tcb} model has been selected. For other models this
22891 parameter is ignored. The specified value must be an integer multiple of four
22892 and in the range 0-1020.
22893
22894 @item strict
22895 This parameter prevents mixed usage of multiple atomic models, even if they
22896 are compatible, and makes the compiler generate atomic sequences of the
22897 specified model only.
22898
22899 @end table
22900
22901 @item -mtas
22902 @opindex mtas
22903 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
22904 Notice that depending on the particular hardware and software configuration
22905 this can degrade overall performance due to the operand cache line flushes
22906 that are implied by the @code{tas.b} instruction. On multi-core SH4A
22907 processors the @code{tas.b} instruction must be used with caution since it
22908 can result in data corruption for certain cache configurations.
22909
22910 @item -mprefergot
22911 @opindex mprefergot
22912 When generating position-independent code, emit function calls using
22913 the Global Offset Table instead of the Procedure Linkage Table.
22914
22915 @item -musermode
22916 @itemx -mno-usermode
22917 @opindex musermode
22918 @opindex mno-usermode
22919 Don't allow (allow) the compiler generating privileged mode code. Specifying
22920 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
22921 inlined code would not work in user mode. @option{-musermode} is the default
22922 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
22923 @option{-musermode} has no effect, since there is no user mode.
22924
22925 @item -multcost=@var{number}
22926 @opindex multcost=@var{number}
22927 Set the cost to assume for a multiply insn.
22928
22929 @item -mdiv=@var{strategy}
22930 @opindex mdiv=@var{strategy}
22931 Set the division strategy to be used for integer division operations.
22932 @var{strategy} can be one of:
22933
22934 @table @samp
22935
22936 @item call-div1
22937 Calls a library function that uses the single-step division instruction
22938 @code{div1} to perform the operation. Division by zero calculates an
22939 unspecified result and does not trap. This is the default except for SH4,
22940 SH2A and SHcompact.
22941
22942 @item call-fp
22943 Calls a library function that performs the operation in double precision
22944 floating point. Division by zero causes a floating-point exception. This is
22945 the default for SHcompact with FPU. Specifying this for targets that do not
22946 have a double precision FPU defaults to @code{call-div1}.
22947
22948 @item call-table
22949 Calls a library function that uses a lookup table for small divisors and
22950 the @code{div1} instruction with case distinction for larger divisors. Division
22951 by zero calculates an unspecified result and does not trap. This is the default
22952 for SH4. Specifying this for targets that do not have dynamic shift
22953 instructions defaults to @code{call-div1}.
22954
22955 @end table
22956
22957 When a division strategy has not been specified the default strategy is
22958 selected based on the current target. For SH2A the default strategy is to
22959 use the @code{divs} and @code{divu} instructions instead of library function
22960 calls.
22961
22962 @item -maccumulate-outgoing-args
22963 @opindex maccumulate-outgoing-args
22964 Reserve space once for outgoing arguments in the function prologue rather
22965 than around each call. Generally beneficial for performance and size. Also
22966 needed for unwinding to avoid changing the stack frame around conditional code.
22967
22968 @item -mdivsi3_libfunc=@var{name}
22969 @opindex mdivsi3_libfunc=@var{name}
22970 Set the name of the library function used for 32-bit signed division to
22971 @var{name}.
22972 This only affects the name used in the @samp{call} division strategies, and
22973 the compiler still expects the same sets of input/output/clobbered registers as
22974 if this option were not present.
22975
22976 @item -mfixed-range=@var{register-range}
22977 @opindex mfixed-range
22978 Generate code treating the given register range as fixed registers.
22979 A fixed register is one that the register allocator can not use. This is
22980 useful when compiling kernel code. A register range is specified as
22981 two registers separated by a dash. Multiple register ranges can be
22982 specified separated by a comma.
22983
22984 @item -mbranch-cost=@var{num}
22985 @opindex mbranch-cost=@var{num}
22986 Assume @var{num} to be the cost for a branch instruction. Higher numbers
22987 make the compiler try to generate more branch-free code if possible.
22988 If not specified the value is selected depending on the processor type that
22989 is being compiled for.
22990
22991 @item -mzdcbranch
22992 @itemx -mno-zdcbranch
22993 @opindex mzdcbranch
22994 @opindex mno-zdcbranch
22995 Assume (do not assume) that zero displacement conditional branch instructions
22996 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
22997 compiler prefers zero displacement branch code sequences. This is
22998 enabled by default when generating code for SH4 and SH4A. It can be explicitly
22999 disabled by specifying @option{-mno-zdcbranch}.
23000
23001 @item -mcbranch-force-delay-slot
23002 @opindex mcbranch-force-delay-slot
23003 Force the usage of delay slots for conditional branches, which stuffs the delay
23004 slot with a @code{nop} if a suitable instruction can't be found. By default
23005 this option is disabled. It can be enabled to work around hardware bugs as
23006 found in the original SH7055.
23007
23008 @item -mfused-madd
23009 @itemx -mno-fused-madd
23010 @opindex mfused-madd
23011 @opindex mno-fused-madd
23012 Generate code that uses (does not use) the floating-point multiply and
23013 accumulate instructions. These instructions are generated by default
23014 if hardware floating point is used. The machine-dependent
23015 @option{-mfused-madd} option is now mapped to the machine-independent
23016 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23017 mapped to @option{-ffp-contract=off}.
23018
23019 @item -mfsca
23020 @itemx -mno-fsca
23021 @opindex mfsca
23022 @opindex mno-fsca
23023 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
23024 and cosine approximations. The option @option{-mfsca} must be used in
23025 combination with @option{-funsafe-math-optimizations}. It is enabled by default
23026 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
23027 approximations even if @option{-funsafe-math-optimizations} is in effect.
23028
23029 @item -mfsrra
23030 @itemx -mno-fsrra
23031 @opindex mfsrra
23032 @opindex mno-fsrra
23033 Allow or disallow the compiler to emit the @code{fsrra} instruction for
23034 reciprocal square root approximations. The option @option{-mfsrra} must be used
23035 in combination with @option{-funsafe-math-optimizations} and
23036 @option{-ffinite-math-only}. It is enabled by default when generating code for
23037 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
23038 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
23039 in effect.
23040
23041 @item -mpretend-cmove
23042 @opindex mpretend-cmove
23043 Prefer zero-displacement conditional branches for conditional move instruction
23044 patterns. This can result in faster code on the SH4 processor.
23045
23046 @item -mfdpic
23047 @opindex fdpic
23048 Generate code using the FDPIC ABI.
23049
23050 @end table
23051
23052 @node Solaris 2 Options
23053 @subsection Solaris 2 Options
23054 @cindex Solaris 2 options
23055
23056 These @samp{-m} options are supported on Solaris 2:
23057
23058 @table @gcctabopt
23059 @item -mclear-hwcap
23060 @opindex mclear-hwcap
23061 @option{-mclear-hwcap} tells the compiler to remove the hardware
23062 capabilities generated by the Solaris assembler. This is only necessary
23063 when object files use ISA extensions not supported by the current
23064 machine, but check at runtime whether or not to use them.
23065
23066 @item -mimpure-text
23067 @opindex mimpure-text
23068 @option{-mimpure-text}, used in addition to @option{-shared}, tells
23069 the compiler to not pass @option{-z text} to the linker when linking a
23070 shared object. Using this option, you can link position-dependent
23071 code into a shared object.
23072
23073 @option{-mimpure-text} suppresses the ``relocations remain against
23074 allocatable but non-writable sections'' linker error message.
23075 However, the necessary relocations trigger copy-on-write, and the
23076 shared object is not actually shared across processes. Instead of
23077 using @option{-mimpure-text}, you should compile all source code with
23078 @option{-fpic} or @option{-fPIC}.
23079
23080 @end table
23081
23082 These switches are supported in addition to the above on Solaris 2:
23083
23084 @table @gcctabopt
23085 @item -pthreads
23086 @opindex pthreads
23087 Add support for multithreading using the POSIX threads library. This
23088 option sets flags for both the preprocessor and linker. This option does
23089 not affect the thread safety of object code produced by the compiler or
23090 that of libraries supplied with it.
23091
23092 @item -pthread
23093 @opindex pthread
23094 This is a synonym for @option{-pthreads}.
23095 @end table
23096
23097 @node SPARC Options
23098 @subsection SPARC Options
23099 @cindex SPARC options
23100
23101 These @samp{-m} options are supported on the SPARC:
23102
23103 @table @gcctabopt
23104 @item -mno-app-regs
23105 @itemx -mapp-regs
23106 @opindex mno-app-regs
23107 @opindex mapp-regs
23108 Specify @option{-mapp-regs} to generate output using the global registers
23109 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
23110 global register 1, each global register 2 through 4 is then treated as an
23111 allocable register that is clobbered by function calls. This is the default.
23112
23113 To be fully SVR4 ABI-compliant at the cost of some performance loss,
23114 specify @option{-mno-app-regs}. You should compile libraries and system
23115 software with this option.
23116
23117 @item -mflat
23118 @itemx -mno-flat
23119 @opindex mflat
23120 @opindex mno-flat
23121 With @option{-mflat}, the compiler does not generate save/restore instructions
23122 and uses a ``flat'' or single register window model. This model is compatible
23123 with the regular register window model. The local registers and the input
23124 registers (0--5) are still treated as ``call-saved'' registers and are
23125 saved on the stack as needed.
23126
23127 With @option{-mno-flat} (the default), the compiler generates save/restore
23128 instructions (except for leaf functions). This is the normal operating mode.
23129
23130 @item -mfpu
23131 @itemx -mhard-float
23132 @opindex mfpu
23133 @opindex mhard-float
23134 Generate output containing floating-point instructions. This is the
23135 default.
23136
23137 @item -mno-fpu
23138 @itemx -msoft-float
23139 @opindex mno-fpu
23140 @opindex msoft-float
23141 Generate output containing library calls for floating point.
23142 @strong{Warning:} the requisite libraries are not available for all SPARC
23143 targets. Normally the facilities of the machine's usual C compiler are
23144 used, but this cannot be done directly in cross-compilation. You must make
23145 your own arrangements to provide suitable library functions for
23146 cross-compilation. The embedded targets @samp{sparc-*-aout} and
23147 @samp{sparclite-*-*} do provide software floating-point support.
23148
23149 @option{-msoft-float} changes the calling convention in the output file;
23150 therefore, it is only useful if you compile @emph{all} of a program with
23151 this option. In particular, you need to compile @file{libgcc.a}, the
23152 library that comes with GCC, with @option{-msoft-float} in order for
23153 this to work.
23154
23155 @item -mhard-quad-float
23156 @opindex mhard-quad-float
23157 Generate output containing quad-word (long double) floating-point
23158 instructions.
23159
23160 @item -msoft-quad-float
23161 @opindex msoft-quad-float
23162 Generate output containing library calls for quad-word (long double)
23163 floating-point instructions. The functions called are those specified
23164 in the SPARC ABI@. This is the default.
23165
23166 As of this writing, there are no SPARC implementations that have hardware
23167 support for the quad-word floating-point instructions. They all invoke
23168 a trap handler for one of these instructions, and then the trap handler
23169 emulates the effect of the instruction. Because of the trap handler overhead,
23170 this is much slower than calling the ABI library routines. Thus the
23171 @option{-msoft-quad-float} option is the default.
23172
23173 @item -mno-unaligned-doubles
23174 @itemx -munaligned-doubles
23175 @opindex mno-unaligned-doubles
23176 @opindex munaligned-doubles
23177 Assume that doubles have 8-byte alignment. This is the default.
23178
23179 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
23180 alignment only if they are contained in another type, or if they have an
23181 absolute address. Otherwise, it assumes they have 4-byte alignment.
23182 Specifying this option avoids some rare compatibility problems with code
23183 generated by other compilers. It is not the default because it results
23184 in a performance loss, especially for floating-point code.
23185
23186 @item -muser-mode
23187 @itemx -mno-user-mode
23188 @opindex muser-mode
23189 @opindex mno-user-mode
23190 Do not generate code that can only run in supervisor mode. This is relevant
23191 only for the @code{casa} instruction emitted for the LEON3 processor. This
23192 is the default.
23193
23194 @item -mfaster-structs
23195 @itemx -mno-faster-structs
23196 @opindex mfaster-structs
23197 @opindex mno-faster-structs
23198 With @option{-mfaster-structs}, the compiler assumes that structures
23199 should have 8-byte alignment. This enables the use of pairs of
23200 @code{ldd} and @code{std} instructions for copies in structure
23201 assignment, in place of twice as many @code{ld} and @code{st} pairs.
23202 However, the use of this changed alignment directly violates the SPARC
23203 ABI@. Thus, it's intended only for use on targets where the developer
23204 acknowledges that their resulting code is not directly in line with
23205 the rules of the ABI@.
23206
23207 @item -mstd-struct-return
23208 @itemx -mno-std-struct-return
23209 @opindex mstd-struct-return
23210 @opindex mno-std-struct-return
23211 With @option{-mstd-struct-return}, the compiler generates checking code
23212 in functions returning structures or unions to detect size mismatches
23213 between the two sides of function calls, as per the 32-bit ABI@.
23214
23215 The default is @option{-mno-std-struct-return}. This option has no effect
23216 in 64-bit mode.
23217
23218 @item -mcpu=@var{cpu_type}
23219 @opindex mcpu
23220 Set the instruction set, register set, and instruction scheduling parameters
23221 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
23222 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
23223 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
23224 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
23225 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
23226 @samp{niagara3}, @samp{niagara4} and @samp{niagara7}.
23227
23228 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
23229 which selects the best architecture option for the host processor.
23230 @option{-mcpu=native} has no effect if GCC does not recognize
23231 the processor.
23232
23233 Default instruction scheduling parameters are used for values that select
23234 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
23235 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
23236
23237 Here is a list of each supported architecture and their supported
23238 implementations.
23239
23240 @table @asis
23241 @item v7
23242 cypress, leon3v7
23243
23244 @item v8
23245 supersparc, hypersparc, leon, leon3
23246
23247 @item sparclite
23248 f930, f934, sparclite86x
23249
23250 @item sparclet
23251 tsc701
23252
23253 @item v9
23254 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7
23255 @end table
23256
23257 By default (unless configured otherwise), GCC generates code for the V7
23258 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
23259 additionally optimizes it for the Cypress CY7C602 chip, as used in the
23260 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
23261 SPARCStation 1, 2, IPX etc.
23262
23263 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
23264 architecture. The only difference from V7 code is that the compiler emits
23265 the integer multiply and integer divide instructions which exist in SPARC-V8
23266 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
23267 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
23268 2000 series.
23269
23270 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
23271 the SPARC architecture. This adds the integer multiply, integer divide step
23272 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
23273 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
23274 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
23275 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
23276 MB86934 chip, which is the more recent SPARClite with FPU@.
23277
23278 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
23279 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
23280 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
23281 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
23282 optimizes it for the TEMIC SPARClet chip.
23283
23284 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
23285 architecture. This adds 64-bit integer and floating-point move instructions,
23286 3 additional floating-point condition code registers and conditional move
23287 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
23288 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
23289 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
23290 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
23291 @option{-mcpu=niagara}, the compiler additionally optimizes it for
23292 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
23293 additionally optimizes it for Sun UltraSPARC T2 chips. With
23294 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
23295 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
23296 additionally optimizes it for Sun UltraSPARC T4 chips. With
23297 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
23298 Oracle SPARC M7 chips.
23299
23300 @item -mtune=@var{cpu_type}
23301 @opindex mtune
23302 Set the instruction scheduling parameters for machine type
23303 @var{cpu_type}, but do not set the instruction set or register set that the
23304 option @option{-mcpu=@var{cpu_type}} does.
23305
23306 The same values for @option{-mcpu=@var{cpu_type}} can be used for
23307 @option{-mtune=@var{cpu_type}}, but the only useful values are those
23308 that select a particular CPU implementation. Those are
23309 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
23310 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
23311 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
23312 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
23313 @samp{niagara4} and @samp{niagara7}. With native Solaris and
23314 GNU/Linux toolchains, @samp{native} can also be used.
23315
23316 @item -mv8plus
23317 @itemx -mno-v8plus
23318 @opindex mv8plus
23319 @opindex mno-v8plus
23320 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
23321 difference from the V8 ABI is that the global and out registers are
23322 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
23323 mode for all SPARC-V9 processors.
23324
23325 @item -mvis
23326 @itemx -mno-vis
23327 @opindex mvis
23328 @opindex mno-vis
23329 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
23330 Visual Instruction Set extensions. The default is @option{-mno-vis}.
23331
23332 @item -mvis2
23333 @itemx -mno-vis2
23334 @opindex mvis2
23335 @opindex mno-vis2
23336 With @option{-mvis2}, GCC generates code that takes advantage of
23337 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
23338 default is @option{-mvis2} when targeting a cpu that supports such
23339 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
23340 also sets @option{-mvis}.
23341
23342 @item -mvis3
23343 @itemx -mno-vis3
23344 @opindex mvis3
23345 @opindex mno-vis3
23346 With @option{-mvis3}, GCC generates code that takes advantage of
23347 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
23348 default is @option{-mvis3} when targeting a cpu that supports such
23349 instructions, such as niagara-3 and later. Setting @option{-mvis3}
23350 also sets @option{-mvis2} and @option{-mvis}.
23351
23352 @item -mvis4
23353 @itemx -mno-vis4
23354 @opindex mvis4
23355 @opindex mno-vis4
23356 With @option{-mvis4}, GCC generates code that takes advantage of
23357 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
23358 default is @option{-mvis4} when targeting a cpu that supports such
23359 instructions, such as niagara-7 and later. Setting @option{-mvis4}
23360 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
23361
23362 @item -mcbcond
23363 @itemx -mno-cbcond
23364 @opindex mcbcond
23365 @opindex mno-cbcond
23366 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
23367 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
23368 when targeting a CPU that supports such instructions, such as Niagara-4 and
23369 later.
23370
23371 @item -mfmaf
23372 @itemx -mno-fmaf
23373 @opindex mfmaf
23374 @opindex mno-fmaf
23375 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
23376 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
23377 when targeting a CPU that supports such instructions, such as Niagara-3 and
23378 later.
23379
23380 @item -mpopc
23381 @itemx -mno-popc
23382 @opindex mpopc
23383 @opindex mno-popc
23384 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
23385 Population Count instruction. The default is @option{-mpopc}
23386 when targeting a CPU that supports such an instruction, such as Niagara-2 and
23387 later.
23388
23389 @item -msubxc
23390 @itemx -mno-subxc
23391 @opindex msubxc
23392 @opindex mno-subxc
23393 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
23394 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
23395 when targeting a CPU that supports such an instruction, such as Niagara-7 and
23396 later.
23397
23398 @item -mfix-at697f
23399 @opindex mfix-at697f
23400 Enable the documented workaround for the single erratum of the Atmel AT697F
23401 processor (which corresponds to erratum #13 of the AT697E processor).
23402
23403 @item -mfix-ut699
23404 @opindex mfix-ut699
23405 Enable the documented workarounds for the floating-point errata and the data
23406 cache nullify errata of the UT699 processor.
23407 @end table
23408
23409 These @samp{-m} options are supported in addition to the above
23410 on SPARC-V9 processors in 64-bit environments:
23411
23412 @table @gcctabopt
23413 @item -m32
23414 @itemx -m64
23415 @opindex m32
23416 @opindex m64
23417 Generate code for a 32-bit or 64-bit environment.
23418 The 32-bit environment sets int, long and pointer to 32 bits.
23419 The 64-bit environment sets int to 32 bits and long and pointer
23420 to 64 bits.
23421
23422 @item -mcmodel=@var{which}
23423 @opindex mcmodel
23424 Set the code model to one of
23425
23426 @table @samp
23427 @item medlow
23428 The Medium/Low code model: 64-bit addresses, programs
23429 must be linked in the low 32 bits of memory. Programs can be statically
23430 or dynamically linked.
23431
23432 @item medmid
23433 The Medium/Middle code model: 64-bit addresses, programs
23434 must be linked in the low 44 bits of memory, the text and data segments must
23435 be less than 2GB in size and the data segment must be located within 2GB of
23436 the text segment.
23437
23438 @item medany
23439 The Medium/Anywhere code model: 64-bit addresses, programs
23440 may be linked anywhere in memory, the text and data segments must be less
23441 than 2GB in size and the data segment must be located within 2GB of the
23442 text segment.
23443
23444 @item embmedany
23445 The Medium/Anywhere code model for embedded systems:
23446 64-bit addresses, the text and data segments must be less than 2GB in
23447 size, both starting anywhere in memory (determined at link time). The
23448 global register %g4 points to the base of the data segment. Programs
23449 are statically linked and PIC is not supported.
23450 @end table
23451
23452 @item -mmemory-model=@var{mem-model}
23453 @opindex mmemory-model
23454 Set the memory model in force on the processor to one of
23455
23456 @table @samp
23457 @item default
23458 The default memory model for the processor and operating system.
23459
23460 @item rmo
23461 Relaxed Memory Order
23462
23463 @item pso
23464 Partial Store Order
23465
23466 @item tso
23467 Total Store Order
23468
23469 @item sc
23470 Sequential Consistency
23471 @end table
23472
23473 These memory models are formally defined in Appendix D of the Sparc V9
23474 architecture manual, as set in the processor's @code{PSTATE.MM} field.
23475
23476 @item -mstack-bias
23477 @itemx -mno-stack-bias
23478 @opindex mstack-bias
23479 @opindex mno-stack-bias
23480 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
23481 frame pointer if present, are offset by @minus{}2047 which must be added back
23482 when making stack frame references. This is the default in 64-bit mode.
23483 Otherwise, assume no such offset is present.
23484 @end table
23485
23486 @node SPU Options
23487 @subsection SPU Options
23488 @cindex SPU options
23489
23490 These @samp{-m} options are supported on the SPU:
23491
23492 @table @gcctabopt
23493 @item -mwarn-reloc
23494 @itemx -merror-reloc
23495 @opindex mwarn-reloc
23496 @opindex merror-reloc
23497
23498 The loader for SPU does not handle dynamic relocations. By default, GCC
23499 gives an error when it generates code that requires a dynamic
23500 relocation. @option{-mno-error-reloc} disables the error,
23501 @option{-mwarn-reloc} generates a warning instead.
23502
23503 @item -msafe-dma
23504 @itemx -munsafe-dma
23505 @opindex msafe-dma
23506 @opindex munsafe-dma
23507
23508 Instructions that initiate or test completion of DMA must not be
23509 reordered with respect to loads and stores of the memory that is being
23510 accessed.
23511 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
23512 memory accesses, but that can lead to inefficient code in places where the
23513 memory is known to not change. Rather than mark the memory as volatile,
23514 you can use @option{-msafe-dma} to tell the compiler to treat
23515 the DMA instructions as potentially affecting all memory.
23516
23517 @item -mbranch-hints
23518 @opindex mbranch-hints
23519
23520 By default, GCC generates a branch hint instruction to avoid
23521 pipeline stalls for always-taken or probably-taken branches. A hint
23522 is not generated closer than 8 instructions away from its branch.
23523 There is little reason to disable them, except for debugging purposes,
23524 or to make an object a little bit smaller.
23525
23526 @item -msmall-mem
23527 @itemx -mlarge-mem
23528 @opindex msmall-mem
23529 @opindex mlarge-mem
23530
23531 By default, GCC generates code assuming that addresses are never larger
23532 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
23533 a full 32-bit address.
23534
23535 @item -mstdmain
23536 @opindex mstdmain
23537
23538 By default, GCC links against startup code that assumes the SPU-style
23539 main function interface (which has an unconventional parameter list).
23540 With @option{-mstdmain}, GCC links your program against startup
23541 code that assumes a C99-style interface to @code{main}, including a
23542 local copy of @code{argv} strings.
23543
23544 @item -mfixed-range=@var{register-range}
23545 @opindex mfixed-range
23546 Generate code treating the given register range as fixed registers.
23547 A fixed register is one that the register allocator cannot use. This is
23548 useful when compiling kernel code. A register range is specified as
23549 two registers separated by a dash. Multiple register ranges can be
23550 specified separated by a comma.
23551
23552 @item -mea32
23553 @itemx -mea64
23554 @opindex mea32
23555 @opindex mea64
23556 Compile code assuming that pointers to the PPU address space accessed
23557 via the @code{__ea} named address space qualifier are either 32 or 64
23558 bits wide. The default is 32 bits. As this is an ABI-changing option,
23559 all object code in an executable must be compiled with the same setting.
23560
23561 @item -maddress-space-conversion
23562 @itemx -mno-address-space-conversion
23563 @opindex maddress-space-conversion
23564 @opindex mno-address-space-conversion
23565 Allow/disallow treating the @code{__ea} address space as superset
23566 of the generic address space. This enables explicit type casts
23567 between @code{__ea} and generic pointer as well as implicit
23568 conversions of generic pointers to @code{__ea} pointers. The
23569 default is to allow address space pointer conversions.
23570
23571 @item -mcache-size=@var{cache-size}
23572 @opindex mcache-size
23573 This option controls the version of libgcc that the compiler links to an
23574 executable and selects a software-managed cache for accessing variables
23575 in the @code{__ea} address space with a particular cache size. Possible
23576 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
23577 and @samp{128}. The default cache size is 64KB.
23578
23579 @item -matomic-updates
23580 @itemx -mno-atomic-updates
23581 @opindex matomic-updates
23582 @opindex mno-atomic-updates
23583 This option controls the version of libgcc that the compiler links to an
23584 executable and selects whether atomic updates to the software-managed
23585 cache of PPU-side variables are used. If you use atomic updates, changes
23586 to a PPU variable from SPU code using the @code{__ea} named address space
23587 qualifier do not interfere with changes to other PPU variables residing
23588 in the same cache line from PPU code. If you do not use atomic updates,
23589 such interference may occur; however, writing back cache lines is
23590 more efficient. The default behavior is to use atomic updates.
23591
23592 @item -mdual-nops
23593 @itemx -mdual-nops=@var{n}
23594 @opindex mdual-nops
23595 By default, GCC inserts NOPs to increase dual issue when it expects
23596 it to increase performance. @var{n} can be a value from 0 to 10. A
23597 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
23598 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
23599
23600 @item -mhint-max-nops=@var{n}
23601 @opindex mhint-max-nops
23602 Maximum number of NOPs to insert for a branch hint. A branch hint must
23603 be at least 8 instructions away from the branch it is affecting. GCC
23604 inserts up to @var{n} NOPs to enforce this, otherwise it does not
23605 generate the branch hint.
23606
23607 @item -mhint-max-distance=@var{n}
23608 @opindex mhint-max-distance
23609 The encoding of the branch hint instruction limits the hint to be within
23610 256 instructions of the branch it is affecting. By default, GCC makes
23611 sure it is within 125.
23612
23613 @item -msafe-hints
23614 @opindex msafe-hints
23615 Work around a hardware bug that causes the SPU to stall indefinitely.
23616 By default, GCC inserts the @code{hbrp} instruction to make sure
23617 this stall won't happen.
23618
23619 @end table
23620
23621 @node System V Options
23622 @subsection Options for System V
23623
23624 These additional options are available on System V Release 4 for
23625 compatibility with other compilers on those systems:
23626
23627 @table @gcctabopt
23628 @item -G
23629 @opindex G
23630 Create a shared object.
23631 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
23632
23633 @item -Qy
23634 @opindex Qy
23635 Identify the versions of each tool used by the compiler, in a
23636 @code{.ident} assembler directive in the output.
23637
23638 @item -Qn
23639 @opindex Qn
23640 Refrain from adding @code{.ident} directives to the output file (this is
23641 the default).
23642
23643 @item -YP,@var{dirs}
23644 @opindex YP
23645 Search the directories @var{dirs}, and no others, for libraries
23646 specified with @option{-l}.
23647
23648 @item -Ym,@var{dir}
23649 @opindex Ym
23650 Look in the directory @var{dir} to find the M4 preprocessor.
23651 The assembler uses this option.
23652 @c This is supposed to go with a -Yd for predefined M4 macro files, but
23653 @c the generic assembler that comes with Solaris takes just -Ym.
23654 @end table
23655
23656 @node TILE-Gx Options
23657 @subsection TILE-Gx Options
23658 @cindex TILE-Gx options
23659
23660 These @samp{-m} options are supported on the TILE-Gx:
23661
23662 @table @gcctabopt
23663 @item -mcmodel=small
23664 @opindex mcmodel=small
23665 Generate code for the small model. The distance for direct calls is
23666 limited to 500M in either direction. PC-relative addresses are 32
23667 bits. Absolute addresses support the full address range.
23668
23669 @item -mcmodel=large
23670 @opindex mcmodel=large
23671 Generate code for the large model. There is no limitation on call
23672 distance, pc-relative addresses, or absolute addresses.
23673
23674 @item -mcpu=@var{name}
23675 @opindex mcpu
23676 Selects the type of CPU to be targeted. Currently the only supported
23677 type is @samp{tilegx}.
23678
23679 @item -m32
23680 @itemx -m64
23681 @opindex m32
23682 @opindex m64
23683 Generate code for a 32-bit or 64-bit environment. The 32-bit
23684 environment sets int, long, and pointer to 32 bits. The 64-bit
23685 environment sets int to 32 bits and long and pointer to 64 bits.
23686
23687 @item -mbig-endian
23688 @itemx -mlittle-endian
23689 @opindex mbig-endian
23690 @opindex mlittle-endian
23691 Generate code in big/little endian mode, respectively.
23692 @end table
23693
23694 @node TILEPro Options
23695 @subsection TILEPro Options
23696 @cindex TILEPro options
23697
23698 These @samp{-m} options are supported on the TILEPro:
23699
23700 @table @gcctabopt
23701 @item -mcpu=@var{name}
23702 @opindex mcpu
23703 Selects the type of CPU to be targeted. Currently the only supported
23704 type is @samp{tilepro}.
23705
23706 @item -m32
23707 @opindex m32
23708 Generate code for a 32-bit environment, which sets int, long, and
23709 pointer to 32 bits. This is the only supported behavior so the flag
23710 is essentially ignored.
23711 @end table
23712
23713 @node V850 Options
23714 @subsection V850 Options
23715 @cindex V850 Options
23716
23717 These @samp{-m} options are defined for V850 implementations:
23718
23719 @table @gcctabopt
23720 @item -mlong-calls
23721 @itemx -mno-long-calls
23722 @opindex mlong-calls
23723 @opindex mno-long-calls
23724 Treat all calls as being far away (near). If calls are assumed to be
23725 far away, the compiler always loads the function's address into a
23726 register, and calls indirect through the pointer.
23727
23728 @item -mno-ep
23729 @itemx -mep
23730 @opindex mno-ep
23731 @opindex mep
23732 Do not optimize (do optimize) basic blocks that use the same index
23733 pointer 4 or more times to copy pointer into the @code{ep} register, and
23734 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
23735 option is on by default if you optimize.
23736
23737 @item -mno-prolog-function
23738 @itemx -mprolog-function
23739 @opindex mno-prolog-function
23740 @opindex mprolog-function
23741 Do not use (do use) external functions to save and restore registers
23742 at the prologue and epilogue of a function. The external functions
23743 are slower, but use less code space if more than one function saves
23744 the same number of registers. The @option{-mprolog-function} option
23745 is on by default if you optimize.
23746
23747 @item -mspace
23748 @opindex mspace
23749 Try to make the code as small as possible. At present, this just turns
23750 on the @option{-mep} and @option{-mprolog-function} options.
23751
23752 @item -mtda=@var{n}
23753 @opindex mtda
23754 Put static or global variables whose size is @var{n} bytes or less into
23755 the tiny data area that register @code{ep} points to. The tiny data
23756 area can hold up to 256 bytes in total (128 bytes for byte references).
23757
23758 @item -msda=@var{n}
23759 @opindex msda
23760 Put static or global variables whose size is @var{n} bytes or less into
23761 the small data area that register @code{gp} points to. The small data
23762 area can hold up to 64 kilobytes.
23763
23764 @item -mzda=@var{n}
23765 @opindex mzda
23766 Put static or global variables whose size is @var{n} bytes or less into
23767 the first 32 kilobytes of memory.
23768
23769 @item -mv850
23770 @opindex mv850
23771 Specify that the target processor is the V850.
23772
23773 @item -mv850e3v5
23774 @opindex mv850e3v5
23775 Specify that the target processor is the V850E3V5. The preprocessor
23776 constant @code{__v850e3v5__} is defined if this option is used.
23777
23778 @item -mv850e2v4
23779 @opindex mv850e2v4
23780 Specify that the target processor is the V850E3V5. This is an alias for
23781 the @option{-mv850e3v5} option.
23782
23783 @item -mv850e2v3
23784 @opindex mv850e2v3
23785 Specify that the target processor is the V850E2V3. The preprocessor
23786 constant @code{__v850e2v3__} is defined if this option is used.
23787
23788 @item -mv850e2
23789 @opindex mv850e2
23790 Specify that the target processor is the V850E2. The preprocessor
23791 constant @code{__v850e2__} is defined if this option is used.
23792
23793 @item -mv850e1
23794 @opindex mv850e1
23795 Specify that the target processor is the V850E1. The preprocessor
23796 constants @code{__v850e1__} and @code{__v850e__} are defined if
23797 this option is used.
23798
23799 @item -mv850es
23800 @opindex mv850es
23801 Specify that the target processor is the V850ES. This is an alias for
23802 the @option{-mv850e1} option.
23803
23804 @item -mv850e
23805 @opindex mv850e
23806 Specify that the target processor is the V850E@. The preprocessor
23807 constant @code{__v850e__} is defined if this option is used.
23808
23809 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
23810 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
23811 are defined then a default target processor is chosen and the
23812 relevant @samp{__v850*__} preprocessor constant is defined.
23813
23814 The preprocessor constants @code{__v850} and @code{__v851__} are always
23815 defined, regardless of which processor variant is the target.
23816
23817 @item -mdisable-callt
23818 @itemx -mno-disable-callt
23819 @opindex mdisable-callt
23820 @opindex mno-disable-callt
23821 This option suppresses generation of the @code{CALLT} instruction for the
23822 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
23823 architecture.
23824
23825 This option is enabled by default when the RH850 ABI is
23826 in use (see @option{-mrh850-abi}), and disabled by default when the
23827 GCC ABI is in use. If @code{CALLT} instructions are being generated
23828 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
23829
23830 @item -mrelax
23831 @itemx -mno-relax
23832 @opindex mrelax
23833 @opindex mno-relax
23834 Pass on (or do not pass on) the @option{-mrelax} command-line option
23835 to the assembler.
23836
23837 @item -mlong-jumps
23838 @itemx -mno-long-jumps
23839 @opindex mlong-jumps
23840 @opindex mno-long-jumps
23841 Disable (or re-enable) the generation of PC-relative jump instructions.
23842
23843 @item -msoft-float
23844 @itemx -mhard-float
23845 @opindex msoft-float
23846 @opindex mhard-float
23847 Disable (or re-enable) the generation of hardware floating point
23848 instructions. This option is only significant when the target
23849 architecture is @samp{V850E2V3} or higher. If hardware floating point
23850 instructions are being generated then the C preprocessor symbol
23851 @code{__FPU_OK__} is defined, otherwise the symbol
23852 @code{__NO_FPU__} is defined.
23853
23854 @item -mloop
23855 @opindex mloop
23856 Enables the use of the e3v5 LOOP instruction. The use of this
23857 instruction is not enabled by default when the e3v5 architecture is
23858 selected because its use is still experimental.
23859
23860 @item -mrh850-abi
23861 @itemx -mghs
23862 @opindex mrh850-abi
23863 @opindex mghs
23864 Enables support for the RH850 version of the V850 ABI. This is the
23865 default. With this version of the ABI the following rules apply:
23866
23867 @itemize
23868 @item
23869 Integer sized structures and unions are returned via a memory pointer
23870 rather than a register.
23871
23872 @item
23873 Large structures and unions (more than 8 bytes in size) are passed by
23874 value.
23875
23876 @item
23877 Functions are aligned to 16-bit boundaries.
23878
23879 @item
23880 The @option{-m8byte-align} command-line option is supported.
23881
23882 @item
23883 The @option{-mdisable-callt} command-line option is enabled by
23884 default. The @option{-mno-disable-callt} command-line option is not
23885 supported.
23886 @end itemize
23887
23888 When this version of the ABI is enabled the C preprocessor symbol
23889 @code{__V850_RH850_ABI__} is defined.
23890
23891 @item -mgcc-abi
23892 @opindex mgcc-abi
23893 Enables support for the old GCC version of the V850 ABI. With this
23894 version of the ABI the following rules apply:
23895
23896 @itemize
23897 @item
23898 Integer sized structures and unions are returned in register @code{r10}.
23899
23900 @item
23901 Large structures and unions (more than 8 bytes in size) are passed by
23902 reference.
23903
23904 @item
23905 Functions are aligned to 32-bit boundaries, unless optimizing for
23906 size.
23907
23908 @item
23909 The @option{-m8byte-align} command-line option is not supported.
23910
23911 @item
23912 The @option{-mdisable-callt} command-line option is supported but not
23913 enabled by default.
23914 @end itemize
23915
23916 When this version of the ABI is enabled the C preprocessor symbol
23917 @code{__V850_GCC_ABI__} is defined.
23918
23919 @item -m8byte-align
23920 @itemx -mno-8byte-align
23921 @opindex m8byte-align
23922 @opindex mno-8byte-align
23923 Enables support for @code{double} and @code{long long} types to be
23924 aligned on 8-byte boundaries. The default is to restrict the
23925 alignment of all objects to at most 4-bytes. When
23926 @option{-m8byte-align} is in effect the C preprocessor symbol
23927 @code{__V850_8BYTE_ALIGN__} is defined.
23928
23929 @item -mbig-switch
23930 @opindex mbig-switch
23931 Generate code suitable for big switch tables. Use this option only if
23932 the assembler/linker complain about out of range branches within a switch
23933 table.
23934
23935 @item -mapp-regs
23936 @opindex mapp-regs
23937 This option causes r2 and r5 to be used in the code generated by
23938 the compiler. This setting is the default.
23939
23940 @item -mno-app-regs
23941 @opindex mno-app-regs
23942 This option causes r2 and r5 to be treated as fixed registers.
23943
23944 @end table
23945
23946 @node VAX Options
23947 @subsection VAX Options
23948 @cindex VAX options
23949
23950 These @samp{-m} options are defined for the VAX:
23951
23952 @table @gcctabopt
23953 @item -munix
23954 @opindex munix
23955 Do not output certain jump instructions (@code{aobleq} and so on)
23956 that the Unix assembler for the VAX cannot handle across long
23957 ranges.
23958
23959 @item -mgnu
23960 @opindex mgnu
23961 Do output those jump instructions, on the assumption that the
23962 GNU assembler is being used.
23963
23964 @item -mg
23965 @opindex mg
23966 Output code for G-format floating-point numbers instead of D-format.
23967 @end table
23968
23969 @node Visium Options
23970 @subsection Visium Options
23971 @cindex Visium options
23972
23973 @table @gcctabopt
23974
23975 @item -mdebug
23976 @opindex mdebug
23977 A program which performs file I/O and is destined to run on an MCM target
23978 should be linked with this option. It causes the libraries libc.a and
23979 libdebug.a to be linked. The program should be run on the target under
23980 the control of the GDB remote debugging stub.
23981
23982 @item -msim
23983 @opindex msim
23984 A program which performs file I/O and is destined to run on the simulator
23985 should be linked with option. This causes libraries libc.a and libsim.a to
23986 be linked.
23987
23988 @item -mfpu
23989 @itemx -mhard-float
23990 @opindex mfpu
23991 @opindex mhard-float
23992 Generate code containing floating-point instructions. This is the
23993 default.
23994
23995 @item -mno-fpu
23996 @itemx -msoft-float
23997 @opindex mno-fpu
23998 @opindex msoft-float
23999 Generate code containing library calls for floating-point.
24000
24001 @option{-msoft-float} changes the calling convention in the output file;
24002 therefore, it is only useful if you compile @emph{all} of a program with
24003 this option. In particular, you need to compile @file{libgcc.a}, the
24004 library that comes with GCC, with @option{-msoft-float} in order for
24005 this to work.
24006
24007 @item -mcpu=@var{cpu_type}
24008 @opindex mcpu
24009 Set the instruction set, register set, and instruction scheduling parameters
24010 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
24011 @samp{mcm}, @samp{gr5} and @samp{gr6}.
24012
24013 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
24014
24015 By default (unless configured otherwise), GCC generates code for the GR5
24016 variant of the Visium architecture.
24017
24018 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
24019 architecture. The only difference from GR5 code is that the compiler will
24020 generate block move instructions.
24021
24022 @item -mtune=@var{cpu_type}
24023 @opindex mtune
24024 Set the instruction scheduling parameters for machine type @var{cpu_type},
24025 but do not set the instruction set or register set that the option
24026 @option{-mcpu=@var{cpu_type}} would.
24027
24028 @item -msv-mode
24029 @opindex msv-mode
24030 Generate code for the supervisor mode, where there are no restrictions on
24031 the access to general registers. This is the default.
24032
24033 @item -muser-mode
24034 @opindex muser-mode
24035 Generate code for the user mode, where the access to some general registers
24036 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
24037 mode; on the GR6, only registers r29 to r31 are affected.
24038 @end table
24039
24040 @node VMS Options
24041 @subsection VMS Options
24042
24043 These @samp{-m} options are defined for the VMS implementations:
24044
24045 @table @gcctabopt
24046 @item -mvms-return-codes
24047 @opindex mvms-return-codes
24048 Return VMS condition codes from @code{main}. The default is to return POSIX-style
24049 condition (e.g.@ error) codes.
24050
24051 @item -mdebug-main=@var{prefix}
24052 @opindex mdebug-main=@var{prefix}
24053 Flag the first routine whose name starts with @var{prefix} as the main
24054 routine for the debugger.
24055
24056 @item -mmalloc64
24057 @opindex mmalloc64
24058 Default to 64-bit memory allocation routines.
24059
24060 @item -mpointer-size=@var{size}
24061 @opindex mpointer-size=@var{size}
24062 Set the default size of pointers. Possible options for @var{size} are
24063 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
24064 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
24065 The later option disables @code{pragma pointer_size}.
24066 @end table
24067
24068 @node VxWorks Options
24069 @subsection VxWorks Options
24070 @cindex VxWorks Options
24071
24072 The options in this section are defined for all VxWorks targets.
24073 Options specific to the target hardware are listed with the other
24074 options for that target.
24075
24076 @table @gcctabopt
24077 @item -mrtp
24078 @opindex mrtp
24079 GCC can generate code for both VxWorks kernels and real time processes
24080 (RTPs). This option switches from the former to the latter. It also
24081 defines the preprocessor macro @code{__RTP__}.
24082
24083 @item -non-static
24084 @opindex non-static
24085 Link an RTP executable against shared libraries rather than static
24086 libraries. The options @option{-static} and @option{-shared} can
24087 also be used for RTPs (@pxref{Link Options}); @option{-static}
24088 is the default.
24089
24090 @item -Bstatic
24091 @itemx -Bdynamic
24092 @opindex Bstatic
24093 @opindex Bdynamic
24094 These options are passed down to the linker. They are defined for
24095 compatibility with Diab.
24096
24097 @item -Xbind-lazy
24098 @opindex Xbind-lazy
24099 Enable lazy binding of function calls. This option is equivalent to
24100 @option{-Wl,-z,now} and is defined for compatibility with Diab.
24101
24102 @item -Xbind-now
24103 @opindex Xbind-now
24104 Disable lazy binding of function calls. This option is the default and
24105 is defined for compatibility with Diab.
24106 @end table
24107
24108 @node x86 Options
24109 @subsection x86 Options
24110 @cindex x86 Options
24111
24112 These @samp{-m} options are defined for the x86 family of computers.
24113
24114 @table @gcctabopt
24115
24116 @item -march=@var{cpu-type}
24117 @opindex march
24118 Generate instructions for the machine type @var{cpu-type}. In contrast to
24119 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
24120 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
24121 to generate code that may not run at all on processors other than the one
24122 indicated. Specifying @option{-march=@var{cpu-type}} implies
24123 @option{-mtune=@var{cpu-type}}.
24124
24125 The choices for @var{cpu-type} are:
24126
24127 @table @samp
24128 @item native
24129 This selects the CPU to generate code for at compilation time by determining
24130 the processor type of the compiling machine. Using @option{-march=native}
24131 enables all instruction subsets supported by the local machine (hence
24132 the result might not run on different machines). Using @option{-mtune=native}
24133 produces code optimized for the local machine under the constraints
24134 of the selected instruction set.
24135
24136 @item i386
24137 Original Intel i386 CPU@.
24138
24139 @item i486
24140 Intel i486 CPU@. (No scheduling is implemented for this chip.)
24141
24142 @item i586
24143 @itemx pentium
24144 Intel Pentium CPU with no MMX support.
24145
24146 @item lakemont
24147 Intel Lakemont MCU, based on Intel Pentium CPU.
24148
24149 @item pentium-mmx
24150 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
24151
24152 @item pentiumpro
24153 Intel Pentium Pro CPU@.
24154
24155 @item i686
24156 When used with @option{-march}, the Pentium Pro
24157 instruction set is used, so the code runs on all i686 family chips.
24158 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
24159
24160 @item pentium2
24161 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
24162 support.
24163
24164 @item pentium3
24165 @itemx pentium3m
24166 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
24167 set support.
24168
24169 @item pentium-m
24170 Intel Pentium M; low-power version of Intel Pentium III CPU
24171 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
24172
24173 @item pentium4
24174 @itemx pentium4m
24175 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
24176
24177 @item prescott
24178 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
24179 set support.
24180
24181 @item nocona
24182 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
24183 SSE2 and SSE3 instruction set support.
24184
24185 @item core2
24186 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
24187 instruction set support.
24188
24189 @item nehalem
24190 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24191 SSE4.1, SSE4.2 and POPCNT instruction set support.
24192
24193 @item westmere
24194 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24195 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
24196
24197 @item sandybridge
24198 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24199 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
24200
24201 @item ivybridge
24202 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24203 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
24204 instruction set support.
24205
24206 @item haswell
24207 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24208 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24209 BMI, BMI2 and F16C instruction set support.
24210
24211 @item broadwell
24212 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24213 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24214 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
24215
24216 @item skylake
24217 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24218 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24219 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
24220 XSAVES instruction set support.
24221
24222 @item bonnell
24223 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
24224 instruction set support.
24225
24226 @item silvermont
24227 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24228 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
24229
24230 @item knl
24231 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
24232 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24233 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
24234 AVX512CD instruction set support.
24235
24236 @item skylake-avx512
24237 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
24238 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24239 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
24240 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
24241
24242 @item k6
24243 AMD K6 CPU with MMX instruction set support.
24244
24245 @item k6-2
24246 @itemx k6-3
24247 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
24248
24249 @item athlon
24250 @itemx athlon-tbird
24251 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
24252 support.
24253
24254 @item athlon-4
24255 @itemx athlon-xp
24256 @itemx athlon-mp
24257 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
24258 instruction set support.
24259
24260 @item k8
24261 @itemx opteron
24262 @itemx athlon64
24263 @itemx athlon-fx
24264 Processors based on the AMD K8 core with x86-64 instruction set support,
24265 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
24266 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
24267 instruction set extensions.)
24268
24269 @item k8-sse3
24270 @itemx opteron-sse3
24271 @itemx athlon64-sse3
24272 Improved versions of AMD K8 cores with SSE3 instruction set support.
24273
24274 @item amdfam10
24275 @itemx barcelona
24276 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
24277 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
24278 instruction set extensions.)
24279
24280 @item bdver1
24281 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
24282 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
24283 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
24284 @item bdver2
24285 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
24286 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
24287 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
24288 extensions.)
24289 @item bdver3
24290 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
24291 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
24292 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
24293 64-bit instruction set extensions.
24294 @item bdver4
24295 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
24296 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
24297 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
24298 SSE4.2, ABM and 64-bit instruction set extensions.
24299
24300 @item znver1
24301 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
24302 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
24303 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
24304 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
24305 instruction set extensions.
24306
24307 @item btver1
24308 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
24309 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
24310 instruction set extensions.)
24311
24312 @item btver2
24313 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
24314 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
24315 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
24316
24317 @item winchip-c6
24318 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
24319 set support.
24320
24321 @item winchip2
24322 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
24323 instruction set support.
24324
24325 @item c3
24326 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
24327 (No scheduling is implemented for this chip.)
24328
24329 @item c3-2
24330 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
24331 (No scheduling is implemented for this chip.)
24332
24333 @item c7
24334 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
24335 (No scheduling is implemented for this chip.)
24336
24337 @item samuel-2
24338 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
24339 (No scheduling is implemented for this chip.)
24340
24341 @item nehemiah
24342 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
24343 (No scheduling is implemented for this chip.)
24344
24345 @item esther
24346 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
24347 (No scheduling is implemented for this chip.)
24348
24349 @item eden-x2
24350 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
24351 (No scheduling is implemented for this chip.)
24352
24353 @item eden-x4
24354 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
24355 AVX and AVX2 instruction set support.
24356 (No scheduling is implemented for this chip.)
24357
24358 @item nano
24359 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24360 instruction set support.
24361 (No scheduling is implemented for this chip.)
24362
24363 @item nano-1000
24364 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24365 instruction set support.
24366 (No scheduling is implemented for this chip.)
24367
24368 @item nano-2000
24369 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24370 instruction set support.
24371 (No scheduling is implemented for this chip.)
24372
24373 @item nano-3000
24374 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
24375 instruction set support.
24376 (No scheduling is implemented for this chip.)
24377
24378 @item nano-x2
24379 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
24380 instruction set support.
24381 (No scheduling is implemented for this chip.)
24382
24383 @item nano-x4
24384 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
24385 instruction set support.
24386 (No scheduling is implemented for this chip.)
24387
24388 @item geode
24389 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
24390 @end table
24391
24392 @item -mtune=@var{cpu-type}
24393 @opindex mtune
24394 Tune to @var{cpu-type} everything applicable about the generated code, except
24395 for the ABI and the set of available instructions.
24396 While picking a specific @var{cpu-type} schedules things appropriately
24397 for that particular chip, the compiler does not generate any code that
24398 cannot run on the default machine type unless you use a
24399 @option{-march=@var{cpu-type}} option.
24400 For example, if GCC is configured for i686-pc-linux-gnu
24401 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
24402 but still runs on i686 machines.
24403
24404 The choices for @var{cpu-type} are the same as for @option{-march}.
24405 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
24406
24407 @table @samp
24408 @item generic
24409 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
24410 If you know the CPU on which your code will run, then you should use
24411 the corresponding @option{-mtune} or @option{-march} option instead of
24412 @option{-mtune=generic}. But, if you do not know exactly what CPU users
24413 of your application will have, then you should use this option.
24414
24415 As new processors are deployed in the marketplace, the behavior of this
24416 option will change. Therefore, if you upgrade to a newer version of
24417 GCC, code generation controlled by this option will change to reflect
24418 the processors
24419 that are most common at the time that version of GCC is released.
24420
24421 There is no @option{-march=generic} option because @option{-march}
24422 indicates the instruction set the compiler can use, and there is no
24423 generic instruction set applicable to all processors. In contrast,
24424 @option{-mtune} indicates the processor (or, in this case, collection of
24425 processors) for which the code is optimized.
24426
24427 @item intel
24428 Produce code optimized for the most current Intel processors, which are
24429 Haswell and Silvermont for this version of GCC. If you know the CPU
24430 on which your code will run, then you should use the corresponding
24431 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
24432 But, if you want your application performs better on both Haswell and
24433 Silvermont, then you should use this option.
24434
24435 As new Intel processors are deployed in the marketplace, the behavior of
24436 this option will change. Therefore, if you upgrade to a newer version of
24437 GCC, code generation controlled by this option will change to reflect
24438 the most current Intel processors at the time that version of GCC is
24439 released.
24440
24441 There is no @option{-march=intel} option because @option{-march} indicates
24442 the instruction set the compiler can use, and there is no common
24443 instruction set applicable to all processors. In contrast,
24444 @option{-mtune} indicates the processor (or, in this case, collection of
24445 processors) for which the code is optimized.
24446 @end table
24447
24448 @item -mcpu=@var{cpu-type}
24449 @opindex mcpu
24450 A deprecated synonym for @option{-mtune}.
24451
24452 @item -mfpmath=@var{unit}
24453 @opindex mfpmath
24454 Generate floating-point arithmetic for selected unit @var{unit}. The choices
24455 for @var{unit} are:
24456
24457 @table @samp
24458 @item 387
24459 Use the standard 387 floating-point coprocessor present on the majority of chips and
24460 emulated otherwise. Code compiled with this option runs almost everywhere.
24461 The temporary results are computed in 80-bit precision instead of the precision
24462 specified by the type, resulting in slightly different results compared to most
24463 of other chips. See @option{-ffloat-store} for more detailed description.
24464
24465 This is the default choice for x86-32 targets.
24466
24467 @item sse
24468 Use scalar floating-point instructions present in the SSE instruction set.
24469 This instruction set is supported by Pentium III and newer chips,
24470 and in the AMD line
24471 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
24472 instruction set supports only single-precision arithmetic, thus the double and
24473 extended-precision arithmetic are still done using 387. A later version, present
24474 only in Pentium 4 and AMD x86-64 chips, supports double-precision
24475 arithmetic too.
24476
24477 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
24478 or @option{-msse2} switches to enable SSE extensions and make this option
24479 effective. For the x86-64 compiler, these extensions are enabled by default.
24480
24481 The resulting code should be considerably faster in the majority of cases and avoid
24482 the numerical instability problems of 387 code, but may break some existing
24483 code that expects temporaries to be 80 bits.
24484
24485 This is the default choice for the x86-64 compiler.
24486
24487 @item sse,387
24488 @itemx sse+387
24489 @itemx both
24490 Attempt to utilize both instruction sets at once. This effectively doubles the
24491 amount of available registers, and on chips with separate execution units for
24492 387 and SSE the execution resources too. Use this option with care, as it is
24493 still experimental, because the GCC register allocator does not model separate
24494 functional units well, resulting in unstable performance.
24495 @end table
24496
24497 @item -masm=@var{dialect}
24498 @opindex masm=@var{dialect}
24499 Output assembly instructions using selected @var{dialect}. Also affects
24500 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
24501 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
24502 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
24503 not support @samp{intel}.
24504
24505 @item -mieee-fp
24506 @itemx -mno-ieee-fp
24507 @opindex mieee-fp
24508 @opindex mno-ieee-fp
24509 Control whether or not the compiler uses IEEE floating-point
24510 comparisons. These correctly handle the case where the result of a
24511 comparison is unordered.
24512
24513 @item -m80387
24514 @item -mhard-float
24515 @opindex 80387
24516 @opindex mhard-float
24517 Generate output containing 80387 instructions for floating point.
24518
24519 @item -mno-80387
24520 @item -msoft-float
24521 @opindex no-80387
24522 @opindex msoft-float
24523 Generate output containing library calls for floating point.
24524
24525 @strong{Warning:} the requisite libraries are not part of GCC@.
24526 Normally the facilities of the machine's usual C compiler are used, but
24527 this can't be done directly in cross-compilation. You must make your
24528 own arrangements to provide suitable library functions for
24529 cross-compilation.
24530
24531 On machines where a function returns floating-point results in the 80387
24532 register stack, some floating-point opcodes may be emitted even if
24533 @option{-msoft-float} is used.
24534
24535 @item -mno-fp-ret-in-387
24536 @opindex mno-fp-ret-in-387
24537 Do not use the FPU registers for return values of functions.
24538
24539 The usual calling convention has functions return values of types
24540 @code{float} and @code{double} in an FPU register, even if there
24541 is no FPU@. The idea is that the operating system should emulate
24542 an FPU@.
24543
24544 The option @option{-mno-fp-ret-in-387} causes such values to be returned
24545 in ordinary CPU registers instead.
24546
24547 @item -mno-fancy-math-387
24548 @opindex mno-fancy-math-387
24549 Some 387 emulators do not support the @code{sin}, @code{cos} and
24550 @code{sqrt} instructions for the 387. Specify this option to avoid
24551 generating those instructions. This option is the default on
24552 OpenBSD and NetBSD@. This option is overridden when @option{-march}
24553 indicates that the target CPU always has an FPU and so the
24554 instruction does not need emulation. These
24555 instructions are not generated unless you also use the
24556 @option{-funsafe-math-optimizations} switch.
24557
24558 @item -malign-double
24559 @itemx -mno-align-double
24560 @opindex malign-double
24561 @opindex mno-align-double
24562 Control whether GCC aligns @code{double}, @code{long double}, and
24563 @code{long long} variables on a two-word boundary or a one-word
24564 boundary. Aligning @code{double} variables on a two-word boundary
24565 produces code that runs somewhat faster on a Pentium at the
24566 expense of more memory.
24567
24568 On x86-64, @option{-malign-double} is enabled by default.
24569
24570 @strong{Warning:} if you use the @option{-malign-double} switch,
24571 structures containing the above types are aligned differently than
24572 the published application binary interface specifications for the x86-32
24573 and are not binary compatible with structures in code compiled
24574 without that switch.
24575
24576 @item -m96bit-long-double
24577 @itemx -m128bit-long-double
24578 @opindex m96bit-long-double
24579 @opindex m128bit-long-double
24580 These switches control the size of @code{long double} type. The x86-32
24581 application binary interface specifies the size to be 96 bits,
24582 so @option{-m96bit-long-double} is the default in 32-bit mode.
24583
24584 Modern architectures (Pentium and newer) prefer @code{long double}
24585 to be aligned to an 8- or 16-byte boundary. In arrays or structures
24586 conforming to the ABI, this is not possible. So specifying
24587 @option{-m128bit-long-double} aligns @code{long double}
24588 to a 16-byte boundary by padding the @code{long double} with an additional
24589 32-bit zero.
24590
24591 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
24592 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
24593
24594 Notice that neither of these options enable any extra precision over the x87
24595 standard of 80 bits for a @code{long double}.
24596
24597 @strong{Warning:} if you override the default value for your target ABI, this
24598 changes the size of
24599 structures and arrays containing @code{long double} variables,
24600 as well as modifying the function calling convention for functions taking
24601 @code{long double}. Hence they are not binary-compatible
24602 with code compiled without that switch.
24603
24604 @item -mlong-double-64
24605 @itemx -mlong-double-80
24606 @itemx -mlong-double-128
24607 @opindex mlong-double-64
24608 @opindex mlong-double-80
24609 @opindex mlong-double-128
24610 These switches control the size of @code{long double} type. A size
24611 of 64 bits makes the @code{long double} type equivalent to the @code{double}
24612 type. This is the default for 32-bit Bionic C library. A size
24613 of 128 bits makes the @code{long double} type equivalent to the
24614 @code{__float128} type. This is the default for 64-bit Bionic C library.
24615
24616 @strong{Warning:} if you override the default value for your target ABI, this
24617 changes the size of
24618 structures and arrays containing @code{long double} variables,
24619 as well as modifying the function calling convention for functions taking
24620 @code{long double}. Hence they are not binary-compatible
24621 with code compiled without that switch.
24622
24623 @item -malign-data=@var{type}
24624 @opindex malign-data
24625 Control how GCC aligns variables. Supported values for @var{type} are
24626 @samp{compat} uses increased alignment value compatible uses GCC 4.8
24627 and earlier, @samp{abi} uses alignment value as specified by the
24628 psABI, and @samp{cacheline} uses increased alignment value to match
24629 the cache line size. @samp{compat} is the default.
24630
24631 @item -mlarge-data-threshold=@var{threshold}
24632 @opindex mlarge-data-threshold
24633 When @option{-mcmodel=medium} is specified, data objects larger than
24634 @var{threshold} are placed in the large data section. This value must be the
24635 same across all objects linked into the binary, and defaults to 65535.
24636
24637 @item -mrtd
24638 @opindex mrtd
24639 Use a different function-calling convention, in which functions that
24640 take a fixed number of arguments return with the @code{ret @var{num}}
24641 instruction, which pops their arguments while returning. This saves one
24642 instruction in the caller since there is no need to pop the arguments
24643 there.
24644
24645 You can specify that an individual function is called with this calling
24646 sequence with the function attribute @code{stdcall}. You can also
24647 override the @option{-mrtd} option by using the function attribute
24648 @code{cdecl}. @xref{Function Attributes}.
24649
24650 @strong{Warning:} this calling convention is incompatible with the one
24651 normally used on Unix, so you cannot use it if you need to call
24652 libraries compiled with the Unix compiler.
24653
24654 Also, you must provide function prototypes for all functions that
24655 take variable numbers of arguments (including @code{printf});
24656 otherwise incorrect code is generated for calls to those
24657 functions.
24658
24659 In addition, seriously incorrect code results if you call a
24660 function with too many arguments. (Normally, extra arguments are
24661 harmlessly ignored.)
24662
24663 @item -mregparm=@var{num}
24664 @opindex mregparm
24665 Control how many registers are used to pass integer arguments. By
24666 default, no registers are used to pass arguments, and at most 3
24667 registers can be used. You can control this behavior for a specific
24668 function by using the function attribute @code{regparm}.
24669 @xref{Function Attributes}.
24670
24671 @strong{Warning:} if you use this switch, and
24672 @var{num} is nonzero, then you must build all modules with the same
24673 value, including any libraries. This includes the system libraries and
24674 startup modules.
24675
24676 @item -msseregparm
24677 @opindex msseregparm
24678 Use SSE register passing conventions for float and double arguments
24679 and return values. You can control this behavior for a specific
24680 function by using the function attribute @code{sseregparm}.
24681 @xref{Function Attributes}.
24682
24683 @strong{Warning:} if you use this switch then you must build all
24684 modules with the same value, including any libraries. This includes
24685 the system libraries and startup modules.
24686
24687 @item -mvect8-ret-in-mem
24688 @opindex mvect8-ret-in-mem
24689 Return 8-byte vectors in memory instead of MMX registers. This is the
24690 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
24691 Studio compilers until version 12. Later compiler versions (starting
24692 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
24693 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
24694 you need to remain compatible with existing code produced by those
24695 previous compiler versions or older versions of GCC@.
24696
24697 @item -mpc32
24698 @itemx -mpc64
24699 @itemx -mpc80
24700 @opindex mpc32
24701 @opindex mpc64
24702 @opindex mpc80
24703
24704 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
24705 is specified, the significands of results of floating-point operations are
24706 rounded to 24 bits (single precision); @option{-mpc64} rounds the
24707 significands of results of floating-point operations to 53 bits (double
24708 precision) and @option{-mpc80} rounds the significands of results of
24709 floating-point operations to 64 bits (extended double precision), which is
24710 the default. When this option is used, floating-point operations in higher
24711 precisions are not available to the programmer without setting the FPU
24712 control word explicitly.
24713
24714 Setting the rounding of floating-point operations to less than the default
24715 80 bits can speed some programs by 2% or more. Note that some mathematical
24716 libraries assume that extended-precision (80-bit) floating-point operations
24717 are enabled by default; routines in such libraries could suffer significant
24718 loss of accuracy, typically through so-called ``catastrophic cancellation'',
24719 when this option is used to set the precision to less than extended precision.
24720
24721 @item -mstackrealign
24722 @opindex mstackrealign
24723 Realign the stack at entry. On the x86, the @option{-mstackrealign}
24724 option generates an alternate prologue and epilogue that realigns the
24725 run-time stack if necessary. This supports mixing legacy codes that keep
24726 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
24727 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
24728 applicable to individual functions.
24729
24730 @item -mpreferred-stack-boundary=@var{num}
24731 @opindex mpreferred-stack-boundary
24732 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24733 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24734 the default is 4 (16 bytes or 128 bits).
24735
24736 @strong{Warning:} When generating code for the x86-64 architecture with
24737 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
24738 used to keep the stack boundary aligned to 8 byte boundary. Since
24739 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
24740 intended to be used in controlled environment where stack space is
24741 important limitation. This option leads to wrong code when functions
24742 compiled with 16 byte stack alignment (such as functions from a standard
24743 library) are called with misaligned stack. In this case, SSE
24744 instructions may lead to misaligned memory access traps. In addition,
24745 variable arguments are handled incorrectly for 16 byte aligned
24746 objects (including x87 long double and __int128), leading to wrong
24747 results. You must build all modules with
24748 @option{-mpreferred-stack-boundary=3}, including any libraries. This
24749 includes the system libraries and startup modules.
24750
24751 @item -mincoming-stack-boundary=@var{num}
24752 @opindex mincoming-stack-boundary
24753 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
24754 boundary. If @option{-mincoming-stack-boundary} is not specified,
24755 the one specified by @option{-mpreferred-stack-boundary} is used.
24756
24757 On Pentium and Pentium Pro, @code{double} and @code{long double} values
24758 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
24759 suffer significant run time performance penalties. On Pentium III, the
24760 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
24761 properly if it is not 16-byte aligned.
24762
24763 To ensure proper alignment of this values on the stack, the stack boundary
24764 must be as aligned as that required by any value stored on the stack.
24765 Further, every function must be generated such that it keeps the stack
24766 aligned. Thus calling a function compiled with a higher preferred
24767 stack boundary from a function compiled with a lower preferred stack
24768 boundary most likely misaligns the stack. It is recommended that
24769 libraries that use callbacks always use the default setting.
24770
24771 This extra alignment does consume extra stack space, and generally
24772 increases code size. Code that is sensitive to stack space usage, such
24773 as embedded systems and operating system kernels, may want to reduce the
24774 preferred alignment to @option{-mpreferred-stack-boundary=2}.
24775
24776 @need 200
24777 @item -mmmx
24778 @opindex mmmx
24779 @need 200
24780 @itemx -msse
24781 @opindex msse
24782 @need 200
24783 @itemx -msse2
24784 @opindex msse2
24785 @need 200
24786 @itemx -msse3
24787 @opindex msse3
24788 @need 200
24789 @itemx -mssse3
24790 @opindex mssse3
24791 @need 200
24792 @itemx -msse4
24793 @opindex msse4
24794 @need 200
24795 @itemx -msse4a
24796 @opindex msse4a
24797 @need 200
24798 @itemx -msse4.1
24799 @opindex msse4.1
24800 @need 200
24801 @itemx -msse4.2
24802 @opindex msse4.2
24803 @need 200
24804 @itemx -mavx
24805 @opindex mavx
24806 @need 200
24807 @itemx -mavx2
24808 @opindex mavx2
24809 @need 200
24810 @itemx -mavx512f
24811 @opindex mavx512f
24812 @need 200
24813 @itemx -mavx512pf
24814 @opindex mavx512pf
24815 @need 200
24816 @itemx -mavx512er
24817 @opindex mavx512er
24818 @need 200
24819 @itemx -mavx512cd
24820 @opindex mavx512cd
24821 @need 200
24822 @itemx -mavx512vl
24823 @opindex mavx512vl
24824 @need 200
24825 @itemx -mavx512bw
24826 @opindex mavx512bw
24827 @need 200
24828 @itemx -mavx512dq
24829 @opindex mavx512dq
24830 @need 200
24831 @itemx -mavx512ifma
24832 @opindex mavx512ifma
24833 @need 200
24834 @itemx -mavx512vbmi
24835 @opindex mavx512vbmi
24836 @need 200
24837 @itemx -msha
24838 @opindex msha
24839 @need 200
24840 @itemx -maes
24841 @opindex maes
24842 @need 200
24843 @itemx -mpclmul
24844 @opindex mpclmul
24845 @need 200
24846 @itemx -mclfushopt
24847 @opindex mclfushopt
24848 @need 200
24849 @itemx -mfsgsbase
24850 @opindex mfsgsbase
24851 @need 200
24852 @itemx -mrdrnd
24853 @opindex mrdrnd
24854 @need 200
24855 @itemx -mf16c
24856 @opindex mf16c
24857 @need 200
24858 @itemx -mfma
24859 @opindex mfma
24860 @need 200
24861 @itemx -mfma4
24862 @opindex mfma4
24863 @need 200
24864 @itemx -mprefetchwt1
24865 @opindex mprefetchwt1
24866 @need 200
24867 @itemx -mxop
24868 @opindex mxop
24869 @need 200
24870 @itemx -mlwp
24871 @opindex mlwp
24872 @need 200
24873 @itemx -m3dnow
24874 @opindex m3dnow
24875 @need 200
24876 @itemx -mpopcnt
24877 @opindex mpopcnt
24878 @need 200
24879 @itemx -mabm
24880 @opindex mabm
24881 @need 200
24882 @itemx -mbmi
24883 @opindex mbmi
24884 @need 200
24885 @itemx -mbmi2
24886 @need 200
24887 @itemx -mlzcnt
24888 @opindex mlzcnt
24889 @need 200
24890 @itemx -mfxsr
24891 @opindex mfxsr
24892 @need 200
24893 @itemx -mxsave
24894 @opindex mxsave
24895 @need 200
24896 @itemx -mxsaveopt
24897 @opindex mxsaveopt
24898 @need 200
24899 @itemx -mxsavec
24900 @opindex mxsavec
24901 @need 200
24902 @itemx -mxsaves
24903 @opindex mxsaves
24904 @need 200
24905 @itemx -mrtm
24906 @opindex mrtm
24907 @need 200
24908 @itemx -mtbm
24909 @opindex mtbm
24910 @need 200
24911 @itemx -mmpx
24912 @opindex mmpx
24913 @need 200
24914 @itemx -mmwaitx
24915 @opindex mmwaitx
24916 @need 200
24917 @itemx -mclzero
24918 @opindex mclzero
24919 @itemx -mpku
24920 @opindex mpku
24921 These switches enable the use of instructions in the MMX, SSE,
24922 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
24923 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
24924 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
24925 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU or 3DNow!@:
24926 extended instruction sets. Each has a corresponding @option{-mno-} option
24927 to disable use of these instructions.
24928
24929 These extensions are also available as built-in functions: see
24930 @ref{x86 Built-in Functions}, for details of the functions enabled and
24931 disabled by these switches.
24932
24933 To generate SSE/SSE2 instructions automatically from floating-point
24934 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
24935
24936 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
24937 generates new AVX instructions or AVX equivalence for all SSEx instructions
24938 when needed.
24939
24940 These options enable GCC to use these extended instructions in
24941 generated code, even without @option{-mfpmath=sse}. Applications that
24942 perform run-time CPU detection must compile separate files for each
24943 supported architecture, using the appropriate flags. In particular,
24944 the file containing the CPU detection code should be compiled without
24945 these options.
24946
24947 @item -mdump-tune-features
24948 @opindex mdump-tune-features
24949 This option instructs GCC to dump the names of the x86 performance
24950 tuning features and default settings. The names can be used in
24951 @option{-mtune-ctrl=@var{feature-list}}.
24952
24953 @item -mtune-ctrl=@var{feature-list}
24954 @opindex mtune-ctrl=@var{feature-list}
24955 This option is used to do fine grain control of x86 code generation features.
24956 @var{feature-list} is a comma separated list of @var{feature} names. See also
24957 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
24958 on if it is not preceded with @samp{^}, otherwise, it is turned off.
24959 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
24960 developers. Using it may lead to code paths not covered by testing and can
24961 potentially result in compiler ICEs or runtime errors.
24962
24963 @item -mno-default
24964 @opindex mno-default
24965 This option instructs GCC to turn off all tunable features. See also
24966 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
24967
24968 @item -mcld
24969 @opindex mcld
24970 This option instructs GCC to emit a @code{cld} instruction in the prologue
24971 of functions that use string instructions. String instructions depend on
24972 the DF flag to select between autoincrement or autodecrement mode. While the
24973 ABI specifies the DF flag to be cleared on function entry, some operating
24974 systems violate this specification by not clearing the DF flag in their
24975 exception dispatchers. The exception handler can be invoked with the DF flag
24976 set, which leads to wrong direction mode when string instructions are used.
24977 This option can be enabled by default on 32-bit x86 targets by configuring
24978 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
24979 instructions can be suppressed with the @option{-mno-cld} compiler option
24980 in this case.
24981
24982 @item -mvzeroupper
24983 @opindex mvzeroupper
24984 This option instructs GCC to emit a @code{vzeroupper} instruction
24985 before a transfer of control flow out of the function to minimize
24986 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
24987 intrinsics.
24988
24989 @item -mprefer-avx128
24990 @opindex mprefer-avx128
24991 This option instructs GCC to use 128-bit AVX instructions instead of
24992 256-bit AVX instructions in the auto-vectorizer.
24993
24994 @item -mcx16
24995 @opindex mcx16
24996 This option enables GCC to generate @code{CMPXCHG16B} instructions.
24997 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
24998 (or oword) data types.
24999 This is useful for high-resolution counters that can be updated
25000 by multiple processors (or cores). This instruction is generated as part of
25001 atomic built-in functions: see @ref{__sync Builtins} or
25002 @ref{__atomic Builtins} for details.
25003
25004 @item -msahf
25005 @opindex msahf
25006 This option enables generation of @code{SAHF} instructions in 64-bit code.
25007 Early Intel Pentium 4 CPUs with Intel 64 support,
25008 prior to the introduction of Pentium 4 G1 step in December 2005,
25009 lacked the @code{LAHF} and @code{SAHF} instructions
25010 which are supported by AMD64.
25011 These are load and store instructions, respectively, for certain status flags.
25012 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
25013 @code{drem}, and @code{remainder} built-in functions;
25014 see @ref{Other Builtins} for details.
25015
25016 @item -mmovbe
25017 @opindex mmovbe
25018 This option enables use of the @code{movbe} instruction to implement
25019 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
25020
25021 @item -mcrc32
25022 @opindex mcrc32
25023 This option enables built-in functions @code{__builtin_ia32_crc32qi},
25024 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
25025 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
25026
25027 @item -mrecip
25028 @opindex mrecip
25029 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
25030 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
25031 with an additional Newton-Raphson step
25032 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
25033 (and their vectorized
25034 variants) for single-precision floating-point arguments. These instructions
25035 are generated only when @option{-funsafe-math-optimizations} is enabled
25036 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
25037 Note that while the throughput of the sequence is higher than the throughput
25038 of the non-reciprocal instruction, the precision of the sequence can be
25039 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
25040
25041 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
25042 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
25043 combination), and doesn't need @option{-mrecip}.
25044
25045 Also note that GCC emits the above sequence with additional Newton-Raphson step
25046 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
25047 already with @option{-ffast-math} (or the above option combination), and
25048 doesn't need @option{-mrecip}.
25049
25050 @item -mrecip=@var{opt}
25051 @opindex mrecip=opt
25052 This option controls which reciprocal estimate instructions
25053 may be used. @var{opt} is a comma-separated list of options, which may
25054 be preceded by a @samp{!} to invert the option:
25055
25056 @table @samp
25057 @item all
25058 Enable all estimate instructions.
25059
25060 @item default
25061 Enable the default instructions, equivalent to @option{-mrecip}.
25062
25063 @item none
25064 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25065
25066 @item div
25067 Enable the approximation for scalar division.
25068
25069 @item vec-div
25070 Enable the approximation for vectorized division.
25071
25072 @item sqrt
25073 Enable the approximation for scalar square root.
25074
25075 @item vec-sqrt
25076 Enable the approximation for vectorized square root.
25077 @end table
25078
25079 So, for example, @option{-mrecip=all,!sqrt} enables
25080 all of the reciprocal approximations, except for square root.
25081
25082 @item -mveclibabi=@var{type}
25083 @opindex mveclibabi
25084 Specifies the ABI type to use for vectorizing intrinsics using an
25085 external library. Supported values for @var{type} are @samp{svml}
25086 for the Intel short
25087 vector math library and @samp{acml} for the AMD math core library.
25088 To use this option, both @option{-ftree-vectorize} and
25089 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
25090 ABI-compatible library must be specified at link time.
25091
25092 GCC currently emits calls to @code{vmldExp2},
25093 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
25094 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
25095 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
25096 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
25097 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
25098 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
25099 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
25100 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
25101 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
25102 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
25103 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
25104 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
25105 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
25106 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
25107 when @option{-mveclibabi=acml} is used.
25108
25109 @item -mabi=@var{name}
25110 @opindex mabi
25111 Generate code for the specified calling convention. Permissible values
25112 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
25113 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
25114 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
25115 You can control this behavior for specific functions by
25116 using the function attributes @code{ms_abi} and @code{sysv_abi}.
25117 @xref{Function Attributes}.
25118
25119 @item -mtls-dialect=@var{type}
25120 @opindex mtls-dialect
25121 Generate code to access thread-local storage using the @samp{gnu} or
25122 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
25123 @samp{gnu2} is more efficient, but it may add compile- and run-time
25124 requirements that cannot be satisfied on all systems.
25125
25126 @item -mpush-args
25127 @itemx -mno-push-args
25128 @opindex mpush-args
25129 @opindex mno-push-args
25130 Use PUSH operations to store outgoing parameters. This method is shorter
25131 and usually equally fast as method using SUB/MOV operations and is enabled
25132 by default. In some cases disabling it may improve performance because of
25133 improved scheduling and reduced dependencies.
25134
25135 @item -maccumulate-outgoing-args
25136 @opindex maccumulate-outgoing-args
25137 If enabled, the maximum amount of space required for outgoing arguments is
25138 computed in the function prologue. This is faster on most modern CPUs
25139 because of reduced dependencies, improved scheduling and reduced stack usage
25140 when the preferred stack boundary is not equal to 2. The drawback is a notable
25141 increase in code size. This switch implies @option{-mno-push-args}.
25142
25143 @item -mthreads
25144 @opindex mthreads
25145 Support thread-safe exception handling on MinGW. Programs that rely
25146 on thread-safe exception handling must compile and link all code with the
25147 @option{-mthreads} option. When compiling, @option{-mthreads} defines
25148 @option{-D_MT}; when linking, it links in a special thread helper library
25149 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
25150
25151 @item -mms-bitfields
25152 @itemx -mno-ms-bitfields
25153 @opindex mms-bitfields
25154 @opindex mno-ms-bitfields
25155
25156 Enable/disable bit-field layout compatible with the native Microsoft
25157 Windows compiler.
25158
25159 If @code{packed} is used on a structure, or if bit-fields are used,
25160 it may be that the Microsoft ABI lays out the structure differently
25161 than the way GCC normally does. Particularly when moving packed
25162 data between functions compiled with GCC and the native Microsoft compiler
25163 (either via function call or as data in a file), it may be necessary to access
25164 either format.
25165
25166 This option is enabled by default for Microsoft Windows
25167 targets. This behavior can also be controlled locally by use of variable
25168 or type attributes. For more information, see @ref{x86 Variable Attributes}
25169 and @ref{x86 Type Attributes}.
25170
25171 The Microsoft structure layout algorithm is fairly simple with the exception
25172 of the bit-field packing.
25173 The padding and alignment of members of structures and whether a bit-field
25174 can straddle a storage-unit boundary are determine by these rules:
25175
25176 @enumerate
25177 @item Structure members are stored sequentially in the order in which they are
25178 declared: the first member has the lowest memory address and the last member
25179 the highest.
25180
25181 @item Every data object has an alignment requirement. The alignment requirement
25182 for all data except structures, unions, and arrays is either the size of the
25183 object or the current packing size (specified with either the
25184 @code{aligned} attribute or the @code{pack} pragma),
25185 whichever is less. For structures, unions, and arrays,
25186 the alignment requirement is the largest alignment requirement of its members.
25187 Every object is allocated an offset so that:
25188
25189 @smallexample
25190 offset % alignment_requirement == 0
25191 @end smallexample
25192
25193 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
25194 unit if the integral types are the same size and if the next bit-field fits
25195 into the current allocation unit without crossing the boundary imposed by the
25196 common alignment requirements of the bit-fields.
25197 @end enumerate
25198
25199 MSVC interprets zero-length bit-fields in the following ways:
25200
25201 @enumerate
25202 @item If a zero-length bit-field is inserted between two bit-fields that
25203 are normally coalesced, the bit-fields are not coalesced.
25204
25205 For example:
25206
25207 @smallexample
25208 struct
25209 @{
25210 unsigned long bf_1 : 12;
25211 unsigned long : 0;
25212 unsigned long bf_2 : 12;
25213 @} t1;
25214 @end smallexample
25215
25216 @noindent
25217 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
25218 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
25219
25220 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
25221 alignment of the zero-length bit-field is greater than the member that follows it,
25222 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
25223
25224 For example:
25225
25226 @smallexample
25227 struct
25228 @{
25229 char foo : 4;
25230 short : 0;
25231 char bar;
25232 @} t2;
25233
25234 struct
25235 @{
25236 char foo : 4;
25237 short : 0;
25238 double bar;
25239 @} t3;
25240 @end smallexample
25241
25242 @noindent
25243 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
25244 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
25245 bit-field does not affect the alignment of @code{bar} or, as a result, the size
25246 of the structure.
25247
25248 Taking this into account, it is important to note the following:
25249
25250 @enumerate
25251 @item If a zero-length bit-field follows a normal bit-field, the type of the
25252 zero-length bit-field may affect the alignment of the structure as whole. For
25253 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
25254 normal bit-field, and is of type short.
25255
25256 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
25257 still affect the alignment of the structure:
25258
25259 @smallexample
25260 struct
25261 @{
25262 char foo : 6;
25263 long : 0;
25264 @} t4;
25265 @end smallexample
25266
25267 @noindent
25268 Here, @code{t4} takes up 4 bytes.
25269 @end enumerate
25270
25271 @item Zero-length bit-fields following non-bit-field members are ignored:
25272
25273 @smallexample
25274 struct
25275 @{
25276 char foo;
25277 long : 0;
25278 char bar;
25279 @} t5;
25280 @end smallexample
25281
25282 @noindent
25283 Here, @code{t5} takes up 2 bytes.
25284 @end enumerate
25285
25286
25287 @item -mno-align-stringops
25288 @opindex mno-align-stringops
25289 Do not align the destination of inlined string operations. This switch reduces
25290 code size and improves performance in case the destination is already aligned,
25291 but GCC doesn't know about it.
25292
25293 @item -minline-all-stringops
25294 @opindex minline-all-stringops
25295 By default GCC inlines string operations only when the destination is
25296 known to be aligned to least a 4-byte boundary.
25297 This enables more inlining and increases code
25298 size, but may improve performance of code that depends on fast
25299 @code{memcpy}, @code{strlen},
25300 and @code{memset} for short lengths.
25301
25302 @item -minline-stringops-dynamically
25303 @opindex minline-stringops-dynamically
25304 For string operations of unknown size, use run-time checks with
25305 inline code for small blocks and a library call for large blocks.
25306
25307 @item -mstringop-strategy=@var{alg}
25308 @opindex mstringop-strategy=@var{alg}
25309 Override the internal decision heuristic for the particular algorithm to use
25310 for inlining string operations. The allowed values for @var{alg} are:
25311
25312 @table @samp
25313 @item rep_byte
25314 @itemx rep_4byte
25315 @itemx rep_8byte
25316 Expand using i386 @code{rep} prefix of the specified size.
25317
25318 @item byte_loop
25319 @itemx loop
25320 @itemx unrolled_loop
25321 Expand into an inline loop.
25322
25323 @item libcall
25324 Always use a library call.
25325 @end table
25326
25327 @item -mmemcpy-strategy=@var{strategy}
25328 @opindex mmemcpy-strategy=@var{strategy}
25329 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
25330 should be inlined and what inline algorithm to use when the expected size
25331 of the copy operation is known. @var{strategy}
25332 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
25333 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
25334 the max byte size with which inline algorithm @var{alg} is allowed. For the last
25335 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
25336 in the list must be specified in increasing order. The minimal byte size for
25337 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
25338 preceding range.
25339
25340 @item -mmemset-strategy=@var{strategy}
25341 @opindex mmemset-strategy=@var{strategy}
25342 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
25343 @code{__builtin_memset} expansion.
25344
25345 @item -momit-leaf-frame-pointer
25346 @opindex momit-leaf-frame-pointer
25347 Don't keep the frame pointer in a register for leaf functions. This
25348 avoids the instructions to save, set up, and restore frame pointers and
25349 makes an extra register available in leaf functions. The option
25350 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
25351 which might make debugging harder.
25352
25353 @item -mtls-direct-seg-refs
25354 @itemx -mno-tls-direct-seg-refs
25355 @opindex mtls-direct-seg-refs
25356 Controls whether TLS variables may be accessed with offsets from the
25357 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
25358 or whether the thread base pointer must be added. Whether or not this
25359 is valid depends on the operating system, and whether it maps the
25360 segment to cover the entire TLS area.
25361
25362 For systems that use the GNU C Library, the default is on.
25363
25364 @item -msse2avx
25365 @itemx -mno-sse2avx
25366 @opindex msse2avx
25367 Specify that the assembler should encode SSE instructions with VEX
25368 prefix. The option @option{-mavx} turns this on by default.
25369
25370 @item -mfentry
25371 @itemx -mno-fentry
25372 @opindex mfentry
25373 If profiling is active (@option{-pg}), put the profiling
25374 counter call before the prologue.
25375 Note: On x86 architectures the attribute @code{ms_hook_prologue}
25376 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
25377
25378 @item -mrecord-mcount
25379 @itemx -mno-record-mcount
25380 @opindex mrecord-mcount
25381 If profiling is active (@option{-pg}), generate a __mcount_loc section
25382 that contains pointers to each profiling call. This is useful for
25383 automatically patching and out calls.
25384
25385 @item -mnop-mcount
25386 @itemx -mno-nop-mcount
25387 @opindex mnop-mcount
25388 If profiling is active (@option{-pg}), generate the calls to
25389 the profiling functions as NOPs. This is useful when they
25390 should be patched in later dynamically. This is likely only
25391 useful together with @option{-mrecord-mcount}.
25392
25393 @item -mskip-rax-setup
25394 @itemx -mno-skip-rax-setup
25395 @opindex mskip-rax-setup
25396 When generating code for the x86-64 architecture with SSE extensions
25397 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
25398 register when there are no variable arguments passed in vector registers.
25399
25400 @strong{Warning:} Since RAX register is used to avoid unnecessarily
25401 saving vector registers on stack when passing variable arguments, the
25402 impacts of this option are callees may waste some stack space,
25403 misbehave or jump to a random location. GCC 4.4 or newer don't have
25404 those issues, regardless the RAX register value.
25405
25406 @item -m8bit-idiv
25407 @itemx -mno-8bit-idiv
25408 @opindex m8bit-idiv
25409 On some processors, like Intel Atom, 8-bit unsigned integer divide is
25410 much faster than 32-bit/64-bit integer divide. This option generates a
25411 run-time check. If both dividend and divisor are within range of 0
25412 to 255, 8-bit unsigned integer divide is used instead of
25413 32-bit/64-bit integer divide.
25414
25415 @item -mavx256-split-unaligned-load
25416 @itemx -mavx256-split-unaligned-store
25417 @opindex mavx256-split-unaligned-load
25418 @opindex mavx256-split-unaligned-store
25419 Split 32-byte AVX unaligned load and store.
25420
25421 @item -mstack-protector-guard=@var{guard}
25422 @opindex mstack-protector-guard=@var{guard}
25423 Generate stack protection code using canary at @var{guard}. Supported
25424 locations are @samp{global} for global canary or @samp{tls} for per-thread
25425 canary in the TLS block (the default). This option has effect only when
25426 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
25427
25428 @item -mmitigate-rop
25429 @opindex mmitigate-rop
25430 Try to avoid generating code sequences that contain unintended return
25431 opcodes, to mitigate against certain forms of attack. At the moment,
25432 this option is limited in what it can do and should not be relied
25433 on to provide serious protection.
25434
25435 @item -mgeneral-regs-only
25436 @opindex mgeneral-regs-only
25437 Generate code that uses only the general-purpose registers. This
25438 prevents the compiler from using floating-point, vector, mask and bound
25439 registers.
25440
25441 @end table
25442
25443 These @samp{-m} switches are supported in addition to the above
25444 on x86-64 processors in 64-bit environments.
25445
25446 @table @gcctabopt
25447 @item -m32
25448 @itemx -m64
25449 @itemx -mx32
25450 @itemx -m16
25451 @itemx -miamcu
25452 @opindex m32
25453 @opindex m64
25454 @opindex mx32
25455 @opindex m16
25456 @opindex miamcu
25457 Generate code for a 16-bit, 32-bit or 64-bit environment.
25458 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
25459 to 32 bits, and
25460 generates code that runs on any i386 system.
25461
25462 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
25463 types to 64 bits, and generates code for the x86-64 architecture.
25464 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
25465 and @option{-mdynamic-no-pic} options.
25466
25467 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
25468 to 32 bits, and
25469 generates code for the x86-64 architecture.
25470
25471 The @option{-m16} option is the same as @option{-m32}, except for that
25472 it outputs the @code{.code16gcc} assembly directive at the beginning of
25473 the assembly output so that the binary can run in 16-bit mode.
25474
25475 The @option{-miamcu} option generates code which conforms to Intel MCU
25476 psABI. It requires the @option{-m32} option to be turned on.
25477
25478 @item -mno-red-zone
25479 @opindex mno-red-zone
25480 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
25481 by the x86-64 ABI; it is a 128-byte area beyond the location of the
25482 stack pointer that is not modified by signal or interrupt handlers
25483 and therefore can be used for temporary data without adjusting the stack
25484 pointer. The flag @option{-mno-red-zone} disables this red zone.
25485
25486 @item -mcmodel=small
25487 @opindex mcmodel=small
25488 Generate code for the small code model: the program and its symbols must
25489 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
25490 Programs can be statically or dynamically linked. This is the default
25491 code model.
25492
25493 @item -mcmodel=kernel
25494 @opindex mcmodel=kernel
25495 Generate code for the kernel code model. The kernel runs in the
25496 negative 2 GB of the address space.
25497 This model has to be used for Linux kernel code.
25498
25499 @item -mcmodel=medium
25500 @opindex mcmodel=medium
25501 Generate code for the medium model: the program is linked in the lower 2
25502 GB of the address space. Small symbols are also placed there. Symbols
25503 with sizes larger than @option{-mlarge-data-threshold} are put into
25504 large data or BSS sections and can be located above 2GB. Programs can
25505 be statically or dynamically linked.
25506
25507 @item -mcmodel=large
25508 @opindex mcmodel=large
25509 Generate code for the large model. This model makes no assumptions
25510 about addresses and sizes of sections.
25511
25512 @item -maddress-mode=long
25513 @opindex maddress-mode=long
25514 Generate code for long address mode. This is only supported for 64-bit
25515 and x32 environments. It is the default address mode for 64-bit
25516 environments.
25517
25518 @item -maddress-mode=short
25519 @opindex maddress-mode=short
25520 Generate code for short address mode. This is only supported for 32-bit
25521 and x32 environments. It is the default address mode for 32-bit and
25522 x32 environments.
25523 @end table
25524
25525 @node x86 Windows Options
25526 @subsection x86 Windows Options
25527 @cindex x86 Windows Options
25528 @cindex Windows Options for x86
25529
25530 These additional options are available for Microsoft Windows targets:
25531
25532 @table @gcctabopt
25533 @item -mconsole
25534 @opindex mconsole
25535 This option
25536 specifies that a console application is to be generated, by
25537 instructing the linker to set the PE header subsystem type
25538 required for console applications.
25539 This option is available for Cygwin and MinGW targets and is
25540 enabled by default on those targets.
25541
25542 @item -mdll
25543 @opindex mdll
25544 This option is available for Cygwin and MinGW targets. It
25545 specifies that a DLL---a dynamic link library---is to be
25546 generated, enabling the selection of the required runtime
25547 startup object and entry point.
25548
25549 @item -mnop-fun-dllimport
25550 @opindex mnop-fun-dllimport
25551 This option is available for Cygwin and MinGW targets. It
25552 specifies that the @code{dllimport} attribute should be ignored.
25553
25554 @item -mthread
25555 @opindex mthread
25556 This option is available for MinGW targets. It specifies
25557 that MinGW-specific thread support is to be used.
25558
25559 @item -municode
25560 @opindex municode
25561 This option is available for MinGW-w64 targets. It causes
25562 the @code{UNICODE} preprocessor macro to be predefined, and
25563 chooses Unicode-capable runtime startup code.
25564
25565 @item -mwin32
25566 @opindex mwin32
25567 This option is available for Cygwin and MinGW targets. It
25568 specifies that the typical Microsoft Windows predefined macros are to
25569 be set in the pre-processor, but does not influence the choice
25570 of runtime library/startup code.
25571
25572 @item -mwindows
25573 @opindex mwindows
25574 This option is available for Cygwin and MinGW targets. It
25575 specifies that a GUI application is to be generated by
25576 instructing the linker to set the PE header subsystem type
25577 appropriately.
25578
25579 @item -fno-set-stack-executable
25580 @opindex fno-set-stack-executable
25581 This option is available for MinGW targets. It specifies that
25582 the executable flag for the stack used by nested functions isn't
25583 set. This is necessary for binaries running in kernel mode of
25584 Microsoft Windows, as there the User32 API, which is used to set executable
25585 privileges, isn't available.
25586
25587 @item -fwritable-relocated-rdata
25588 @opindex fno-writable-relocated-rdata
25589 This option is available for MinGW and Cygwin targets. It specifies
25590 that relocated-data in read-only section is put into the @code{.data}
25591 section. This is a necessary for older runtimes not supporting
25592 modification of @code{.rdata} sections for pseudo-relocation.
25593
25594 @item -mpe-aligned-commons
25595 @opindex mpe-aligned-commons
25596 This option is available for Cygwin and MinGW targets. It
25597 specifies that the GNU extension to the PE file format that
25598 permits the correct alignment of COMMON variables should be
25599 used when generating code. It is enabled by default if
25600 GCC detects that the target assembler found during configuration
25601 supports the feature.
25602 @end table
25603
25604 See also under @ref{x86 Options} for standard options.
25605
25606 @node Xstormy16 Options
25607 @subsection Xstormy16 Options
25608 @cindex Xstormy16 Options
25609
25610 These options are defined for Xstormy16:
25611
25612 @table @gcctabopt
25613 @item -msim
25614 @opindex msim
25615 Choose startup files and linker script suitable for the simulator.
25616 @end table
25617
25618 @node Xtensa Options
25619 @subsection Xtensa Options
25620 @cindex Xtensa Options
25621
25622 These options are supported for Xtensa targets:
25623
25624 @table @gcctabopt
25625 @item -mconst16
25626 @itemx -mno-const16
25627 @opindex mconst16
25628 @opindex mno-const16
25629 Enable or disable use of @code{CONST16} instructions for loading
25630 constant values. The @code{CONST16} instruction is currently not a
25631 standard option from Tensilica. When enabled, @code{CONST16}
25632 instructions are always used in place of the standard @code{L32R}
25633 instructions. The use of @code{CONST16} is enabled by default only if
25634 the @code{L32R} instruction is not available.
25635
25636 @item -mfused-madd
25637 @itemx -mno-fused-madd
25638 @opindex mfused-madd
25639 @opindex mno-fused-madd
25640 Enable or disable use of fused multiply/add and multiply/subtract
25641 instructions in the floating-point option. This has no effect if the
25642 floating-point option is not also enabled. Disabling fused multiply/add
25643 and multiply/subtract instructions forces the compiler to use separate
25644 instructions for the multiply and add/subtract operations. This may be
25645 desirable in some cases where strict IEEE 754-compliant results are
25646 required: the fused multiply add/subtract instructions do not round the
25647 intermediate result, thereby producing results with @emph{more} bits of
25648 precision than specified by the IEEE standard. Disabling fused multiply
25649 add/subtract instructions also ensures that the program output is not
25650 sensitive to the compiler's ability to combine multiply and add/subtract
25651 operations.
25652
25653 @item -mserialize-volatile
25654 @itemx -mno-serialize-volatile
25655 @opindex mserialize-volatile
25656 @opindex mno-serialize-volatile
25657 When this option is enabled, GCC inserts @code{MEMW} instructions before
25658 @code{volatile} memory references to guarantee sequential consistency.
25659 The default is @option{-mserialize-volatile}. Use
25660 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
25661
25662 @item -mforce-no-pic
25663 @opindex mforce-no-pic
25664 For targets, like GNU/Linux, where all user-mode Xtensa code must be
25665 position-independent code (PIC), this option disables PIC for compiling
25666 kernel code.
25667
25668 @item -mtext-section-literals
25669 @itemx -mno-text-section-literals
25670 @opindex mtext-section-literals
25671 @opindex mno-text-section-literals
25672 These options control the treatment of literal pools. The default is
25673 @option{-mno-text-section-literals}, which places literals in a separate
25674 section in the output file. This allows the literal pool to be placed
25675 in a data RAM/ROM, and it also allows the linker to combine literal
25676 pools from separate object files to remove redundant literals and
25677 improve code size. With @option{-mtext-section-literals}, the literals
25678 are interspersed in the text section in order to keep them as close as
25679 possible to their references. This may be necessary for large assembly
25680 files. Literals for each function are placed right before that function.
25681
25682 @item -mauto-litpools
25683 @itemx -mno-auto-litpools
25684 @opindex mauto-litpools
25685 @opindex mno-auto-litpools
25686 These options control the treatment of literal pools. The default is
25687 @option{-mno-auto-litpools}, which places literals in a separate
25688 section in the output file unless @option{-mtext-section-literals} is
25689 used. With @option{-mauto-litpools} the literals are interspersed in
25690 the text section by the assembler. Compiler does not produce explicit
25691 @code{.literal} directives and loads literals into registers with
25692 @code{MOVI} instructions instead of @code{L32R} to let the assembler
25693 do relaxation and place literals as necessary. This option allows
25694 assembler to create several literal pools per function and assemble
25695 very big functions, which may not be possible with
25696 @option{-mtext-section-literals}.
25697
25698 @item -mtarget-align
25699 @itemx -mno-target-align
25700 @opindex mtarget-align
25701 @opindex mno-target-align
25702 When this option is enabled, GCC instructs the assembler to
25703 automatically align instructions to reduce branch penalties at the
25704 expense of some code density. The assembler attempts to widen density
25705 instructions to align branch targets and the instructions following call
25706 instructions. If there are not enough preceding safe density
25707 instructions to align a target, no widening is performed. The
25708 default is @option{-mtarget-align}. These options do not affect the
25709 treatment of auto-aligned instructions like @code{LOOP}, which the
25710 assembler always aligns, either by widening density instructions or
25711 by inserting NOP instructions.
25712
25713 @item -mlongcalls
25714 @itemx -mno-longcalls
25715 @opindex mlongcalls
25716 @opindex mno-longcalls
25717 When this option is enabled, GCC instructs the assembler to translate
25718 direct calls to indirect calls unless it can determine that the target
25719 of a direct call is in the range allowed by the call instruction. This
25720 translation typically occurs for calls to functions in other source
25721 files. Specifically, the assembler translates a direct @code{CALL}
25722 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
25723 The default is @option{-mno-longcalls}. This option should be used in
25724 programs where the call target can potentially be out of range. This
25725 option is implemented in the assembler, not the compiler, so the
25726 assembly code generated by GCC still shows direct call
25727 instructions---look at the disassembled object code to see the actual
25728 instructions. Note that the assembler uses an indirect call for
25729 every cross-file call, not just those that really are out of range.
25730 @end table
25731
25732 @node zSeries Options
25733 @subsection zSeries Options
25734 @cindex zSeries options
25735
25736 These are listed under @xref{S/390 and zSeries Options}.
25737
25738
25739 @c man end
25740
25741 @node Spec Files
25742 @section Specifying Subprocesses and the Switches to Pass to Them
25743 @cindex Spec Files
25744
25745 @command{gcc} is a driver program. It performs its job by invoking a
25746 sequence of other programs to do the work of compiling, assembling and
25747 linking. GCC interprets its command-line parameters and uses these to
25748 deduce which programs it should invoke, and which command-line options
25749 it ought to place on their command lines. This behavior is controlled
25750 by @dfn{spec strings}. In most cases there is one spec string for each
25751 program that GCC can invoke, but a few programs have multiple spec
25752 strings to control their behavior. The spec strings built into GCC can
25753 be overridden by using the @option{-specs=} command-line switch to specify
25754 a spec file.
25755
25756 @dfn{Spec files} are plain-text files that are used to construct spec
25757 strings. They consist of a sequence of directives separated by blank
25758 lines. The type of directive is determined by the first non-whitespace
25759 character on the line, which can be one of the following:
25760
25761 @table @code
25762 @item %@var{command}
25763 Issues a @var{command} to the spec file processor. The commands that can
25764 appear here are:
25765
25766 @table @code
25767 @item %include <@var{file}>
25768 @cindex @code{%include}
25769 Search for @var{file} and insert its text at the current point in the
25770 specs file.
25771
25772 @item %include_noerr <@var{file}>
25773 @cindex @code{%include_noerr}
25774 Just like @samp{%include}, but do not generate an error message if the include
25775 file cannot be found.
25776
25777 @item %rename @var{old_name} @var{new_name}
25778 @cindex @code{%rename}
25779 Rename the spec string @var{old_name} to @var{new_name}.
25780
25781 @end table
25782
25783 @item *[@var{spec_name}]:
25784 This tells the compiler to create, override or delete the named spec
25785 string. All lines after this directive up to the next directive or
25786 blank line are considered to be the text for the spec string. If this
25787 results in an empty string then the spec is deleted. (Or, if the
25788 spec did not exist, then nothing happens.) Otherwise, if the spec
25789 does not currently exist a new spec is created. If the spec does
25790 exist then its contents are overridden by the text of this
25791 directive, unless the first character of that text is the @samp{+}
25792 character, in which case the text is appended to the spec.
25793
25794 @item [@var{suffix}]:
25795 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
25796 and up to the next directive or blank line are considered to make up the
25797 spec string for the indicated suffix. When the compiler encounters an
25798 input file with the named suffix, it processes the spec string in
25799 order to work out how to compile that file. For example:
25800
25801 @smallexample
25802 .ZZ:
25803 z-compile -input %i
25804 @end smallexample
25805
25806 This says that any input file whose name ends in @samp{.ZZ} should be
25807 passed to the program @samp{z-compile}, which should be invoked with the
25808 command-line switch @option{-input} and with the result of performing the
25809 @samp{%i} substitution. (See below.)
25810
25811 As an alternative to providing a spec string, the text following a
25812 suffix directive can be one of the following:
25813
25814 @table @code
25815 @item @@@var{language}
25816 This says that the suffix is an alias for a known @var{language}. This is
25817 similar to using the @option{-x} command-line switch to GCC to specify a
25818 language explicitly. For example:
25819
25820 @smallexample
25821 .ZZ:
25822 @@c++
25823 @end smallexample
25824
25825 Says that .ZZ files are, in fact, C++ source files.
25826
25827 @item #@var{name}
25828 This causes an error messages saying:
25829
25830 @smallexample
25831 @var{name} compiler not installed on this system.
25832 @end smallexample
25833 @end table
25834
25835 GCC already has an extensive list of suffixes built into it.
25836 This directive adds an entry to the end of the list of suffixes, but
25837 since the list is searched from the end backwards, it is effectively
25838 possible to override earlier entries using this technique.
25839
25840 @end table
25841
25842 GCC has the following spec strings built into it. Spec files can
25843 override these strings or create their own. Note that individual
25844 targets can also add their own spec strings to this list.
25845
25846 @smallexample
25847 asm Options to pass to the assembler
25848 asm_final Options to pass to the assembler post-processor
25849 cpp Options to pass to the C preprocessor
25850 cc1 Options to pass to the C compiler
25851 cc1plus Options to pass to the C++ compiler
25852 endfile Object files to include at the end of the link
25853 link Options to pass to the linker
25854 lib Libraries to include on the command line to the linker
25855 libgcc Decides which GCC support library to pass to the linker
25856 linker Sets the name of the linker
25857 predefines Defines to be passed to the C preprocessor
25858 signed_char Defines to pass to CPP to say whether @code{char} is signed
25859 by default
25860 startfile Object files to include at the start of the link
25861 @end smallexample
25862
25863 Here is a small example of a spec file:
25864
25865 @smallexample
25866 %rename lib old_lib
25867
25868 *lib:
25869 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
25870 @end smallexample
25871
25872 This example renames the spec called @samp{lib} to @samp{old_lib} and
25873 then overrides the previous definition of @samp{lib} with a new one.
25874 The new definition adds in some extra command-line options before
25875 including the text of the old definition.
25876
25877 @dfn{Spec strings} are a list of command-line options to be passed to their
25878 corresponding program. In addition, the spec strings can contain
25879 @samp{%}-prefixed sequences to substitute variable text or to
25880 conditionally insert text into the command line. Using these constructs
25881 it is possible to generate quite complex command lines.
25882
25883 Here is a table of all defined @samp{%}-sequences for spec
25884 strings. Note that spaces are not generated automatically around the
25885 results of expanding these sequences. Therefore you can concatenate them
25886 together or combine them with constant text in a single argument.
25887
25888 @table @code
25889 @item %%
25890 Substitute one @samp{%} into the program name or argument.
25891
25892 @item %i
25893 Substitute the name of the input file being processed.
25894
25895 @item %b
25896 Substitute the basename of the input file being processed.
25897 This is the substring up to (and not including) the last period
25898 and not including the directory.
25899
25900 @item %B
25901 This is the same as @samp{%b}, but include the file suffix (text after
25902 the last period).
25903
25904 @item %d
25905 Marks the argument containing or following the @samp{%d} as a
25906 temporary file name, so that that file is deleted if GCC exits
25907 successfully. Unlike @samp{%g}, this contributes no text to the
25908 argument.
25909
25910 @item %g@var{suffix}
25911 Substitute a file name that has suffix @var{suffix} and is chosen
25912 once per compilation, and mark the argument in the same way as
25913 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
25914 name is now chosen in a way that is hard to predict even when previously
25915 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
25916 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
25917 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
25918 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
25919 was simply substituted with a file name chosen once per compilation,
25920 without regard to any appended suffix (which was therefore treated
25921 just like ordinary text), making such attacks more likely to succeed.
25922
25923 @item %u@var{suffix}
25924 Like @samp{%g}, but generates a new temporary file name
25925 each time it appears instead of once per compilation.
25926
25927 @item %U@var{suffix}
25928 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
25929 new one if there is no such last file name. In the absence of any
25930 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
25931 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
25932 involves the generation of two distinct file names, one
25933 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
25934 simply substituted with a file name chosen for the previous @samp{%u},
25935 without regard to any appended suffix.
25936
25937 @item %j@var{suffix}
25938 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
25939 writable, and if @option{-save-temps} is not used;
25940 otherwise, substitute the name
25941 of a temporary file, just like @samp{%u}. This temporary file is not
25942 meant for communication between processes, but rather as a junk
25943 disposal mechanism.
25944
25945 @item %|@var{suffix}
25946 @itemx %m@var{suffix}
25947 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
25948 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
25949 all. These are the two most common ways to instruct a program that it
25950 should read from standard input or write to standard output. If you
25951 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
25952 construct: see for example @file{f/lang-specs.h}.
25953
25954 @item %.@var{SUFFIX}
25955 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
25956 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
25957 terminated by the next space or %.
25958
25959 @item %w
25960 Marks the argument containing or following the @samp{%w} as the
25961 designated output file of this compilation. This puts the argument
25962 into the sequence of arguments that @samp{%o} substitutes.
25963
25964 @item %o
25965 Substitutes the names of all the output files, with spaces
25966 automatically placed around them. You should write spaces
25967 around the @samp{%o} as well or the results are undefined.
25968 @samp{%o} is for use in the specs for running the linker.
25969 Input files whose names have no recognized suffix are not compiled
25970 at all, but they are included among the output files, so they are
25971 linked.
25972
25973 @item %O
25974 Substitutes the suffix for object files. Note that this is
25975 handled specially when it immediately follows @samp{%g, %u, or %U},
25976 because of the need for those to form complete file names. The
25977 handling is such that @samp{%O} is treated exactly as if it had already
25978 been substituted, except that @samp{%g, %u, and %U} do not currently
25979 support additional @var{suffix} characters following @samp{%O} as they do
25980 following, for example, @samp{.o}.
25981
25982 @item %p
25983 Substitutes the standard macro predefinitions for the
25984 current target machine. Use this when running @command{cpp}.
25985
25986 @item %P
25987 Like @samp{%p}, but puts @samp{__} before and after the name of each
25988 predefined macro, except for macros that start with @samp{__} or with
25989 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
25990 C@.
25991
25992 @item %I
25993 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
25994 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
25995 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
25996 and @option{-imultilib} as necessary.
25997
25998 @item %s
25999 Current argument is the name of a library or startup file of some sort.
26000 Search for that file in a standard list of directories and substitute
26001 the full name found. The current working directory is included in the
26002 list of directories scanned.
26003
26004 @item %T
26005 Current argument is the name of a linker script. Search for that file
26006 in the current list of directories to scan for libraries. If the file
26007 is located insert a @option{--script} option into the command line
26008 followed by the full path name found. If the file is not found then
26009 generate an error message. Note: the current working directory is not
26010 searched.
26011
26012 @item %e@var{str}
26013 Print @var{str} as an error message. @var{str} is terminated by a newline.
26014 Use this when inconsistent options are detected.
26015
26016 @item %(@var{name})
26017 Substitute the contents of spec string @var{name} at this point.
26018
26019 @item %x@{@var{option}@}
26020 Accumulate an option for @samp{%X}.
26021
26022 @item %X
26023 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
26024 spec string.
26025
26026 @item %Y
26027 Output the accumulated assembler options specified by @option{-Wa}.
26028
26029 @item %Z
26030 Output the accumulated preprocessor options specified by @option{-Wp}.
26031
26032 @item %a
26033 Process the @code{asm} spec. This is used to compute the
26034 switches to be passed to the assembler.
26035
26036 @item %A
26037 Process the @code{asm_final} spec. This is a spec string for
26038 passing switches to an assembler post-processor, if such a program is
26039 needed.
26040
26041 @item %l
26042 Process the @code{link} spec. This is the spec for computing the
26043 command line passed to the linker. Typically it makes use of the
26044 @samp{%L %G %S %D and %E} sequences.
26045
26046 @item %D
26047 Dump out a @option{-L} option for each directory that GCC believes might
26048 contain startup files. If the target supports multilibs then the
26049 current multilib directory is prepended to each of these paths.
26050
26051 @item %L
26052 Process the @code{lib} spec. This is a spec string for deciding which
26053 libraries are included on the command line to the linker.
26054
26055 @item %G
26056 Process the @code{libgcc} spec. This is a spec string for deciding
26057 which GCC support library is included on the command line to the linker.
26058
26059 @item %S
26060 Process the @code{startfile} spec. This is a spec for deciding which
26061 object files are the first ones passed to the linker. Typically
26062 this might be a file named @file{crt0.o}.
26063
26064 @item %E
26065 Process the @code{endfile} spec. This is a spec string that specifies
26066 the last object files that are passed to the linker.
26067
26068 @item %C
26069 Process the @code{cpp} spec. This is used to construct the arguments
26070 to be passed to the C preprocessor.
26071
26072 @item %1
26073 Process the @code{cc1} spec. This is used to construct the options to be
26074 passed to the actual C compiler (@command{cc1}).
26075
26076 @item %2
26077 Process the @code{cc1plus} spec. This is used to construct the options to be
26078 passed to the actual C++ compiler (@command{cc1plus}).
26079
26080 @item %*
26081 Substitute the variable part of a matched option. See below.
26082 Note that each comma in the substituted string is replaced by
26083 a single space.
26084
26085 @item %<@code{S}
26086 Remove all occurrences of @code{-S} from the command line. Note---this
26087 command is position dependent. @samp{%} commands in the spec string
26088 before this one see @code{-S}, @samp{%} commands in the spec string
26089 after this one do not.
26090
26091 @item %:@var{function}(@var{args})
26092 Call the named function @var{function}, passing it @var{args}.
26093 @var{args} is first processed as a nested spec string, then split
26094 into an argument vector in the usual fashion. The function returns
26095 a string which is processed as if it had appeared literally as part
26096 of the current spec.
26097
26098 The following built-in spec functions are provided:
26099
26100 @table @code
26101 @item @code{getenv}
26102 The @code{getenv} spec function takes two arguments: an environment
26103 variable name and a string. If the environment variable is not
26104 defined, a fatal error is issued. Otherwise, the return value is the
26105 value of the environment variable concatenated with the string. For
26106 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
26107
26108 @smallexample
26109 %:getenv(TOPDIR /include)
26110 @end smallexample
26111
26112 expands to @file{/path/to/top/include}.
26113
26114 @item @code{if-exists}
26115 The @code{if-exists} spec function takes one argument, an absolute
26116 pathname to a file. If the file exists, @code{if-exists} returns the
26117 pathname. Here is a small example of its usage:
26118
26119 @smallexample
26120 *startfile:
26121 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
26122 @end smallexample
26123
26124 @item @code{if-exists-else}
26125 The @code{if-exists-else} spec function is similar to the @code{if-exists}
26126 spec function, except that it takes two arguments. The first argument is
26127 an absolute pathname to a file. If the file exists, @code{if-exists-else}
26128 returns the pathname. If it does not exist, it returns the second argument.
26129 This way, @code{if-exists-else} can be used to select one file or another,
26130 based on the existence of the first. Here is a small example of its usage:
26131
26132 @smallexample
26133 *startfile:
26134 crt0%O%s %:if-exists(crti%O%s) \
26135 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
26136 @end smallexample
26137
26138 @item @code{replace-outfile}
26139 The @code{replace-outfile} spec function takes two arguments. It looks for the
26140 first argument in the outfiles array and replaces it with the second argument. Here
26141 is a small example of its usage:
26142
26143 @smallexample
26144 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
26145 @end smallexample
26146
26147 @item @code{remove-outfile}
26148 The @code{remove-outfile} spec function takes one argument. It looks for the
26149 first argument in the outfiles array and removes it. Here is a small example
26150 its usage:
26151
26152 @smallexample
26153 %:remove-outfile(-lm)
26154 @end smallexample
26155
26156 @item @code{pass-through-libs}
26157 The @code{pass-through-libs} spec function takes any number of arguments. It
26158 finds any @option{-l} options and any non-options ending in @file{.a} (which it
26159 assumes are the names of linker input library archive files) and returns a
26160 result containing all the found arguments each prepended by
26161 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
26162 intended to be passed to the LTO linker plugin.
26163
26164 @smallexample
26165 %:pass-through-libs(%G %L %G)
26166 @end smallexample
26167
26168 @item @code{print-asm-header}
26169 The @code{print-asm-header} function takes no arguments and simply
26170 prints a banner like:
26171
26172 @smallexample
26173 Assembler options
26174 =================
26175
26176 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
26177 @end smallexample
26178
26179 It is used to separate compiler options from assembler options
26180 in the @option{--target-help} output.
26181 @end table
26182
26183 @item %@{@code{S}@}
26184 Substitutes the @code{-S} switch, if that switch is given to GCC@.
26185 If that switch is not specified, this substitutes nothing. Note that
26186 the leading dash is omitted when specifying this option, and it is
26187 automatically inserted if the substitution is performed. Thus the spec
26188 string @samp{%@{foo@}} matches the command-line option @option{-foo}
26189 and outputs the command-line option @option{-foo}.
26190
26191 @item %W@{@code{S}@}
26192 Like %@{@code{S}@} but mark last argument supplied within as a file to be
26193 deleted on failure.
26194
26195 @item %@{@code{S}*@}
26196 Substitutes all the switches specified to GCC whose names start
26197 with @code{-S}, but which also take an argument. This is used for
26198 switches like @option{-o}, @option{-D}, @option{-I}, etc.
26199 GCC considers @option{-o foo} as being
26200 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
26201 text, including the space. Thus two arguments are generated.
26202
26203 @item %@{@code{S}*&@code{T}*@}
26204 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
26205 (the order of @code{S} and @code{T} in the spec is not significant).
26206 There can be any number of ampersand-separated variables; for each the
26207 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
26208
26209 @item %@{@code{S}:@code{X}@}
26210 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
26211
26212 @item %@{!@code{S}:@code{X}@}
26213 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
26214
26215 @item %@{@code{S}*:@code{X}@}
26216 Substitutes @code{X} if one or more switches whose names start with
26217 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
26218 once, no matter how many such switches appeared. However, if @code{%*}
26219 appears somewhere in @code{X}, then @code{X} is substituted once
26220 for each matching switch, with the @code{%*} replaced by the part of
26221 that switch matching the @code{*}.
26222
26223 If @code{%*} appears as the last part of a spec sequence then a space
26224 is added after the end of the last substitution. If there is more
26225 text in the sequence, however, then a space is not generated. This
26226 allows the @code{%*} substitution to be used as part of a larger
26227 string. For example, a spec string like this:
26228
26229 @smallexample
26230 %@{mcu=*:--script=%*/memory.ld@}
26231 @end smallexample
26232
26233 @noindent
26234 when matching an option like @option{-mcu=newchip} produces:
26235
26236 @smallexample
26237 --script=newchip/memory.ld
26238 @end smallexample
26239
26240 @item %@{.@code{S}:@code{X}@}
26241 Substitutes @code{X}, if processing a file with suffix @code{S}.
26242
26243 @item %@{!.@code{S}:@code{X}@}
26244 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
26245
26246 @item %@{,@code{S}:@code{X}@}
26247 Substitutes @code{X}, if processing a file for language @code{S}.
26248
26249 @item %@{!,@code{S}:@code{X}@}
26250 Substitutes @code{X}, if not processing a file for language @code{S}.
26251
26252 @item %@{@code{S}|@code{P}:@code{X}@}
26253 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
26254 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
26255 @code{*} sequences as well, although they have a stronger binding than
26256 the @samp{|}. If @code{%*} appears in @code{X}, all of the
26257 alternatives must be starred, and only the first matching alternative
26258 is substituted.
26259
26260 For example, a spec string like this:
26261
26262 @smallexample
26263 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
26264 @end smallexample
26265
26266 @noindent
26267 outputs the following command-line options from the following input
26268 command-line options:
26269
26270 @smallexample
26271 fred.c -foo -baz
26272 jim.d -bar -boggle
26273 -d fred.c -foo -baz -boggle
26274 -d jim.d -bar -baz -boggle
26275 @end smallexample
26276
26277 @item %@{S:X; T:Y; :D@}
26278
26279 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
26280 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
26281 be as many clauses as you need. This may be combined with @code{.},
26282 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
26283
26284
26285 @end table
26286
26287 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
26288 construct may contain other nested @samp{%} constructs or spaces, or
26289 even newlines. They are processed as usual, as described above.
26290 Trailing white space in @code{X} is ignored. White space may also
26291 appear anywhere on the left side of the colon in these constructs,
26292 except between @code{.} or @code{*} and the corresponding word.
26293
26294 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
26295 handled specifically in these constructs. If another value of
26296 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
26297 @option{-W} switch is found later in the command line, the earlier
26298 switch value is ignored, except with @{@code{S}*@} where @code{S} is
26299 just one letter, which passes all matching options.
26300
26301 The character @samp{|} at the beginning of the predicate text is used to
26302 indicate that a command should be piped to the following command, but
26303 only if @option{-pipe} is specified.
26304
26305 It is built into GCC which switches take arguments and which do not.
26306 (You might think it would be useful to generalize this to allow each
26307 compiler's spec to say which switches take arguments. But this cannot
26308 be done in a consistent fashion. GCC cannot even decide which input
26309 files have been specified without knowing which switches take arguments,
26310 and it must know which input files to compile in order to tell which
26311 compilers to run).
26312
26313 GCC also knows implicitly that arguments starting in @option{-l} are to be
26314 treated as compiler output files, and passed to the linker in their
26315 proper position among the other output files.
26316
26317 @node Environment Variables
26318 @section Environment Variables Affecting GCC
26319 @cindex environment variables
26320
26321 @c man begin ENVIRONMENT
26322 This section describes several environment variables that affect how GCC
26323 operates. Some of them work by specifying directories or prefixes to use
26324 when searching for various kinds of files. Some are used to specify other
26325 aspects of the compilation environment.
26326
26327 Note that you can also specify places to search using options such as
26328 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
26329 take precedence over places specified using environment variables, which
26330 in turn take precedence over those specified by the configuration of GCC@.
26331 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
26332 GNU Compiler Collection (GCC) Internals}.
26333
26334 @table @env
26335 @item LANG
26336 @itemx LC_CTYPE
26337 @c @itemx LC_COLLATE
26338 @itemx LC_MESSAGES
26339 @c @itemx LC_MONETARY
26340 @c @itemx LC_NUMERIC
26341 @c @itemx LC_TIME
26342 @itemx LC_ALL
26343 @findex LANG
26344 @findex LC_CTYPE
26345 @c @findex LC_COLLATE
26346 @findex LC_MESSAGES
26347 @c @findex LC_MONETARY
26348 @c @findex LC_NUMERIC
26349 @c @findex LC_TIME
26350 @findex LC_ALL
26351 @cindex locale
26352 These environment variables control the way that GCC uses
26353 localization information which allows GCC to work with different
26354 national conventions. GCC inspects the locale categories
26355 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
26356 so. These locale categories can be set to any value supported by your
26357 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
26358 Kingdom encoded in UTF-8.
26359
26360 The @env{LC_CTYPE} environment variable specifies character
26361 classification. GCC uses it to determine the character boundaries in
26362 a string; this is needed for some multibyte encodings that contain quote
26363 and escape characters that are otherwise interpreted as a string
26364 end or escape.
26365
26366 The @env{LC_MESSAGES} environment variable specifies the language to
26367 use in diagnostic messages.
26368
26369 If the @env{LC_ALL} environment variable is set, it overrides the value
26370 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
26371 and @env{LC_MESSAGES} default to the value of the @env{LANG}
26372 environment variable. If none of these variables are set, GCC
26373 defaults to traditional C English behavior.
26374
26375 @item TMPDIR
26376 @findex TMPDIR
26377 If @env{TMPDIR} is set, it specifies the directory to use for temporary
26378 files. GCC uses temporary files to hold the output of one stage of
26379 compilation which is to be used as input to the next stage: for example,
26380 the output of the preprocessor, which is the input to the compiler
26381 proper.
26382
26383 @item GCC_COMPARE_DEBUG
26384 @findex GCC_COMPARE_DEBUG
26385 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
26386 @option{-fcompare-debug} to the compiler driver. See the documentation
26387 of this option for more details.
26388
26389 @item GCC_EXEC_PREFIX
26390 @findex GCC_EXEC_PREFIX
26391 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
26392 names of the subprograms executed by the compiler. No slash is added
26393 when this prefix is combined with the name of a subprogram, but you can
26394 specify a prefix that ends with a slash if you wish.
26395
26396 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
26397 an appropriate prefix to use based on the pathname it is invoked with.
26398
26399 If GCC cannot find the subprogram using the specified prefix, it
26400 tries looking in the usual places for the subprogram.
26401
26402 The default value of @env{GCC_EXEC_PREFIX} is
26403 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
26404 the installed compiler. In many cases @var{prefix} is the value
26405 of @code{prefix} when you ran the @file{configure} script.
26406
26407 Other prefixes specified with @option{-B} take precedence over this prefix.
26408
26409 This prefix is also used for finding files such as @file{crt0.o} that are
26410 used for linking.
26411
26412 In addition, the prefix is used in an unusual way in finding the
26413 directories to search for header files. For each of the standard
26414 directories whose name normally begins with @samp{/usr/local/lib/gcc}
26415 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
26416 replacing that beginning with the specified prefix to produce an
26417 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
26418 @file{foo/bar} just before it searches the standard directory
26419 @file{/usr/local/lib/bar}.
26420 If a standard directory begins with the configured
26421 @var{prefix} then the value of @var{prefix} is replaced by
26422 @env{GCC_EXEC_PREFIX} when looking for header files.
26423
26424 @item COMPILER_PATH
26425 @findex COMPILER_PATH
26426 The value of @env{COMPILER_PATH} is a colon-separated list of
26427 directories, much like @env{PATH}. GCC tries the directories thus
26428 specified when searching for subprograms, if it can't find the
26429 subprograms using @env{GCC_EXEC_PREFIX}.
26430
26431 @item LIBRARY_PATH
26432 @findex LIBRARY_PATH
26433 The value of @env{LIBRARY_PATH} is a colon-separated list of
26434 directories, much like @env{PATH}. When configured as a native compiler,
26435 GCC tries the directories thus specified when searching for special
26436 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
26437 using GCC also uses these directories when searching for ordinary
26438 libraries for the @option{-l} option (but directories specified with
26439 @option{-L} come first).
26440
26441 @item LANG
26442 @findex LANG
26443 @cindex locale definition
26444 This variable is used to pass locale information to the compiler. One way in
26445 which this information is used is to determine the character set to be used
26446 when character literals, string literals and comments are parsed in C and C++.
26447 When the compiler is configured to allow multibyte characters,
26448 the following values for @env{LANG} are recognized:
26449
26450 @table @samp
26451 @item C-JIS
26452 Recognize JIS characters.
26453 @item C-SJIS
26454 Recognize SJIS characters.
26455 @item C-EUCJP
26456 Recognize EUCJP characters.
26457 @end table
26458
26459 If @env{LANG} is not defined, or if it has some other value, then the
26460 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
26461 recognize and translate multibyte characters.
26462 @end table
26463
26464 @noindent
26465 Some additional environment variables affect the behavior of the
26466 preprocessor.
26467
26468 @include cppenv.texi
26469
26470 @c man end
26471
26472 @node Precompiled Headers
26473 @section Using Precompiled Headers
26474 @cindex precompiled headers
26475 @cindex speed of compilation
26476
26477 Often large projects have many header files that are included in every
26478 source file. The time the compiler takes to process these header files
26479 over and over again can account for nearly all of the time required to
26480 build the project. To make builds faster, GCC allows you to
26481 @dfn{precompile} a header file.
26482
26483 To create a precompiled header file, simply compile it as you would any
26484 other file, if necessary using the @option{-x} option to make the driver
26485 treat it as a C or C++ header file. You may want to use a
26486 tool like @command{make} to keep the precompiled header up-to-date when
26487 the headers it contains change.
26488
26489 A precompiled header file is searched for when @code{#include} is
26490 seen in the compilation. As it searches for the included file
26491 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
26492 compiler looks for a precompiled header in each directory just before it
26493 looks for the include file in that directory. The name searched for is
26494 the name specified in the @code{#include} with @samp{.gch} appended. If
26495 the precompiled header file can't be used, it is ignored.
26496
26497 For instance, if you have @code{#include "all.h"}, and you have
26498 @file{all.h.gch} in the same directory as @file{all.h}, then the
26499 precompiled header file is used if possible, and the original
26500 header is used otherwise.
26501
26502 Alternatively, you might decide to put the precompiled header file in a
26503 directory and use @option{-I} to ensure that directory is searched
26504 before (or instead of) the directory containing the original header.
26505 Then, if you want to check that the precompiled header file is always
26506 used, you can put a file of the same name as the original header in this
26507 directory containing an @code{#error} command.
26508
26509 This also works with @option{-include}. So yet another way to use
26510 precompiled headers, good for projects not designed with precompiled
26511 header files in mind, is to simply take most of the header files used by
26512 a project, include them from another header file, precompile that header
26513 file, and @option{-include} the precompiled header. If the header files
26514 have guards against multiple inclusion, they are skipped because
26515 they've already been included (in the precompiled header).
26516
26517 If you need to precompile the same header file for different
26518 languages, targets, or compiler options, you can instead make a
26519 @emph{directory} named like @file{all.h.gch}, and put each precompiled
26520 header in the directory, perhaps using @option{-o}. It doesn't matter
26521 what you call the files in the directory; every precompiled header in
26522 the directory is considered. The first precompiled header
26523 encountered in the directory that is valid for this compilation is
26524 used; they're searched in no particular order.
26525
26526 There are many other possibilities, limited only by your imagination,
26527 good sense, and the constraints of your build system.
26528
26529 A precompiled header file can be used only when these conditions apply:
26530
26531 @itemize
26532 @item
26533 Only one precompiled header can be used in a particular compilation.
26534
26535 @item
26536 A precompiled header can't be used once the first C token is seen. You
26537 can have preprocessor directives before a precompiled header; you cannot
26538 include a precompiled header from inside another header.
26539
26540 @item
26541 The precompiled header file must be produced for the same language as
26542 the current compilation. You can't use a C precompiled header for a C++
26543 compilation.
26544
26545 @item
26546 The precompiled header file must have been produced by the same compiler
26547 binary as the current compilation is using.
26548
26549 @item
26550 Any macros defined before the precompiled header is included must
26551 either be defined in the same way as when the precompiled header was
26552 generated, or must not affect the precompiled header, which usually
26553 means that they don't appear in the precompiled header at all.
26554
26555 The @option{-D} option is one way to define a macro before a
26556 precompiled header is included; using a @code{#define} can also do it.
26557 There are also some options that define macros implicitly, like
26558 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
26559 defined this way.
26560
26561 @item If debugging information is output when using the precompiled
26562 header, using @option{-g} or similar, the same kind of debugging information
26563 must have been output when building the precompiled header. However,
26564 a precompiled header built using @option{-g} can be used in a compilation
26565 when no debugging information is being output.
26566
26567 @item The same @option{-m} options must generally be used when building
26568 and using the precompiled header. @xref{Submodel Options},
26569 for any cases where this rule is relaxed.
26570
26571 @item Each of the following options must be the same when building and using
26572 the precompiled header:
26573
26574 @gccoptlist{-fexceptions}
26575
26576 @item
26577 Some other command-line options starting with @option{-f},
26578 @option{-p}, or @option{-O} must be defined in the same way as when
26579 the precompiled header was generated. At present, it's not clear
26580 which options are safe to change and which are not; the safest choice
26581 is to use exactly the same options when generating and using the
26582 precompiled header. The following are known to be safe:
26583
26584 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
26585 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
26586 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
26587 -pedantic-errors}
26588
26589 @end itemize
26590
26591 For all of these except the last, the compiler automatically
26592 ignores the precompiled header if the conditions aren't met. If you
26593 find an option combination that doesn't work and doesn't cause the
26594 precompiled header to be ignored, please consider filing a bug report,
26595 see @ref{Bugs}.
26596
26597 If you do use differing options when generating and using the
26598 precompiled header, the actual behavior is a mixture of the
26599 behavior for the options. For instance, if you use @option{-g} to
26600 generate the precompiled header but not when using it, you may or may
26601 not get debugging information for routines in the precompiled header.