]> gcc.gnu.org Git - gcc.git/blob - gcc/doc/invoke.texi
Add -static-pie to GCC driver to create static PIE
[gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2017 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-2017 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} @gol
186 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
187 -fsigned-bitfields -fsigned-char @gol
188 -funsigned-bitfields -funsigned-char}
189
190 @item C++ Language Options
191 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
192 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
193 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
194 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
195 -ffriend-injection @gol
196 -fno-elide-constructors @gol
197 -fno-enforce-eh-specs @gol
198 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
199 -fno-implicit-templates @gol
200 -fno-implicit-inline-templates @gol
201 -fno-implement-inlines -fms-extensions @gol
202 -fnew-inheriting-ctors @gol
203 -fnew-ttp-matching @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 -Wnoexcept-type -Wclass-memaccess @gol
219 -Wnon-virtual-dtor -Wreorder -Wregister @gol
220 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
221 -Wno-non-template-friend -Wold-style-cast @gol
222 -Woverloaded-virtual -Wno-pmf-conversions @gol
223 -Wsign-promo -Wvirtual-inheritance}
224
225 @item Objective-C and Objective-C++ Language Options
226 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
227 Objective-C and Objective-C++ Dialects}.
228 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
229 -fgnu-runtime -fnext-runtime @gol
230 -fno-nil-receivers @gol
231 -fobjc-abi-version=@var{n} @gol
232 -fobjc-call-cxx-cdtors @gol
233 -fobjc-direct-dispatch @gol
234 -fobjc-exceptions @gol
235 -fobjc-gc @gol
236 -fobjc-nilcheck @gol
237 -fobjc-std=objc1 @gol
238 -fno-local-ivars @gol
239 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
240 -freplace-objc-classes @gol
241 -fzero-link @gol
242 -gen-decls @gol
243 -Wassign-intercept @gol
244 -Wno-protocol -Wselector @gol
245 -Wstrict-selector-match @gol
246 -Wundeclared-selector}
247
248 @item Diagnostic Message Formatting Options
249 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
250 @gccoptlist{-fmessage-length=@var{n} @gol
251 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
252 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
253 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
254 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
255 -fdiagnostics-show-template-tree -fno-elide-type @gol
256 -fno-show-column}
257
258 @item Warning Options
259 @xref{Warning Options,,Options to Request or Suppress Warnings}.
260 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
261 -pedantic-errors @gol
262 -w -Wextra -Wall -Waddress -Waggregate-return @gol
263 -Walloc-zero -Walloc-size-larger-than=@var{n}
264 -Walloca -Walloca-larger-than=@var{n} @gol
265 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
266 -Wno-attributes -Wbool-compare -Wbool-operation @gol
267 -Wno-builtin-declaration-mismatch @gol
268 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
269 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
270 -Wchar-subscripts -Wchkp -Wcatch-value -Wcatch-value=@var{n} @gol
271 -Wclobbered -Wcomment -Wconditionally-supported @gol
272 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
273 -Wdelete-incomplete @gol
274 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
275 -Wdisabled-optimization @gol
276 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
277 -Wno-div-by-zero -Wdouble-promotion @gol
278 -Wduplicated-branches -Wduplicated-cond @gol
279 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
280 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
281 -Wfloat-equal -Wformat -Wformat=2 @gol
282 -Wno-format-contains-nul -Wno-format-extra-args @gol
283 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
284 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
285 -Wformat-y2k -Wframe-address @gol
286 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
287 -Wif-not-aligned @gol
288 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
289 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
290 -Wimplicit-function-declaration -Wimplicit-int @gol
291 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
292 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
293 -Winvalid-pch -Wlarger-than=@var{len} @gol
294 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
295 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
296 -Wmisleading-indentation -Wmissing-braces @gol
297 -Wmissing-field-initializers -Wmissing-include-dirs @gol
298 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
299 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
300 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
301 -Woverride-init-side-effects -Woverlength-strings @gol
302 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
303 -Wparentheses -Wno-pedantic-ms-format @gol
304 -Wplacement-new -Wplacement-new=@var{n} @gol
305 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
306 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
307 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
308 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
309 -Wshift-overflow -Wshift-overflow=@var{n} @gol
310 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
311 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
312 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
313 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
314 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
315 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
316 -Wstringop-overflow=@var{n} @gol
317 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
318 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
319 -Wmissing-format-attribute -Wsubobject-linkage @gol
320 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
321 -Wswitch-unreachable -Wsync-nand @gol
322 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
323 -Wtype-limits -Wundef @gol
324 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
325 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
326 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
327 -Wunused-parameter -Wno-unused-result @gol
328 -Wunused-value -Wunused-variable @gol
329 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
330 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
331 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
332 -Wvla -Wvla-larger-than=@var{n} -Wvolatile-register-var -Wwrite-strings @gol
333 -Wzero-as-null-pointer-constant -Whsa}
334
335 @item C and Objective-C-only Warning Options
336 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
337 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
338 -Wold-style-declaration -Wold-style-definition @gol
339 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
340 -Wdeclaration-after-statement -Wpointer-sign}
341
342 @item Debugging Options
343 @xref{Debugging Options,,Options for Debugging Your Program}.
344 @gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol
345 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
346 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
347 -gcolumn-info -gno-column-info @gol
348 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
349 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
350 -fno-eliminate-unused-debug-types @gol
351 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
352 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
353 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
354 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
355 -fvar-tracking -fvar-tracking-assignments}
356
357 @item Optimization Options
358 @xref{Optimize Options,,Options that Control Optimization}.
359 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
360 -falign-jumps[=@var{n}] @gol
361 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
362 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
363 -fauto-inc-dec -fbranch-probabilities @gol
364 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
365 -fbtr-bb-exclusive -fcaller-saves @gol
366 -fcombine-stack-adjustments -fconserve-stack @gol
367 -fcompare-elim -fcprop-registers -fcrossjumping @gol
368 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
369 -fcx-limited-range @gol
370 -fdata-sections -fdce -fdelayed-branch @gol
371 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
372 -fdevirtualize-at-ltrans -fdse @gol
373 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
374 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
375 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
376 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
377 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
378 -fif-conversion2 -findirect-inlining @gol
379 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
380 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
381 -fipa-bit-cp -fipa-vrp @gol
382 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
383 -fira-algorithm=@var{algorithm} @gol
384 -fira-region=@var{region} -fira-hoist-pressure @gol
385 -fira-loop-pressure -fno-ira-share-save-slots @gol
386 -fno-ira-share-spill-slots @gol
387 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
388 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
389 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
390 -floop-block -floop-interchange -floop-strip-mine @gol
391 -floop-unroll-and-jam -floop-nest-optimize @gol
392 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
393 -flto-partition=@var{alg} -fmerge-all-constants @gol
394 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
395 -fmove-loop-invariants -fno-branch-count-reg @gol
396 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
397 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
398 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
399 -fno-sched-spec -fno-signed-zeros @gol
400 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
401 -fomit-frame-pointer -foptimize-sibling-calls @gol
402 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
403 -fprefetch-loop-arrays @gol
404 -fprofile-correction @gol
405 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
406 -fprofile-reorder-functions @gol
407 -freciprocal-math -free -frename-registers -freorder-blocks @gol
408 -freorder-blocks-algorithm=@var{algorithm} @gol
409 -freorder-blocks-and-partition -freorder-functions @gol
410 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
411 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
412 -fsched-spec-load -fsched-spec-load-dangerous @gol
413 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
414 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
415 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
416 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
417 -fschedule-fusion @gol
418 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
419 -fselective-scheduling -fselective-scheduling2 @gol
420 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
421 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
422 -fsignaling-nans @gol
423 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
424 -fsplit-paths @gol
425 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
426 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
427 -fthread-jumps -ftracer -ftree-bit-ccp @gol
428 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
429 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
430 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
431 -ftree-loop-if-convert -ftree-loop-im @gol
432 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
433 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
434 -ftree-loop-vectorize @gol
435 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
436 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
437 -ftree-switch-conversion -ftree-tail-merge @gol
438 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
439 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
440 -funsafe-math-optimizations -funswitch-loops @gol
441 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
442 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
443 --param @var{name}=@var{value}
444 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
445
446 @item Program Instrumentation Options
447 @xref{Instrumentation Options,,Program Instrumentation Options}.
448 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
449 -fprofile-abs-path @gol
450 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
451 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
452 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
453 -fsanitize-undefined-trap-on-error -fbounds-check @gol
454 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
455 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
456 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
457 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
458 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
459 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
460 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
461 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
462 -fchkp-use-wrappers -fchkp-flexible-struct-trailing-arrays@gol
463 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
464 -fstack-protector-explicit -fstack-check @gol
465 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
466 -fno-stack-limit -fsplit-stack @gol
467 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
468 -fvtv-counts -fvtv-debug @gol
469 -finstrument-functions @gol
470 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
471 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
472
473 @item Preprocessor Options
474 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
475 @gccoptlist{-A@var{question}=@var{answer} @gol
476 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
477 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
478 -dD -dI -dM -dN -dU @gol
479 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
480 -fexec-charset=@var{charset} -fextended-identifiers @gol
481 -finput-charset=@var{charset} -fno-canonical-system-headers @gol
482 -fpch-deps -fpch-preprocess -fpreprocessed @gol
483 -ftabstop=@var{width} -ftrack-macro-expansion @gol
484 -fwide-exec-charset=@var{charset} -fworking-directory @gol
485 -H -imacros @var{file} -include @var{file} @gol
486 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
487 -no-integrated-cpp -P -pthread -remap @gol
488 -traditional -traditional-cpp -trigraphs @gol
489 -U@var{macro} -undef @gol
490 -Wp,@var{option} -Xpreprocessor @var{option}}
491
492 @item Assembler Options
493 @xref{Assembler Options,,Passing Options to the Assembler}.
494 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
495
496 @item Linker Options
497 @xref{Link Options,,Options for Linking}.
498 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
499 -nostartfiles -nodefaultlibs -nostdlib -pie -pthread -rdynamic @gol
500 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
501 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
502 -static-libmpx -static-libmpxwrappers @gol
503 -shared -shared-libgcc -symbolic @gol
504 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
505 -u @var{symbol} -z @var{keyword}}
506
507 @item Directory Options
508 @xref{Directory Options,,Options for Directory Search}.
509 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
510 -idirafter @var{dir} @gol
511 -imacros @var{file} -imultilib @var{dir} @gol
512 -iplugindir=@var{dir} -iprefix @var{file} @gol
513 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
514 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
515 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
516 -nostdinc -nostdinc++ --sysroot=@var{dir}}
517
518 @item Code Generation Options
519 @xref{Code Gen Options,,Options for Code Generation Conventions}.
520 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
521 -ffixed-@var{reg} -fexceptions @gol
522 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
523 -fasynchronous-unwind-tables @gol
524 -fno-gnu-unique @gol
525 -finhibit-size-directive -fno-common -fno-ident @gol
526 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
527 -fno-jump-tables @gol
528 -frecord-gcc-switches @gol
529 -freg-struct-return -fshort-enums -fshort-wchar @gol
530 -fverbose-asm -fpack-struct[=@var{n}] @gol
531 -fleading-underscore -ftls-model=@var{model} @gol
532 -fstack-reuse=@var{reuse_level} @gol
533 -ftrampolines -ftrapv -fwrapv @gol
534 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
535 -fstrict-volatile-bitfields -fsync-libcalls}
536
537 @item Developer Options
538 @xref{Developer Options,,GCC Developer Options}.
539 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
540 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
541 -fdbg-cnt=@var{counter-value-list} @gol
542 -fdisable-ipa-@var{pass_name} @gol
543 -fdisable-rtl-@var{pass_name} @gol
544 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
545 -fdisable-tree-@var{pass_name} @gol
546 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
547 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
548 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
549 -fdump-final-insns@r{[}=@var{file}@r{]}
550 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
551 -fdump-lang-all @gol
552 -fdump-lang-@var{switch} @gol
553 -fdump-lang-@var{switch}-@var{options} @gol
554 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
555 -fdump-passes @gol
556 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
557 -fdump-statistics @gol
558 -fdump-tree-all @gol
559 -fdump-tree-@var{switch} @gol
560 -fdump-tree-@var{switch}-@var{options} @gol
561 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
562 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
563 -fenable-@var{kind}-@var{pass} @gol
564 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
565 -fira-verbose=@var{n} @gol
566 -flto-report -flto-report-wpa -fmem-report-wpa @gol
567 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
568 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
569 -fprofile-report @gol
570 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
571 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
572 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
573 -fvar-tracking-assignments-toggle -gtoggle @gol
574 -print-file-name=@var{library} -print-libgcc-file-name @gol
575 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
576 -print-prog-name=@var{program} -print-search-dirs -Q @gol
577 -print-sysroot -print-sysroot-headers-suffix @gol
578 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
579
580 @item Machine-Dependent Options
581 @xref{Submodel Options,,Machine-Dependent Options}.
582 @c This list is ordered alphanumerically by subsection name.
583 @c Try and put the significant identifier (CPU or system) first,
584 @c so users have a clue at guessing where the ones they want will be.
585
586 @emph{AArch64 Options}
587 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
588 -mgeneral-regs-only @gol
589 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
590 -mstrict-align @gol
591 -momit-leaf-frame-pointer @gol
592 -mtls-dialect=desc -mtls-dialect=traditional @gol
593 -mtls-size=@var{size} @gol
594 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
595 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
596 -mpc-relative-literal-loads @gol
597 -msign-return-address=@var{scope} @gol
598 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} -moverride=@var{string}}
599
600 @emph{Adapteva Epiphany Options}
601 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
602 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
603 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
604 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
605 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
606 -msplit-vecmove-early -m1reg-@var{reg}}
607
608 @emph{ARC Options}
609 @gccoptlist{-mbarrel-shifter @gol
610 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
611 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
612 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
613 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
614 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
615 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
616 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
617 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
618 -mvolatile-cache -mtp-regno=@var{regno} @gol
619 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
620 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
621 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
622 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
623 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
624 -mtune=@var{cpu} -mmultcost=@var{num} @gol
625 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
626 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
627
628 @emph{ARM Options}
629 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
630 -mabi=@var{name} @gol
631 -mapcs-stack-check -mno-apcs-stack-check @gol
632 -mapcs-reentrant -mno-apcs-reentrant @gol
633 -msched-prolog -mno-sched-prolog @gol
634 -mlittle-endian -mbig-endian @gol
635 -mbe8 -mbe32 @gol
636 -mfloat-abi=@var{name} @gol
637 -mfp16-format=@var{name}
638 -mthumb-interwork -mno-thumb-interwork @gol
639 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
640 -mtune=@var{name} -mprint-tune-info @gol
641 -mstructure-size-boundary=@var{n} @gol
642 -mabort-on-noreturn @gol
643 -mlong-calls -mno-long-calls @gol
644 -msingle-pic-base -mno-single-pic-base @gol
645 -mpic-register=@var{reg} @gol
646 -mnop-fun-dllimport @gol
647 -mpoke-function-name @gol
648 -mthumb -marm @gol
649 -mtpcs-frame -mtpcs-leaf-frame @gol
650 -mcaller-super-interworking -mcallee-super-interworking @gol
651 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
652 -mword-relocations @gol
653 -mfix-cortex-m3-ldrd @gol
654 -munaligned-access @gol
655 -mneon-for-64bits @gol
656 -mslow-flash-data @gol
657 -masm-syntax-unified @gol
658 -mrestrict-it @gol
659 -mpure-code @gol
660 -mcmse}
661
662 @emph{AVR Options}
663 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
664 -mbranch-cost=@var{cost} @gol
665 -mcall-prologues -mgas-isr-prologues -mint8 @gol
666 -mn_flash=@var{size} -mno-interrupts @gol
667 -mrelax -mrmw -mstrict-X -mtiny-stack -mfract-convert-truncate @gol
668 -mshort-calls -nodevicelib @gol
669 -Waddr-space-convert -Wmisspelled-isr}
670
671 @emph{Blackfin Options}
672 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
673 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
674 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
675 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
676 -mno-id-shared-library -mshared-library-id=@var{n} @gol
677 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
678 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
679 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
680 -micplb}
681
682 @emph{C6X Options}
683 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
684 -msim -msdata=@var{sdata-type}}
685
686 @emph{CRIS Options}
687 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
688 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
689 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
690 -mstack-align -mdata-align -mconst-align @gol
691 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
692 -melf -maout -melinux -mlinux -sim -sim2 @gol
693 -mmul-bug-workaround -mno-mul-bug-workaround}
694
695 @emph{CR16 Options}
696 @gccoptlist{-mmac @gol
697 -mcr16cplus -mcr16c @gol
698 -msim -mint32 -mbit-ops
699 -mdata-model=@var{model}}
700
701 @emph{Darwin Options}
702 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
703 -arch_only -bind_at_load -bundle -bundle_loader @gol
704 -client_name -compatibility_version -current_version @gol
705 -dead_strip @gol
706 -dependency-file -dylib_file -dylinker_install_name @gol
707 -dynamic -dynamiclib -exported_symbols_list @gol
708 -filelist -flat_namespace -force_cpusubtype_ALL @gol
709 -force_flat_namespace -headerpad_max_install_names @gol
710 -iframework @gol
711 -image_base -init -install_name -keep_private_externs @gol
712 -multi_module -multiply_defined -multiply_defined_unused @gol
713 -noall_load -no_dead_strip_inits_and_terms @gol
714 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
715 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
716 -private_bundle -read_only_relocs -sectalign @gol
717 -sectobjectsymbols -whyload -seg1addr @gol
718 -sectcreate -sectobjectsymbols -sectorder @gol
719 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
720 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
721 -segprot -segs_read_only_addr -segs_read_write_addr @gol
722 -single_module -static -sub_library -sub_umbrella @gol
723 -twolevel_namespace -umbrella -undefined @gol
724 -unexported_symbols_list -weak_reference_mismatches @gol
725 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
726 -mkernel -mone-byte-bool}
727
728 @emph{DEC Alpha Options}
729 @gccoptlist{-mno-fp-regs -msoft-float @gol
730 -mieee -mieee-with-inexact -mieee-conformant @gol
731 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
732 -mtrap-precision=@var{mode} -mbuild-constants @gol
733 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
734 -mbwx -mmax -mfix -mcix @gol
735 -mfloat-vax -mfloat-ieee @gol
736 -mexplicit-relocs -msmall-data -mlarge-data @gol
737 -msmall-text -mlarge-text @gol
738 -mmemory-latency=@var{time}}
739
740 @emph{FR30 Options}
741 @gccoptlist{-msmall-model -mno-lsim}
742
743 @emph{FT32 Options}
744 @gccoptlist{-msim -mlra -mnodiv}
745
746 @emph{FRV Options}
747 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
748 -mhard-float -msoft-float @gol
749 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
750 -mdouble -mno-double @gol
751 -mmedia -mno-media -mmuladd -mno-muladd @gol
752 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
753 -mlinked-fp -mlong-calls -malign-labels @gol
754 -mlibrary-pic -macc-4 -macc-8 @gol
755 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
756 -moptimize-membar -mno-optimize-membar @gol
757 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
758 -mvliw-branch -mno-vliw-branch @gol
759 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
760 -mno-nested-cond-exec -mtomcat-stats @gol
761 -mTLS -mtls @gol
762 -mcpu=@var{cpu}}
763
764 @emph{GNU/Linux Options}
765 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
766 -tno-android-cc -tno-android-ld}
767
768 @emph{H8/300 Options}
769 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
770
771 @emph{HPPA Options}
772 @gccoptlist{-march=@var{architecture-type} @gol
773 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
774 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
775 -mfixed-range=@var{register-range} @gol
776 -mjump-in-delay -mlinker-opt -mlong-calls @gol
777 -mlong-load-store -mno-disable-fpregs @gol
778 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
779 -mno-jump-in-delay -mno-long-load-store @gol
780 -mno-portable-runtime -mno-soft-float @gol
781 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
782 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
783 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
784 -munix=@var{unix-std} -nolibdld -static -threads}
785
786 @emph{IA-64 Options}
787 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
788 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
789 -mconstant-gp -mauto-pic -mfused-madd @gol
790 -minline-float-divide-min-latency @gol
791 -minline-float-divide-max-throughput @gol
792 -mno-inline-float-divide @gol
793 -minline-int-divide-min-latency @gol
794 -minline-int-divide-max-throughput @gol
795 -mno-inline-int-divide @gol
796 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
797 -mno-inline-sqrt @gol
798 -mdwarf2-asm -mearly-stop-bits @gol
799 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
800 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
801 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
802 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
803 -msched-spec-ldc -msched-spec-control-ldc @gol
804 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
805 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
806 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
807 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
808
809 @emph{LM32 Options}
810 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
811 -msign-extend-enabled -muser-enabled}
812
813 @emph{M32R/D Options}
814 @gccoptlist{-m32r2 -m32rx -m32r @gol
815 -mdebug @gol
816 -malign-loops -mno-align-loops @gol
817 -missue-rate=@var{number} @gol
818 -mbranch-cost=@var{number} @gol
819 -mmodel=@var{code-size-model-type} @gol
820 -msdata=@var{sdata-type} @gol
821 -mno-flush-func -mflush-func=@var{name} @gol
822 -mno-flush-trap -mflush-trap=@var{number} @gol
823 -G @var{num}}
824
825 @emph{M32C Options}
826 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
827
828 @emph{M680x0 Options}
829 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
830 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
831 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
832 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
833 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
834 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
835 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
836 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
837 -mxgot -mno-xgot -mlong-jump-table-offsets}
838
839 @emph{MCore Options}
840 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
841 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
842 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
843 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
844 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
845
846 @emph{MeP Options}
847 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
848 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
849 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
850 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
851 -mtiny=@var{n}}
852
853 @emph{MicroBlaze Options}
854 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
855 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
856 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
857 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
858 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
859
860 @emph{MIPS Options}
861 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
862 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
863 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
864 -mips16 -mno-mips16 -mflip-mips16 @gol
865 -minterlink-compressed -mno-interlink-compressed @gol
866 -minterlink-mips16 -mno-interlink-mips16 @gol
867 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
868 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
869 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
870 -mno-float -msingle-float -mdouble-float @gol
871 -modd-spreg -mno-odd-spreg @gol
872 -mabs=@var{mode} -mnan=@var{encoding} @gol
873 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
874 -mmcu -mmno-mcu @gol
875 -meva -mno-eva @gol
876 -mvirt -mno-virt @gol
877 -mxpa -mno-xpa @gol
878 -mmicromips -mno-micromips @gol
879 -mmsa -mno-msa @gol
880 -mfpu=@var{fpu-type} @gol
881 -msmartmips -mno-smartmips @gol
882 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
883 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
884 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
885 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
886 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
887 -membedded-data -mno-embedded-data @gol
888 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
889 -mcode-readable=@var{setting} @gol
890 -msplit-addresses -mno-split-addresses @gol
891 -mexplicit-relocs -mno-explicit-relocs @gol
892 -mcheck-zero-division -mno-check-zero-division @gol
893 -mdivide-traps -mdivide-breaks @gol
894 -mload-store-pairs -mno-load-store-pairs @gol
895 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
896 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
897 -mfix-24k -mno-fix-24k @gol
898 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
899 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
900 -mfix-vr4120 -mno-fix-vr4120 @gol
901 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
902 -mflush-func=@var{func} -mno-flush-func @gol
903 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
904 -mcompact-branches=@var{policy} @gol
905 -mfp-exceptions -mno-fp-exceptions @gol
906 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
907 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
908 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
909 -mframe-header-opt -mno-frame-header-opt}
910
911 @emph{MMIX Options}
912 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
913 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
914 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
915 -mno-base-addresses -msingle-exit -mno-single-exit}
916
917 @emph{MN10300 Options}
918 @gccoptlist{-mmult-bug -mno-mult-bug @gol
919 -mno-am33 -mam33 -mam33-2 -mam34 @gol
920 -mtune=@var{cpu-type} @gol
921 -mreturn-pointer-on-d0 @gol
922 -mno-crt0 -mrelax -mliw -msetlb}
923
924 @emph{Moxie Options}
925 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
926
927 @emph{MSP430 Options}
928 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
929 -mwarn-mcu @gol
930 -mcode-region= -mdata-region= @gol
931 -msilicon-errata= -msilicon-errata-warn= @gol
932 -mhwmult= -minrt}
933
934 @emph{NDS32 Options}
935 @gccoptlist{-mbig-endian -mlittle-endian @gol
936 -mreduced-regs -mfull-regs @gol
937 -mcmov -mno-cmov @gol
938 -mperf-ext -mno-perf-ext @gol
939 -mv3push -mno-v3push @gol
940 -m16bit -mno-16bit @gol
941 -misr-vector-size=@var{num} @gol
942 -mcache-block-size=@var{num} @gol
943 -march=@var{arch} @gol
944 -mcmodel=@var{code-model} @gol
945 -mctor-dtor -mrelax}
946
947 @emph{Nios II Options}
948 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
949 -mel -meb @gol
950 -mno-bypass-cache -mbypass-cache @gol
951 -mno-cache-volatile -mcache-volatile @gol
952 -mno-fast-sw-div -mfast-sw-div @gol
953 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
954 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
955 -mcustom-fpu-cfg=@var{name} @gol
956 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
957 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
958
959 @emph{Nvidia PTX Options}
960 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
961
962 @emph{PDP-11 Options}
963 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
964 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
965 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
966 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
967 -mbranch-expensive -mbranch-cheap @gol
968 -munix-asm -mdec-asm}
969
970 @emph{picoChip Options}
971 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
972 -msymbol-as-address -mno-inefficient-warnings}
973
974 @emph{PowerPC Options}
975 See RS/6000 and PowerPC Options.
976
977 @emph{RISC-V Options}
978 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
979 -mmemcpy -mno-memcpy @gol
980 -mplt -mno-plt @gol
981 -mabi=@var{ABI-string} @gol
982 -mfdiv -mno-fdiv @gol
983 -mdiv -mno-div @gol
984 -march=@var{ISA-string} @gol
985 -mtune=@var{processor-string} @gol
986 -msmall-data-limit=@var{N-bytes} @gol
987 -msave-restore -mno-save-restore @gol
988 -mstrict-align -mno-strict-align @gol
989 -mcmodel=@var{code-model} @gol
990 -mexplicit-relocs -mno-explicit-relocs @gol}
991
992 @emph{RL78 Options}
993 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
994 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
995 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
996
997 @emph{RS/6000 and PowerPC Options}
998 @gccoptlist{-mcpu=@var{cpu-type} @gol
999 -mtune=@var{cpu-type} @gol
1000 -mcmodel=@var{code-model} @gol
1001 -mpowerpc64 @gol
1002 -maltivec -mno-altivec @gol
1003 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1004 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1005 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1006 -mfprnd -mno-fprnd @gol
1007 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1008 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1009 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1010 -malign-power -malign-natural @gol
1011 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1012 -msingle-float -mdouble-float -msimple-fpu @gol
1013 -mstring -mno-string -mupdate -mno-update @gol
1014 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1015 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1016 -mstrict-align -mno-strict-align -mrelocatable @gol
1017 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1018 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1019 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1020 -mprioritize-restricted-insns=@var{priority} @gol
1021 -msched-costly-dep=@var{dependence_type} @gol
1022 -minsert-sched-nops=@var{scheme} @gol
1023 -mcall-sysv -mcall-netbsd @gol
1024 -maix-struct-return -msvr4-struct-return @gol
1025 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1026 -mblock-move-inline-limit=@var{num} @gol
1027 -misel -mno-isel @gol
1028 -misel=yes -misel=no @gol
1029 -mspe -mno-spe @gol
1030 -mspe=yes -mspe=no @gol
1031 -mpaired @gol
1032 -mvrsave -mno-vrsave @gol
1033 -mmulhw -mno-mulhw @gol
1034 -mdlmzb -mno-dlmzb @gol
1035 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1036 -mprototype -mno-prototype @gol
1037 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1038 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1039 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1040 -mno-recip-precision @gol
1041 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1042 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1043 -msave-toc-indirect -mno-save-toc-indirect @gol
1044 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1045 -mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol
1046 -mquad-memory -mno-quad-memory @gol
1047 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1048 -mcompat-align-parm -mno-compat-align-parm @gol
1049 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1050 -mgnu-attribute -mno-gnu-attribute @gol
1051 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1052 -mstack-protector-guard-offset=@var{offset}}
1053
1054 @emph{RX Options}
1055 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1056 -mcpu=@gol
1057 -mbig-endian-data -mlittle-endian-data @gol
1058 -msmall-data @gol
1059 -msim -mno-sim@gol
1060 -mas100-syntax -mno-as100-syntax@gol
1061 -mrelax@gol
1062 -mmax-constant-size=@gol
1063 -mint-register=@gol
1064 -mpid@gol
1065 -mallow-string-insns -mno-allow-string-insns@gol
1066 -mjsr@gol
1067 -mno-warn-multiple-fast-interrupts@gol
1068 -msave-acc-in-interrupts}
1069
1070 @emph{S/390 and zSeries Options}
1071 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1072 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1073 -mlong-double-64 -mlong-double-128 @gol
1074 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1075 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1076 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1077 -mhtm -mvx -mzvector @gol
1078 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1079 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1080 -mhotpatch=@var{halfwords},@var{halfwords}}
1081
1082 @emph{Score Options}
1083 @gccoptlist{-meb -mel @gol
1084 -mnhwloop @gol
1085 -muls @gol
1086 -mmac @gol
1087 -mscore5 -mscore5u -mscore7 -mscore7d}
1088
1089 @emph{SH Options}
1090 @gccoptlist{-m1 -m2 -m2e @gol
1091 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1092 -m3 -m3e @gol
1093 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1094 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1095 -mb -ml -mdalign -mrelax @gol
1096 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1097 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1098 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1099 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1100 -maccumulate-outgoing-args @gol
1101 -matomic-model=@var{atomic-model} @gol
1102 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1103 -mcbranch-force-delay-slot @gol
1104 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1105 -mpretend-cmove -mtas}
1106
1107 @emph{Solaris 2 Options}
1108 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1109 -pthreads}
1110
1111 @emph{SPARC Options}
1112 @gccoptlist{-mcpu=@var{cpu-type} @gol
1113 -mtune=@var{cpu-type} @gol
1114 -mcmodel=@var{code-model} @gol
1115 -mmemory-model=@var{mem-model} @gol
1116 -m32 -m64 -mapp-regs -mno-app-regs @gol
1117 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1118 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1119 -mhard-quad-float -msoft-quad-float @gol
1120 -mstack-bias -mno-stack-bias @gol
1121 -mstd-struct-return -mno-std-struct-return @gol
1122 -munaligned-doubles -mno-unaligned-doubles @gol
1123 -muser-mode -mno-user-mode @gol
1124 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1125 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1126 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1127 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1128 -mpopc -mno-popc -msubxc -mno-subxc @gol
1129 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1130 -mlra -mno-lra}
1131
1132 @emph{SPU Options}
1133 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1134 -msafe-dma -munsafe-dma @gol
1135 -mbranch-hints @gol
1136 -msmall-mem -mlarge-mem -mstdmain @gol
1137 -mfixed-range=@var{register-range} @gol
1138 -mea32 -mea64 @gol
1139 -maddress-space-conversion -mno-address-space-conversion @gol
1140 -mcache-size=@var{cache-size} @gol
1141 -matomic-updates -mno-atomic-updates}
1142
1143 @emph{System V Options}
1144 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1145
1146 @emph{TILE-Gx Options}
1147 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1148 -mcmodel=@var{code-model}}
1149
1150 @emph{TILEPro Options}
1151 @gccoptlist{-mcpu=@var{cpu} -m32}
1152
1153 @emph{V850 Options}
1154 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1155 -mprolog-function -mno-prolog-function -mspace @gol
1156 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1157 -mapp-regs -mno-app-regs @gol
1158 -mdisable-callt -mno-disable-callt @gol
1159 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1160 -mv850e -mv850 -mv850e3v5 @gol
1161 -mloop @gol
1162 -mrelax @gol
1163 -mlong-jumps @gol
1164 -msoft-float @gol
1165 -mhard-float @gol
1166 -mgcc-abi @gol
1167 -mrh850-abi @gol
1168 -mbig-switch}
1169
1170 @emph{VAX Options}
1171 @gccoptlist{-mg -mgnu -munix}
1172
1173 @emph{Visium Options}
1174 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1175 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1176
1177 @emph{VMS Options}
1178 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1179 -mpointer-size=@var{size}}
1180
1181 @emph{VxWorks Options}
1182 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1183 -Xbind-lazy -Xbind-now}
1184
1185 @emph{x86 Options}
1186 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1187 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1188 -mfpmath=@var{unit} @gol
1189 -masm=@var{dialect} -mno-fancy-math-387 @gol
1190 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1191 -mno-wide-multiply -mrtd -malign-double @gol
1192 -mpreferred-stack-boundary=@var{num} @gol
1193 -mincoming-stack-boundary=@var{num} @gol
1194 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1195 -mrecip -mrecip=@var{opt} @gol
1196 -mvzeroupper -mprefer-avx128 @gol
1197 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1198 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1199 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1200 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1201 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1202 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1203 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx @gol
1204 -mmwaitx -mclzero -mpku -mthreads @gol
1205 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1206 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1207 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1208 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1209 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1210 -mregparm=@var{num} -msseregparm @gol
1211 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1212 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1213 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1214 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1215 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1216 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1217 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1218 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1219 -mstack-protector-guard-reg=@var{reg} @gol
1220 -mstack-protector-guard-offset=@var{offset} @gol
1221 -mstack-protector-guard-symbol=@var{symbol} -mmitigate-rop @gol
1222 -mgeneral-regs-only -mcall-ms2sysv-xlogues}
1223
1224 @emph{x86 Windows Options}
1225 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1226 -mnop-fun-dllimport -mthread @gol
1227 -municode -mwin32 -mwindows -fno-set-stack-executable}
1228
1229 @emph{Xstormy16 Options}
1230 @gccoptlist{-msim}
1231
1232 @emph{Xtensa Options}
1233 @gccoptlist{-mconst16 -mno-const16 @gol
1234 -mfused-madd -mno-fused-madd @gol
1235 -mforce-no-pic @gol
1236 -mserialize-volatile -mno-serialize-volatile @gol
1237 -mtext-section-literals -mno-text-section-literals @gol
1238 -mauto-litpools -mno-auto-litpools @gol
1239 -mtarget-align -mno-target-align @gol
1240 -mlongcalls -mno-longcalls}
1241
1242 @emph{zSeries Options}
1243 See S/390 and zSeries Options.
1244 @end table
1245
1246
1247 @node Overall Options
1248 @section Options Controlling the Kind of Output
1249
1250 Compilation can involve up to four stages: preprocessing, compilation
1251 proper, assembly and linking, always in that order. GCC is capable of
1252 preprocessing and compiling several files either into several
1253 assembler input files, or into one assembler input file; then each
1254 assembler input file produces an object file, and linking combines all
1255 the object files (those newly compiled, and those specified as input)
1256 into an executable file.
1257
1258 @cindex file name suffix
1259 For any given input file, the file name suffix determines what kind of
1260 compilation is done:
1261
1262 @table @gcctabopt
1263 @item @var{file}.c
1264 C source code that must be preprocessed.
1265
1266 @item @var{file}.i
1267 C source code that should not be preprocessed.
1268
1269 @item @var{file}.ii
1270 C++ source code that should not be preprocessed.
1271
1272 @item @var{file}.m
1273 Objective-C source code. Note that you must link with the @file{libobjc}
1274 library to make an Objective-C program work.
1275
1276 @item @var{file}.mi
1277 Objective-C source code that should not be preprocessed.
1278
1279 @item @var{file}.mm
1280 @itemx @var{file}.M
1281 Objective-C++ source code. Note that you must link with the @file{libobjc}
1282 library to make an Objective-C++ program work. Note that @samp{.M} refers
1283 to a literal capital M@.
1284
1285 @item @var{file}.mii
1286 Objective-C++ source code that should not be preprocessed.
1287
1288 @item @var{file}.h
1289 C, C++, Objective-C or Objective-C++ header file to be turned into a
1290 precompiled header (default), or C, C++ header file to be turned into an
1291 Ada spec (via the @option{-fdump-ada-spec} switch).
1292
1293 @item @var{file}.cc
1294 @itemx @var{file}.cp
1295 @itemx @var{file}.cxx
1296 @itemx @var{file}.cpp
1297 @itemx @var{file}.CPP
1298 @itemx @var{file}.c++
1299 @itemx @var{file}.C
1300 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1301 the last two letters must both be literally @samp{x}. Likewise,
1302 @samp{.C} refers to a literal capital C@.
1303
1304 @item @var{file}.mm
1305 @itemx @var{file}.M
1306 Objective-C++ source code that must be preprocessed.
1307
1308 @item @var{file}.mii
1309 Objective-C++ source code that should not be preprocessed.
1310
1311 @item @var{file}.hh
1312 @itemx @var{file}.H
1313 @itemx @var{file}.hp
1314 @itemx @var{file}.hxx
1315 @itemx @var{file}.hpp
1316 @itemx @var{file}.HPP
1317 @itemx @var{file}.h++
1318 @itemx @var{file}.tcc
1319 C++ header file to be turned into a precompiled header or Ada spec.
1320
1321 @item @var{file}.f
1322 @itemx @var{file}.for
1323 @itemx @var{file}.ftn
1324 Fixed form Fortran source code that should not be preprocessed.
1325
1326 @item @var{file}.F
1327 @itemx @var{file}.FOR
1328 @itemx @var{file}.fpp
1329 @itemx @var{file}.FPP
1330 @itemx @var{file}.FTN
1331 Fixed form Fortran source code that must be preprocessed (with the traditional
1332 preprocessor).
1333
1334 @item @var{file}.f90
1335 @itemx @var{file}.f95
1336 @itemx @var{file}.f03
1337 @itemx @var{file}.f08
1338 Free form Fortran source code that should not be preprocessed.
1339
1340 @item @var{file}.F90
1341 @itemx @var{file}.F95
1342 @itemx @var{file}.F03
1343 @itemx @var{file}.F08
1344 Free form Fortran source code that must be preprocessed (with the
1345 traditional preprocessor).
1346
1347 @item @var{file}.go
1348 Go source code.
1349
1350 @item @var{file}.brig
1351 BRIG files (binary representation of HSAIL).
1352
1353 @item @var{file}.ads
1354 Ada source code file that contains a library unit declaration (a
1355 declaration of a package, subprogram, or generic, or a generic
1356 instantiation), or a library unit renaming declaration (a package,
1357 generic, or subprogram renaming declaration). Such files are also
1358 called @dfn{specs}.
1359
1360 @item @var{file}.adb
1361 Ada source code file containing a library unit body (a subprogram or
1362 package body). Such files are also called @dfn{bodies}.
1363
1364 @c GCC also knows about some suffixes for languages not yet included:
1365 @c Pascal:
1366 @c @var{file}.p
1367 @c @var{file}.pas
1368 @c Ratfor:
1369 @c @var{file}.r
1370
1371 @item @var{file}.s
1372 Assembler code.
1373
1374 @item @var{file}.S
1375 @itemx @var{file}.sx
1376 Assembler code that must be preprocessed.
1377
1378 @item @var{other}
1379 An object file to be fed straight into linking.
1380 Any file name with no recognized suffix is treated this way.
1381 @end table
1382
1383 @opindex x
1384 You can specify the input language explicitly with the @option{-x} option:
1385
1386 @table @gcctabopt
1387 @item -x @var{language}
1388 Specify explicitly the @var{language} for the following input files
1389 (rather than letting the compiler choose a default based on the file
1390 name suffix). This option applies to all following input files until
1391 the next @option{-x} option. Possible values for @var{language} are:
1392 @smallexample
1393 c c-header cpp-output
1394 c++ c++-header c++-cpp-output
1395 objective-c objective-c-header objective-c-cpp-output
1396 objective-c++ objective-c++-header objective-c++-cpp-output
1397 assembler assembler-with-cpp
1398 ada
1399 f77 f77-cpp-input f95 f95-cpp-input
1400 go
1401 brig
1402 @end smallexample
1403
1404 @item -x none
1405 Turn off any specification of a language, so that subsequent files are
1406 handled according to their file name suffixes (as they are if @option{-x}
1407 has not been used at all).
1408 @end table
1409
1410 If you only want some of the stages of compilation, you can use
1411 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1412 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1413 @command{gcc} is to stop. Note that some combinations (for example,
1414 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1415
1416 @table @gcctabopt
1417 @item -c
1418 @opindex c
1419 Compile or assemble the source files, but do not link. The linking
1420 stage simply is not done. The ultimate output is in the form of an
1421 object file for each source file.
1422
1423 By default, the object file name for a source file is made by replacing
1424 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1425
1426 Unrecognized input files, not requiring compilation or assembly, are
1427 ignored.
1428
1429 @item -S
1430 @opindex S
1431 Stop after the stage of compilation proper; do not assemble. The output
1432 is in the form of an assembler code file for each non-assembler input
1433 file specified.
1434
1435 By default, the assembler file name for a source file is made by
1436 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1437
1438 Input files that don't require compilation are ignored.
1439
1440 @item -E
1441 @opindex E
1442 Stop after the preprocessing stage; do not run the compiler proper. The
1443 output is in the form of preprocessed source code, which is sent to the
1444 standard output.
1445
1446 Input files that don't require preprocessing are ignored.
1447
1448 @cindex output file option
1449 @item -o @var{file}
1450 @opindex o
1451 Place output in file @var{file}. This applies to whatever
1452 sort of output is being produced, whether it be an executable file,
1453 an object file, an assembler file or preprocessed C code.
1454
1455 If @option{-o} is not specified, the default is to put an executable
1456 file in @file{a.out}, the object file for
1457 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1458 assembler file in @file{@var{source}.s}, a precompiled header file in
1459 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1460 standard output.
1461
1462 @item -v
1463 @opindex v
1464 Print (on standard error output) the commands executed to run the stages
1465 of compilation. Also print the version number of the compiler driver
1466 program and of the preprocessor and the compiler proper.
1467
1468 @item -###
1469 @opindex ###
1470 Like @option{-v} except the commands are not executed and arguments
1471 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1472 This is useful for shell scripts to capture the driver-generated command lines.
1473
1474 @item --help
1475 @opindex help
1476 Print (on the standard output) a description of the command-line options
1477 understood by @command{gcc}. If the @option{-v} option is also specified
1478 then @option{--help} is also passed on to the various processes
1479 invoked by @command{gcc}, so that they can display the command-line options
1480 they accept. If the @option{-Wextra} option has also been specified
1481 (prior to the @option{--help} option), then command-line options that
1482 have no documentation associated with them are also displayed.
1483
1484 @item --target-help
1485 @opindex target-help
1486 Print (on the standard output) a description of target-specific command-line
1487 options for each tool. For some targets extra target-specific
1488 information may also be printed.
1489
1490 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1491 Print (on the standard output) a description of the command-line
1492 options understood by the compiler that fit into all specified classes
1493 and qualifiers. These are the supported classes:
1494
1495 @table @asis
1496 @item @samp{optimizers}
1497 Display all of the optimization options supported by the
1498 compiler.
1499
1500 @item @samp{warnings}
1501 Display all of the options controlling warning messages
1502 produced by the compiler.
1503
1504 @item @samp{target}
1505 Display target-specific options. Unlike the
1506 @option{--target-help} option however, target-specific options of the
1507 linker and assembler are not displayed. This is because those
1508 tools do not currently support the extended @option{--help=} syntax.
1509
1510 @item @samp{params}
1511 Display the values recognized by the @option{--param}
1512 option.
1513
1514 @item @var{language}
1515 Display the options supported for @var{language}, where
1516 @var{language} is the name of one of the languages supported in this
1517 version of GCC@.
1518
1519 @item @samp{common}
1520 Display the options that are common to all languages.
1521 @end table
1522
1523 These are the supported qualifiers:
1524
1525 @table @asis
1526 @item @samp{undocumented}
1527 Display only those options that are undocumented.
1528
1529 @item @samp{joined}
1530 Display options taking an argument that appears after an equal
1531 sign in the same continuous piece of text, such as:
1532 @samp{--help=target}.
1533
1534 @item @samp{separate}
1535 Display options taking an argument that appears as a separate word
1536 following the original option, such as: @samp{-o output-file}.
1537 @end table
1538
1539 Thus for example to display all the undocumented target-specific
1540 switches supported by the compiler, use:
1541
1542 @smallexample
1543 --help=target,undocumented
1544 @end smallexample
1545
1546 The sense of a qualifier can be inverted by prefixing it with the
1547 @samp{^} character, so for example to display all binary warning
1548 options (i.e., ones that are either on or off and that do not take an
1549 argument) that have a description, use:
1550
1551 @smallexample
1552 --help=warnings,^joined,^undocumented
1553 @end smallexample
1554
1555 The argument to @option{--help=} should not consist solely of inverted
1556 qualifiers.
1557
1558 Combining several classes is possible, although this usually
1559 restricts the output so much that there is nothing to display. One
1560 case where it does work, however, is when one of the classes is
1561 @var{target}. For example, to display all the target-specific
1562 optimization options, use:
1563
1564 @smallexample
1565 --help=target,optimizers
1566 @end smallexample
1567
1568 The @option{--help=} option can be repeated on the command line. Each
1569 successive use displays its requested class of options, skipping
1570 those that have already been displayed.
1571
1572 If the @option{-Q} option appears on the command line before the
1573 @option{--help=} option, then the descriptive text displayed by
1574 @option{--help=} is changed. Instead of describing the displayed
1575 options, an indication is given as to whether the option is enabled,
1576 disabled or set to a specific value (assuming that the compiler
1577 knows this at the point where the @option{--help=} option is used).
1578
1579 Here is a truncated example from the ARM port of @command{gcc}:
1580
1581 @smallexample
1582 % gcc -Q -mabi=2 --help=target -c
1583 The following options are target specific:
1584 -mabi= 2
1585 -mabort-on-noreturn [disabled]
1586 -mapcs [disabled]
1587 @end smallexample
1588
1589 The output is sensitive to the effects of previous command-line
1590 options, so for example it is possible to find out which optimizations
1591 are enabled at @option{-O2} by using:
1592
1593 @smallexample
1594 -Q -O2 --help=optimizers
1595 @end smallexample
1596
1597 Alternatively you can discover which binary optimizations are enabled
1598 by @option{-O3} by using:
1599
1600 @smallexample
1601 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1602 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1603 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1604 @end smallexample
1605
1606 @item --version
1607 @opindex version
1608 Display the version number and copyrights of the invoked GCC@.
1609
1610 @item -pass-exit-codes
1611 @opindex pass-exit-codes
1612 Normally the @command{gcc} program exits with the code of 1 if any
1613 phase of the compiler returns a non-success return code. If you specify
1614 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1615 the numerically highest error produced by any phase returning an error
1616 indication. The C, C++, and Fortran front ends return 4 if an internal
1617 compiler error is encountered.
1618
1619 @item -pipe
1620 @opindex pipe
1621 Use pipes rather than temporary files for communication between the
1622 various stages of compilation. This fails to work on some systems where
1623 the assembler is unable to read from a pipe; but the GNU assembler has
1624 no trouble.
1625
1626 @item -specs=@var{file}
1627 @opindex specs
1628 Process @var{file} after the compiler reads in the standard @file{specs}
1629 file, in order to override the defaults which the @command{gcc} driver
1630 program uses when determining what switches to pass to @command{cc1},
1631 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1632 @option{-specs=@var{file}} can be specified on the command line, and they
1633 are processed in order, from left to right. @xref{Spec Files}, for
1634 information about the format of the @var{file}.
1635
1636 @item -wrapper
1637 @opindex wrapper
1638 Invoke all subcommands under a wrapper program. The name of the
1639 wrapper program and its parameters are passed as a comma separated
1640 list.
1641
1642 @smallexample
1643 gcc -c t.c -wrapper gdb,--args
1644 @end smallexample
1645
1646 @noindent
1647 This invokes all subprograms of @command{gcc} under
1648 @samp{gdb --args}, thus the invocation of @command{cc1} is
1649 @samp{gdb --args cc1 @dots{}}.
1650
1651 @item -fplugin=@var{name}.so
1652 @opindex fplugin
1653 Load the plugin code in file @var{name}.so, assumed to be a
1654 shared object to be dlopen'd by the compiler. The base name of
1655 the shared object file is used to identify the plugin for the
1656 purposes of argument parsing (See
1657 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1658 Each plugin should define the callback functions specified in the
1659 Plugins API.
1660
1661 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1662 @opindex fplugin-arg
1663 Define an argument called @var{key} with a value of @var{value}
1664 for the plugin called @var{name}.
1665
1666 @item -fdump-ada-spec@r{[}-slim@r{]}
1667 @opindex fdump-ada-spec
1668 For C and C++ source and include files, generate corresponding Ada specs.
1669 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1670 GNAT User's Guide}, which provides detailed documentation on this feature.
1671
1672 @item -fada-spec-parent=@var{unit}
1673 @opindex fada-spec-parent
1674 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1675 Ada specs as child units of parent @var{unit}.
1676
1677 @item -fdump-go-spec=@var{file}
1678 @opindex fdump-go-spec
1679 For input files in any language, generate corresponding Go
1680 declarations in @var{file}. This generates Go @code{const},
1681 @code{type}, @code{var}, and @code{func} declarations which may be a
1682 useful way to start writing a Go interface to code written in some
1683 other language.
1684
1685 @include @value{srcdir}/../libiberty/at-file.texi
1686 @end table
1687
1688 @node Invoking G++
1689 @section Compiling C++ Programs
1690
1691 @cindex suffixes for C++ source
1692 @cindex C++ source file suffixes
1693 C++ source files conventionally use one of the suffixes @samp{.C},
1694 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1695 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1696 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1697 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1698 files with these names and compiles them as C++ programs even if you
1699 call the compiler the same way as for compiling C programs (usually
1700 with the name @command{gcc}).
1701
1702 @findex g++
1703 @findex c++
1704 However, the use of @command{gcc} does not add the C++ library.
1705 @command{g++} is a program that calls GCC and automatically specifies linking
1706 against the C++ library. It treats @samp{.c},
1707 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1708 files unless @option{-x} is used. This program is also useful when
1709 precompiling a C header file with a @samp{.h} extension for use in C++
1710 compilations. On many systems, @command{g++} is also installed with
1711 the name @command{c++}.
1712
1713 @cindex invoking @command{g++}
1714 When you compile C++ programs, you may specify many of the same
1715 command-line options that you use for compiling programs in any
1716 language; or command-line options meaningful for C and related
1717 languages; or options that are meaningful only for C++ programs.
1718 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1719 explanations of options for languages related to C@.
1720 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1721 explanations of options that are meaningful only for C++ programs.
1722
1723 @node C Dialect Options
1724 @section Options Controlling C Dialect
1725 @cindex dialect options
1726 @cindex language dialect options
1727 @cindex options, dialect
1728
1729 The following options control the dialect of C (or languages derived
1730 from C, such as C++, Objective-C and Objective-C++) that the compiler
1731 accepts:
1732
1733 @table @gcctabopt
1734 @cindex ANSI support
1735 @cindex ISO support
1736 @item -ansi
1737 @opindex ansi
1738 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1739 equivalent to @option{-std=c++98}.
1740
1741 This turns off certain features of GCC that are incompatible with ISO
1742 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1743 such as the @code{asm} and @code{typeof} keywords, and
1744 predefined macros such as @code{unix} and @code{vax} that identify the
1745 type of system you are using. It also enables the undesirable and
1746 rarely used ISO trigraph feature. For the C compiler,
1747 it disables recognition of C++ style @samp{//} comments as well as
1748 the @code{inline} keyword.
1749
1750 The alternate keywords @code{__asm__}, @code{__extension__},
1751 @code{__inline__} and @code{__typeof__} continue to work despite
1752 @option{-ansi}. You would not want to use them in an ISO C program, of
1753 course, but it is useful to put them in header files that might be included
1754 in compilations done with @option{-ansi}. Alternate predefined macros
1755 such as @code{__unix__} and @code{__vax__} are also available, with or
1756 without @option{-ansi}.
1757
1758 The @option{-ansi} option does not cause non-ISO programs to be
1759 rejected gratuitously. For that, @option{-Wpedantic} is required in
1760 addition to @option{-ansi}. @xref{Warning Options}.
1761
1762 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1763 option is used. Some header files may notice this macro and refrain
1764 from declaring certain functions or defining certain macros that the
1765 ISO standard doesn't call for; this is to avoid interfering with any
1766 programs that might use these names for other things.
1767
1768 Functions that are normally built in but do not have semantics
1769 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1770 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1771 built-in functions provided by GCC}, for details of the functions
1772 affected.
1773
1774 @item -std=
1775 @opindex std
1776 Determine the language standard. @xref{Standards,,Language Standards
1777 Supported by GCC}, for details of these standard versions. This option
1778 is currently only supported when compiling C or C++.
1779
1780 The compiler can accept several base standards, such as @samp{c90} or
1781 @samp{c++98}, and GNU dialects of those standards, such as
1782 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1783 compiler accepts all programs following that standard plus those
1784 using GNU extensions that do not contradict it. For example,
1785 @option{-std=c90} turns off certain features of GCC that are
1786 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1787 keywords, but not other GNU extensions that do not have a meaning in
1788 ISO C90, such as omitting the middle term of a @code{?:}
1789 expression. On the other hand, when a GNU dialect of a standard is
1790 specified, all features supported by the compiler are enabled, even when
1791 those features change the meaning of the base standard. As a result, some
1792 strict-conforming programs may be rejected. The particular standard
1793 is used by @option{-Wpedantic} to identify which features are GNU
1794 extensions given that version of the standard. For example
1795 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1796 comments, while @option{-std=gnu99 -Wpedantic} does not.
1797
1798 A value for this option must be provided; possible values are
1799
1800 @table @samp
1801 @item c90
1802 @itemx c89
1803 @itemx iso9899:1990
1804 Support all ISO C90 programs (certain GNU extensions that conflict
1805 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1806
1807 @item iso9899:199409
1808 ISO C90 as modified in amendment 1.
1809
1810 @item c99
1811 @itemx c9x
1812 @itemx iso9899:1999
1813 @itemx iso9899:199x
1814 ISO C99. This standard is substantially completely supported, modulo
1815 bugs and floating-point issues
1816 (mainly but not entirely relating to optional C99 features from
1817 Annexes F and G). See
1818 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1819 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1820
1821 @item c11
1822 @itemx c1x
1823 @itemx iso9899:2011
1824 ISO C11, the 2011 revision of the ISO C standard. This standard is
1825 substantially completely supported, modulo bugs, floating-point issues
1826 (mainly but not entirely relating to optional C11 features from
1827 Annexes F and G) and the optional Annexes K (Bounds-checking
1828 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1829
1830 @item gnu90
1831 @itemx gnu89
1832 GNU dialect of ISO C90 (including some C99 features).
1833
1834 @item gnu99
1835 @itemx gnu9x
1836 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1837
1838 @item gnu11
1839 @itemx gnu1x
1840 GNU dialect of ISO C11. This is the default for C code.
1841 The name @samp{gnu1x} is deprecated.
1842
1843 @item c++98
1844 @itemx c++03
1845 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1846 additional defect reports. Same as @option{-ansi} for C++ code.
1847
1848 @item gnu++98
1849 @itemx gnu++03
1850 GNU dialect of @option{-std=c++98}.
1851
1852 @item c++11
1853 @itemx c++0x
1854 The 2011 ISO C++ standard plus amendments.
1855 The name @samp{c++0x} is deprecated.
1856
1857 @item gnu++11
1858 @itemx gnu++0x
1859 GNU dialect of @option{-std=c++11}.
1860 The name @samp{gnu++0x} is deprecated.
1861
1862 @item c++14
1863 @itemx c++1y
1864 The 2014 ISO C++ standard plus amendments.
1865 The name @samp{c++1y} is deprecated.
1866
1867 @item gnu++14
1868 @itemx gnu++1y
1869 GNU dialect of @option{-std=c++14}.
1870 This is the default for C++ code.
1871 The name @samp{gnu++1y} is deprecated.
1872
1873 @item c++1z
1874 The next revision of the ISO C++ standard, tentatively planned for
1875 2017. Support is highly experimental, and will almost certainly
1876 change in incompatible ways in future releases.
1877
1878 @item gnu++1z
1879 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1880 and will almost certainly change in incompatible ways in future
1881 releases.
1882 @end table
1883
1884 @item -fgnu89-inline
1885 @opindex fgnu89-inline
1886 The option @option{-fgnu89-inline} tells GCC to use the traditional
1887 GNU semantics for @code{inline} functions when in C99 mode.
1888 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1889 Using this option is roughly equivalent to adding the
1890 @code{gnu_inline} function attribute to all inline functions
1891 (@pxref{Function Attributes}).
1892
1893 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1894 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1895 specifies the default behavior).
1896 This option is not supported in @option{-std=c90} or
1897 @option{-std=gnu90} mode.
1898
1899 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1900 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1901 in effect for @code{inline} functions. @xref{Common Predefined
1902 Macros,,,cpp,The C Preprocessor}.
1903
1904 @item -fpermitted-flt-eval-methods=@var{style}
1905 @opindex fpermitted-flt-eval-methods
1906 @opindex fpermitted-flt-eval-methods=c11
1907 @opindex fpermitted-flt-eval-methods=ts-18661-3
1908 ISO/IEC TS 18661-3 defines new permissible values for
1909 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
1910 a semantic type that is an interchange or extended format should be
1911 evaluated to the precision and range of that type. These new values are
1912 a superset of those permitted under C99/C11, which does not specify the
1913 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
1914 conforming to C11 may not have been written expecting the possibility of
1915 the new values.
1916
1917 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
1918 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
1919 or the extended set of values specified in ISO/IEC TS 18661-3.
1920
1921 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
1922
1923 The default when in a standards compliant mode (@option{-std=c11} or similar)
1924 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
1925 dialect (@option{-std=gnu11} or similar) is
1926 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
1927
1928 @item -aux-info @var{filename}
1929 @opindex aux-info
1930 Output to the given filename prototyped declarations for all functions
1931 declared and/or defined in a translation unit, including those in header
1932 files. This option is silently ignored in any language other than C@.
1933
1934 Besides declarations, the file indicates, in comments, the origin of
1935 each declaration (source file and line), whether the declaration was
1936 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1937 @samp{O} for old, respectively, in the first character after the line
1938 number and the colon), and whether it came from a declaration or a
1939 definition (@samp{C} or @samp{F}, respectively, in the following
1940 character). In the case of function definitions, a K&R-style list of
1941 arguments followed by their declarations is also provided, inside
1942 comments, after the declaration.
1943
1944 @item -fallow-parameterless-variadic-functions
1945 @opindex fallow-parameterless-variadic-functions
1946 Accept variadic functions without named parameters.
1947
1948 Although it is possible to define such a function, this is not very
1949 useful as it is not possible to read the arguments. This is only
1950 supported for C as this construct is allowed by C++.
1951
1952 @item -fno-asm
1953 @opindex fno-asm
1954 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1955 keyword, so that code can use these words as identifiers. You can use
1956 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1957 instead. @option{-ansi} implies @option{-fno-asm}.
1958
1959 In C++, this switch only affects the @code{typeof} keyword, since
1960 @code{asm} and @code{inline} are standard keywords. You may want to
1961 use the @option{-fno-gnu-keywords} flag instead, which has the same
1962 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1963 switch only affects the @code{asm} and @code{typeof} keywords, since
1964 @code{inline} is a standard keyword in ISO C99.
1965
1966 @item -fno-builtin
1967 @itemx -fno-builtin-@var{function}
1968 @opindex fno-builtin
1969 @cindex built-in functions
1970 Don't recognize built-in functions that do not begin with
1971 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1972 functions provided by GCC}, for details of the functions affected,
1973 including those which are not built-in functions when @option{-ansi} or
1974 @option{-std} options for strict ISO C conformance are used because they
1975 do not have an ISO standard meaning.
1976
1977 GCC normally generates special code to handle certain built-in functions
1978 more efficiently; for instance, calls to @code{alloca} may become single
1979 instructions which adjust the stack directly, and calls to @code{memcpy}
1980 may become inline copy loops. The resulting code is often both smaller
1981 and faster, but since the function calls no longer appear as such, you
1982 cannot set a breakpoint on those calls, nor can you change the behavior
1983 of the functions by linking with a different library. In addition,
1984 when a function is recognized as a built-in function, GCC may use
1985 information about that function to warn about problems with calls to
1986 that function, or to generate more efficient code, even if the
1987 resulting code still contains calls to that function. For example,
1988 warnings are given with @option{-Wformat} for bad calls to
1989 @code{printf} when @code{printf} is built in and @code{strlen} is
1990 known not to modify global memory.
1991
1992 With the @option{-fno-builtin-@var{function}} option
1993 only the built-in function @var{function} is
1994 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1995 function is named that is not built-in in this version of GCC, this
1996 option is ignored. There is no corresponding
1997 @option{-fbuiltin-@var{function}} option; if you wish to enable
1998 built-in functions selectively when using @option{-fno-builtin} or
1999 @option{-ffreestanding}, you may define macros such as:
2000
2001 @smallexample
2002 #define abs(n) __builtin_abs ((n))
2003 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2004 @end smallexample
2005
2006 @item -fgimple
2007 @opindex fgimple
2008
2009 Enable parsing of function definitions marked with @code{__GIMPLE}.
2010 This is an experimental feature that allows unit testing of GIMPLE
2011 passes.
2012
2013 @item -fhosted
2014 @opindex fhosted
2015 @cindex hosted environment
2016
2017 Assert that compilation targets a hosted environment. This implies
2018 @option{-fbuiltin}. A hosted environment is one in which the
2019 entire standard library is available, and in which @code{main} has a return
2020 type of @code{int}. Examples are nearly everything except a kernel.
2021 This is equivalent to @option{-fno-freestanding}.
2022
2023 @item -ffreestanding
2024 @opindex ffreestanding
2025 @cindex hosted environment
2026
2027 Assert that compilation targets a freestanding environment. This
2028 implies @option{-fno-builtin}. A freestanding environment
2029 is one in which the standard library may not exist, and program startup may
2030 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2031 This is equivalent to @option{-fno-hosted}.
2032
2033 @xref{Standards,,Language Standards Supported by GCC}, for details of
2034 freestanding and hosted environments.
2035
2036 @item -fopenacc
2037 @opindex fopenacc
2038 @cindex OpenACC accelerator programming
2039 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2040 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2041 compiler generates accelerated code according to the OpenACC Application
2042 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2043 implies @option{-pthread}, and thus is only supported on targets that
2044 have support for @option{-pthread}.
2045
2046 @item -fopenacc-dim=@var{geom}
2047 @opindex fopenacc-dim
2048 @cindex OpenACC accelerator programming
2049 Specify default compute dimensions for parallel offload regions that do
2050 not explicitly specify. The @var{geom} value is a triple of
2051 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2052 can be omitted, to use a target-specific default value.
2053
2054 @item -fopenmp
2055 @opindex fopenmp
2056 @cindex OpenMP parallel
2057 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2058 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2059 compiler generates parallel code according to the OpenMP Application
2060 Program Interface v4.5 @w{@uref{http://www.openmp.org/}}. This option
2061 implies @option{-pthread}, and thus is only supported on targets that
2062 have support for @option{-pthread}. @option{-fopenmp} implies
2063 @option{-fopenmp-simd}.
2064
2065 @item -fopenmp-simd
2066 @opindex fopenmp-simd
2067 @cindex OpenMP SIMD
2068 @cindex SIMD
2069 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2070 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2071 are ignored.
2072
2073 @item -fcilkplus
2074 @opindex fcilkplus
2075 @cindex Enable Cilk Plus
2076 Enable the usage of Cilk Plus language extension features for C/C++.
2077 When the option @option{-fcilkplus} is specified, enable the usage of
2078 the Cilk Plus Language extension features for C/C++. The present
2079 implementation follows ABI version 1.2. This is an experimental
2080 feature that is only partially complete, and whose interface may
2081 change in future versions of GCC as the official specification
2082 changes. Currently, all features but @code{_Cilk_for} have been
2083 implemented.
2084
2085 @item -fgnu-tm
2086 @opindex fgnu-tm
2087 When the option @option{-fgnu-tm} is specified, the compiler
2088 generates code for the Linux variant of Intel's current Transactional
2089 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2090 an experimental feature whose interface may change in future versions
2091 of GCC, as the official specification changes. Please note that not
2092 all architectures are supported for this feature.
2093
2094 For more information on GCC's support for transactional memory,
2095 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2096 Transactional Memory Library}.
2097
2098 Note that the transactional memory feature is not supported with
2099 non-call exceptions (@option{-fnon-call-exceptions}).
2100
2101 @item -fms-extensions
2102 @opindex fms-extensions
2103 Accept some non-standard constructs used in Microsoft header files.
2104
2105 In C++ code, this allows member names in structures to be similar
2106 to previous types declarations.
2107
2108 @smallexample
2109 typedef int UOW;
2110 struct ABC @{
2111 UOW UOW;
2112 @};
2113 @end smallexample
2114
2115 Some cases of unnamed fields in structures and unions are only
2116 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2117 fields within structs/unions}, for details.
2118
2119 Note that this option is off for all targets but x86
2120 targets using ms-abi.
2121
2122 @item -fplan9-extensions
2123 @opindex fplan9-extensions
2124 Accept some non-standard constructs used in Plan 9 code.
2125
2126 This enables @option{-fms-extensions}, permits passing pointers to
2127 structures with anonymous fields to functions that expect pointers to
2128 elements of the type of the field, and permits referring to anonymous
2129 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2130 struct/union fields within structs/unions}, for details. This is only
2131 supported for C, not C++.
2132
2133 @item -fcond-mismatch
2134 @opindex fcond-mismatch
2135 Allow conditional expressions with mismatched types in the second and
2136 third arguments. The value of such an expression is void. This option
2137 is not supported for C++.
2138
2139 @item -flax-vector-conversions
2140 @opindex flax-vector-conversions
2141 Allow implicit conversions between vectors with differing numbers of
2142 elements and/or incompatible element types. This option should not be
2143 used for new code.
2144
2145 @item -funsigned-char
2146 @opindex funsigned-char
2147 Let the type @code{char} be unsigned, like @code{unsigned char}.
2148
2149 Each kind of machine has a default for what @code{char} should
2150 be. It is either like @code{unsigned char} by default or like
2151 @code{signed char} by default.
2152
2153 Ideally, a portable program should always use @code{signed char} or
2154 @code{unsigned char} when it depends on the signedness of an object.
2155 But many programs have been written to use plain @code{char} and
2156 expect it to be signed, or expect it to be unsigned, depending on the
2157 machines they were written for. This option, and its inverse, let you
2158 make such a program work with the opposite default.
2159
2160 The type @code{char} is always a distinct type from each of
2161 @code{signed char} or @code{unsigned char}, even though its behavior
2162 is always just like one of those two.
2163
2164 @item -fsigned-char
2165 @opindex fsigned-char
2166 Let the type @code{char} be signed, like @code{signed char}.
2167
2168 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2169 the negative form of @option{-funsigned-char}. Likewise, the option
2170 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2171
2172 @item -fsigned-bitfields
2173 @itemx -funsigned-bitfields
2174 @itemx -fno-signed-bitfields
2175 @itemx -fno-unsigned-bitfields
2176 @opindex fsigned-bitfields
2177 @opindex funsigned-bitfields
2178 @opindex fno-signed-bitfields
2179 @opindex fno-unsigned-bitfields
2180 These options control whether a bit-field is signed or unsigned, when the
2181 declaration does not use either @code{signed} or @code{unsigned}. By
2182 default, such a bit-field is signed, because this is consistent: the
2183 basic integer types such as @code{int} are signed types.
2184
2185 @item -fsso-struct=@var{endianness}
2186 @opindex fsso-struct
2187 Set the default scalar storage order of structures and unions to the
2188 specified endianness. The accepted values are @samp{big-endian},
2189 @samp{little-endian} and @samp{native} for the native endianness of
2190 the target (the default). This option is not supported for C++.
2191
2192 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2193 code that is not binary compatible with code generated without it if the
2194 specified endianness is not the native endianness of the target.
2195 @end table
2196
2197 @node C++ Dialect Options
2198 @section Options Controlling C++ Dialect
2199
2200 @cindex compiler options, C++
2201 @cindex C++ options, command-line
2202 @cindex options, C++
2203 This section describes the command-line options that are only meaningful
2204 for C++ programs. You can also use most of the GNU compiler options
2205 regardless of what language your program is in. For example, you
2206 might compile a file @file{firstClass.C} like this:
2207
2208 @smallexample
2209 g++ -g -fstrict-enums -O -c firstClass.C
2210 @end smallexample
2211
2212 @noindent
2213 In this example, only @option{-fstrict-enums} is an option meant
2214 only for C++ programs; you can use the other options with any
2215 language supported by GCC@.
2216
2217 Some options for compiling C programs, such as @option{-std}, are also
2218 relevant for C++ programs.
2219 @xref{C Dialect Options,,Options Controlling C Dialect}.
2220
2221 Here is a list of options that are @emph{only} for compiling C++ programs:
2222
2223 @table @gcctabopt
2224
2225 @item -fabi-version=@var{n}
2226 @opindex fabi-version
2227 Use version @var{n} of the C++ ABI@. The default is version 0.
2228
2229 Version 0 refers to the version conforming most closely to
2230 the C++ ABI specification. Therefore, the ABI obtained using version 0
2231 will change in different versions of G++ as ABI bugs are fixed.
2232
2233 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2234
2235 Version 2 is the version of the C++ ABI that first appeared in G++
2236 3.4, and was the default through G++ 4.9.
2237
2238 Version 3 corrects an error in mangling a constant address as a
2239 template argument.
2240
2241 Version 4, which first appeared in G++ 4.5, implements a standard
2242 mangling for vector types.
2243
2244 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2245 attribute const/volatile on function pointer types, decltype of a
2246 plain decl, and use of a function parameter in the declaration of
2247 another parameter.
2248
2249 Version 6, which first appeared in G++ 4.7, corrects the promotion
2250 behavior of C++11 scoped enums and the mangling of template argument
2251 packs, const/static_cast, prefix ++ and --, and a class scope function
2252 used as a template argument.
2253
2254 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2255 builtin type and corrects the mangling of lambdas in default argument
2256 scope.
2257
2258 Version 8, which first appeared in G++ 4.9, corrects the substitution
2259 behavior of function types with function-cv-qualifiers.
2260
2261 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2262 @code{nullptr_t}.
2263
2264 Version 10, which first appeared in G++ 6.1, adds mangling of
2265 attributes that affect type identity, such as ia32 calling convention
2266 attributes (e.g. @samp{stdcall}).
2267
2268 Version 11, which first appeared in G++ 7, corrects the mangling of
2269 sizeof... expressions and operator names. For multiple entities with
2270 the same name within a function, that are declared in different scopes,
2271 the mangling now changes starting with the twelfth occurrence. It also
2272 implies @option{-fnew-inheriting-ctors}.
2273
2274 See also @option{-Wabi}.
2275
2276 @item -fabi-compat-version=@var{n}
2277 @opindex fabi-compat-version
2278 On targets that support strong aliases, G++
2279 works around mangling changes by creating an alias with the correct
2280 mangled name when defining a symbol with an incorrect mangled name.
2281 This switch specifies which ABI version to use for the alias.
2282
2283 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2284 compatibility). If another ABI version is explicitly selected, this
2285 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2286 use @option{-fabi-compat-version=2}.
2287
2288 If this option is not provided but @option{-Wabi=@var{n}} is, that
2289 version is used for compatibility aliases. If this option is provided
2290 along with @option{-Wabi} (without the version), the version from this
2291 option is used for the warning.
2292
2293 @item -fno-access-control
2294 @opindex fno-access-control
2295 Turn off all access checking. This switch is mainly useful for working
2296 around bugs in the access control code.
2297
2298 @item -faligned-new
2299 @opindex faligned-new
2300 Enable support for C++17 @code{new} of types that require more
2301 alignment than @code{void* ::operator new(std::size_t)} provides. A
2302 numeric argument such as @code{-faligned-new=32} can be used to
2303 specify how much alignment (in bytes) is provided by that function,
2304 but few users will need to override the default of
2305 @code{alignof(std::max_align_t)}.
2306
2307 This flag is enabled by default for @option{-std=c++1z}.
2308
2309 @item -fcheck-new
2310 @opindex fcheck-new
2311 Check that the pointer returned by @code{operator new} is non-null
2312 before attempting to modify the storage allocated. This check is
2313 normally unnecessary because the C++ standard specifies that
2314 @code{operator new} only returns @code{0} if it is declared
2315 @code{throw()}, in which case the compiler always checks the
2316 return value even without this option. In all other cases, when
2317 @code{operator new} has a non-empty exception specification, memory
2318 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2319 @samp{new (nothrow)}.
2320
2321 @item -fconcepts
2322 @opindex fconcepts
2323 Enable support for the C++ Extensions for Concepts Technical
2324 Specification, ISO 19217 (2015), which allows code like
2325
2326 @smallexample
2327 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2328 template <Addable T> T add (T a, T b) @{ return a + b; @}
2329 @end smallexample
2330
2331 @item -fconstexpr-depth=@var{n}
2332 @opindex fconstexpr-depth
2333 Set the maximum nested evaluation depth for C++11 constexpr functions
2334 to @var{n}. A limit is needed to detect endless recursion during
2335 constant expression evaluation. The minimum specified by the standard
2336 is 512.
2337
2338 @item -fconstexpr-loop-limit=@var{n}
2339 @opindex fconstexpr-loop-limit
2340 Set the maximum number of iterations for a loop in C++14 constexpr functions
2341 to @var{n}. A limit is needed to detect infinite loops during
2342 constant expression evaluation. The default is 262144 (1<<18).
2343
2344 @item -fdeduce-init-list
2345 @opindex fdeduce-init-list
2346 Enable deduction of a template type parameter as
2347 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2348
2349 @smallexample
2350 template <class T> auto forward(T t) -> decltype (realfn (t))
2351 @{
2352 return realfn (t);
2353 @}
2354
2355 void f()
2356 @{
2357 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2358 @}
2359 @end smallexample
2360
2361 This deduction was implemented as a possible extension to the
2362 originally proposed semantics for the C++11 standard, but was not part
2363 of the final standard, so it is disabled by default. This option is
2364 deprecated, and may be removed in a future version of G++.
2365
2366 @item -ffriend-injection
2367 @opindex ffriend-injection
2368 Inject friend functions into the enclosing namespace, so that they are
2369 visible outside the scope of the class in which they are declared.
2370 Friend functions were documented to work this way in the old Annotated
2371 C++ Reference Manual.
2372 However, in ISO C++ a friend function that is not declared
2373 in an enclosing scope can only be found using argument dependent
2374 lookup. GCC defaults to the standard behavior.
2375
2376 This option is for compatibility, and may be removed in a future
2377 release of G++.
2378
2379 @item -fno-elide-constructors
2380 @opindex fno-elide-constructors
2381 The C++ standard allows an implementation to omit creating a temporary
2382 that is only used to initialize another object of the same type.
2383 Specifying this option disables that optimization, and forces G++ to
2384 call the copy constructor in all cases. This option also causes G++
2385 to call trivial member functions which otherwise would be expanded inline.
2386
2387 In C++17, the compiler is required to omit these temporaries, but this
2388 option still affects trivial member functions.
2389
2390 @item -fno-enforce-eh-specs
2391 @opindex fno-enforce-eh-specs
2392 Don't generate code to check for violation of exception specifications
2393 at run time. This option violates the C++ standard, but may be useful
2394 for reducing code size in production builds, much like defining
2395 @code{NDEBUG}. This does not give user code permission to throw
2396 exceptions in violation of the exception specifications; the compiler
2397 still optimizes based on the specifications, so throwing an
2398 unexpected exception results in undefined behavior at run time.
2399
2400 @item -fextern-tls-init
2401 @itemx -fno-extern-tls-init
2402 @opindex fextern-tls-init
2403 @opindex fno-extern-tls-init
2404 The C++11 and OpenMP standards allow @code{thread_local} and
2405 @code{threadprivate} variables to have dynamic (runtime)
2406 initialization. To support this, any use of such a variable goes
2407 through a wrapper function that performs any necessary initialization.
2408 When the use and definition of the variable are in the same
2409 translation unit, this overhead can be optimized away, but when the
2410 use is in a different translation unit there is significant overhead
2411 even if the variable doesn't actually need dynamic initialization. If
2412 the programmer can be sure that no use of the variable in a
2413 non-defining TU needs to trigger dynamic initialization (either
2414 because the variable is statically initialized, or a use of the
2415 variable in the defining TU will be executed before any uses in
2416 another TU), they can avoid this overhead with the
2417 @option{-fno-extern-tls-init} option.
2418
2419 On targets that support symbol aliases, the default is
2420 @option{-fextern-tls-init}. On targets that do not support symbol
2421 aliases, the default is @option{-fno-extern-tls-init}.
2422
2423 @item -ffor-scope
2424 @itemx -fno-for-scope
2425 @opindex ffor-scope
2426 @opindex fno-for-scope
2427 If @option{-ffor-scope} is specified, the scope of variables declared in
2428 a @i{for-init-statement} is limited to the @code{for} loop itself,
2429 as specified by the C++ standard.
2430 If @option{-fno-for-scope} is specified, the scope of variables declared in
2431 a @i{for-init-statement} extends to the end of the enclosing scope,
2432 as was the case in old versions of G++, and other (traditional)
2433 implementations of C++.
2434
2435 If neither flag is given, the default is to follow the standard,
2436 but to allow and give a warning for old-style code that would
2437 otherwise be invalid, or have different behavior.
2438
2439 @item -fno-gnu-keywords
2440 @opindex fno-gnu-keywords
2441 Do not recognize @code{typeof} as a keyword, so that code can use this
2442 word as an identifier. You can use the keyword @code{__typeof__} instead.
2443 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2444 @option{-std=c++98}, @option{-std=c++11}, etc.
2445
2446 @item -fno-implicit-templates
2447 @opindex fno-implicit-templates
2448 Never emit code for non-inline templates that are instantiated
2449 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2450 @xref{Template Instantiation}, for more information.
2451
2452 @item -fno-implicit-inline-templates
2453 @opindex fno-implicit-inline-templates
2454 Don't emit code for implicit instantiations of inline templates, either.
2455 The default is to handle inlines differently so that compiles with and
2456 without optimization need the same set of explicit instantiations.
2457
2458 @item -fno-implement-inlines
2459 @opindex fno-implement-inlines
2460 To save space, do not emit out-of-line copies of inline functions
2461 controlled by @code{#pragma implementation}. This causes linker
2462 errors if these functions are not inlined everywhere they are called.
2463
2464 @item -fms-extensions
2465 @opindex fms-extensions
2466 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2467 int and getting a pointer to member function via non-standard syntax.
2468
2469 @item -fnew-inheriting-ctors
2470 @opindex fnew-inheriting-ctors
2471 Enable the P0136 adjustment to the semantics of C++11 constructor
2472 inheritance. This is part of C++17 but also considered to be a Defect
2473 Report against C++11 and C++14. This flag is enabled by default
2474 unless @option{-fabi-version=10} or lower is specified.
2475
2476 @item -fnew-ttp-matching
2477 @opindex fnew-ttp-matching
2478 Enable the P0522 resolution to Core issue 150, template template
2479 parameters and default arguments: this allows a template with default
2480 template arguments as an argument for a template template parameter
2481 with fewer template parameters. This flag is enabled by default for
2482 @option{-std=c++1z}.
2483
2484 @item -fno-nonansi-builtins
2485 @opindex fno-nonansi-builtins
2486 Disable built-in declarations of functions that are not mandated by
2487 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2488 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2489
2490 @item -fnothrow-opt
2491 @opindex fnothrow-opt
2492 Treat a @code{throw()} exception specification as if it were a
2493 @code{noexcept} specification to reduce or eliminate the text size
2494 overhead relative to a function with no exception specification. If
2495 the function has local variables of types with non-trivial
2496 destructors, the exception specification actually makes the
2497 function smaller because the EH cleanups for those variables can be
2498 optimized away. The semantic effect is that an exception thrown out of
2499 a function with such an exception specification results in a call
2500 to @code{terminate} rather than @code{unexpected}.
2501
2502 @item -fno-operator-names
2503 @opindex fno-operator-names
2504 Do not treat the operator name keywords @code{and}, @code{bitand},
2505 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2506 synonyms as keywords.
2507
2508 @item -fno-optional-diags
2509 @opindex fno-optional-diags
2510 Disable diagnostics that the standard says a compiler does not need to
2511 issue. Currently, the only such diagnostic issued by G++ is the one for
2512 a name having multiple meanings within a class.
2513
2514 @item -fpermissive
2515 @opindex fpermissive
2516 Downgrade some diagnostics about nonconformant code from errors to
2517 warnings. Thus, using @option{-fpermissive} allows some
2518 nonconforming code to compile.
2519
2520 @item -fno-pretty-templates
2521 @opindex fno-pretty-templates
2522 When an error message refers to a specialization of a function
2523 template, the compiler normally prints the signature of the
2524 template followed by the template arguments and any typedefs or
2525 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2526 rather than @code{void f(int)}) so that it's clear which template is
2527 involved. When an error message refers to a specialization of a class
2528 template, the compiler omits any template arguments that match
2529 the default template arguments for that template. If either of these
2530 behaviors make it harder to understand the error message rather than
2531 easier, you can use @option{-fno-pretty-templates} to disable them.
2532
2533 @item -frepo
2534 @opindex frepo
2535 Enable automatic template instantiation at link time. This option also
2536 implies @option{-fno-implicit-templates}. @xref{Template
2537 Instantiation}, for more information.
2538
2539 @item -fno-rtti
2540 @opindex fno-rtti
2541 Disable generation of information about every class with virtual
2542 functions for use by the C++ run-time type identification features
2543 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2544 of the language, you can save some space by using this flag. Note that
2545 exception handling uses the same information, but G++ generates it as
2546 needed. The @code{dynamic_cast} operator can still be used for casts that
2547 do not require run-time type information, i.e.@: casts to @code{void *} or to
2548 unambiguous base classes.
2549
2550 @item -fsized-deallocation
2551 @opindex fsized-deallocation
2552 Enable the built-in global declarations
2553 @smallexample
2554 void operator delete (void *, std::size_t) noexcept;
2555 void operator delete[] (void *, std::size_t) noexcept;
2556 @end smallexample
2557 as introduced in C++14. This is useful for user-defined replacement
2558 deallocation functions that, for example, use the size of the object
2559 to make deallocation faster. Enabled by default under
2560 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2561 warns about places that might want to add a definition.
2562
2563 @item -fstrict-enums
2564 @opindex fstrict-enums
2565 Allow the compiler to optimize using the assumption that a value of
2566 enumerated type can only be one of the values of the enumeration (as
2567 defined in the C++ standard; basically, a value that can be
2568 represented in the minimum number of bits needed to represent all the
2569 enumerators). This assumption may not be valid if the program uses a
2570 cast to convert an arbitrary integer value to the enumerated type.
2571
2572 @item -fstrong-eval-order
2573 @opindex fstrong-eval-order
2574 Evaluate member access, array subscripting, and shift expressions in
2575 left-to-right order, and evaluate assignment in right-to-left order,
2576 as adopted for C++17. Enabled by default with @option{-std=c++1z}.
2577 @option{-fstrong-eval-order=some} enables just the ordering of member
2578 access and shift expressions, and is the default without
2579 @option{-std=c++1z}.
2580
2581 @item -ftemplate-backtrace-limit=@var{n}
2582 @opindex ftemplate-backtrace-limit
2583 Set the maximum number of template instantiation notes for a single
2584 warning or error to @var{n}. The default value is 10.
2585
2586 @item -ftemplate-depth=@var{n}
2587 @opindex ftemplate-depth
2588 Set the maximum instantiation depth for template classes to @var{n}.
2589 A limit on the template instantiation depth is needed to detect
2590 endless recursions during template class instantiation. ANSI/ISO C++
2591 conforming programs must not rely on a maximum depth greater than 17
2592 (changed to 1024 in C++11). The default value is 900, as the compiler
2593 can run out of stack space before hitting 1024 in some situations.
2594
2595 @item -fno-threadsafe-statics
2596 @opindex fno-threadsafe-statics
2597 Do not emit the extra code to use the routines specified in the C++
2598 ABI for thread-safe initialization of local statics. You can use this
2599 option to reduce code size slightly in code that doesn't need to be
2600 thread-safe.
2601
2602 @item -fuse-cxa-atexit
2603 @opindex fuse-cxa-atexit
2604 Register destructors for objects with static storage duration with the
2605 @code{__cxa_atexit} function rather than the @code{atexit} function.
2606 This option is required for fully standards-compliant handling of static
2607 destructors, but only works if your C library supports
2608 @code{__cxa_atexit}.
2609
2610 @item -fno-use-cxa-get-exception-ptr
2611 @opindex fno-use-cxa-get-exception-ptr
2612 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2613 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2614 if the runtime routine is not available.
2615
2616 @item -fvisibility-inlines-hidden
2617 @opindex fvisibility-inlines-hidden
2618 This switch declares that the user does not attempt to compare
2619 pointers to inline functions or methods where the addresses of the two functions
2620 are taken in different shared objects.
2621
2622 The effect of this is that GCC may, effectively, mark inline methods with
2623 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2624 appear in the export table of a DSO and do not require a PLT indirection
2625 when used within the DSO@. Enabling this option can have a dramatic effect
2626 on load and link times of a DSO as it massively reduces the size of the
2627 dynamic export table when the library makes heavy use of templates.
2628
2629 The behavior of this switch is not quite the same as marking the
2630 methods as hidden directly, because it does not affect static variables
2631 local to the function or cause the compiler to deduce that
2632 the function is defined in only one shared object.
2633
2634 You may mark a method as having a visibility explicitly to negate the
2635 effect of the switch for that method. For example, if you do want to
2636 compare pointers to a particular inline method, you might mark it as
2637 having default visibility. Marking the enclosing class with explicit
2638 visibility has no effect.
2639
2640 Explicitly instantiated inline methods are unaffected by this option
2641 as their linkage might otherwise cross a shared library boundary.
2642 @xref{Template Instantiation}.
2643
2644 @item -fvisibility-ms-compat
2645 @opindex fvisibility-ms-compat
2646 This flag attempts to use visibility settings to make GCC's C++
2647 linkage model compatible with that of Microsoft Visual Studio.
2648
2649 The flag makes these changes to GCC's linkage model:
2650
2651 @enumerate
2652 @item
2653 It sets the default visibility to @code{hidden}, like
2654 @option{-fvisibility=hidden}.
2655
2656 @item
2657 Types, but not their members, are not hidden by default.
2658
2659 @item
2660 The One Definition Rule is relaxed for types without explicit
2661 visibility specifications that are defined in more than one
2662 shared object: those declarations are permitted if they are
2663 permitted when this option is not used.
2664 @end enumerate
2665
2666 In new code it is better to use @option{-fvisibility=hidden} and
2667 export those classes that are intended to be externally visible.
2668 Unfortunately it is possible for code to rely, perhaps accidentally,
2669 on the Visual Studio behavior.
2670
2671 Among the consequences of these changes are that static data members
2672 of the same type with the same name but defined in different shared
2673 objects are different, so changing one does not change the other;
2674 and that pointers to function members defined in different shared
2675 objects may not compare equal. When this flag is given, it is a
2676 violation of the ODR to define types with the same name differently.
2677
2678 @item -fno-weak
2679 @opindex fno-weak
2680 Do not use weak symbol support, even if it is provided by the linker.
2681 By default, G++ uses weak symbols if they are available. This
2682 option exists only for testing, and should not be used by end-users;
2683 it results in inferior code and has no benefits. This option may
2684 be removed in a future release of G++.
2685
2686 @item -nostdinc++
2687 @opindex nostdinc++
2688 Do not search for header files in the standard directories specific to
2689 C++, but do still search the other standard directories. (This option
2690 is used when building the C++ library.)
2691 @end table
2692
2693 In addition, these optimization, warning, and code generation options
2694 have meanings only for C++ programs:
2695
2696 @table @gcctabopt
2697 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2698 @opindex Wabi
2699 @opindex Wno-abi
2700 Warn when G++ it generates code that is probably not compatible with
2701 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2702 ABI with each major release, normally @option{-Wabi} will warn only if
2703 there is a check added later in a release series for an ABI issue
2704 discovered since the initial release. @option{-Wabi} will warn about
2705 more things if an older ABI version is selected (with
2706 @option{-fabi-version=@var{n}}).
2707
2708 @option{-Wabi} can also be used with an explicit version number to
2709 warn about compatibility with a particular @option{-fabi-version}
2710 level, e.g. @option{-Wabi=2} to warn about changes relative to
2711 @option{-fabi-version=2}.
2712
2713 If an explicit version number is provided and
2714 @option{-fabi-compat-version} is not specified, the version number
2715 from this option is used for compatibility aliases. If no explicit
2716 version number is provided with this option, but
2717 @option{-fabi-compat-version} is specified, that version number is
2718 used for ABI warnings.
2719
2720 Although an effort has been made to warn about
2721 all such cases, there are probably some cases that are not warned about,
2722 even though G++ is generating incompatible code. There may also be
2723 cases where warnings are emitted even though the code that is generated
2724 is compatible.
2725
2726 You should rewrite your code to avoid these warnings if you are
2727 concerned about the fact that code generated by G++ may not be binary
2728 compatible with code generated by other compilers.
2729
2730 Known incompatibilities in @option{-fabi-version=2} (which was the
2731 default from GCC 3.4 to 4.9) include:
2732
2733 @itemize @bullet
2734
2735 @item
2736 A template with a non-type template parameter of reference type was
2737 mangled incorrectly:
2738 @smallexample
2739 extern int N;
2740 template <int &> struct S @{@};
2741 void n (S<N>) @{2@}
2742 @end smallexample
2743
2744 This was fixed in @option{-fabi-version=3}.
2745
2746 @item
2747 SIMD vector types declared using @code{__attribute ((vector_size))} were
2748 mangled in a non-standard way that does not allow for overloading of
2749 functions taking vectors of different sizes.
2750
2751 The mangling was changed in @option{-fabi-version=4}.
2752
2753 @item
2754 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2755 qualifiers, and @code{decltype} of a plain declaration was folded away.
2756
2757 These mangling issues were fixed in @option{-fabi-version=5}.
2758
2759 @item
2760 Scoped enumerators passed as arguments to a variadic function are
2761 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2762 On most targets this does not actually affect the parameter passing
2763 ABI, as there is no way to pass an argument smaller than @code{int}.
2764
2765 Also, the ABI changed the mangling of template argument packs,
2766 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2767 a class scope function used as a template argument.
2768
2769 These issues were corrected in @option{-fabi-version=6}.
2770
2771 @item
2772 Lambdas in default argument scope were mangled incorrectly, and the
2773 ABI changed the mangling of @code{nullptr_t}.
2774
2775 These issues were corrected in @option{-fabi-version=7}.
2776
2777 @item
2778 When mangling a function type with function-cv-qualifiers, the
2779 un-qualified function type was incorrectly treated as a substitution
2780 candidate.
2781
2782 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2783
2784 @item
2785 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2786 unaligned accesses. Note that this did not affect the ABI of a
2787 function with a @code{nullptr_t} parameter, as parameters have a
2788 minimum alignment.
2789
2790 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2791
2792 @item
2793 Target-specific attributes that affect the identity of a type, such as
2794 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2795 did not affect the mangled name, leading to name collisions when
2796 function pointers were used as template arguments.
2797
2798 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2799
2800 @end itemize
2801
2802 It also warns about psABI-related changes. The known psABI changes at this
2803 point include:
2804
2805 @itemize @bullet
2806
2807 @item
2808 For SysV/x86-64, unions with @code{long double} members are
2809 passed in memory as specified in psABI. For example:
2810
2811 @smallexample
2812 union U @{
2813 long double ld;
2814 int i;
2815 @};
2816 @end smallexample
2817
2818 @noindent
2819 @code{union U} is always passed in memory.
2820
2821 @end itemize
2822
2823 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2824 @opindex Wabi-tag
2825 @opindex -Wabi-tag
2826 Warn when a type with an ABI tag is used in a context that does not
2827 have that ABI tag. See @ref{C++ Attributes} for more information
2828 about ABI tags.
2829
2830 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2831 @opindex Wctor-dtor-privacy
2832 @opindex Wno-ctor-dtor-privacy
2833 Warn when a class seems unusable because all the constructors or
2834 destructors in that class are private, and it has neither friends nor
2835 public static member functions. Also warn if there are no non-private
2836 methods, and there's at least one private member function that isn't
2837 a constructor or destructor.
2838
2839 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2840 @opindex Wdelete-non-virtual-dtor
2841 @opindex Wno-delete-non-virtual-dtor
2842 Warn when @code{delete} is used to destroy an instance of a class that
2843 has virtual functions and non-virtual destructor. It is unsafe to delete
2844 an instance of a derived class through a pointer to a base class if the
2845 base class does not have a virtual destructor. This warning is enabled
2846 by @option{-Wall}.
2847
2848 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2849 @opindex Wliteral-suffix
2850 @opindex Wno-literal-suffix
2851 Warn when a string or character literal is followed by a ud-suffix which does
2852 not begin with an underscore. As a conforming extension, GCC treats such
2853 suffixes as separate preprocessing tokens in order to maintain backwards
2854 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2855 For example:
2856
2857 @smallexample
2858 #define __STDC_FORMAT_MACROS
2859 #include <inttypes.h>
2860 #include <stdio.h>
2861
2862 int main() @{
2863 int64_t i64 = 123;
2864 printf("My int64: %" PRId64"\n", i64);
2865 @}
2866 @end smallexample
2867
2868 In this case, @code{PRId64} is treated as a separate preprocessing token.
2869
2870 Additionally, warn when a user-defined literal operator is declared with
2871 a literal suffix identifier that doesn't begin with an underscore. Literal
2872 suffix identifiers that don't begin with an underscore are reserved for
2873 future standardization.
2874
2875 This warning is enabled by default.
2876
2877 @item -Wlto-type-mismatch
2878 @opindex Wlto-type-mismatch
2879 @opindex Wno-lto-type-mismatch
2880
2881 During the link-time optimization warn about type mismatches in
2882 global declarations from different compilation units.
2883 Requires @option{-flto} to be enabled. Enabled by default.
2884
2885 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
2886 @opindex Wnarrowing
2887 @opindex Wno-narrowing
2888 For C++11 and later standards, narrowing conversions are diagnosed by default,
2889 as required by the standard. A narrowing conversion from a constant produces
2890 an error, and a narrowing conversion from a non-constant produces a warning,
2891 but @option{-Wno-narrowing} suppresses the diagnostic.
2892 Note that this does not affect the meaning of well-formed code;
2893 narrowing conversions are still considered ill-formed in SFINAE contexts.
2894
2895 With @option{-Wnarrowing} in C++98, warn when a narrowing
2896 conversion prohibited by C++11 occurs within
2897 @samp{@{ @}}, e.g.
2898
2899 @smallexample
2900 int i = @{ 2.2 @}; // error: narrowing from double to int
2901 @end smallexample
2902
2903 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2904
2905 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2906 @opindex Wnoexcept
2907 @opindex Wno-noexcept
2908 Warn when a noexcept-expression evaluates to false because of a call
2909 to a function that does not have a non-throwing exception
2910 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2911 the compiler to never throw an exception.
2912
2913 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
2914 @opindex Wnoexcept-type
2915 @opindex Wno-noexcept-type
2916 Warn if the C++1z feature making @code{noexcept} part of a function
2917 type changes the mangled name of a symbol relative to C++14. Enabled
2918 by @option{-Wabi} and @option{-Wc++1z-compat}.
2919
2920 @smallexample
2921 template <class T> void f(T t) @{ t(); @};
2922 void g() noexcept;
2923 void h() @{ f(g); @} // in C++14 calls f<void(*)()>, in C++1z calls f<void(*)()noexcept>
2924 @end smallexample
2925
2926 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
2927 @opindex Wclass-memaccess
2928 Warn when the destination of a call to a raw memory function such as
2929 @code{memset} or @code{memcpy} is an object of class type writing into which
2930 might bypass the class non-trivial or deleted constructor or copy assignment,
2931 violate const-correctness or encapsulation, or corrupt the virtual table.
2932 Modifying the representation of such objects may violate invariants maintained
2933 by member functions of the class. For example, the call to @code{memset}
2934 below is undefined becase it modifies a non-trivial class object and is,
2935 therefore, diagnosed. The safe way to either initialize or clear the storage
2936 of objects of such types is by using the appropriate constructor or assignment
2937 operator, if one is available.
2938 @smallexample
2939 std::string str = "abc";
2940 memset (&str, 0, 3);
2941 @end smallexample
2942 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
2943
2944 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2945 @opindex Wnon-virtual-dtor
2946 @opindex Wno-non-virtual-dtor
2947 Warn when a class has virtual functions and an accessible non-virtual
2948 destructor itself or in an accessible polymorphic base class, in which
2949 case it is possible but unsafe to delete an instance of a derived
2950 class through a pointer to the class itself or base class. This
2951 warning is automatically enabled if @option{-Weffc++} is specified.
2952
2953 @item -Wregister @r{(C++ and Objective-C++ only)}
2954 @opindex Wregister
2955 @opindex Wno-register
2956 Warn on uses of the @code{register} storage class specifier, except
2957 when it is part of the GNU @ref{Explicit Register Variables} extension.
2958 The use of the @code{register} keyword as storage class specifier has
2959 been deprecated in C++11 and removed in C++17.
2960 Enabled by default with @option{-std=c++1z}.
2961
2962 @item -Wreorder @r{(C++ and Objective-C++ only)}
2963 @opindex Wreorder
2964 @opindex Wno-reorder
2965 @cindex reordering, warning
2966 @cindex warning for reordering of member initializers
2967 Warn when the order of member initializers given in the code does not
2968 match the order in which they must be executed. For instance:
2969
2970 @smallexample
2971 struct A @{
2972 int i;
2973 int j;
2974 A(): j (0), i (1) @{ @}
2975 @};
2976 @end smallexample
2977
2978 @noindent
2979 The compiler rearranges the member initializers for @code{i}
2980 and @code{j} to match the declaration order of the members, emitting
2981 a warning to that effect. This warning is enabled by @option{-Wall}.
2982
2983 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2984 @opindex fext-numeric-literals
2985 @opindex fno-ext-numeric-literals
2986 Accept imaginary, fixed-point, or machine-defined
2987 literal number suffixes as GNU extensions.
2988 When this option is turned off these suffixes are treated
2989 as C++11 user-defined literal numeric suffixes.
2990 This is on by default for all pre-C++11 dialects and all GNU dialects:
2991 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2992 @option{-std=gnu++14}.
2993 This option is off by default
2994 for ISO C++11 onwards (@option{-std=c++11}, ...).
2995 @end table
2996
2997 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2998
2999 @table @gcctabopt
3000 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3001 @opindex Weffc++
3002 @opindex Wno-effc++
3003 Warn about violations of the following style guidelines from Scott Meyers'
3004 @cite{Effective C++} series of books:
3005
3006 @itemize @bullet
3007 @item
3008 Define a copy constructor and an assignment operator for classes
3009 with dynamically-allocated memory.
3010
3011 @item
3012 Prefer initialization to assignment in constructors.
3013
3014 @item
3015 Have @code{operator=} return a reference to @code{*this}.
3016
3017 @item
3018 Don't try to return a reference when you must return an object.
3019
3020 @item
3021 Distinguish between prefix and postfix forms of increment and
3022 decrement operators.
3023
3024 @item
3025 Never overload @code{&&}, @code{||}, or @code{,}.
3026
3027 @end itemize
3028
3029 This option also enables @option{-Wnon-virtual-dtor}, which is also
3030 one of the effective C++ recommendations. However, the check is
3031 extended to warn about the lack of virtual destructor in accessible
3032 non-polymorphic bases classes too.
3033
3034 When selecting this option, be aware that the standard library
3035 headers do not obey all of these guidelines; use @samp{grep -v}
3036 to filter out those warnings.
3037
3038 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3039 @opindex Wstrict-null-sentinel
3040 @opindex Wno-strict-null-sentinel
3041 Warn about the use of an uncasted @code{NULL} as sentinel. When
3042 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3043 to @code{__null}. Although it is a null pointer constant rather than a
3044 null pointer, it is guaranteed to be of the same size as a pointer.
3045 But this use is not portable across different compilers.
3046
3047 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3048 @opindex Wno-non-template-friend
3049 @opindex Wnon-template-friend
3050 Disable warnings when non-template friend functions are declared
3051 within a template. In very old versions of GCC that predate implementation
3052 of the ISO standard, declarations such as
3053 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3054 could be interpreted as a particular specialization of a template
3055 function; the warning exists to diagnose compatibility problems,
3056 and is enabled by default.
3057
3058 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3059 @opindex Wold-style-cast
3060 @opindex Wno-old-style-cast
3061 Warn if an old-style (C-style) cast to a non-void type is used within
3062 a C++ program. The new-style casts (@code{dynamic_cast},
3063 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3064 less vulnerable to unintended effects and much easier to search for.
3065
3066 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3067 @opindex Woverloaded-virtual
3068 @opindex Wno-overloaded-virtual
3069 @cindex overloaded virtual function, warning
3070 @cindex warning for overloaded virtual function
3071 Warn when a function declaration hides virtual functions from a
3072 base class. For example, in:
3073
3074 @smallexample
3075 struct A @{
3076 virtual void f();
3077 @};
3078
3079 struct B: public A @{
3080 void f(int);
3081 @};
3082 @end smallexample
3083
3084 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3085 like:
3086
3087 @smallexample
3088 B* b;
3089 b->f();
3090 @end smallexample
3091
3092 @noindent
3093 fails to compile.
3094
3095 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3096 @opindex Wno-pmf-conversions
3097 @opindex Wpmf-conversions
3098 Disable the diagnostic for converting a bound pointer to member function
3099 to a plain pointer.
3100
3101 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3102 @opindex Wsign-promo
3103 @opindex Wno-sign-promo
3104 Warn when overload resolution chooses a promotion from unsigned or
3105 enumerated type to a signed type, over a conversion to an unsigned type of
3106 the same size. Previous versions of G++ tried to preserve
3107 unsignedness, but the standard mandates the current behavior.
3108
3109 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3110 @opindex Wtemplates
3111 Warn when a primary template declaration is encountered. Some coding
3112 rules disallow templates, and this may be used to enforce that rule.
3113 The warning is inactive inside a system header file, such as the STL, so
3114 one can still use the STL. One may also instantiate or specialize
3115 templates.
3116
3117 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3118 @opindex Wmultiple-inheritance
3119 Warn when a class is defined with multiple direct base classes. Some
3120 coding rules disallow multiple inheritance, and this may be used to
3121 enforce that rule. The warning is inactive inside a system header file,
3122 such as the STL, so one can still use the STL. One may also define
3123 classes that indirectly use multiple inheritance.
3124
3125 @item -Wvirtual-inheritance
3126 @opindex Wvirtual-inheritance
3127 Warn when a class is defined with a virtual direct base class. Some
3128 coding rules disallow multiple inheritance, and this may be used to
3129 enforce that rule. The warning is inactive inside a system header file,
3130 such as the STL, so one can still use the STL. One may also define
3131 classes that indirectly use virtual inheritance.
3132
3133 @item -Wnamespaces
3134 @opindex Wnamespaces
3135 Warn when a namespace definition is opened. Some coding rules disallow
3136 namespaces, and this may be used to enforce that rule. The warning is
3137 inactive inside a system header file, such as the STL, so one can still
3138 use the STL. One may also use using directives and qualified names.
3139
3140 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3141 @opindex Wterminate
3142 @opindex Wno-terminate
3143 Disable the warning about a throw-expression that will immediately
3144 result in a call to @code{terminate}.
3145 @end table
3146
3147 @node Objective-C and Objective-C++ Dialect Options
3148 @section Options Controlling Objective-C and Objective-C++ Dialects
3149
3150 @cindex compiler options, Objective-C and Objective-C++
3151 @cindex Objective-C and Objective-C++ options, command-line
3152 @cindex options, Objective-C and Objective-C++
3153 (NOTE: This manual does not describe the Objective-C and Objective-C++
3154 languages themselves. @xref{Standards,,Language Standards
3155 Supported by GCC}, for references.)
3156
3157 This section describes the command-line options that are only meaningful
3158 for Objective-C and Objective-C++ programs. You can also use most of
3159 the language-independent GNU compiler options.
3160 For example, you might compile a file @file{some_class.m} like this:
3161
3162 @smallexample
3163 gcc -g -fgnu-runtime -O -c some_class.m
3164 @end smallexample
3165
3166 @noindent
3167 In this example, @option{-fgnu-runtime} is an option meant only for
3168 Objective-C and Objective-C++ programs; you can use the other options with
3169 any language supported by GCC@.
3170
3171 Note that since Objective-C is an extension of the C language, Objective-C
3172 compilations may also use options specific to the C front-end (e.g.,
3173 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3174 C++-specific options (e.g., @option{-Wabi}).
3175
3176 Here is a list of options that are @emph{only} for compiling Objective-C
3177 and Objective-C++ programs:
3178
3179 @table @gcctabopt
3180 @item -fconstant-string-class=@var{class-name}
3181 @opindex fconstant-string-class
3182 Use @var{class-name} as the name of the class to instantiate for each
3183 literal string specified with the syntax @code{@@"@dots{}"}. The default
3184 class name is @code{NXConstantString} if the GNU runtime is being used, and
3185 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3186 @option{-fconstant-cfstrings} option, if also present, overrides the
3187 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3188 to be laid out as constant CoreFoundation strings.
3189
3190 @item -fgnu-runtime
3191 @opindex fgnu-runtime
3192 Generate object code compatible with the standard GNU Objective-C
3193 runtime. This is the default for most types of systems.
3194
3195 @item -fnext-runtime
3196 @opindex fnext-runtime
3197 Generate output compatible with the NeXT runtime. This is the default
3198 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3199 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3200 used.
3201
3202 @item -fno-nil-receivers
3203 @opindex fno-nil-receivers
3204 Assume that all Objective-C message dispatches (@code{[receiver
3205 message:arg]}) in this translation unit ensure that the receiver is
3206 not @code{nil}. This allows for more efficient entry points in the
3207 runtime to be used. This option is only available in conjunction with
3208 the NeXT runtime and ABI version 0 or 1.
3209
3210 @item -fobjc-abi-version=@var{n}
3211 @opindex fobjc-abi-version
3212 Use version @var{n} of the Objective-C ABI for the selected runtime.
3213 This option is currently supported only for the NeXT runtime. In that
3214 case, Version 0 is the traditional (32-bit) ABI without support for
3215 properties and other Objective-C 2.0 additions. Version 1 is the
3216 traditional (32-bit) ABI with support for properties and other
3217 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3218 nothing is specified, the default is Version 0 on 32-bit target
3219 machines, and Version 2 on 64-bit target machines.
3220
3221 @item -fobjc-call-cxx-cdtors
3222 @opindex fobjc-call-cxx-cdtors
3223 For each Objective-C class, check if any of its instance variables is a
3224 C++ object with a non-trivial default constructor. If so, synthesize a
3225 special @code{- (id) .cxx_construct} instance method which runs
3226 non-trivial default constructors on any such instance variables, in order,
3227 and then return @code{self}. Similarly, check if any instance variable
3228 is a C++ object with a non-trivial destructor, and if so, synthesize a
3229 special @code{- (void) .cxx_destruct} method which runs
3230 all such default destructors, in reverse order.
3231
3232 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3233 methods thusly generated only operate on instance variables
3234 declared in the current Objective-C class, and not those inherited
3235 from superclasses. It is the responsibility of the Objective-C
3236 runtime to invoke all such methods in an object's inheritance
3237 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3238 by the runtime immediately after a new object instance is allocated;
3239 the @code{- (void) .cxx_destruct} methods are invoked immediately
3240 before the runtime deallocates an object instance.
3241
3242 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3243 support for invoking the @code{- (id) .cxx_construct} and
3244 @code{- (void) .cxx_destruct} methods.
3245
3246 @item -fobjc-direct-dispatch
3247 @opindex fobjc-direct-dispatch
3248 Allow fast jumps to the message dispatcher. On Darwin this is
3249 accomplished via the comm page.
3250
3251 @item -fobjc-exceptions
3252 @opindex fobjc-exceptions
3253 Enable syntactic support for structured exception handling in
3254 Objective-C, similar to what is offered by C++. This option
3255 is required to use the Objective-C keywords @code{@@try},
3256 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3257 @code{@@synchronized}. This option is available with both the GNU
3258 runtime and the NeXT runtime (but not available in conjunction with
3259 the NeXT runtime on Mac OS X 10.2 and earlier).
3260
3261 @item -fobjc-gc
3262 @opindex fobjc-gc
3263 Enable garbage collection (GC) in Objective-C and Objective-C++
3264 programs. This option is only available with the NeXT runtime; the
3265 GNU runtime has a different garbage collection implementation that
3266 does not require special compiler flags.
3267
3268 @item -fobjc-nilcheck
3269 @opindex fobjc-nilcheck
3270 For the NeXT runtime with version 2 of the ABI, check for a nil
3271 receiver in method invocations before doing the actual method call.
3272 This is the default and can be disabled using
3273 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3274 checked for nil in this way no matter what this flag is set to.
3275 Currently this flag does nothing when the GNU runtime, or an older
3276 version of the NeXT runtime ABI, is used.
3277
3278 @item -fobjc-std=objc1
3279 @opindex fobjc-std
3280 Conform to the language syntax of Objective-C 1.0, the language
3281 recognized by GCC 4.0. This only affects the Objective-C additions to
3282 the C/C++ language; it does not affect conformance to C/C++ standards,
3283 which is controlled by the separate C/C++ dialect option flags. When
3284 this option is used with the Objective-C or Objective-C++ compiler,
3285 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3286 This is useful if you need to make sure that your Objective-C code can
3287 be compiled with older versions of GCC@.
3288
3289 @item -freplace-objc-classes
3290 @opindex freplace-objc-classes
3291 Emit a special marker instructing @command{ld(1)} not to statically link in
3292 the resulting object file, and allow @command{dyld(1)} to load it in at
3293 run time instead. This is used in conjunction with the Fix-and-Continue
3294 debugging mode, where the object file in question may be recompiled and
3295 dynamically reloaded in the course of program execution, without the need
3296 to restart the program itself. Currently, Fix-and-Continue functionality
3297 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3298 and later.
3299
3300 @item -fzero-link
3301 @opindex fzero-link
3302 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3303 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3304 compile time) with static class references that get initialized at load time,
3305 which improves run-time performance. Specifying the @option{-fzero-link} flag
3306 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3307 to be retained. This is useful in Zero-Link debugging mode, since it allows
3308 for individual class implementations to be modified during program execution.
3309 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3310 regardless of command-line options.
3311
3312 @item -fno-local-ivars
3313 @opindex fno-local-ivars
3314 @opindex flocal-ivars
3315 By default instance variables in Objective-C can be accessed as if
3316 they were local variables from within the methods of the class they're
3317 declared in. This can lead to shadowing between instance variables
3318 and other variables declared either locally inside a class method or
3319 globally with the same name. Specifying the @option{-fno-local-ivars}
3320 flag disables this behavior thus avoiding variable shadowing issues.
3321
3322 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3323 @opindex fivar-visibility
3324 Set the default instance variable visibility to the specified option
3325 so that instance variables declared outside the scope of any access
3326 modifier directives default to the specified visibility.
3327
3328 @item -gen-decls
3329 @opindex gen-decls
3330 Dump interface declarations for all classes seen in the source file to a
3331 file named @file{@var{sourcename}.decl}.
3332
3333 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3334 @opindex Wassign-intercept
3335 @opindex Wno-assign-intercept
3336 Warn whenever an Objective-C assignment is being intercepted by the
3337 garbage collector.
3338
3339 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3340 @opindex Wno-protocol
3341 @opindex Wprotocol
3342 If a class is declared to implement a protocol, a warning is issued for
3343 every method in the protocol that is not implemented by the class. The
3344 default behavior is to issue a warning for every method not explicitly
3345 implemented in the class, even if a method implementation is inherited
3346 from the superclass. If you use the @option{-Wno-protocol} option, then
3347 methods inherited from the superclass are considered to be implemented,
3348 and no warning is issued for them.
3349
3350 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3351 @opindex Wselector
3352 @opindex Wno-selector
3353 Warn if multiple methods of different types for the same selector are
3354 found during compilation. The check is performed on the list of methods
3355 in the final stage of compilation. Additionally, a check is performed
3356 for each selector appearing in a @code{@@selector(@dots{})}
3357 expression, and a corresponding method for that selector has been found
3358 during compilation. Because these checks scan the method table only at
3359 the end of compilation, these warnings are not produced if the final
3360 stage of compilation is not reached, for example because an error is
3361 found during compilation, or because the @option{-fsyntax-only} option is
3362 being used.
3363
3364 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3365 @opindex Wstrict-selector-match
3366 @opindex Wno-strict-selector-match
3367 Warn if multiple methods with differing argument and/or return types are
3368 found for a given selector when attempting to send a message using this
3369 selector to a receiver of type @code{id} or @code{Class}. When this flag
3370 is off (which is the default behavior), the compiler omits such warnings
3371 if any differences found are confined to types that share the same size
3372 and alignment.
3373
3374 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3375 @opindex Wundeclared-selector
3376 @opindex Wno-undeclared-selector
3377 Warn if a @code{@@selector(@dots{})} expression referring to an
3378 undeclared selector is found. A selector is considered undeclared if no
3379 method with that name has been declared before the
3380 @code{@@selector(@dots{})} expression, either explicitly in an
3381 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3382 an @code{@@implementation} section. This option always performs its
3383 checks as soon as a @code{@@selector(@dots{})} expression is found,
3384 while @option{-Wselector} only performs its checks in the final stage of
3385 compilation. This also enforces the coding style convention
3386 that methods and selectors must be declared before being used.
3387
3388 @item -print-objc-runtime-info
3389 @opindex print-objc-runtime-info
3390 Generate C header describing the largest structure that is passed by
3391 value, if any.
3392
3393 @end table
3394
3395 @node Diagnostic Message Formatting Options
3396 @section Options to Control Diagnostic Messages Formatting
3397 @cindex options to control diagnostics formatting
3398 @cindex diagnostic messages
3399 @cindex message formatting
3400
3401 Traditionally, diagnostic messages have been formatted irrespective of
3402 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3403 options described below
3404 to control the formatting algorithm for diagnostic messages,
3405 e.g.@: how many characters per line, how often source location
3406 information should be reported. Note that some language front ends may not
3407 honor these options.
3408
3409 @table @gcctabopt
3410 @item -fmessage-length=@var{n}
3411 @opindex fmessage-length
3412 Try to format error messages so that they fit on lines of about
3413 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3414 done; each error message appears on a single line. This is the
3415 default for all front ends.
3416
3417 @item -fdiagnostics-show-location=once
3418 @opindex fdiagnostics-show-location
3419 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3420 reporter to emit source location information @emph{once}; that is, in
3421 case the message is too long to fit on a single physical line and has to
3422 be wrapped, the source location won't be emitted (as prefix) again,
3423 over and over, in subsequent continuation lines. This is the default
3424 behavior.
3425
3426 @item -fdiagnostics-show-location=every-line
3427 Only meaningful in line-wrapping mode. Instructs the diagnostic
3428 messages reporter to emit the same source location information (as
3429 prefix) for physical lines that result from the process of breaking
3430 a message which is too long to fit on a single line.
3431
3432 @item -fdiagnostics-color[=@var{WHEN}]
3433 @itemx -fno-diagnostics-color
3434 @opindex fdiagnostics-color
3435 @cindex highlight, color
3436 @vindex GCC_COLORS @r{environment variable}
3437 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3438 or @samp{auto}. The default depends on how the compiler has been configured,
3439 it can be any of the above @var{WHEN} options or also @samp{never}
3440 if @env{GCC_COLORS} environment variable isn't present in the environment,
3441 and @samp{auto} otherwise.
3442 @samp{auto} means to use color only when the standard error is a terminal.
3443 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3444 aliases for @option{-fdiagnostics-color=always} and
3445 @option{-fdiagnostics-color=never}, respectively.
3446
3447 The colors are defined by the environment variable @env{GCC_COLORS}.
3448 Its value is a colon-separated list of capabilities and Select Graphic
3449 Rendition (SGR) substrings. SGR commands are interpreted by the
3450 terminal or terminal emulator. (See the section in the documentation
3451 of your text terminal for permitted values and their meanings as
3452 character attributes.) These substring values are integers in decimal
3453 representation and can be concatenated with semicolons.
3454 Common values to concatenate include
3455 @samp{1} for bold,
3456 @samp{4} for underline,
3457 @samp{5} for blink,
3458 @samp{7} for inverse,
3459 @samp{39} for default foreground color,
3460 @samp{30} to @samp{37} for foreground colors,
3461 @samp{90} to @samp{97} for 16-color mode foreground colors,
3462 @samp{38;5;0} to @samp{38;5;255}
3463 for 88-color and 256-color modes foreground colors,
3464 @samp{49} for default background color,
3465 @samp{40} to @samp{47} for background colors,
3466 @samp{100} to @samp{107} for 16-color mode background colors,
3467 and @samp{48;5;0} to @samp{48;5;255}
3468 for 88-color and 256-color modes background colors.
3469
3470 The default @env{GCC_COLORS} is
3471 @smallexample
3472 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3473 quote=01:fixit-insert=32:fixit-delete=31:\
3474 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3475 type-diff=01;32
3476 @end smallexample
3477 @noindent
3478 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3479 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3480 @samp{01} is bold, and @samp{31} is red.
3481 Setting @env{GCC_COLORS} to the empty string disables colors.
3482 Supported capabilities are as follows.
3483
3484 @table @code
3485 @item error=
3486 @vindex error GCC_COLORS @r{capability}
3487 SGR substring for error: markers.
3488
3489 @item warning=
3490 @vindex warning GCC_COLORS @r{capability}
3491 SGR substring for warning: markers.
3492
3493 @item note=
3494 @vindex note GCC_COLORS @r{capability}
3495 SGR substring for note: markers.
3496
3497 @item range1=
3498 @vindex range1 GCC_COLORS @r{capability}
3499 SGR substring for first additional range.
3500
3501 @item range2=
3502 @vindex range2 GCC_COLORS @r{capability}
3503 SGR substring for second additional range.
3504
3505 @item locus=
3506 @vindex locus GCC_COLORS @r{capability}
3507 SGR substring for location information, @samp{file:line} or
3508 @samp{file:line:column} etc.
3509
3510 @item quote=
3511 @vindex quote GCC_COLORS @r{capability}
3512 SGR substring for information printed within quotes.
3513
3514 @item fixit-insert=
3515 @vindex fixit-insert GCC_COLORS @r{capability}
3516 SGR substring for fix-it hints suggesting text to
3517 be inserted or replaced.
3518
3519 @item fixit-delete=
3520 @vindex fixit-delete GCC_COLORS @r{capability}
3521 SGR substring for fix-it hints suggesting text to
3522 be deleted.
3523
3524 @item diff-filename=
3525 @vindex diff-filename GCC_COLORS @r{capability}
3526 SGR substring for filename headers within generated patches.
3527
3528 @item diff-hunk=
3529 @vindex diff-hunk GCC_COLORS @r{capability}
3530 SGR substring for the starts of hunks within generated patches.
3531
3532 @item diff-delete=
3533 @vindex diff-delete GCC_COLORS @r{capability}
3534 SGR substring for deleted lines within generated patches.
3535
3536 @item diff-insert=
3537 @vindex diff-insert GCC_COLORS @r{capability}
3538 SGR substring for inserted lines within generated patches.
3539
3540 @item type-diff=
3541 @vindex type-diff GCC_COLORS @r{capability}
3542 SGR substring for highlighting mismatching types within template
3543 arguments in the C++ frontend.
3544 @end table
3545
3546 @item -fno-diagnostics-show-option
3547 @opindex fno-diagnostics-show-option
3548 @opindex fdiagnostics-show-option
3549 By default, each diagnostic emitted includes text indicating the
3550 command-line option that directly controls the diagnostic (if such an
3551 option is known to the diagnostic machinery). Specifying the
3552 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3553
3554 @item -fno-diagnostics-show-caret
3555 @opindex fno-diagnostics-show-caret
3556 @opindex fdiagnostics-show-caret
3557 By default, each diagnostic emitted includes the original source line
3558 and a caret @samp{^} indicating the column. This option suppresses this
3559 information. The source line is truncated to @var{n} characters, if
3560 the @option{-fmessage-length=n} option is given. When the output is done
3561 to the terminal, the width is limited to the width given by the
3562 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3563
3564 @item -fdiagnostics-parseable-fixits
3565 @opindex fdiagnostics-parseable-fixits
3566 Emit fix-it hints in a machine-parseable format, suitable for consumption
3567 by IDEs. For each fix-it, a line will be printed after the relevant
3568 diagnostic, starting with the string ``fix-it:''. For example:
3569
3570 @smallexample
3571 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3572 @end smallexample
3573
3574 The location is expressed as a half-open range, expressed as a count of
3575 bytes, starting at byte 1 for the initial column. In the above example,
3576 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3577 given string:
3578
3579 @smallexample
3580 00000000011111111112222222222
3581 12345678901234567890123456789
3582 gtk_widget_showall (dlg);
3583 ^^^^^^^^^^^^^^^^^^
3584 gtk_widget_show_all
3585 @end smallexample
3586
3587 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3588 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3589 (e.g. vertical tab as ``\013'').
3590
3591 An empty replacement string indicates that the given range is to be removed.
3592 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3593 be inserted at the given position.
3594
3595 @item -fdiagnostics-generate-patch
3596 @opindex fdiagnostics-generate-patch
3597 Print fix-it hints to stderr in unified diff format, after any diagnostics
3598 are printed. For example:
3599
3600 @smallexample
3601 --- test.c
3602 +++ test.c
3603 @@ -42,5 +42,5 @@
3604
3605 void show_cb(GtkDialog *dlg)
3606 @{
3607 - gtk_widget_showall(dlg);
3608 + gtk_widget_show_all(dlg);
3609 @}
3610
3611 @end smallexample
3612
3613 The diff may or may not be colorized, following the same rules
3614 as for diagnostics (see @option{-fdiagnostics-color}).
3615
3616 @item -fdiagnostics-show-template-tree
3617 @opindex fdiagnostics-show-template-tree
3618
3619 In the C++ frontend, when printing diagnostics showing mismatching
3620 template types, such as:
3621
3622 @smallexample
3623 could not convert 'std::map<int, std::vector<double> >()'
3624 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3625 @end smallexample
3626
3627 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3628 tree-like structure showing the common and differing parts of the types,
3629 such as:
3630
3631 @smallexample
3632 map<
3633 [...],
3634 vector<
3635 [double != float]>>
3636 @end smallexample
3637
3638 The parts that differ are highlighted with color (``double'' and
3639 ``float'' in this case).
3640
3641 @item -fno-elide-type
3642 @opindex fno-elide-type
3643 @opindex felide-type
3644 By default when the C++ frontend prints diagnostics showing mismatching
3645 template types, common parts of the types are printed as ``[...]'' to
3646 simplify the error message. For example:
3647
3648 @smallexample
3649 could not convert 'std::map<int, std::vector<double> >()'
3650 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3651 @end smallexample
3652
3653 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3654 This flag also affects the output of the
3655 @option{-fdiagnostics-show-template-tree} flag.
3656
3657 @item -fno-show-column
3658 @opindex fno-show-column
3659 Do not print column numbers in diagnostics. This may be necessary if
3660 diagnostics are being scanned by a program that does not understand the
3661 column numbers, such as @command{dejagnu}.
3662
3663 @end table
3664
3665 @node Warning Options
3666 @section Options to Request or Suppress Warnings
3667 @cindex options to control warnings
3668 @cindex warning messages
3669 @cindex messages, warning
3670 @cindex suppressing warnings
3671
3672 Warnings are diagnostic messages that report constructions that
3673 are not inherently erroneous but that are risky or suggest there
3674 may have been an error.
3675
3676 The following language-independent options do not enable specific
3677 warnings but control the kinds of diagnostics produced by GCC@.
3678
3679 @table @gcctabopt
3680 @cindex syntax checking
3681 @item -fsyntax-only
3682 @opindex fsyntax-only
3683 Check the code for syntax errors, but don't do anything beyond that.
3684
3685 @item -fmax-errors=@var{n}
3686 @opindex fmax-errors
3687 Limits the maximum number of error messages to @var{n}, at which point
3688 GCC bails out rather than attempting to continue processing the source
3689 code. If @var{n} is 0 (the default), there is no limit on the number
3690 of error messages produced. If @option{-Wfatal-errors} is also
3691 specified, then @option{-Wfatal-errors} takes precedence over this
3692 option.
3693
3694 @item -w
3695 @opindex w
3696 Inhibit all warning messages.
3697
3698 @item -Werror
3699 @opindex Werror
3700 @opindex Wno-error
3701 Make all warnings into errors.
3702
3703 @item -Werror=
3704 @opindex Werror=
3705 @opindex Wno-error=
3706 Make the specified warning into an error. The specifier for a warning
3707 is appended; for example @option{-Werror=switch} turns the warnings
3708 controlled by @option{-Wswitch} into errors. This switch takes a
3709 negative form, to be used to negate @option{-Werror} for specific
3710 warnings; for example @option{-Wno-error=switch} makes
3711 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3712 is in effect.
3713
3714 The warning message for each controllable warning includes the
3715 option that controls the warning. That option can then be used with
3716 @option{-Werror=} and @option{-Wno-error=} as described above.
3717 (Printing of the option in the warning message can be disabled using the
3718 @option{-fno-diagnostics-show-option} flag.)
3719
3720 Note that specifying @option{-Werror=}@var{foo} automatically implies
3721 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3722 imply anything.
3723
3724 @item -Wfatal-errors
3725 @opindex Wfatal-errors
3726 @opindex Wno-fatal-errors
3727 This option causes the compiler to abort compilation on the first error
3728 occurred rather than trying to keep going and printing further error
3729 messages.
3730
3731 @end table
3732
3733 You can request many specific warnings with options beginning with
3734 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3735 implicit declarations. Each of these specific warning options also
3736 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3737 example, @option{-Wno-implicit}. This manual lists only one of the
3738 two forms, whichever is not the default. For further
3739 language-specific options also refer to @ref{C++ Dialect Options} and
3740 @ref{Objective-C and Objective-C++ Dialect Options}.
3741
3742 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3743 options, such as @option{-Wunused}, which may turn on further options,
3744 such as @option{-Wunused-value}. The combined effect of positive and
3745 negative forms is that more specific options have priority over less
3746 specific ones, independently of their position in the command-line. For
3747 options of the same specificity, the last one takes effect. Options
3748 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3749 as if they appeared at the end of the command-line.
3750
3751 When an unrecognized warning option is requested (e.g.,
3752 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3753 that the option is not recognized. However, if the @option{-Wno-} form
3754 is used, the behavior is slightly different: no diagnostic is
3755 produced for @option{-Wno-unknown-warning} unless other diagnostics
3756 are being produced. This allows the use of new @option{-Wno-} options
3757 with old compilers, but if something goes wrong, the compiler
3758 warns that an unrecognized option is present.
3759
3760 @table @gcctabopt
3761 @item -Wpedantic
3762 @itemx -pedantic
3763 @opindex pedantic
3764 @opindex Wpedantic
3765 Issue all the warnings demanded by strict ISO C and ISO C++;
3766 reject all programs that use forbidden extensions, and some other
3767 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3768 version of the ISO C standard specified by any @option{-std} option used.
3769
3770 Valid ISO C and ISO C++ programs should compile properly with or without
3771 this option (though a rare few require @option{-ansi} or a
3772 @option{-std} option specifying the required version of ISO C)@. However,
3773 without this option, certain GNU extensions and traditional C and C++
3774 features are supported as well. With this option, they are rejected.
3775
3776 @option{-Wpedantic} does not cause warning messages for use of the
3777 alternate keywords whose names begin and end with @samp{__}. Pedantic
3778 warnings are also disabled in the expression that follows
3779 @code{__extension__}. However, only system header files should use
3780 these escape routes; application programs should avoid them.
3781 @xref{Alternate Keywords}.
3782
3783 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3784 C conformance. They soon find that it does not do quite what they want:
3785 it finds some non-ISO practices, but not all---only those for which
3786 ISO C @emph{requires} a diagnostic, and some others for which
3787 diagnostics have been added.
3788
3789 A feature to report any failure to conform to ISO C might be useful in
3790 some instances, but would require considerable additional work and would
3791 be quite different from @option{-Wpedantic}. We don't have plans to
3792 support such a feature in the near future.
3793
3794 Where the standard specified with @option{-std} represents a GNU
3795 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3796 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3797 extended dialect is based. Warnings from @option{-Wpedantic} are given
3798 where they are required by the base standard. (It does not make sense
3799 for such warnings to be given only for features not in the specified GNU
3800 C dialect, since by definition the GNU dialects of C include all
3801 features the compiler supports with the given option, and there would be
3802 nothing to warn about.)
3803
3804 @item -pedantic-errors
3805 @opindex pedantic-errors
3806 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3807 requires a diagnostic, in some cases where there is undefined behavior
3808 at compile-time and in some other cases that do not prevent compilation
3809 of programs that are valid according to the standard. This is not
3810 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3811 by this option and not enabled by the latter and vice versa.
3812
3813 @item -Wall
3814 @opindex Wall
3815 @opindex Wno-all
3816 This enables all the warnings about constructions that some users
3817 consider questionable, and that are easy to avoid (or modify to
3818 prevent the warning), even in conjunction with macros. This also
3819 enables some language-specific warnings described in @ref{C++ Dialect
3820 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3821
3822 @option{-Wall} turns on the following warning flags:
3823
3824 @gccoptlist{-Waddress @gol
3825 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3826 -Wbool-compare @gol
3827 -Wbool-operation @gol
3828 -Wc++11-compat -Wc++14-compat @gol
3829 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
3830 -Wchar-subscripts @gol
3831 -Wcomment @gol
3832 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3833 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3834 -Wformat @gol
3835 -Wint-in-bool-context @gol
3836 -Wimplicit @r{(C and Objective-C only)} @gol
3837 -Wimplicit-int @r{(C and Objective-C only)} @gol
3838 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3839 -Winit-self @r{(only for C++)} @gol
3840 -Wlogical-not-parentheses @gol
3841 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3842 -Wmaybe-uninitialized @gol
3843 -Wmemset-elt-size @gol
3844 -Wmemset-transposed-args @gol
3845 -Wmisleading-indentation @r{(only for C/C++)} @gol
3846 -Wmissing-braces @r{(only for C/ObjC)} @gol
3847 -Wmultistatement-macros @gol
3848 -Wnarrowing @r{(only for C++)} @gol
3849 -Wnonnull @gol
3850 -Wnonnull-compare @gol
3851 -Wopenmp-simd @gol
3852 -Wparentheses @gol
3853 -Wpointer-sign @gol
3854 -Wreorder @gol
3855 -Wreturn-type @gol
3856 -Wsequence-point @gol
3857 -Wsign-compare @r{(only in C++)} @gol
3858 -Wsizeof-pointer-div @gol
3859 -Wsizeof-pointer-memaccess @gol
3860 -Wstrict-aliasing @gol
3861 -Wstrict-overflow=1 @gol
3862 -Wswitch @gol
3863 -Wtautological-compare @gol
3864 -Wtrigraphs @gol
3865 -Wuninitialized @gol
3866 -Wunknown-pragmas @gol
3867 -Wunused-function @gol
3868 -Wunused-label @gol
3869 -Wunused-value @gol
3870 -Wunused-variable @gol
3871 -Wvolatile-register-var @gol
3872 }
3873
3874 Note that some warning flags are not implied by @option{-Wall}. Some of
3875 them warn about constructions that users generally do not consider
3876 questionable, but which occasionally you might wish to check for;
3877 others warn about constructions that are necessary or hard to avoid in
3878 some cases, and there is no simple way to modify the code to suppress
3879 the warning. Some of them are enabled by @option{-Wextra} but many of
3880 them must be enabled individually.
3881
3882 @item -Wextra
3883 @opindex W
3884 @opindex Wextra
3885 @opindex Wno-extra
3886 This enables some extra warning flags that are not enabled by
3887 @option{-Wall}. (This option used to be called @option{-W}. The older
3888 name is still supported, but the newer name is more descriptive.)
3889
3890 @gccoptlist{-Wclobbered @gol
3891 -Wempty-body @gol
3892 -Wignored-qualifiers @gol
3893 -Wimplicit-fallthrough=3 @gol
3894 -Wmissing-field-initializers @gol
3895 -Wmissing-parameter-type @r{(C only)} @gol
3896 -Wold-style-declaration @r{(C only)} @gol
3897 -Woverride-init @gol
3898 -Wsign-compare @r{(C only)} @gol
3899 -Wtype-limits @gol
3900 -Wuninitialized @gol
3901 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3902 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3903 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3904 }
3905
3906 The option @option{-Wextra} also prints warning messages for the
3907 following cases:
3908
3909 @itemize @bullet
3910
3911 @item
3912 A pointer is compared against integer zero with @code{<}, @code{<=},
3913 @code{>}, or @code{>=}.
3914
3915 @item
3916 (C++ only) An enumerator and a non-enumerator both appear in a
3917 conditional expression.
3918
3919 @item
3920 (C++ only) Ambiguous virtual bases.
3921
3922 @item
3923 (C++ only) Subscripting an array that has been declared @code{register}.
3924
3925 @item
3926 (C++ only) Taking the address of a variable that has been declared
3927 @code{register}.
3928
3929 @item
3930 (C++ only) A base class is not initialized in the copy constructor
3931 of a derived class.
3932
3933 @end itemize
3934
3935 @item -Wchar-subscripts
3936 @opindex Wchar-subscripts
3937 @opindex Wno-char-subscripts
3938 Warn if an array subscript has type @code{char}. This is a common cause
3939 of error, as programmers often forget that this type is signed on some
3940 machines.
3941 This warning is enabled by @option{-Wall}.
3942
3943 @item -Wchkp
3944 @opindex Wchkp
3945 Warn about an invalid memory access that is found by Pointer Bounds Checker
3946 (@option{-fcheck-pointer-bounds}).
3947
3948 @item -Wno-coverage-mismatch
3949 @opindex Wno-coverage-mismatch
3950 Warn if feedback profiles do not match when using the
3951 @option{-fprofile-use} option.
3952 If a source file is changed between compiling with @option{-fprofile-gen} and
3953 with @option{-fprofile-use}, the files with the profile feedback can fail
3954 to match the source file and GCC cannot use the profile feedback
3955 information. By default, this warning is enabled and is treated as an
3956 error. @option{-Wno-coverage-mismatch} can be used to disable the
3957 warning or @option{-Wno-error=coverage-mismatch} can be used to
3958 disable the error. Disabling the error for this warning can result in
3959 poorly optimized code and is useful only in the
3960 case of very minor changes such as bug fixes to an existing code-base.
3961 Completely disabling the warning is not recommended.
3962
3963 @item -Wno-cpp
3964 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3965
3966 Suppress warning messages emitted by @code{#warning} directives.
3967
3968 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3969 @opindex Wdouble-promotion
3970 @opindex Wno-double-promotion
3971 Give a warning when a value of type @code{float} is implicitly
3972 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3973 floating-point unit implement @code{float} in hardware, but emulate
3974 @code{double} in software. On such a machine, doing computations
3975 using @code{double} values is much more expensive because of the
3976 overhead required for software emulation.
3977
3978 It is easy to accidentally do computations with @code{double} because
3979 floating-point literals are implicitly of type @code{double}. For
3980 example, in:
3981 @smallexample
3982 @group
3983 float area(float radius)
3984 @{
3985 return 3.14159 * radius * radius;
3986 @}
3987 @end group
3988 @end smallexample
3989 the compiler performs the entire computation with @code{double}
3990 because the floating-point literal is a @code{double}.
3991
3992 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
3993 @opindex Wduplicate-decl-specifier
3994 @opindex Wno-duplicate-decl-specifier
3995 Warn if a declaration has duplicate @code{const}, @code{volatile},
3996 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
3997 @option{-Wall}.
3998
3999 @item -Wformat
4000 @itemx -Wformat=@var{n}
4001 @opindex Wformat
4002 @opindex Wno-format
4003 @opindex ffreestanding
4004 @opindex fno-builtin
4005 @opindex Wformat=
4006 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4007 the arguments supplied have types appropriate to the format string
4008 specified, and that the conversions specified in the format string make
4009 sense. This includes standard functions, and others specified by format
4010 attributes (@pxref{Function Attributes}), in the @code{printf},
4011 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4012 not in the C standard) families (or other target-specific families).
4013 Which functions are checked without format attributes having been
4014 specified depends on the standard version selected, and such checks of
4015 functions without the attribute specified are disabled by
4016 @option{-ffreestanding} or @option{-fno-builtin}.
4017
4018 The formats are checked against the format features supported by GNU
4019 libc version 2.2. These include all ISO C90 and C99 features, as well
4020 as features from the Single Unix Specification and some BSD and GNU
4021 extensions. Other library implementations may not support all these
4022 features; GCC does not support warning about features that go beyond a
4023 particular library's limitations. However, if @option{-Wpedantic} is used
4024 with @option{-Wformat}, warnings are given about format features not
4025 in the selected standard version (but not for @code{strfmon} formats,
4026 since those are not in any version of the C standard). @xref{C Dialect
4027 Options,,Options Controlling C Dialect}.
4028
4029 @table @gcctabopt
4030 @item -Wformat=1
4031 @itemx -Wformat
4032 @opindex Wformat
4033 @opindex Wformat=1
4034 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4035 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4036 @option{-Wformat} also checks for null format arguments for several
4037 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4038 aspects of this level of format checking can be disabled by the
4039 options: @option{-Wno-format-contains-nul},
4040 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4041 @option{-Wformat} is enabled by @option{-Wall}.
4042
4043 @item -Wno-format-contains-nul
4044 @opindex Wno-format-contains-nul
4045 @opindex Wformat-contains-nul
4046 If @option{-Wformat} is specified, do not warn about format strings that
4047 contain NUL bytes.
4048
4049 @item -Wno-format-extra-args
4050 @opindex Wno-format-extra-args
4051 @opindex Wformat-extra-args
4052 If @option{-Wformat} is specified, do not warn about excess arguments to a
4053 @code{printf} or @code{scanf} format function. The C standard specifies
4054 that such arguments are ignored.
4055
4056 Where the unused arguments lie between used arguments that are
4057 specified with @samp{$} operand number specifications, normally
4058 warnings are still given, since the implementation could not know what
4059 type to pass to @code{va_arg} to skip the unused arguments. However,
4060 in the case of @code{scanf} formats, this option suppresses the
4061 warning if the unused arguments are all pointers, since the Single
4062 Unix Specification says that such unused arguments are allowed.
4063
4064 @item -Wformat-overflow
4065 @itemx -Wformat-overflow=@var{level}
4066 @opindex Wformat-overflow
4067 @opindex Wno-format-overflow
4068 Warn about calls to formatted input/output functions such as @code{sprintf}
4069 and @code{vsprintf} that might overflow the destination buffer. When the
4070 exact number of bytes written by a format directive cannot be determined
4071 at compile-time it is estimated based on heuristics that depend on the
4072 @var{level} argument and on optimization. While enabling optimization
4073 will in most cases improve the accuracy of the warning, it may also
4074 result in false positives.
4075
4076 @table @gcctabopt
4077 @item -Wformat-overflow
4078 @item -Wformat-overflow=1
4079 @opindex Wformat-overflow
4080 @opindex Wno-format-overflow
4081 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4082 employs a conservative approach that warns only about calls that most
4083 likely overflow the buffer. At this level, numeric arguments to format
4084 directives with unknown values are assumed to have the value of one, and
4085 strings of unknown length to be empty. Numeric arguments that are known
4086 to be bounded to a subrange of their type, or string arguments whose output
4087 is bounded either by their directive's precision or by a finite set of
4088 string literals, are assumed to take on the value within the range that
4089 results in the most bytes on output. For example, the call to @code{sprintf}
4090 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4091 the terminating NUL character (@code{'\0'}) appended by the function
4092 to the destination buffer will be written past its end. Increasing
4093 the size of the buffer by a single byte is sufficient to avoid the
4094 warning, though it may not be sufficient to avoid the overflow.
4095
4096 @smallexample
4097 void f (int a, int b)
4098 @{
4099 char buf [12];
4100 sprintf (buf, "a = %i, b = %i\n", a, b);
4101 @}
4102 @end smallexample
4103
4104 @item -Wformat-overflow=2
4105 Level @var{2} warns also about calls that might overflow the destination
4106 buffer given an argument of sufficient length or magnitude. At level
4107 @var{2}, unknown numeric arguments are assumed to have the minimum
4108 representable value for signed types with a precision greater than 1, and
4109 the maximum representable value otherwise. Unknown string arguments whose
4110 length cannot be assumed to be bounded either by the directive's precision,
4111 or by a finite set of string literals they may evaluate to, or the character
4112 array they may point to, are assumed to be 1 character long.
4113
4114 At level @var{2}, the call in the example above is again diagnosed, but
4115 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4116 @code{%i} directive will write some of its digits beyond the end of
4117 the destination buffer. To make the call safe regardless of the values
4118 of the two variables, the size of the destination buffer must be increased
4119 to at least 34 bytes. GCC includes the minimum size of the buffer in
4120 an informational note following the warning.
4121
4122 An alternative to increasing the size of the destination buffer is to
4123 constrain the range of formatted values. The maximum length of string
4124 arguments can be bounded by specifying the precision in the format
4125 directive. When numeric arguments of format directives can be assumed
4126 to be bounded by less than the precision of their type, choosing
4127 an appropriate length modifier to the format specifier will reduce
4128 the required buffer size. For example, if @var{a} and @var{b} in the
4129 example above can be assumed to be within the precision of
4130 the @code{short int} type then using either the @code{%hi} format
4131 directive or casting the argument to @code{short} reduces the maximum
4132 required size of the buffer to 24 bytes.
4133
4134 @smallexample
4135 void f (int a, int b)
4136 @{
4137 char buf [23];
4138 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4139 @}
4140 @end smallexample
4141 @end table
4142
4143 @item -Wno-format-zero-length
4144 @opindex Wno-format-zero-length
4145 @opindex Wformat-zero-length
4146 If @option{-Wformat} is specified, do not warn about zero-length formats.
4147 The C standard specifies that zero-length formats are allowed.
4148
4149
4150 @item -Wformat=2
4151 @opindex Wformat=2
4152 Enable @option{-Wformat} plus additional format checks. Currently
4153 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4154 -Wformat-y2k}.
4155
4156 @item -Wformat-nonliteral
4157 @opindex Wformat-nonliteral
4158 @opindex Wno-format-nonliteral
4159 If @option{-Wformat} is specified, also warn if the format string is not a
4160 string literal and so cannot be checked, unless the format function
4161 takes its format arguments as a @code{va_list}.
4162
4163 @item -Wformat-security
4164 @opindex Wformat-security
4165 @opindex Wno-format-security
4166 If @option{-Wformat} is specified, also warn about uses of format
4167 functions that represent possible security problems. At present, this
4168 warns about calls to @code{printf} and @code{scanf} functions where the
4169 format string is not a string literal and there are no format arguments,
4170 as in @code{printf (foo);}. This may be a security hole if the format
4171 string came from untrusted input and contains @samp{%n}. (This is
4172 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4173 in future warnings may be added to @option{-Wformat-security} that are not
4174 included in @option{-Wformat-nonliteral}.)
4175
4176 @item -Wformat-signedness
4177 @opindex Wformat-signedness
4178 @opindex Wno-format-signedness
4179 If @option{-Wformat} is specified, also warn if the format string
4180 requires an unsigned argument and the argument is signed and vice versa.
4181
4182 @item -Wformat-truncation
4183 @itemx -Wformat-truncation=@var{level}
4184 @opindex Wformat-truncation
4185 @opindex Wno-format-truncation
4186 Warn about calls to formatted input/output functions such as @code{snprintf}
4187 and @code{vsnprintf} that might result in output truncation. When the exact
4188 number of bytes written by a format directive cannot be determined at
4189 compile-time it is estimated based on heuristics that depend on
4190 the @var{level} argument and on optimization. While enabling optimization
4191 will in most cases improve the accuracy of the warning, it may also result
4192 in false positives. Except as noted otherwise, the option uses the same
4193 logic @option{-Wformat-overflow}.
4194
4195 @table @gcctabopt
4196 @item -Wformat-truncation
4197 @item -Wformat-truncation=1
4198 @opindex Wformat-truncation
4199 @opindex Wno-format-overflow
4200 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4201 employs a conservative approach that warns only about calls to bounded
4202 functions whose return value is unused and that will most likely result
4203 in output truncation.
4204
4205 @item -Wformat-truncation=2
4206 Level @var{2} warns also about calls to bounded functions whose return
4207 value is used and that might result in truncation given an argument of
4208 sufficient length or magnitude.
4209 @end table
4210
4211 @item -Wformat-y2k
4212 @opindex Wformat-y2k
4213 @opindex Wno-format-y2k
4214 If @option{-Wformat} is specified, also warn about @code{strftime}
4215 formats that may yield only a two-digit year.
4216 @end table
4217
4218 @item -Wnonnull
4219 @opindex Wnonnull
4220 @opindex Wno-nonnull
4221 Warn about passing a null pointer for arguments marked as
4222 requiring a non-null value by the @code{nonnull} function attribute.
4223
4224 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4225 can be disabled with the @option{-Wno-nonnull} option.
4226
4227 @item -Wnonnull-compare
4228 @opindex Wnonnull-compare
4229 @opindex Wno-nonnull-compare
4230 Warn when comparing an argument marked with the @code{nonnull}
4231 function attribute against null inside the function.
4232
4233 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4234 can be disabled with the @option{-Wno-nonnull-compare} option.
4235
4236 @item -Wnull-dereference
4237 @opindex Wnull-dereference
4238 @opindex Wno-null-dereference
4239 Warn if the compiler detects paths that trigger erroneous or
4240 undefined behavior due to dereferencing a null pointer. This option
4241 is only active when @option{-fdelete-null-pointer-checks} is active,
4242 which is enabled by optimizations in most targets. The precision of
4243 the warnings depends on the optimization options used.
4244
4245 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4246 @opindex Winit-self
4247 @opindex Wno-init-self
4248 Warn about uninitialized variables that are initialized with themselves.
4249 Note this option can only be used with the @option{-Wuninitialized} option.
4250
4251 For example, GCC warns about @code{i} being uninitialized in the
4252 following snippet only when @option{-Winit-self} has been specified:
4253 @smallexample
4254 @group
4255 int f()
4256 @{
4257 int i = i;
4258 return i;
4259 @}
4260 @end group
4261 @end smallexample
4262
4263 This warning is enabled by @option{-Wall} in C++.
4264
4265 @item -Wimplicit-int @r{(C and Objective-C only)}
4266 @opindex Wimplicit-int
4267 @opindex Wno-implicit-int
4268 Warn when a declaration does not specify a type.
4269 This warning is enabled by @option{-Wall}.
4270
4271 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4272 @opindex Wimplicit-function-declaration
4273 @opindex Wno-implicit-function-declaration
4274 Give a warning whenever a function is used before being declared. In
4275 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4276 enabled by default and it is made into an error by
4277 @option{-pedantic-errors}. This warning is also enabled by
4278 @option{-Wall}.
4279
4280 @item -Wimplicit @r{(C and Objective-C only)}
4281 @opindex Wimplicit
4282 @opindex Wno-implicit
4283 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4284 This warning is enabled by @option{-Wall}.
4285
4286 @item -Wimplicit-fallthrough
4287 @opindex Wimplicit-fallthrough
4288 @opindex Wno-implicit-fallthrough
4289 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4290 and @option{-Wno-implicit-fallthrough} is the same as
4291 @option{-Wimplicit-fallthrough=0}.
4292
4293 @item -Wimplicit-fallthrough=@var{n}
4294 @opindex Wimplicit-fallthrough=
4295 Warn when a switch case falls through. For example:
4296
4297 @smallexample
4298 @group
4299 switch (cond)
4300 @{
4301 case 1:
4302 a = 1;
4303 break;
4304 case 2:
4305 a = 2;
4306 case 3:
4307 a = 3;
4308 break;
4309 @}
4310 @end group
4311 @end smallexample
4312
4313 This warning does not warn when the last statement of a case cannot
4314 fall through, e.g. when there is a return statement or a call to function
4315 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4316 also takes into account control flow statements, such as ifs, and only
4317 warns when appropriate. E.g.@:
4318
4319 @smallexample
4320 @group
4321 switch (cond)
4322 @{
4323 case 1:
4324 if (i > 3) @{
4325 bar (5);
4326 break;
4327 @} else if (i < 1) @{
4328 bar (0);
4329 @} else
4330 return;
4331 default:
4332 @dots{}
4333 @}
4334 @end group
4335 @end smallexample
4336
4337 Since there are occasions where a switch case fall through is desirable,
4338 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4339 to be used along with a null statement to suppress this warning that
4340 would normally occur:
4341
4342 @smallexample
4343 @group
4344 switch (cond)
4345 @{
4346 case 1:
4347 bar (0);
4348 __attribute__ ((fallthrough));
4349 default:
4350 @dots{}
4351 @}
4352 @end group
4353 @end smallexample
4354
4355 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4356 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4357 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4358 Instead of these attributes, it is also possible to add a fallthrough comment
4359 to silence the warning. The whole body of the C or C++ style comment should
4360 match the given regular expressions listed below. The option argument @var{n}
4361 specifies what kind of comments are accepted:
4362
4363 @itemize @bullet
4364
4365 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4366
4367 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4368 expression, any comment is used as fallthrough comment.
4369
4370 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4371 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4372
4373 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4374 following regular expressions:
4375
4376 @itemize @bullet
4377
4378 @item @code{-fallthrough}
4379
4380 @item @code{@@fallthrough@@}
4381
4382 @item @code{lint -fallthrough[ \t]*}
4383
4384 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4385
4386 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4387
4388 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4389
4390 @end itemize
4391
4392 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4393 following regular expressions:
4394
4395 @itemize @bullet
4396
4397 @item @code{-fallthrough}
4398
4399 @item @code{@@fallthrough@@}
4400
4401 @item @code{lint -fallthrough[ \t]*}
4402
4403 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4404
4405 @end itemize
4406
4407 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4408 fallthrough comments, only attributes disable the warning.
4409
4410 @end itemize
4411
4412 The comment needs to be followed after optional whitespace and other comments
4413 by @code{case} or @code{default} keywords or by a user label that precedes some
4414 @code{case} or @code{default} label.
4415
4416 @smallexample
4417 @group
4418 switch (cond)
4419 @{
4420 case 1:
4421 bar (0);
4422 /* FALLTHRU */
4423 default:
4424 @dots{}
4425 @}
4426 @end group
4427 @end smallexample
4428
4429 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4430
4431 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4432 @opindex Wif-not-aligned
4433 @opindex Wno-if-not-aligned
4434 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4435 should be issued. This is is enabled by default.
4436 Use @option{-Wno-if-not-aligned} to disable it.
4437
4438 @item -Wignored-qualifiers @r{(C and C++ only)}
4439 @opindex Wignored-qualifiers
4440 @opindex Wno-ignored-qualifiers
4441 Warn if the return type of a function has a type qualifier
4442 such as @code{const}. For ISO C such a type qualifier has no effect,
4443 since the value returned by a function is not an lvalue.
4444 For C++, the warning is only emitted for scalar types or @code{void}.
4445 ISO C prohibits qualified @code{void} return types on function
4446 definitions, so such return types always receive a warning
4447 even without this option.
4448
4449 This warning is also enabled by @option{-Wextra}.
4450
4451 @item -Wignored-attributes @r{(C and C++ only)}
4452 @opindex Wignored-attributes
4453 @opindex Wno-ignored-attributes
4454 Warn when an attribute is ignored. This is different from the
4455 @option{-Wattributes} option in that it warns whenever the compiler decides
4456 to drop an attribute, not that the attribute is either unknown, used in a
4457 wrong place, etc. This warning is enabled by default.
4458
4459 @item -Wmain
4460 @opindex Wmain
4461 @opindex Wno-main
4462 Warn if the type of @code{main} is suspicious. @code{main} should be
4463 a function with external linkage, returning int, taking either zero
4464 arguments, two, or three arguments of appropriate types. This warning
4465 is enabled by default in C++ and is enabled by either @option{-Wall}
4466 or @option{-Wpedantic}.
4467
4468 @item -Wmisleading-indentation @r{(C and C++ only)}
4469 @opindex Wmisleading-indentation
4470 @opindex Wno-misleading-indentation
4471 Warn when the indentation of the code does not reflect the block structure.
4472 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4473 @code{for} clauses with a guarded statement that does not use braces,
4474 followed by an unguarded statement with the same indentation.
4475
4476 In the following example, the call to ``bar'' is misleadingly indented as
4477 if it were guarded by the ``if'' conditional.
4478
4479 @smallexample
4480 if (some_condition ())
4481 foo ();
4482 bar (); /* Gotcha: this is not guarded by the "if". */
4483 @end smallexample
4484
4485 In the case of mixed tabs and spaces, the warning uses the
4486 @option{-ftabstop=} option to determine if the statements line up
4487 (defaulting to 8).
4488
4489 The warning is not issued for code involving multiline preprocessor logic
4490 such as the following example.
4491
4492 @smallexample
4493 if (flagA)
4494 foo (0);
4495 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4496 if (flagB)
4497 #endif
4498 foo (1);
4499 @end smallexample
4500
4501 The warning is not issued after a @code{#line} directive, since this
4502 typically indicates autogenerated code, and no assumptions can be made
4503 about the layout of the file that the directive references.
4504
4505 This warning is enabled by @option{-Wall} in C and C++.
4506
4507 @item -Wmissing-braces
4508 @opindex Wmissing-braces
4509 @opindex Wno-missing-braces
4510 Warn if an aggregate or union initializer is not fully bracketed. In
4511 the following example, the initializer for @code{a} is not fully
4512 bracketed, but that for @code{b} is fully bracketed. This warning is
4513 enabled by @option{-Wall} in C.
4514
4515 @smallexample
4516 int a[2][2] = @{ 0, 1, 2, 3 @};
4517 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4518 @end smallexample
4519
4520 This warning is enabled by @option{-Wall}.
4521
4522 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4523 @opindex Wmissing-include-dirs
4524 @opindex Wno-missing-include-dirs
4525 Warn if a user-supplied include directory does not exist.
4526
4527 @item -Wmultistatement-macros
4528 @opindex Wmultistatement-macros
4529 @opindex Wno-multistatement-macros
4530 Warn about unsafe multiple statement macros that appear to be guarded
4531 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
4532 @code{while}, in which only the first statement is actually guarded after
4533 the macro is expanded.
4534
4535 For example:
4536
4537 @smallexample
4538 #define DOIT x++; y++
4539 if (c)
4540 DOIT;
4541 @end smallexample
4542
4543 will increment @code{y} unconditionally, not just when @code{c} holds.
4544 The can usually be fixed by wrapping the macro in a do-while loop:
4545 @smallexample
4546 #define DOIT do @{ x++; y++; @} while (0)
4547 if (c)
4548 DOIT;
4549 @end smallexample
4550
4551 This warning is enabled by @option{-Wall} in C and C++.
4552
4553 @item -Wparentheses
4554 @opindex Wparentheses
4555 @opindex Wno-parentheses
4556 Warn if parentheses are omitted in certain contexts, such
4557 as when there is an assignment in a context where a truth value
4558 is expected, or when operators are nested whose precedence people
4559 often get confused about.
4560
4561 Also warn if a comparison like @code{x<=y<=z} appears; this is
4562 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4563 interpretation from that of ordinary mathematical notation.
4564
4565 Also warn for dangerous uses of the GNU extension to
4566 @code{?:} with omitted middle operand. When the condition
4567 in the @code{?}: operator is a boolean expression, the omitted value is
4568 always 1. Often programmers expect it to be a value computed
4569 inside the conditional expression instead.
4570
4571 This warning is enabled by @option{-Wall}.
4572
4573 @item -Wsequence-point
4574 @opindex Wsequence-point
4575 @opindex Wno-sequence-point
4576 Warn about code that may have undefined semantics because of violations
4577 of sequence point rules in the C and C++ standards.
4578
4579 The C and C++ standards define the order in which expressions in a C/C++
4580 program are evaluated in terms of @dfn{sequence points}, which represent
4581 a partial ordering between the execution of parts of the program: those
4582 executed before the sequence point, and those executed after it. These
4583 occur after the evaluation of a full expression (one which is not part
4584 of a larger expression), after the evaluation of the first operand of a
4585 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4586 function is called (but after the evaluation of its arguments and the
4587 expression denoting the called function), and in certain other places.
4588 Other than as expressed by the sequence point rules, the order of
4589 evaluation of subexpressions of an expression is not specified. All
4590 these rules describe only a partial order rather than a total order,
4591 since, for example, if two functions are called within one expression
4592 with no sequence point between them, the order in which the functions
4593 are called is not specified. However, the standards committee have
4594 ruled that function calls do not overlap.
4595
4596 It is not specified when between sequence points modifications to the
4597 values of objects take effect. Programs whose behavior depends on this
4598 have undefined behavior; the C and C++ standards specify that ``Between
4599 the previous and next sequence point an object shall have its stored
4600 value modified at most once by the evaluation of an expression.
4601 Furthermore, the prior value shall be read only to determine the value
4602 to be stored.''. If a program breaks these rules, the results on any
4603 particular implementation are entirely unpredictable.
4604
4605 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4606 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4607 diagnosed by this option, and it may give an occasional false positive
4608 result, but in general it has been found fairly effective at detecting
4609 this sort of problem in programs.
4610
4611 The C++17 standard will define the order of evaluation of operands in
4612 more cases: in particular it requires that the right-hand side of an
4613 assignment be evaluated before the left-hand side, so the above
4614 examples are no longer undefined. But this warning will still warn
4615 about them, to help people avoid writing code that is undefined in C
4616 and earlier revisions of C++.
4617
4618 The standard is worded confusingly, therefore there is some debate
4619 over the precise meaning of the sequence point rules in subtle cases.
4620 Links to discussions of the problem, including proposed formal
4621 definitions, may be found on the GCC readings page, at
4622 @uref{http://gcc.gnu.org/@/readings.html}.
4623
4624 This warning is enabled by @option{-Wall} for C and C++.
4625
4626 @item -Wno-return-local-addr
4627 @opindex Wno-return-local-addr
4628 @opindex Wreturn-local-addr
4629 Do not warn about returning a pointer (or in C++, a reference) to a
4630 variable that goes out of scope after the function returns.
4631
4632 @item -Wreturn-type
4633 @opindex Wreturn-type
4634 @opindex Wno-return-type
4635 Warn whenever a function is defined with a return type that defaults
4636 to @code{int}. Also warn about any @code{return} statement with no
4637 return value in a function whose return type is not @code{void}
4638 (falling off the end of the function body is considered returning
4639 without a value).
4640
4641 For C only, warn about a @code{return} statement with an expression in a
4642 function whose return type is @code{void}, unless the expression type is
4643 also @code{void}. As a GNU extension, the latter case is accepted
4644 without a warning unless @option{-Wpedantic} is used.
4645
4646 For C++, a function without return type always produces a diagnostic
4647 message, even when @option{-Wno-return-type} is specified. The only
4648 exceptions are @code{main} and functions defined in system headers.
4649
4650 This warning is enabled by @option{-Wall}.
4651
4652 @item -Wshift-count-negative
4653 @opindex Wshift-count-negative
4654 @opindex Wno-shift-count-negative
4655 Warn if shift count is negative. This warning is enabled by default.
4656
4657 @item -Wshift-count-overflow
4658 @opindex Wshift-count-overflow
4659 @opindex Wno-shift-count-overflow
4660 Warn if shift count >= width of type. This warning is enabled by default.
4661
4662 @item -Wshift-negative-value
4663 @opindex Wshift-negative-value
4664 @opindex Wno-shift-negative-value
4665 Warn if left shifting a negative value. This warning is enabled by
4666 @option{-Wextra} in C99 and C++11 modes (and newer).
4667
4668 @item -Wshift-overflow
4669 @itemx -Wshift-overflow=@var{n}
4670 @opindex Wshift-overflow
4671 @opindex Wno-shift-overflow
4672 Warn about left shift overflows. This warning is enabled by
4673 default in C99 and C++11 modes (and newer).
4674
4675 @table @gcctabopt
4676 @item -Wshift-overflow=1
4677 This is the warning level of @option{-Wshift-overflow} and is enabled
4678 by default in C99 and C++11 modes (and newer). This warning level does
4679 not warn about left-shifting 1 into the sign bit. (However, in C, such
4680 an overflow is still rejected in contexts where an integer constant expression
4681 is required.)
4682
4683 @item -Wshift-overflow=2
4684 This warning level also warns about left-shifting 1 into the sign bit,
4685 unless C++14 mode is active.
4686 @end table
4687
4688 @item -Wswitch
4689 @opindex Wswitch
4690 @opindex Wno-switch
4691 Warn whenever a @code{switch} statement has an index of enumerated type
4692 and lacks a @code{case} for one or more of the named codes of that
4693 enumeration. (The presence of a @code{default} label prevents this
4694 warning.) @code{case} labels outside the enumeration range also
4695 provoke warnings when this option is used (even if there is a
4696 @code{default} label).
4697 This warning is enabled by @option{-Wall}.
4698
4699 @item -Wswitch-default
4700 @opindex Wswitch-default
4701 @opindex Wno-switch-default
4702 Warn whenever a @code{switch} statement does not have a @code{default}
4703 case.
4704
4705 @item -Wswitch-enum
4706 @opindex Wswitch-enum
4707 @opindex Wno-switch-enum
4708 Warn whenever a @code{switch} statement has an index of enumerated type
4709 and lacks a @code{case} for one or more of the named codes of that
4710 enumeration. @code{case} labels outside the enumeration range also
4711 provoke warnings when this option is used. The only difference
4712 between @option{-Wswitch} and this option is that this option gives a
4713 warning about an omitted enumeration code even if there is a
4714 @code{default} label.
4715
4716 @item -Wswitch-bool
4717 @opindex Wswitch-bool
4718 @opindex Wno-switch-bool
4719 Warn whenever a @code{switch} statement has an index of boolean type
4720 and the case values are outside the range of a boolean type.
4721 It is possible to suppress this warning by casting the controlling
4722 expression to a type other than @code{bool}. For example:
4723 @smallexample
4724 @group
4725 switch ((int) (a == 4))
4726 @{
4727 @dots{}
4728 @}
4729 @end group
4730 @end smallexample
4731 This warning is enabled by default for C and C++ programs.
4732
4733 @item -Wswitch-unreachable
4734 @opindex Wswitch-unreachable
4735 @opindex Wno-switch-unreachable
4736 Warn whenever a @code{switch} statement contains statements between the
4737 controlling expression and the first case label, which will never be
4738 executed. For example:
4739 @smallexample
4740 @group
4741 switch (cond)
4742 @{
4743 i = 15;
4744 @dots{}
4745 case 5:
4746 @dots{}
4747 @}
4748 @end group
4749 @end smallexample
4750 @option{-Wswitch-unreachable} does not warn if the statement between the
4751 controlling expression and the first case label is just a declaration:
4752 @smallexample
4753 @group
4754 switch (cond)
4755 @{
4756 int i;
4757 @dots{}
4758 case 5:
4759 i = 5;
4760 @dots{}
4761 @}
4762 @end group
4763 @end smallexample
4764 This warning is enabled by default for C and C++ programs.
4765
4766 @item -Wsync-nand @r{(C and C++ only)}
4767 @opindex Wsync-nand
4768 @opindex Wno-sync-nand
4769 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4770 built-in functions are used. These functions changed semantics in GCC 4.4.
4771
4772 @item -Wunused-but-set-parameter
4773 @opindex Wunused-but-set-parameter
4774 @opindex Wno-unused-but-set-parameter
4775 Warn whenever a function parameter is assigned to, but otherwise unused
4776 (aside from its declaration).
4777
4778 To suppress this warning use the @code{unused} attribute
4779 (@pxref{Variable Attributes}).
4780
4781 This warning is also enabled by @option{-Wunused} together with
4782 @option{-Wextra}.
4783
4784 @item -Wunused-but-set-variable
4785 @opindex Wunused-but-set-variable
4786 @opindex Wno-unused-but-set-variable
4787 Warn whenever a local variable is assigned to, but otherwise unused
4788 (aside from its declaration).
4789 This warning is enabled by @option{-Wall}.
4790
4791 To suppress this warning use the @code{unused} attribute
4792 (@pxref{Variable Attributes}).
4793
4794 This warning is also enabled by @option{-Wunused}, which is enabled
4795 by @option{-Wall}.
4796
4797 @item -Wunused-function
4798 @opindex Wunused-function
4799 @opindex Wno-unused-function
4800 Warn whenever a static function is declared but not defined or a
4801 non-inline static function is unused.
4802 This warning is enabled by @option{-Wall}.
4803
4804 @item -Wunused-label
4805 @opindex Wunused-label
4806 @opindex Wno-unused-label
4807 Warn whenever a label is declared but not used.
4808 This warning is enabled by @option{-Wall}.
4809
4810 To suppress this warning use the @code{unused} attribute
4811 (@pxref{Variable Attributes}).
4812
4813 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4814 @opindex Wunused-local-typedefs
4815 Warn when a typedef locally defined in a function is not used.
4816 This warning is enabled by @option{-Wall}.
4817
4818 @item -Wunused-parameter
4819 @opindex Wunused-parameter
4820 @opindex Wno-unused-parameter
4821 Warn whenever a function parameter is unused aside from its declaration.
4822
4823 To suppress this warning use the @code{unused} attribute
4824 (@pxref{Variable Attributes}).
4825
4826 @item -Wno-unused-result
4827 @opindex Wunused-result
4828 @opindex Wno-unused-result
4829 Do not warn if a caller of a function marked with attribute
4830 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4831 its return value. The default is @option{-Wunused-result}.
4832
4833 @item -Wunused-variable
4834 @opindex Wunused-variable
4835 @opindex Wno-unused-variable
4836 Warn whenever a local or static variable is unused aside from its
4837 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4838 but not for C++. This warning is enabled by @option{-Wall}.
4839
4840 To suppress this warning use the @code{unused} attribute
4841 (@pxref{Variable Attributes}).
4842
4843 @item -Wunused-const-variable
4844 @itemx -Wunused-const-variable=@var{n}
4845 @opindex Wunused-const-variable
4846 @opindex Wno-unused-const-variable
4847 Warn whenever a constant static variable is unused aside from its declaration.
4848 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4849 for C, but not for C++. In C this declares variable storage, but in C++ this
4850 is not an error since const variables take the place of @code{#define}s.
4851
4852 To suppress this warning use the @code{unused} attribute
4853 (@pxref{Variable Attributes}).
4854
4855 @table @gcctabopt
4856 @item -Wunused-const-variable=1
4857 This is the warning level that is enabled by @option{-Wunused-variable} for
4858 C. It warns only about unused static const variables defined in the main
4859 compilation unit, but not about static const variables declared in any
4860 header included.
4861
4862 @item -Wunused-const-variable=2
4863 This warning level also warns for unused constant static variables in
4864 headers (excluding system headers). This is the warning level of
4865 @option{-Wunused-const-variable} and must be explicitly requested since
4866 in C++ this isn't an error and in C it might be harder to clean up all
4867 headers included.
4868 @end table
4869
4870 @item -Wunused-value
4871 @opindex Wunused-value
4872 @opindex Wno-unused-value
4873 Warn whenever a statement computes a result that is explicitly not
4874 used. To suppress this warning cast the unused expression to
4875 @code{void}. This includes an expression-statement or the left-hand
4876 side of a comma expression that contains no side effects. For example,
4877 an expression such as @code{x[i,j]} causes a warning, while
4878 @code{x[(void)i,j]} does not.
4879
4880 This warning is enabled by @option{-Wall}.
4881
4882 @item -Wunused
4883 @opindex Wunused
4884 @opindex Wno-unused
4885 All the above @option{-Wunused} options combined.
4886
4887 In order to get a warning about an unused function parameter, you must
4888 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4889 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4890
4891 @item -Wuninitialized
4892 @opindex Wuninitialized
4893 @opindex Wno-uninitialized
4894 Warn if an automatic variable is used without first being initialized
4895 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4896 warn if a non-static reference or non-static @code{const} member
4897 appears in a class without constructors.
4898
4899 If you want to warn about code that uses the uninitialized value of the
4900 variable in its own initializer, use the @option{-Winit-self} option.
4901
4902 These warnings occur for individual uninitialized or clobbered
4903 elements of structure, union or array variables as well as for
4904 variables that are uninitialized or clobbered as a whole. They do
4905 not occur for variables or elements declared @code{volatile}. Because
4906 these warnings depend on optimization, the exact variables or elements
4907 for which there are warnings depends on the precise optimization
4908 options and version of GCC used.
4909
4910 Note that there may be no warning about a variable that is used only
4911 to compute a value that itself is never used, because such
4912 computations may be deleted by data flow analysis before the warnings
4913 are printed.
4914
4915 @item -Winvalid-memory-model
4916 @opindex Winvalid-memory-model
4917 @opindex Wno-invalid-memory-model
4918 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4919 and the C11 atomic generic functions with a memory consistency argument
4920 that is either invalid for the operation or outside the range of values
4921 of the @code{memory_order} enumeration. For example, since the
4922 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4923 defined for the relaxed, release, and sequentially consistent memory
4924 orders the following code is diagnosed:
4925
4926 @smallexample
4927 void store (int *i)
4928 @{
4929 __atomic_store_n (i, 0, memory_order_consume);
4930 @}
4931 @end smallexample
4932
4933 @option{-Winvalid-memory-model} is enabled by default.
4934
4935 @item -Wmaybe-uninitialized
4936 @opindex Wmaybe-uninitialized
4937 @opindex Wno-maybe-uninitialized
4938 For an automatic variable, if there exists a path from the function
4939 entry to a use of the variable that is initialized, but there exist
4940 some other paths for which the variable is not initialized, the compiler
4941 emits a warning if it cannot prove the uninitialized paths are not
4942 executed at run time. These warnings are made optional because GCC is
4943 not smart enough to see all the reasons why the code might be correct
4944 in spite of appearing to have an error. Here is one example of how
4945 this can happen:
4946
4947 @smallexample
4948 @group
4949 @{
4950 int x;
4951 switch (y)
4952 @{
4953 case 1: x = 1;
4954 break;
4955 case 2: x = 4;
4956 break;
4957 case 3: x = 5;
4958 @}
4959 foo (x);
4960 @}
4961 @end group
4962 @end smallexample
4963
4964 @noindent
4965 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4966 always initialized, but GCC doesn't know this. To suppress the
4967 warning, you need to provide a default case with assert(0) or
4968 similar code.
4969
4970 @cindex @code{longjmp} warnings
4971 This option also warns when a non-volatile automatic variable might be
4972 changed by a call to @code{longjmp}. These warnings as well are possible
4973 only in optimizing compilation.
4974
4975 The compiler sees only the calls to @code{setjmp}. It cannot know
4976 where @code{longjmp} will be called; in fact, a signal handler could
4977 call it at any point in the code. As a result, you may get a warning
4978 even when there is in fact no problem because @code{longjmp} cannot
4979 in fact be called at the place that would cause a problem.
4980
4981 Some spurious warnings can be avoided if you declare all the functions
4982 you use that never return as @code{noreturn}. @xref{Function
4983 Attributes}.
4984
4985 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4986
4987 @item -Wunknown-pragmas
4988 @opindex Wunknown-pragmas
4989 @opindex Wno-unknown-pragmas
4990 @cindex warning for unknown pragmas
4991 @cindex unknown pragmas, warning
4992 @cindex pragmas, warning of unknown
4993 Warn when a @code{#pragma} directive is encountered that is not understood by
4994 GCC@. If this command-line option is used, warnings are even issued
4995 for unknown pragmas in system header files. This is not the case if
4996 the warnings are only enabled by the @option{-Wall} command-line option.
4997
4998 @item -Wno-pragmas
4999 @opindex Wno-pragmas
5000 @opindex Wpragmas
5001 Do not warn about misuses of pragmas, such as incorrect parameters,
5002 invalid syntax, or conflicts between pragmas. See also
5003 @option{-Wunknown-pragmas}.
5004
5005 @item -Wstrict-aliasing
5006 @opindex Wstrict-aliasing
5007 @opindex Wno-strict-aliasing
5008 This option is only active when @option{-fstrict-aliasing} is active.
5009 It warns about code that might break the strict aliasing rules that the
5010 compiler is using for optimization. The warning does not catch all
5011 cases, but does attempt to catch the more common pitfalls. It is
5012 included in @option{-Wall}.
5013 It is equivalent to @option{-Wstrict-aliasing=3}
5014
5015 @item -Wstrict-aliasing=n
5016 @opindex Wstrict-aliasing=n
5017 This option is only active when @option{-fstrict-aliasing} is active.
5018 It warns about code that might break the strict aliasing rules that the
5019 compiler is using for optimization.
5020 Higher levels correspond to higher accuracy (fewer false positives).
5021 Higher levels also correspond to more effort, similar to the way @option{-O}
5022 works.
5023 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5024
5025 Level 1: Most aggressive, quick, least accurate.
5026 Possibly useful when higher levels
5027 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5028 false negatives. However, it has many false positives.
5029 Warns for all pointer conversions between possibly incompatible types,
5030 even if never dereferenced. Runs in the front end only.
5031
5032 Level 2: Aggressive, quick, not too precise.
5033 May still have many false positives (not as many as level 1 though),
5034 and few false negatives (but possibly more than level 1).
5035 Unlike level 1, it only warns when an address is taken. Warns about
5036 incomplete types. Runs in the front end only.
5037
5038 Level 3 (default for @option{-Wstrict-aliasing}):
5039 Should have very few false positives and few false
5040 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5041 Takes care of the common pun+dereference pattern in the front end:
5042 @code{*(int*)&some_float}.
5043 If optimization is enabled, it also runs in the back end, where it deals
5044 with multiple statement cases using flow-sensitive points-to information.
5045 Only warns when the converted pointer is dereferenced.
5046 Does not warn about incomplete types.
5047
5048 @item -Wstrict-overflow
5049 @itemx -Wstrict-overflow=@var{n}
5050 @opindex Wstrict-overflow
5051 @opindex Wno-strict-overflow
5052 This option is only active when signed overflow is undefined.
5053 It warns about cases where the compiler optimizes based on the
5054 assumption that signed overflow does not occur. Note that it does not
5055 warn about all cases where the code might overflow: it only warns
5056 about cases where the compiler implements some optimization. Thus
5057 this warning depends on the optimization level.
5058
5059 An optimization that assumes that signed overflow does not occur is
5060 perfectly safe if the values of the variables involved are such that
5061 overflow never does, in fact, occur. Therefore this warning can
5062 easily give a false positive: a warning about code that is not
5063 actually a problem. To help focus on important issues, several
5064 warning levels are defined. No warnings are issued for the use of
5065 undefined signed overflow when estimating how many iterations a loop
5066 requires, in particular when determining whether a loop will be
5067 executed at all.
5068
5069 @table @gcctabopt
5070 @item -Wstrict-overflow=1
5071 Warn about cases that are both questionable and easy to avoid. For
5072 example the compiler simplifies
5073 @code{x + 1 > x} to @code{1}. This level of
5074 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5075 are not, and must be explicitly requested.
5076
5077 @item -Wstrict-overflow=2
5078 Also warn about other cases where a comparison is simplified to a
5079 constant. For example: @code{abs (x) >= 0}. This can only be
5080 simplified when signed integer overflow is undefined, because
5081 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5082 zero. @option{-Wstrict-overflow} (with no level) is the same as
5083 @option{-Wstrict-overflow=2}.
5084
5085 @item -Wstrict-overflow=3
5086 Also warn about other cases where a comparison is simplified. For
5087 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5088
5089 @item -Wstrict-overflow=4
5090 Also warn about other simplifications not covered by the above cases.
5091 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5092
5093 @item -Wstrict-overflow=5
5094 Also warn about cases where the compiler reduces the magnitude of a
5095 constant involved in a comparison. For example: @code{x + 2 > y} is
5096 simplified to @code{x + 1 >= y}. This is reported only at the
5097 highest warning level because this simplification applies to many
5098 comparisons, so this warning level gives a very large number of
5099 false positives.
5100 @end table
5101
5102 @item -Wstringop-overflow
5103 @itemx -Wstringop-overflow=@var{type}
5104 @opindex Wstringop-overflow
5105 @opindex Wno-stringop-overflow
5106 Warn for calls to string manipulation functions such as @code{memcpy} and
5107 @code{strcpy} that are determined to overflow the destination buffer. The
5108 optional argument is one greater than the type of Object Size Checking to
5109 perform to determine the size of the destination. @xref{Object Size Checking}.
5110 The argument is meaningful only for functions that operate on character arrays
5111 but not for raw memory functions like @code{memcpy} which always make use
5112 of Object Size type-0. The option also warns for calls that specify a size
5113 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5114 The option produces the best results with optimization enabled but can detect
5115 a small subset of simple buffer overflows even without optimization in
5116 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5117 correspond to the standard functions. In any case, the option warns about
5118 just a subset of buffer overflows detected by the corresponding overflow
5119 checking built-ins. For example, the option will issue a warning for
5120 the @code{strcpy} call below because it copies at least 5 characters
5121 (the string @code{"blue"} including the terminating NUL) into the buffer
5122 of size 4.
5123
5124 @smallexample
5125 enum Color @{ blue, purple, yellow @};
5126 const char* f (enum Color clr)
5127 @{
5128 static char buf [4];
5129 const char *str;
5130 switch (clr)
5131 @{
5132 case blue: str = "blue"; break;
5133 case purple: str = "purple"; break;
5134 case yellow: str = "yellow"; break;
5135 @}
5136
5137 return strcpy (buf, str); // warning here
5138 @}
5139 @end smallexample
5140
5141 Option @option{-Wstringop-overflow=2} is enabled by default.
5142
5143 @table @gcctabopt
5144 @item -Wstringop-overflow
5145 @item -Wstringop-overflow=1
5146 @opindex Wstringop-overflow
5147 @opindex Wno-stringop-overflow
5148 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5149 to determine the sizes of destination objects. This is the default setting
5150 of the option. At this setting the option will not warn for writes past
5151 the end of subobjects of larger objects accessed by pointers unless the
5152 size of the largest surrounding object is known. When the destination may
5153 be one of several objects it is assumed to be the largest one of them. On
5154 Linux systems, when optimization is enabled at this setting the option warns
5155 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5156 a non-zero value.
5157
5158 @item -Wstringop-overflow=2
5159 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5160 to determine the sizes of destination objects. At this setting the option
5161 will warn about overflows when writing to members of the largest complete
5162 objects whose exact size is known. It will, however, not warn for excessive
5163 writes to the same members of unknown objects referenced by pointers since
5164 they may point to arrays containing unknown numbers of elements.
5165
5166 @item -Wstringop-overflow=3
5167 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5168 to determine the sizes of destination objects. At this setting the option
5169 warns about overflowing the smallest object or data member. This is the
5170 most restrictive setting of the option that may result in warnings for safe
5171 code.
5172
5173 @item -Wstringop-overflow=4
5174 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5175 to determine the sizes of destination objects. At this setting the option
5176 will warn about overflowing any data members, and when the destination is
5177 one of several objects it uses the size of the largest of them to decide
5178 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5179 setting of the option may result in warnings for benign code.
5180 @end table
5181
5182 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
5183 @opindex Wsuggest-attribute=
5184 @opindex Wno-suggest-attribute=
5185 Warn for cases where adding an attribute may be beneficial. The
5186 attributes currently supported are listed below.
5187
5188 @table @gcctabopt
5189 @item -Wsuggest-attribute=pure
5190 @itemx -Wsuggest-attribute=const
5191 @itemx -Wsuggest-attribute=noreturn
5192 @opindex Wsuggest-attribute=pure
5193 @opindex Wno-suggest-attribute=pure
5194 @opindex Wsuggest-attribute=const
5195 @opindex Wno-suggest-attribute=const
5196 @opindex Wsuggest-attribute=noreturn
5197 @opindex Wno-suggest-attribute=noreturn
5198
5199 Warn about functions that might be candidates for attributes
5200 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
5201 functions visible in other compilation units or (in the case of @code{pure} and
5202 @code{const}) if it cannot prove that the function returns normally. A function
5203 returns normally if it doesn't contain an infinite loop or return abnormally
5204 by throwing, calling @code{abort} or trapping. This analysis requires option
5205 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
5206 higher. Higher optimization levels improve the accuracy of the analysis.
5207
5208 @item -Wsuggest-attribute=format
5209 @itemx -Wmissing-format-attribute
5210 @opindex Wsuggest-attribute=format
5211 @opindex Wmissing-format-attribute
5212 @opindex Wno-suggest-attribute=format
5213 @opindex Wno-missing-format-attribute
5214 @opindex Wformat
5215 @opindex Wno-format
5216
5217 Warn about function pointers that might be candidates for @code{format}
5218 attributes. Note these are only possible candidates, not absolute ones.
5219 GCC guesses that function pointers with @code{format} attributes that
5220 are used in assignment, initialization, parameter passing or return
5221 statements should have a corresponding @code{format} attribute in the
5222 resulting type. I.e.@: the left-hand side of the assignment or
5223 initialization, the type of the parameter variable, or the return type
5224 of the containing function respectively should also have a @code{format}
5225 attribute to avoid the warning.
5226
5227 GCC also warns about function definitions that might be
5228 candidates for @code{format} attributes. Again, these are only
5229 possible candidates. GCC guesses that @code{format} attributes
5230 might be appropriate for any function that calls a function like
5231 @code{vprintf} or @code{vscanf}, but this might not always be the
5232 case, and some functions for which @code{format} attributes are
5233 appropriate may not be detected.
5234 @end table
5235
5236 @item -Wsuggest-final-types
5237 @opindex Wno-suggest-final-types
5238 @opindex Wsuggest-final-types
5239 Warn about types with virtual methods where code quality would be improved
5240 if the type were declared with the C++11 @code{final} specifier,
5241 or, if possible,
5242 declared in an anonymous namespace. This allows GCC to more aggressively
5243 devirtualize the polymorphic calls. This warning is more effective with link
5244 time optimization, where the information about the class hierarchy graph is
5245 more complete.
5246
5247 @item -Wsuggest-final-methods
5248 @opindex Wno-suggest-final-methods
5249 @opindex Wsuggest-final-methods
5250 Warn about virtual methods where code quality would be improved if the method
5251 were declared with the C++11 @code{final} specifier,
5252 or, if possible, its type were
5253 declared in an anonymous namespace or with the @code{final} specifier.
5254 This warning is
5255 more effective with link-time optimization, where the information about the
5256 class hierarchy graph is more complete. It is recommended to first consider
5257 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5258 annotations.
5259
5260 @item -Wsuggest-override
5261 Warn about overriding virtual functions that are not marked with the override
5262 keyword.
5263
5264 @item -Walloc-zero
5265 @opindex Wno-alloc-zero
5266 @opindex Walloc-zero
5267 Warn about calls to allocation functions decorated with attribute
5268 @code{alloc_size} that specify zero bytes, including those to the built-in
5269 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5270 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5271 when called with a zero size differs among implementations (and in the case
5272 of @code{realloc} has been deprecated) relying on it may result in subtle
5273 portability bugs and should be avoided.
5274
5275 @item -Walloc-size-larger-than=@var{n}
5276 Warn about calls to functions decorated with attribute @code{alloc_size}
5277 that attempt to allocate objects larger than the specified number of bytes,
5278 or where the result of the size computation in an integer type with infinite
5279 precision would exceed @code{SIZE_MAX / 2}. The option argument @var{n}
5280 may end in one of the standard suffixes designating a multiple of bytes
5281 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
5282 @code{MB} and @code{MiB} for megabyte and mebibyte, and so on.
5283 @xref{Function Attributes}.
5284
5285 @item -Walloca
5286 @opindex Wno-alloca
5287 @opindex Walloca
5288 This option warns on all uses of @code{alloca} in the source.
5289
5290 @item -Walloca-larger-than=@var{n}
5291 This option warns on calls to @code{alloca} that are not bounded by a
5292 controlling predicate limiting its argument of integer type to at most
5293 @var{n} bytes, or calls to @code{alloca} where the bound is unknown.
5294 Arguments of non-integer types are considered unbounded even if they
5295 appear to be constrained to the expected range.
5296
5297 For example, a bounded case of @code{alloca} could be:
5298
5299 @smallexample
5300 void func (size_t n)
5301 @{
5302 void *p;
5303 if (n <= 1000)
5304 p = alloca (n);
5305 else
5306 p = malloc (n);
5307 f (p);
5308 @}
5309 @end smallexample
5310
5311 In the above example, passing @code{-Walloca-larger-than=1000} would not
5312 issue a warning because the call to @code{alloca} is known to be at most
5313 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5314 the compiler would emit a warning.
5315
5316 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5317 controlling predicate constraining its integer argument. For example:
5318
5319 @smallexample
5320 void func ()
5321 @{
5322 void *p = alloca (n);
5323 f (p);
5324 @}
5325 @end smallexample
5326
5327 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5328 a warning, but this time because of the lack of bounds checking.
5329
5330 Note, that even seemingly correct code involving signed integers could
5331 cause a warning:
5332
5333 @smallexample
5334 void func (signed int n)
5335 @{
5336 if (n < 500)
5337 @{
5338 p = alloca (n);
5339 f (p);
5340 @}
5341 @}
5342 @end smallexample
5343
5344 In the above example, @var{n} could be negative, causing a larger than
5345 expected argument to be implicitly cast into the @code{alloca} call.
5346
5347 This option also warns when @code{alloca} is used in a loop.
5348
5349 This warning is not enabled by @option{-Wall}, and is only active when
5350 @option{-ftree-vrp} is active (default for @option{-O2} and above).
5351
5352 See also @option{-Wvla-larger-than=@var{n}}.
5353
5354 @item -Warray-bounds
5355 @itemx -Warray-bounds=@var{n}
5356 @opindex Wno-array-bounds
5357 @opindex Warray-bounds
5358 This option is only active when @option{-ftree-vrp} is active
5359 (default for @option{-O2} and above). It warns about subscripts to arrays
5360 that are always out of bounds. This warning is enabled by @option{-Wall}.
5361
5362 @table @gcctabopt
5363 @item -Warray-bounds=1
5364 This is the warning level of @option{-Warray-bounds} and is enabled
5365 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5366
5367 @item -Warray-bounds=2
5368 This warning level also warns about out of bounds access for
5369 arrays at the end of a struct and for arrays accessed through
5370 pointers. This warning level may give a larger number of
5371 false positives and is deactivated by default.
5372 @end table
5373
5374 @item -Wbool-compare
5375 @opindex Wno-bool-compare
5376 @opindex Wbool-compare
5377 Warn about boolean expression compared with an integer value different from
5378 @code{true}/@code{false}. For instance, the following comparison is
5379 always false:
5380 @smallexample
5381 int n = 5;
5382 @dots{}
5383 if ((n > 1) == 2) @{ @dots{} @}
5384 @end smallexample
5385 This warning is enabled by @option{-Wall}.
5386
5387 @item -Wbool-operation
5388 @opindex Wno-bool-operation
5389 @opindex Wbool-operation
5390 Warn about suspicious operations on expressions of a boolean type. For
5391 instance, bitwise negation of a boolean is very likely a bug in the program.
5392 For C, this warning also warns about incrementing or decrementing a boolean,
5393 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5394 Incrementing a boolean is invalid in C++1z, and deprecated otherwise.)
5395
5396 This warning is enabled by @option{-Wall}.
5397
5398 @item -Wduplicated-branches
5399 @opindex Wno-duplicated-branches
5400 @opindex Wduplicated-branches
5401 Warn when an if-else has identical branches. This warning detects cases like
5402 @smallexample
5403 if (p != NULL)
5404 return 0;
5405 else
5406 return 0;
5407 @end smallexample
5408 It doesn't warn when both branches contain just a null statement. This warning
5409 also warn for conditional operators:
5410 @smallexample
5411 int i = x ? *p : *p;
5412 @end smallexample
5413
5414 @item -Wduplicated-cond
5415 @opindex Wno-duplicated-cond
5416 @opindex Wduplicated-cond
5417 Warn about duplicated conditions in an if-else-if chain. For instance,
5418 warn for the following code:
5419 @smallexample
5420 if (p->q != NULL) @{ @dots{} @}
5421 else if (p->q != NULL) @{ @dots{} @}
5422 @end smallexample
5423
5424 @item -Wframe-address
5425 @opindex Wno-frame-address
5426 @opindex Wframe-address
5427 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5428 is called with an argument greater than 0. Such calls may return indeterminate
5429 values or crash the program. The warning is included in @option{-Wall}.
5430
5431 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5432 @opindex Wno-discarded-qualifiers
5433 @opindex Wdiscarded-qualifiers
5434 Do not warn if type qualifiers on pointers are being discarded.
5435 Typically, the compiler warns if a @code{const char *} variable is
5436 passed to a function that takes a @code{char *} parameter. This option
5437 can be used to suppress such a warning.
5438
5439 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5440 @opindex Wno-discarded-array-qualifiers
5441 @opindex Wdiscarded-array-qualifiers
5442 Do not warn if type qualifiers on arrays which are pointer targets
5443 are being discarded. Typically, the compiler warns if a
5444 @code{const int (*)[]} variable is passed to a function that
5445 takes a @code{int (*)[]} parameter. This option can be used to
5446 suppress such a warning.
5447
5448 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5449 @opindex Wno-incompatible-pointer-types
5450 @opindex Wincompatible-pointer-types
5451 Do not warn when there is a conversion between pointers that have incompatible
5452 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5453 which warns for pointer argument passing or assignment with different
5454 signedness.
5455
5456 @item -Wno-int-conversion @r{(C and Objective-C only)}
5457 @opindex Wno-int-conversion
5458 @opindex Wint-conversion
5459 Do not warn about incompatible integer to pointer and pointer to integer
5460 conversions. This warning is about implicit conversions; for explicit
5461 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5462 @option{-Wno-pointer-to-int-cast} may be used.
5463
5464 @item -Wno-div-by-zero
5465 @opindex Wno-div-by-zero
5466 @opindex Wdiv-by-zero
5467 Do not warn about compile-time integer division by zero. Floating-point
5468 division by zero is not warned about, as it can be a legitimate way of
5469 obtaining infinities and NaNs.
5470
5471 @item -Wsystem-headers
5472 @opindex Wsystem-headers
5473 @opindex Wno-system-headers
5474 @cindex warnings from system headers
5475 @cindex system headers, warnings from
5476 Print warning messages for constructs found in system header files.
5477 Warnings from system headers are normally suppressed, on the assumption
5478 that they usually do not indicate real problems and would only make the
5479 compiler output harder to read. Using this command-line option tells
5480 GCC to emit warnings from system headers as if they occurred in user
5481 code. However, note that using @option{-Wall} in conjunction with this
5482 option does @emph{not} warn about unknown pragmas in system
5483 headers---for that, @option{-Wunknown-pragmas} must also be used.
5484
5485 @item -Wtautological-compare
5486 @opindex Wtautological-compare
5487 @opindex Wno-tautological-compare
5488 Warn if a self-comparison always evaluates to true or false. This
5489 warning detects various mistakes such as:
5490 @smallexample
5491 int i = 1;
5492 @dots{}
5493 if (i > i) @{ @dots{} @}
5494 @end smallexample
5495
5496 This warning also warns about bitwise comparisons that always evaluate
5497 to true or false, for instance:
5498 @smallexample
5499 if ((a & 16) == 10) @{ @dots{} @}
5500 @end smallexample
5501 will always be false.
5502
5503 This warning is enabled by @option{-Wall}.
5504
5505 @item -Wtrampolines
5506 @opindex Wtrampolines
5507 @opindex Wno-trampolines
5508 Warn about trampolines generated for pointers to nested functions.
5509 A trampoline is a small piece of data or code that is created at run
5510 time on the stack when the address of a nested function is taken, and is
5511 used to call the nested function indirectly. For some targets, it is
5512 made up of data only and thus requires no special treatment. But, for
5513 most targets, it is made up of code and thus requires the stack to be
5514 made executable in order for the program to work properly.
5515
5516 @item -Wfloat-equal
5517 @opindex Wfloat-equal
5518 @opindex Wno-float-equal
5519 Warn if floating-point values are used in equality comparisons.
5520
5521 The idea behind this is that sometimes it is convenient (for the
5522 programmer) to consider floating-point values as approximations to
5523 infinitely precise real numbers. If you are doing this, then you need
5524 to compute (by analyzing the code, or in some other way) the maximum or
5525 likely maximum error that the computation introduces, and allow for it
5526 when performing comparisons (and when producing output, but that's a
5527 different problem). In particular, instead of testing for equality, you
5528 should check to see whether the two values have ranges that overlap; and
5529 this is done with the relational operators, so equality comparisons are
5530 probably mistaken.
5531
5532 @item -Wtraditional @r{(C and Objective-C only)}
5533 @opindex Wtraditional
5534 @opindex Wno-traditional
5535 Warn about certain constructs that behave differently in traditional and
5536 ISO C@. Also warn about ISO C constructs that have no traditional C
5537 equivalent, and/or problematic constructs that should be avoided.
5538
5539 @itemize @bullet
5540 @item
5541 Macro parameters that appear within string literals in the macro body.
5542 In traditional C macro replacement takes place within string literals,
5543 but in ISO C it does not.
5544
5545 @item
5546 In traditional C, some preprocessor directives did not exist.
5547 Traditional preprocessors only considered a line to be a directive
5548 if the @samp{#} appeared in column 1 on the line. Therefore
5549 @option{-Wtraditional} warns about directives that traditional C
5550 understands but ignores because the @samp{#} does not appear as the
5551 first character on the line. It also suggests you hide directives like
5552 @code{#pragma} not understood by traditional C by indenting them. Some
5553 traditional implementations do not recognize @code{#elif}, so this option
5554 suggests avoiding it altogether.
5555
5556 @item
5557 A function-like macro that appears without arguments.
5558
5559 @item
5560 The unary plus operator.
5561
5562 @item
5563 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
5564 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
5565 constants.) Note, these suffixes appear in macros defined in the system
5566 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
5567 Use of these macros in user code might normally lead to spurious
5568 warnings, however GCC's integrated preprocessor has enough context to
5569 avoid warning in these cases.
5570
5571 @item
5572 A function declared external in one block and then used after the end of
5573 the block.
5574
5575 @item
5576 A @code{switch} statement has an operand of type @code{long}.
5577
5578 @item
5579 A non-@code{static} function declaration follows a @code{static} one.
5580 This construct is not accepted by some traditional C compilers.
5581
5582 @item
5583 The ISO type of an integer constant has a different width or
5584 signedness from its traditional type. This warning is only issued if
5585 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
5586 typically represent bit patterns, are not warned about.
5587
5588 @item
5589 Usage of ISO string concatenation is detected.
5590
5591 @item
5592 Initialization of automatic aggregates.
5593
5594 @item
5595 Identifier conflicts with labels. Traditional C lacks a separate
5596 namespace for labels.
5597
5598 @item
5599 Initialization of unions. If the initializer is zero, the warning is
5600 omitted. This is done under the assumption that the zero initializer in
5601 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
5602 initializer warnings and relies on default initialization to zero in the
5603 traditional C case.
5604
5605 @item
5606 Conversions by prototypes between fixed/floating-point values and vice
5607 versa. The absence of these prototypes when compiling with traditional
5608 C causes serious problems. This is a subset of the possible
5609 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
5610
5611 @item
5612 Use of ISO C style function definitions. This warning intentionally is
5613 @emph{not} issued for prototype declarations or variadic functions
5614 because these ISO C features appear in your code when using
5615 libiberty's traditional C compatibility macros, @code{PARAMS} and
5616 @code{VPARAMS}. This warning is also bypassed for nested functions
5617 because that feature is already a GCC extension and thus not relevant to
5618 traditional C compatibility.
5619 @end itemize
5620
5621 @item -Wtraditional-conversion @r{(C and Objective-C only)}
5622 @opindex Wtraditional-conversion
5623 @opindex Wno-traditional-conversion
5624 Warn if a prototype causes a type conversion that is different from what
5625 would happen to the same argument in the absence of a prototype. This
5626 includes conversions of fixed point to floating and vice versa, and
5627 conversions changing the width or signedness of a fixed-point argument
5628 except when the same as the default promotion.
5629
5630 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
5631 @opindex Wdeclaration-after-statement
5632 @opindex Wno-declaration-after-statement
5633 Warn when a declaration is found after a statement in a block. This
5634 construct, known from C++, was introduced with ISO C99 and is by default
5635 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
5636
5637 @item -Wshadow
5638 @opindex Wshadow
5639 @opindex Wno-shadow
5640 Warn whenever a local variable or type declaration shadows another
5641 variable, parameter, type, class member (in C++), or instance variable
5642 (in Objective-C) or whenever a built-in function is shadowed. Note
5643 that in C++, the compiler warns if a local variable shadows an
5644 explicit typedef, but not if it shadows a struct/class/enum.
5645 Same as @option{-Wshadow=global}.
5646
5647 @item -Wno-shadow-ivar @r{(Objective-C only)}
5648 @opindex Wno-shadow-ivar
5649 @opindex Wshadow-ivar
5650 Do not warn whenever a local variable shadows an instance variable in an
5651 Objective-C method.
5652
5653 @item -Wshadow=global
5654 @opindex Wshadow=local
5655 The default for @option{-Wshadow}. Warns for any (global) shadowing.
5656
5657 @item -Wshadow=local
5658 @opindex Wshadow=local
5659 Warn when a local variable shadows another local variable or parameter.
5660 This warning is enabled by @option{-Wshadow=global}.
5661
5662 @item -Wshadow=compatible-local
5663 @opindex Wshadow=compatible-local
5664 Warn when a local variable shadows another local variable or parameter
5665 whose type is compatible with that of the shadowing variable. In C++,
5666 type compatibility here means the type of the shadowing variable can be
5667 converted to that of the shadowed variable. The creation of this flag
5668 (in addition to @option{-Wshadow=local}) is based on the idea that when
5669 a local variable shadows another one of incompatible type, it is most
5670 likely intentional, not a bug or typo, as shown in the following example:
5671
5672 @smallexample
5673 @group
5674 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5675 @{
5676 for (int i = 0; i < N; ++i)
5677 @{
5678 ...
5679 @}
5680 ...
5681 @}
5682 @end group
5683 @end smallexample
5684
5685 Since the two variable @code{i} in the example above have incompatible types,
5686 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
5687 Because their types are incompatible, if a programmer accidentally uses one
5688 in place of the other, type checking will catch that and emit an error or
5689 warning. So not warning (about shadowing) in this case will not lead to
5690 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
5691 possibly reduce the number of warnings triggered by intentional shadowing.
5692
5693 This warning is enabled by @option{-Wshadow=local}.
5694
5695 @item -Wlarger-than=@var{len}
5696 @opindex Wlarger-than=@var{len}
5697 @opindex Wlarger-than-@var{len}
5698 Warn whenever an object of larger than @var{len} bytes is defined.
5699
5700 @item -Wframe-larger-than=@var{len}
5701 @opindex Wframe-larger-than
5702 Warn if the size of a function frame is larger than @var{len} bytes.
5703 The computation done to determine the stack frame size is approximate
5704 and not conservative.
5705 The actual requirements may be somewhat greater than @var{len}
5706 even if you do not get a warning. In addition, any space allocated
5707 via @code{alloca}, variable-length arrays, or related constructs
5708 is not included by the compiler when determining
5709 whether or not to issue a warning.
5710
5711 @item -Wno-free-nonheap-object
5712 @opindex Wno-free-nonheap-object
5713 @opindex Wfree-nonheap-object
5714 Do not warn when attempting to free an object that was not allocated
5715 on the heap.
5716
5717 @item -Wstack-usage=@var{len}
5718 @opindex Wstack-usage
5719 Warn if the stack usage of a function might be larger than @var{len} bytes.
5720 The computation done to determine the stack usage is conservative.
5721 Any space allocated via @code{alloca}, variable-length arrays, or related
5722 constructs is included by the compiler when determining whether or not to
5723 issue a warning.
5724
5725 The message is in keeping with the output of @option{-fstack-usage}.
5726
5727 @itemize
5728 @item
5729 If the stack usage is fully static but exceeds the specified amount, it's:
5730
5731 @smallexample
5732 warning: stack usage is 1120 bytes
5733 @end smallexample
5734 @item
5735 If the stack usage is (partly) dynamic but bounded, it's:
5736
5737 @smallexample
5738 warning: stack usage might be 1648 bytes
5739 @end smallexample
5740 @item
5741 If the stack usage is (partly) dynamic and not bounded, it's:
5742
5743 @smallexample
5744 warning: stack usage might be unbounded
5745 @end smallexample
5746 @end itemize
5747
5748 @item -Wunsafe-loop-optimizations
5749 @opindex Wunsafe-loop-optimizations
5750 @opindex Wno-unsafe-loop-optimizations
5751 Warn if the loop cannot be optimized because the compiler cannot
5752 assume anything on the bounds of the loop indices. With
5753 @option{-funsafe-loop-optimizations} warn if the compiler makes
5754 such assumptions.
5755
5756 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
5757 @opindex Wno-pedantic-ms-format
5758 @opindex Wpedantic-ms-format
5759 When used in combination with @option{-Wformat}
5760 and @option{-pedantic} without GNU extensions, this option
5761 disables the warnings about non-ISO @code{printf} / @code{scanf} format
5762 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
5763 which depend on the MS runtime.
5764
5765 @item -Waligned-new
5766 @opindex Waligned-new
5767 @opindex Wno-aligned-new
5768 Warn about a new-expression of a type that requires greater alignment
5769 than the @code{alignof(std::max_align_t)} but uses an allocation
5770 function without an explicit alignment parameter. This option is
5771 enabled by @option{-Wall}.
5772
5773 Normally this only warns about global allocation functions, but
5774 @option{-Waligned-new=all} also warns about class member allocation
5775 functions.
5776
5777 @item -Wplacement-new
5778 @itemx -Wplacement-new=@var{n}
5779 @opindex Wplacement-new
5780 @opindex Wno-placement-new
5781 Warn about placement new expressions with undefined behavior, such as
5782 constructing an object in a buffer that is smaller than the type of
5783 the object. For example, the placement new expression below is diagnosed
5784 because it attempts to construct an array of 64 integers in a buffer only
5785 64 bytes large.
5786 @smallexample
5787 char buf [64];
5788 new (buf) int[64];
5789 @end smallexample
5790 This warning is enabled by default.
5791
5792 @table @gcctabopt
5793 @item -Wplacement-new=1
5794 This is the default warning level of @option{-Wplacement-new}. At this
5795 level the warning is not issued for some strictly undefined constructs that
5796 GCC allows as extensions for compatibility with legacy code. For example,
5797 the following @code{new} expression is not diagnosed at this level even
5798 though it has undefined behavior according to the C++ standard because
5799 it writes past the end of the one-element array.
5800 @smallexample
5801 struct S @{ int n, a[1]; @};
5802 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5803 new (s->a)int [32]();
5804 @end smallexample
5805
5806 @item -Wplacement-new=2
5807 At this level, in addition to diagnosing all the same constructs as at level
5808 1, a diagnostic is also issued for placement new expressions that construct
5809 an object in the last member of structure whose type is an array of a single
5810 element and whose size is less than the size of the object being constructed.
5811 While the previous example would be diagnosed, the following construct makes
5812 use of the flexible member array extension to avoid the warning at level 2.
5813 @smallexample
5814 struct S @{ int n, a[]; @};
5815 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
5816 new (s->a)int [32]();
5817 @end smallexample
5818
5819 @end table
5820
5821 @item -Wpointer-arith
5822 @opindex Wpointer-arith
5823 @opindex Wno-pointer-arith
5824 Warn about anything that depends on the ``size of'' a function type or
5825 of @code{void}. GNU C assigns these types a size of 1, for
5826 convenience in calculations with @code{void *} pointers and pointers
5827 to functions. In C++, warn also when an arithmetic operation involves
5828 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
5829
5830 @item -Wpointer-compare
5831 @opindex Wpointer-compare
5832 @opindex Wno-pointer-compare
5833 Warn if a pointer is compared with a zero character constant. This usually
5834 means that the pointer was meant to be dereferenced. For example:
5835
5836 @smallexample
5837 const char *p = foo ();
5838 if (p == '\0')
5839 return 42;
5840 @end smallexample
5841
5842 Note that the code above is invalid in C++11.
5843
5844 This warning is enabled by default.
5845
5846 @item -Wtype-limits
5847 @opindex Wtype-limits
5848 @opindex Wno-type-limits
5849 Warn if a comparison is always true or always false due to the limited
5850 range of the data type, but do not warn for constant expressions. For
5851 example, warn if an unsigned variable is compared against zero with
5852 @code{<} or @code{>=}. This warning is also enabled by
5853 @option{-Wextra}.
5854
5855 @include cppwarnopts.texi
5856
5857 @item -Wbad-function-cast @r{(C and Objective-C only)}
5858 @opindex Wbad-function-cast
5859 @opindex Wno-bad-function-cast
5860 Warn when a function call is cast to a non-matching type.
5861 For example, warn if a call to a function returning an integer type
5862 is cast to a pointer type.
5863
5864 @item -Wc90-c99-compat @r{(C and Objective-C only)}
5865 @opindex Wc90-c99-compat
5866 @opindex Wno-c90-c99-compat
5867 Warn about features not present in ISO C90, but present in ISO C99.
5868 For instance, warn about use of variable length arrays, @code{long long}
5869 type, @code{bool} type, compound literals, designated initializers, and so
5870 on. This option is independent of the standards mode. Warnings are disabled
5871 in the expression that follows @code{__extension__}.
5872
5873 @item -Wc99-c11-compat @r{(C and Objective-C only)}
5874 @opindex Wc99-c11-compat
5875 @opindex Wno-c99-c11-compat
5876 Warn about features not present in ISO C99, but present in ISO C11.
5877 For instance, warn about use of anonymous structures and unions,
5878 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
5879 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
5880 and so on. This option is independent of the standards mode. Warnings are
5881 disabled in the expression that follows @code{__extension__}.
5882
5883 @item -Wc++-compat @r{(C and Objective-C only)}
5884 @opindex Wc++-compat
5885 Warn about ISO C constructs that are outside of the common subset of
5886 ISO C and ISO C++, e.g.@: request for implicit conversion from
5887 @code{void *} to a pointer to non-@code{void} type.
5888
5889 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
5890 @opindex Wc++11-compat
5891 Warn about C++ constructs whose meaning differs between ISO C++ 1998
5892 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
5893 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
5894 enabled by @option{-Wall}.
5895
5896 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
5897 @opindex Wc++14-compat
5898 Warn about C++ constructs whose meaning differs between ISO C++ 2011
5899 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
5900
5901 @item -Wc++1z-compat @r{(C++ and Objective-C++ only)}
5902 @opindex Wc++1z-compat
5903 Warn about C++ constructs whose meaning differs between ISO C++ 2014
5904 and the forthoming ISO C++ 2017(?). This warning is enabled by @option{-Wall}.
5905
5906 @item -Wcast-qual
5907 @opindex Wcast-qual
5908 @opindex Wno-cast-qual
5909 Warn whenever a pointer is cast so as to remove a type qualifier from
5910 the target type. For example, warn if a @code{const char *} is cast
5911 to an ordinary @code{char *}.
5912
5913 Also warn when making a cast that introduces a type qualifier in an
5914 unsafe way. For example, casting @code{char **} to @code{const char **}
5915 is unsafe, as in this example:
5916
5917 @smallexample
5918 /* p is char ** value. */
5919 const char **q = (const char **) p;
5920 /* Assignment of readonly string to const char * is OK. */
5921 *q = "string";
5922 /* Now char** pointer points to read-only memory. */
5923 **p = 'b';
5924 @end smallexample
5925
5926 @item -Wcast-align
5927 @opindex Wcast-align
5928 @opindex Wno-cast-align
5929 Warn whenever a pointer is cast such that the required alignment of the
5930 target is increased. For example, warn if a @code{char *} is cast to
5931 an @code{int *} on machines where integers can only be accessed at
5932 two- or four-byte boundaries.
5933
5934 @item -Wwrite-strings
5935 @opindex Wwrite-strings
5936 @opindex Wno-write-strings
5937 When compiling C, give string constants the type @code{const
5938 char[@var{length}]} so that copying the address of one into a
5939 non-@code{const} @code{char *} pointer produces a warning. These
5940 warnings help you find at compile time code that can try to write
5941 into a string constant, but only if you have been very careful about
5942 using @code{const} in declarations and prototypes. Otherwise, it is
5943 just a nuisance. This is why we did not make @option{-Wall} request
5944 these warnings.
5945
5946 When compiling C++, warn about the deprecated conversion from string
5947 literals to @code{char *}. This warning is enabled by default for C++
5948 programs.
5949
5950 @item -Wcatch-value
5951 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
5952 @opindex Wcatch-value
5953 @opindex Wno-catch-value
5954 Warn about catch handlers that do not catch via reference.
5955 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
5956 warn about polymorphic class types that are caught by value.
5957 With @option{-Wcatch-value=2} warn about all class types that are caught
5958 by value. With @option{-Wcatch-value=3} warn about all types that are
5959 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
5960
5961 @item -Wclobbered
5962 @opindex Wclobbered
5963 @opindex Wno-clobbered
5964 Warn for variables that might be changed by @code{longjmp} or
5965 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5966
5967 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5968 @opindex Wconditionally-supported
5969 @opindex Wno-conditionally-supported
5970 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5971
5972 @item -Wconversion
5973 @opindex Wconversion
5974 @opindex Wno-conversion
5975 Warn for implicit conversions that may alter a value. This includes
5976 conversions between real and integer, like @code{abs (x)} when
5977 @code{x} is @code{double}; conversions between signed and unsigned,
5978 like @code{unsigned ui = -1}; and conversions to smaller types, like
5979 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5980 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5981 changed by the conversion like in @code{abs (2.0)}. Warnings about
5982 conversions between signed and unsigned integers can be disabled by
5983 using @option{-Wno-sign-conversion}.
5984
5985 For C++, also warn for confusing overload resolution for user-defined
5986 conversions; and conversions that never use a type conversion
5987 operator: conversions to @code{void}, the same type, a base class or a
5988 reference to them. Warnings about conversions between signed and
5989 unsigned integers are disabled by default in C++ unless
5990 @option{-Wsign-conversion} is explicitly enabled.
5991
5992 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5993 @opindex Wconversion-null
5994 @opindex Wno-conversion-null
5995 Do not warn for conversions between @code{NULL} and non-pointer
5996 types. @option{-Wconversion-null} is enabled by default.
5997
5998 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5999 @opindex Wzero-as-null-pointer-constant
6000 @opindex Wno-zero-as-null-pointer-constant
6001 Warn when a literal @samp{0} is used as null pointer constant. This can
6002 be useful to facilitate the conversion to @code{nullptr} in C++11.
6003
6004 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6005 @opindex Wsubobject-linkage
6006 @opindex Wno-subobject-linkage
6007 Warn if a class type has a base or a field whose type uses the anonymous
6008 namespace or depends on a type with no linkage. If a type A depends on
6009 a type B with no or internal linkage, defining it in multiple
6010 translation units would be an ODR violation because the meaning of B
6011 is different in each translation unit. If A only appears in a single
6012 translation unit, the best way to silence the warning is to give it
6013 internal linkage by putting it in an anonymous namespace as well. The
6014 compiler doesn't give this warning for types defined in the main .C
6015 file, as those are unlikely to have multiple definitions.
6016 @option{-Wsubobject-linkage} is enabled by default.
6017
6018 @item -Wdangling-else
6019 @opindex Wdangling-else
6020 @opindex Wno-dangling-else
6021 Warn about constructions where there may be confusion to which
6022 @code{if} statement an @code{else} branch belongs. Here is an example of
6023 such a case:
6024
6025 @smallexample
6026 @group
6027 @{
6028 if (a)
6029 if (b)
6030 foo ();
6031 else
6032 bar ();
6033 @}
6034 @end group
6035 @end smallexample
6036
6037 In C/C++, every @code{else} branch belongs to the innermost possible
6038 @code{if} statement, which in this example is @code{if (b)}. This is
6039 often not what the programmer expected, as illustrated in the above
6040 example by indentation the programmer chose. When there is the
6041 potential for this confusion, GCC issues a warning when this flag
6042 is specified. To eliminate the warning, add explicit braces around
6043 the innermost @code{if} statement so there is no way the @code{else}
6044 can belong to the enclosing @code{if}. The resulting code
6045 looks like this:
6046
6047 @smallexample
6048 @group
6049 @{
6050 if (a)
6051 @{
6052 if (b)
6053 foo ();
6054 else
6055 bar ();
6056 @}
6057 @}
6058 @end group
6059 @end smallexample
6060
6061 This warning is enabled by @option{-Wparentheses}.
6062
6063 @item -Wdate-time
6064 @opindex Wdate-time
6065 @opindex Wno-date-time
6066 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6067 are encountered as they might prevent bit-wise-identical reproducible
6068 compilations.
6069
6070 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6071 @opindex Wdelete-incomplete
6072 @opindex Wno-delete-incomplete
6073 Warn when deleting a pointer to incomplete type, which may cause
6074 undefined behavior at runtime. This warning is enabled by default.
6075
6076 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6077 @opindex Wuseless-cast
6078 @opindex Wno-useless-cast
6079 Warn when an expression is casted to its own type.
6080
6081 @item -Wempty-body
6082 @opindex Wempty-body
6083 @opindex Wno-empty-body
6084 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6085 while} statement. This warning is also enabled by @option{-Wextra}.
6086
6087 @item -Wenum-compare
6088 @opindex Wenum-compare
6089 @opindex Wno-enum-compare
6090 Warn about a comparison between values of different enumerated types.
6091 In C++ enumerated type mismatches in conditional expressions are also
6092 diagnosed and the warning is enabled by default. In C this warning is
6093 enabled by @option{-Wall}.
6094
6095 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6096 @opindex Wextra-semi
6097 @opindex Wno-extra-semi
6098 Warn about redundant semicolon after in-class function definition.
6099
6100 @item -Wjump-misses-init @r{(C, Objective-C only)}
6101 @opindex Wjump-misses-init
6102 @opindex Wno-jump-misses-init
6103 Warn if a @code{goto} statement or a @code{switch} statement jumps
6104 forward across the initialization of a variable, or jumps backward to a
6105 label after the variable has been initialized. This only warns about
6106 variables that are initialized when they are declared. This warning is
6107 only supported for C and Objective-C; in C++ this sort of branch is an
6108 error in any case.
6109
6110 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6111 can be disabled with the @option{-Wno-jump-misses-init} option.
6112
6113 @item -Wsign-compare
6114 @opindex Wsign-compare
6115 @opindex Wno-sign-compare
6116 @cindex warning for comparison of signed and unsigned values
6117 @cindex comparison of signed and unsigned values, warning
6118 @cindex signed and unsigned values, comparison warning
6119 Warn when a comparison between signed and unsigned values could produce
6120 an incorrect result when the signed value is converted to unsigned.
6121 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6122 also enabled by @option{-Wextra}.
6123
6124 @item -Wsign-conversion
6125 @opindex Wsign-conversion
6126 @opindex Wno-sign-conversion
6127 Warn for implicit conversions that may change the sign of an integer
6128 value, like assigning a signed integer expression to an unsigned
6129 integer variable. An explicit cast silences the warning. In C, this
6130 option is enabled also by @option{-Wconversion}.
6131
6132 @item -Wfloat-conversion
6133 @opindex Wfloat-conversion
6134 @opindex Wno-float-conversion
6135 Warn for implicit conversions that reduce the precision of a real value.
6136 This includes conversions from real to integer, and from higher precision
6137 real to lower precision real values. This option is also enabled by
6138 @option{-Wconversion}.
6139
6140 @item -Wno-scalar-storage-order
6141 @opindex -Wno-scalar-storage-order
6142 @opindex -Wscalar-storage-order
6143 Do not warn on suspicious constructs involving reverse scalar storage order.
6144
6145 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6146 @opindex Wsized-deallocation
6147 @opindex Wno-sized-deallocation
6148 Warn about a definition of an unsized deallocation function
6149 @smallexample
6150 void operator delete (void *) noexcept;
6151 void operator delete[] (void *) noexcept;
6152 @end smallexample
6153 without a definition of the corresponding sized deallocation function
6154 @smallexample
6155 void operator delete (void *, std::size_t) noexcept;
6156 void operator delete[] (void *, std::size_t) noexcept;
6157 @end smallexample
6158 or vice versa. Enabled by @option{-Wextra} along with
6159 @option{-fsized-deallocation}.
6160
6161 @item -Wsizeof-pointer-div
6162 @opindex Wsizeof-pointer-div
6163 @opindex Wno-sizeof-pointer-div
6164 Warn for suspicious divisions of two sizeof expressions that divide
6165 the pointer size by the element size, which is the usual way to compute
6166 the array size but won't work out correctly with pointers. This warning
6167 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6168 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6169
6170 @item -Wsizeof-pointer-memaccess
6171 @opindex Wsizeof-pointer-memaccess
6172 @opindex Wno-sizeof-pointer-memaccess
6173 Warn for suspicious length parameters to certain string and memory built-in
6174 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
6175 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
6176 but a pointer, and suggests a possible fix, or about
6177 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
6178 @option{-Wall}.
6179
6180 @item -Wsizeof-array-argument
6181 @opindex Wsizeof-array-argument
6182 @opindex Wno-sizeof-array-argument
6183 Warn when the @code{sizeof} operator is applied to a parameter that is
6184 declared as an array in a function definition. This warning is enabled by
6185 default for C and C++ programs.
6186
6187 @item -Wmemset-elt-size
6188 @opindex Wmemset-elt-size
6189 @opindex Wno-memset-elt-size
6190 Warn for suspicious calls to the @code{memset} built-in function, if the
6191 first argument references an array, and the third argument is a number
6192 equal to the number of elements, but not equal to the size of the array
6193 in memory. This indicates that the user has omitted a multiplication by
6194 the element size. This warning is enabled by @option{-Wall}.
6195
6196 @item -Wmemset-transposed-args
6197 @opindex Wmemset-transposed-args
6198 @opindex Wno-memset-transposed-args
6199 Warn for suspicious calls to the @code{memset} built-in function, if the
6200 second argument is not zero and the third argument is zero. This warns e.g.@
6201 about @code{memset (buf, sizeof buf, 0)} where most probably
6202 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6203 is only emitted if the third argument is literal zero. If it is some
6204 expression that is folded to zero, a cast of zero to some type, etc.,
6205 it is far less likely that the user has mistakenly exchanged the arguments
6206 and no warning is emitted. This warning is enabled by @option{-Wall}.
6207
6208 @item -Waddress
6209 @opindex Waddress
6210 @opindex Wno-address
6211 Warn about suspicious uses of memory addresses. These include using
6212 the address of a function in a conditional expression, such as
6213 @code{void func(void); if (func)}, and comparisons against the memory
6214 address of a string literal, such as @code{if (x == "abc")}. Such
6215 uses typically indicate a programmer error: the address of a function
6216 always evaluates to true, so their use in a conditional usually
6217 indicate that the programmer forgot the parentheses in a function
6218 call; and comparisons against string literals result in unspecified
6219 behavior and are not portable in C, so they usually indicate that the
6220 programmer intended to use @code{strcmp}. This warning is enabled by
6221 @option{-Wall}.
6222
6223 @item -Wlogical-op
6224 @opindex Wlogical-op
6225 @opindex Wno-logical-op
6226 Warn about suspicious uses of logical operators in expressions.
6227 This includes using logical operators in contexts where a
6228 bit-wise operator is likely to be expected. Also warns when
6229 the operands of a logical operator are the same:
6230 @smallexample
6231 extern int a;
6232 if (a < 0 && a < 0) @{ @dots{} @}
6233 @end smallexample
6234
6235 @item -Wlogical-not-parentheses
6236 @opindex Wlogical-not-parentheses
6237 @opindex Wno-logical-not-parentheses
6238 Warn about logical not used on the left hand side operand of a comparison.
6239 This option does not warn if the right operand is considered to be a boolean
6240 expression. Its purpose is to detect suspicious code like the following:
6241 @smallexample
6242 int a;
6243 @dots{}
6244 if (!a > 1) @{ @dots{} @}
6245 @end smallexample
6246
6247 It is possible to suppress the warning by wrapping the LHS into
6248 parentheses:
6249 @smallexample
6250 if ((!a) > 1) @{ @dots{} @}
6251 @end smallexample
6252
6253 This warning is enabled by @option{-Wall}.
6254
6255 @item -Waggregate-return
6256 @opindex Waggregate-return
6257 @opindex Wno-aggregate-return
6258 Warn if any functions that return structures or unions are defined or
6259 called. (In languages where you can return an array, this also elicits
6260 a warning.)
6261
6262 @item -Wno-aggressive-loop-optimizations
6263 @opindex Wno-aggressive-loop-optimizations
6264 @opindex Waggressive-loop-optimizations
6265 Warn if in a loop with constant number of iterations the compiler detects
6266 undefined behavior in some statement during one or more of the iterations.
6267
6268 @item -Wno-attributes
6269 @opindex Wno-attributes
6270 @opindex Wattributes
6271 Do not warn if an unexpected @code{__attribute__} is used, such as
6272 unrecognized attributes, function attributes applied to variables,
6273 etc. This does not stop errors for incorrect use of supported
6274 attributes.
6275
6276 @item -Wno-builtin-declaration-mismatch
6277 @opindex Wno-builtin-declaration-mismatch
6278 @opindex Wbuiltin-declaration-mismatch
6279 Warn if a built-in function is declared with the wrong signature.
6280 This warning is enabled by default.
6281
6282 @item -Wno-builtin-macro-redefined
6283 @opindex Wno-builtin-macro-redefined
6284 @opindex Wbuiltin-macro-redefined
6285 Do not warn if certain built-in macros are redefined. This suppresses
6286 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
6287 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
6288
6289 @item -Wstrict-prototypes @r{(C and Objective-C only)}
6290 @opindex Wstrict-prototypes
6291 @opindex Wno-strict-prototypes
6292 Warn if a function is declared or defined without specifying the
6293 argument types. (An old-style function definition is permitted without
6294 a warning if preceded by a declaration that specifies the argument
6295 types.)
6296
6297 @item -Wold-style-declaration @r{(C and Objective-C only)}
6298 @opindex Wold-style-declaration
6299 @opindex Wno-old-style-declaration
6300 Warn for obsolescent usages, according to the C Standard, in a
6301 declaration. For example, warn if storage-class specifiers like
6302 @code{static} are not the first things in a declaration. This warning
6303 is also enabled by @option{-Wextra}.
6304
6305 @item -Wold-style-definition @r{(C and Objective-C only)}
6306 @opindex Wold-style-definition
6307 @opindex Wno-old-style-definition
6308 Warn if an old-style function definition is used. A warning is given
6309 even if there is a previous prototype.
6310
6311 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
6312 @opindex Wmissing-parameter-type
6313 @opindex Wno-missing-parameter-type
6314 A function parameter is declared without a type specifier in K&R-style
6315 functions:
6316
6317 @smallexample
6318 void foo(bar) @{ @}
6319 @end smallexample
6320
6321 This warning is also enabled by @option{-Wextra}.
6322
6323 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6324 @opindex Wmissing-prototypes
6325 @opindex Wno-missing-prototypes
6326 Warn if a global function is defined without a previous prototype
6327 declaration. This warning is issued even if the definition itself
6328 provides a prototype. Use this option to detect global functions
6329 that do not have a matching prototype declaration in a header file.
6330 This option is not valid for C++ because all function declarations
6331 provide prototypes and a non-matching declaration declares an
6332 overload rather than conflict with an earlier declaration.
6333 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6334
6335 @item -Wmissing-declarations
6336 @opindex Wmissing-declarations
6337 @opindex Wno-missing-declarations
6338 Warn if a global function is defined without a previous declaration.
6339 Do so even if the definition itself provides a prototype.
6340 Use this option to detect global functions that are not declared in
6341 header files. In C, no warnings are issued for functions with previous
6342 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6343 missing prototypes. In C++, no warnings are issued for function templates,
6344 or for inline functions, or for functions in anonymous namespaces.
6345
6346 @item -Wmissing-field-initializers
6347 @opindex Wmissing-field-initializers
6348 @opindex Wno-missing-field-initializers
6349 @opindex W
6350 @opindex Wextra
6351 @opindex Wno-extra
6352 Warn if a structure's initializer has some fields missing. For
6353 example, the following code causes such a warning, because
6354 @code{x.h} is implicitly zero:
6355
6356 @smallexample
6357 struct s @{ int f, g, h; @};
6358 struct s x = @{ 3, 4 @};
6359 @end smallexample
6360
6361 This option does not warn about designated initializers, so the following
6362 modification does not trigger a warning:
6363
6364 @smallexample
6365 struct s @{ int f, g, h; @};
6366 struct s x = @{ .f = 3, .g = 4 @};
6367 @end smallexample
6368
6369 In C this option does not warn about the universal zero initializer
6370 @samp{@{ 0 @}}:
6371
6372 @smallexample
6373 struct s @{ int f, g, h; @};
6374 struct s x = @{ 0 @};
6375 @end smallexample
6376
6377 Likewise, in C++ this option does not warn about the empty @{ @}
6378 initializer, for example:
6379
6380 @smallexample
6381 struct s @{ int f, g, h; @};
6382 s x = @{ @};
6383 @end smallexample
6384
6385 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6386 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6387
6388 @item -Wno-multichar
6389 @opindex Wno-multichar
6390 @opindex Wmultichar
6391 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6392 Usually they indicate a typo in the user's code, as they have
6393 implementation-defined values, and should not be used in portable code.
6394
6395 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
6396 @opindex Wnormalized=
6397 @opindex Wnormalized
6398 @opindex Wno-normalized
6399 @cindex NFC
6400 @cindex NFKC
6401 @cindex character set, input normalization
6402 In ISO C and ISO C++, two identifiers are different if they are
6403 different sequences of characters. However, sometimes when characters
6404 outside the basic ASCII character set are used, you can have two
6405 different character sequences that look the same. To avoid confusion,
6406 the ISO 10646 standard sets out some @dfn{normalization rules} which
6407 when applied ensure that two sequences that look the same are turned into
6408 the same sequence. GCC can warn you if you are using identifiers that
6409 have not been normalized; this option controls that warning.
6410
6411 There are four levels of warning supported by GCC@. The default is
6412 @option{-Wnormalized=nfc}, which warns about any identifier that is
6413 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6414 recommended form for most uses. It is equivalent to
6415 @option{-Wnormalized}.
6416
6417 Unfortunately, there are some characters allowed in identifiers by
6418 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6419 identifiers. That is, there's no way to use these symbols in portable
6420 ISO C or C++ and have all your identifiers in NFC@.
6421 @option{-Wnormalized=id} suppresses the warning for these characters.
6422 It is hoped that future versions of the standards involved will correct
6423 this, which is why this option is not the default.
6424
6425 You can switch the warning off for all characters by writing
6426 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6427 only do this if you are using some other normalization scheme (like
6428 ``D''), because otherwise you can easily create bugs that are
6429 literally impossible to see.
6430
6431 Some characters in ISO 10646 have distinct meanings but look identical
6432 in some fonts or display methodologies, especially once formatting has
6433 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6434 LETTER N'', displays just like a regular @code{n} that has been
6435 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6436 normalization scheme to convert all these into a standard form as
6437 well, and GCC warns if your code is not in NFKC if you use
6438 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6439 about every identifier that contains the letter O because it might be
6440 confused with the digit 0, and so is not the default, but may be
6441 useful as a local coding convention if the programming environment
6442 cannot be fixed to display these characters distinctly.
6443
6444 @item -Wno-deprecated
6445 @opindex Wno-deprecated
6446 @opindex Wdeprecated
6447 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6448
6449 @item -Wno-deprecated-declarations
6450 @opindex Wno-deprecated-declarations
6451 @opindex Wdeprecated-declarations
6452 Do not warn about uses of functions (@pxref{Function Attributes}),
6453 variables (@pxref{Variable Attributes}), and types (@pxref{Type
6454 Attributes}) marked as deprecated by using the @code{deprecated}
6455 attribute.
6456
6457 @item -Wno-overflow
6458 @opindex Wno-overflow
6459 @opindex Woverflow
6460 Do not warn about compile-time overflow in constant expressions.
6461
6462 @item -Wno-odr
6463 @opindex Wno-odr
6464 @opindex Wodr
6465 Warn about One Definition Rule violations during link-time optimization.
6466 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
6467
6468 @item -Wopenmp-simd
6469 @opindex Wopenm-simd
6470 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
6471 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
6472 option can be used to relax the cost model.
6473
6474 @item -Woverride-init @r{(C and Objective-C only)}
6475 @opindex Woverride-init
6476 @opindex Wno-override-init
6477 @opindex W
6478 @opindex Wextra
6479 @opindex Wno-extra
6480 Warn if an initialized field without side effects is overridden when
6481 using designated initializers (@pxref{Designated Inits, , Designated
6482 Initializers}).
6483
6484 This warning is included in @option{-Wextra}. To get other
6485 @option{-Wextra} warnings without this one, use @option{-Wextra
6486 -Wno-override-init}.
6487
6488 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
6489 @opindex Woverride-init-side-effects
6490 @opindex Wno-override-init-side-effects
6491 Warn if an initialized field with side effects is overridden when
6492 using designated initializers (@pxref{Designated Inits, , Designated
6493 Initializers}). This warning is enabled by default.
6494
6495 @item -Wpacked
6496 @opindex Wpacked
6497 @opindex Wno-packed
6498 Warn if a structure is given the packed attribute, but the packed
6499 attribute has no effect on the layout or size of the structure.
6500 Such structures may be mis-aligned for little benefit. For
6501 instance, in this code, the variable @code{f.x} in @code{struct bar}
6502 is misaligned even though @code{struct bar} does not itself
6503 have the packed attribute:
6504
6505 @smallexample
6506 @group
6507 struct foo @{
6508 int x;
6509 char a, b, c, d;
6510 @} __attribute__((packed));
6511 struct bar @{
6512 char z;
6513 struct foo f;
6514 @};
6515 @end group
6516 @end smallexample
6517
6518 @item -Wpacked-bitfield-compat
6519 @opindex Wpacked-bitfield-compat
6520 @opindex Wno-packed-bitfield-compat
6521 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
6522 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
6523 the change can lead to differences in the structure layout. GCC
6524 informs you when the offset of such a field has changed in GCC 4.4.
6525 For example there is no longer a 4-bit padding between field @code{a}
6526 and @code{b} in this structure:
6527
6528 @smallexample
6529 struct foo
6530 @{
6531 char a:4;
6532 char b:8;
6533 @} __attribute__ ((packed));
6534 @end smallexample
6535
6536 This warning is enabled by default. Use
6537 @option{-Wno-packed-bitfield-compat} to disable this warning.
6538
6539 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6540 @opindex Wpacked-not-aligned
6541 @opindex Wno-packed-not-aligned
6542 Warn if a structure field with explicitly specified alignment in a
6543 packed struct or union is misaligned. For example, a warning will
6544 be issued on @code{struct S}, like, @code{warning: alignment 1 of
6545 'struct S' is less than 8}, in this code:
6546
6547 @smallexample
6548 @group
6549 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
6550 struct __attribute__ ((packed)) S @{
6551 struct S8 s8;
6552 @};
6553 @end group
6554 @end smallexample
6555
6556 This warning is enabled by @option{-Wall}.
6557
6558 @item -Wpadded
6559 @opindex Wpadded
6560 @opindex Wno-padded
6561 Warn if padding is included in a structure, either to align an element
6562 of the structure or to align the whole structure. Sometimes when this
6563 happens it is possible to rearrange the fields of the structure to
6564 reduce the padding and so make the structure smaller.
6565
6566 @item -Wredundant-decls
6567 @opindex Wredundant-decls
6568 @opindex Wno-redundant-decls
6569 Warn if anything is declared more than once in the same scope, even in
6570 cases where multiple declaration is valid and changes nothing.
6571
6572 @item -Wrestrict
6573 @opindex Wrestrict
6574 @opindex Wno-restrict
6575 Warn when an argument passed to a restrict-qualified parameter
6576 aliases with another argument.
6577
6578 @item -Wnested-externs @r{(C and Objective-C only)}
6579 @opindex Wnested-externs
6580 @opindex Wno-nested-externs
6581 Warn if an @code{extern} declaration is encountered within a function.
6582
6583 @item -Wno-inherited-variadic-ctor
6584 @opindex Winherited-variadic-ctor
6585 @opindex Wno-inherited-variadic-ctor
6586 Suppress warnings about use of C++11 inheriting constructors when the
6587 base class inherited from has a C variadic constructor; the warning is
6588 on by default because the ellipsis is not inherited.
6589
6590 @item -Winline
6591 @opindex Winline
6592 @opindex Wno-inline
6593 Warn if a function that is declared as inline cannot be inlined.
6594 Even with this option, the compiler does not warn about failures to
6595 inline functions declared in system headers.
6596
6597 The compiler uses a variety of heuristics to determine whether or not
6598 to inline a function. For example, the compiler takes into account
6599 the size of the function being inlined and the amount of inlining
6600 that has already been done in the current function. Therefore,
6601 seemingly insignificant changes in the source program can cause the
6602 warnings produced by @option{-Winline} to appear or disappear.
6603
6604 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
6605 @opindex Wno-invalid-offsetof
6606 @opindex Winvalid-offsetof
6607 Suppress warnings from applying the @code{offsetof} macro to a non-POD
6608 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
6609 to a non-standard-layout type is undefined. In existing C++ implementations,
6610 however, @code{offsetof} typically gives meaningful results.
6611 This flag is for users who are aware that they are
6612 writing nonportable code and who have deliberately chosen to ignore the
6613 warning about it.
6614
6615 The restrictions on @code{offsetof} may be relaxed in a future version
6616 of the C++ standard.
6617
6618 @item -Wint-in-bool-context
6619 @opindex Wint-in-bool-context
6620 @opindex Wno-int-in-bool-context
6621 Warn for suspicious use of integer values where boolean values are expected,
6622 such as conditional expressions (?:) using non-boolean integer constants in
6623 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
6624 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
6625 for all kinds of multiplications regardless of the data type.
6626 This warning is enabled by @option{-Wall}.
6627
6628 @item -Wno-int-to-pointer-cast
6629 @opindex Wno-int-to-pointer-cast
6630 @opindex Wint-to-pointer-cast
6631 Suppress warnings from casts to pointer type of an integer of a
6632 different size. In C++, casting to a pointer type of smaller size is
6633 an error. @option{Wint-to-pointer-cast} is enabled by default.
6634
6635
6636 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
6637 @opindex Wno-pointer-to-int-cast
6638 @opindex Wpointer-to-int-cast
6639 Suppress warnings from casts from a pointer to an integer type of a
6640 different size.
6641
6642 @item -Winvalid-pch
6643 @opindex Winvalid-pch
6644 @opindex Wno-invalid-pch
6645 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
6646 the search path but cannot be used.
6647
6648 @item -Wlong-long
6649 @opindex Wlong-long
6650 @opindex Wno-long-long
6651 Warn if @code{long long} type is used. This is enabled by either
6652 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
6653 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
6654
6655 @item -Wvariadic-macros
6656 @opindex Wvariadic-macros
6657 @opindex Wno-variadic-macros
6658 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6659 alternate syntax is used in ISO C99 mode. This is enabled by either
6660 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
6661 messages, use @option{-Wno-variadic-macros}.
6662
6663 @item -Wvarargs
6664 @opindex Wvarargs
6665 @opindex Wno-varargs
6666 Warn upon questionable usage of the macros used to handle variable
6667 arguments like @code{va_start}. This is default. To inhibit the
6668 warning messages, use @option{-Wno-varargs}.
6669
6670 @item -Wvector-operation-performance
6671 @opindex Wvector-operation-performance
6672 @opindex Wno-vector-operation-performance
6673 Warn if vector operation is not implemented via SIMD capabilities of the
6674 architecture. Mainly useful for the performance tuning.
6675 Vector operation can be implemented @code{piecewise}, which means that the
6676 scalar operation is performed on every vector element;
6677 @code{in parallel}, which means that the vector operation is implemented
6678 using scalars of wider type, which normally is more performance efficient;
6679 and @code{as a single scalar}, which means that vector fits into a
6680 scalar type.
6681
6682 @item -Wno-virtual-move-assign
6683 @opindex Wvirtual-move-assign
6684 @opindex Wno-virtual-move-assign
6685 Suppress warnings about inheriting from a virtual base with a
6686 non-trivial C++11 move assignment operator. This is dangerous because
6687 if the virtual base is reachable along more than one path, it is
6688 moved multiple times, which can mean both objects end up in the
6689 moved-from state. If the move assignment operator is written to avoid
6690 moving from a moved-from object, this warning can be disabled.
6691
6692 @item -Wvla
6693 @opindex Wvla
6694 @opindex Wno-vla
6695 Warn if a variable-length array is used in the code.
6696 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
6697 the variable-length array.
6698
6699 @item -Wvla-larger-than=@var{n}
6700 If this option is used, the compiler will warn on uses of
6701 variable-length arrays where the size is either unbounded, or bounded
6702 by an argument that can be larger than @var{n} bytes. This is similar
6703 to how @option{-Walloca-larger-than=@var{n}} works, but with
6704 variable-length arrays.
6705
6706 Note that GCC may optimize small variable-length arrays of a known
6707 value into plain arrays, so this warning may not get triggered for
6708 such arrays.
6709
6710 This warning is not enabled by @option{-Wall}, and is only active when
6711 @option{-ftree-vrp} is active (default for @option{-O2} and above).
6712
6713 See also @option{-Walloca-larger-than=@var{n}}.
6714
6715 @item -Wvolatile-register-var
6716 @opindex Wvolatile-register-var
6717 @opindex Wno-volatile-register-var
6718 Warn if a register variable is declared volatile. The volatile
6719 modifier does not inhibit all optimizations that may eliminate reads
6720 and/or writes to register variables. This warning is enabled by
6721 @option{-Wall}.
6722
6723 @item -Wdisabled-optimization
6724 @opindex Wdisabled-optimization
6725 @opindex Wno-disabled-optimization
6726 Warn if a requested optimization pass is disabled. This warning does
6727 not generally indicate that there is anything wrong with your code; it
6728 merely indicates that GCC's optimizers are unable to handle the code
6729 effectively. Often, the problem is that your code is too big or too
6730 complex; GCC refuses to optimize programs when the optimization
6731 itself is likely to take inordinate amounts of time.
6732
6733 @item -Wpointer-sign @r{(C and Objective-C only)}
6734 @opindex Wpointer-sign
6735 @opindex Wno-pointer-sign
6736 Warn for pointer argument passing or assignment with different signedness.
6737 This option is only supported for C and Objective-C@. It is implied by
6738 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
6739 @option{-Wno-pointer-sign}.
6740
6741 @item -Wstack-protector
6742 @opindex Wstack-protector
6743 @opindex Wno-stack-protector
6744 This option is only active when @option{-fstack-protector} is active. It
6745 warns about functions that are not protected against stack smashing.
6746
6747 @item -Woverlength-strings
6748 @opindex Woverlength-strings
6749 @opindex Wno-overlength-strings
6750 Warn about string constants that are longer than the ``minimum
6751 maximum'' length specified in the C standard. Modern compilers
6752 generally allow string constants that are much longer than the
6753 standard's minimum limit, but very portable programs should avoid
6754 using longer strings.
6755
6756 The limit applies @emph{after} string constant concatenation, and does
6757 not count the trailing NUL@. In C90, the limit was 509 characters; in
6758 C99, it was raised to 4095. C++98 does not specify a normative
6759 minimum maximum, so we do not diagnose overlength strings in C++@.
6760
6761 This option is implied by @option{-Wpedantic}, and can be disabled with
6762 @option{-Wno-overlength-strings}.
6763
6764 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
6765 @opindex Wunsuffixed-float-constants
6766
6767 Issue a warning for any floating constant that does not have
6768 a suffix. When used together with @option{-Wsystem-headers} it
6769 warns about such constants in system header files. This can be useful
6770 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
6771 from the decimal floating-point extension to C99.
6772
6773 @item -Wno-designated-init @r{(C and Objective-C only)}
6774 Suppress warnings when a positional initializer is used to initialize
6775 a structure that has been marked with the @code{designated_init}
6776 attribute.
6777
6778 @item -Whsa
6779 Issue a warning when HSAIL cannot be emitted for the compiled function or
6780 OpenMP construct.
6781
6782 @end table
6783
6784 @node Debugging Options
6785 @section Options for Debugging Your Program
6786 @cindex options, debugging
6787 @cindex debugging information options
6788
6789 To tell GCC to emit extra information for use by a debugger, in almost
6790 all cases you need only to add @option{-g} to your other options.
6791
6792 GCC allows you to use @option{-g} with
6793 @option{-O}. The shortcuts taken by optimized code may occasionally
6794 be surprising: some variables you declared may not exist
6795 at all; flow of control may briefly move where you did not expect it;
6796 some statements may not be executed because they compute constant
6797 results or their values are already at hand; some statements may
6798 execute in different places because they have been moved out of loops.
6799 Nevertheless it is possible to debug optimized output. This makes
6800 it reasonable to use the optimizer for programs that might have bugs.
6801
6802 If you are not using some other optimization option, consider
6803 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
6804 With no @option{-O} option at all, some compiler passes that collect
6805 information useful for debugging do not run at all, so that
6806 @option{-Og} may result in a better debugging experience.
6807
6808 @table @gcctabopt
6809 @item -g
6810 @opindex g
6811 Produce debugging information in the operating system's native format
6812 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
6813 information.
6814
6815 On most systems that use stabs format, @option{-g} enables use of extra
6816 debugging information that only GDB can use; this extra information
6817 makes debugging work better in GDB but probably makes other debuggers
6818 crash or
6819 refuse to read the program. If you want to control for certain whether
6820 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
6821 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
6822
6823 @item -ggdb
6824 @opindex ggdb
6825 Produce debugging information for use by GDB@. This means to use the
6826 most expressive format available (DWARF, stabs, or the native format
6827 if neither of those are supported), including GDB extensions if at all
6828 possible.
6829
6830 @item -gdwarf
6831 @itemx -gdwarf-@var{version}
6832 @opindex gdwarf
6833 Produce debugging information in DWARF format (if that is supported).
6834 The value of @var{version} may be either 2, 3, 4 or 5; the default version
6835 for most targets is 4. DWARF Version 5 is only experimental.
6836
6837 Note that with DWARF Version 2, some ports require and always
6838 use some non-conflicting DWARF 3 extensions in the unwind tables.
6839
6840 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
6841 for maximum benefit.
6842
6843 GCC no longer supports DWARF Version 1, which is substantially
6844 different than Version 2 and later. For historical reasons, some
6845 other DWARF-related options such as
6846 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
6847 in their names, but apply to all currently-supported versions of DWARF.
6848
6849 @item -gstabs
6850 @opindex gstabs
6851 Produce debugging information in stabs format (if that is supported),
6852 without GDB extensions. This is the format used by DBX on most BSD
6853 systems. On MIPS, Alpha and System V Release 4 systems this option
6854 produces stabs debugging output that is not understood by DBX or SDB@.
6855 On System V Release 4 systems this option requires the GNU assembler.
6856
6857 @item -gstabs+
6858 @opindex gstabs+
6859 Produce debugging information in stabs format (if that is supported),
6860 using GNU extensions understood only by the GNU debugger (GDB)@. The
6861 use of these extensions is likely to make other debuggers crash or
6862 refuse to read the program.
6863
6864 @item -gcoff
6865 @opindex gcoff
6866 Produce debugging information in COFF format (if that is supported).
6867 This is the format used by SDB on most System V systems prior to
6868 System V Release 4.
6869
6870 @item -gxcoff
6871 @opindex gxcoff
6872 Produce debugging information in XCOFF format (if that is supported).
6873 This is the format used by the DBX debugger on IBM RS/6000 systems.
6874
6875 @item -gxcoff+
6876 @opindex gxcoff+
6877 Produce debugging information in XCOFF format (if that is supported),
6878 using GNU extensions understood only by the GNU debugger (GDB)@. The
6879 use of these extensions is likely to make other debuggers crash or
6880 refuse to read the program, and may cause assemblers other than the GNU
6881 assembler (GAS) to fail with an error.
6882
6883 @item -gvms
6884 @opindex gvms
6885 Produce debugging information in Alpha/VMS debug format (if that is
6886 supported). This is the format used by DEBUG on Alpha/VMS systems.
6887
6888 @item -g@var{level}
6889 @itemx -ggdb@var{level}
6890 @itemx -gstabs@var{level}
6891 @itemx -gcoff@var{level}
6892 @itemx -gxcoff@var{level}
6893 @itemx -gvms@var{level}
6894 Request debugging information and also use @var{level} to specify how
6895 much information. The default level is 2.
6896
6897 Level 0 produces no debug information at all. Thus, @option{-g0} negates
6898 @option{-g}.
6899
6900 Level 1 produces minimal information, enough for making backtraces in
6901 parts of the program that you don't plan to debug. This includes
6902 descriptions of functions and external variables, and line number
6903 tables, but no information about local variables.
6904
6905 Level 3 includes extra information, such as all the macro definitions
6906 present in the program. Some debuggers support macro expansion when
6907 you use @option{-g3}.
6908
6909 @option{-gdwarf} does not accept a concatenated debug level, to avoid
6910 confusion with @option{-gdwarf-@var{level}}.
6911 Instead use an additional @option{-g@var{level}} option to change the
6912 debug level for DWARF.
6913
6914 @item -feliminate-unused-debug-symbols
6915 @opindex feliminate-unused-debug-symbols
6916 Produce debugging information in stabs format (if that is supported),
6917 for only symbols that are actually used.
6918
6919 @item -femit-class-debug-always
6920 @opindex femit-class-debug-always
6921 Instead of emitting debugging information for a C++ class in only one
6922 object file, emit it in all object files using the class. This option
6923 should be used only with debuggers that are unable to handle the way GCC
6924 normally emits debugging information for classes because using this
6925 option increases the size of debugging information by as much as a
6926 factor of two.
6927
6928 @item -fno-merge-debug-strings
6929 @opindex fmerge-debug-strings
6930 @opindex fno-merge-debug-strings
6931 Direct the linker to not merge together strings in the debugging
6932 information that are identical in different object files. Merging is
6933 not supported by all assemblers or linkers. Merging decreases the size
6934 of the debug information in the output file at the cost of increasing
6935 link processing time. Merging is enabled by default.
6936
6937 @item -fdebug-prefix-map=@var{old}=@var{new}
6938 @opindex fdebug-prefix-map
6939 When compiling files in directory @file{@var{old}}, record debugging
6940 information describing them as in @file{@var{new}} instead.
6941
6942 @item -fvar-tracking
6943 @opindex fvar-tracking
6944 Run variable tracking pass. It computes where variables are stored at each
6945 position in code. Better debugging information is then generated
6946 (if the debugging information format supports this information).
6947
6948 It is enabled by default when compiling with optimization (@option{-Os},
6949 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6950 the debug info format supports it.
6951
6952 @item -fvar-tracking-assignments
6953 @opindex fvar-tracking-assignments
6954 @opindex fno-var-tracking-assignments
6955 Annotate assignments to user variables early in the compilation and
6956 attempt to carry the annotations over throughout the compilation all the
6957 way to the end, in an attempt to improve debug information while
6958 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6959
6960 It can be enabled even if var-tracking is disabled, in which case
6961 annotations are created and maintained, but discarded at the end.
6962 By default, this flag is enabled together with @option{-fvar-tracking},
6963 except when selective scheduling is enabled.
6964
6965 @item -gsplit-dwarf
6966 @opindex gsplit-dwarf
6967 Separate as much DWARF debugging information as possible into a
6968 separate output file with the extension @file{.dwo}. This option allows
6969 the build system to avoid linking files with debug information. To
6970 be useful, this option requires a debugger capable of reading @file{.dwo}
6971 files.
6972
6973 @item -gpubnames
6974 @opindex gpubnames
6975 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
6976
6977 @item -ggnu-pubnames
6978 @opindex ggnu-pubnames
6979 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
6980 suitable for conversion into a GDB@ index. This option is only useful
6981 with a linker that can produce GDB@ index version 7.
6982
6983 @item -fdebug-types-section
6984 @opindex fdebug-types-section
6985 @opindex fno-debug-types-section
6986 When using DWARF Version 4 or higher, type DIEs can be put into
6987 their own @code{.debug_types} section instead of making them part of the
6988 @code{.debug_info} section. It is more efficient to put them in a separate
6989 comdat sections since the linker can then remove duplicates.
6990 But not all DWARF consumers support @code{.debug_types} sections yet
6991 and on some objects @code{.debug_types} produces larger instead of smaller
6992 debugging information.
6993
6994 @item -grecord-gcc-switches
6995 @item -gno-record-gcc-switches
6996 @opindex grecord-gcc-switches
6997 @opindex gno-record-gcc-switches
6998 This switch causes the command-line options used to invoke the
6999 compiler that may affect code generation to be appended to the
7000 DW_AT_producer attribute in DWARF debugging information. The options
7001 are concatenated with spaces separating them from each other and from
7002 the compiler version.
7003 It is enabled by default.
7004 See also @option{-frecord-gcc-switches} for another
7005 way of storing compiler options into the object file.
7006
7007 @item -gstrict-dwarf
7008 @opindex gstrict-dwarf
7009 Disallow using extensions of later DWARF standard version than selected
7010 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7011 DWARF extensions from later standard versions is allowed.
7012
7013 @item -gno-strict-dwarf
7014 @opindex gno-strict-dwarf
7015 Allow using extensions of later DWARF standard version than selected with
7016 @option{-gdwarf-@var{version}}.
7017
7018 @item -gcolumn-info
7019 @item -gno-column-info
7020 @opindex gcolumn-info
7021 @opindex gno-column-info
7022 Emit location column information into DWARF debugging information, rather
7023 than just file and line.
7024 This option is disabled by default.
7025
7026 @item -gz@r{[}=@var{type}@r{]}
7027 @opindex gz
7028 Produce compressed debug sections in DWARF format, if that is supported.
7029 If @var{type} is not given, the default type depends on the capabilities
7030 of the assembler and linker used. @var{type} may be one of
7031 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7032 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7033 compression in traditional GNU format). If the linker doesn't support
7034 writing compressed debug sections, the option is rejected. Otherwise,
7035 if the assembler does not support them, @option{-gz} is silently ignored
7036 when producing object files.
7037
7038 @item -femit-struct-debug-baseonly
7039 @opindex femit-struct-debug-baseonly
7040 Emit debug information for struct-like types
7041 only when the base name of the compilation source file
7042 matches the base name of file in which the struct is defined.
7043
7044 This option substantially reduces the size of debugging information,
7045 but at significant potential loss in type information to the debugger.
7046 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7047 See @option{-femit-struct-debug-detailed} for more detailed control.
7048
7049 This option works only with DWARF debug output.
7050
7051 @item -femit-struct-debug-reduced
7052 @opindex femit-struct-debug-reduced
7053 Emit debug information for struct-like types
7054 only when the base name of the compilation source file
7055 matches the base name of file in which the type is defined,
7056 unless the struct is a template or defined in a system header.
7057
7058 This option significantly reduces the size of debugging information,
7059 with some potential loss in type information to the debugger.
7060 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
7061 See @option{-femit-struct-debug-detailed} for more detailed control.
7062
7063 This option works only with DWARF debug output.
7064
7065 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
7066 @opindex femit-struct-debug-detailed
7067 Specify the struct-like types
7068 for which the compiler generates debug information.
7069 The intent is to reduce duplicate struct debug information
7070 between different object files within the same program.
7071
7072 This option is a detailed version of
7073 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
7074 which serves for most needs.
7075
7076 A specification has the syntax@*
7077 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
7078
7079 The optional first word limits the specification to
7080 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
7081 A struct type is used directly when it is the type of a variable, member.
7082 Indirect uses arise through pointers to structs.
7083 That is, when use of an incomplete struct is valid, the use is indirect.
7084 An example is
7085 @samp{struct one direct; struct two * indirect;}.
7086
7087 The optional second word limits the specification to
7088 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
7089 Generic structs are a bit complicated to explain.
7090 For C++, these are non-explicit specializations of template classes,
7091 or non-template classes within the above.
7092 Other programming languages have generics,
7093 but @option{-femit-struct-debug-detailed} does not yet implement them.
7094
7095 The third word specifies the source files for those
7096 structs for which the compiler should emit debug information.
7097 The values @samp{none} and @samp{any} have the normal meaning.
7098 The value @samp{base} means that
7099 the base of name of the file in which the type declaration appears
7100 must match the base of the name of the main compilation file.
7101 In practice, this means that when compiling @file{foo.c}, debug information
7102 is generated for types declared in that file and @file{foo.h},
7103 but not other header files.
7104 The value @samp{sys} means those types satisfying @samp{base}
7105 or declared in system or compiler headers.
7106
7107 You may need to experiment to determine the best settings for your application.
7108
7109 The default is @option{-femit-struct-debug-detailed=all}.
7110
7111 This option works only with DWARF debug output.
7112
7113 @item -fno-dwarf2-cfi-asm
7114 @opindex fdwarf2-cfi-asm
7115 @opindex fno-dwarf2-cfi-asm
7116 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
7117 instead of using GAS @code{.cfi_*} directives.
7118
7119 @item -fno-eliminate-unused-debug-types
7120 @opindex feliminate-unused-debug-types
7121 @opindex fno-eliminate-unused-debug-types
7122 Normally, when producing DWARF output, GCC avoids producing debug symbol
7123 output for types that are nowhere used in the source file being compiled.
7124 Sometimes it is useful to have GCC emit debugging
7125 information for all types declared in a compilation
7126 unit, regardless of whether or not they are actually used
7127 in that compilation unit, for example
7128 if, in the debugger, you want to cast a value to a type that is
7129 not actually used in your program (but is declared). More often,
7130 however, this results in a significant amount of wasted space.
7131 @end table
7132
7133 @node Optimize Options
7134 @section Options That Control Optimization
7135 @cindex optimize options
7136 @cindex options, optimization
7137
7138 These options control various sorts of optimizations.
7139
7140 Without any optimization option, the compiler's goal is to reduce the
7141 cost of compilation and to make debugging produce the expected
7142 results. Statements are independent: if you stop the program with a
7143 breakpoint between statements, you can then assign a new value to any
7144 variable or change the program counter to any other statement in the
7145 function and get exactly the results you expect from the source
7146 code.
7147
7148 Turning on optimization flags makes the compiler attempt to improve
7149 the performance and/or code size at the expense of compilation time
7150 and possibly the ability to debug the program.
7151
7152 The compiler performs optimization based on the knowledge it has of the
7153 program. Compiling multiple files at once to a single output file mode allows
7154 the compiler to use information gained from all of the files when compiling
7155 each of them.
7156
7157 Not all optimizations are controlled directly by a flag. Only
7158 optimizations that have a flag are listed in this section.
7159
7160 Most optimizations are only enabled if an @option{-O} level is set on
7161 the command line. Otherwise they are disabled, even if individual
7162 optimization flags are specified.
7163
7164 Depending on the target and how GCC was configured, a slightly different
7165 set of optimizations may be enabled at each @option{-O} level than
7166 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7167 to find out the exact set of optimizations that are enabled at each level.
7168 @xref{Overall Options}, for examples.
7169
7170 @table @gcctabopt
7171 @item -O
7172 @itemx -O1
7173 @opindex O
7174 @opindex O1
7175 Optimize. Optimizing compilation takes somewhat more time, and a lot
7176 more memory for a large function.
7177
7178 With @option{-O}, the compiler tries to reduce code size and execution
7179 time, without performing any optimizations that take a great deal of
7180 compilation time.
7181
7182 @option{-O} turns on the following optimization flags:
7183 @gccoptlist{
7184 -fauto-inc-dec @gol
7185 -fbranch-count-reg @gol
7186 -fcombine-stack-adjustments @gol
7187 -fcompare-elim @gol
7188 -fcprop-registers @gol
7189 -fdce @gol
7190 -fdefer-pop @gol
7191 -fdelayed-branch @gol
7192 -fdse @gol
7193 -fforward-propagate @gol
7194 -fguess-branch-probability @gol
7195 -fif-conversion2 @gol
7196 -fif-conversion @gol
7197 -finline-functions-called-once @gol
7198 -fipa-pure-const @gol
7199 -fipa-profile @gol
7200 -fipa-reference @gol
7201 -fmerge-constants @gol
7202 -fmove-loop-invariants @gol
7203 -freorder-blocks @gol
7204 -fshrink-wrap @gol
7205 -fshrink-wrap-separate @gol
7206 -fsplit-wide-types @gol
7207 -fssa-backprop @gol
7208 -fssa-phiopt @gol
7209 -ftree-bit-ccp @gol
7210 -ftree-ccp @gol
7211 -ftree-ch @gol
7212 -ftree-coalesce-vars @gol
7213 -ftree-copy-prop @gol
7214 -ftree-dce @gol
7215 -ftree-dominator-opts @gol
7216 -ftree-dse @gol
7217 -ftree-forwprop @gol
7218 -ftree-fre @gol
7219 -ftree-phiprop @gol
7220 -ftree-sink @gol
7221 -ftree-slsr @gol
7222 -ftree-sra @gol
7223 -ftree-pta @gol
7224 -ftree-ter @gol
7225 -funit-at-a-time}
7226
7227 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
7228 where doing so does not interfere with debugging.
7229
7230 @item -O2
7231 @opindex O2
7232 Optimize even more. GCC performs nearly all supported optimizations
7233 that do not involve a space-speed tradeoff.
7234 As compared to @option{-O}, this option increases both compilation time
7235 and the performance of the generated code.
7236
7237 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7238 also turns on the following optimization flags:
7239 @gccoptlist{-fthread-jumps @gol
7240 -falign-functions -falign-jumps @gol
7241 -falign-loops -falign-labels @gol
7242 -fcaller-saves @gol
7243 -fcrossjumping @gol
7244 -fcse-follow-jumps -fcse-skip-blocks @gol
7245 -fdelete-null-pointer-checks @gol
7246 -fdevirtualize -fdevirtualize-speculatively @gol
7247 -fexpensive-optimizations @gol
7248 -fgcse -fgcse-lm @gol
7249 -fhoist-adjacent-loads @gol
7250 -finline-small-functions @gol
7251 -findirect-inlining @gol
7252 -fipa-cp @gol
7253 -fipa-bit-cp @gol
7254 -fipa-vrp @gol
7255 -fipa-sra @gol
7256 -fipa-icf @gol
7257 -fisolate-erroneous-paths-dereference @gol
7258 -flra-remat @gol
7259 -foptimize-sibling-calls @gol
7260 -foptimize-strlen @gol
7261 -fpartial-inlining @gol
7262 -fpeephole2 @gol
7263 -freorder-blocks-algorithm=stc @gol
7264 -freorder-blocks-and-partition -freorder-functions @gol
7265 -frerun-cse-after-loop @gol
7266 -fsched-interblock -fsched-spec @gol
7267 -fschedule-insns -fschedule-insns2 @gol
7268 -fstore-merging @gol
7269 -fstrict-aliasing @gol
7270 -ftree-builtin-call-dce @gol
7271 -ftree-switch-conversion -ftree-tail-merge @gol
7272 -fcode-hoisting @gol
7273 -ftree-pre @gol
7274 -ftree-vrp @gol
7275 -fipa-ra}
7276
7277 Please note the warning under @option{-fgcse} about
7278 invoking @option{-O2} on programs that use computed gotos.
7279
7280 @item -O3
7281 @opindex O3
7282 Optimize yet more. @option{-O3} turns on all optimizations specified
7283 by @option{-O2} and also turns on the following optimization flags:
7284 @gccoptlist{-finline-functions @gol
7285 -funswitch-loops @gol
7286 -fpredictive-commoning @gol
7287 -fgcse-after-reload @gol
7288 -ftree-loop-vectorize @gol
7289 -ftree-loop-distribution @gol
7290 -ftree-loop-distribute-patterns @gol
7291 -fsplit-paths @gol
7292 -ftree-slp-vectorize @gol
7293 -fvect-cost-model @gol
7294 -ftree-partial-pre @gol
7295 -fpeel-loops @gol
7296 -fipa-cp-clone}
7297
7298 @item -O0
7299 @opindex O0
7300 Reduce compilation time and make debugging produce the expected
7301 results. This is the default.
7302
7303 @item -Os
7304 @opindex Os
7305 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7306 do not typically increase code size. It also performs further
7307 optimizations designed to reduce code size.
7308
7309 @option{-Os} disables the following optimization flags:
7310 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7311 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
7312 -freorder-blocks-and-partition -fprefetch-loop-arrays}
7313
7314 @item -Ofast
7315 @opindex Ofast
7316 Disregard strict standards compliance. @option{-Ofast} enables all
7317 @option{-O3} optimizations. It also enables optimizations that are not
7318 valid for all standard-compliant programs.
7319 It turns on @option{-ffast-math} and the Fortran-specific
7320 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
7321 specified, and @option{-fno-protect-parens}.
7322
7323 @item -Og
7324 @opindex Og
7325 Optimize debugging experience. @option{-Og} enables optimizations
7326 that do not interfere with debugging. It should be the optimization
7327 level of choice for the standard edit-compile-debug cycle, offering
7328 a reasonable level of optimization while maintaining fast compilation
7329 and a good debugging experience.
7330 @end table
7331
7332 If you use multiple @option{-O} options, with or without level numbers,
7333 the last such option is the one that is effective.
7334
7335 Options of the form @option{-f@var{flag}} specify machine-independent
7336 flags. Most flags have both positive and negative forms; the negative
7337 form of @option{-ffoo} is @option{-fno-foo}. In the table
7338 below, only one of the forms is listed---the one you typically
7339 use. You can figure out the other form by either removing @samp{no-}
7340 or adding it.
7341
7342 The following options control specific optimizations. They are either
7343 activated by @option{-O} options or are related to ones that are. You
7344 can use the following flags in the rare cases when ``fine-tuning'' of
7345 optimizations to be performed is desired.
7346
7347 @table @gcctabopt
7348 @item -fno-defer-pop
7349 @opindex fno-defer-pop
7350 Always pop the arguments to each function call as soon as that function
7351 returns. For machines that must pop arguments after a function call,
7352 the compiler normally lets arguments accumulate on the stack for several
7353 function calls and pops them all at once.
7354
7355 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7356
7357 @item -fforward-propagate
7358 @opindex fforward-propagate
7359 Perform a forward propagation pass on RTL@. The pass tries to combine two
7360 instructions and checks if the result can be simplified. If loop unrolling
7361 is active, two passes are performed and the second is scheduled after
7362 loop unrolling.
7363
7364 This option is enabled by default at optimization levels @option{-O},
7365 @option{-O2}, @option{-O3}, @option{-Os}.
7366
7367 @item -ffp-contract=@var{style}
7368 @opindex ffp-contract
7369 @option{-ffp-contract=off} disables floating-point expression contraction.
7370 @option{-ffp-contract=fast} enables floating-point expression contraction
7371 such as forming of fused multiply-add operations if the target has
7372 native support for them.
7373 @option{-ffp-contract=on} enables floating-point expression contraction
7374 if allowed by the language standard. This is currently not implemented
7375 and treated equal to @option{-ffp-contract=off}.
7376
7377 The default is @option{-ffp-contract=fast}.
7378
7379 @item -fomit-frame-pointer
7380 @opindex fomit-frame-pointer
7381 Don't keep the frame pointer in a register for functions that
7382 don't need one. This avoids the instructions to save, set up and
7383 restore frame pointers; it also makes an extra register available
7384 in many functions. @strong{It also makes debugging impossible on
7385 some machines.}
7386
7387 On some machines, such as the VAX, this flag has no effect, because
7388 the standard calling sequence automatically handles the frame pointer
7389 and nothing is saved by pretending it doesn't exist. The
7390 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
7391 whether a target machine supports this flag. @xref{Registers,,Register
7392 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
7393
7394 The default setting (when not optimizing for
7395 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
7396 @option{-fomit-frame-pointer}. You can configure GCC with the
7397 @option{--enable-frame-pointer} configure option to change the default.
7398
7399 Note that @option{-fno-omit-frame-pointer} doesn't force a new stack
7400 frame for all functions if it isn't otherwise needed, and hence doesn't
7401 guarantee a new frame pointer for all functions.
7402
7403 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7404
7405 @item -foptimize-sibling-calls
7406 @opindex foptimize-sibling-calls
7407 Optimize sibling and tail recursive calls.
7408
7409 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7410
7411 @item -foptimize-strlen
7412 @opindex foptimize-strlen
7413 Optimize various standard C string functions (e.g. @code{strlen},
7414 @code{strchr} or @code{strcpy}) and
7415 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7416
7417 Enabled at levels @option{-O2}, @option{-O3}.
7418
7419 @item -fno-inline
7420 @opindex fno-inline
7421 Do not expand any functions inline apart from those marked with
7422 the @code{always_inline} attribute. This is the default when not
7423 optimizing.
7424
7425 Single functions can be exempted from inlining by marking them
7426 with the @code{noinline} attribute.
7427
7428 @item -finline-small-functions
7429 @opindex finline-small-functions
7430 Integrate functions into their callers when their body is smaller than expected
7431 function call code (so overall size of program gets smaller). The compiler
7432 heuristically decides which functions are simple enough to be worth integrating
7433 in this way. This inlining applies to all functions, even those not declared
7434 inline.
7435
7436 Enabled at level @option{-O2}.
7437
7438 @item -findirect-inlining
7439 @opindex findirect-inlining
7440 Inline also indirect calls that are discovered to be known at compile
7441 time thanks to previous inlining. This option has any effect only
7442 when inlining itself is turned on by the @option{-finline-functions}
7443 or @option{-finline-small-functions} options.
7444
7445 Enabled at level @option{-O2}.
7446
7447 @item -finline-functions
7448 @opindex finline-functions
7449 Consider all functions for inlining, even if they are not declared inline.
7450 The compiler heuristically decides which functions are worth integrating
7451 in this way.
7452
7453 If all calls to a given function are integrated, and the function is
7454 declared @code{static}, then the function is normally not output as
7455 assembler code in its own right.
7456
7457 Enabled at level @option{-O3}.
7458
7459 @item -finline-functions-called-once
7460 @opindex finline-functions-called-once
7461 Consider all @code{static} functions called once for inlining into their
7462 caller even if they are not marked @code{inline}. If a call to a given
7463 function is integrated, then the function is not output as assembler code
7464 in its own right.
7465
7466 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7467
7468 @item -fearly-inlining
7469 @opindex fearly-inlining
7470 Inline functions marked by @code{always_inline} and functions whose body seems
7471 smaller than the function call overhead early before doing
7472 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7473 makes profiling significantly cheaper and usually inlining faster on programs
7474 having large chains of nested wrapper functions.
7475
7476 Enabled by default.
7477
7478 @item -fipa-sra
7479 @opindex fipa-sra
7480 Perform interprocedural scalar replacement of aggregates, removal of
7481 unused parameters and replacement of parameters passed by reference
7482 by parameters passed by value.
7483
7484 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7485
7486 @item -finline-limit=@var{n}
7487 @opindex finline-limit
7488 By default, GCC limits the size of functions that can be inlined. This flag
7489 allows coarse control of this limit. @var{n} is the size of functions that
7490 can be inlined in number of pseudo instructions.
7491
7492 Inlining is actually controlled by a number of parameters, which may be
7493 specified individually by using @option{--param @var{name}=@var{value}}.
7494 The @option{-finline-limit=@var{n}} option sets some of these parameters
7495 as follows:
7496
7497 @table @gcctabopt
7498 @item max-inline-insns-single
7499 is set to @var{n}/2.
7500 @item max-inline-insns-auto
7501 is set to @var{n}/2.
7502 @end table
7503
7504 See below for a documentation of the individual
7505 parameters controlling inlining and for the defaults of these parameters.
7506
7507 @emph{Note:} there may be no value to @option{-finline-limit} that results
7508 in default behavior.
7509
7510 @emph{Note:} pseudo instruction represents, in this particular context, an
7511 abstract measurement of function's size. In no way does it represent a count
7512 of assembly instructions and as such its exact meaning might change from one
7513 release to an another.
7514
7515 @item -fno-keep-inline-dllexport
7516 @opindex fno-keep-inline-dllexport
7517 This is a more fine-grained version of @option{-fkeep-inline-functions},
7518 which applies only to functions that are declared using the @code{dllexport}
7519 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
7520 Functions}.
7521
7522 @item -fkeep-inline-functions
7523 @opindex fkeep-inline-functions
7524 In C, emit @code{static} functions that are declared @code{inline}
7525 into the object file, even if the function has been inlined into all
7526 of its callers. This switch does not affect functions using the
7527 @code{extern inline} extension in GNU C90@. In C++, emit any and all
7528 inline functions into the object file.
7529
7530 @item -fkeep-static-functions
7531 @opindex fkeep-static-functions
7532 Emit @code{static} functions into the object file, even if the function
7533 is never used.
7534
7535 @item -fkeep-static-consts
7536 @opindex fkeep-static-consts
7537 Emit variables declared @code{static const} when optimization isn't turned
7538 on, even if the variables aren't referenced.
7539
7540 GCC enables this option by default. If you want to force the compiler to
7541 check if a variable is referenced, regardless of whether or not
7542 optimization is turned on, use the @option{-fno-keep-static-consts} option.
7543
7544 @item -fmerge-constants
7545 @opindex fmerge-constants
7546 Attempt to merge identical constants (string constants and floating-point
7547 constants) across compilation units.
7548
7549 This option is the default for optimized compilation if the assembler and
7550 linker support it. Use @option{-fno-merge-constants} to inhibit this
7551 behavior.
7552
7553 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7554
7555 @item -fmerge-all-constants
7556 @opindex fmerge-all-constants
7557 Attempt to merge identical constants and identical variables.
7558
7559 This option implies @option{-fmerge-constants}. In addition to
7560 @option{-fmerge-constants} this considers e.g.@: even constant initialized
7561 arrays or initialized constant variables with integral or floating-point
7562 types. Languages like C or C++ require each variable, including multiple
7563 instances of the same variable in recursive calls, to have distinct locations,
7564 so using this option results in non-conforming
7565 behavior.
7566
7567 @item -fmodulo-sched
7568 @opindex fmodulo-sched
7569 Perform swing modulo scheduling immediately before the first scheduling
7570 pass. This pass looks at innermost loops and reorders their
7571 instructions by overlapping different iterations.
7572
7573 @item -fmodulo-sched-allow-regmoves
7574 @opindex fmodulo-sched-allow-regmoves
7575 Perform more aggressive SMS-based modulo scheduling with register moves
7576 allowed. By setting this flag certain anti-dependences edges are
7577 deleted, which triggers the generation of reg-moves based on the
7578 life-range analysis. This option is effective only with
7579 @option{-fmodulo-sched} enabled.
7580
7581 @item -fno-branch-count-reg
7582 @opindex fno-branch-count-reg
7583 Avoid running a pass scanning for opportunities to use ``decrement and
7584 branch'' instructions on a count register instead of generating sequences
7585 of instructions that decrement a register, compare it against zero, and
7586 then branch based upon the result. This option is only meaningful on
7587 architectures that support such instructions, which include x86, PowerPC,
7588 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
7589 doesn't remove the decrement and branch instructions from the generated
7590 instruction stream introduced by other optimization passes.
7591
7592 Enabled by default at @option{-O1} and higher.
7593
7594 The default is @option{-fbranch-count-reg}.
7595
7596 @item -fno-function-cse
7597 @opindex fno-function-cse
7598 Do not put function addresses in registers; make each instruction that
7599 calls a constant function contain the function's address explicitly.
7600
7601 This option results in less efficient code, but some strange hacks
7602 that alter the assembler output may be confused by the optimizations
7603 performed when this option is not used.
7604
7605 The default is @option{-ffunction-cse}
7606
7607 @item -fno-zero-initialized-in-bss
7608 @opindex fno-zero-initialized-in-bss
7609 If the target supports a BSS section, GCC by default puts variables that
7610 are initialized to zero into BSS@. This can save space in the resulting
7611 code.
7612
7613 This option turns off this behavior because some programs explicitly
7614 rely on variables going to the data section---e.g., so that the
7615 resulting executable can find the beginning of that section and/or make
7616 assumptions based on that.
7617
7618 The default is @option{-fzero-initialized-in-bss}.
7619
7620 @item -fthread-jumps
7621 @opindex fthread-jumps
7622 Perform optimizations that check to see if a jump branches to a
7623 location where another comparison subsumed by the first is found. If
7624 so, the first branch is redirected to either the destination of the
7625 second branch or a point immediately following it, depending on whether
7626 the condition is known to be true or false.
7627
7628 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7629
7630 @item -fsplit-wide-types
7631 @opindex fsplit-wide-types
7632 When using a type that occupies multiple registers, such as @code{long
7633 long} on a 32-bit system, split the registers apart and allocate them
7634 independently. This normally generates better code for those types,
7635 but may make debugging more difficult.
7636
7637 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
7638 @option{-Os}.
7639
7640 @item -fcse-follow-jumps
7641 @opindex fcse-follow-jumps
7642 In common subexpression elimination (CSE), scan through jump instructions
7643 when the target of the jump is not reached by any other path. For
7644 example, when CSE encounters an @code{if} statement with an
7645 @code{else} clause, CSE follows the jump when the condition
7646 tested is false.
7647
7648 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7649
7650 @item -fcse-skip-blocks
7651 @opindex fcse-skip-blocks
7652 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
7653 follow jumps that conditionally skip over blocks. When CSE
7654 encounters a simple @code{if} statement with no else clause,
7655 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
7656 body of the @code{if}.
7657
7658 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7659
7660 @item -frerun-cse-after-loop
7661 @opindex frerun-cse-after-loop
7662 Re-run common subexpression elimination after loop optimizations are
7663 performed.
7664
7665 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7666
7667 @item -fgcse
7668 @opindex fgcse
7669 Perform a global common subexpression elimination pass.
7670 This pass also performs global constant and copy propagation.
7671
7672 @emph{Note:} When compiling a program using computed gotos, a GCC
7673 extension, you may get better run-time performance if you disable
7674 the global common subexpression elimination pass by adding
7675 @option{-fno-gcse} to the command line.
7676
7677 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7678
7679 @item -fgcse-lm
7680 @opindex fgcse-lm
7681 When @option{-fgcse-lm} is enabled, global common subexpression elimination
7682 attempts to move loads that are only killed by stores into themselves. This
7683 allows a loop containing a load/store sequence to be changed to a load outside
7684 the loop, and a copy/store within the loop.
7685
7686 Enabled by default when @option{-fgcse} is enabled.
7687
7688 @item -fgcse-sm
7689 @opindex fgcse-sm
7690 When @option{-fgcse-sm} is enabled, a store motion pass is run after
7691 global common subexpression elimination. This pass attempts to move
7692 stores out of loops. When used in conjunction with @option{-fgcse-lm},
7693 loops containing a load/store sequence can be changed to a load before
7694 the loop and a store after the loop.
7695
7696 Not enabled at any optimization level.
7697
7698 @item -fgcse-las
7699 @opindex fgcse-las
7700 When @option{-fgcse-las} is enabled, the global common subexpression
7701 elimination pass eliminates redundant loads that come after stores to the
7702 same memory location (both partial and full redundancies).
7703
7704 Not enabled at any optimization level.
7705
7706 @item -fgcse-after-reload
7707 @opindex fgcse-after-reload
7708 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
7709 pass is performed after reload. The purpose of this pass is to clean up
7710 redundant spilling.
7711
7712 @item -faggressive-loop-optimizations
7713 @opindex faggressive-loop-optimizations
7714 This option tells the loop optimizer to use language constraints to
7715 derive bounds for the number of iterations of a loop. This assumes that
7716 loop code does not invoke undefined behavior by for example causing signed
7717 integer overflows or out-of-bound array accesses. The bounds for the
7718 number of iterations of a loop are used to guide loop unrolling and peeling
7719 and loop exit test optimizations.
7720 This option is enabled by default.
7721
7722 @item -funconstrained-commons
7723 @opindex funconstrained-commons
7724 This option tells the compiler that variables declared in common blocks
7725 (e.g. Fortran) may later be overridden with longer trailing arrays. This
7726 prevents certain optimizations that depend on knowing the array bounds.
7727
7728 @item -fcrossjumping
7729 @opindex fcrossjumping
7730 Perform cross-jumping transformation.
7731 This transformation unifies equivalent code and saves code size. The
7732 resulting code may or may not perform better than without cross-jumping.
7733
7734 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7735
7736 @item -fauto-inc-dec
7737 @opindex fauto-inc-dec
7738 Combine increments or decrements of addresses with memory accesses.
7739 This pass is always skipped on architectures that do not have
7740 instructions to support this. Enabled by default at @option{-O} and
7741 higher on architectures that support this.
7742
7743 @item -fdce
7744 @opindex fdce
7745 Perform dead code elimination (DCE) on RTL@.
7746 Enabled by default at @option{-O} and higher.
7747
7748 @item -fdse
7749 @opindex fdse
7750 Perform dead store elimination (DSE) on RTL@.
7751 Enabled by default at @option{-O} and higher.
7752
7753 @item -fif-conversion
7754 @opindex fif-conversion
7755 Attempt to transform conditional jumps into branch-less equivalents. This
7756 includes use of conditional moves, min, max, set flags and abs instructions, and
7757 some tricks doable by standard arithmetics. The use of conditional execution
7758 on chips where it is available is controlled by @option{-fif-conversion2}.
7759
7760 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7761
7762 @item -fif-conversion2
7763 @opindex fif-conversion2
7764 Use conditional execution (where available) to transform conditional jumps into
7765 branch-less equivalents.
7766
7767 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7768
7769 @item -fdeclone-ctor-dtor
7770 @opindex fdeclone-ctor-dtor
7771 The C++ ABI requires multiple entry points for constructors and
7772 destructors: one for a base subobject, one for a complete object, and
7773 one for a virtual destructor that calls operator delete afterwards.
7774 For a hierarchy with virtual bases, the base and complete variants are
7775 clones, which means two copies of the function. With this option, the
7776 base and complete variants are changed to be thunks that call a common
7777 implementation.
7778
7779 Enabled by @option{-Os}.
7780
7781 @item -fdelete-null-pointer-checks
7782 @opindex fdelete-null-pointer-checks
7783 Assume that programs cannot safely dereference null pointers, and that
7784 no code or data element resides at address zero.
7785 This option enables simple constant
7786 folding optimizations at all optimization levels. In addition, other
7787 optimization passes in GCC use this flag to control global dataflow
7788 analyses that eliminate useless checks for null pointers; these assume
7789 that a memory access to address zero always results in a trap, so
7790 that if a pointer is checked after it has already been dereferenced,
7791 it cannot be null.
7792
7793 Note however that in some environments this assumption is not true.
7794 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
7795 for programs that depend on that behavior.
7796
7797 This option is enabled by default on most targets. On Nios II ELF, it
7798 defaults to off. On AVR and CR16, this option is completely disabled.
7799
7800 Passes that use the dataflow information
7801 are enabled independently at different optimization levels.
7802
7803 @item -fdevirtualize
7804 @opindex fdevirtualize
7805 Attempt to convert calls to virtual functions to direct calls. This
7806 is done both within a procedure and interprocedurally as part of
7807 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
7808 propagation (@option{-fipa-cp}).
7809 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7810
7811 @item -fdevirtualize-speculatively
7812 @opindex fdevirtualize-speculatively
7813 Attempt to convert calls to virtual functions to speculative direct calls.
7814 Based on the analysis of the type inheritance graph, determine for a given call
7815 the set of likely targets. If the set is small, preferably of size 1, change
7816 the call into a conditional deciding between direct and indirect calls. The
7817 speculative calls enable more optimizations, such as inlining. When they seem
7818 useless after further optimization, they are converted back into original form.
7819
7820 @item -fdevirtualize-at-ltrans
7821 @opindex fdevirtualize-at-ltrans
7822 Stream extra information needed for aggressive devirtualization when running
7823 the link-time optimizer in local transformation mode.
7824 This option enables more devirtualization but
7825 significantly increases the size of streamed data. For this reason it is
7826 disabled by default.
7827
7828 @item -fexpensive-optimizations
7829 @opindex fexpensive-optimizations
7830 Perform a number of minor optimizations that are relatively expensive.
7831
7832 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7833
7834 @item -free
7835 @opindex free
7836 Attempt to remove redundant extension instructions. This is especially
7837 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
7838 registers after writing to their lower 32-bit half.
7839
7840 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
7841 @option{-O3}, @option{-Os}.
7842
7843 @item -fno-lifetime-dse
7844 @opindex fno-lifetime-dse
7845 In C++ the value of an object is only affected by changes within its
7846 lifetime: when the constructor begins, the object has an indeterminate
7847 value, and any changes during the lifetime of the object are dead when
7848 the object is destroyed. Normally dead store elimination will take
7849 advantage of this; if your code relies on the value of the object
7850 storage persisting beyond the lifetime of the object, you can use this
7851 flag to disable this optimization. To preserve stores before the
7852 constructor starts (e.g. because your operator new clears the object
7853 storage) but still treat the object as dead after the destructor you,
7854 can use @option{-flifetime-dse=1}. The default behavior can be
7855 explicitly selected with @option{-flifetime-dse=2}.
7856 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
7857
7858 @item -flive-range-shrinkage
7859 @opindex flive-range-shrinkage
7860 Attempt to decrease register pressure through register live range
7861 shrinkage. This is helpful for fast processors with small or moderate
7862 size register sets.
7863
7864 @item -fira-algorithm=@var{algorithm}
7865 @opindex fira-algorithm
7866 Use the specified coloring algorithm for the integrated register
7867 allocator. The @var{algorithm} argument can be @samp{priority}, which
7868 specifies Chow's priority coloring, or @samp{CB}, which specifies
7869 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
7870 for all architectures, but for those targets that do support it, it is
7871 the default because it generates better code.
7872
7873 @item -fira-region=@var{region}
7874 @opindex fira-region
7875 Use specified regions for the integrated register allocator. The
7876 @var{region} argument should be one of the following:
7877
7878 @table @samp
7879
7880 @item all
7881 Use all loops as register allocation regions.
7882 This can give the best results for machines with a small and/or
7883 irregular register set.
7884
7885 @item mixed
7886 Use all loops except for loops with small register pressure
7887 as the regions. This value usually gives
7888 the best results in most cases and for most architectures,
7889 and is enabled by default when compiling with optimization for speed
7890 (@option{-O}, @option{-O2}, @dots{}).
7891
7892 @item one
7893 Use all functions as a single region.
7894 This typically results in the smallest code size, and is enabled by default for
7895 @option{-Os} or @option{-O0}.
7896
7897 @end table
7898
7899 @item -fira-hoist-pressure
7900 @opindex fira-hoist-pressure
7901 Use IRA to evaluate register pressure in the code hoisting pass for
7902 decisions to hoist expressions. This option usually results in smaller
7903 code, but it can slow the compiler down.
7904
7905 This option is enabled at level @option{-Os} for all targets.
7906
7907 @item -fira-loop-pressure
7908 @opindex fira-loop-pressure
7909 Use IRA to evaluate register pressure in loops for decisions to move
7910 loop invariants. This option usually results in generation
7911 of faster and smaller code on machines with large register files (>= 32
7912 registers), but it can slow the compiler down.
7913
7914 This option is enabled at level @option{-O3} for some targets.
7915
7916 @item -fno-ira-share-save-slots
7917 @opindex fno-ira-share-save-slots
7918 Disable sharing of stack slots used for saving call-used hard
7919 registers living through a call. Each hard register gets a
7920 separate stack slot, and as a result function stack frames are
7921 larger.
7922
7923 @item -fno-ira-share-spill-slots
7924 @opindex fno-ira-share-spill-slots
7925 Disable sharing of stack slots allocated for pseudo-registers. Each
7926 pseudo-register that does not get a hard register gets a separate
7927 stack slot, and as a result function stack frames are larger.
7928
7929 @item -flra-remat
7930 @opindex flra-remat
7931 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7932 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7933 values if it is profitable.
7934
7935 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7936
7937 @item -fdelayed-branch
7938 @opindex fdelayed-branch
7939 If supported for the target machine, attempt to reorder instructions
7940 to exploit instruction slots available after delayed branch
7941 instructions.
7942
7943 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7944
7945 @item -fschedule-insns
7946 @opindex fschedule-insns
7947 If supported for the target machine, attempt to reorder instructions to
7948 eliminate execution stalls due to required data being unavailable. This
7949 helps machines that have slow floating point or memory load instructions
7950 by allowing other instructions to be issued until the result of the load
7951 or floating-point instruction is required.
7952
7953 Enabled at levels @option{-O2}, @option{-O3}.
7954
7955 @item -fschedule-insns2
7956 @opindex fschedule-insns2
7957 Similar to @option{-fschedule-insns}, but requests an additional pass of
7958 instruction scheduling after register allocation has been done. This is
7959 especially useful on machines with a relatively small number of
7960 registers and where memory load instructions take more than one cycle.
7961
7962 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7963
7964 @item -fno-sched-interblock
7965 @opindex fno-sched-interblock
7966 Don't schedule instructions across basic blocks. This is normally
7967 enabled by default when scheduling before register allocation, i.e.@:
7968 with @option{-fschedule-insns} or at @option{-O2} or higher.
7969
7970 @item -fno-sched-spec
7971 @opindex fno-sched-spec
7972 Don't allow speculative motion of non-load instructions. This is normally
7973 enabled by default when scheduling before register allocation, i.e.@:
7974 with @option{-fschedule-insns} or at @option{-O2} or higher.
7975
7976 @item -fsched-pressure
7977 @opindex fsched-pressure
7978 Enable register pressure sensitive insn scheduling before register
7979 allocation. This only makes sense when scheduling before register
7980 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7981 @option{-O2} or higher. Usage of this option can improve the
7982 generated code and decrease its size by preventing register pressure
7983 increase above the number of available hard registers and subsequent
7984 spills in register allocation.
7985
7986 @item -fsched-spec-load
7987 @opindex fsched-spec-load
7988 Allow speculative motion of some load instructions. This only makes
7989 sense when scheduling before register allocation, i.e.@: with
7990 @option{-fschedule-insns} or at @option{-O2} or higher.
7991
7992 @item -fsched-spec-load-dangerous
7993 @opindex fsched-spec-load-dangerous
7994 Allow speculative motion of more load instructions. This only makes
7995 sense when scheduling before register allocation, i.e.@: with
7996 @option{-fschedule-insns} or at @option{-O2} or higher.
7997
7998 @item -fsched-stalled-insns
7999 @itemx -fsched-stalled-insns=@var{n}
8000 @opindex fsched-stalled-insns
8001 Define how many insns (if any) can be moved prematurely from the queue
8002 of stalled insns into the ready list during the second scheduling pass.
8003 @option{-fno-sched-stalled-insns} means that no insns are moved
8004 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8005 on how many queued insns can be moved prematurely.
8006 @option{-fsched-stalled-insns} without a value is equivalent to
8007 @option{-fsched-stalled-insns=1}.
8008
8009 @item -fsched-stalled-insns-dep
8010 @itemx -fsched-stalled-insns-dep=@var{n}
8011 @opindex fsched-stalled-insns-dep
8012 Define how many insn groups (cycles) are examined for a dependency
8013 on a stalled insn that is a candidate for premature removal from the queue
8014 of stalled insns. This has an effect only during the second scheduling pass,
8015 and only if @option{-fsched-stalled-insns} is used.
8016 @option{-fno-sched-stalled-insns-dep} is equivalent to
8017 @option{-fsched-stalled-insns-dep=0}.
8018 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8019 @option{-fsched-stalled-insns-dep=1}.
8020
8021 @item -fsched2-use-superblocks
8022 @opindex fsched2-use-superblocks
8023 When scheduling after register allocation, use superblock scheduling.
8024 This allows motion across basic block boundaries,
8025 resulting in faster schedules. This option is experimental, as not all machine
8026 descriptions used by GCC model the CPU closely enough to avoid unreliable
8027 results from the algorithm.
8028
8029 This only makes sense when scheduling after register allocation, i.e.@: with
8030 @option{-fschedule-insns2} or at @option{-O2} or higher.
8031
8032 @item -fsched-group-heuristic
8033 @opindex fsched-group-heuristic
8034 Enable the group heuristic in the scheduler. This heuristic favors
8035 the instruction that belongs to a schedule group. This is enabled
8036 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8037 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8038
8039 @item -fsched-critical-path-heuristic
8040 @opindex fsched-critical-path-heuristic
8041 Enable the critical-path heuristic in the scheduler. This heuristic favors
8042 instructions on the critical path. This is enabled by default when
8043 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8044 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8045
8046 @item -fsched-spec-insn-heuristic
8047 @opindex fsched-spec-insn-heuristic
8048 Enable the speculative instruction heuristic in the scheduler. This
8049 heuristic favors speculative instructions with greater dependency weakness.
8050 This is enabled by default when scheduling is enabled, i.e.@:
8051 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8052 or at @option{-O2} or higher.
8053
8054 @item -fsched-rank-heuristic
8055 @opindex fsched-rank-heuristic
8056 Enable the rank heuristic in the scheduler. This heuristic favors
8057 the instruction belonging to a basic block with greater size or frequency.
8058 This is enabled by default when scheduling is enabled, i.e.@:
8059 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8060 at @option{-O2} or higher.
8061
8062 @item -fsched-last-insn-heuristic
8063 @opindex fsched-last-insn-heuristic
8064 Enable the last-instruction heuristic in the scheduler. This heuristic
8065 favors the instruction that is less dependent on the last instruction
8066 scheduled. This is enabled by default when scheduling is enabled,
8067 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8068 at @option{-O2} or higher.
8069
8070 @item -fsched-dep-count-heuristic
8071 @opindex fsched-dep-count-heuristic
8072 Enable the dependent-count heuristic in the scheduler. This heuristic
8073 favors the instruction that has more instructions depending on it.
8074 This is enabled by default when scheduling is enabled, i.e.@:
8075 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8076 at @option{-O2} or higher.
8077
8078 @item -freschedule-modulo-scheduled-loops
8079 @opindex freschedule-modulo-scheduled-loops
8080 Modulo scheduling is performed before traditional scheduling. If a loop
8081 is modulo scheduled, later scheduling passes may change its schedule.
8082 Use this option to control that behavior.
8083
8084 @item -fselective-scheduling
8085 @opindex fselective-scheduling
8086 Schedule instructions using selective scheduling algorithm. Selective
8087 scheduling runs instead of the first scheduler pass.
8088
8089 @item -fselective-scheduling2
8090 @opindex fselective-scheduling2
8091 Schedule instructions using selective scheduling algorithm. Selective
8092 scheduling runs instead of the second scheduler pass.
8093
8094 @item -fsel-sched-pipelining
8095 @opindex fsel-sched-pipelining
8096 Enable software pipelining of innermost loops during selective scheduling.
8097 This option has no effect unless one of @option{-fselective-scheduling} or
8098 @option{-fselective-scheduling2} is turned on.
8099
8100 @item -fsel-sched-pipelining-outer-loops
8101 @opindex fsel-sched-pipelining-outer-loops
8102 When pipelining loops during selective scheduling, also pipeline outer loops.
8103 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8104
8105 @item -fsemantic-interposition
8106 @opindex fsemantic-interposition
8107 Some object formats, like ELF, allow interposing of symbols by the
8108 dynamic linker.
8109 This means that for symbols exported from the DSO, the compiler cannot perform
8110 interprocedural propagation, inlining and other optimizations in anticipation
8111 that the function or variable in question may change. While this feature is
8112 useful, for example, to rewrite memory allocation functions by a debugging
8113 implementation, it is expensive in the terms of code quality.
8114 With @option{-fno-semantic-interposition} the compiler assumes that
8115 if interposition happens for functions the overwriting function will have
8116 precisely the same semantics (and side effects).
8117 Similarly if interposition happens
8118 for variables, the constructor of the variable will be the same. The flag
8119 has no effect for functions explicitly declared inline
8120 (where it is never allowed for interposition to change semantics)
8121 and for symbols explicitly declared weak.
8122
8123 @item -fshrink-wrap
8124 @opindex fshrink-wrap
8125 Emit function prologues only before parts of the function that need it,
8126 rather than at the top of the function. This flag is enabled by default at
8127 @option{-O} and higher.
8128
8129 @item -fshrink-wrap-separate
8130 @opindex fshrink-wrap-separate
8131 Shrink-wrap separate parts of the prologue and epilogue separately, so that
8132 those parts are only executed when needed.
8133 This option is on by default, but has no effect unless @option{-fshrink-wrap}
8134 is also turned on and the target supports this.
8135
8136 @item -fcaller-saves
8137 @opindex fcaller-saves
8138 Enable allocation of values to registers that are clobbered by
8139 function calls, by emitting extra instructions to save and restore the
8140 registers around such calls. Such allocation is done only when it
8141 seems to result in better code.
8142
8143 This option is always enabled by default on certain machines, usually
8144 those which have no call-preserved registers to use instead.
8145
8146 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8147
8148 @item -fcombine-stack-adjustments
8149 @opindex fcombine-stack-adjustments
8150 Tracks stack adjustments (pushes and pops) and stack memory references
8151 and then tries to find ways to combine them.
8152
8153 Enabled by default at @option{-O1} and higher.
8154
8155 @item -fipa-ra
8156 @opindex fipa-ra
8157 Use caller save registers for allocation if those registers are not used by
8158 any called function. In that case it is not necessary to save and restore
8159 them around calls. This is only possible if called functions are part of
8160 same compilation unit as current function and they are compiled before it.
8161
8162 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
8163 is disabled if generated code will be instrumented for profiling
8164 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
8165 exactly (this happens on targets that do not expose prologues
8166 and epilogues in RTL).
8167
8168 @item -fconserve-stack
8169 @opindex fconserve-stack
8170 Attempt to minimize stack usage. The compiler attempts to use less
8171 stack space, even if that makes the program slower. This option
8172 implies setting the @option{large-stack-frame} parameter to 100
8173 and the @option{large-stack-frame-growth} parameter to 400.
8174
8175 @item -ftree-reassoc
8176 @opindex ftree-reassoc
8177 Perform reassociation on trees. This flag is enabled by default
8178 at @option{-O} and higher.
8179
8180 @item -fcode-hoisting
8181 @opindex fcode-hoisting
8182 Perform code hoisting. Code hoisting tries to move the
8183 evaluation of expressions executed on all paths to the function exit
8184 as early as possible. This is especially useful as a code size
8185 optimization, but it often helps for code speed as well.
8186 This flag is enabled by default at @option{-O2} and higher.
8187
8188 @item -ftree-pre
8189 @opindex ftree-pre
8190 Perform partial redundancy elimination (PRE) on trees. This flag is
8191 enabled by default at @option{-O2} and @option{-O3}.
8192
8193 @item -ftree-partial-pre
8194 @opindex ftree-partial-pre
8195 Make partial redundancy elimination (PRE) more aggressive. This flag is
8196 enabled by default at @option{-O3}.
8197
8198 @item -ftree-forwprop
8199 @opindex ftree-forwprop
8200 Perform forward propagation on trees. This flag is enabled by default
8201 at @option{-O} and higher.
8202
8203 @item -ftree-fre
8204 @opindex ftree-fre
8205 Perform full redundancy elimination (FRE) on trees. The difference
8206 between FRE and PRE is that FRE only considers expressions
8207 that are computed on all paths leading to the redundant computation.
8208 This analysis is faster than PRE, though it exposes fewer redundancies.
8209 This flag is enabled by default at @option{-O} and higher.
8210
8211 @item -ftree-phiprop
8212 @opindex ftree-phiprop
8213 Perform hoisting of loads from conditional pointers on trees. This
8214 pass is enabled by default at @option{-O} and higher.
8215
8216 @item -fhoist-adjacent-loads
8217 @opindex fhoist-adjacent-loads
8218 Speculatively hoist loads from both branches of an if-then-else if the
8219 loads are from adjacent locations in the same structure and the target
8220 architecture has a conditional move instruction. This flag is enabled
8221 by default at @option{-O2} and higher.
8222
8223 @item -ftree-copy-prop
8224 @opindex ftree-copy-prop
8225 Perform copy propagation on trees. This pass eliminates unnecessary
8226 copy operations. This flag is enabled by default at @option{-O} and
8227 higher.
8228
8229 @item -fipa-pure-const
8230 @opindex fipa-pure-const
8231 Discover which functions are pure or constant.
8232 Enabled by default at @option{-O} and higher.
8233
8234 @item -fipa-reference
8235 @opindex fipa-reference
8236 Discover which static variables do not escape the
8237 compilation unit.
8238 Enabled by default at @option{-O} and higher.
8239
8240 @item -fipa-pta
8241 @opindex fipa-pta
8242 Perform interprocedural pointer analysis and interprocedural modification
8243 and reference analysis. This option can cause excessive memory and
8244 compile-time usage on large compilation units. It is not enabled by
8245 default at any optimization level.
8246
8247 @item -fipa-profile
8248 @opindex fipa-profile
8249 Perform interprocedural profile propagation. The functions called only from
8250 cold functions are marked as cold. Also functions executed once (such as
8251 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8252 functions and loop less parts of functions executed once are then optimized for
8253 size.
8254 Enabled by default at @option{-O} and higher.
8255
8256 @item -fipa-cp
8257 @opindex fipa-cp
8258 Perform interprocedural constant propagation.
8259 This optimization analyzes the program to determine when values passed
8260 to functions are constants and then optimizes accordingly.
8261 This optimization can substantially increase performance
8262 if the application has constants passed to functions.
8263 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8264
8265 @item -fipa-cp-clone
8266 @opindex fipa-cp-clone
8267 Perform function cloning to make interprocedural constant propagation stronger.
8268 When enabled, interprocedural constant propagation performs function cloning
8269 when externally visible function can be called with constant arguments.
8270 Because this optimization can create multiple copies of functions,
8271 it may significantly increase code size
8272 (see @option{--param ipcp-unit-growth=@var{value}}).
8273 This flag is enabled by default at @option{-O3}.
8274
8275 @item -fipa-bit-cp
8276 @opindex -fipa-bit-cp
8277 When enabled, perform interprocedural bitwise constant
8278 propagation. This flag is enabled by default at @option{-O2}. It
8279 requires that @option{-fipa-cp} is enabled.
8280
8281 @item -fipa-vrp
8282 @opindex -fipa-vrp
8283 When enabled, perform interprocedural propagation of value
8284 ranges. This flag is enabled by default at @option{-O2}. It requires
8285 that @option{-fipa-cp} is enabled.
8286
8287 @item -fipa-icf
8288 @opindex fipa-icf
8289 Perform Identical Code Folding for functions and read-only variables.
8290 The optimization reduces code size and may disturb unwind stacks by replacing
8291 a function by equivalent one with a different name. The optimization works
8292 more effectively with link-time optimization enabled.
8293
8294 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8295 works on different levels and thus the optimizations are not same - there are
8296 equivalences that are found only by GCC and equivalences found only by Gold.
8297
8298 This flag is enabled by default at @option{-O2} and @option{-Os}.
8299
8300 @item -fisolate-erroneous-paths-dereference
8301 @opindex fisolate-erroneous-paths-dereference
8302 Detect paths that trigger erroneous or undefined behavior due to
8303 dereferencing a null pointer. Isolate those paths from the main control
8304 flow and turn the statement with erroneous or undefined behavior into a trap.
8305 This flag is enabled by default at @option{-O2} and higher and depends on
8306 @option{-fdelete-null-pointer-checks} also being enabled.
8307
8308 @item -fisolate-erroneous-paths-attribute
8309 @opindex fisolate-erroneous-paths-attribute
8310 Detect paths that trigger erroneous or undefined behavior due a null value
8311 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
8312 attribute. Isolate those paths from the main control flow and turn the
8313 statement with erroneous or undefined behavior into a trap. This is not
8314 currently enabled, but may be enabled by @option{-O2} in the future.
8315
8316 @item -ftree-sink
8317 @opindex ftree-sink
8318 Perform forward store motion on trees. This flag is
8319 enabled by default at @option{-O} and higher.
8320
8321 @item -ftree-bit-ccp
8322 @opindex ftree-bit-ccp
8323 Perform sparse conditional bit constant propagation on trees and propagate
8324 pointer alignment information.
8325 This pass only operates on local scalar variables and is enabled by default
8326 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8327
8328 @item -ftree-ccp
8329 @opindex ftree-ccp
8330 Perform sparse conditional constant propagation (CCP) on trees. This
8331 pass only operates on local scalar variables and is enabled by default
8332 at @option{-O} and higher.
8333
8334 @item -fssa-backprop
8335 @opindex fssa-backprop
8336 Propagate information about uses of a value up the definition chain
8337 in order to simplify the definitions. For example, this pass strips
8338 sign operations if the sign of a value never matters. The flag is
8339 enabled by default at @option{-O} and higher.
8340
8341 @item -fssa-phiopt
8342 @opindex fssa-phiopt
8343 Perform pattern matching on SSA PHI nodes to optimize conditional
8344 code. This pass is enabled by default at @option{-O} and higher.
8345
8346 @item -ftree-switch-conversion
8347 @opindex ftree-switch-conversion
8348 Perform conversion of simple initializations in a switch to
8349 initializations from a scalar array. This flag is enabled by default
8350 at @option{-O2} and higher.
8351
8352 @item -ftree-tail-merge
8353 @opindex ftree-tail-merge
8354 Look for identical code sequences. When found, replace one with a jump to the
8355 other. This optimization is known as tail merging or cross jumping. This flag
8356 is enabled by default at @option{-O2} and higher. The compilation time
8357 in this pass can
8358 be limited using @option{max-tail-merge-comparisons} parameter and
8359 @option{max-tail-merge-iterations} parameter.
8360
8361 @item -ftree-dce
8362 @opindex ftree-dce
8363 Perform dead code elimination (DCE) on trees. This flag is enabled by
8364 default at @option{-O} and higher.
8365
8366 @item -ftree-builtin-call-dce
8367 @opindex ftree-builtin-call-dce
8368 Perform conditional dead code elimination (DCE) for calls to built-in functions
8369 that may set @code{errno} but are otherwise side-effect free. This flag is
8370 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8371 specified.
8372
8373 @item -ftree-dominator-opts
8374 @opindex ftree-dominator-opts
8375 Perform a variety of simple scalar cleanups (constant/copy
8376 propagation, redundancy elimination, range propagation and expression
8377 simplification) based on a dominator tree traversal. This also
8378 performs jump threading (to reduce jumps to jumps). This flag is
8379 enabled by default at @option{-O} and higher.
8380
8381 @item -ftree-dse
8382 @opindex ftree-dse
8383 Perform dead store elimination (DSE) on trees. A dead store is a store into
8384 a memory location that is later overwritten by another store without
8385 any intervening loads. In this case the earlier store can be deleted. This
8386 flag is enabled by default at @option{-O} and higher.
8387
8388 @item -ftree-ch
8389 @opindex ftree-ch
8390 Perform loop header copying on trees. This is beneficial since it increases
8391 effectiveness of code motion optimizations. It also saves one jump. This flag
8392 is enabled by default at @option{-O} and higher. It is not enabled
8393 for @option{-Os}, since it usually increases code size.
8394
8395 @item -ftree-loop-optimize
8396 @opindex ftree-loop-optimize
8397 Perform loop optimizations on trees. This flag is enabled by default
8398 at @option{-O} and higher.
8399
8400 @item -ftree-loop-linear
8401 @itemx -floop-interchange
8402 @itemx -floop-strip-mine
8403 @itemx -floop-block
8404 @itemx -floop-unroll-and-jam
8405 @opindex ftree-loop-linear
8406 @opindex floop-interchange
8407 @opindex floop-strip-mine
8408 @opindex floop-block
8409 @opindex floop-unroll-and-jam
8410 Perform loop nest optimizations. Same as
8411 @option{-floop-nest-optimize}. To use this code transformation, GCC has
8412 to be configured with @option{--with-isl} to enable the Graphite loop
8413 transformation infrastructure.
8414
8415 @item -fgraphite-identity
8416 @opindex fgraphite-identity
8417 Enable the identity transformation for graphite. For every SCoP we generate
8418 the polyhedral representation and transform it back to gimple. Using
8419 @option{-fgraphite-identity} we can check the costs or benefits of the
8420 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8421 are also performed by the code generator isl, like index splitting and
8422 dead code elimination in loops.
8423
8424 @item -floop-nest-optimize
8425 @opindex floop-nest-optimize
8426 Enable the isl based loop nest optimizer. This is a generic loop nest
8427 optimizer based on the Pluto optimization algorithms. It calculates a loop
8428 structure optimized for data-locality and parallelism. This option
8429 is experimental.
8430
8431 @item -floop-parallelize-all
8432 @opindex floop-parallelize-all
8433 Use the Graphite data dependence analysis to identify loops that can
8434 be parallelized. Parallelize all the loops that can be analyzed to
8435 not contain loop carried dependences without checking that it is
8436 profitable to parallelize the loops.
8437
8438 @item -ftree-coalesce-vars
8439 @opindex ftree-coalesce-vars
8440 While transforming the program out of the SSA representation, attempt to
8441 reduce copying by coalescing versions of different user-defined
8442 variables, instead of just compiler temporaries. This may severely
8443 limit the ability to debug an optimized program compiled with
8444 @option{-fno-var-tracking-assignments}. In the negated form, this flag
8445 prevents SSA coalescing of user variables. This option is enabled by
8446 default if optimization is enabled, and it does very little otherwise.
8447
8448 @item -ftree-loop-if-convert
8449 @opindex ftree-loop-if-convert
8450 Attempt to transform conditional jumps in the innermost loops to
8451 branch-less equivalents. The intent is to remove control-flow from
8452 the innermost loops in order to improve the ability of the
8453 vectorization pass to handle these loops. This is enabled by default
8454 if vectorization is enabled.
8455
8456 @item -ftree-loop-distribution
8457 @opindex ftree-loop-distribution
8458 Perform loop distribution. This flag can improve cache performance on
8459 big loop bodies and allow further loop optimizations, like
8460 parallelization or vectorization, to take place. For example, the loop
8461 @smallexample
8462 DO I = 1, N
8463 A(I) = B(I) + C
8464 D(I) = E(I) * F
8465 ENDDO
8466 @end smallexample
8467 is transformed to
8468 @smallexample
8469 DO I = 1, N
8470 A(I) = B(I) + C
8471 ENDDO
8472 DO I = 1, N
8473 D(I) = E(I) * F
8474 ENDDO
8475 @end smallexample
8476
8477 @item -ftree-loop-distribute-patterns
8478 @opindex ftree-loop-distribute-patterns
8479 Perform loop distribution of patterns that can be code generated with
8480 calls to a library. This flag is enabled by default at @option{-O3}.
8481
8482 This pass distributes the initialization loops and generates a call to
8483 memset zero. For example, the loop
8484 @smallexample
8485 DO I = 1, N
8486 A(I) = 0
8487 B(I) = A(I) + I
8488 ENDDO
8489 @end smallexample
8490 is transformed to
8491 @smallexample
8492 DO I = 1, N
8493 A(I) = 0
8494 ENDDO
8495 DO I = 1, N
8496 B(I) = A(I) + I
8497 ENDDO
8498 @end smallexample
8499 and the initialization loop is transformed into a call to memset zero.
8500
8501 @item -ftree-loop-im
8502 @opindex ftree-loop-im
8503 Perform loop invariant motion on trees. This pass moves only invariants that
8504 are hard to handle at RTL level (function calls, operations that expand to
8505 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8506 operands of conditions that are invariant out of the loop, so that we can use
8507 just trivial invariantness analysis in loop unswitching. The pass also includes
8508 store motion.
8509
8510 @item -ftree-loop-ivcanon
8511 @opindex ftree-loop-ivcanon
8512 Create a canonical counter for number of iterations in loops for which
8513 determining number of iterations requires complicated analysis. Later
8514 optimizations then may determine the number easily. Useful especially
8515 in connection with unrolling.
8516
8517 @item -fivopts
8518 @opindex fivopts
8519 Perform induction variable optimizations (strength reduction, induction
8520 variable merging and induction variable elimination) on trees.
8521
8522 @item -ftree-parallelize-loops=n
8523 @opindex ftree-parallelize-loops
8524 Parallelize loops, i.e., split their iteration space to run in n threads.
8525 This is only possible for loops whose iterations are independent
8526 and can be arbitrarily reordered. The optimization is only
8527 profitable on multiprocessor machines, for loops that are CPU-intensive,
8528 rather than constrained e.g.@: by memory bandwidth. This option
8529 implies @option{-pthread}, and thus is only supported on targets
8530 that have support for @option{-pthread}.
8531
8532 @item -ftree-pta
8533 @opindex ftree-pta
8534 Perform function-local points-to analysis on trees. This flag is
8535 enabled by default at @option{-O} and higher.
8536
8537 @item -ftree-sra
8538 @opindex ftree-sra
8539 Perform scalar replacement of aggregates. This pass replaces structure
8540 references with scalars to prevent committing structures to memory too
8541 early. This flag is enabled by default at @option{-O} and higher.
8542
8543 @item -fstore-merging
8544 @opindex fstore-merging
8545 Perform merging of narrow stores to consecutive memory addresses. This pass
8546 merges contiguous stores of immediate values narrower than a word into fewer
8547 wider stores to reduce the number of instructions. This is enabled by default
8548 at @option{-O2} and higher as well as @option{-Os}.
8549
8550 @item -ftree-ter
8551 @opindex ftree-ter
8552 Perform temporary expression replacement during the SSA->normal phase. Single
8553 use/single def temporaries are replaced at their use location with their
8554 defining expression. This results in non-GIMPLE code, but gives the expanders
8555 much more complex trees to work on resulting in better RTL generation. This is
8556 enabled by default at @option{-O} and higher.
8557
8558 @item -ftree-slsr
8559 @opindex ftree-slsr
8560 Perform straight-line strength reduction on trees. This recognizes related
8561 expressions involving multiplications and replaces them by less expensive
8562 calculations when possible. This is enabled by default at @option{-O} and
8563 higher.
8564
8565 @item -ftree-vectorize
8566 @opindex ftree-vectorize
8567 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8568 and @option{-ftree-slp-vectorize} if not explicitly specified.
8569
8570 @item -ftree-loop-vectorize
8571 @opindex ftree-loop-vectorize
8572 Perform loop vectorization on trees. This flag is enabled by default at
8573 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8574
8575 @item -ftree-slp-vectorize
8576 @opindex ftree-slp-vectorize
8577 Perform basic block vectorization on trees. This flag is enabled by default at
8578 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8579
8580 @item -fvect-cost-model=@var{model}
8581 @opindex fvect-cost-model
8582 Alter the cost model used for vectorization. The @var{model} argument
8583 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
8584 With the @samp{unlimited} model the vectorized code-path is assumed
8585 to be profitable while with the @samp{dynamic} model a runtime check
8586 guards the vectorized code-path to enable it only for iteration
8587 counts that will likely execute faster than when executing the original
8588 scalar loop. The @samp{cheap} model disables vectorization of
8589 loops where doing so would be cost prohibitive for example due to
8590 required runtime checks for data dependence or alignment but otherwise
8591 is equal to the @samp{dynamic} model.
8592 The default cost model depends on other optimization flags and is
8593 either @samp{dynamic} or @samp{cheap}.
8594
8595 @item -fsimd-cost-model=@var{model}
8596 @opindex fsimd-cost-model
8597 Alter the cost model used for vectorization of loops marked with the OpenMP
8598 or Cilk Plus simd directive. The @var{model} argument should be one of
8599 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
8600 have the same meaning as described in @option{-fvect-cost-model} and by
8601 default a cost model defined with @option{-fvect-cost-model} is used.
8602
8603 @item -ftree-vrp
8604 @opindex ftree-vrp
8605 Perform Value Range Propagation on trees. This is similar to the
8606 constant propagation pass, but instead of values, ranges of values are
8607 propagated. This allows the optimizers to remove unnecessary range
8608 checks like array bound checks and null pointer checks. This is
8609 enabled by default at @option{-O2} and higher. Null pointer check
8610 elimination is only done if @option{-fdelete-null-pointer-checks} is
8611 enabled.
8612
8613 @item -fsplit-paths
8614 @opindex fsplit-paths
8615 Split paths leading to loop backedges. This can improve dead code
8616 elimination and common subexpression elimination. This is enabled by
8617 default at @option{-O2} and above.
8618
8619 @item -fsplit-ivs-in-unroller
8620 @opindex fsplit-ivs-in-unroller
8621 Enables expression of values of induction variables in later iterations
8622 of the unrolled loop using the value in the first iteration. This breaks
8623 long dependency chains, thus improving efficiency of the scheduling passes.
8624
8625 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8626 same effect. However, that is not reliable in cases where the loop body
8627 is more complicated than a single basic block. It also does not work at all
8628 on some architectures due to restrictions in the CSE pass.
8629
8630 This optimization is enabled by default.
8631
8632 @item -fvariable-expansion-in-unroller
8633 @opindex fvariable-expansion-in-unroller
8634 With this option, the compiler creates multiple copies of some
8635 local variables when unrolling a loop, which can result in superior code.
8636
8637 @item -fpartial-inlining
8638 @opindex fpartial-inlining
8639 Inline parts of functions. This option has any effect only
8640 when inlining itself is turned on by the @option{-finline-functions}
8641 or @option{-finline-small-functions} options.
8642
8643 Enabled at level @option{-O2}.
8644
8645 @item -fpredictive-commoning
8646 @opindex fpredictive-commoning
8647 Perform predictive commoning optimization, i.e., reusing computations
8648 (especially memory loads and stores) performed in previous
8649 iterations of loops.
8650
8651 This option is enabled at level @option{-O3}.
8652
8653 @item -fprefetch-loop-arrays
8654 @opindex fprefetch-loop-arrays
8655 If supported by the target machine, generate instructions to prefetch
8656 memory to improve the performance of loops that access large arrays.
8657
8658 This option may generate better or worse code; results are highly
8659 dependent on the structure of loops within the source code.
8660
8661 Disabled at level @option{-Os}.
8662
8663 @item -fno-printf-return-value
8664 @opindex fno-printf-return-value
8665 Do not substitute constants for known return value of formatted output
8666 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
8667 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
8668 transformation allows GCC to optimize or even eliminate branches based
8669 on the known return value of these functions called with arguments that
8670 are either constant, or whose values are known to be in a range that
8671 makes determining the exact return value possible. For example, when
8672 @option{-fprintf-return-value} is in effect, both the branch and the
8673 body of the @code{if} statement (but not the call to @code{snprint})
8674 can be optimized away when @code{i} is a 32-bit or smaller integer
8675 because the return value is guaranteed to be at most 8.
8676
8677 @smallexample
8678 char buf[9];
8679 if (snprintf (buf, "%08x", i) >= sizeof buf)
8680 @dots{}
8681 @end smallexample
8682
8683 The @option{-fprintf-return-value} option relies on other optimizations
8684 and yields best results with @option{-O2}. It works in tandem with the
8685 @option{-Wformat-overflow} and @option{-Wformat-truncation} options.
8686 The @option{-fprintf-return-value} option is enabled by default.
8687
8688 @item -fno-peephole
8689 @itemx -fno-peephole2
8690 @opindex fno-peephole
8691 @opindex fno-peephole2
8692 Disable any machine-specific peephole optimizations. The difference
8693 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
8694 are implemented in the compiler; some targets use one, some use the
8695 other, a few use both.
8696
8697 @option{-fpeephole} is enabled by default.
8698 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8699
8700 @item -fno-guess-branch-probability
8701 @opindex fno-guess-branch-probability
8702 Do not guess branch probabilities using heuristics.
8703
8704 GCC uses heuristics to guess branch probabilities if they are
8705 not provided by profiling feedback (@option{-fprofile-arcs}). These
8706 heuristics are based on the control flow graph. If some branch probabilities
8707 are specified by @code{__builtin_expect}, then the heuristics are
8708 used to guess branch probabilities for the rest of the control flow graph,
8709 taking the @code{__builtin_expect} info into account. The interactions
8710 between the heuristics and @code{__builtin_expect} can be complex, and in
8711 some cases, it may be useful to disable the heuristics so that the effects
8712 of @code{__builtin_expect} are easier to understand.
8713
8714 The default is @option{-fguess-branch-probability} at levels
8715 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8716
8717 @item -freorder-blocks
8718 @opindex freorder-blocks
8719 Reorder basic blocks in the compiled function in order to reduce number of
8720 taken branches and improve code locality.
8721
8722 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8723
8724 @item -freorder-blocks-algorithm=@var{algorithm}
8725 @opindex freorder-blocks-algorithm
8726 Use the specified algorithm for basic block reordering. The
8727 @var{algorithm} argument can be @samp{simple}, which does not increase
8728 code size (except sometimes due to secondary effects like alignment),
8729 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
8730 put all often executed code together, minimizing the number of branches
8731 executed by making extra copies of code.
8732
8733 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
8734 @samp{stc} at levels @option{-O2}, @option{-O3}.
8735
8736 @item -freorder-blocks-and-partition
8737 @opindex freorder-blocks-and-partition
8738 In addition to reordering basic blocks in the compiled function, in order
8739 to reduce number of taken branches, partitions hot and cold basic blocks
8740 into separate sections of the assembly and @file{.o} files, to improve
8741 paging and cache locality performance.
8742
8743 This optimization is automatically turned off in the presence of
8744 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
8745 section attribute and on any architecture that does not support named
8746 sections. When @option{-fsplit-stack} is used this option is not
8747 enabled by default (to avoid linker errors), but may be enabled
8748 explicitly (if using a working linker).
8749
8750 Enabled for x86 at levels @option{-O2}, @option{-O3}.
8751
8752 @item -freorder-functions
8753 @opindex freorder-functions
8754 Reorder functions in the object file in order to
8755 improve code locality. This is implemented by using special
8756 subsections @code{.text.hot} for most frequently executed functions and
8757 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
8758 the linker so object file format must support named sections and linker must
8759 place them in a reasonable way.
8760
8761 Also profile feedback must be available to make this option effective. See
8762 @option{-fprofile-arcs} for details.
8763
8764 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8765
8766 @item -fstrict-aliasing
8767 @opindex fstrict-aliasing
8768 Allow the compiler to assume the strictest aliasing rules applicable to
8769 the language being compiled. For C (and C++), this activates
8770 optimizations based on the type of expressions. In particular, an
8771 object of one type is assumed never to reside at the same address as an
8772 object of a different type, unless the types are almost the same. For
8773 example, an @code{unsigned int} can alias an @code{int}, but not a
8774 @code{void*} or a @code{double}. A character type may alias any other
8775 type.
8776
8777 @anchor{Type-punning}Pay special attention to code like this:
8778 @smallexample
8779 union a_union @{
8780 int i;
8781 double d;
8782 @};
8783
8784 int f() @{
8785 union a_union t;
8786 t.d = 3.0;
8787 return t.i;
8788 @}
8789 @end smallexample
8790 The practice of reading from a different union member than the one most
8791 recently written to (called ``type-punning'') is common. Even with
8792 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
8793 is accessed through the union type. So, the code above works as
8794 expected. @xref{Structures unions enumerations and bit-fields
8795 implementation}. However, this code might not:
8796 @smallexample
8797 int f() @{
8798 union a_union t;
8799 int* ip;
8800 t.d = 3.0;
8801 ip = &t.i;
8802 return *ip;
8803 @}
8804 @end smallexample
8805
8806 Similarly, access by taking the address, casting the resulting pointer
8807 and dereferencing the result has undefined behavior, even if the cast
8808 uses a union type, e.g.:
8809 @smallexample
8810 int f() @{
8811 double d = 3.0;
8812 return ((union a_union *) &d)->i;
8813 @}
8814 @end smallexample
8815
8816 The @option{-fstrict-aliasing} option is enabled at levels
8817 @option{-O2}, @option{-O3}, @option{-Os}.
8818
8819 @item -falign-functions
8820 @itemx -falign-functions=@var{n}
8821 @opindex falign-functions
8822 Align the start of functions to the next power-of-two greater than
8823 @var{n}, skipping up to @var{n} bytes. For instance,
8824 @option{-falign-functions=32} aligns functions to the next 32-byte
8825 boundary, but @option{-falign-functions=24} aligns to the next
8826 32-byte boundary only if this can be done by skipping 23 bytes or less.
8827
8828 @option{-fno-align-functions} and @option{-falign-functions=1} are
8829 equivalent and mean that functions are not aligned.
8830
8831 Some assemblers only support this flag when @var{n} is a power of two;
8832 in that case, it is rounded up.
8833
8834 If @var{n} is not specified or is zero, use a machine-dependent default.
8835
8836 Enabled at levels @option{-O2}, @option{-O3}.
8837
8838 @item -flimit-function-alignment
8839 If this option is enabled, the compiler tries to avoid unnecessarily
8840 overaligning functions. It attempts to instruct the assembler to align
8841 by the amount specified by @option{-falign-functions}, but not to
8842 skip more bytes than the size of the function.
8843
8844 @item -falign-labels
8845 @itemx -falign-labels=@var{n}
8846 @opindex falign-labels
8847 Align all branch targets to a power-of-two boundary, skipping up to
8848 @var{n} bytes like @option{-falign-functions}. This option can easily
8849 make code slower, because it must insert dummy operations for when the
8850 branch target is reached in the usual flow of the code.
8851
8852 @option{-fno-align-labels} and @option{-falign-labels=1} are
8853 equivalent and mean that labels are not aligned.
8854
8855 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
8856 are greater than this value, then their values are used instead.
8857
8858 If @var{n} is not specified or is zero, use a machine-dependent default
8859 which is very likely to be @samp{1}, meaning no alignment.
8860
8861 Enabled at levels @option{-O2}, @option{-O3}.
8862
8863 @item -falign-loops
8864 @itemx -falign-loops=@var{n}
8865 @opindex falign-loops
8866 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
8867 like @option{-falign-functions}. If the loops are
8868 executed many times, this makes up for any execution of the dummy
8869 operations.
8870
8871 @option{-fno-align-loops} and @option{-falign-loops=1} are
8872 equivalent and mean that loops are not aligned.
8873
8874 If @var{n} is not specified or is zero, use a machine-dependent default.
8875
8876 Enabled at levels @option{-O2}, @option{-O3}.
8877
8878 @item -falign-jumps
8879 @itemx -falign-jumps=@var{n}
8880 @opindex falign-jumps
8881 Align branch targets to a power-of-two boundary, for branch targets
8882 where the targets can only be reached by jumping, skipping up to @var{n}
8883 bytes like @option{-falign-functions}. In this case, no dummy operations
8884 need be executed.
8885
8886 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
8887 equivalent and mean that loops are not aligned.
8888
8889 If @var{n} is not specified or is zero, use a machine-dependent default.
8890
8891 Enabled at levels @option{-O2}, @option{-O3}.
8892
8893 @item -funit-at-a-time
8894 @opindex funit-at-a-time
8895 This option is left for compatibility reasons. @option{-funit-at-a-time}
8896 has no effect, while @option{-fno-unit-at-a-time} implies
8897 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8898
8899 Enabled by default.
8900
8901 @item -fno-toplevel-reorder
8902 @opindex fno-toplevel-reorder
8903 Do not reorder top-level functions, variables, and @code{asm}
8904 statements. Output them in the same order that they appear in the
8905 input file. When this option is used, unreferenced static variables
8906 are not removed. This option is intended to support existing code
8907 that relies on a particular ordering. For new code, it is better to
8908 use attributes when possible.
8909
8910 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8911 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8912 targets.
8913
8914 @item -fweb
8915 @opindex fweb
8916 Constructs webs as commonly used for register allocation purposes and assign
8917 each web individual pseudo register. This allows the register allocation pass
8918 to operate on pseudos directly, but also strengthens several other optimization
8919 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8920 however, make debugging impossible, since variables no longer stay in a
8921 ``home register''.
8922
8923 Enabled by default with @option{-funroll-loops}.
8924
8925 @item -fwhole-program
8926 @opindex fwhole-program
8927 Assume that the current compilation unit represents the whole program being
8928 compiled. All public functions and variables with the exception of @code{main}
8929 and those merged by attribute @code{externally_visible} become static functions
8930 and in effect are optimized more aggressively by interprocedural optimizers.
8931
8932 This option should not be used in combination with @option{-flto}.
8933 Instead relying on a linker plugin should provide safer and more precise
8934 information.
8935
8936 @item -flto[=@var{n}]
8937 @opindex flto
8938 This option runs the standard link-time optimizer. When invoked
8939 with source code, it generates GIMPLE (one of GCC's internal
8940 representations) and writes it to special ELF sections in the object
8941 file. When the object files are linked together, all the function
8942 bodies are read from these ELF sections and instantiated as if they
8943 had been part of the same translation unit.
8944
8945 To use the link-time optimizer, @option{-flto} and optimization
8946 options should be specified at compile time and during the final link.
8947 It is recommended that you compile all the files participating in the
8948 same link with the same options and also specify those options at
8949 link time.
8950 For example:
8951
8952 @smallexample
8953 gcc -c -O2 -flto foo.c
8954 gcc -c -O2 -flto bar.c
8955 gcc -o myprog -flto -O2 foo.o bar.o
8956 @end smallexample
8957
8958 The first two invocations to GCC save a bytecode representation
8959 of GIMPLE into special ELF sections inside @file{foo.o} and
8960 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8961 @file{foo.o} and @file{bar.o}, merges the two files into a single
8962 internal image, and compiles the result as usual. Since both
8963 @file{foo.o} and @file{bar.o} are merged into a single image, this
8964 causes all the interprocedural analyses and optimizations in GCC to
8965 work across the two files as if they were a single one. This means,
8966 for example, that the inliner is able to inline functions in
8967 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8968
8969 Another (simpler) way to enable link-time optimization is:
8970
8971 @smallexample
8972 gcc -o myprog -flto -O2 foo.c bar.c
8973 @end smallexample
8974
8975 The above generates bytecode for @file{foo.c} and @file{bar.c},
8976 merges them together into a single GIMPLE representation and optimizes
8977 them as usual to produce @file{myprog}.
8978
8979 The only important thing to keep in mind is that to enable link-time
8980 optimizations you need to use the GCC driver to perform the link step.
8981 GCC then automatically performs link-time optimization if any of the
8982 objects involved were compiled with the @option{-flto} command-line option.
8983 You generally
8984 should specify the optimization options to be used for link-time
8985 optimization though GCC tries to be clever at guessing an
8986 optimization level to use from the options used at compile time
8987 if you fail to specify one at link time. You can always override
8988 the automatic decision to do link-time optimization
8989 by passing @option{-fno-lto} to the link command.
8990
8991 To make whole program optimization effective, it is necessary to make
8992 certain whole program assumptions. The compiler needs to know
8993 what functions and variables can be accessed by libraries and runtime
8994 outside of the link-time optimized unit. When supported by the linker,
8995 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8996 to the compiler about used and externally visible symbols. When
8997 the linker plugin is not available, @option{-fwhole-program} should be
8998 used to allow the compiler to make these assumptions, which leads
8999 to more aggressive optimization decisions.
9000
9001 When @option{-fuse-linker-plugin} is not enabled, when a file is
9002 compiled with @option{-flto}, the generated object file is larger than
9003 a regular object file because it contains GIMPLE bytecodes and the usual
9004 final code (see @option{-ffat-lto-objects}. This means that
9005 object files with LTO information can be linked as normal object
9006 files; if @option{-fno-lto} is passed to the linker, no
9007 interprocedural optimizations are applied. Note that when
9008 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
9009 but you cannot perform a regular, non-LTO link on them.
9010
9011 Additionally, the optimization flags used to compile individual files
9012 are not necessarily related to those used at link time. For instance,
9013
9014 @smallexample
9015 gcc -c -O0 -ffat-lto-objects -flto foo.c
9016 gcc -c -O0 -ffat-lto-objects -flto bar.c
9017 gcc -o myprog -O3 foo.o bar.o
9018 @end smallexample
9019
9020 This produces individual object files with unoptimized assembler
9021 code, but the resulting binary @file{myprog} is optimized at
9022 @option{-O3}. If, instead, the final binary is generated with
9023 @option{-fno-lto}, then @file{myprog} is not optimized.
9024
9025 When producing the final binary, GCC only
9026 applies link-time optimizations to those files that contain bytecode.
9027 Therefore, you can mix and match object files and libraries with
9028 GIMPLE bytecodes and final object code. GCC automatically selects
9029 which files to optimize in LTO mode and which files to link without
9030 further processing.
9031
9032 There are some code generation flags preserved by GCC when
9033 generating bytecodes, as they need to be used during the final link
9034 stage. Generally options specified at link time override those
9035 specified at compile time.
9036
9037 If you do not specify an optimization level option @option{-O} at
9038 link time, then GCC uses the highest optimization level
9039 used when compiling the object files.
9040
9041 Currently, the following options and their settings are taken from
9042 the first object file that explicitly specifies them:
9043 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9044 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9045 and all the @option{-m} target flags.
9046
9047 Certain ABI-changing flags are required to match in all compilation units,
9048 and trying to override this at link time with a conflicting value
9049 is ignored. This includes options such as @option{-freg-struct-return}
9050 and @option{-fpcc-struct-return}.
9051
9052 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9053 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9054 are passed through to the link stage and merged conservatively for
9055 conflicting translation units. Specifically
9056 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9057 precedence; and for example @option{-ffp-contract=off} takes precedence
9058 over @option{-ffp-contract=fast}. You can override them at link time.
9059
9060 If LTO encounters objects with C linkage declared with incompatible
9061 types in separate translation units to be linked together (undefined
9062 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9063 issued. The behavior is still undefined at run time. Similar
9064 diagnostics may be raised for other languages.
9065
9066 Another feature of LTO is that it is possible to apply interprocedural
9067 optimizations on files written in different languages:
9068
9069 @smallexample
9070 gcc -c -flto foo.c
9071 g++ -c -flto bar.cc
9072 gfortran -c -flto baz.f90
9073 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9074 @end smallexample
9075
9076 Notice that the final link is done with @command{g++} to get the C++
9077 runtime libraries and @option{-lgfortran} is added to get the Fortran
9078 runtime libraries. In general, when mixing languages in LTO mode, you
9079 should use the same link command options as when mixing languages in a
9080 regular (non-LTO) compilation.
9081
9082 If object files containing GIMPLE bytecode are stored in a library archive, say
9083 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9084 are using a linker with plugin support. To create static libraries suitable
9085 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9086 and @command{ranlib};
9087 to show the symbols of object files with GIMPLE bytecode, use
9088 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9089 and @command{nm} have been compiled with plugin support. At link time, use the the
9090 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9091 the LTO optimization process:
9092
9093 @smallexample
9094 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9095 @end smallexample
9096
9097 With the linker plugin enabled, the linker extracts the needed
9098 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9099 to make them part of the aggregated GIMPLE image to be optimized.
9100
9101 If you are not using a linker with plugin support and/or do not
9102 enable the linker plugin, then the objects inside @file{libfoo.a}
9103 are extracted and linked as usual, but they do not participate
9104 in the LTO optimization process. In order to make a static library suitable
9105 for both LTO optimization and usual linkage, compile its object files with
9106 @option{-flto} @option{-ffat-lto-objects}.
9107
9108 Link-time optimizations do not require the presence of the whole program to
9109 operate. If the program does not require any symbols to be exported, it is
9110 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9111 the interprocedural optimizers to use more aggressive assumptions which may
9112 lead to improved optimization opportunities.
9113 Use of @option{-fwhole-program} is not needed when linker plugin is
9114 active (see @option{-fuse-linker-plugin}).
9115
9116 The current implementation of LTO makes no
9117 attempt to generate bytecode that is portable between different
9118 types of hosts. The bytecode files are versioned and there is a
9119 strict version check, so bytecode files generated in one version of
9120 GCC do not work with an older or newer version of GCC.
9121
9122 Link-time optimization does not work well with generation of debugging
9123 information. Combining @option{-flto} with
9124 @option{-g} is currently experimental and expected to produce unexpected
9125 results.
9126
9127 If you specify the optional @var{n}, the optimization and code
9128 generation done at link time is executed in parallel using @var{n}
9129 parallel jobs by utilizing an installed @command{make} program. The
9130 environment variable @env{MAKE} may be used to override the program
9131 used. The default value for @var{n} is 1.
9132
9133 You can also specify @option{-flto=jobserver} to use GNU make's
9134 job server mode to determine the number of parallel jobs. This
9135 is useful when the Makefile calling GCC is already executing in parallel.
9136 You must prepend a @samp{+} to the command recipe in the parent Makefile
9137 for this to work. This option likely only works if @env{MAKE} is
9138 GNU make.
9139
9140 @item -flto-partition=@var{alg}
9141 @opindex flto-partition
9142 Specify the partitioning algorithm used by the link-time optimizer.
9143 The value is either @samp{1to1} to specify a partitioning mirroring
9144 the original source files or @samp{balanced} to specify partitioning
9145 into equally sized chunks (whenever possible) or @samp{max} to create
9146 new partition for every symbol where possible. Specifying @samp{none}
9147 as an algorithm disables partitioning and streaming completely.
9148 The default value is @samp{balanced}. While @samp{1to1} can be used
9149 as an workaround for various code ordering issues, the @samp{max}
9150 partitioning is intended for internal testing only.
9151 The value @samp{one} specifies that exactly one partition should be
9152 used while the value @samp{none} bypasses partitioning and executes
9153 the link-time optimization step directly from the WPA phase.
9154
9155 @item -flto-odr-type-merging
9156 @opindex flto-odr-type-merging
9157 Enable streaming of mangled types names of C++ types and their unification
9158 at link time. This increases size of LTO object files, but enables
9159 diagnostics about One Definition Rule violations.
9160
9161 @item -flto-compression-level=@var{n}
9162 @opindex flto-compression-level
9163 This option specifies the level of compression used for intermediate
9164 language written to LTO object files, and is only meaningful in
9165 conjunction with LTO mode (@option{-flto}). Valid
9166 values are 0 (no compression) to 9 (maximum compression). Values
9167 outside this range are clamped to either 0 or 9. If the option is not
9168 given, a default balanced compression setting is used.
9169
9170 @item -fuse-linker-plugin
9171 @opindex fuse-linker-plugin
9172 Enables the use of a linker plugin during link-time optimization. This
9173 option relies on plugin support in the linker, which is available in gold
9174 or in GNU ld 2.21 or newer.
9175
9176 This option enables the extraction of object files with GIMPLE bytecode out
9177 of library archives. This improves the quality of optimization by exposing
9178 more code to the link-time optimizer. This information specifies what
9179 symbols can be accessed externally (by non-LTO object or during dynamic
9180 linking). Resulting code quality improvements on binaries (and shared
9181 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9182 See @option{-flto} for a description of the effect of this flag and how to
9183 use it.
9184
9185 This option is enabled by default when LTO support in GCC is enabled
9186 and GCC was configured for use with
9187 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9188
9189 @item -ffat-lto-objects
9190 @opindex ffat-lto-objects
9191 Fat LTO objects are object files that contain both the intermediate language
9192 and the object code. This makes them usable for both LTO linking and normal
9193 linking. This option is effective only when compiling with @option{-flto}
9194 and is ignored at link time.
9195
9196 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9197 requires the complete toolchain to be aware of LTO. It requires a linker with
9198 linker plugin support for basic functionality. Additionally,
9199 @command{nm}, @command{ar} and @command{ranlib}
9200 need to support linker plugins to allow a full-featured build environment
9201 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9202 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9203 to these tools. With non fat LTO makefiles need to be modified to use them.
9204
9205 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9206 support.
9207
9208 @item -fcompare-elim
9209 @opindex fcompare-elim
9210 After register allocation and post-register allocation instruction splitting,
9211 identify arithmetic instructions that compute processor flags similar to a
9212 comparison operation based on that arithmetic. If possible, eliminate the
9213 explicit comparison operation.
9214
9215 This pass only applies to certain targets that cannot explicitly represent
9216 the comparison operation before register allocation is complete.
9217
9218 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9219
9220 @item -fcprop-registers
9221 @opindex fcprop-registers
9222 After register allocation and post-register allocation instruction splitting,
9223 perform a copy-propagation pass to try to reduce scheduling dependencies
9224 and occasionally eliminate the copy.
9225
9226 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9227
9228 @item -fprofile-correction
9229 @opindex fprofile-correction
9230 Profiles collected using an instrumented binary for multi-threaded programs may
9231 be inconsistent due to missed counter updates. When this option is specified,
9232 GCC uses heuristics to correct or smooth out such inconsistencies. By
9233 default, GCC emits an error message when an inconsistent profile is detected.
9234
9235 @item -fprofile-use
9236 @itemx -fprofile-use=@var{path}
9237 @opindex fprofile-use
9238 Enable profile feedback-directed optimizations,
9239 and the following optimizations
9240 which are generally profitable only with profile feedback available:
9241 @option{-fbranch-probabilities}, @option{-fvpt},
9242 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9243 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9244
9245 Before you can use this option, you must first generate profiling information.
9246 @xref{Instrumentation Options}, for information about the
9247 @option{-fprofile-generate} option.
9248
9249 By default, GCC emits an error message if the feedback profiles do not
9250 match the source code. This error can be turned into a warning by using
9251 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9252 code.
9253
9254 If @var{path} is specified, GCC looks at the @var{path} to find
9255 the profile feedback data files. See @option{-fprofile-dir}.
9256
9257 @item -fauto-profile
9258 @itemx -fauto-profile=@var{path}
9259 @opindex fauto-profile
9260 Enable sampling-based feedback-directed optimizations,
9261 and the following optimizations
9262 which are generally profitable only with profile feedback available:
9263 @option{-fbranch-probabilities}, @option{-fvpt},
9264 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9265 @option{-ftree-vectorize},
9266 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
9267 @option{-fpredictive-commoning}, @option{-funswitch-loops},
9268 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
9269
9270 @var{path} is the name of a file containing AutoFDO profile information.
9271 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
9272
9273 Producing an AutoFDO profile data file requires running your program
9274 with the @command{perf} utility on a supported GNU/Linux target system.
9275 For more information, see @uref{https://perf.wiki.kernel.org/}.
9276
9277 E.g.
9278 @smallexample
9279 perf record -e br_inst_retired:near_taken -b -o perf.data \
9280 -- your_program
9281 @end smallexample
9282
9283 Then use the @command{create_gcov} tool to convert the raw profile data
9284 to a format that can be used by GCC.@ You must also supply the
9285 unstripped binary for your program to this tool.
9286 See @uref{https://github.com/google/autofdo}.
9287
9288 E.g.
9289 @smallexample
9290 create_gcov --binary=your_program.unstripped --profile=perf.data \
9291 --gcov=profile.afdo
9292 @end smallexample
9293 @end table
9294
9295 The following options control compiler behavior regarding floating-point
9296 arithmetic. These options trade off between speed and
9297 correctness. All must be specifically enabled.
9298
9299 @table @gcctabopt
9300 @item -ffloat-store
9301 @opindex ffloat-store
9302 Do not store floating-point variables in registers, and inhibit other
9303 options that might change whether a floating-point value is taken from a
9304 register or memory.
9305
9306 @cindex floating-point precision
9307 This option prevents undesirable excess precision on machines such as
9308 the 68000 where the floating registers (of the 68881) keep more
9309 precision than a @code{double} is supposed to have. Similarly for the
9310 x86 architecture. For most programs, the excess precision does only
9311 good, but a few programs rely on the precise definition of IEEE floating
9312 point. Use @option{-ffloat-store} for such programs, after modifying
9313 them to store all pertinent intermediate computations into variables.
9314
9315 @item -fexcess-precision=@var{style}
9316 @opindex fexcess-precision
9317 This option allows further control over excess precision on machines
9318 where floating-point operations occur in a format with more precision or
9319 range than the IEEE standard and interchange floating-point types. By
9320 default, @option{-fexcess-precision=fast} is in effect; this means that
9321 operations may be carried out in a wider precision than the types specified
9322 in the source if that would result in faster code, and it is unpredictable
9323 when rounding to the types specified in the source code takes place.
9324 When compiling C, if @option{-fexcess-precision=standard} is specified then
9325 excess precision follows the rules specified in ISO C99; in particular,
9326 both casts and assignments cause values to be rounded to their
9327 semantic types (whereas @option{-ffloat-store} only affects
9328 assignments). This option is enabled by default for C if a strict
9329 conformance option such as @option{-std=c99} is used.
9330 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
9331 regardless of whether a strict conformance option is used.
9332
9333 @opindex mfpmath
9334 @option{-fexcess-precision=standard} is not implemented for languages
9335 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
9336 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9337 semantics apply without excess precision, and in the latter, rounding
9338 is unpredictable.
9339
9340 @item -ffast-math
9341 @opindex ffast-math
9342 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9343 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9344 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
9345 @option{-fexcess-precision=fast}.
9346
9347 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9348
9349 This option is not turned on by any @option{-O} option besides
9350 @option{-Ofast} since it can result in incorrect output for programs
9351 that depend on an exact implementation of IEEE or ISO rules/specifications
9352 for math functions. It may, however, yield faster code for programs
9353 that do not require the guarantees of these specifications.
9354
9355 @item -fno-math-errno
9356 @opindex fno-math-errno
9357 Do not set @code{errno} after calling math functions that are executed
9358 with a single instruction, e.g., @code{sqrt}. A program that relies on
9359 IEEE exceptions for math error handling may want to use this flag
9360 for speed while maintaining IEEE arithmetic compatibility.
9361
9362 This option is not turned on by any @option{-O} option since
9363 it can result in incorrect output for programs that depend on
9364 an exact implementation of IEEE or ISO rules/specifications for
9365 math functions. It may, however, yield faster code for programs
9366 that do not require the guarantees of these specifications.
9367
9368 The default is @option{-fmath-errno}.
9369
9370 On Darwin systems, the math library never sets @code{errno}. There is
9371 therefore no reason for the compiler to consider the possibility that
9372 it might, and @option{-fno-math-errno} is the default.
9373
9374 @item -funsafe-math-optimizations
9375 @opindex funsafe-math-optimizations
9376
9377 Allow optimizations for floating-point arithmetic that (a) assume
9378 that arguments and results are valid and (b) may violate IEEE or
9379 ANSI standards. When used at link time, it may include libraries
9380 or startup files that change the default FPU control word or other
9381 similar optimizations.
9382
9383 This option is not turned on by any @option{-O} option since
9384 it can result in incorrect output for programs that depend on
9385 an exact implementation of IEEE or ISO rules/specifications for
9386 math functions. It may, however, yield faster code for programs
9387 that do not require the guarantees of these specifications.
9388 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9389 @option{-fassociative-math} and @option{-freciprocal-math}.
9390
9391 The default is @option{-fno-unsafe-math-optimizations}.
9392
9393 @item -fassociative-math
9394 @opindex fassociative-math
9395
9396 Allow re-association of operands in series of floating-point operations.
9397 This violates the ISO C and C++ language standard by possibly changing
9398 computation result. NOTE: re-ordering may change the sign of zero as
9399 well as ignore NaNs and inhibit or create underflow or overflow (and
9400 thus cannot be used on code that relies on rounding behavior like
9401 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9402 and thus may not be used when ordered comparisons are required.
9403 This option requires that both @option{-fno-signed-zeros} and
9404 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9405 much sense with @option{-frounding-math}. For Fortran the option
9406 is automatically enabled when both @option{-fno-signed-zeros} and
9407 @option{-fno-trapping-math} are in effect.
9408
9409 The default is @option{-fno-associative-math}.
9410
9411 @item -freciprocal-math
9412 @opindex freciprocal-math
9413
9414 Allow the reciprocal of a value to be used instead of dividing by
9415 the value if this enables optimizations. For example @code{x / y}
9416 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9417 is subject to common subexpression elimination. Note that this loses
9418 precision and increases the number of flops operating on the value.
9419
9420 The default is @option{-fno-reciprocal-math}.
9421
9422 @item -ffinite-math-only
9423 @opindex ffinite-math-only
9424 Allow optimizations for floating-point arithmetic that assume
9425 that arguments and results are not NaNs or +-Infs.
9426
9427 This option is not turned on by any @option{-O} option since
9428 it can result in incorrect output for programs that depend on
9429 an exact implementation of IEEE or ISO rules/specifications for
9430 math functions. It may, however, yield faster code for programs
9431 that do not require the guarantees of these specifications.
9432
9433 The default is @option{-fno-finite-math-only}.
9434
9435 @item -fno-signed-zeros
9436 @opindex fno-signed-zeros
9437 Allow optimizations for floating-point arithmetic that ignore the
9438 signedness of zero. IEEE arithmetic specifies the behavior of
9439 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9440 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9441 This option implies that the sign of a zero result isn't significant.
9442
9443 The default is @option{-fsigned-zeros}.
9444
9445 @item -fno-trapping-math
9446 @opindex fno-trapping-math
9447 Compile code assuming that floating-point operations cannot generate
9448 user-visible traps. These traps include division by zero, overflow,
9449 underflow, inexact result and invalid operation. This option requires
9450 that @option{-fno-signaling-nans} be in effect. Setting this option may
9451 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9452
9453 This option should never be turned on by any @option{-O} option since
9454 it can result in incorrect output for programs that depend on
9455 an exact implementation of IEEE or ISO rules/specifications for
9456 math functions.
9457
9458 The default is @option{-ftrapping-math}.
9459
9460 @item -frounding-math
9461 @opindex frounding-math
9462 Disable transformations and optimizations that assume default floating-point
9463 rounding behavior. This is round-to-zero for all floating point
9464 to integer conversions, and round-to-nearest for all other arithmetic
9465 truncations. This option should be specified for programs that change
9466 the FP rounding mode dynamically, or that may be executed with a
9467 non-default rounding mode. This option disables constant folding of
9468 floating-point expressions at compile time (which may be affected by
9469 rounding mode) and arithmetic transformations that are unsafe in the
9470 presence of sign-dependent rounding modes.
9471
9472 The default is @option{-fno-rounding-math}.
9473
9474 This option is experimental and does not currently guarantee to
9475 disable all GCC optimizations that are affected by rounding mode.
9476 Future versions of GCC may provide finer control of this setting
9477 using C99's @code{FENV_ACCESS} pragma. This command-line option
9478 will be used to specify the default state for @code{FENV_ACCESS}.
9479
9480 @item -fsignaling-nans
9481 @opindex fsignaling-nans
9482 Compile code assuming that IEEE signaling NaNs may generate user-visible
9483 traps during floating-point operations. Setting this option disables
9484 optimizations that may change the number of exceptions visible with
9485 signaling NaNs. This option implies @option{-ftrapping-math}.
9486
9487 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9488 be defined.
9489
9490 The default is @option{-fno-signaling-nans}.
9491
9492 This option is experimental and does not currently guarantee to
9493 disable all GCC optimizations that affect signaling NaN behavior.
9494
9495 @item -fno-fp-int-builtin-inexact
9496 @opindex fno-fp-int-builtin-inexact
9497 Do not allow the built-in functions @code{ceil}, @code{floor},
9498 @code{round} and @code{trunc}, and their @code{float} and @code{long
9499 double} variants, to generate code that raises the ``inexact''
9500 floating-point exception for noninteger arguments. ISO C99 and C11
9501 allow these functions to raise the ``inexact'' exception, but ISO/IEC
9502 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
9503 functions to do so.
9504
9505 The default is @option{-ffp-int-builtin-inexact}, allowing the
9506 exception to be raised. This option does nothing unless
9507 @option{-ftrapping-math} is in effect.
9508
9509 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
9510 generate a call to a library function then the ``inexact'' exception
9511 may be raised if the library implementation does not follow TS 18661.
9512
9513 @item -fsingle-precision-constant
9514 @opindex fsingle-precision-constant
9515 Treat floating-point constants as single precision instead of
9516 implicitly converting them to double-precision constants.
9517
9518 @item -fcx-limited-range
9519 @opindex fcx-limited-range
9520 When enabled, this option states that a range reduction step is not
9521 needed when performing complex division. Also, there is no checking
9522 whether the result of a complex multiplication or division is @code{NaN
9523 + I*NaN}, with an attempt to rescue the situation in that case. The
9524 default is @option{-fno-cx-limited-range}, but is enabled by
9525 @option{-ffast-math}.
9526
9527 This option controls the default setting of the ISO C99
9528 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9529 all languages.
9530
9531 @item -fcx-fortran-rules
9532 @opindex fcx-fortran-rules
9533 Complex multiplication and division follow Fortran rules. Range
9534 reduction is done as part of complex division, but there is no checking
9535 whether the result of a complex multiplication or division is @code{NaN
9536 + I*NaN}, with an attempt to rescue the situation in that case.
9537
9538 The default is @option{-fno-cx-fortran-rules}.
9539
9540 @end table
9541
9542 The following options control optimizations that may improve
9543 performance, but are not enabled by any @option{-O} options. This
9544 section includes experimental options that may produce broken code.
9545
9546 @table @gcctabopt
9547 @item -fbranch-probabilities
9548 @opindex fbranch-probabilities
9549 After running a program compiled with @option{-fprofile-arcs}
9550 (@pxref{Instrumentation Options}),
9551 you can compile it a second time using
9552 @option{-fbranch-probabilities}, to improve optimizations based on
9553 the number of times each branch was taken. When a program
9554 compiled with @option{-fprofile-arcs} exits, it saves arc execution
9555 counts to a file called @file{@var{sourcename}.gcda} for each source
9556 file. The information in this data file is very dependent on the
9557 structure of the generated code, so you must use the same source code
9558 and the same optimization options for both compilations.
9559
9560 With @option{-fbranch-probabilities}, GCC puts a
9561 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
9562 These can be used to improve optimization. Currently, they are only
9563 used in one place: in @file{reorg.c}, instead of guessing which path a
9564 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
9565 exactly determine which path is taken more often.
9566
9567 @item -fprofile-values
9568 @opindex fprofile-values
9569 If combined with @option{-fprofile-arcs}, it adds code so that some
9570 data about values of expressions in the program is gathered.
9571
9572 With @option{-fbranch-probabilities}, it reads back the data gathered
9573 from profiling values of expressions for usage in optimizations.
9574
9575 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
9576
9577 @item -fprofile-reorder-functions
9578 @opindex fprofile-reorder-functions
9579 Function reordering based on profile instrumentation collects
9580 first time of execution of a function and orders these functions
9581 in ascending order.
9582
9583 Enabled with @option{-fprofile-use}.
9584
9585 @item -fvpt
9586 @opindex fvpt
9587 If combined with @option{-fprofile-arcs}, this option instructs the compiler
9588 to add code to gather information about values of expressions.
9589
9590 With @option{-fbranch-probabilities}, it reads back the data gathered
9591 and actually performs the optimizations based on them.
9592 Currently the optimizations include specialization of division operations
9593 using the knowledge about the value of the denominator.
9594
9595 @item -frename-registers
9596 @opindex frename-registers
9597 Attempt to avoid false dependencies in scheduled code by making use
9598 of registers left over after register allocation. This optimization
9599 most benefits processors with lots of registers. Depending on the
9600 debug information format adopted by the target, however, it can
9601 make debugging impossible, since variables no longer stay in
9602 a ``home register''.
9603
9604 Enabled by default with @option{-funroll-loops}.
9605
9606 @item -fschedule-fusion
9607 @opindex fschedule-fusion
9608 Performs a target dependent pass over the instruction stream to schedule
9609 instructions of same type together because target machine can execute them
9610 more efficiently if they are adjacent to each other in the instruction flow.
9611
9612 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9613
9614 @item -ftracer
9615 @opindex ftracer
9616 Perform tail duplication to enlarge superblock size. This transformation
9617 simplifies the control flow of the function allowing other optimizations to do
9618 a better job.
9619
9620 Enabled with @option{-fprofile-use}.
9621
9622 @item -funroll-loops
9623 @opindex funroll-loops
9624 Unroll loops whose number of iterations can be determined at compile time or
9625 upon entry to the loop. @option{-funroll-loops} implies
9626 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9627 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9628 a small constant number of iterations). This option makes code larger, and may
9629 or may not make it run faster.
9630
9631 Enabled with @option{-fprofile-use}.
9632
9633 @item -funroll-all-loops
9634 @opindex funroll-all-loops
9635 Unroll all loops, even if their number of iterations is uncertain when
9636 the loop is entered. This usually makes programs run more slowly.
9637 @option{-funroll-all-loops} implies the same options as
9638 @option{-funroll-loops}.
9639
9640 @item -fpeel-loops
9641 @opindex fpeel-loops
9642 Peels loops for which there is enough information that they do not
9643 roll much (from profile feedback or static analysis). It also turns on
9644 complete loop peeling (i.e.@: complete removal of loops with small constant
9645 number of iterations).
9646
9647 Enabled with @option{-O3} and/or @option{-fprofile-use}.
9648
9649 @item -fmove-loop-invariants
9650 @opindex fmove-loop-invariants
9651 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
9652 at level @option{-O1}
9653
9654 @item -fsplit-loops
9655 @opindex fsplit-loops
9656 Split a loop into two if it contains a condition that's always true
9657 for one side of the iteration space and false for the other.
9658
9659 @item -funswitch-loops
9660 @opindex funswitch-loops
9661 Move branches with loop invariant conditions out of the loop, with duplicates
9662 of the loop on both branches (modified according to result of the condition).
9663
9664 @item -ffunction-sections
9665 @itemx -fdata-sections
9666 @opindex ffunction-sections
9667 @opindex fdata-sections
9668 Place each function or data item into its own section in the output
9669 file if the target supports arbitrary sections. The name of the
9670 function or the name of the data item determines the section's name
9671 in the output file.
9672
9673 Use these options on systems where the linker can perform optimizations
9674 to improve locality of reference in the instruction space. Most systems
9675 using the ELF object format and SPARC processors running Solaris 2 have
9676 linkers with such optimizations. AIX may have these optimizations in
9677 the future.
9678
9679 Only use these options when there are significant benefits from doing
9680 so. When you specify these options, the assembler and linker
9681 create larger object and executable files and are also slower.
9682 You cannot use @command{gprof} on all systems if you
9683 specify this option, and you may have problems with debugging if
9684 you specify both this option and @option{-g}.
9685
9686 @item -fbranch-target-load-optimize
9687 @opindex fbranch-target-load-optimize
9688 Perform branch target register load optimization before prologue / epilogue
9689 threading.
9690 The use of target registers can typically be exposed only during reload,
9691 thus hoisting loads out of loops and doing inter-block scheduling needs
9692 a separate optimization pass.
9693
9694 @item -fbranch-target-load-optimize2
9695 @opindex fbranch-target-load-optimize2
9696 Perform branch target register load optimization after prologue / epilogue
9697 threading.
9698
9699 @item -fbtr-bb-exclusive
9700 @opindex fbtr-bb-exclusive
9701 When performing branch target register load optimization, don't reuse
9702 branch target registers within any basic block.
9703
9704 @item -fstdarg-opt
9705 @opindex fstdarg-opt
9706 Optimize the prologue of variadic argument functions with respect to usage of
9707 those arguments.
9708
9709 @item -fsection-anchors
9710 @opindex fsection-anchors
9711 Try to reduce the number of symbolic address calculations by using
9712 shared ``anchor'' symbols to address nearby objects. This transformation
9713 can help to reduce the number of GOT entries and GOT accesses on some
9714 targets.
9715
9716 For example, the implementation of the following function @code{foo}:
9717
9718 @smallexample
9719 static int a, b, c;
9720 int foo (void) @{ return a + b + c; @}
9721 @end smallexample
9722
9723 @noindent
9724 usually calculates the addresses of all three variables, but if you
9725 compile it with @option{-fsection-anchors}, it accesses the variables
9726 from a common anchor point instead. The effect is similar to the
9727 following pseudocode (which isn't valid C):
9728
9729 @smallexample
9730 int foo (void)
9731 @{
9732 register int *xr = &x;
9733 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9734 @}
9735 @end smallexample
9736
9737 Not all targets support this option.
9738
9739 @item --param @var{name}=@var{value}
9740 @opindex param
9741 In some places, GCC uses various constants to control the amount of
9742 optimization that is done. For example, GCC does not inline functions
9743 that contain more than a certain number of instructions. You can
9744 control some of these constants on the command line using the
9745 @option{--param} option.
9746
9747 The names of specific parameters, and the meaning of the values, are
9748 tied to the internals of the compiler, and are subject to change
9749 without notice in future releases.
9750
9751 In each case, the @var{value} is an integer. The allowable choices for
9752 @var{name} are:
9753
9754 @table @gcctabopt
9755 @item predictable-branch-outcome
9756 When branch is predicted to be taken with probability lower than this threshold
9757 (in percent), then it is considered well predictable. The default is 10.
9758
9759 @item max-rtl-if-conversion-insns
9760 RTL if-conversion tries to remove conditional branches around a block and
9761 replace them with conditionally executed instructions. This parameter
9762 gives the maximum number of instructions in a block which should be
9763 considered for if-conversion. The default is 10, though the compiler will
9764 also use other heuristics to decide whether if-conversion is likely to be
9765 profitable.
9766
9767 @item max-rtl-if-conversion-predictable-cost
9768 @item max-rtl-if-conversion-unpredictable-cost
9769 RTL if-conversion will try to remove conditional branches around a block
9770 and replace them with conditionally executed instructions. These parameters
9771 give the maximum permissible cost for the sequence that would be generated
9772 by if-conversion depending on whether the branch is statically determined
9773 to be predictable or not. The units for this parameter are the same as
9774 those for the GCC internal seq_cost metric. The compiler will try to
9775 provide a reasonable default for this parameter using the BRANCH_COST
9776 target macro.
9777
9778 @item max-crossjump-edges
9779 The maximum number of incoming edges to consider for cross-jumping.
9780 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
9781 the number of edges incoming to each block. Increasing values mean
9782 more aggressive optimization, making the compilation time increase with
9783 probably small improvement in executable size.
9784
9785 @item min-crossjump-insns
9786 The minimum number of instructions that must be matched at the end
9787 of two blocks before cross-jumping is performed on them. This
9788 value is ignored in the case where all instructions in the block being
9789 cross-jumped from are matched. The default value is 5.
9790
9791 @item max-grow-copy-bb-insns
9792 The maximum code size expansion factor when copying basic blocks
9793 instead of jumping. The expansion is relative to a jump instruction.
9794 The default value is 8.
9795
9796 @item max-goto-duplication-insns
9797 The maximum number of instructions to duplicate to a block that jumps
9798 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
9799 passes, GCC factors computed gotos early in the compilation process,
9800 and unfactors them as late as possible. Only computed jumps at the
9801 end of a basic blocks with no more than max-goto-duplication-insns are
9802 unfactored. The default value is 8.
9803
9804 @item max-delay-slot-insn-search
9805 The maximum number of instructions to consider when looking for an
9806 instruction to fill a delay slot. If more than this arbitrary number of
9807 instructions are searched, the time savings from filling the delay slot
9808 are minimal, so stop searching. Increasing values mean more
9809 aggressive optimization, making the compilation time increase with probably
9810 small improvement in execution time.
9811
9812 @item max-delay-slot-live-search
9813 When trying to fill delay slots, the maximum number of instructions to
9814 consider when searching for a block with valid live register
9815 information. Increasing this arbitrarily chosen value means more
9816 aggressive optimization, increasing the compilation time. This parameter
9817 should be removed when the delay slot code is rewritten to maintain the
9818 control-flow graph.
9819
9820 @item max-gcse-memory
9821 The approximate maximum amount of memory that can be allocated in
9822 order to perform the global common subexpression elimination
9823 optimization. If more memory than specified is required, the
9824 optimization is not done.
9825
9826 @item max-gcse-insertion-ratio
9827 If the ratio of expression insertions to deletions is larger than this value
9828 for any expression, then RTL PRE inserts or removes the expression and thus
9829 leaves partially redundant computations in the instruction stream. The default value is 20.
9830
9831 @item max-pending-list-length
9832 The maximum number of pending dependencies scheduling allows
9833 before flushing the current state and starting over. Large functions
9834 with few branches or calls can create excessively large lists which
9835 needlessly consume memory and resources.
9836
9837 @item max-modulo-backtrack-attempts
9838 The maximum number of backtrack attempts the scheduler should make
9839 when modulo scheduling a loop. Larger values can exponentially increase
9840 compilation time.
9841
9842 @item max-inline-insns-single
9843 Several parameters control the tree inliner used in GCC@.
9844 This number sets the maximum number of instructions (counted in GCC's
9845 internal representation) in a single function that the tree inliner
9846 considers for inlining. This only affects functions declared
9847 inline and methods implemented in a class declaration (C++).
9848 The default value is 400.
9849
9850 @item max-inline-insns-auto
9851 When you use @option{-finline-functions} (included in @option{-O3}),
9852 a lot of functions that would otherwise not be considered for inlining
9853 by the compiler are investigated. To those functions, a different
9854 (more restrictive) limit compared to functions declared inline can
9855 be applied.
9856 The default value is 40.
9857
9858 @item inline-min-speedup
9859 When estimated performance improvement of caller + callee runtime exceeds this
9860 threshold (in percent), the function can be inlined regardless of the limit on
9861 @option{--param max-inline-insns-single} and @option{--param
9862 max-inline-insns-auto}.
9863
9864 @item large-function-insns
9865 The limit specifying really large functions. For functions larger than this
9866 limit after inlining, inlining is constrained by
9867 @option{--param large-function-growth}. This parameter is useful primarily
9868 to avoid extreme compilation time caused by non-linear algorithms used by the
9869 back end.
9870 The default value is 2700.
9871
9872 @item large-function-growth
9873 Specifies maximal growth of large function caused by inlining in percents.
9874 The default value is 100 which limits large function growth to 2.0 times
9875 the original size.
9876
9877 @item large-unit-insns
9878 The limit specifying large translation unit. Growth caused by inlining of
9879 units larger than this limit is limited by @option{--param inline-unit-growth}.
9880 For small units this might be too tight.
9881 For example, consider a unit consisting of function A
9882 that is inline and B that just calls A three times. If B is small relative to
9883 A, the growth of unit is 300\% and yet such inlining is very sane. For very
9884 large units consisting of small inlineable functions, however, the overall unit
9885 growth limit is needed to avoid exponential explosion of code size. Thus for
9886 smaller units, the size is increased to @option{--param large-unit-insns}
9887 before applying @option{--param inline-unit-growth}. The default is 10000.
9888
9889 @item inline-unit-growth
9890 Specifies maximal overall growth of the compilation unit caused by inlining.
9891 The default value is 20 which limits unit growth to 1.2 times the original
9892 size. Cold functions (either marked cold via an attribute or by profile
9893 feedback) are not accounted into the unit size.
9894
9895 @item ipcp-unit-growth
9896 Specifies maximal overall growth of the compilation unit caused by
9897 interprocedural constant propagation. The default value is 10 which limits
9898 unit growth to 1.1 times the original size.
9899
9900 @item large-stack-frame
9901 The limit specifying large stack frames. While inlining the algorithm is trying
9902 to not grow past this limit too much. The default value is 256 bytes.
9903
9904 @item large-stack-frame-growth
9905 Specifies maximal growth of large stack frames caused by inlining in percents.
9906 The default value is 1000 which limits large stack frame growth to 11 times
9907 the original size.
9908
9909 @item max-inline-insns-recursive
9910 @itemx max-inline-insns-recursive-auto
9911 Specifies the maximum number of instructions an out-of-line copy of a
9912 self-recursive inline
9913 function can grow into by performing recursive inlining.
9914
9915 @option{--param max-inline-insns-recursive} applies to functions
9916 declared inline.
9917 For functions not declared inline, recursive inlining
9918 happens only when @option{-finline-functions} (included in @option{-O3}) is
9919 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
9920 default value is 450.
9921
9922 @item max-inline-recursive-depth
9923 @itemx max-inline-recursive-depth-auto
9924 Specifies the maximum recursion depth used for recursive inlining.
9925
9926 @option{--param max-inline-recursive-depth} applies to functions
9927 declared inline. For functions not declared inline, recursive inlining
9928 happens only when @option{-finline-functions} (included in @option{-O3}) is
9929 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
9930 default value is 8.
9931
9932 @item min-inline-recursive-probability
9933 Recursive inlining is profitable only for function having deep recursion
9934 in average and can hurt for function having little recursion depth by
9935 increasing the prologue size or complexity of function body to other
9936 optimizers.
9937
9938 When profile feedback is available (see @option{-fprofile-generate}) the actual
9939 recursion depth can be guessed from the probability that function recurses
9940 via a given call expression. This parameter limits inlining only to call
9941 expressions whose probability exceeds the given threshold (in percents).
9942 The default value is 10.
9943
9944 @item early-inlining-insns
9945 Specify growth that the early inliner can make. In effect it increases
9946 the amount of inlining for code having a large abstraction penalty.
9947 The default value is 14.
9948
9949 @item max-early-inliner-iterations
9950 Limit of iterations of the early inliner. This basically bounds
9951 the number of nested indirect calls the early inliner can resolve.
9952 Deeper chains are still handled by late inlining.
9953
9954 @item comdat-sharing-probability
9955 Probability (in percent) that C++ inline function with comdat visibility
9956 are shared across multiple compilation units. The default value is 20.
9957
9958 @item profile-func-internal-id
9959 A parameter to control whether to use function internal id in profile
9960 database lookup. If the value is 0, the compiler uses an id that
9961 is based on function assembler name and filename, which makes old profile
9962 data more tolerant to source changes such as function reordering etc.
9963 The default value is 0.
9964
9965 @item min-vect-loop-bound
9966 The minimum number of iterations under which loops are not vectorized
9967 when @option{-ftree-vectorize} is used. The number of iterations after
9968 vectorization needs to be greater than the value specified by this option
9969 to allow vectorization. The default value is 0.
9970
9971 @item gcse-cost-distance-ratio
9972 Scaling factor in calculation of maximum distance an expression
9973 can be moved by GCSE optimizations. This is currently supported only in the
9974 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9975 is with simple expressions, i.e., the expressions that have cost
9976 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9977 hoisting of simple expressions. The default value is 10.
9978
9979 @item gcse-unrestricted-cost
9980 Cost, roughly measured as the cost of a single typical machine
9981 instruction, at which GCSE optimizations do not constrain
9982 the distance an expression can travel. This is currently
9983 supported only in the code hoisting pass. The lesser the cost,
9984 the more aggressive code hoisting is. Specifying 0
9985 allows all expressions to travel unrestricted distances.
9986 The default value is 3.
9987
9988 @item max-hoist-depth
9989 The depth of search in the dominator tree for expressions to hoist.
9990 This is used to avoid quadratic behavior in hoisting algorithm.
9991 The value of 0 does not limit on the search, but may slow down compilation
9992 of huge functions. The default value is 30.
9993
9994 @item max-tail-merge-comparisons
9995 The maximum amount of similar bbs to compare a bb with. This is used to
9996 avoid quadratic behavior in tree tail merging. The default value is 10.
9997
9998 @item max-tail-merge-iterations
9999 The maximum amount of iterations of the pass over the function. This is used to
10000 limit compilation time in tree tail merging. The default value is 2.
10001
10002 @item store-merging-allow-unaligned
10003 Allow the store merging pass to introduce unaligned stores if it is legal to
10004 do so. The default value is 1.
10005
10006 @item max-stores-to-merge
10007 The maximum number of stores to attempt to merge into wider stores in the store
10008 merging pass. The minimum value is 2 and the default is 64.
10009
10010 @item max-unrolled-insns
10011 The maximum number of instructions that a loop may have to be unrolled.
10012 If a loop is unrolled, this parameter also determines how many times
10013 the loop code is unrolled.
10014
10015 @item max-average-unrolled-insns
10016 The maximum number of instructions biased by probabilities of their execution
10017 that a loop may have to be unrolled. If a loop is unrolled,
10018 this parameter also determines how many times the loop code is unrolled.
10019
10020 @item max-unroll-times
10021 The maximum number of unrollings of a single loop.
10022
10023 @item max-peeled-insns
10024 The maximum number of instructions that a loop may have to be peeled.
10025 If a loop is peeled, this parameter also determines how many times
10026 the loop code is peeled.
10027
10028 @item max-peel-times
10029 The maximum number of peelings of a single loop.
10030
10031 @item max-peel-branches
10032 The maximum number of branches on the hot path through the peeled sequence.
10033
10034 @item max-completely-peeled-insns
10035 The maximum number of insns of a completely peeled loop.
10036
10037 @item max-completely-peel-times
10038 The maximum number of iterations of a loop to be suitable for complete peeling.
10039
10040 @item max-completely-peel-loop-nest-depth
10041 The maximum depth of a loop nest suitable for complete peeling.
10042
10043 @item max-unswitch-insns
10044 The maximum number of insns of an unswitched loop.
10045
10046 @item max-unswitch-level
10047 The maximum number of branches unswitched in a single loop.
10048
10049 @item max-loop-headers-insns
10050 The maximum number of insns in loop header duplicated by the copy loop headers
10051 pass.
10052
10053 @item lim-expensive
10054 The minimum cost of an expensive expression in the loop invariant motion.
10055
10056 @item iv-consider-all-candidates-bound
10057 Bound on number of candidates for induction variables, below which
10058 all candidates are considered for each use in induction variable
10059 optimizations. If there are more candidates than this,
10060 only the most relevant ones are considered to avoid quadratic time complexity.
10061
10062 @item iv-max-considered-uses
10063 The induction variable optimizations give up on loops that contain more
10064 induction variable uses.
10065
10066 @item iv-always-prune-cand-set-bound
10067 If the number of candidates in the set is smaller than this value,
10068 always try to remove unnecessary ivs from the set
10069 when adding a new one.
10070
10071 @item avg-loop-niter
10072 Average number of iterations of a loop.
10073
10074 @item dse-max-object-size
10075 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
10076 Larger values may result in larger compilation times.
10077
10078 @item scev-max-expr-size
10079 Bound on size of expressions used in the scalar evolutions analyzer.
10080 Large expressions slow the analyzer.
10081
10082 @item scev-max-expr-complexity
10083 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10084 Complex expressions slow the analyzer.
10085
10086 @item max-tree-if-conversion-phi-args
10087 Maximum number of arguments in a PHI supported by TREE if conversion
10088 unless the loop is marked with simd pragma.
10089
10090 @item vect-max-version-for-alignment-checks
10091 The maximum number of run-time checks that can be performed when
10092 doing loop versioning for alignment in the vectorizer.
10093
10094 @item vect-max-version-for-alias-checks
10095 The maximum number of run-time checks that can be performed when
10096 doing loop versioning for alias in the vectorizer.
10097
10098 @item vect-max-peeling-for-alignment
10099 The maximum number of loop peels to enhance access alignment
10100 for vectorizer. Value -1 means no limit.
10101
10102 @item max-iterations-to-track
10103 The maximum number of iterations of a loop the brute-force algorithm
10104 for analysis of the number of iterations of the loop tries to evaluate.
10105
10106 @item hot-bb-count-ws-permille
10107 A basic block profile count is considered hot if it contributes to
10108 the given permillage (i.e. 0...1000) of the entire profiled execution.
10109
10110 @item hot-bb-frequency-fraction
10111 Select fraction of the entry block frequency of executions of basic block in
10112 function given basic block needs to have to be considered hot.
10113
10114 @item max-predicted-iterations
10115 The maximum number of loop iterations we predict statically. This is useful
10116 in cases where a function contains a single loop with known bound and
10117 another loop with unknown bound.
10118 The known number of iterations is predicted correctly, while
10119 the unknown number of iterations average to roughly 10. This means that the
10120 loop without bounds appears artificially cold relative to the other one.
10121
10122 @item builtin-expect-probability
10123 Control the probability of the expression having the specified value. This
10124 parameter takes a percentage (i.e. 0 ... 100) as input.
10125 The default probability of 90 is obtained empirically.
10126
10127 @item align-threshold
10128
10129 Select fraction of the maximal frequency of executions of a basic block in
10130 a function to align the basic block.
10131
10132 @item align-loop-iterations
10133
10134 A loop expected to iterate at least the selected number of iterations is
10135 aligned.
10136
10137 @item tracer-dynamic-coverage
10138 @itemx tracer-dynamic-coverage-feedback
10139
10140 This value is used to limit superblock formation once the given percentage of
10141 executed instructions is covered. This limits unnecessary code size
10142 expansion.
10143
10144 The @option{tracer-dynamic-coverage-feedback} parameter
10145 is used only when profile
10146 feedback is available. The real profiles (as opposed to statically estimated
10147 ones) are much less balanced allowing the threshold to be larger value.
10148
10149 @item tracer-max-code-growth
10150 Stop tail duplication once code growth has reached given percentage. This is
10151 a rather artificial limit, as most of the duplicates are eliminated later in
10152 cross jumping, so it may be set to much higher values than is the desired code
10153 growth.
10154
10155 @item tracer-min-branch-ratio
10156
10157 Stop reverse growth when the reverse probability of best edge is less than this
10158 threshold (in percent).
10159
10160 @item tracer-min-branch-probability
10161 @itemx tracer-min-branch-probability-feedback
10162
10163 Stop forward growth if the best edge has probability lower than this
10164 threshold.
10165
10166 Similarly to @option{tracer-dynamic-coverage} two parameters are
10167 provided. @option{tracer-min-branch-probability-feedback} is used for
10168 compilation with profile feedback and @option{tracer-min-branch-probability}
10169 compilation without. The value for compilation with profile feedback
10170 needs to be more conservative (higher) in order to make tracer
10171 effective.
10172
10173 @item max-cse-path-length
10174
10175 The maximum number of basic blocks on path that CSE considers.
10176 The default is 10.
10177
10178 @item max-cse-insns
10179 The maximum number of instructions CSE processes before flushing.
10180 The default is 1000.
10181
10182 @item ggc-min-expand
10183
10184 GCC uses a garbage collector to manage its own memory allocation. This
10185 parameter specifies the minimum percentage by which the garbage
10186 collector's heap should be allowed to expand between collections.
10187 Tuning this may improve compilation speed; it has no effect on code
10188 generation.
10189
10190 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10191 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10192 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10193 GCC is not able to calculate RAM on a particular platform, the lower
10194 bound of 30% is used. Setting this parameter and
10195 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10196 every opportunity. This is extremely slow, but can be useful for
10197 debugging.
10198
10199 @item ggc-min-heapsize
10200
10201 Minimum size of the garbage collector's heap before it begins bothering
10202 to collect garbage. The first collection occurs after the heap expands
10203 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10204 tuning this may improve compilation speed, and has no effect on code
10205 generation.
10206
10207 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10208 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10209 with a lower bound of 4096 (four megabytes) and an upper bound of
10210 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10211 particular platform, the lower bound is used. Setting this parameter
10212 very large effectively disables garbage collection. Setting this
10213 parameter and @option{ggc-min-expand} to zero causes a full collection
10214 to occur at every opportunity.
10215
10216 @item max-reload-search-insns
10217 The maximum number of instruction reload should look backward for equivalent
10218 register. Increasing values mean more aggressive optimization, making the
10219 compilation time increase with probably slightly better performance.
10220 The default value is 100.
10221
10222 @item max-cselib-memory-locations
10223 The maximum number of memory locations cselib should take into account.
10224 Increasing values mean more aggressive optimization, making the compilation time
10225 increase with probably slightly better performance. The default value is 500.
10226
10227 @item max-sched-ready-insns
10228 The maximum number of instructions ready to be issued the scheduler should
10229 consider at any given time during the first scheduling pass. Increasing
10230 values mean more thorough searches, making the compilation time increase
10231 with probably little benefit. The default value is 100.
10232
10233 @item max-sched-region-blocks
10234 The maximum number of blocks in a region to be considered for
10235 interblock scheduling. The default value is 10.
10236
10237 @item max-pipeline-region-blocks
10238 The maximum number of blocks in a region to be considered for
10239 pipelining in the selective scheduler. The default value is 15.
10240
10241 @item max-sched-region-insns
10242 The maximum number of insns in a region to be considered for
10243 interblock scheduling. The default value is 100.
10244
10245 @item max-pipeline-region-insns
10246 The maximum number of insns in a region to be considered for
10247 pipelining in the selective scheduler. The default value is 200.
10248
10249 @item min-spec-prob
10250 The minimum probability (in percents) of reaching a source block
10251 for interblock speculative scheduling. The default value is 40.
10252
10253 @item max-sched-extend-regions-iters
10254 The maximum number of iterations through CFG to extend regions.
10255 A value of 0 (the default) disables region extensions.
10256
10257 @item max-sched-insn-conflict-delay
10258 The maximum conflict delay for an insn to be considered for speculative motion.
10259 The default value is 3.
10260
10261 @item sched-spec-prob-cutoff
10262 The minimal probability of speculation success (in percents), so that
10263 speculative insns are scheduled.
10264 The default value is 40.
10265
10266 @item sched-state-edge-prob-cutoff
10267 The minimum probability an edge must have for the scheduler to save its
10268 state across it.
10269 The default value is 10.
10270
10271 @item sched-mem-true-dep-cost
10272 Minimal distance (in CPU cycles) between store and load targeting same
10273 memory locations. The default value is 1.
10274
10275 @item selsched-max-lookahead
10276 The maximum size of the lookahead window of selective scheduling. It is a
10277 depth of search for available instructions.
10278 The default value is 50.
10279
10280 @item selsched-max-sched-times
10281 The maximum number of times that an instruction is scheduled during
10282 selective scheduling. This is the limit on the number of iterations
10283 through which the instruction may be pipelined. The default value is 2.
10284
10285 @item selsched-insns-to-rename
10286 The maximum number of best instructions in the ready list that are considered
10287 for renaming in the selective scheduler. The default value is 2.
10288
10289 @item sms-min-sc
10290 The minimum value of stage count that swing modulo scheduler
10291 generates. The default value is 2.
10292
10293 @item max-last-value-rtl
10294 The maximum size measured as number of RTLs that can be recorded in an expression
10295 in combiner for a pseudo register as last known value of that register. The default
10296 is 10000.
10297
10298 @item max-combine-insns
10299 The maximum number of instructions the RTL combiner tries to combine.
10300 The default value is 2 at @option{-Og} and 4 otherwise.
10301
10302 @item integer-share-limit
10303 Small integer constants can use a shared data structure, reducing the
10304 compiler's memory usage and increasing its speed. This sets the maximum
10305 value of a shared integer constant. The default value is 256.
10306
10307 @item ssp-buffer-size
10308 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10309 protection when @option{-fstack-protection} is used.
10310
10311 @item min-size-for-stack-sharing
10312 The minimum size of variables taking part in stack slot sharing when not
10313 optimizing. The default value is 32.
10314
10315 @item max-jump-thread-duplication-stmts
10316 Maximum number of statements allowed in a block that needs to be
10317 duplicated when threading jumps.
10318
10319 @item max-fields-for-field-sensitive
10320 Maximum number of fields in a structure treated in
10321 a field sensitive manner during pointer analysis. The default is zero
10322 for @option{-O0} and @option{-O1},
10323 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10324
10325 @item prefetch-latency
10326 Estimate on average number of instructions that are executed before
10327 prefetch finishes. The distance prefetched ahead is proportional
10328 to this constant. Increasing this number may also lead to less
10329 streams being prefetched (see @option{simultaneous-prefetches}).
10330
10331 @item simultaneous-prefetches
10332 Maximum number of prefetches that can run at the same time.
10333
10334 @item l1-cache-line-size
10335 The size of cache line in L1 cache, in bytes.
10336
10337 @item l1-cache-size
10338 The size of L1 cache, in kilobytes.
10339
10340 @item l2-cache-size
10341 The size of L2 cache, in kilobytes.
10342
10343 @item min-insn-to-prefetch-ratio
10344 The minimum ratio between the number of instructions and the
10345 number of prefetches to enable prefetching in a loop.
10346
10347 @item prefetch-min-insn-to-mem-ratio
10348 The minimum ratio between the number of instructions and the
10349 number of memory references to enable prefetching in a loop.
10350
10351 @item use-canonical-types
10352 Whether the compiler should use the ``canonical'' type system. By
10353 default, this should always be 1, which uses a more efficient internal
10354 mechanism for comparing types in C++ and Objective-C++. However, if
10355 bugs in the canonical type system are causing compilation failures,
10356 set this value to 0 to disable canonical types.
10357
10358 @item switch-conversion-max-branch-ratio
10359 Switch initialization conversion refuses to create arrays that are
10360 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10361 branches in the switch.
10362
10363 @item max-partial-antic-length
10364 Maximum length of the partial antic set computed during the tree
10365 partial redundancy elimination optimization (@option{-ftree-pre}) when
10366 optimizing at @option{-O3} and above. For some sorts of source code
10367 the enhanced partial redundancy elimination optimization can run away,
10368 consuming all of the memory available on the host machine. This
10369 parameter sets a limit on the length of the sets that are computed,
10370 which prevents the runaway behavior. Setting a value of 0 for
10371 this parameter allows an unlimited set length.
10372
10373 @item sccvn-max-scc-size
10374 Maximum size of a strongly connected component (SCC) during SCCVN
10375 processing. If this limit is hit, SCCVN processing for the whole
10376 function is not done and optimizations depending on it are
10377 disabled. The default maximum SCC size is 10000.
10378
10379 @item sccvn-max-alias-queries-per-access
10380 Maximum number of alias-oracle queries we perform when looking for
10381 redundancies for loads and stores. If this limit is hit the search
10382 is aborted and the load or store is not considered redundant. The
10383 number of queries is algorithmically limited to the number of
10384 stores on all paths from the load to the function entry.
10385 The default maximum number of queries is 1000.
10386
10387 @item ira-max-loops-num
10388 IRA uses regional register allocation by default. If a function
10389 contains more loops than the number given by this parameter, only at most
10390 the given number of the most frequently-executed loops form regions
10391 for regional register allocation. The default value of the
10392 parameter is 100.
10393
10394 @item ira-max-conflict-table-size
10395 Although IRA uses a sophisticated algorithm to compress the conflict
10396 table, the table can still require excessive amounts of memory for
10397 huge functions. If the conflict table for a function could be more
10398 than the size in MB given by this parameter, the register allocator
10399 instead uses a faster, simpler, and lower-quality
10400 algorithm that does not require building a pseudo-register conflict table.
10401 The default value of the parameter is 2000.
10402
10403 @item ira-loop-reserved-regs
10404 IRA can be used to evaluate more accurate register pressure in loops
10405 for decisions to move loop invariants (see @option{-O3}). The number
10406 of available registers reserved for some other purposes is given
10407 by this parameter. The default value of the parameter is 2, which is
10408 the minimal number of registers needed by typical instructions.
10409 This value is the best found from numerous experiments.
10410
10411 @item lra-inheritance-ebb-probability-cutoff
10412 LRA tries to reuse values reloaded in registers in subsequent insns.
10413 This optimization is called inheritance. EBB is used as a region to
10414 do this optimization. The parameter defines a minimal fall-through
10415 edge probability in percentage used to add BB to inheritance EBB in
10416 LRA. The default value of the parameter is 40. The value was chosen
10417 from numerous runs of SPEC2000 on x86-64.
10418
10419 @item loop-invariant-max-bbs-in-loop
10420 Loop invariant motion can be very expensive, both in compilation time and
10421 in amount of needed compile-time memory, with very large loops. Loops
10422 with more basic blocks than this parameter won't have loop invariant
10423 motion optimization performed on them. The default value of the
10424 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10425
10426 @item loop-max-datarefs-for-datadeps
10427 Building data dependencies is expensive for very large loops. This
10428 parameter limits the number of data references in loops that are
10429 considered for data dependence analysis. These large loops are no
10430 handled by the optimizations using loop data dependencies.
10431 The default value is 1000.
10432
10433 @item max-vartrack-size
10434 Sets a maximum number of hash table slots to use during variable
10435 tracking dataflow analysis of any function. If this limit is exceeded
10436 with variable tracking at assignments enabled, analysis for that
10437 function is retried without it, after removing all debug insns from
10438 the function. If the limit is exceeded even without debug insns, var
10439 tracking analysis is completely disabled for the function. Setting
10440 the parameter to zero makes it unlimited.
10441
10442 @item max-vartrack-expr-depth
10443 Sets a maximum number of recursion levels when attempting to map
10444 variable names or debug temporaries to value expressions. This trades
10445 compilation time for more complete debug information. If this is set too
10446 low, value expressions that are available and could be represented in
10447 debug information may end up not being used; setting this higher may
10448 enable the compiler to find more complex debug expressions, but compile
10449 time and memory use may grow. The default is 12.
10450
10451 @item min-nondebug-insn-uid
10452 Use uids starting at this parameter for nondebug insns. The range below
10453 the parameter is reserved exclusively for debug insns created by
10454 @option{-fvar-tracking-assignments}, but debug insns may get
10455 (non-overlapping) uids above it if the reserved range is exhausted.
10456
10457 @item ipa-sra-ptr-growth-factor
10458 IPA-SRA replaces a pointer to an aggregate with one or more new
10459 parameters only when their cumulative size is less or equal to
10460 @option{ipa-sra-ptr-growth-factor} times the size of the original
10461 pointer parameter.
10462
10463 @item sra-max-scalarization-size-Ospeed
10464 @item sra-max-scalarization-size-Osize
10465 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
10466 replace scalar parts of aggregates with uses of independent scalar
10467 variables. These parameters control the maximum size, in storage units,
10468 of aggregate which is considered for replacement when compiling for
10469 speed
10470 (@option{sra-max-scalarization-size-Ospeed}) or size
10471 (@option{sra-max-scalarization-size-Osize}) respectively.
10472
10473 @item tm-max-aggregate-size
10474 When making copies of thread-local variables in a transaction, this
10475 parameter specifies the size in bytes after which variables are
10476 saved with the logging functions as opposed to save/restore code
10477 sequence pairs. This option only applies when using
10478 @option{-fgnu-tm}.
10479
10480 @item graphite-max-nb-scop-params
10481 To avoid exponential effects in the Graphite loop transforms, the
10482 number of parameters in a Static Control Part (SCoP) is bounded. The
10483 default value is 10 parameters. A variable whose value is unknown at
10484 compilation time and defined outside a SCoP is a parameter of the SCoP.
10485
10486 @item graphite-max-bbs-per-function
10487 To avoid exponential effects in the detection of SCoPs, the size of
10488 the functions analyzed by Graphite is bounded. The default value is
10489 100 basic blocks.
10490
10491 @item loop-block-tile-size
10492 Loop blocking or strip mining transforms, enabled with
10493 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10494 loop in the loop nest by a given number of iterations. The strip
10495 length can be changed using the @option{loop-block-tile-size}
10496 parameter. The default value is 51 iterations.
10497
10498 @item loop-unroll-jam-size
10499 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
10500 default value is 4.
10501
10502 @item loop-unroll-jam-depth
10503 Specify the dimension to be unrolled (counting from the most inner loop)
10504 for the @option{-floop-unroll-and-jam}. The default value is 2.
10505
10506 @item ipa-cp-value-list-size
10507 IPA-CP attempts to track all possible values and types passed to a function's
10508 parameter in order to propagate them and perform devirtualization.
10509 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10510 stores per one formal parameter of a function.
10511
10512 @item ipa-cp-eval-threshold
10513 IPA-CP calculates its own score of cloning profitability heuristics
10514 and performs those cloning opportunities with scores that exceed
10515 @option{ipa-cp-eval-threshold}.
10516
10517 @item ipa-cp-recursion-penalty
10518 Percentage penalty the recursive functions will receive when they
10519 are evaluated for cloning.
10520
10521 @item ipa-cp-single-call-penalty
10522 Percentage penalty functions containing a single call to another
10523 function will receive when they are evaluated for cloning.
10524
10525
10526 @item ipa-max-agg-items
10527 IPA-CP is also capable to propagate a number of scalar values passed
10528 in an aggregate. @option{ipa-max-agg-items} controls the maximum
10529 number of such values per one parameter.
10530
10531 @item ipa-cp-loop-hint-bonus
10532 When IPA-CP determines that a cloning candidate would make the number
10533 of iterations of a loop known, it adds a bonus of
10534 @option{ipa-cp-loop-hint-bonus} to the profitability score of
10535 the candidate.
10536
10537 @item ipa-cp-array-index-hint-bonus
10538 When IPA-CP determines that a cloning candidate would make the index of
10539 an array access known, it adds a bonus of
10540 @option{ipa-cp-array-index-hint-bonus} to the profitability
10541 score of the candidate.
10542
10543 @item ipa-max-aa-steps
10544 During its analysis of function bodies, IPA-CP employs alias analysis
10545 in order to track values pointed to by function parameters. In order
10546 not spend too much time analyzing huge functions, it gives up and
10547 consider all memory clobbered after examining
10548 @option{ipa-max-aa-steps} statements modifying memory.
10549
10550 @item lto-partitions
10551 Specify desired number of partitions produced during WHOPR compilation.
10552 The number of partitions should exceed the number of CPUs used for compilation.
10553 The default value is 32.
10554
10555 @item lto-min-partition
10556 Size of minimal partition for WHOPR (in estimated instructions).
10557 This prevents expenses of splitting very small programs into too many
10558 partitions.
10559
10560 @item lto-max-partition
10561 Size of max partition for WHOPR (in estimated instructions).
10562 to provide an upper bound for individual size of partition.
10563 Meant to be used only with balanced partitioning.
10564
10565 @item cxx-max-namespaces-for-diagnostic-help
10566 The maximum number of namespaces to consult for suggestions when C++
10567 name lookup fails for an identifier. The default is 1000.
10568
10569 @item sink-frequency-threshold
10570 The maximum relative execution frequency (in percents) of the target block
10571 relative to a statement's original block to allow statement sinking of a
10572 statement. Larger numbers result in more aggressive statement sinking.
10573 The default value is 75. A small positive adjustment is applied for
10574 statements with memory operands as those are even more profitable so sink.
10575
10576 @item max-stores-to-sink
10577 The maximum number of conditional store pairs that can be sunk. Set to 0
10578 if either vectorization (@option{-ftree-vectorize}) or if-conversion
10579 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
10580
10581 @item allow-store-data-races
10582 Allow optimizers to introduce new data races on stores.
10583 Set to 1 to allow, otherwise to 0. This option is enabled by default
10584 at optimization level @option{-Ofast}.
10585
10586 @item case-values-threshold
10587 The smallest number of different values for which it is best to use a
10588 jump-table instead of a tree of conditional branches. If the value is
10589 0, use the default for the machine. The default is 0.
10590
10591 @item tree-reassoc-width
10592 Set the maximum number of instructions executed in parallel in
10593 reassociated tree. This parameter overrides target dependent
10594 heuristics used by default if has non zero value.
10595
10596 @item sched-pressure-algorithm
10597 Choose between the two available implementations of
10598 @option{-fsched-pressure}. Algorithm 1 is the original implementation
10599 and is the more likely to prevent instructions from being reordered.
10600 Algorithm 2 was designed to be a compromise between the relatively
10601 conservative approach taken by algorithm 1 and the rather aggressive
10602 approach taken by the default scheduler. It relies more heavily on
10603 having a regular register file and accurate register pressure classes.
10604 See @file{haifa-sched.c} in the GCC sources for more details.
10605
10606 The default choice depends on the target.
10607
10608 @item max-slsr-cand-scan
10609 Set the maximum number of existing candidates that are considered when
10610 seeking a basis for a new straight-line strength reduction candidate.
10611
10612 @item asan-globals
10613 Enable buffer overflow detection for global objects. This kind
10614 of protection is enabled by default if you are using
10615 @option{-fsanitize=address} option.
10616 To disable global objects protection use @option{--param asan-globals=0}.
10617
10618 @item asan-stack
10619 Enable buffer overflow detection for stack objects. This kind of
10620 protection is enabled by default when using @option{-fsanitize=address}.
10621 To disable stack protection use @option{--param asan-stack=0} option.
10622
10623 @item asan-instrument-reads
10624 Enable buffer overflow detection for memory reads. This kind of
10625 protection is enabled by default when using @option{-fsanitize=address}.
10626 To disable memory reads protection use
10627 @option{--param asan-instrument-reads=0}.
10628
10629 @item asan-instrument-writes
10630 Enable buffer overflow detection for memory writes. This kind of
10631 protection is enabled by default when using @option{-fsanitize=address}.
10632 To disable memory writes protection use
10633 @option{--param asan-instrument-writes=0} option.
10634
10635 @item asan-memintrin
10636 Enable detection for built-in functions. This kind of protection
10637 is enabled by default when using @option{-fsanitize=address}.
10638 To disable built-in functions protection use
10639 @option{--param asan-memintrin=0}.
10640
10641 @item asan-use-after-return
10642 Enable detection of use-after-return. This kind of protection
10643 is enabled by default when using the @option{-fsanitize=address} option.
10644 To disable it use @option{--param asan-use-after-return=0}.
10645
10646 Note: By default the check is disabled at run time. To enable it,
10647 add @code{detect_stack_use_after_return=1} to the environment variable
10648 @env{ASAN_OPTIONS}.
10649
10650 @item asan-instrumentation-with-call-threshold
10651 If number of memory accesses in function being instrumented
10652 is greater or equal to this number, use callbacks instead of inline checks.
10653 E.g. to disable inline code use
10654 @option{--param asan-instrumentation-with-call-threshold=0}.
10655
10656 @item use-after-scope-direct-emission-threshold
10657 If the size of a local variable in bytes is smaller or equal to this
10658 number, directly poison (or unpoison) shadow memory instead of using
10659 run-time callbacks. The default value is 256.
10660
10661 @item chkp-max-ctor-size
10662 Static constructors generated by Pointer Bounds Checker may become very
10663 large and significantly increase compile time at optimization level
10664 @option{-O1} and higher. This parameter is a maximum number of statements
10665 in a single generated constructor. Default value is 5000.
10666
10667 @item max-fsm-thread-path-insns
10668 Maximum number of instructions to copy when duplicating blocks on a
10669 finite state automaton jump thread path. The default is 100.
10670
10671 @item max-fsm-thread-length
10672 Maximum number of basic blocks on a finite state automaton jump thread
10673 path. The default is 10.
10674
10675 @item max-fsm-thread-paths
10676 Maximum number of new jump thread paths to create for a finite state
10677 automaton. The default is 50.
10678
10679 @item parloops-chunk-size
10680 Chunk size of omp schedule for loops parallelized by parloops. The default
10681 is 0.
10682
10683 @item parloops-schedule
10684 Schedule type of omp schedule for loops parallelized by parloops (static,
10685 dynamic, guided, auto, runtime). The default is static.
10686
10687 @item max-ssa-name-query-depth
10688 Maximum depth of recursion when querying properties of SSA names in things
10689 like fold routines. One level of recursion corresponds to following a
10690 use-def chain.
10691
10692 @item hsa-gen-debug-stores
10693 Enable emission of special debug stores within HSA kernels which are
10694 then read and reported by libgomp plugin. Generation of these stores
10695 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
10696 enable it.
10697
10698 @item max-speculative-devirt-maydefs
10699 The maximum number of may-defs we analyze when looking for a must-def
10700 specifying the dynamic type of an object that invokes a virtual call
10701 we may be able to devirtualize speculatively.
10702
10703 @item max-vrp-switch-assertions
10704 The maximum number of assertions to add along the default edge of a switch
10705 statement during VRP. The default is 10.
10706 @end table
10707 @end table
10708
10709 @node Instrumentation Options
10710 @section Program Instrumentation Options
10711 @cindex instrumentation options
10712 @cindex program instrumentation options
10713 @cindex run-time error checking options
10714 @cindex profiling options
10715 @cindex options, program instrumentation
10716 @cindex options, run-time error checking
10717 @cindex options, profiling
10718
10719 GCC supports a number of command-line options that control adding
10720 run-time instrumentation to the code it normally generates.
10721 For example, one purpose of instrumentation is collect profiling
10722 statistics for use in finding program hot spots, code coverage
10723 analysis, or profile-guided optimizations.
10724 Another class of program instrumentation is adding run-time checking
10725 to detect programming errors like invalid pointer
10726 dereferences or out-of-bounds array accesses, as well as deliberately
10727 hostile attacks such as stack smashing or C++ vtable hijacking.
10728 There is also a general hook which can be used to implement other
10729 forms of tracing or function-level instrumentation for debug or
10730 program analysis purposes.
10731
10732 @table @gcctabopt
10733 @cindex @command{prof}
10734 @item -p
10735 @opindex p
10736 Generate extra code to write profile information suitable for the
10737 analysis program @command{prof}. You must use this option when compiling
10738 the source files you want data about, and you must also use it when
10739 linking.
10740
10741 @cindex @command{gprof}
10742 @item -pg
10743 @opindex pg
10744 Generate extra code to write profile information suitable for the
10745 analysis program @command{gprof}. You must use this option when compiling
10746 the source files you want data about, and you must also use it when
10747 linking.
10748
10749 @item -fprofile-arcs
10750 @opindex fprofile-arcs
10751 Add code so that program flow @dfn{arcs} are instrumented. During
10752 execution the program records how many times each branch and call is
10753 executed and how many times it is taken or returns. On targets that support
10754 constructors with priority support, profiling properly handles constructors,
10755 destructors and C++ constructors (and destructors) of classes which are used
10756 as a type of a global variable.
10757
10758 When the compiled
10759 program exits it saves this data to a file called
10760 @file{@var{auxname}.gcda} for each source file. The data may be used for
10761 profile-directed optimizations (@option{-fbranch-probabilities}), or for
10762 test coverage analysis (@option{-ftest-coverage}). Each object file's
10763 @var{auxname} is generated from the name of the output file, if
10764 explicitly specified and it is not the final executable, otherwise it is
10765 the basename of the source file. In both cases any suffix is removed
10766 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
10767 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
10768 @xref{Cross-profiling}.
10769
10770 @cindex @command{gcov}
10771 @item --coverage
10772 @opindex coverage
10773
10774 This option is used to compile and link code instrumented for coverage
10775 analysis. The option is a synonym for @option{-fprofile-arcs}
10776 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
10777 linking). See the documentation for those options for more details.
10778
10779 @itemize
10780
10781 @item
10782 Compile the source files with @option{-fprofile-arcs} plus optimization
10783 and code generation options. For test coverage analysis, use the
10784 additional @option{-ftest-coverage} option. You do not need to profile
10785 every source file in a program.
10786
10787 @item
10788 Compile the source files additionally with @option{-fprofile-abs-path}
10789 to create absolute path names in the @file{.gcno} files. This allows
10790 @command{gcov} to find the correct sources in projects where compilations
10791 occur with different working directories.
10792
10793 @item
10794 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
10795 (the latter implies the former).
10796
10797 @item
10798 Run the program on a representative workload to generate the arc profile
10799 information. This may be repeated any number of times. You can run
10800 concurrent instances of your program, and provided that the file system
10801 supports locking, the data files will be correctly updated. Also
10802 @code{fork} calls are detected and correctly handled (double counting
10803 will not happen).
10804
10805 @item
10806 For profile-directed optimizations, compile the source files again with
10807 the same optimization and code generation options plus
10808 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
10809 Control Optimization}).
10810
10811 @item
10812 For test coverage analysis, use @command{gcov} to produce human readable
10813 information from the @file{.gcno} and @file{.gcda} files. Refer to the
10814 @command{gcov} documentation for further information.
10815
10816 @end itemize
10817
10818 With @option{-fprofile-arcs}, for each function of your program GCC
10819 creates a program flow graph, then finds a spanning tree for the graph.
10820 Only arcs that are not on the spanning tree have to be instrumented: the
10821 compiler adds code to count the number of times that these arcs are
10822 executed. When an arc is the only exit or only entrance to a block, the
10823 instrumentation code can be added to the block; otherwise, a new basic
10824 block must be created to hold the instrumentation code.
10825
10826 @need 2000
10827 @item -ftest-coverage
10828 @opindex ftest-coverage
10829 Produce a notes file that the @command{gcov} code-coverage utility
10830 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
10831 show program coverage. Each source file's note file is called
10832 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
10833 above for a description of @var{auxname} and instructions on how to
10834 generate test coverage data. Coverage data matches the source files
10835 more closely if you do not optimize.
10836
10837 @item -fprofile-abs-path
10838 @opindex fprofile-abs-path
10839 Automatically convert relative source file names to absolute path names
10840 in the @file{.gcno} files. This allows @command{gcov} to find the correct
10841 sources in projects where compilations occur with different working
10842 directories.
10843
10844 @item -fprofile-dir=@var{path}
10845 @opindex fprofile-dir
10846
10847 Set the directory to search for the profile data files in to @var{path}.
10848 This option affects only the profile data generated by
10849 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
10850 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
10851 and its related options. Both absolute and relative paths can be used.
10852 By default, GCC uses the current directory as @var{path}, thus the
10853 profile data file appears in the same directory as the object file.
10854
10855 @item -fprofile-generate
10856 @itemx -fprofile-generate=@var{path}
10857 @opindex fprofile-generate
10858
10859 Enable options usually used for instrumenting application to produce
10860 profile useful for later recompilation with profile feedback based
10861 optimization. You must use @option{-fprofile-generate} both when
10862 compiling and when linking your program.
10863
10864 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
10865
10866 If @var{path} is specified, GCC looks at the @var{path} to find
10867 the profile feedback data files. See @option{-fprofile-dir}.
10868
10869 To optimize the program based on the collected profile information, use
10870 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
10871
10872 @item -fprofile-update=@var{method}
10873 @opindex fprofile-update
10874
10875 Alter the update method for an application instrumented for profile
10876 feedback based optimization. The @var{method} argument should be one of
10877 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
10878 The first one is useful for single-threaded applications,
10879 while the second one prevents profile corruption by emitting thread-safe code.
10880
10881 @strong{Warning:} When an application does not properly join all threads
10882 (or creates an detached thread), a profile file can be still corrupted.
10883
10884 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
10885 when supported by a target, or to @samp{single} otherwise. The GCC driver
10886 automatically selects @samp{prefer-atomic} when @option{-pthread}
10887 is present in the command line.
10888
10889 @item -fsanitize=address
10890 @opindex fsanitize=address
10891 Enable AddressSanitizer, a fast memory error detector.
10892 Memory access instructions are instrumented to detect
10893 out-of-bounds and use-after-free bugs.
10894 The option enables @option{-fsanitize-address-use-after-scope}.
10895 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
10896 more details. The run-time behavior can be influenced using the
10897 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
10898 the available options are shown at startup of the instrumented program. See
10899 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
10900 for a list of supported options.
10901 The option cannot be combined with @option{-fsanitize=thread}
10902 and/or @option{-fcheck-pointer-bounds}.
10903
10904 @item -fsanitize=kernel-address
10905 @opindex fsanitize=kernel-address
10906 Enable AddressSanitizer for Linux kernel.
10907 See @uref{https://github.com/google/kasan/wiki} for more details.
10908 The option cannot be combined with @option{-fcheck-pointer-bounds}.
10909
10910 @item -fsanitize=thread
10911 @opindex fsanitize=thread
10912 Enable ThreadSanitizer, a fast data race detector.
10913 Memory access instructions are instrumented to detect
10914 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
10915 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
10916 environment variable; see
10917 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
10918 supported options.
10919 The option cannot be combined with @option{-fsanitize=address},
10920 @option{-fsanitize=leak} and/or @option{-fcheck-pointer-bounds}.
10921
10922 Note that sanitized atomic builtins cannot throw exceptions when
10923 operating on invalid memory addresses with non-call exceptions
10924 (@option{-fnon-call-exceptions}).
10925
10926 @item -fsanitize=leak
10927 @opindex fsanitize=leak
10928 Enable LeakSanitizer, a memory leak detector.
10929 This option only matters for linking of executables and
10930 the executable is linked against a library that overrides @code{malloc}
10931 and other allocator functions. See
10932 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
10933 details. The run-time behavior can be influenced using the
10934 @env{LSAN_OPTIONS} environment variable.
10935 The option cannot be combined with @option{-fsanitize=thread}.
10936
10937 @item -fsanitize=undefined
10938 @opindex fsanitize=undefined
10939 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
10940 Various computations are instrumented to detect undefined behavior
10941 at runtime. Current suboptions are:
10942
10943 @table @gcctabopt
10944
10945 @item -fsanitize=shift
10946 @opindex fsanitize=shift
10947 This option enables checking that the result of a shift operation is
10948 not undefined. Note that what exactly is considered undefined differs
10949 slightly between C and C++, as well as between ISO C90 and C99, etc.
10950 This option has two suboptions, @option{-fsanitize=shift-base} and
10951 @option{-fsanitize=shift-exponent}.
10952
10953 @item -fsanitize=shift-exponent
10954 @opindex fsanitize=shift-exponent
10955 This option enables checking that the second argument of a shift operation
10956 is not negative and is smaller than the precision of the promoted first
10957 argument.
10958
10959 @item -fsanitize=shift-base
10960 @opindex fsanitize=shift-base
10961 If the second argument of a shift operation is within range, check that the
10962 result of a shift operation is not undefined. Note that what exactly is
10963 considered undefined differs slightly between C and C++, as well as between
10964 ISO C90 and C99, etc.
10965
10966 @item -fsanitize=integer-divide-by-zero
10967 @opindex fsanitize=integer-divide-by-zero
10968 Detect integer division by zero as well as @code{INT_MIN / -1} division.
10969
10970 @item -fsanitize=unreachable
10971 @opindex fsanitize=unreachable
10972 With this option, the compiler turns the @code{__builtin_unreachable}
10973 call into a diagnostics message call instead. When reaching the
10974 @code{__builtin_unreachable} call, the behavior is undefined.
10975
10976 @item -fsanitize=vla-bound
10977 @opindex fsanitize=vla-bound
10978 This option instructs the compiler to check that the size of a variable
10979 length array is positive.
10980
10981 @item -fsanitize=null
10982 @opindex fsanitize=null
10983 This option enables pointer checking. Particularly, the application
10984 built with this option turned on will issue an error message when it
10985 tries to dereference a NULL pointer, or if a reference (possibly an
10986 rvalue reference) is bound to a NULL pointer, or if a method is invoked
10987 on an object pointed by a NULL pointer.
10988
10989 @item -fsanitize=return
10990 @opindex fsanitize=return
10991 This option enables return statement checking. Programs
10992 built with this option turned on will issue an error message
10993 when the end of a non-void function is reached without actually
10994 returning a value. This option works in C++ only.
10995
10996 @item -fsanitize=signed-integer-overflow
10997 @opindex fsanitize=signed-integer-overflow
10998 This option enables signed integer overflow checking. We check that
10999 the result of @code{+}, @code{*}, and both unary and binary @code{-}
11000 does not overflow in the signed arithmetics. Note, integer promotion
11001 rules must be taken into account. That is, the following is not an
11002 overflow:
11003 @smallexample
11004 signed char a = SCHAR_MAX;
11005 a++;
11006 @end smallexample
11007
11008 @item -fsanitize=bounds
11009 @opindex fsanitize=bounds
11010 This option enables instrumentation of array bounds. Various out of bounds
11011 accesses are detected. Flexible array members, flexible array member-like
11012 arrays, and initializers of variables with static storage are not instrumented.
11013 The option cannot be combined with @option{-fcheck-pointer-bounds}.
11014
11015 @item -fsanitize=bounds-strict
11016 @opindex fsanitize=bounds-strict
11017 This option enables strict instrumentation of array bounds. Most out of bounds
11018 accesses are detected, including flexible array members and flexible array
11019 member-like arrays. Initializers of variables with static storage are not
11020 instrumented. The option cannot be combined
11021 with @option{-fcheck-pointer-bounds}.
11022
11023 @item -fsanitize=alignment
11024 @opindex fsanitize=alignment
11025
11026 This option enables checking of alignment of pointers when they are
11027 dereferenced, or when a reference is bound to insufficiently aligned target,
11028 or when a method or constructor is invoked on insufficiently aligned object.
11029
11030 @item -fsanitize=object-size
11031 @opindex fsanitize=object-size
11032 This option enables instrumentation of memory references using the
11033 @code{__builtin_object_size} function. Various out of bounds pointer
11034 accesses are detected.
11035
11036 @item -fsanitize=float-divide-by-zero
11037 @opindex fsanitize=float-divide-by-zero
11038 Detect floating-point division by zero. Unlike other similar options,
11039 @option{-fsanitize=float-divide-by-zero} is not enabled by
11040 @option{-fsanitize=undefined}, since floating-point division by zero can
11041 be a legitimate way of obtaining infinities and NaNs.
11042
11043 @item -fsanitize=float-cast-overflow
11044 @opindex fsanitize=float-cast-overflow
11045 This option enables floating-point type to integer conversion checking.
11046 We check that the result of the conversion does not overflow.
11047 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
11048 not enabled by @option{-fsanitize=undefined}.
11049 This option does not work well with @code{FE_INVALID} exceptions enabled.
11050
11051 @item -fsanitize=nonnull-attribute
11052 @opindex fsanitize=nonnull-attribute
11053
11054 This option enables instrumentation of calls, checking whether null values
11055 are not passed to arguments marked as requiring a non-null value by the
11056 @code{nonnull} function attribute.
11057
11058 @item -fsanitize=returns-nonnull-attribute
11059 @opindex fsanitize=returns-nonnull-attribute
11060
11061 This option enables instrumentation of return statements in functions
11062 marked with @code{returns_nonnull} function attribute, to detect returning
11063 of null values from such functions.
11064
11065 @item -fsanitize=bool
11066 @opindex fsanitize=bool
11067
11068 This option enables instrumentation of loads from bool. If a value other
11069 than 0/1 is loaded, a run-time error is issued.
11070
11071 @item -fsanitize=enum
11072 @opindex fsanitize=enum
11073
11074 This option enables instrumentation of loads from an enum type. If
11075 a value outside the range of values for the enum type is loaded,
11076 a run-time error is issued.
11077
11078 @item -fsanitize=vptr
11079 @opindex fsanitize=vptr
11080
11081 This option enables instrumentation of C++ member function calls, member
11082 accesses and some conversions between pointers to base and derived classes,
11083 to verify the referenced object has the correct dynamic type.
11084
11085 @item -fsanitize=pointer-overflow
11086 @opindex fsanitize=pointer-overflow
11087
11088 This option enables instrumentation of pointer arithmetics. If the pointer
11089 arithmetics overflows, a run-time error is issued.
11090
11091 @end table
11092
11093 While @option{-ftrapv} causes traps for signed overflows to be emitted,
11094 @option{-fsanitize=undefined} gives a diagnostic message.
11095 This currently works only for the C family of languages.
11096
11097 @item -fno-sanitize=all
11098 @opindex fno-sanitize=all
11099
11100 This option disables all previously enabled sanitizers.
11101 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
11102 together.
11103
11104 @item -fasan-shadow-offset=@var{number}
11105 @opindex fasan-shadow-offset
11106 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
11107 It is useful for experimenting with different shadow memory layouts in
11108 Kernel AddressSanitizer.
11109
11110 @item -fsanitize-sections=@var{s1},@var{s2},...
11111 @opindex fsanitize-sections
11112 Sanitize global variables in selected user-defined sections. @var{si} may
11113 contain wildcards.
11114
11115 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
11116 @opindex fsanitize-recover
11117 @opindex fno-sanitize-recover
11118 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
11119 mentioned in comma-separated list of @var{opts}. Enabling this option
11120 for a sanitizer component causes it to attempt to continue
11121 running the program as if no error happened. This means multiple
11122 runtime errors can be reported in a single program run, and the exit
11123 code of the program may indicate success even when errors
11124 have been reported. The @option{-fno-sanitize-recover=} option
11125 can be used to alter
11126 this behavior: only the first detected error is reported
11127 and program then exits with a non-zero exit code.
11128
11129 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
11130 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
11131 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
11132 @option{-fsanitize=bounds-strict},
11133 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
11134 For these sanitizers error recovery is turned on by default,
11135 except @option{-fsanitize=address}, for which this feature is experimental.
11136 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
11137 accepted, the former enables recovery for all sanitizers that support it,
11138 the latter disables recovery for all sanitizers that support it.
11139
11140 Even if a recovery mode is turned on the compiler side, it needs to be also
11141 enabled on the runtime library side, otherwise the failures are still fatal.
11142 The runtime library defaults to @code{halt_on_error=0} for
11143 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
11144 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
11145 setting the @code{halt_on_error} flag in the corresponding environment variable.
11146
11147 Syntax without an explicit @var{opts} parameter is deprecated. It is
11148 equivalent to specifying an @var{opts} list of:
11149
11150 @smallexample
11151 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
11152 @end smallexample
11153
11154 @item -fsanitize-address-use-after-scope
11155 @opindex fsanitize-address-use-after-scope
11156 Enable sanitization of local variables to detect use-after-scope bugs.
11157 The option sets @option{-fstack-reuse} to @samp{none}.
11158
11159 @item -fsanitize-undefined-trap-on-error
11160 @opindex fsanitize-undefined-trap-on-error
11161 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
11162 report undefined behavior using @code{__builtin_trap} rather than
11163 a @code{libubsan} library routine. The advantage of this is that the
11164 @code{libubsan} library is not needed and is not linked in, so this
11165 is usable even in freestanding environments.
11166
11167 @item -fsanitize-coverage=trace-pc
11168 @opindex fsanitize-coverage=trace-pc
11169 Enable coverage-guided fuzzing code instrumentation.
11170 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
11171
11172 @item -fsanitize-coverage=trace-cmp
11173 @opindex fsanitize-coverage=trace-cmp
11174 Enable dataflow guided fuzzing code instrumentation.
11175 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
11176 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
11177 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
11178 variable or @code{__sanitizer_cov_trace_const_cmp1},
11179 @code{__sanitizer_cov_trace_const_cmp2},
11180 @code{__sanitizer_cov_trace_const_cmp4} or
11181 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
11182 operand constant, @code{__sanitizer_cov_trace_cmpf} or
11183 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
11184 @code{__sanitizer_cov_trace_switch} for switch statements.
11185
11186 @item -fbounds-check
11187 @opindex fbounds-check
11188 For front ends that support it, generate additional code to check that
11189 indices used to access arrays are within the declared range. This is
11190 currently only supported by the Fortran front end, where this option
11191 defaults to false.
11192
11193 @item -fcheck-pointer-bounds
11194 @opindex fcheck-pointer-bounds
11195 @opindex fno-check-pointer-bounds
11196 @cindex Pointer Bounds Checker options
11197 Enable Pointer Bounds Checker instrumentation. Each memory reference
11198 is instrumented with checks of the pointer used for memory access against
11199 bounds associated with that pointer.
11200
11201 Currently there
11202 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
11203 and @option{-mmpx} are required to enable this feature.
11204 MPX-based instrumentation requires
11205 a runtime library to enable MPX in hardware and handle bounds
11206 violation signals. By default when @option{-fcheck-pointer-bounds}
11207 and @option{-mmpx} options are used to link a program, the GCC driver
11208 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
11209 Bounds checking on calls to dynamic libraries requires a linker
11210 with @option{-z bndplt} support; if GCC was configured with a linker
11211 without support for this option (including the Gold linker and older
11212 versions of ld), a warning is given if you link with @option{-mmpx}
11213 without also specifying @option{-static}, since the overall effectiveness
11214 of the bounds checking protection is reduced.
11215 See also @option{-static-libmpxwrappers}.
11216
11217 MPX-based instrumentation
11218 may be used for debugging and also may be included in production code
11219 to increase program security. Depending on usage, you may
11220 have different requirements for the runtime library. The current version
11221 of the MPX runtime library is more oriented for use as a debugging
11222 tool. MPX runtime library usage implies @option{-lpthread}. See
11223 also @option{-static-libmpx}. The runtime library behavior can be
11224 influenced using various @env{CHKP_RT_*} environment variables. See
11225 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
11226 for more details.
11227
11228 Generated instrumentation may be controlled by various
11229 @option{-fchkp-*} options and by the @code{bnd_variable_size}
11230 structure field attribute (@pxref{Type Attributes}) and
11231 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
11232 (@pxref{Function Attributes}). GCC also provides a number of built-in
11233 functions for controlling the Pointer Bounds Checker. @xref{Pointer
11234 Bounds Checker builtins}, for more information.
11235
11236 @item -fchkp-check-incomplete-type
11237 @opindex fchkp-check-incomplete-type
11238 @opindex fno-chkp-check-incomplete-type
11239 Generate pointer bounds checks for variables with incomplete type.
11240 Enabled by default.
11241
11242 @item -fchkp-narrow-bounds
11243 @opindex fchkp-narrow-bounds
11244 @opindex fno-chkp-narrow-bounds
11245 Controls bounds used by Pointer Bounds Checker for pointers to object
11246 fields. If narrowing is enabled then field bounds are used. Otherwise
11247 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
11248 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
11249
11250 @item -fchkp-first-field-has-own-bounds
11251 @opindex fchkp-first-field-has-own-bounds
11252 @opindex fno-chkp-first-field-has-own-bounds
11253 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
11254 first field in the structure. By default a pointer to the first field has
11255 the same bounds as a pointer to the whole structure.
11256
11257 @item -fchkp-flexible-struct-trailing-arrays
11258 @opindex fchkp-flexible-struct-trailing-arrays
11259 @opindex fno-chkp-flexible-struct-trailing-arrays
11260 Forces Pointer Bounds Checker to treat all trailing arrays in structures as
11261 possibly flexible. By default only array fields with zero length or that are
11262 marked with attribute bnd_variable_size are treated as flexible.
11263
11264 @item -fchkp-narrow-to-innermost-array
11265 @opindex fchkp-narrow-to-innermost-array
11266 @opindex fno-chkp-narrow-to-innermost-array
11267 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
11268 case of nested static array access. By default this option is disabled and
11269 bounds of the outermost array are used.
11270
11271 @item -fchkp-optimize
11272 @opindex fchkp-optimize
11273 @opindex fno-chkp-optimize
11274 Enables Pointer Bounds Checker optimizations. Enabled by default at
11275 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
11276
11277 @item -fchkp-use-fast-string-functions
11278 @opindex fchkp-use-fast-string-functions
11279 @opindex fno-chkp-use-fast-string-functions
11280 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
11281 by Pointer Bounds Checker. Disabled by default.
11282
11283 @item -fchkp-use-nochk-string-functions
11284 @opindex fchkp-use-nochk-string-functions
11285 @opindex fno-chkp-use-nochk-string-functions
11286 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
11287 by Pointer Bounds Checker. Disabled by default.
11288
11289 @item -fchkp-use-static-bounds
11290 @opindex fchkp-use-static-bounds
11291 @opindex fno-chkp-use-static-bounds
11292 Allow Pointer Bounds Checker to generate static bounds holding
11293 bounds of static variables. Enabled by default.
11294
11295 @item -fchkp-use-static-const-bounds
11296 @opindex fchkp-use-static-const-bounds
11297 @opindex fno-chkp-use-static-const-bounds
11298 Use statically-initialized bounds for constant bounds instead of
11299 generating them each time they are required. By default enabled when
11300 @option{-fchkp-use-static-bounds} is enabled.
11301
11302 @item -fchkp-treat-zero-dynamic-size-as-infinite
11303 @opindex fchkp-treat-zero-dynamic-size-as-infinite
11304 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
11305 With this option, objects with incomplete type whose
11306 dynamically-obtained size is zero are treated as having infinite size
11307 instead by Pointer Bounds
11308 Checker. This option may be helpful if a program is linked with a library
11309 missing size information for some symbols. Disabled by default.
11310
11311 @item -fchkp-check-read
11312 @opindex fchkp-check-read
11313 @opindex fno-chkp-check-read
11314 Instructs Pointer Bounds Checker to generate checks for all read
11315 accesses to memory. Enabled by default.
11316
11317 @item -fchkp-check-write
11318 @opindex fchkp-check-write
11319 @opindex fno-chkp-check-write
11320 Instructs Pointer Bounds Checker to generate checks for all write
11321 accesses to memory. Enabled by default.
11322
11323 @item -fchkp-store-bounds
11324 @opindex fchkp-store-bounds
11325 @opindex fno-chkp-store-bounds
11326 Instructs Pointer Bounds Checker to generate bounds stores for
11327 pointer writes. Enabled by default.
11328
11329 @item -fchkp-instrument-calls
11330 @opindex fchkp-instrument-calls
11331 @opindex fno-chkp-instrument-calls
11332 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
11333 Enabled by default.
11334
11335 @item -fchkp-instrument-marked-only
11336 @opindex fchkp-instrument-marked-only
11337 @opindex fno-chkp-instrument-marked-only
11338 Instructs Pointer Bounds Checker to instrument only functions
11339 marked with the @code{bnd_instrument} attribute
11340 (@pxref{Function Attributes}). Disabled by default.
11341
11342 @item -fchkp-use-wrappers
11343 @opindex fchkp-use-wrappers
11344 @opindex fno-chkp-use-wrappers
11345 Allows Pointer Bounds Checker to replace calls to built-in functions
11346 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
11347 is used to link a program, the GCC driver automatically links
11348 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
11349 Enabled by default.
11350
11351 @item -fstack-protector
11352 @opindex fstack-protector
11353 Emit extra code to check for buffer overflows, such as stack smashing
11354 attacks. This is done by adding a guard variable to functions with
11355 vulnerable objects. This includes functions that call @code{alloca}, and
11356 functions with buffers larger than 8 bytes. The guards are initialized
11357 when a function is entered and then checked when the function exits.
11358 If a guard check fails, an error message is printed and the program exits.
11359
11360 @item -fstack-protector-all
11361 @opindex fstack-protector-all
11362 Like @option{-fstack-protector} except that all functions are protected.
11363
11364 @item -fstack-protector-strong
11365 @opindex fstack-protector-strong
11366 Like @option{-fstack-protector} but includes additional functions to
11367 be protected --- those that have local array definitions, or have
11368 references to local frame addresses.
11369
11370 @item -fstack-protector-explicit
11371 @opindex fstack-protector-explicit
11372 Like @option{-fstack-protector} but only protects those functions which
11373 have the @code{stack_protect} attribute.
11374
11375 @item -fstack-check
11376 @opindex fstack-check
11377 Generate code to verify that you do not go beyond the boundary of the
11378 stack. You should specify this flag if you are running in an
11379 environment with multiple threads, but you only rarely need to specify it in
11380 a single-threaded environment since stack overflow is automatically
11381 detected on nearly all systems if there is only one stack.
11382
11383 Note that this switch does not actually cause checking to be done; the
11384 operating system or the language runtime must do that. The switch causes
11385 generation of code to ensure that they see the stack being extended.
11386
11387 You can additionally specify a string parameter: @samp{no} means no
11388 checking, @samp{generic} means force the use of old-style checking,
11389 @samp{specific} means use the best checking method and is equivalent
11390 to bare @option{-fstack-check}.
11391
11392 Old-style checking is a generic mechanism that requires no specific
11393 target support in the compiler but comes with the following drawbacks:
11394
11395 @enumerate
11396 @item
11397 Modified allocation strategy for large objects: they are always
11398 allocated dynamically if their size exceeds a fixed threshold.
11399
11400 @item
11401 Fixed limit on the size of the static frame of functions: when it is
11402 topped by a particular function, stack checking is not reliable and
11403 a warning is issued by the compiler.
11404
11405 @item
11406 Inefficiency: because of both the modified allocation strategy and the
11407 generic implementation, code performance is hampered.
11408 @end enumerate
11409
11410 Note that old-style stack checking is also the fallback method for
11411 @samp{specific} if no target support has been added in the compiler.
11412
11413 @item -fstack-limit-register=@var{reg}
11414 @itemx -fstack-limit-symbol=@var{sym}
11415 @itemx -fno-stack-limit
11416 @opindex fstack-limit-register
11417 @opindex fstack-limit-symbol
11418 @opindex fno-stack-limit
11419 Generate code to ensure that the stack does not grow beyond a certain value,
11420 either the value of a register or the address of a symbol. If a larger
11421 stack is required, a signal is raised at run time. For most targets,
11422 the signal is raised before the stack overruns the boundary, so
11423 it is possible to catch the signal without taking special precautions.
11424
11425 For instance, if the stack starts at absolute address @samp{0x80000000}
11426 and grows downwards, you can use the flags
11427 @option{-fstack-limit-symbol=__stack_limit} and
11428 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11429 of 128KB@. Note that this may only work with the GNU linker.
11430
11431 You can locally override stack limit checking by using the
11432 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
11433
11434 @item -fsplit-stack
11435 @opindex fsplit-stack
11436 Generate code to automatically split the stack before it overflows.
11437 The resulting program has a discontiguous stack which can only
11438 overflow if the program is unable to allocate any more memory. This
11439 is most useful when running threaded programs, as it is no longer
11440 necessary to calculate a good stack size to use for each thread. This
11441 is currently only implemented for the x86 targets running
11442 GNU/Linux.
11443
11444 When code compiled with @option{-fsplit-stack} calls code compiled
11445 without @option{-fsplit-stack}, there may not be much stack space
11446 available for the latter code to run. If compiling all code,
11447 including library code, with @option{-fsplit-stack} is not an option,
11448 then the linker can fix up these calls so that the code compiled
11449 without @option{-fsplit-stack} always has a large stack. Support for
11450 this is implemented in the gold linker in GNU binutils release 2.21
11451 and later.
11452
11453 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
11454 @opindex fvtable-verify
11455 This option is only available when compiling C++ code.
11456 It turns on (or off, if using @option{-fvtable-verify=none}) the security
11457 feature that verifies at run time, for every virtual call, that
11458 the vtable pointer through which the call is made is valid for the type of
11459 the object, and has not been corrupted or overwritten. If an invalid vtable
11460 pointer is detected at run time, an error is reported and execution of the
11461 program is immediately halted.
11462
11463 This option causes run-time data structures to be built at program startup,
11464 which are used for verifying the vtable pointers.
11465 The options @samp{std} and @samp{preinit}
11466 control the timing of when these data structures are built. In both cases the
11467 data structures are built before execution reaches @code{main}. Using
11468 @option{-fvtable-verify=std} causes the data structures to be built after
11469 shared libraries have been loaded and initialized.
11470 @option{-fvtable-verify=preinit} causes them to be built before shared
11471 libraries have been loaded and initialized.
11472
11473 If this option appears multiple times in the command line with different
11474 values specified, @samp{none} takes highest priority over both @samp{std} and
11475 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
11476
11477 @item -fvtv-debug
11478 @opindex fvtv-debug
11479 When used in conjunction with @option{-fvtable-verify=std} or
11480 @option{-fvtable-verify=preinit}, causes debug versions of the
11481 runtime functions for the vtable verification feature to be called.
11482 This flag also causes the compiler to log information about which
11483 vtable pointers it finds for each class.
11484 This information is written to a file named @file{vtv_set_ptr_data.log}
11485 in the directory named by the environment variable @env{VTV_LOGS_DIR}
11486 if that is defined or the current working directory otherwise.
11487
11488 Note: This feature @emph{appends} data to the log file. If you want a fresh log
11489 file, be sure to delete any existing one.
11490
11491 @item -fvtv-counts
11492 @opindex fvtv-counts
11493 This is a debugging flag. When used in conjunction with
11494 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
11495 causes the compiler to keep track of the total number of virtual calls
11496 it encounters and the number of verifications it inserts. It also
11497 counts the number of calls to certain run-time library functions
11498 that it inserts and logs this information for each compilation unit.
11499 The compiler writes this information to a file named
11500 @file{vtv_count_data.log} in the directory named by the environment
11501 variable @env{VTV_LOGS_DIR} if that is defined or the current working
11502 directory otherwise. It also counts the size of the vtable pointer sets
11503 for each class, and writes this information to @file{vtv_class_set_sizes.log}
11504 in the same directory.
11505
11506 Note: This feature @emph{appends} data to the log files. To get fresh log
11507 files, be sure to delete any existing ones.
11508
11509 @item -finstrument-functions
11510 @opindex finstrument-functions
11511 Generate instrumentation calls for entry and exit to functions. Just
11512 after function entry and just before function exit, the following
11513 profiling functions are called with the address of the current
11514 function and its call site. (On some platforms,
11515 @code{__builtin_return_address} does not work beyond the current
11516 function, so the call site information may not be available to the
11517 profiling functions otherwise.)
11518
11519 @smallexample
11520 void __cyg_profile_func_enter (void *this_fn,
11521 void *call_site);
11522 void __cyg_profile_func_exit (void *this_fn,
11523 void *call_site);
11524 @end smallexample
11525
11526 The first argument is the address of the start of the current function,
11527 which may be looked up exactly in the symbol table.
11528
11529 This instrumentation is also done for functions expanded inline in other
11530 functions. The profiling calls indicate where, conceptually, the
11531 inline function is entered and exited. This means that addressable
11532 versions of such functions must be available. If all your uses of a
11533 function are expanded inline, this may mean an additional expansion of
11534 code size. If you use @code{extern inline} in your C code, an
11535 addressable version of such functions must be provided. (This is
11536 normally the case anyway, but if you get lucky and the optimizer always
11537 expands the functions inline, you might have gotten away without
11538 providing static copies.)
11539
11540 A function may be given the attribute @code{no_instrument_function}, in
11541 which case this instrumentation is not done. This can be used, for
11542 example, for the profiling functions listed above, high-priority
11543 interrupt routines, and any functions from which the profiling functions
11544 cannot safely be called (perhaps signal handlers, if the profiling
11545 routines generate output or allocate memory).
11546
11547 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
11548 @opindex finstrument-functions-exclude-file-list
11549
11550 Set the list of functions that are excluded from instrumentation (see
11551 the description of @option{-finstrument-functions}). If the file that
11552 contains a function definition matches with one of @var{file}, then
11553 that function is not instrumented. The match is done on substrings:
11554 if the @var{file} parameter is a substring of the file name, it is
11555 considered to be a match.
11556
11557 For example:
11558
11559 @smallexample
11560 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
11561 @end smallexample
11562
11563 @noindent
11564 excludes any inline function defined in files whose pathnames
11565 contain @file{/bits/stl} or @file{include/sys}.
11566
11567 If, for some reason, you want to include letter @samp{,} in one of
11568 @var{sym}, write @samp{\,}. For example,
11569 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
11570 (note the single quote surrounding the option).
11571
11572 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
11573 @opindex finstrument-functions-exclude-function-list
11574
11575 This is similar to @option{-finstrument-functions-exclude-file-list},
11576 but this option sets the list of function names to be excluded from
11577 instrumentation. The function name to be matched is its user-visible
11578 name, such as @code{vector<int> blah(const vector<int> &)}, not the
11579 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
11580 match is done on substrings: if the @var{sym} parameter is a substring
11581 of the function name, it is considered to be a match. For C99 and C++
11582 extended identifiers, the function name must be given in UTF-8, not
11583 using universal character names.
11584
11585 @item -fpatchable-function-entry=@var{N}[,@var{M}]
11586 @opindex fpatchable-function-entry
11587 Generate @var{N} NOPs right at the beginning
11588 of each function, with the function entry point before the @var{M}th NOP.
11589 If @var{M} is omitted, it defaults to @code{0} so the
11590 function entry points to the address just at the first NOP.
11591 The NOP instructions reserve extra space which can be used to patch in
11592 any desired instrumentation at run time, provided that the code segment
11593 is writable. The amount of space is controllable indirectly via
11594 the number of NOPs; the NOP instruction used corresponds to the instruction
11595 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
11596 is target-specific and may also depend on the architecture variant and/or
11597 other compilation options.
11598
11599 For run-time identification, the starting addresses of these areas,
11600 which correspond to their respective function entries minus @var{M},
11601 are additionally collected in the @code{__patchable_function_entries}
11602 section of the resulting binary.
11603
11604 Note that the value of @code{__attribute__ ((patchable_function_entry
11605 (N,M)))} takes precedence over command-line option
11606 @option{-fpatchable-function-entry=N,M}. This can be used to increase
11607 the area size or to remove it completely on a single function.
11608 If @code{N=0}, no pad location is recorded.
11609
11610 The NOP instructions are inserted at---and maybe before, depending on
11611 @var{M}---the function entry address, even before the prologue.
11612
11613 @end table
11614
11615
11616 @node Preprocessor Options
11617 @section Options Controlling the Preprocessor
11618 @cindex preprocessor options
11619 @cindex options, preprocessor
11620
11621 These options control the C preprocessor, which is run on each C source
11622 file before actual compilation.
11623
11624 If you use the @option{-E} option, nothing is done except preprocessing.
11625 Some of these options make sense only together with @option{-E} because
11626 they cause the preprocessor output to be unsuitable for actual
11627 compilation.
11628
11629 In addition to the options listed here, there are a number of options
11630 to control search paths for include files documented in
11631 @ref{Directory Options}.
11632 Options to control preprocessor diagnostics are listed in
11633 @ref{Warning Options}.
11634
11635 @table @gcctabopt
11636 @include cppopts.texi
11637
11638 @item -Wp,@var{option}
11639 @opindex Wp
11640 You can use @option{-Wp,@var{option}} to bypass the compiler driver
11641 and pass @var{option} directly through to the preprocessor. If
11642 @var{option} contains commas, it is split into multiple options at the
11643 commas. However, many options are modified, translated or interpreted
11644 by the compiler driver before being passed to the preprocessor, and
11645 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
11646 interface is undocumented and subject to change, so whenever possible
11647 you should avoid using @option{-Wp} and let the driver handle the
11648 options instead.
11649
11650 @item -Xpreprocessor @var{option}
11651 @opindex Xpreprocessor
11652 Pass @var{option} as an option to the preprocessor. You can use this to
11653 supply system-specific preprocessor options that GCC does not
11654 recognize.
11655
11656 If you want to pass an option that takes an argument, you must use
11657 @option{-Xpreprocessor} twice, once for the option and once for the argument.
11658
11659 @item -no-integrated-cpp
11660 @opindex no-integrated-cpp
11661 Perform preprocessing as a separate pass before compilation.
11662 By default, GCC performs preprocessing as an integrated part of
11663 input tokenization and parsing.
11664 If this option is provided, the appropriate language front end
11665 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
11666 and Objective-C, respectively) is instead invoked twice,
11667 once for preprocessing only and once for actual compilation
11668 of the preprocessed input.
11669 This option may be useful in conjunction with the @option{-B} or
11670 @option{-wrapper} options to specify an alternate preprocessor or
11671 perform additional processing of the program source between
11672 normal preprocessing and compilation.
11673
11674 @end table
11675
11676 @node Assembler Options
11677 @section Passing Options to the Assembler
11678
11679 @c prevent bad page break with this line
11680 You can pass options to the assembler.
11681
11682 @table @gcctabopt
11683 @item -Wa,@var{option}
11684 @opindex Wa
11685 Pass @var{option} as an option to the assembler. If @var{option}
11686 contains commas, it is split into multiple options at the commas.
11687
11688 @item -Xassembler @var{option}
11689 @opindex Xassembler
11690 Pass @var{option} as an option to the assembler. You can use this to
11691 supply system-specific assembler options that GCC does not
11692 recognize.
11693
11694 If you want to pass an option that takes an argument, you must use
11695 @option{-Xassembler} twice, once for the option and once for the argument.
11696
11697 @end table
11698
11699 @node Link Options
11700 @section Options for Linking
11701 @cindex link options
11702 @cindex options, linking
11703
11704 These options come into play when the compiler links object files into
11705 an executable output file. They are meaningless if the compiler is
11706 not doing a link step.
11707
11708 @table @gcctabopt
11709 @cindex file names
11710 @item @var{object-file-name}
11711 A file name that does not end in a special recognized suffix is
11712 considered to name an object file or library. (Object files are
11713 distinguished from libraries by the linker according to the file
11714 contents.) If linking is done, these object files are used as input
11715 to the linker.
11716
11717 @item -c
11718 @itemx -S
11719 @itemx -E
11720 @opindex c
11721 @opindex S
11722 @opindex E
11723 If any of these options is used, then the linker is not run, and
11724 object file names should not be used as arguments. @xref{Overall
11725 Options}.
11726
11727 @item -fuse-ld=bfd
11728 @opindex fuse-ld=bfd
11729 Use the @command{bfd} linker instead of the default linker.
11730
11731 @item -fuse-ld=gold
11732 @opindex fuse-ld=gold
11733 Use the @command{gold} linker instead of the default linker.
11734
11735 @cindex Libraries
11736 @item -l@var{library}
11737 @itemx -l @var{library}
11738 @opindex l
11739 Search the library named @var{library} when linking. (The second
11740 alternative with the library as a separate argument is only for
11741 POSIX compliance and is not recommended.)
11742
11743 It makes a difference where in the command you write this option; the
11744 linker searches and processes libraries and object files in the order they
11745 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
11746 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
11747 to functions in @samp{z}, those functions may not be loaded.
11748
11749 The linker searches a standard list of directories for the library,
11750 which is actually a file named @file{lib@var{library}.a}. The linker
11751 then uses this file as if it had been specified precisely by name.
11752
11753 The directories searched include several standard system directories
11754 plus any that you specify with @option{-L}.
11755
11756 Normally the files found this way are library files---archive files
11757 whose members are object files. The linker handles an archive file by
11758 scanning through it for members which define symbols that have so far
11759 been referenced but not defined. But if the file that is found is an
11760 ordinary object file, it is linked in the usual fashion. The only
11761 difference between using an @option{-l} option and specifying a file name
11762 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
11763 and searches several directories.
11764
11765 @item -lobjc
11766 @opindex lobjc
11767 You need this special case of the @option{-l} option in order to
11768 link an Objective-C or Objective-C++ program.
11769
11770 @item -nostartfiles
11771 @opindex nostartfiles
11772 Do not use the standard system startup files when linking.
11773 The standard system libraries are used normally, unless @option{-nostdlib}
11774 or @option{-nodefaultlibs} is used.
11775
11776 @item -nodefaultlibs
11777 @opindex nodefaultlibs
11778 Do not use the standard system libraries when linking.
11779 Only the libraries you specify are passed to the linker, and options
11780 specifying linkage of the system libraries, such as @option{-static-libgcc}
11781 or @option{-shared-libgcc}, are ignored.
11782 The standard startup files are used normally, unless @option{-nostartfiles}
11783 is used.
11784
11785 The compiler may generate calls to @code{memcmp},
11786 @code{memset}, @code{memcpy} and @code{memmove}.
11787 These entries are usually resolved by entries in
11788 libc. These entry points should be supplied through some other
11789 mechanism when this option is specified.
11790
11791 @item -nostdlib
11792 @opindex nostdlib
11793 Do not use the standard system startup files or libraries when linking.
11794 No startup files and only the libraries you specify are passed to
11795 the linker, and options specifying linkage of the system libraries, such as
11796 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
11797
11798 The compiler may generate calls to @code{memcmp}, @code{memset},
11799 @code{memcpy} and @code{memmove}.
11800 These entries are usually resolved by entries in
11801 libc. These entry points should be supplied through some other
11802 mechanism when this option is specified.
11803
11804 @cindex @option{-lgcc}, use with @option{-nostdlib}
11805 @cindex @option{-nostdlib} and unresolved references
11806 @cindex unresolved references and @option{-nostdlib}
11807 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
11808 @cindex @option{-nodefaultlibs} and unresolved references
11809 @cindex unresolved references and @option{-nodefaultlibs}
11810 One of the standard libraries bypassed by @option{-nostdlib} and
11811 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
11812 which GCC uses to overcome shortcomings of particular machines, or special
11813 needs for some languages.
11814 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
11815 Collection (GCC) Internals},
11816 for more discussion of @file{libgcc.a}.)
11817 In most cases, you need @file{libgcc.a} even when you want to avoid
11818 other standard libraries. In other words, when you specify @option{-nostdlib}
11819 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
11820 This ensures that you have no unresolved references to internal GCC
11821 library subroutines.
11822 (An example of such an internal subroutine is @code{__main}, used to ensure C++
11823 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
11824 GNU Compiler Collection (GCC) Internals}.)
11825
11826 @item -pie
11827 @opindex pie
11828 Produce a dynamically linked position independent executable on targets
11829 that support it. For predictable results, you must also specify the same
11830 set of options used for compilation (@option{-fpie}, @option{-fPIE},
11831 or model suboptions) when you specify this linker option.
11832
11833 @item -no-pie
11834 @opindex no-pie
11835 Don't produce a dynamically linked position independent executable.
11836
11837 @item -static-pie
11838 @opindex static-pie
11839 Produce a static position independent executable on targets that support
11840 it. A static position independent executable is similar to a static
11841 executable, but can be loaded at any address without a dynamic linker.
11842 For predictable results, you must also specify the same set of options
11843 used for compilation (@option{-fpie}, @option{-fPIE}, or model
11844 suboptions) when you specify this linker option.
11845
11846 @item -pthread
11847 @opindex pthread
11848 Link with the POSIX threads library. This option is supported on
11849 GNU/Linux targets, most other Unix derivatives, and also on
11850 x86 Cygwin and MinGW targets. On some targets this option also sets
11851 flags for the preprocessor, so it should be used consistently for both
11852 compilation and linking.
11853
11854 @item -rdynamic
11855 @opindex rdynamic
11856 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
11857 that support it. This instructs the linker to add all symbols, not
11858 only used ones, to the dynamic symbol table. This option is needed
11859 for some uses of @code{dlopen} or to allow obtaining backtraces
11860 from within a program.
11861
11862 @item -s
11863 @opindex s
11864 Remove all symbol table and relocation information from the executable.
11865
11866 @item -static
11867 @opindex static
11868 On systems that support dynamic linking, this overrides @option{-pie}
11869 and prevents linking with the shared libraries. On other systems, this
11870 option has no effect.
11871
11872 @item -shared
11873 @opindex shared
11874 Produce a shared object which can then be linked with other objects to
11875 form an executable. Not all systems support this option. For predictable
11876 results, you must also specify the same set of options used for compilation
11877 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
11878 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
11879 needs to build supplementary stub code for constructors to work. On
11880 multi-libbed systems, @samp{gcc -shared} must select the correct support
11881 libraries to link against. Failing to supply the correct flags may lead
11882 to subtle defects. Supplying them in cases where they are not necessary
11883 is innocuous.}
11884
11885 @item -shared-libgcc
11886 @itemx -static-libgcc
11887 @opindex shared-libgcc
11888 @opindex static-libgcc
11889 On systems that provide @file{libgcc} as a shared library, these options
11890 force the use of either the shared or static version, respectively.
11891 If no shared version of @file{libgcc} was built when the compiler was
11892 configured, these options have no effect.
11893
11894 There are several situations in which an application should use the
11895 shared @file{libgcc} instead of the static version. The most common
11896 of these is when the application wishes to throw and catch exceptions
11897 across different shared libraries. In that case, each of the libraries
11898 as well as the application itself should use the shared @file{libgcc}.
11899
11900 Therefore, the G++ and driver automatically adds @option{-shared-libgcc}
11901 whenever you build a shared library or a main executable, because C++
11902 programs typically use exceptions, so this is the right thing to do.
11903
11904 If, instead, you use the GCC driver to create shared libraries, you may
11905 find that they are not always linked with the shared @file{libgcc}.
11906 If GCC finds, at its configuration time, that you have a non-GNU linker
11907 or a GNU linker that does not support option @option{--eh-frame-hdr},
11908 it links the shared version of @file{libgcc} into shared libraries
11909 by default. Otherwise, it takes advantage of the linker and optimizes
11910 away the linking with the shared version of @file{libgcc}, linking with
11911 the static version of libgcc by default. This allows exceptions to
11912 propagate through such shared libraries, without incurring relocation
11913 costs at library load time.
11914
11915 However, if a library or main executable is supposed to throw or catch
11916 exceptions, you must link it using the G++ driver, as appropriate
11917 for the languages used in the program, or using the option
11918 @option{-shared-libgcc}, such that it is linked with the shared
11919 @file{libgcc}.
11920
11921 @item -static-libasan
11922 @opindex static-libasan
11923 When the @option{-fsanitize=address} option is used to link a program,
11924 the GCC driver automatically links against @option{libasan}. If
11925 @file{libasan} is available as a shared library, and the @option{-static}
11926 option is not used, then this links against the shared version of
11927 @file{libasan}. The @option{-static-libasan} option directs the GCC
11928 driver to link @file{libasan} statically, without necessarily linking
11929 other libraries statically.
11930
11931 @item -static-libtsan
11932 @opindex static-libtsan
11933 When the @option{-fsanitize=thread} option is used to link a program,
11934 the GCC driver automatically links against @option{libtsan}. If
11935 @file{libtsan} is available as a shared library, and the @option{-static}
11936 option is not used, then this links against the shared version of
11937 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
11938 driver to link @file{libtsan} statically, without necessarily linking
11939 other libraries statically.
11940
11941 @item -static-liblsan
11942 @opindex static-liblsan
11943 When the @option{-fsanitize=leak} option is used to link a program,
11944 the GCC driver automatically links against @option{liblsan}. If
11945 @file{liblsan} is available as a shared library, and the @option{-static}
11946 option is not used, then this links against the shared version of
11947 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
11948 driver to link @file{liblsan} statically, without necessarily linking
11949 other libraries statically.
11950
11951 @item -static-libubsan
11952 @opindex static-libubsan
11953 When the @option{-fsanitize=undefined} option is used to link a program,
11954 the GCC driver automatically links against @option{libubsan}. If
11955 @file{libubsan} is available as a shared library, and the @option{-static}
11956 option is not used, then this links against the shared version of
11957 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
11958 driver to link @file{libubsan} statically, without necessarily linking
11959 other libraries statically.
11960
11961 @item -static-libmpx
11962 @opindex static-libmpx
11963 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
11964 used to link a program, the GCC driver automatically links against
11965 @file{libmpx}. If @file{libmpx} is available as a shared library,
11966 and the @option{-static} option is not used, then this links against
11967 the shared version of @file{libmpx}. The @option{-static-libmpx}
11968 option directs the GCC driver to link @file{libmpx} statically,
11969 without necessarily linking other libraries statically.
11970
11971 @item -static-libmpxwrappers
11972 @opindex static-libmpxwrappers
11973 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
11974 to link a program without also using @option{-fno-chkp-use-wrappers}, the
11975 GCC driver automatically links against @file{libmpxwrappers}. If
11976 @file{libmpxwrappers} is available as a shared library, and the
11977 @option{-static} option is not used, then this links against the shared
11978 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
11979 option directs the GCC driver to link @file{libmpxwrappers} statically,
11980 without necessarily linking other libraries statically.
11981
11982 @item -static-libstdc++
11983 @opindex static-libstdc++
11984 When the @command{g++} program is used to link a C++ program, it
11985 normally automatically links against @option{libstdc++}. If
11986 @file{libstdc++} is available as a shared library, and the
11987 @option{-static} option is not used, then this links against the
11988 shared version of @file{libstdc++}. That is normally fine. However, it
11989 is sometimes useful to freeze the version of @file{libstdc++} used by
11990 the program without going all the way to a fully static link. The
11991 @option{-static-libstdc++} option directs the @command{g++} driver to
11992 link @file{libstdc++} statically, without necessarily linking other
11993 libraries statically.
11994
11995 @item -symbolic
11996 @opindex symbolic
11997 Bind references to global symbols when building a shared object. Warn
11998 about any unresolved references (unless overridden by the link editor
11999 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
12000 this option.
12001
12002 @item -T @var{script}
12003 @opindex T
12004 @cindex linker script
12005 Use @var{script} as the linker script. This option is supported by most
12006 systems using the GNU linker. On some targets, such as bare-board
12007 targets without an operating system, the @option{-T} option may be required
12008 when linking to avoid references to undefined symbols.
12009
12010 @item -Xlinker @var{option}
12011 @opindex Xlinker
12012 Pass @var{option} as an option to the linker. You can use this to
12013 supply system-specific linker options that GCC does not recognize.
12014
12015 If you want to pass an option that takes a separate argument, you must use
12016 @option{-Xlinker} twice, once for the option and once for the argument.
12017 For example, to pass @option{-assert definitions}, you must write
12018 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
12019 @option{-Xlinker "-assert definitions"}, because this passes the entire
12020 string as a single argument, which is not what the linker expects.
12021
12022 When using the GNU linker, it is usually more convenient to pass
12023 arguments to linker options using the @option{@var{option}=@var{value}}
12024 syntax than as separate arguments. For example, you can specify
12025 @option{-Xlinker -Map=output.map} rather than
12026 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
12027 this syntax for command-line options.
12028
12029 @item -Wl,@var{option}
12030 @opindex Wl
12031 Pass @var{option} as an option to the linker. If @var{option} contains
12032 commas, it is split into multiple options at the commas. You can use this
12033 syntax to pass an argument to the option.
12034 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
12035 linker. When using the GNU linker, you can also get the same effect with
12036 @option{-Wl,-Map=output.map}.
12037
12038 @item -u @var{symbol}
12039 @opindex u
12040 Pretend the symbol @var{symbol} is undefined, to force linking of
12041 library modules to define it. You can use @option{-u} multiple times with
12042 different symbols to force loading of additional library modules.
12043
12044 @item -z @var{keyword}
12045 @opindex z
12046 @option{-z} is passed directly on to the linker along with the keyword
12047 @var{keyword}. See the section in the documentation of your linker for
12048 permitted values and their meanings.
12049 @end table
12050
12051 @node Directory Options
12052 @section Options for Directory Search
12053 @cindex directory options
12054 @cindex options, directory search
12055 @cindex search path
12056
12057 These options specify directories to search for header files, for
12058 libraries and for parts of the compiler:
12059
12060 @table @gcctabopt
12061 @include cppdiropts.texi
12062
12063 @item -iplugindir=@var{dir}
12064 @opindex iplugindir=
12065 Set the directory to search for plugins that are passed
12066 by @option{-fplugin=@var{name}} instead of
12067 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
12068 to be used by the user, but only passed by the driver.
12069
12070 @item -L@var{dir}
12071 @opindex L
12072 Add directory @var{dir} to the list of directories to be searched
12073 for @option{-l}.
12074
12075 @item -B@var{prefix}
12076 @opindex B
12077 This option specifies where to find the executables, libraries,
12078 include files, and data files of the compiler itself.
12079
12080 The compiler driver program runs one or more of the subprograms
12081 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
12082 @var{prefix} as a prefix for each program it tries to run, both with and
12083 without @samp{@var{machine}/@var{version}/} for the corresponding target
12084 machine and compiler version.
12085
12086 For each subprogram to be run, the compiler driver first tries the
12087 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
12088 is not specified, the driver tries two standard prefixes,
12089 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
12090 those results in a file name that is found, the unmodified program
12091 name is searched for using the directories specified in your
12092 @env{PATH} environment variable.
12093
12094 The compiler checks to see if the path provided by @option{-B}
12095 refers to a directory, and if necessary it adds a directory
12096 separator character at the end of the path.
12097
12098 @option{-B} prefixes that effectively specify directory names also apply
12099 to libraries in the linker, because the compiler translates these
12100 options into @option{-L} options for the linker. They also apply to
12101 include files in the preprocessor, because the compiler translates these
12102 options into @option{-isystem} options for the preprocessor. In this case,
12103 the compiler appends @samp{include} to the prefix.
12104
12105 The runtime support file @file{libgcc.a} can also be searched for using
12106 the @option{-B} prefix, if needed. If it is not found there, the two
12107 standard prefixes above are tried, and that is all. The file is left
12108 out of the link if it is not found by those means.
12109
12110 Another way to specify a prefix much like the @option{-B} prefix is to use
12111 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
12112 Variables}.
12113
12114 As a special kludge, if the path provided by @option{-B} is
12115 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
12116 9, then it is replaced by @file{[dir/]include}. This is to help
12117 with boot-strapping the compiler.
12118
12119 @item -no-canonical-prefixes
12120 @opindex no-canonical-prefixes
12121 Do not expand any symbolic links, resolve references to @samp{/../}
12122 or @samp{/./}, or make the path absolute when generating a relative
12123 prefix.
12124
12125 @item --sysroot=@var{dir}
12126 @opindex sysroot
12127 Use @var{dir} as the logical root directory for headers and libraries.
12128 For example, if the compiler normally searches for headers in
12129 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
12130 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
12131
12132 If you use both this option and the @option{-isysroot} option, then
12133 the @option{--sysroot} option applies to libraries, but the
12134 @option{-isysroot} option applies to header files.
12135
12136 The GNU linker (beginning with version 2.16) has the necessary support
12137 for this option. If your linker does not support this option, the
12138 header file aspect of @option{--sysroot} still works, but the
12139 library aspect does not.
12140
12141 @item --no-sysroot-suffix
12142 @opindex no-sysroot-suffix
12143 For some targets, a suffix is added to the root directory specified
12144 with @option{--sysroot}, depending on the other options used, so that
12145 headers may for example be found in
12146 @file{@var{dir}/@var{suffix}/usr/include} instead of
12147 @file{@var{dir}/usr/include}. This option disables the addition of
12148 such a suffix.
12149
12150 @end table
12151
12152 @node Code Gen Options
12153 @section Options for Code Generation Conventions
12154 @cindex code generation conventions
12155 @cindex options, code generation
12156 @cindex run-time options
12157
12158 These machine-independent options control the interface conventions
12159 used in code generation.
12160
12161 Most of them have both positive and negative forms; the negative form
12162 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
12163 one of the forms is listed---the one that is not the default. You
12164 can figure out the other form by either removing @samp{no-} or adding
12165 it.
12166
12167 @table @gcctabopt
12168 @item -fstack-reuse=@var{reuse-level}
12169 @opindex fstack_reuse
12170 This option controls stack space reuse for user declared local/auto variables
12171 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
12172 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
12173 local variables and temporaries, @samp{named_vars} enables the reuse only for
12174 user defined local variables with names, and @samp{none} disables stack reuse
12175 completely. The default value is @samp{all}. The option is needed when the
12176 program extends the lifetime of a scoped local variable or a compiler generated
12177 temporary beyond the end point defined by the language. When a lifetime of
12178 a variable ends, and if the variable lives in memory, the optimizing compiler
12179 has the freedom to reuse its stack space with other temporaries or scoped
12180 local variables whose live range does not overlap with it. Legacy code extending
12181 local lifetime is likely to break with the stack reuse optimization.
12182
12183 For example,
12184
12185 @smallexample
12186 int *p;
12187 @{
12188 int local1;
12189
12190 p = &local1;
12191 local1 = 10;
12192 ....
12193 @}
12194 @{
12195 int local2;
12196 local2 = 20;
12197 ...
12198 @}
12199
12200 if (*p == 10) // out of scope use of local1
12201 @{
12202
12203 @}
12204 @end smallexample
12205
12206 Another example:
12207 @smallexample
12208
12209 struct A
12210 @{
12211 A(int k) : i(k), j(k) @{ @}
12212 int i;
12213 int j;
12214 @};
12215
12216 A *ap;
12217
12218 void foo(const A& ar)
12219 @{
12220 ap = &ar;
12221 @}
12222
12223 void bar()
12224 @{
12225 foo(A(10)); // temp object's lifetime ends when foo returns
12226
12227 @{
12228 A a(20);
12229 ....
12230 @}
12231 ap->i+= 10; // ap references out of scope temp whose space
12232 // is reused with a. What is the value of ap->i?
12233 @}
12234
12235 @end smallexample
12236
12237 The lifetime of a compiler generated temporary is well defined by the C++
12238 standard. When a lifetime of a temporary ends, and if the temporary lives
12239 in memory, the optimizing compiler has the freedom to reuse its stack
12240 space with other temporaries or scoped local variables whose live range
12241 does not overlap with it. However some of the legacy code relies on
12242 the behavior of older compilers in which temporaries' stack space is
12243 not reused, the aggressive stack reuse can lead to runtime errors. This
12244 option is used to control the temporary stack reuse optimization.
12245
12246 @item -ftrapv
12247 @opindex ftrapv
12248 This option generates traps for signed overflow on addition, subtraction,
12249 multiplication operations.
12250 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12251 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12252 @option{-fwrapv} being effective. Note that only active options override, so
12253 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12254 results in @option{-ftrapv} being effective.
12255
12256 @item -fwrapv
12257 @opindex fwrapv
12258 This option instructs the compiler to assume that signed arithmetic
12259 overflow of addition, subtraction and multiplication wraps around
12260 using twos-complement representation. This flag enables some optimizations
12261 and disables others.
12262 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12263 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12264 @option{-fwrapv} being effective. Note that only active options override, so
12265 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12266 results in @option{-ftrapv} being effective.
12267
12268 @item -fexceptions
12269 @opindex fexceptions
12270 Enable exception handling. Generates extra code needed to propagate
12271 exceptions. For some targets, this implies GCC generates frame
12272 unwind information for all functions, which can produce significant data
12273 size overhead, although it does not affect execution. If you do not
12274 specify this option, GCC enables it by default for languages like
12275 C++ that normally require exception handling, and disables it for
12276 languages like C that do not normally require it. However, you may need
12277 to enable this option when compiling C code that needs to interoperate
12278 properly with exception handlers written in C++. You may also wish to
12279 disable this option if you are compiling older C++ programs that don't
12280 use exception handling.
12281
12282 @item -fnon-call-exceptions
12283 @opindex fnon-call-exceptions
12284 Generate code that allows trapping instructions to throw exceptions.
12285 Note that this requires platform-specific runtime support that does
12286 not exist everywhere. Moreover, it only allows @emph{trapping}
12287 instructions to throw exceptions, i.e.@: memory references or floating-point
12288 instructions. It does not allow exceptions to be thrown from
12289 arbitrary signal handlers such as @code{SIGALRM}.
12290
12291 @item -fdelete-dead-exceptions
12292 @opindex fdelete-dead-exceptions
12293 Consider that instructions that may throw exceptions but don't otherwise
12294 contribute to the execution of the program can be optimized away.
12295 This option is enabled by default for the Ada front end, as permitted by
12296 the Ada language specification.
12297 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
12298
12299 @item -funwind-tables
12300 @opindex funwind-tables
12301 Similar to @option{-fexceptions}, except that it just generates any needed
12302 static data, but does not affect the generated code in any other way.
12303 You normally do not need to enable this option; instead, a language processor
12304 that needs this handling enables it on your behalf.
12305
12306 @item -fasynchronous-unwind-tables
12307 @opindex fasynchronous-unwind-tables
12308 Generate unwind table in DWARF format, if supported by target machine. The
12309 table is exact at each instruction boundary, so it can be used for stack
12310 unwinding from asynchronous events (such as debugger or garbage collector).
12311
12312 @item -fno-gnu-unique
12313 @opindex fno-gnu-unique
12314 On systems with recent GNU assembler and C library, the C++ compiler
12315 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
12316 of template static data members and static local variables in inline
12317 functions are unique even in the presence of @code{RTLD_LOCAL}; this
12318 is necessary to avoid problems with a library used by two different
12319 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
12320 therefore disagreeing with the other one about the binding of the
12321 symbol. But this causes @code{dlclose} to be ignored for affected
12322 DSOs; if your program relies on reinitialization of a DSO via
12323 @code{dlclose} and @code{dlopen}, you can use
12324 @option{-fno-gnu-unique}.
12325
12326 @item -fpcc-struct-return
12327 @opindex fpcc-struct-return
12328 Return ``short'' @code{struct} and @code{union} values in memory like
12329 longer ones, rather than in registers. This convention is less
12330 efficient, but it has the advantage of allowing intercallability between
12331 GCC-compiled files and files compiled with other compilers, particularly
12332 the Portable C Compiler (pcc).
12333
12334 The precise convention for returning structures in memory depends
12335 on the target configuration macros.
12336
12337 Short structures and unions are those whose size and alignment match
12338 that of some integer type.
12339
12340 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
12341 switch is not binary compatible with code compiled with the
12342 @option{-freg-struct-return} switch.
12343 Use it to conform to a non-default application binary interface.
12344
12345 @item -freg-struct-return
12346 @opindex freg-struct-return
12347 Return @code{struct} and @code{union} values in registers when possible.
12348 This is more efficient for small structures than
12349 @option{-fpcc-struct-return}.
12350
12351 If you specify neither @option{-fpcc-struct-return} nor
12352 @option{-freg-struct-return}, GCC defaults to whichever convention is
12353 standard for the target. If there is no standard convention, GCC
12354 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
12355 the principal compiler. In those cases, we can choose the standard, and
12356 we chose the more efficient register return alternative.
12357
12358 @strong{Warning:} code compiled with the @option{-freg-struct-return}
12359 switch is not binary compatible with code compiled with the
12360 @option{-fpcc-struct-return} switch.
12361 Use it to conform to a non-default application binary interface.
12362
12363 @item -fshort-enums
12364 @opindex fshort-enums
12365 Allocate to an @code{enum} type only as many bytes as it needs for the
12366 declared range of possible values. Specifically, the @code{enum} type
12367 is equivalent to the smallest integer type that has enough room.
12368
12369 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
12370 code that is not binary compatible with code generated without that switch.
12371 Use it to conform to a non-default application binary interface.
12372
12373 @item -fshort-wchar
12374 @opindex fshort-wchar
12375 Override the underlying type for @code{wchar_t} to be @code{short
12376 unsigned int} instead of the default for the target. This option is
12377 useful for building programs to run under WINE@.
12378
12379 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
12380 code that is not binary compatible with code generated without that switch.
12381 Use it to conform to a non-default application binary interface.
12382
12383 @item -fno-common
12384 @opindex fno-common
12385 @cindex tentative definitions
12386 In C code, this option controls the placement of global variables
12387 defined without an initializer, known as @dfn{tentative definitions}
12388 in the C standard. Tentative definitions are distinct from declarations
12389 of a variable with the @code{extern} keyword, which do not allocate storage.
12390
12391 Unix C compilers have traditionally allocated storage for
12392 uninitialized global variables in a common block. This allows the
12393 linker to resolve all tentative definitions of the same variable
12394 in different compilation units to the same object, or to a non-tentative
12395 definition.
12396 This is the behavior specified by @option{-fcommon}, and is the default for
12397 GCC on most targets.
12398 On the other hand, this behavior is not required by ISO
12399 C, and on some targets may carry a speed or code size penalty on
12400 variable references.
12401
12402 The @option{-fno-common} option specifies that the compiler should instead
12403 place uninitialized global variables in the data section of the object file.
12404 This inhibits the merging of tentative definitions by the linker so
12405 you get a multiple-definition error if the same
12406 variable is defined in more than one compilation unit.
12407 Compiling with @option{-fno-common} is useful on targets for which
12408 it provides better performance, or if you wish to verify that the
12409 program will work on other systems that always treat uninitialized
12410 variable definitions this way.
12411
12412 @item -fno-ident
12413 @opindex fno-ident
12414 Ignore the @code{#ident} directive.
12415
12416 @item -finhibit-size-directive
12417 @opindex finhibit-size-directive
12418 Don't output a @code{.size} assembler directive, or anything else that
12419 would cause trouble if the function is split in the middle, and the
12420 two halves are placed at locations far apart in memory. This option is
12421 used when compiling @file{crtstuff.c}; you should not need to use it
12422 for anything else.
12423
12424 @item -fverbose-asm
12425 @opindex fverbose-asm
12426 Put extra commentary information in the generated assembly code to
12427 make it more readable. This option is generally only of use to those
12428 who actually need to read the generated assembly code (perhaps while
12429 debugging the compiler itself).
12430
12431 @option{-fno-verbose-asm}, the default, causes the
12432 extra information to be omitted and is useful when comparing two assembler
12433 files.
12434
12435 The added comments include:
12436
12437 @itemize @bullet
12438
12439 @item
12440 information on the compiler version and command-line options,
12441
12442 @item
12443 the source code lines associated with the assembly instructions,
12444 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
12445
12446 @item
12447 hints on which high-level expressions correspond to
12448 the various assembly instruction operands.
12449
12450 @end itemize
12451
12452 For example, given this C source file:
12453
12454 @smallexample
12455 int test (int n)
12456 @{
12457 int i;
12458 int total = 0;
12459
12460 for (i = 0; i < n; i++)
12461 total += i * i;
12462
12463 return total;
12464 @}
12465 @end smallexample
12466
12467 compiling to (x86_64) assembly via @option{-S} and emitting the result
12468 direct to stdout via @option{-o} @option{-}
12469
12470 @smallexample
12471 gcc -S test.c -fverbose-asm -Os -o -
12472 @end smallexample
12473
12474 gives output similar to this:
12475
12476 @smallexample
12477 .file "test.c"
12478 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
12479 [...snip...]
12480 # options passed:
12481 [...snip...]
12482
12483 .text
12484 .globl test
12485 .type test, @@function
12486 test:
12487 .LFB0:
12488 .cfi_startproc
12489 # test.c:4: int total = 0;
12490 xorl %eax, %eax # <retval>
12491 # test.c:6: for (i = 0; i < n; i++)
12492 xorl %edx, %edx # i
12493 .L2:
12494 # test.c:6: for (i = 0; i < n; i++)
12495 cmpl %edi, %edx # n, i
12496 jge .L5 #,
12497 # test.c:7: total += i * i;
12498 movl %edx, %ecx # i, tmp92
12499 imull %edx, %ecx # i, tmp92
12500 # test.c:6: for (i = 0; i < n; i++)
12501 incl %edx # i
12502 # test.c:7: total += i * i;
12503 addl %ecx, %eax # tmp92, <retval>
12504 jmp .L2 #
12505 .L5:
12506 # test.c:10: @}
12507 ret
12508 .cfi_endproc
12509 .LFE0:
12510 .size test, .-test
12511 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
12512 .section .note.GNU-stack,"",@@progbits
12513 @end smallexample
12514
12515 The comments are intended for humans rather than machines and hence the
12516 precise format of the comments is subject to change.
12517
12518 @item -frecord-gcc-switches
12519 @opindex frecord-gcc-switches
12520 This switch causes the command line used to invoke the
12521 compiler to be recorded into the object file that is being created.
12522 This switch is only implemented on some targets and the exact format
12523 of the recording is target and binary file format dependent, but it
12524 usually takes the form of a section containing ASCII text. This
12525 switch is related to the @option{-fverbose-asm} switch, but that
12526 switch only records information in the assembler output file as
12527 comments, so it never reaches the object file.
12528 See also @option{-grecord-gcc-switches} for another
12529 way of storing compiler options into the object file.
12530
12531 @item -fpic
12532 @opindex fpic
12533 @cindex global offset table
12534 @cindex PIC
12535 Generate position-independent code (PIC) suitable for use in a shared
12536 library, if supported for the target machine. Such code accesses all
12537 constant addresses through a global offset table (GOT)@. The dynamic
12538 loader resolves the GOT entries when the program starts (the dynamic
12539 loader is not part of GCC; it is part of the operating system). If
12540 the GOT size for the linked executable exceeds a machine-specific
12541 maximum size, you get an error message from the linker indicating that
12542 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
12543 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
12544 on the m68k and RS/6000. The x86 has no such limit.)
12545
12546 Position-independent code requires special support, and therefore works
12547 only on certain machines. For the x86, GCC supports PIC for System V
12548 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
12549 position-independent.
12550
12551 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12552 are defined to 1.
12553
12554 @item -fPIC
12555 @opindex fPIC
12556 If supported for the target machine, emit position-independent code,
12557 suitable for dynamic linking and avoiding any limit on the size of the
12558 global offset table. This option makes a difference on AArch64, m68k,
12559 PowerPC and SPARC@.
12560
12561 Position-independent code requires special support, and therefore works
12562 only on certain machines.
12563
12564 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12565 are defined to 2.
12566
12567 @item -fpie
12568 @itemx -fPIE
12569 @opindex fpie
12570 @opindex fPIE
12571 These options are similar to @option{-fpic} and @option{-fPIC}, but
12572 generated position independent code can be only linked into executables.
12573 Usually these options are used when @option{-pie} GCC option is
12574 used during linking.
12575
12576 @option{-fpie} and @option{-fPIE} both define the macros
12577 @code{__pie__} and @code{__PIE__}. The macros have the value 1
12578 for @option{-fpie} and 2 for @option{-fPIE}.
12579
12580 @item -fno-plt
12581 @opindex fno-plt
12582 Do not use the PLT for external function calls in position-independent code.
12583 Instead, load the callee address at call sites from the GOT and branch to it.
12584 This leads to more efficient code by eliminating PLT stubs and exposing
12585 GOT loads to optimizations. On architectures such as 32-bit x86 where
12586 PLT stubs expect the GOT pointer in a specific register, this gives more
12587 register allocation freedom to the compiler.
12588 Lazy binding requires use of the PLT;
12589 with @option{-fno-plt} all external symbols are resolved at load time.
12590
12591 Alternatively, the function attribute @code{noplt} can be used to avoid calls
12592 through the PLT for specific external functions.
12593
12594 In position-dependent code, a few targets also convert calls to
12595 functions that are marked to not use the PLT to use the GOT instead.
12596
12597 @item -fno-jump-tables
12598 @opindex fno-jump-tables
12599 Do not use jump tables for switch statements even where it would be
12600 more efficient than other code generation strategies. This option is
12601 of use in conjunction with @option{-fpic} or @option{-fPIC} for
12602 building code that forms part of a dynamic linker and cannot
12603 reference the address of a jump table. On some targets, jump tables
12604 do not require a GOT and this option is not needed.
12605
12606 @item -ffixed-@var{reg}
12607 @opindex ffixed
12608 Treat the register named @var{reg} as a fixed register; generated code
12609 should never refer to it (except perhaps as a stack pointer, frame
12610 pointer or in some other fixed role).
12611
12612 @var{reg} must be the name of a register. The register names accepted
12613 are machine-specific and are defined in the @code{REGISTER_NAMES}
12614 macro in the machine description macro file.
12615
12616 This flag does not have a negative form, because it specifies a
12617 three-way choice.
12618
12619 @item -fcall-used-@var{reg}
12620 @opindex fcall-used
12621 Treat the register named @var{reg} as an allocable register that is
12622 clobbered by function calls. It may be allocated for temporaries or
12623 variables that do not live across a call. Functions compiled this way
12624 do not save and restore the register @var{reg}.
12625
12626 It is an error to use this flag with the frame pointer or stack pointer.
12627 Use of this flag for other registers that have fixed pervasive roles in
12628 the machine's execution model produces disastrous results.
12629
12630 This flag does not have a negative form, because it specifies a
12631 three-way choice.
12632
12633 @item -fcall-saved-@var{reg}
12634 @opindex fcall-saved
12635 Treat the register named @var{reg} as an allocable register saved by
12636 functions. It may be allocated even for temporaries or variables that
12637 live across a call. Functions compiled this way save and restore
12638 the register @var{reg} if they use it.
12639
12640 It is an error to use this flag with the frame pointer or stack pointer.
12641 Use of this flag for other registers that have fixed pervasive roles in
12642 the machine's execution model produces disastrous results.
12643
12644 A different sort of disaster results from the use of this flag for
12645 a register in which function values may be returned.
12646
12647 This flag does not have a negative form, because it specifies a
12648 three-way choice.
12649
12650 @item -fpack-struct[=@var{n}]
12651 @opindex fpack-struct
12652 Without a value specified, pack all structure members together without
12653 holes. When a value is specified (which must be a small power of two), pack
12654 structure members according to this value, representing the maximum
12655 alignment (that is, objects with default alignment requirements larger than
12656 this are output potentially unaligned at the next fitting location.
12657
12658 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
12659 code that is not binary compatible with code generated without that switch.
12660 Additionally, it makes the code suboptimal.
12661 Use it to conform to a non-default application binary interface.
12662
12663 @item -fleading-underscore
12664 @opindex fleading-underscore
12665 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
12666 change the way C symbols are represented in the object file. One use
12667 is to help link with legacy assembly code.
12668
12669 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
12670 generate code that is not binary compatible with code generated without that
12671 switch. Use it to conform to a non-default application binary interface.
12672 Not all targets provide complete support for this switch.
12673
12674 @item -ftls-model=@var{model}
12675 @opindex ftls-model
12676 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
12677 The @var{model} argument should be one of @samp{global-dynamic},
12678 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
12679 Note that the choice is subject to optimization: the compiler may use
12680 a more efficient model for symbols not visible outside of the translation
12681 unit, or if @option{-fpic} is not given on the command line.
12682
12683 The default without @option{-fpic} is @samp{initial-exec}; with
12684 @option{-fpic} the default is @samp{global-dynamic}.
12685
12686 @item -ftrampolines
12687 @opindex ftrampolines
12688 For targets that normally need trampolines for nested functions, always
12689 generate them instead of using descriptors. Otherwise, for targets that
12690 do not need them, like for example HP-PA or IA-64, do nothing.
12691
12692 A trampoline is a small piece of code that is created at run time on the
12693 stack when the address of a nested function is taken, and is used to call
12694 the nested function indirectly. Therefore, it requires the stack to be
12695 made executable in order for the program to work properly.
12696
12697 @option{-fno-trampolines} is enabled by default on a language by language
12698 basis to let the compiler avoid generating them, if it computes that this
12699 is safe, and replace them with descriptors. Descriptors are made up of data
12700 only, but the generated code must be prepared to deal with them. As of this
12701 writing, @option{-fno-trampolines} is enabled by default only for Ada.
12702
12703 Moreover, code compiled with @option{-ftrampolines} and code compiled with
12704 @option{-fno-trampolines} are not binary compatible if nested functions are
12705 present. This option must therefore be used on a program-wide basis and be
12706 manipulated with extreme care.
12707
12708 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
12709 @opindex fvisibility
12710 Set the default ELF image symbol visibility to the specified option---all
12711 symbols are marked with this unless overridden within the code.
12712 Using this feature can very substantially improve linking and
12713 load times of shared object libraries, produce more optimized
12714 code, provide near-perfect API export and prevent symbol clashes.
12715 It is @strong{strongly} recommended that you use this in any shared objects
12716 you distribute.
12717
12718 Despite the nomenclature, @samp{default} always means public; i.e.,
12719 available to be linked against from outside the shared object.
12720 @samp{protected} and @samp{internal} are pretty useless in real-world
12721 usage so the only other commonly used option is @samp{hidden}.
12722 The default if @option{-fvisibility} isn't specified is
12723 @samp{default}, i.e., make every symbol public.
12724
12725 A good explanation of the benefits offered by ensuring ELF
12726 symbols have the correct visibility is given by ``How To Write
12727 Shared Libraries'' by Ulrich Drepper (which can be found at
12728 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
12729 solution made possible by this option to marking things hidden when
12730 the default is public is to make the default hidden and mark things
12731 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
12732 and @code{__attribute__ ((visibility("default")))} instead of
12733 @code{__declspec(dllexport)} you get almost identical semantics with
12734 identical syntax. This is a great boon to those working with
12735 cross-platform projects.
12736
12737 For those adding visibility support to existing code, you may find
12738 @code{#pragma GCC visibility} of use. This works by you enclosing
12739 the declarations you wish to set visibility for with (for example)
12740 @code{#pragma GCC visibility push(hidden)} and
12741 @code{#pragma GCC visibility pop}.
12742 Bear in mind that symbol visibility should be viewed @strong{as
12743 part of the API interface contract} and thus all new code should
12744 always specify visibility when it is not the default; i.e., declarations
12745 only for use within the local DSO should @strong{always} be marked explicitly
12746 as hidden as so to avoid PLT indirection overheads---making this
12747 abundantly clear also aids readability and self-documentation of the code.
12748 Note that due to ISO C++ specification requirements, @code{operator new} and
12749 @code{operator delete} must always be of default visibility.
12750
12751 Be aware that headers from outside your project, in particular system
12752 headers and headers from any other library you use, may not be
12753 expecting to be compiled with visibility other than the default. You
12754 may need to explicitly say @code{#pragma GCC visibility push(default)}
12755 before including any such headers.
12756
12757 @code{extern} declarations are not affected by @option{-fvisibility}, so
12758 a lot of code can be recompiled with @option{-fvisibility=hidden} with
12759 no modifications. However, this means that calls to @code{extern}
12760 functions with no explicit visibility use the PLT, so it is more
12761 effective to use @code{__attribute ((visibility))} and/or
12762 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
12763 declarations should be treated as hidden.
12764
12765 Note that @option{-fvisibility} does affect C++ vague linkage
12766 entities. This means that, for instance, an exception class that is
12767 be thrown between DSOs must be explicitly marked with default
12768 visibility so that the @samp{type_info} nodes are unified between
12769 the DSOs.
12770
12771 An overview of these techniques, their benefits and how to use them
12772 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
12773
12774 @item -fstrict-volatile-bitfields
12775 @opindex fstrict-volatile-bitfields
12776 This option should be used if accesses to volatile bit-fields (or other
12777 structure fields, although the compiler usually honors those types
12778 anyway) should use a single access of the width of the
12779 field's type, aligned to a natural alignment if possible. For
12780 example, targets with memory-mapped peripheral registers might require
12781 all such accesses to be 16 bits wide; with this flag you can
12782 declare all peripheral bit-fields as @code{unsigned short} (assuming short
12783 is 16 bits on these targets) to force GCC to use 16-bit accesses
12784 instead of, perhaps, a more efficient 32-bit access.
12785
12786 If this option is disabled, the compiler uses the most efficient
12787 instruction. In the previous example, that might be a 32-bit load
12788 instruction, even though that accesses bytes that do not contain
12789 any portion of the bit-field, or memory-mapped registers unrelated to
12790 the one being updated.
12791
12792 In some cases, such as when the @code{packed} attribute is applied to a
12793 structure field, it may not be possible to access the field with a single
12794 read or write that is correctly aligned for the target machine. In this
12795 case GCC falls back to generating multiple accesses rather than code that
12796 will fault or truncate the result at run time.
12797
12798 Note: Due to restrictions of the C/C++11 memory model, write accesses are
12799 not allowed to touch non bit-field members. It is therefore recommended
12800 to define all bits of the field's type as bit-field members.
12801
12802 The default value of this option is determined by the application binary
12803 interface for the target processor.
12804
12805 @item -fsync-libcalls
12806 @opindex fsync-libcalls
12807 This option controls whether any out-of-line instance of the @code{__sync}
12808 family of functions may be used to implement the C++11 @code{__atomic}
12809 family of functions.
12810
12811 The default value of this option is enabled, thus the only useful form
12812 of the option is @option{-fno-sync-libcalls}. This option is used in
12813 the implementation of the @file{libatomic} runtime library.
12814
12815 @end table
12816
12817 @node Developer Options
12818 @section GCC Developer Options
12819 @cindex developer options
12820 @cindex debugging GCC
12821 @cindex debug dump options
12822 @cindex dump options
12823 @cindex compilation statistics
12824
12825 This section describes command-line options that are primarily of
12826 interest to GCC developers, including options to support compiler
12827 testing and investigation of compiler bugs and compile-time
12828 performance problems. This includes options that produce debug dumps
12829 at various points in the compilation; that print statistics such as
12830 memory use and execution time; and that print information about GCC's
12831 configuration, such as where it searches for libraries. You should
12832 rarely need to use any of these options for ordinary compilation and
12833 linking tasks.
12834
12835 @table @gcctabopt
12836
12837 @item -d@var{letters}
12838 @itemx -fdump-rtl-@var{pass}
12839 @itemx -fdump-rtl-@var{pass}=@var{filename}
12840 @opindex d
12841 @opindex fdump-rtl-@var{pass}
12842 Says to make debugging dumps during compilation at times specified by
12843 @var{letters}. This is used for debugging the RTL-based passes of the
12844 compiler. The file names for most of the dumps are made by appending
12845 a pass number and a word to the @var{dumpname}, and the files are
12846 created in the directory of the output file. In case of
12847 @option{=@var{filename}} option, the dump is output on the given file
12848 instead of the pass numbered dump files. Note that the pass number is
12849 assigned as passes are registered into the pass manager. Most passes
12850 are registered in the order that they will execute and for these passes
12851 the number corresponds to the pass execution order. However, passes
12852 registered by plugins, passes specific to compilation targets, or
12853 passes that are otherwise registered after all the other passes are
12854 numbered higher than a pass named "final", even if they are executed
12855 earlier. @var{dumpname} is generated from the name of the output
12856 file if explicitly specified and not an executable, otherwise it is
12857 the basename of the source file.
12858
12859 Some @option{-d@var{letters}} switches have different meaning when
12860 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
12861 for information about preprocessor-specific dump options.
12862
12863 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
12864 @option{-d} option @var{letters}. Here are the possible
12865 letters for use in @var{pass} and @var{letters}, and their meanings:
12866
12867 @table @gcctabopt
12868
12869 @item -fdump-rtl-alignments
12870 @opindex fdump-rtl-alignments
12871 Dump after branch alignments have been computed.
12872
12873 @item -fdump-rtl-asmcons
12874 @opindex fdump-rtl-asmcons
12875 Dump after fixing rtl statements that have unsatisfied in/out constraints.
12876
12877 @item -fdump-rtl-auto_inc_dec
12878 @opindex fdump-rtl-auto_inc_dec
12879 Dump after auto-inc-dec discovery. This pass is only run on
12880 architectures that have auto inc or auto dec instructions.
12881
12882 @item -fdump-rtl-barriers
12883 @opindex fdump-rtl-barriers
12884 Dump after cleaning up the barrier instructions.
12885
12886 @item -fdump-rtl-bbpart
12887 @opindex fdump-rtl-bbpart
12888 Dump after partitioning hot and cold basic blocks.
12889
12890 @item -fdump-rtl-bbro
12891 @opindex fdump-rtl-bbro
12892 Dump after block reordering.
12893
12894 @item -fdump-rtl-btl1
12895 @itemx -fdump-rtl-btl2
12896 @opindex fdump-rtl-btl2
12897 @opindex fdump-rtl-btl2
12898 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
12899 after the two branch
12900 target load optimization passes.
12901
12902 @item -fdump-rtl-bypass
12903 @opindex fdump-rtl-bypass
12904 Dump after jump bypassing and control flow optimizations.
12905
12906 @item -fdump-rtl-combine
12907 @opindex fdump-rtl-combine
12908 Dump after the RTL instruction combination pass.
12909
12910 @item -fdump-rtl-compgotos
12911 @opindex fdump-rtl-compgotos
12912 Dump after duplicating the computed gotos.
12913
12914 @item -fdump-rtl-ce1
12915 @itemx -fdump-rtl-ce2
12916 @itemx -fdump-rtl-ce3
12917 @opindex fdump-rtl-ce1
12918 @opindex fdump-rtl-ce2
12919 @opindex fdump-rtl-ce3
12920 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
12921 @option{-fdump-rtl-ce3} enable dumping after the three
12922 if conversion passes.
12923
12924 @item -fdump-rtl-cprop_hardreg
12925 @opindex fdump-rtl-cprop_hardreg
12926 Dump after hard register copy propagation.
12927
12928 @item -fdump-rtl-csa
12929 @opindex fdump-rtl-csa
12930 Dump after combining stack adjustments.
12931
12932 @item -fdump-rtl-cse1
12933 @itemx -fdump-rtl-cse2
12934 @opindex fdump-rtl-cse1
12935 @opindex fdump-rtl-cse2
12936 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
12937 the two common subexpression elimination passes.
12938
12939 @item -fdump-rtl-dce
12940 @opindex fdump-rtl-dce
12941 Dump after the standalone dead code elimination passes.
12942
12943 @item -fdump-rtl-dbr
12944 @opindex fdump-rtl-dbr
12945 Dump after delayed branch scheduling.
12946
12947 @item -fdump-rtl-dce1
12948 @itemx -fdump-rtl-dce2
12949 @opindex fdump-rtl-dce1
12950 @opindex fdump-rtl-dce2
12951 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
12952 the two dead store elimination passes.
12953
12954 @item -fdump-rtl-eh
12955 @opindex fdump-rtl-eh
12956 Dump after finalization of EH handling code.
12957
12958 @item -fdump-rtl-eh_ranges
12959 @opindex fdump-rtl-eh_ranges
12960 Dump after conversion of EH handling range regions.
12961
12962 @item -fdump-rtl-expand
12963 @opindex fdump-rtl-expand
12964 Dump after RTL generation.
12965
12966 @item -fdump-rtl-fwprop1
12967 @itemx -fdump-rtl-fwprop2
12968 @opindex fdump-rtl-fwprop1
12969 @opindex fdump-rtl-fwprop2
12970 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
12971 dumping after the two forward propagation passes.
12972
12973 @item -fdump-rtl-gcse1
12974 @itemx -fdump-rtl-gcse2
12975 @opindex fdump-rtl-gcse1
12976 @opindex fdump-rtl-gcse2
12977 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
12978 after global common subexpression elimination.
12979
12980 @item -fdump-rtl-init-regs
12981 @opindex fdump-rtl-init-regs
12982 Dump after the initialization of the registers.
12983
12984 @item -fdump-rtl-initvals
12985 @opindex fdump-rtl-initvals
12986 Dump after the computation of the initial value sets.
12987
12988 @item -fdump-rtl-into_cfglayout
12989 @opindex fdump-rtl-into_cfglayout
12990 Dump after converting to cfglayout mode.
12991
12992 @item -fdump-rtl-ira
12993 @opindex fdump-rtl-ira
12994 Dump after iterated register allocation.
12995
12996 @item -fdump-rtl-jump
12997 @opindex fdump-rtl-jump
12998 Dump after the second jump optimization.
12999
13000 @item -fdump-rtl-loop2
13001 @opindex fdump-rtl-loop2
13002 @option{-fdump-rtl-loop2} enables dumping after the rtl
13003 loop optimization passes.
13004
13005 @item -fdump-rtl-mach
13006 @opindex fdump-rtl-mach
13007 Dump after performing the machine dependent reorganization pass, if that
13008 pass exists.
13009
13010 @item -fdump-rtl-mode_sw
13011 @opindex fdump-rtl-mode_sw
13012 Dump after removing redundant mode switches.
13013
13014 @item -fdump-rtl-rnreg
13015 @opindex fdump-rtl-rnreg
13016 Dump after register renumbering.
13017
13018 @item -fdump-rtl-outof_cfglayout
13019 @opindex fdump-rtl-outof_cfglayout
13020 Dump after converting from cfglayout mode.
13021
13022 @item -fdump-rtl-peephole2
13023 @opindex fdump-rtl-peephole2
13024 Dump after the peephole pass.
13025
13026 @item -fdump-rtl-postreload
13027 @opindex fdump-rtl-postreload
13028 Dump after post-reload optimizations.
13029
13030 @item -fdump-rtl-pro_and_epilogue
13031 @opindex fdump-rtl-pro_and_epilogue
13032 Dump after generating the function prologues and epilogues.
13033
13034 @item -fdump-rtl-sched1
13035 @itemx -fdump-rtl-sched2
13036 @opindex fdump-rtl-sched1
13037 @opindex fdump-rtl-sched2
13038 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
13039 after the basic block scheduling passes.
13040
13041 @item -fdump-rtl-ree
13042 @opindex fdump-rtl-ree
13043 Dump after sign/zero extension elimination.
13044
13045 @item -fdump-rtl-seqabstr
13046 @opindex fdump-rtl-seqabstr
13047 Dump after common sequence discovery.
13048
13049 @item -fdump-rtl-shorten
13050 @opindex fdump-rtl-shorten
13051 Dump after shortening branches.
13052
13053 @item -fdump-rtl-sibling
13054 @opindex fdump-rtl-sibling
13055 Dump after sibling call optimizations.
13056
13057 @item -fdump-rtl-split1
13058 @itemx -fdump-rtl-split2
13059 @itemx -fdump-rtl-split3
13060 @itemx -fdump-rtl-split4
13061 @itemx -fdump-rtl-split5
13062 @opindex fdump-rtl-split1
13063 @opindex fdump-rtl-split2
13064 @opindex fdump-rtl-split3
13065 @opindex fdump-rtl-split4
13066 @opindex fdump-rtl-split5
13067 These options enable dumping after five rounds of
13068 instruction splitting.
13069
13070 @item -fdump-rtl-sms
13071 @opindex fdump-rtl-sms
13072 Dump after modulo scheduling. This pass is only run on some
13073 architectures.
13074
13075 @item -fdump-rtl-stack
13076 @opindex fdump-rtl-stack
13077 Dump after conversion from GCC's ``flat register file'' registers to the
13078 x87's stack-like registers. This pass is only run on x86 variants.
13079
13080 @item -fdump-rtl-subreg1
13081 @itemx -fdump-rtl-subreg2
13082 @opindex fdump-rtl-subreg1
13083 @opindex fdump-rtl-subreg2
13084 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
13085 the two subreg expansion passes.
13086
13087 @item -fdump-rtl-unshare
13088 @opindex fdump-rtl-unshare
13089 Dump after all rtl has been unshared.
13090
13091 @item -fdump-rtl-vartrack
13092 @opindex fdump-rtl-vartrack
13093 Dump after variable tracking.
13094
13095 @item -fdump-rtl-vregs
13096 @opindex fdump-rtl-vregs
13097 Dump after converting virtual registers to hard registers.
13098
13099 @item -fdump-rtl-web
13100 @opindex fdump-rtl-web
13101 Dump after live range splitting.
13102
13103 @item -fdump-rtl-regclass
13104 @itemx -fdump-rtl-subregs_of_mode_init
13105 @itemx -fdump-rtl-subregs_of_mode_finish
13106 @itemx -fdump-rtl-dfinit
13107 @itemx -fdump-rtl-dfinish
13108 @opindex fdump-rtl-regclass
13109 @opindex fdump-rtl-subregs_of_mode_init
13110 @opindex fdump-rtl-subregs_of_mode_finish
13111 @opindex fdump-rtl-dfinit
13112 @opindex fdump-rtl-dfinish
13113 These dumps are defined but always produce empty files.
13114
13115 @item -da
13116 @itemx -fdump-rtl-all
13117 @opindex da
13118 @opindex fdump-rtl-all
13119 Produce all the dumps listed above.
13120
13121 @item -dA
13122 @opindex dA
13123 Annotate the assembler output with miscellaneous debugging information.
13124
13125 @item -dD
13126 @opindex dD
13127 Dump all macro definitions, at the end of preprocessing, in addition to
13128 normal output.
13129
13130 @item -dH
13131 @opindex dH
13132 Produce a core dump whenever an error occurs.
13133
13134 @item -dp
13135 @opindex dp
13136 Annotate the assembler output with a comment indicating which
13137 pattern and alternative is used. The length of each instruction is
13138 also printed.
13139
13140 @item -dP
13141 @opindex dP
13142 Dump the RTL in the assembler output as a comment before each instruction.
13143 Also turns on @option{-dp} annotation.
13144
13145 @item -dx
13146 @opindex dx
13147 Just generate RTL for a function instead of compiling it. Usually used
13148 with @option{-fdump-rtl-expand}.
13149 @end table
13150
13151 @item -fdump-noaddr
13152 @opindex fdump-noaddr
13153 When doing debugging dumps, suppress address output. This makes it more
13154 feasible to use diff on debugging dumps for compiler invocations with
13155 different compiler binaries and/or different
13156 text / bss / data / heap / stack / dso start locations.
13157
13158 @item -freport-bug
13159 @opindex freport-bug
13160 Collect and dump debug information into a temporary file if an
13161 internal compiler error (ICE) occurs.
13162
13163 @item -fdump-unnumbered
13164 @opindex fdump-unnumbered
13165 When doing debugging dumps, suppress instruction numbers and address output.
13166 This makes it more feasible to use diff on debugging dumps for compiler
13167 invocations with different options, in particular with and without
13168 @option{-g}.
13169
13170 @item -fdump-unnumbered-links
13171 @opindex fdump-unnumbered-links
13172 When doing debugging dumps (see @option{-d} option above), suppress
13173 instruction numbers for the links to the previous and next instructions
13174 in a sequence.
13175
13176 @item -fdump-ipa-@var{switch}
13177 @opindex fdump-ipa
13178 Control the dumping at various stages of inter-procedural analysis
13179 language tree to a file. The file name is generated by appending a
13180 switch specific suffix to the source file name, and the file is created
13181 in the same directory as the output file. The following dumps are
13182 possible:
13183
13184 @table @samp
13185 @item all
13186 Enables all inter-procedural analysis dumps.
13187
13188 @item cgraph
13189 Dumps information about call-graph optimization, unused function removal,
13190 and inlining decisions.
13191
13192 @item inline
13193 Dump after function inlining.
13194
13195 @end table
13196
13197 @item -fdump-lang-all
13198 @itemx -fdump-lang-@var{switch}
13199 @itemx -fdump-lang-@var{switch}-@var{options}
13200 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
13201 @opindex fdump-lang-all
13202 @opindex fdump-lang
13203 Control the dumping of language-specific information. The @var{options}
13204 and @var{filename} portions behave as described in the
13205 @option{-fdump-tree} option. The following @var{switch} values are
13206 accepted:
13207
13208 @table @samp
13209 @item all
13210
13211 Enable all language-specific dumps.
13212
13213 @item class
13214 Dump class hierarchy information. Virtual table information is emitted
13215 unless '@option{slim}' is specified. This option is applicable to C++ only.
13216
13217 @item raw
13218 Dump the raw internal tree data. This option is applicable to C++ only.
13219
13220 @end table
13221
13222 @item -fdump-passes
13223 @opindex fdump-passes
13224 Print on @file{stderr} the list of optimization passes that are turned
13225 on and off by the current command-line options.
13226
13227 @item -fdump-statistics-@var{option}
13228 @opindex fdump-statistics
13229 Enable and control dumping of pass statistics in a separate file. The
13230 file name is generated by appending a suffix ending in
13231 @samp{.statistics} to the source file name, and the file is created in
13232 the same directory as the output file. If the @samp{-@var{option}}
13233 form is used, @samp{-stats} causes counters to be summed over the
13234 whole compilation unit while @samp{-details} dumps every event as
13235 the passes generate them. The default with no option is to sum
13236 counters for each function compiled.
13237
13238 @item -fdump-tree-all
13239 @itemx -fdump-tree-@var{switch}
13240 @itemx -fdump-tree-@var{switch}-@var{options}
13241 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
13242 @opindex fdump-tree-all
13243 @opindex fdump-tree
13244 Control the dumping at various stages of processing the intermediate
13245 language tree to a file. The file name is generated by appending a
13246 switch-specific suffix to the source file name, and the file is
13247 created in the same directory as the output file. In case of
13248 @option{=@var{filename}} option, the dump is output on the given file
13249 instead of the auto named dump files. If the @samp{-@var{options}}
13250 form is used, @var{options} is a list of @samp{-} separated options
13251 which control the details of the dump. Not all options are applicable
13252 to all dumps; those that are not meaningful are ignored. The
13253 following options are available
13254
13255 @table @samp
13256 @item address
13257 Print the address of each node. Usually this is not meaningful as it
13258 changes according to the environment and source file. Its primary use
13259 is for tying up a dump file with a debug environment.
13260 @item asmname
13261 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
13262 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
13263 use working backward from mangled names in the assembly file.
13264 @item slim
13265 When dumping front-end intermediate representations, inhibit dumping
13266 of members of a scope or body of a function merely because that scope
13267 has been reached. Only dump such items when they are directly reachable
13268 by some other path.
13269
13270 When dumping pretty-printed trees, this option inhibits dumping the
13271 bodies of control structures.
13272
13273 When dumping RTL, print the RTL in slim (condensed) form instead of
13274 the default LISP-like representation.
13275 @item raw
13276 Print a raw representation of the tree. By default, trees are
13277 pretty-printed into a C-like representation.
13278 @item details
13279 Enable more detailed dumps (not honored by every dump option). Also
13280 include information from the optimization passes.
13281 @item stats
13282 Enable dumping various statistics about the pass (not honored by every dump
13283 option).
13284 @item blocks
13285 Enable showing basic block boundaries (disabled in raw dumps).
13286 @item graph
13287 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
13288 dump a representation of the control flow graph suitable for viewing with
13289 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
13290 the file is pretty-printed as a subgraph, so that GraphViz can render them
13291 all in a single plot.
13292
13293 This option currently only works for RTL dumps, and the RTL is always
13294 dumped in slim form.
13295 @item vops
13296 Enable showing virtual operands for every statement.
13297 @item lineno
13298 Enable showing line numbers for statements.
13299 @item uid
13300 Enable showing the unique ID (@code{DECL_UID}) for each variable.
13301 @item verbose
13302 Enable showing the tree dump for each statement.
13303 @item eh
13304 Enable showing the EH region number holding each statement.
13305 @item scev
13306 Enable showing scalar evolution analysis details.
13307 @item optimized
13308 Enable showing optimization information (only available in certain
13309 passes).
13310 @item missed
13311 Enable showing missed optimization information (only available in certain
13312 passes).
13313 @item note
13314 Enable other detailed optimization information (only available in
13315 certain passes).
13316 @item =@var{filename}
13317 Instead of an auto named dump file, output into the given file
13318 name. The file names @file{stdout} and @file{stderr} are treated
13319 specially and are considered already open standard streams. For
13320 example,
13321
13322 @smallexample
13323 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
13324 -fdump-tree-pre=/dev/stderr file.c
13325 @end smallexample
13326
13327 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
13328 output on to @file{stderr}. If two conflicting dump filenames are
13329 given for the same pass, then the latter option overrides the earlier
13330 one.
13331
13332 @item all
13333 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
13334 and @option{lineno}.
13335
13336 @item optall
13337 Turn on all optimization options, i.e., @option{optimized},
13338 @option{missed}, and @option{note}.
13339 @end table
13340
13341 To determine what tree dumps are available or find the dump for a pass
13342 of interest follow the steps below.
13343
13344 @enumerate
13345 @item
13346 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
13347 look for a code that corresponds to the pass you are interested in.
13348 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
13349 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
13350 The number at the end distinguishes distinct invocations of the same pass.
13351 @item
13352 To enable the creation of the dump file, append the pass code to
13353 the @option{-fdump-} option prefix and invoke GCC with it. For example,
13354 to enable the dump from the Early Value Range Propagation pass, invoke
13355 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
13356 specify the name of the dump file. If you don't specify one, GCC
13357 creates as described below.
13358 @item
13359 Find the pass dump in a file whose name is composed of three components
13360 separated by a period: the name of the source file GCC was invoked to
13361 compile, a numeric suffix indicating the pass number followed by the
13362 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
13363 and finally the pass code. For example, the Early VRP pass dump might
13364 be in a file named @file{myfile.c.038t.evrp} in the current working
13365 directory. Note that the numeric codes are not stable and may change
13366 from one version of GCC to another.
13367 @end enumerate
13368
13369 @item -fopt-info
13370 @itemx -fopt-info-@var{options}
13371 @itemx -fopt-info-@var{options}=@var{filename}
13372 @opindex fopt-info
13373 Controls optimization dumps from various optimization passes. If the
13374 @samp{-@var{options}} form is used, @var{options} is a list of
13375 @samp{-} separated option keywords to select the dump details and
13376 optimizations.
13377
13378 The @var{options} can be divided into two groups: options describing the
13379 verbosity of the dump, and options describing which optimizations
13380 should be included. The options from both the groups can be freely
13381 mixed as they are non-overlapping. However, in case of any conflicts,
13382 the later options override the earlier options on the command
13383 line.
13384
13385 The following options control the dump verbosity:
13386
13387 @table @samp
13388 @item optimized
13389 Print information when an optimization is successfully applied. It is
13390 up to a pass to decide which information is relevant. For example, the
13391 vectorizer passes print the source location of loops which are
13392 successfully vectorized.
13393 @item missed
13394 Print information about missed optimizations. Individual passes
13395 control which information to include in the output.
13396 @item note
13397 Print verbose information about optimizations, such as certain
13398 transformations, more detailed messages about decisions etc.
13399 @item all
13400 Print detailed optimization information. This includes
13401 @samp{optimized}, @samp{missed}, and @samp{note}.
13402 @end table
13403
13404 One or more of the following option keywords can be used to describe a
13405 group of optimizations:
13406
13407 @table @samp
13408 @item ipa
13409 Enable dumps from all interprocedural optimizations.
13410 @item loop
13411 Enable dumps from all loop optimizations.
13412 @item inline
13413 Enable dumps from all inlining optimizations.
13414 @item omp
13415 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
13416 @item vec
13417 Enable dumps from all vectorization optimizations.
13418 @item optall
13419 Enable dumps from all optimizations. This is a superset of
13420 the optimization groups listed above.
13421 @end table
13422
13423 If @var{options} is
13424 omitted, it defaults to @samp{optimized-optall}, which means to dump all
13425 info about successful optimizations from all the passes.
13426
13427 If the @var{filename} is provided, then the dumps from all the
13428 applicable optimizations are concatenated into the @var{filename}.
13429 Otherwise the dump is output onto @file{stderr}. Though multiple
13430 @option{-fopt-info} options are accepted, only one of them can include
13431 a @var{filename}. If other filenames are provided then all but the
13432 first such option are ignored.
13433
13434 Note that the output @var{filename} is overwritten
13435 in case of multiple translation units. If a combined output from
13436 multiple translation units is desired, @file{stderr} should be used
13437 instead.
13438
13439 In the following example, the optimization info is output to
13440 @file{stderr}:
13441
13442 @smallexample
13443 gcc -O3 -fopt-info
13444 @end smallexample
13445
13446 This example:
13447 @smallexample
13448 gcc -O3 -fopt-info-missed=missed.all
13449 @end smallexample
13450
13451 @noindent
13452 outputs missed optimization report from all the passes into
13453 @file{missed.all}, and this one:
13454
13455 @smallexample
13456 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
13457 @end smallexample
13458
13459 @noindent
13460 prints information about missed optimization opportunities from
13461 vectorization passes on @file{stderr}.
13462 Note that @option{-fopt-info-vec-missed} is equivalent to
13463 @option{-fopt-info-missed-vec}. The order of the optimization group
13464 names and message types listed after @option{-fopt-info} does not matter.
13465
13466 As another example,
13467 @smallexample
13468 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
13469 @end smallexample
13470
13471 @noindent
13472 outputs information about missed optimizations as well as
13473 optimized locations from all the inlining passes into
13474 @file{inline.txt}.
13475
13476 Finally, consider:
13477
13478 @smallexample
13479 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
13480 @end smallexample
13481
13482 @noindent
13483 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
13484 in conflict since only one output file is allowed. In this case, only
13485 the first option takes effect and the subsequent options are
13486 ignored. Thus only @file{vec.miss} is produced which contains
13487 dumps from the vectorizer about missed opportunities.
13488
13489 @item -fsched-verbose=@var{n}
13490 @opindex fsched-verbose
13491 On targets that use instruction scheduling, this option controls the
13492 amount of debugging output the scheduler prints to the dump files.
13493
13494 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
13495 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
13496 For @var{n} greater than one, it also output basic block probabilities,
13497 detailed ready list information and unit/insn info. For @var{n} greater
13498 than two, it includes RTL at abort point, control-flow and regions info.
13499 And for @var{n} over four, @option{-fsched-verbose} also includes
13500 dependence info.
13501
13502
13503
13504 @item -fenable-@var{kind}-@var{pass}
13505 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
13506 @opindex fdisable-
13507 @opindex fenable-
13508
13509 This is a set of options that are used to explicitly disable/enable
13510 optimization passes. These options are intended for use for debugging GCC.
13511 Compiler users should use regular options for enabling/disabling
13512 passes instead.
13513
13514 @table @gcctabopt
13515
13516 @item -fdisable-ipa-@var{pass}
13517 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13518 statically invoked in the compiler multiple times, the pass name should be
13519 appended with a sequential number starting from 1.
13520
13521 @item -fdisable-rtl-@var{pass}
13522 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
13523 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
13524 statically invoked in the compiler multiple times, the pass name should be
13525 appended with a sequential number starting from 1. @var{range-list} is a
13526 comma-separated list of function ranges or assembler names. Each range is a number
13527 pair separated by a colon. The range is inclusive in both ends. If the range
13528 is trivial, the number pair can be simplified as a single number. If the
13529 function's call graph node's @var{uid} falls within one of the specified ranges,
13530 the @var{pass} is disabled for that function. The @var{uid} is shown in the
13531 function header of a dump file, and the pass names can be dumped by using
13532 option @option{-fdump-passes}.
13533
13534 @item -fdisable-tree-@var{pass}
13535 @itemx -fdisable-tree-@var{pass}=@var{range-list}
13536 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
13537 option arguments.
13538
13539 @item -fenable-ipa-@var{pass}
13540 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13541 statically invoked in the compiler multiple times, the pass name should be
13542 appended with a sequential number starting from 1.
13543
13544 @item -fenable-rtl-@var{pass}
13545 @itemx -fenable-rtl-@var{pass}=@var{range-list}
13546 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
13547 description and examples.
13548
13549 @item -fenable-tree-@var{pass}
13550 @itemx -fenable-tree-@var{pass}=@var{range-list}
13551 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
13552 of option arguments.
13553
13554 @end table
13555
13556 Here are some examples showing uses of these options.
13557
13558 @smallexample
13559
13560 # disable ccp1 for all functions
13561 -fdisable-tree-ccp1
13562 # disable complete unroll for function whose cgraph node uid is 1
13563 -fenable-tree-cunroll=1
13564 # disable gcse2 for functions at the following ranges [1,1],
13565 # [300,400], and [400,1000]
13566 # disable gcse2 for functions foo and foo2
13567 -fdisable-rtl-gcse2=foo,foo2
13568 # disable early inlining
13569 -fdisable-tree-einline
13570 # disable ipa inlining
13571 -fdisable-ipa-inline
13572 # enable tree full unroll
13573 -fenable-tree-unroll
13574
13575 @end smallexample
13576
13577 @item -fchecking
13578 @itemx -fchecking=@var{n}
13579 @opindex fchecking
13580 @opindex fno-checking
13581 Enable internal consistency checking. The default depends on
13582 the compiler configuration. @option{-fchecking=2} enables further
13583 internal consistency checking that might affect code generation.
13584
13585 @item -frandom-seed=@var{string}
13586 @opindex frandom-seed
13587 This option provides a seed that GCC uses in place of
13588 random numbers in generating certain symbol names
13589 that have to be different in every compiled file. It is also used to
13590 place unique stamps in coverage data files and the object files that
13591 produce them. You can use the @option{-frandom-seed} option to produce
13592 reproducibly identical object files.
13593
13594 The @var{string} can either be a number (decimal, octal or hex) or an
13595 arbitrary string (in which case it's converted to a number by
13596 computing CRC32).
13597
13598 The @var{string} should be different for every file you compile.
13599
13600 @item -save-temps
13601 @itemx -save-temps=cwd
13602 @opindex save-temps
13603 Store the usual ``temporary'' intermediate files permanently; place them
13604 in the current directory and name them based on the source file. Thus,
13605 compiling @file{foo.c} with @option{-c -save-temps} produces files
13606 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
13607 preprocessed @file{foo.i} output file even though the compiler now
13608 normally uses an integrated preprocessor.
13609
13610 When used in combination with the @option{-x} command-line option,
13611 @option{-save-temps} is sensible enough to avoid over writing an
13612 input source file with the same extension as an intermediate file.
13613 The corresponding intermediate file may be obtained by renaming the
13614 source file before using @option{-save-temps}.
13615
13616 If you invoke GCC in parallel, compiling several different source
13617 files that share a common base name in different subdirectories or the
13618 same source file compiled for multiple output destinations, it is
13619 likely that the different parallel compilers will interfere with each
13620 other, and overwrite the temporary files. For instance:
13621
13622 @smallexample
13623 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
13624 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
13625 @end smallexample
13626
13627 may result in @file{foo.i} and @file{foo.o} being written to
13628 simultaneously by both compilers.
13629
13630 @item -save-temps=obj
13631 @opindex save-temps=obj
13632 Store the usual ``temporary'' intermediate files permanently. If the
13633 @option{-o} option is used, the temporary files are based on the
13634 object file. If the @option{-o} option is not used, the
13635 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
13636
13637 For example:
13638
13639 @smallexample
13640 gcc -save-temps=obj -c foo.c
13641 gcc -save-temps=obj -c bar.c -o dir/xbar.o
13642 gcc -save-temps=obj foobar.c -o dir2/yfoobar
13643 @end smallexample
13644
13645 @noindent
13646 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
13647 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
13648 @file{dir2/yfoobar.o}.
13649
13650 @item -time@r{[}=@var{file}@r{]}
13651 @opindex time
13652 Report the CPU time taken by each subprocess in the compilation
13653 sequence. For C source files, this is the compiler proper and assembler
13654 (plus the linker if linking is done).
13655
13656 Without the specification of an output file, the output looks like this:
13657
13658 @smallexample
13659 # cc1 0.12 0.01
13660 # as 0.00 0.01
13661 @end smallexample
13662
13663 The first number on each line is the ``user time'', that is time spent
13664 executing the program itself. The second number is ``system time'',
13665 time spent executing operating system routines on behalf of the program.
13666 Both numbers are in seconds.
13667
13668 With the specification of an output file, the output is appended to the
13669 named file, and it looks like this:
13670
13671 @smallexample
13672 0.12 0.01 cc1 @var{options}
13673 0.00 0.01 as @var{options}
13674 @end smallexample
13675
13676 The ``user time'' and the ``system time'' are moved before the program
13677 name, and the options passed to the program are displayed, so that one
13678 can later tell what file was being compiled, and with which options.
13679
13680 @item -fdump-final-insns@r{[}=@var{file}@r{]}
13681 @opindex fdump-final-insns
13682 Dump the final internal representation (RTL) to @var{file}. If the
13683 optional argument is omitted (or if @var{file} is @code{.}), the name
13684 of the dump file is determined by appending @code{.gkd} to the
13685 compilation output file name.
13686
13687 @item -fcompare-debug@r{[}=@var{opts}@r{]}
13688 @opindex fcompare-debug
13689 @opindex fno-compare-debug
13690 If no error occurs during compilation, run the compiler a second time,
13691 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
13692 passed to the second compilation. Dump the final internal
13693 representation in both compilations, and print an error if they differ.
13694
13695 If the equal sign is omitted, the default @option{-gtoggle} is used.
13696
13697 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
13698 and nonzero, implicitly enables @option{-fcompare-debug}. If
13699 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
13700 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
13701 is used.
13702
13703 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
13704 is equivalent to @option{-fno-compare-debug}, which disables the dumping
13705 of the final representation and the second compilation, preventing even
13706 @env{GCC_COMPARE_DEBUG} from taking effect.
13707
13708 To verify full coverage during @option{-fcompare-debug} testing, set
13709 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
13710 which GCC rejects as an invalid option in any actual compilation
13711 (rather than preprocessing, assembly or linking). To get just a
13712 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
13713 not overridden} will do.
13714
13715 @item -fcompare-debug-second
13716 @opindex fcompare-debug-second
13717 This option is implicitly passed to the compiler for the second
13718 compilation requested by @option{-fcompare-debug}, along with options to
13719 silence warnings, and omitting other options that would cause
13720 side-effect compiler outputs to files or to the standard output. Dump
13721 files and preserved temporary files are renamed so as to contain the
13722 @code{.gk} additional extension during the second compilation, to avoid
13723 overwriting those generated by the first.
13724
13725 When this option is passed to the compiler driver, it causes the
13726 @emph{first} compilation to be skipped, which makes it useful for little
13727 other than debugging the compiler proper.
13728
13729 @item -gtoggle
13730 @opindex gtoggle
13731 Turn off generation of debug info, if leaving out this option
13732 generates it, or turn it on at level 2 otherwise. The position of this
13733 argument in the command line does not matter; it takes effect after all
13734 other options are processed, and it does so only once, no matter how
13735 many times it is given. This is mainly intended to be used with
13736 @option{-fcompare-debug}.
13737
13738 @item -fvar-tracking-assignments-toggle
13739 @opindex fvar-tracking-assignments-toggle
13740 @opindex fno-var-tracking-assignments-toggle
13741 Toggle @option{-fvar-tracking-assignments}, in the same way that
13742 @option{-gtoggle} toggles @option{-g}.
13743
13744 @item -Q
13745 @opindex Q
13746 Makes the compiler print out each function name as it is compiled, and
13747 print some statistics about each pass when it finishes.
13748
13749 @item -ftime-report
13750 @opindex ftime-report
13751 Makes the compiler print some statistics about the time consumed by each
13752 pass when it finishes.
13753
13754 @item -ftime-report-details
13755 @opindex ftime-report-details
13756 Record the time consumed by infrastructure parts separately for each pass.
13757
13758 @item -fira-verbose=@var{n}
13759 @opindex fira-verbose
13760 Control the verbosity of the dump file for the integrated register allocator.
13761 The default value is 5. If the value @var{n} is greater or equal to 10,
13762 the dump output is sent to stderr using the same format as @var{n} minus 10.
13763
13764 @item -flto-report
13765 @opindex flto-report
13766 Prints a report with internal details on the workings of the link-time
13767 optimizer. The contents of this report vary from version to version.
13768 It is meant to be useful to GCC developers when processing object
13769 files in LTO mode (via @option{-flto}).
13770
13771 Disabled by default.
13772
13773 @item -flto-report-wpa
13774 @opindex flto-report-wpa
13775 Like @option{-flto-report}, but only print for the WPA phase of Link
13776 Time Optimization.
13777
13778 @item -fmem-report
13779 @opindex fmem-report
13780 Makes the compiler print some statistics about permanent memory
13781 allocation when it finishes.
13782
13783 @item -fmem-report-wpa
13784 @opindex fmem-report-wpa
13785 Makes the compiler print some statistics about permanent memory
13786 allocation for the WPA phase only.
13787
13788 @item -fpre-ipa-mem-report
13789 @opindex fpre-ipa-mem-report
13790 @item -fpost-ipa-mem-report
13791 @opindex fpost-ipa-mem-report
13792 Makes the compiler print some statistics about permanent memory
13793 allocation before or after interprocedural optimization.
13794
13795 @item -fprofile-report
13796 @opindex fprofile-report
13797 Makes the compiler print some statistics about consistency of the
13798 (estimated) profile and effect of individual passes.
13799
13800 @item -fstack-usage
13801 @opindex fstack-usage
13802 Makes the compiler output stack usage information for the program, on a
13803 per-function basis. The filename for the dump is made by appending
13804 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
13805 the output file, if explicitly specified and it is not an executable,
13806 otherwise it is the basename of the source file. An entry is made up
13807 of three fields:
13808
13809 @itemize
13810 @item
13811 The name of the function.
13812 @item
13813 A number of bytes.
13814 @item
13815 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
13816 @end itemize
13817
13818 The qualifier @code{static} means that the function manipulates the stack
13819 statically: a fixed number of bytes are allocated for the frame on function
13820 entry and released on function exit; no stack adjustments are otherwise made
13821 in the function. The second field is this fixed number of bytes.
13822
13823 The qualifier @code{dynamic} means that the function manipulates the stack
13824 dynamically: in addition to the static allocation described above, stack
13825 adjustments are made in the body of the function, for example to push/pop
13826 arguments around function calls. If the qualifier @code{bounded} is also
13827 present, the amount of these adjustments is bounded at compile time and
13828 the second field is an upper bound of the total amount of stack used by
13829 the function. If it is not present, the amount of these adjustments is
13830 not bounded at compile time and the second field only represents the
13831 bounded part.
13832
13833 @item -fstats
13834 @opindex fstats
13835 Emit statistics about front-end processing at the end of the compilation.
13836 This option is supported only by the C++ front end, and
13837 the information is generally only useful to the G++ development team.
13838
13839 @item -fdbg-cnt-list
13840 @opindex fdbg-cnt-list
13841 Print the name and the counter upper bound for all debug counters.
13842
13843
13844 @item -fdbg-cnt=@var{counter-value-list}
13845 @opindex fdbg-cnt
13846 Set the internal debug counter upper bound. @var{counter-value-list}
13847 is a comma-separated list of @var{name}:@var{value} pairs
13848 which sets the upper bound of each debug counter @var{name} to @var{value}.
13849 All debug counters have the initial upper bound of @code{UINT_MAX};
13850 thus @code{dbg_cnt} returns true always unless the upper bound
13851 is set by this option.
13852 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
13853 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
13854
13855 @item -print-file-name=@var{library}
13856 @opindex print-file-name
13857 Print the full absolute name of the library file @var{library} that
13858 would be used when linking---and don't do anything else. With this
13859 option, GCC does not compile or link anything; it just prints the
13860 file name.
13861
13862 @item -print-multi-directory
13863 @opindex print-multi-directory
13864 Print the directory name corresponding to the multilib selected by any
13865 other switches present in the command line. This directory is supposed
13866 to exist in @env{GCC_EXEC_PREFIX}.
13867
13868 @item -print-multi-lib
13869 @opindex print-multi-lib
13870 Print the mapping from multilib directory names to compiler switches
13871 that enable them. The directory name is separated from the switches by
13872 @samp{;}, and each switch starts with an @samp{@@} instead of the
13873 @samp{-}, without spaces between multiple switches. This is supposed to
13874 ease shell processing.
13875
13876 @item -print-multi-os-directory
13877 @opindex print-multi-os-directory
13878 Print the path to OS libraries for the selected
13879 multilib, relative to some @file{lib} subdirectory. If OS libraries are
13880 present in the @file{lib} subdirectory and no multilibs are used, this is
13881 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
13882 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
13883 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
13884 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
13885
13886 @item -print-multiarch
13887 @opindex print-multiarch
13888 Print the path to OS libraries for the selected multiarch,
13889 relative to some @file{lib} subdirectory.
13890
13891 @item -print-prog-name=@var{program}
13892 @opindex print-prog-name
13893 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
13894
13895 @item -print-libgcc-file-name
13896 @opindex print-libgcc-file-name
13897 Same as @option{-print-file-name=libgcc.a}.
13898
13899 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
13900 but you do want to link with @file{libgcc.a}. You can do:
13901
13902 @smallexample
13903 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
13904 @end smallexample
13905
13906 @item -print-search-dirs
13907 @opindex print-search-dirs
13908 Print the name of the configured installation directory and a list of
13909 program and library directories @command{gcc} searches---and don't do anything else.
13910
13911 This is useful when @command{gcc} prints the error message
13912 @samp{installation problem, cannot exec cpp0: No such file or directory}.
13913 To resolve this you either need to put @file{cpp0} and the other compiler
13914 components where @command{gcc} expects to find them, or you can set the environment
13915 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
13916 Don't forget the trailing @samp{/}.
13917 @xref{Environment Variables}.
13918
13919 @item -print-sysroot
13920 @opindex print-sysroot
13921 Print the target sysroot directory that is used during
13922 compilation. This is the target sysroot specified either at configure
13923 time or using the @option{--sysroot} option, possibly with an extra
13924 suffix that depends on compilation options. If no target sysroot is
13925 specified, the option prints nothing.
13926
13927 @item -print-sysroot-headers-suffix
13928 @opindex print-sysroot-headers-suffix
13929 Print the suffix added to the target sysroot when searching for
13930 headers, or give an error if the compiler is not configured with such
13931 a suffix---and don't do anything else.
13932
13933 @item -dumpmachine
13934 @opindex dumpmachine
13935 Print the compiler's target machine (for example,
13936 @samp{i686-pc-linux-gnu})---and don't do anything else.
13937
13938 @item -dumpversion
13939 @opindex dumpversion
13940 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
13941 anything else. This is the compiler version used in filesystem paths,
13942 specs, can be depending on how the compiler has been configured just
13943 a single number (major version), two numbers separated by dot (major and
13944 minor version) or three numbers separated by dots (major, minor and patchlevel
13945 version).
13946
13947 @item -dumpfullversion
13948 @opindex dumpfullversion
13949 Print the full compiler version, always 3 numbers separated by dots,
13950 major, minor and patchlevel version.
13951
13952 @item -dumpspecs
13953 @opindex dumpspecs
13954 Print the compiler's built-in specs---and don't do anything else. (This
13955 is used when GCC itself is being built.) @xref{Spec Files}.
13956 @end table
13957
13958 @node Submodel Options
13959 @section Machine-Dependent Options
13960 @cindex submodel options
13961 @cindex specifying hardware config
13962 @cindex hardware models and configurations, specifying
13963 @cindex target-dependent options
13964 @cindex machine-dependent options
13965
13966 Each target machine supported by GCC can have its own options---for
13967 example, to allow you to compile for a particular processor variant or
13968 ABI, or to control optimizations specific to that machine. By
13969 convention, the names of machine-specific options start with
13970 @samp{-m}.
13971
13972 Some configurations of the compiler also support additional target-specific
13973 options, usually for compatibility with other compilers on the same
13974 platform.
13975
13976 @c This list is ordered alphanumerically by subsection name.
13977 @c It should be the same order and spelling as these options are listed
13978 @c in Machine Dependent Options
13979
13980 @menu
13981 * AArch64 Options::
13982 * Adapteva Epiphany Options::
13983 * ARC Options::
13984 * ARM Options::
13985 * AVR Options::
13986 * Blackfin Options::
13987 * C6X Options::
13988 * CRIS Options::
13989 * CR16 Options::
13990 * Darwin Options::
13991 * DEC Alpha Options::
13992 * FR30 Options::
13993 * FT32 Options::
13994 * FRV Options::
13995 * GNU/Linux Options::
13996 * H8/300 Options::
13997 * HPPA Options::
13998 * IA-64 Options::
13999 * LM32 Options::
14000 * M32C Options::
14001 * M32R/D Options::
14002 * M680x0 Options::
14003 * MCore Options::
14004 * MeP Options::
14005 * MicroBlaze Options::
14006 * MIPS Options::
14007 * MMIX Options::
14008 * MN10300 Options::
14009 * Moxie Options::
14010 * MSP430 Options::
14011 * NDS32 Options::
14012 * Nios II Options::
14013 * Nvidia PTX Options::
14014 * PDP-11 Options::
14015 * picoChip Options::
14016 * PowerPC Options::
14017 * RISC-V Options::
14018 * RL78 Options::
14019 * RS/6000 and PowerPC Options::
14020 * RX Options::
14021 * S/390 and zSeries Options::
14022 * Score Options::
14023 * SH Options::
14024 * Solaris 2 Options::
14025 * SPARC Options::
14026 * SPU Options::
14027 * System V Options::
14028 * TILE-Gx Options::
14029 * TILEPro Options::
14030 * V850 Options::
14031 * VAX Options::
14032 * Visium Options::
14033 * VMS Options::
14034 * VxWorks Options::
14035 * x86 Options::
14036 * x86 Windows Options::
14037 * Xstormy16 Options::
14038 * Xtensa Options::
14039 * zSeries Options::
14040 @end menu
14041
14042 @node AArch64 Options
14043 @subsection AArch64 Options
14044 @cindex AArch64 Options
14045
14046 These options are defined for AArch64 implementations:
14047
14048 @table @gcctabopt
14049
14050 @item -mabi=@var{name}
14051 @opindex mabi
14052 Generate code for the specified data model. Permissible values
14053 are @samp{ilp32} for SysV-like data model where int, long int and pointers
14054 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
14055 but long int and pointers are 64 bits.
14056
14057 The default depends on the specific target configuration. Note that
14058 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
14059 entire program with the same ABI, and link with a compatible set of libraries.
14060
14061 @item -mbig-endian
14062 @opindex mbig-endian
14063 Generate big-endian code. This is the default when GCC is configured for an
14064 @samp{aarch64_be-*-*} target.
14065
14066 @item -mgeneral-regs-only
14067 @opindex mgeneral-regs-only
14068 Generate code which uses only the general-purpose registers. This will prevent
14069 the compiler from using floating-point and Advanced SIMD registers but will not
14070 impose any restrictions on the assembler.
14071
14072 @item -mlittle-endian
14073 @opindex mlittle-endian
14074 Generate little-endian code. This is the default when GCC is configured for an
14075 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
14076
14077 @item -mcmodel=tiny
14078 @opindex mcmodel=tiny
14079 Generate code for the tiny code model. The program and its statically defined
14080 symbols must be within 1MB of each other. Programs can be statically or
14081 dynamically linked.
14082
14083 @item -mcmodel=small
14084 @opindex mcmodel=small
14085 Generate code for the small code model. The program and its statically defined
14086 symbols must be within 4GB of each other. Programs can be statically or
14087 dynamically linked. This is the default code model.
14088
14089 @item -mcmodel=large
14090 @opindex mcmodel=large
14091 Generate code for the large code model. This makes no assumptions about
14092 addresses and sizes of sections. Programs can be statically linked only.
14093
14094 @item -mstrict-align
14095 @opindex mstrict-align
14096 Avoid generating memory accesses that may not be aligned on a natural object
14097 boundary as described in the architecture specification.
14098
14099 @item -momit-leaf-frame-pointer
14100 @itemx -mno-omit-leaf-frame-pointer
14101 @opindex momit-leaf-frame-pointer
14102 @opindex mno-omit-leaf-frame-pointer
14103 Omit or keep the frame pointer in leaf functions. The former behavior is the
14104 default.
14105
14106 @item -mtls-dialect=desc
14107 @opindex mtls-dialect=desc
14108 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
14109 of TLS variables. This is the default.
14110
14111 @item -mtls-dialect=traditional
14112 @opindex mtls-dialect=traditional
14113 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
14114 of TLS variables.
14115
14116 @item -mtls-size=@var{size}
14117 @opindex mtls-size
14118 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
14119 This option requires binutils 2.26 or newer.
14120
14121 @item -mfix-cortex-a53-835769
14122 @itemx -mno-fix-cortex-a53-835769
14123 @opindex mfix-cortex-a53-835769
14124 @opindex mno-fix-cortex-a53-835769
14125 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
14126 This involves inserting a NOP instruction between memory instructions and
14127 64-bit integer multiply-accumulate instructions.
14128
14129 @item -mfix-cortex-a53-843419
14130 @itemx -mno-fix-cortex-a53-843419
14131 @opindex mfix-cortex-a53-843419
14132 @opindex mno-fix-cortex-a53-843419
14133 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
14134 This erratum workaround is made at link time and this will only pass the
14135 corresponding flag to the linker.
14136
14137 @item -mlow-precision-recip-sqrt
14138 @item -mno-low-precision-recip-sqrt
14139 @opindex mlow-precision-recip-sqrt
14140 @opindex mno-low-precision-recip-sqrt
14141 Enable or disable the reciprocal square root approximation.
14142 This option only has an effect if @option{-ffast-math} or
14143 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14144 precision of reciprocal square root results to about 16 bits for
14145 single precision and to 32 bits for double precision.
14146
14147 @item -mlow-precision-sqrt
14148 @item -mno-low-precision-sqrt
14149 @opindex -mlow-precision-sqrt
14150 @opindex -mno-low-precision-sqrt
14151 Enable or disable the square root approximation.
14152 This option only has an effect if @option{-ffast-math} or
14153 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14154 precision of square root results to about 16 bits for
14155 single precision and to 32 bits for double precision.
14156 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
14157
14158 @item -mlow-precision-div
14159 @item -mno-low-precision-div
14160 @opindex -mlow-precision-div
14161 @opindex -mno-low-precision-div
14162 Enable or disable the division approximation.
14163 This option only has an effect if @option{-ffast-math} or
14164 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14165 precision of division results to about 16 bits for
14166 single precision and to 32 bits for double precision.
14167
14168 @item -march=@var{name}
14169 @opindex march
14170 Specify the name of the target architecture and, optionally, one or
14171 more feature modifiers. This option has the form
14172 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
14173
14174 The permissible values for @var{arch} are @samp{armv8-a},
14175 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @var{native}.
14176
14177 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
14178 support for the ARMv8.3-A architecture extensions.
14179
14180 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
14181 support for the ARMv8.2-A architecture extensions.
14182
14183 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
14184 support for the ARMv8.1-A architecture extension. In particular, it
14185 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
14186
14187 The value @samp{native} is available on native AArch64 GNU/Linux and
14188 causes the compiler to pick the architecture of the host system. This
14189 option has no effect if the compiler is unable to recognize the
14190 architecture of the host system,
14191
14192 The permissible values for @var{feature} are listed in the sub-section
14193 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14194 Feature Modifiers}. Where conflicting feature modifiers are
14195 specified, the right-most feature is used.
14196
14197 GCC uses @var{name} to determine what kind of instructions it can emit
14198 when generating assembly code. If @option{-march} is specified
14199 without either of @option{-mtune} or @option{-mcpu} also being
14200 specified, the code is tuned to perform well across a range of target
14201 processors implementing the target architecture.
14202
14203 @item -mtune=@var{name}
14204 @opindex mtune
14205 Specify the name of the target processor for which GCC should tune the
14206 performance of the code. Permissible values for this option are:
14207 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
14208 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
14209 @samp{exynos-m1}, @samp{falkor}, @samp{qdf24xx},
14210 @samp{xgene1}, @samp{vulcan}, @samp{thunderx},
14211 @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
14212 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{cortex-a57.cortex-a53},
14213 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
14214 @samp{cortex-a73.cortex-a53}, @samp{cortex-a75.cortex-a55},
14215 @samp{native}.
14216
14217 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14218 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
14219 @samp{cortex-a75.cortex-a55} specify that GCC should tune for a
14220 big.LITTLE system.
14221
14222 Additionally on native AArch64 GNU/Linux systems the value
14223 @samp{native} tunes performance to the host system. This option has no effect
14224 if the compiler is unable to recognize the processor of the host system.
14225
14226 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
14227 are specified, the code is tuned to perform well across a range
14228 of target processors.
14229
14230 This option cannot be suffixed by feature modifiers.
14231
14232 @item -mcpu=@var{name}
14233 @opindex mcpu
14234 Specify the name of the target processor, optionally suffixed by one
14235 or more feature modifiers. This option has the form
14236 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
14237 the permissible values for @var{cpu} are the same as those available
14238 for @option{-mtune}. The permissible values for @var{feature} are
14239 documented in the sub-section on
14240 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14241 Feature Modifiers}. Where conflicting feature modifiers are
14242 specified, the right-most feature is used.
14243
14244 GCC uses @var{name} to determine what kind of instructions it can emit when
14245 generating assembly code (as if by @option{-march}) and to determine
14246 the target processor for which to tune for performance (as if
14247 by @option{-mtune}). Where this option is used in conjunction
14248 with @option{-march} or @option{-mtune}, those options take precedence
14249 over the appropriate part of this option.
14250
14251 @item -moverride=@var{string}
14252 @opindex moverride
14253 Override tuning decisions made by the back-end in response to a
14254 @option{-mtune=} switch. The syntax, semantics, and accepted values
14255 for @var{string} in this option are not guaranteed to be consistent
14256 across releases.
14257
14258 This option is only intended to be useful when developing GCC.
14259
14260 @item -mpc-relative-literal-loads
14261 @itemx -mno-pc-relative-literal-loads
14262 @opindex mpc-relative-literal-loads
14263 @opindex mno-pc-relative-literal-loads
14264 Enable or disable PC-relative literal loads. With this option literal pools are
14265 accessed using a single instruction and emitted after each function. This
14266 limits the maximum size of functions to 1MB. This is enabled by default for
14267 @option{-mcmodel=tiny}.
14268
14269 @item -msign-return-address=@var{scope}
14270 @opindex msign-return-address
14271 Select the function scope on which return address signing will be applied.
14272 Permissible values are @samp{none}, which disables return address signing,
14273 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
14274 functions, and @samp{all}, which enables pointer signing for all functions. The
14275 default value is @samp{none}.
14276
14277 @end table
14278
14279 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
14280 @anchor{aarch64-feature-modifiers}
14281 @cindex @option{-march} feature modifiers
14282 @cindex @option{-mcpu} feature modifiers
14283 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
14284 the following and their inverses @option{no@var{feature}}:
14285
14286 @table @samp
14287 @item crc
14288 Enable CRC extension. This is on by default for
14289 @option{-march=armv8.1-a}.
14290 @item crypto
14291 Enable Crypto extension. This also enables Advanced SIMD and floating-point
14292 instructions.
14293 @item fp
14294 Enable floating-point instructions. This is on by default for all possible
14295 values for options @option{-march} and @option{-mcpu}.
14296 @item simd
14297 Enable Advanced SIMD instructions. This also enables floating-point
14298 instructions. This is on by default for all possible values for options
14299 @option{-march} and @option{-mcpu}.
14300 @item lse
14301 Enable Large System Extension instructions. This is on by default for
14302 @option{-march=armv8.1-a}.
14303 @item rdma
14304 Enable Round Double Multiply Accumulate instructions. This is on by default
14305 for @option{-march=armv8.1-a}.
14306 @item fp16
14307 Enable FP16 extension. This also enables floating-point instructions.
14308 @item rcpc
14309 Enable the RcPc extension. This does not change code generation from GCC,
14310 but is passed on to the assembler, enabling inline asm statements to use
14311 instructions from the RcPc extension.
14312
14313 @end table
14314
14315 Feature @option{crypto} implies @option{simd}, which implies @option{fp}.
14316 Conversely, @option{nofp} implies @option{nosimd}, which implies
14317 @option{nocrypto}.
14318
14319 @node Adapteva Epiphany Options
14320 @subsection Adapteva Epiphany Options
14321
14322 These @samp{-m} options are defined for Adapteva Epiphany:
14323
14324 @table @gcctabopt
14325 @item -mhalf-reg-file
14326 @opindex mhalf-reg-file
14327 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
14328 That allows code to run on hardware variants that lack these registers.
14329
14330 @item -mprefer-short-insn-regs
14331 @opindex mprefer-short-insn-regs
14332 Preferentially allocate registers that allow short instruction generation.
14333 This can result in increased instruction count, so this may either reduce or
14334 increase overall code size.
14335
14336 @item -mbranch-cost=@var{num}
14337 @opindex mbranch-cost
14338 Set the cost of branches to roughly @var{num} ``simple'' instructions.
14339 This cost is only a heuristic and is not guaranteed to produce
14340 consistent results across releases.
14341
14342 @item -mcmove
14343 @opindex mcmove
14344 Enable the generation of conditional moves.
14345
14346 @item -mnops=@var{num}
14347 @opindex mnops
14348 Emit @var{num} NOPs before every other generated instruction.
14349
14350 @item -mno-soft-cmpsf
14351 @opindex mno-soft-cmpsf
14352 For single-precision floating-point comparisons, emit an @code{fsub} instruction
14353 and test the flags. This is faster than a software comparison, but can
14354 get incorrect results in the presence of NaNs, or when two different small
14355 numbers are compared such that their difference is calculated as zero.
14356 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
14357 software comparisons.
14358
14359 @item -mstack-offset=@var{num}
14360 @opindex mstack-offset
14361 Set the offset between the top of the stack and the stack pointer.
14362 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
14363 can be used by leaf functions without stack allocation.
14364 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
14365 Note also that this option changes the ABI; compiling a program with a
14366 different stack offset than the libraries have been compiled with
14367 generally does not work.
14368 This option can be useful if you want to evaluate if a different stack
14369 offset would give you better code, but to actually use a different stack
14370 offset to build working programs, it is recommended to configure the
14371 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
14372
14373 @item -mno-round-nearest
14374 @opindex mno-round-nearest
14375 Make the scheduler assume that the rounding mode has been set to
14376 truncating. The default is @option{-mround-nearest}.
14377
14378 @item -mlong-calls
14379 @opindex mlong-calls
14380 If not otherwise specified by an attribute, assume all calls might be beyond
14381 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
14382 function address into a register before performing a (otherwise direct) call.
14383 This is the default.
14384
14385 @item -mshort-calls
14386 @opindex short-calls
14387 If not otherwise specified by an attribute, assume all direct calls are
14388 in the range of the @code{b} / @code{bl} instructions, so use these instructions
14389 for direct calls. The default is @option{-mlong-calls}.
14390
14391 @item -msmall16
14392 @opindex msmall16
14393 Assume addresses can be loaded as 16-bit unsigned values. This does not
14394 apply to function addresses for which @option{-mlong-calls} semantics
14395 are in effect.
14396
14397 @item -mfp-mode=@var{mode}
14398 @opindex mfp-mode
14399 Set the prevailing mode of the floating-point unit.
14400 This determines the floating-point mode that is provided and expected
14401 at function call and return time. Making this mode match the mode you
14402 predominantly need at function start can make your programs smaller and
14403 faster by avoiding unnecessary mode switches.
14404
14405 @var{mode} can be set to one the following values:
14406
14407 @table @samp
14408 @item caller
14409 Any mode at function entry is valid, and retained or restored when
14410 the function returns, and when it calls other functions.
14411 This mode is useful for compiling libraries or other compilation units
14412 you might want to incorporate into different programs with different
14413 prevailing FPU modes, and the convenience of being able to use a single
14414 object file outweighs the size and speed overhead for any extra
14415 mode switching that might be needed, compared with what would be needed
14416 with a more specific choice of prevailing FPU mode.
14417
14418 @item truncate
14419 This is the mode used for floating-point calculations with
14420 truncating (i.e.@: round towards zero) rounding mode. That includes
14421 conversion from floating point to integer.
14422
14423 @item round-nearest
14424 This is the mode used for floating-point calculations with
14425 round-to-nearest-or-even rounding mode.
14426
14427 @item int
14428 This is the mode used to perform integer calculations in the FPU, e.g.@:
14429 integer multiply, or integer multiply-and-accumulate.
14430 @end table
14431
14432 The default is @option{-mfp-mode=caller}
14433
14434 @item -mnosplit-lohi
14435 @itemx -mno-postinc
14436 @itemx -mno-postmodify
14437 @opindex mnosplit-lohi
14438 @opindex mno-postinc
14439 @opindex mno-postmodify
14440 Code generation tweaks that disable, respectively, splitting of 32-bit
14441 loads, generation of post-increment addresses, and generation of
14442 post-modify addresses. The defaults are @option{msplit-lohi},
14443 @option{-mpost-inc}, and @option{-mpost-modify}.
14444
14445 @item -mnovect-double
14446 @opindex mno-vect-double
14447 Change the preferred SIMD mode to SImode. The default is
14448 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
14449
14450 @item -max-vect-align=@var{num}
14451 @opindex max-vect-align
14452 The maximum alignment for SIMD vector mode types.
14453 @var{num} may be 4 or 8. The default is 8.
14454 Note that this is an ABI change, even though many library function
14455 interfaces are unaffected if they don't use SIMD vector modes
14456 in places that affect size and/or alignment of relevant types.
14457
14458 @item -msplit-vecmove-early
14459 @opindex msplit-vecmove-early
14460 Split vector moves into single word moves before reload. In theory this
14461 can give better register allocation, but so far the reverse seems to be
14462 generally the case.
14463
14464 @item -m1reg-@var{reg}
14465 @opindex m1reg-
14466 Specify a register to hold the constant @minus{}1, which makes loading small negative
14467 constants and certain bitmasks faster.
14468 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
14469 which specify use of that register as a fixed register,
14470 and @samp{none}, which means that no register is used for this
14471 purpose. The default is @option{-m1reg-none}.
14472
14473 @end table
14474
14475 @node ARC Options
14476 @subsection ARC Options
14477 @cindex ARC options
14478
14479 The following options control the architecture variant for which code
14480 is being compiled:
14481
14482 @c architecture variants
14483 @table @gcctabopt
14484
14485 @item -mbarrel-shifter
14486 @opindex mbarrel-shifter
14487 Generate instructions supported by barrel shifter. This is the default
14488 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
14489
14490 @item -mcpu=@var{cpu}
14491 @opindex mcpu
14492 Set architecture type, register usage, and instruction scheduling
14493 parameters for @var{cpu}. There are also shortcut alias options
14494 available for backward compatibility and convenience. Supported
14495 values for @var{cpu} are
14496
14497 @table @samp
14498 @opindex mA6
14499 @opindex mARC600
14500 @item arc600
14501 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
14502
14503 @item arc601
14504 @opindex mARC601
14505 Compile for ARC601. Alias: @option{-mARC601}.
14506
14507 @item arc700
14508 @opindex mA7
14509 @opindex mARC700
14510 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
14511 This is the default when configured with @option{--with-cpu=arc700}@.
14512
14513 @item arcem
14514 Compile for ARC EM.
14515
14516 @item archs
14517 Compile for ARC HS.
14518
14519 @item em
14520 Compile for ARC EM CPU with no hardware extensions.
14521
14522 @item em4
14523 Compile for ARC EM4 CPU.
14524
14525 @item em4_dmips
14526 Compile for ARC EM4 DMIPS CPU.
14527
14528 @item em4_fpus
14529 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
14530 extension.
14531
14532 @item em4_fpuda
14533 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
14534 double assist instructions.
14535
14536 @item hs
14537 Compile for ARC HS CPU with no hardware extensions except the atomic
14538 instructions.
14539
14540 @item hs34
14541 Compile for ARC HS34 CPU.
14542
14543 @item hs38
14544 Compile for ARC HS38 CPU.
14545
14546 @item hs38_linux
14547 Compile for ARC HS38 CPU with all hardware extensions on.
14548
14549 @item arc600_norm
14550 Compile for ARC 600 CPU with @code{norm} instructions enabled.
14551
14552 @item arc600_mul32x16
14553 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
14554 instructions enabled.
14555
14556 @item arc600_mul64
14557 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
14558 instructions enabled.
14559
14560 @item arc601_norm
14561 Compile for ARC 601 CPU with @code{norm} instructions enabled.
14562
14563 @item arc601_mul32x16
14564 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
14565 instructions enabled.
14566
14567 @item arc601_mul64
14568 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
14569 instructions enabled.
14570
14571 @item nps400
14572 Compile for ARC 700 on NPS400 chip.
14573
14574 @end table
14575
14576 @item -mdpfp
14577 @opindex mdpfp
14578 @itemx -mdpfp-compact
14579 @opindex mdpfp-compact
14580 Generate double-precision FPX instructions, tuned for the compact
14581 implementation.
14582
14583 @item -mdpfp-fast
14584 @opindex mdpfp-fast
14585 Generate double-precision FPX instructions, tuned for the fast
14586 implementation.
14587
14588 @item -mno-dpfp-lrsr
14589 @opindex mno-dpfp-lrsr
14590 Disable @code{lr} and @code{sr} instructions from using FPX extension
14591 aux registers.
14592
14593 @item -mea
14594 @opindex mea
14595 Generate extended arithmetic instructions. Currently only
14596 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
14597 supported. This is always enabled for @option{-mcpu=ARC700}.
14598
14599 @item -mno-mpy
14600 @opindex mno-mpy
14601 Do not generate @code{mpy}-family instructions for ARC700. This option is
14602 deprecated.
14603
14604 @item -mmul32x16
14605 @opindex mmul32x16
14606 Generate 32x16-bit multiply and multiply-accumulate instructions.
14607
14608 @item -mmul64
14609 @opindex mmul64
14610 Generate @code{mul64} and @code{mulu64} instructions.
14611 Only valid for @option{-mcpu=ARC600}.
14612
14613 @item -mnorm
14614 @opindex mnorm
14615 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
14616 is in effect.
14617
14618 @item -mspfp
14619 @opindex mspfp
14620 @itemx -mspfp-compact
14621 @opindex mspfp-compact
14622 Generate single-precision FPX instructions, tuned for the compact
14623 implementation.
14624
14625 @item -mspfp-fast
14626 @opindex mspfp-fast
14627 Generate single-precision FPX instructions, tuned for the fast
14628 implementation.
14629
14630 @item -msimd
14631 @opindex msimd
14632 Enable generation of ARC SIMD instructions via target-specific
14633 builtins. Only valid for @option{-mcpu=ARC700}.
14634
14635 @item -msoft-float
14636 @opindex msoft-float
14637 This option ignored; it is provided for compatibility purposes only.
14638 Software floating-point code is emitted by default, and this default
14639 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
14640 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
14641 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
14642
14643 @item -mswap
14644 @opindex mswap
14645 Generate @code{swap} instructions.
14646
14647 @item -matomic
14648 @opindex matomic
14649 This enables use of the locked load/store conditional extension to implement
14650 atomic memory built-in functions. Not available for ARC 6xx or ARC
14651 EM cores.
14652
14653 @item -mdiv-rem
14654 @opindex mdiv-rem
14655 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
14656
14657 @item -mcode-density
14658 @opindex mcode-density
14659 Enable code density instructions for ARC EM.
14660 This option is on by default for ARC HS.
14661
14662 @item -mll64
14663 @opindex mll64
14664 Enable double load/store operations for ARC HS cores.
14665
14666 @item -mtp-regno=@var{regno}
14667 @opindex mtp-regno
14668 Specify thread pointer register number.
14669
14670 @item -mmpy-option=@var{multo}
14671 @opindex mmpy-option
14672 Compile ARCv2 code with a multiplier design option. You can specify
14673 the option using either a string or numeric value for @var{multo}.
14674 @samp{wlh1} is the default value. The recognized values are:
14675
14676 @table @samp
14677 @item 0
14678 @itemx none
14679 No multiplier available.
14680
14681 @item 1
14682 @itemx w
14683 16x16 multiplier, fully pipelined.
14684 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
14685
14686 @item 2
14687 @itemx wlh1
14688 32x32 multiplier, fully
14689 pipelined (1 stage). The following instructions are additionally
14690 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14691
14692 @item 3
14693 @itemx wlh2
14694 32x32 multiplier, fully pipelined
14695 (2 stages). The following instructions are additionally enabled: @code{mpy},
14696 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14697
14698 @item 4
14699 @itemx wlh3
14700 Two 16x16 multipliers, blocking,
14701 sequential. The following instructions are additionally enabled: @code{mpy},
14702 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14703
14704 @item 5
14705 @itemx wlh4
14706 One 16x16 multiplier, blocking,
14707 sequential. The following instructions are additionally enabled: @code{mpy},
14708 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14709
14710 @item 6
14711 @itemx wlh5
14712 One 32x4 multiplier, blocking,
14713 sequential. The following instructions are additionally enabled: @code{mpy},
14714 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14715
14716 @item 7
14717 @itemx plus_dmpy
14718 ARC HS SIMD support.
14719
14720 @item 8
14721 @itemx plus_macd
14722 ARC HS SIMD support.
14723
14724 @item 9
14725 @itemx plus_qmacw
14726 ARC HS SIMD support.
14727
14728 @end table
14729
14730 This option is only available for ARCv2 cores@.
14731
14732 @item -mfpu=@var{fpu}
14733 @opindex mfpu
14734 Enables support for specific floating-point hardware extensions for ARCv2
14735 cores. Supported values for @var{fpu} are:
14736
14737 @table @samp
14738
14739 @item fpus
14740 Enables support for single-precision floating-point hardware
14741 extensions@.
14742
14743 @item fpud
14744 Enables support for double-precision floating-point hardware
14745 extensions. The single-precision floating-point extension is also
14746 enabled. Not available for ARC EM@.
14747
14748 @item fpuda
14749 Enables support for double-precision floating-point hardware
14750 extensions using double-precision assist instructions. The single-precision
14751 floating-point extension is also enabled. This option is
14752 only available for ARC EM@.
14753
14754 @item fpuda_div
14755 Enables support for double-precision floating-point hardware
14756 extensions using double-precision assist instructions.
14757 The single-precision floating-point, square-root, and divide
14758 extensions are also enabled. This option is
14759 only available for ARC EM@.
14760
14761 @item fpuda_fma
14762 Enables support for double-precision floating-point hardware
14763 extensions using double-precision assist instructions.
14764 The single-precision floating-point and fused multiply and add
14765 hardware extensions are also enabled. This option is
14766 only available for ARC EM@.
14767
14768 @item fpuda_all
14769 Enables support for double-precision floating-point hardware
14770 extensions using double-precision assist instructions.
14771 All single-precision floating-point hardware extensions are also
14772 enabled. This option is only available for ARC EM@.
14773
14774 @item fpus_div
14775 Enables support for single-precision floating-point, square-root and divide
14776 hardware extensions@.
14777
14778 @item fpud_div
14779 Enables support for double-precision floating-point, square-root and divide
14780 hardware extensions. This option
14781 includes option @samp{fpus_div}. Not available for ARC EM@.
14782
14783 @item fpus_fma
14784 Enables support for single-precision floating-point and
14785 fused multiply and add hardware extensions@.
14786
14787 @item fpud_fma
14788 Enables support for double-precision floating-point and
14789 fused multiply and add hardware extensions. This option
14790 includes option @samp{fpus_fma}. Not available for ARC EM@.
14791
14792 @item fpus_all
14793 Enables support for all single-precision floating-point hardware
14794 extensions@.
14795
14796 @item fpud_all
14797 Enables support for all single- and double-precision floating-point
14798 hardware extensions. Not available for ARC EM@.
14799
14800 @end table
14801
14802 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
14803 @opindex mirq-ctrl-saved
14804 Specifies general-purposes registers that the processor automatically
14805 saves/restores on interrupt entry and exit. @var{register-range} is
14806 specified as two registers separated by a dash. The register range
14807 always starts with @code{r0}, the upper limit is @code{fp} register.
14808 @var{blink} and @var{lp_count} are optional. This option is only
14809 valid for ARC EM and ARC HS cores.
14810
14811 @item -mrgf-banked-regs=@var{number}
14812 @opindex mrgf-banked-regs
14813 Specifies the number of registers replicated in second register bank
14814 on entry to fast interrupt. Fast interrupts are interrupts with the
14815 highest priority level P0. These interrupts save only PC and STATUS32
14816 registers to avoid memory transactions during interrupt entry and exit
14817 sequences. Use this option when you are using fast interrupts in an
14818 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
14819
14820 @item -mlpc-width=@var{width}
14821 @opindex mlpc-width
14822 Specify the width of the @code{lp_count} register. Valid values for
14823 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
14824 fixed to 32 bits. If the width is less than 32, the compiler does not
14825 attempt to transform loops in your program to use the zero-delay loop
14826 mechanism unless it is known that the @code{lp_count} register can
14827 hold the required loop-counter value. Depending on the width
14828 specified, the compiler and run-time library might continue to use the
14829 loop mechanism for various needs. This option defines macro
14830 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
14831
14832 @end table
14833
14834 The following options are passed through to the assembler, and also
14835 define preprocessor macro symbols.
14836
14837 @c Flags used by the assembler, but for which we define preprocessor
14838 @c macro symbols as well.
14839 @table @gcctabopt
14840 @item -mdsp-packa
14841 @opindex mdsp-packa
14842 Passed down to the assembler to enable the DSP Pack A extensions.
14843 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
14844 deprecated.
14845
14846 @item -mdvbf
14847 @opindex mdvbf
14848 Passed down to the assembler to enable the dual Viterbi butterfly
14849 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
14850 option is deprecated.
14851
14852 @c ARC700 4.10 extension instruction
14853 @item -mlock
14854 @opindex mlock
14855 Passed down to the assembler to enable the locked load/store
14856 conditional extension. Also sets the preprocessor symbol
14857 @code{__Xlock}.
14858
14859 @item -mmac-d16
14860 @opindex mmac-d16
14861 Passed down to the assembler. Also sets the preprocessor symbol
14862 @code{__Xxmac_d16}. This option is deprecated.
14863
14864 @item -mmac-24
14865 @opindex mmac-24
14866 Passed down to the assembler. Also sets the preprocessor symbol
14867 @code{__Xxmac_24}. This option is deprecated.
14868
14869 @c ARC700 4.10 extension instruction
14870 @item -mrtsc
14871 @opindex mrtsc
14872 Passed down to the assembler to enable the 64-bit time-stamp counter
14873 extension instruction. Also sets the preprocessor symbol
14874 @code{__Xrtsc}. This option is deprecated.
14875
14876 @c ARC700 4.10 extension instruction
14877 @item -mswape
14878 @opindex mswape
14879 Passed down to the assembler to enable the swap byte ordering
14880 extension instruction. Also sets the preprocessor symbol
14881 @code{__Xswape}.
14882
14883 @item -mtelephony
14884 @opindex mtelephony
14885 Passed down to the assembler to enable dual- and single-operand
14886 instructions for telephony. Also sets the preprocessor symbol
14887 @code{__Xtelephony}. This option is deprecated.
14888
14889 @item -mxy
14890 @opindex mxy
14891 Passed down to the assembler to enable the XY memory extension. Also
14892 sets the preprocessor symbol @code{__Xxy}.
14893
14894 @end table
14895
14896 The following options control how the assembly code is annotated:
14897
14898 @c Assembly annotation options
14899 @table @gcctabopt
14900 @item -misize
14901 @opindex misize
14902 Annotate assembler instructions with estimated addresses.
14903
14904 @item -mannotate-align
14905 @opindex mannotate-align
14906 Explain what alignment considerations lead to the decision to make an
14907 instruction short or long.
14908
14909 @end table
14910
14911 The following options are passed through to the linker:
14912
14913 @c options passed through to the linker
14914 @table @gcctabopt
14915 @item -marclinux
14916 @opindex marclinux
14917 Passed through to the linker, to specify use of the @code{arclinux} emulation.
14918 This option is enabled by default in tool chains built for
14919 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
14920 when profiling is not requested.
14921
14922 @item -marclinux_prof
14923 @opindex marclinux_prof
14924 Passed through to the linker, to specify use of the
14925 @code{arclinux_prof} emulation. This option is enabled by default in
14926 tool chains built for @w{@code{arc-linux-uclibc}} and
14927 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
14928
14929 @end table
14930
14931 The following options control the semantics of generated code:
14932
14933 @c semantically relevant code generation options
14934 @table @gcctabopt
14935 @item -mlong-calls
14936 @opindex mlong-calls
14937 Generate calls as register indirect calls, thus providing access
14938 to the full 32-bit address range.
14939
14940 @item -mmedium-calls
14941 @opindex mmedium-calls
14942 Don't use less than 25-bit addressing range for calls, which is the
14943 offset available for an unconditional branch-and-link
14944 instruction. Conditional execution of function calls is suppressed, to
14945 allow use of the 25-bit range, rather than the 21-bit range with
14946 conditional branch-and-link. This is the default for tool chains built
14947 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
14948
14949 @item -G @var{num}
14950 @opindex G
14951 Put definitions of externally-visible data in a small data section if
14952 that data is no bigger than @var{num} bytes. The default value of
14953 @var{num} is 4 for any ARC configuration, or 8 when we have double
14954 load/store operations.
14955
14956 @item -mno-sdata
14957 @opindex mno-sdata
14958 Do not generate sdata references. This is the default for tool chains
14959 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
14960 targets.
14961
14962 @item -mvolatile-cache
14963 @opindex mvolatile-cache
14964 Use ordinarily cached memory accesses for volatile references. This is the
14965 default.
14966
14967 @item -mno-volatile-cache
14968 @opindex mno-volatile-cache
14969 Enable cache bypass for volatile references.
14970
14971 @end table
14972
14973 The following options fine tune code generation:
14974 @c code generation tuning options
14975 @table @gcctabopt
14976 @item -malign-call
14977 @opindex malign-call
14978 Do alignment optimizations for call instructions.
14979
14980 @item -mauto-modify-reg
14981 @opindex mauto-modify-reg
14982 Enable the use of pre/post modify with register displacement.
14983
14984 @item -mbbit-peephole
14985 @opindex mbbit-peephole
14986 Enable bbit peephole2.
14987
14988 @item -mno-brcc
14989 @opindex mno-brcc
14990 This option disables a target-specific pass in @file{arc_reorg} to
14991 generate compare-and-branch (@code{br@var{cc}}) instructions.
14992 It has no effect on
14993 generation of these instructions driven by the combiner pass.
14994
14995 @item -mcase-vector-pcrel
14996 @opindex mcase-vector-pcrel
14997 Use PC-relative switch case tables to enable case table shortening.
14998 This is the default for @option{-Os}.
14999
15000 @item -mcompact-casesi
15001 @opindex mcompact-casesi
15002 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
15003 and only available for ARCv1 cores.
15004
15005 @item -mno-cond-exec
15006 @opindex mno-cond-exec
15007 Disable the ARCompact-specific pass to generate conditional
15008 execution instructions.
15009
15010 Due to delay slot scheduling and interactions between operand numbers,
15011 literal sizes, instruction lengths, and the support for conditional execution,
15012 the target-independent pass to generate conditional execution is often lacking,
15013 so the ARC port has kept a special pass around that tries to find more
15014 conditional execution generation opportunities after register allocation,
15015 branch shortening, and delay slot scheduling have been done. This pass
15016 generally, but not always, improves performance and code size, at the cost of
15017 extra compilation time, which is why there is an option to switch it off.
15018 If you have a problem with call instructions exceeding their allowable
15019 offset range because they are conditionalized, you should consider using
15020 @option{-mmedium-calls} instead.
15021
15022 @item -mearly-cbranchsi
15023 @opindex mearly-cbranchsi
15024 Enable pre-reload use of the @code{cbranchsi} pattern.
15025
15026 @item -mexpand-adddi
15027 @opindex mexpand-adddi
15028 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
15029 @code{add.f}, @code{adc} etc. This option is deprecated.
15030
15031 @item -mindexed-loads
15032 @opindex mindexed-loads
15033 Enable the use of indexed loads. This can be problematic because some
15034 optimizers then assume that indexed stores exist, which is not
15035 the case.
15036
15037 @opindex mlra
15038 Enable Local Register Allocation. This is still experimental for ARC,
15039 so by default the compiler uses standard reload
15040 (i.e. @option{-mno-lra}).
15041
15042 @item -mlra-priority-none
15043 @opindex mlra-priority-none
15044 Don't indicate any priority for target registers.
15045
15046 @item -mlra-priority-compact
15047 @opindex mlra-priority-compact
15048 Indicate target register priority for r0..r3 / r12..r15.
15049
15050 @item -mlra-priority-noncompact
15051 @opindex mlra-priority-noncompact
15052 Reduce target register priority for r0..r3 / r12..r15.
15053
15054 @item -mno-millicode
15055 @opindex mno-millicode
15056 When optimizing for size (using @option{-Os}), prologues and epilogues
15057 that have to save or restore a large number of registers are often
15058 shortened by using call to a special function in libgcc; this is
15059 referred to as a @emph{millicode} call. As these calls can pose
15060 performance issues, and/or cause linking issues when linking in a
15061 nonstandard way, this option is provided to turn off millicode call
15062 generation.
15063
15064 @item -mmixed-code
15065 @opindex mmixed-code
15066 Tweak register allocation to help 16-bit instruction generation.
15067 This generally has the effect of decreasing the average instruction size
15068 while increasing the instruction count.
15069
15070 @item -mq-class
15071 @opindex mq-class
15072 Enable @samp{q} instruction alternatives.
15073 This is the default for @option{-Os}.
15074
15075 @item -mRcq
15076 @opindex mRcq
15077 Enable @samp{Rcq} constraint handling.
15078 Most short code generation depends on this.
15079 This is the default.
15080
15081 @item -mRcw
15082 @opindex mRcw
15083 Enable @samp{Rcw} constraint handling.
15084 Most ccfsm condexec mostly depends on this.
15085 This is the default.
15086
15087 @item -msize-level=@var{level}
15088 @opindex msize-level
15089 Fine-tune size optimization with regards to instruction lengths and alignment.
15090 The recognized values for @var{level} are:
15091 @table @samp
15092 @item 0
15093 No size optimization. This level is deprecated and treated like @samp{1}.
15094
15095 @item 1
15096 Short instructions are used opportunistically.
15097
15098 @item 2
15099 In addition, alignment of loops and of code after barriers are dropped.
15100
15101 @item 3
15102 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
15103
15104 @end table
15105
15106 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
15107 the behavior when this is not set is equivalent to level @samp{1}.
15108
15109 @item -mtune=@var{cpu}
15110 @opindex mtune
15111 Set instruction scheduling parameters for @var{cpu}, overriding any implied
15112 by @option{-mcpu=}.
15113
15114 Supported values for @var{cpu} are
15115
15116 @table @samp
15117 @item ARC600
15118 Tune for ARC600 CPU.
15119
15120 @item ARC601
15121 Tune for ARC601 CPU.
15122
15123 @item ARC700
15124 Tune for ARC700 CPU with standard multiplier block.
15125
15126 @item ARC700-xmac
15127 Tune for ARC700 CPU with XMAC block.
15128
15129 @item ARC725D
15130 Tune for ARC725D CPU.
15131
15132 @item ARC750D
15133 Tune for ARC750D CPU.
15134
15135 @end table
15136
15137 @item -mmultcost=@var{num}
15138 @opindex mmultcost
15139 Cost to assume for a multiply instruction, with @samp{4} being equal to a
15140 normal instruction.
15141
15142 @item -munalign-prob-threshold=@var{probability}
15143 @opindex munalign-prob-threshold
15144 Set probability threshold for unaligning branches.
15145 When tuning for @samp{ARC700} and optimizing for speed, branches without
15146 filled delay slot are preferably emitted unaligned and long, unless
15147 profiling indicates that the probability for the branch to be taken
15148 is below @var{probability}. @xref{Cross-profiling}.
15149 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
15150
15151 @end table
15152
15153 The following options are maintained for backward compatibility, but
15154 are now deprecated and will be removed in a future release:
15155
15156 @c Deprecated options
15157 @table @gcctabopt
15158
15159 @item -margonaut
15160 @opindex margonaut
15161 Obsolete FPX.
15162
15163 @item -mbig-endian
15164 @opindex mbig-endian
15165 @itemx -EB
15166 @opindex EB
15167 Compile code for big-endian targets. Use of these options is now
15168 deprecated. Big-endian code is supported by configuring GCC to build
15169 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
15170 for which big endian is the default.
15171
15172 @item -mlittle-endian
15173 @opindex mlittle-endian
15174 @itemx -EL
15175 @opindex EL
15176 Compile code for little-endian targets. Use of these options is now
15177 deprecated. Little-endian code is supported by configuring GCC to build
15178 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
15179 for which little endian is the default.
15180
15181 @item -mbarrel_shifter
15182 @opindex mbarrel_shifter
15183 Replaced by @option{-mbarrel-shifter}.
15184
15185 @item -mdpfp_compact
15186 @opindex mdpfp_compact
15187 Replaced by @option{-mdpfp-compact}.
15188
15189 @item -mdpfp_fast
15190 @opindex mdpfp_fast
15191 Replaced by @option{-mdpfp-fast}.
15192
15193 @item -mdsp_packa
15194 @opindex mdsp_packa
15195 Replaced by @option{-mdsp-packa}.
15196
15197 @item -mEA
15198 @opindex mEA
15199 Replaced by @option{-mea}.
15200
15201 @item -mmac_24
15202 @opindex mmac_24
15203 Replaced by @option{-mmac-24}.
15204
15205 @item -mmac_d16
15206 @opindex mmac_d16
15207 Replaced by @option{-mmac-d16}.
15208
15209 @item -mspfp_compact
15210 @opindex mspfp_compact
15211 Replaced by @option{-mspfp-compact}.
15212
15213 @item -mspfp_fast
15214 @opindex mspfp_fast
15215 Replaced by @option{-mspfp-fast}.
15216
15217 @item -mtune=@var{cpu}
15218 @opindex mtune
15219 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
15220 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
15221 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
15222
15223 @item -multcost=@var{num}
15224 @opindex multcost
15225 Replaced by @option{-mmultcost}.
15226
15227 @end table
15228
15229 @node ARM Options
15230 @subsection ARM Options
15231 @cindex ARM options
15232
15233 These @samp{-m} options are defined for the ARM port:
15234
15235 @table @gcctabopt
15236 @item -mabi=@var{name}
15237 @opindex mabi
15238 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
15239 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
15240
15241 @item -mapcs-frame
15242 @opindex mapcs-frame
15243 Generate a stack frame that is compliant with the ARM Procedure Call
15244 Standard for all functions, even if this is not strictly necessary for
15245 correct execution of the code. Specifying @option{-fomit-frame-pointer}
15246 with this option causes the stack frames not to be generated for
15247 leaf functions. The default is @option{-mno-apcs-frame}.
15248 This option is deprecated.
15249
15250 @item -mapcs
15251 @opindex mapcs
15252 This is a synonym for @option{-mapcs-frame} and is deprecated.
15253
15254 @ignore
15255 @c not currently implemented
15256 @item -mapcs-stack-check
15257 @opindex mapcs-stack-check
15258 Generate code to check the amount of stack space available upon entry to
15259 every function (that actually uses some stack space). If there is
15260 insufficient space available then either the function
15261 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
15262 called, depending upon the amount of stack space required. The runtime
15263 system is required to provide these functions. The default is
15264 @option{-mno-apcs-stack-check}, since this produces smaller code.
15265
15266 @c not currently implemented
15267 @item -mapcs-reentrant
15268 @opindex mapcs-reentrant
15269 Generate reentrant, position-independent code. The default is
15270 @option{-mno-apcs-reentrant}.
15271 @end ignore
15272
15273 @item -mthumb-interwork
15274 @opindex mthumb-interwork
15275 Generate code that supports calling between the ARM and Thumb
15276 instruction sets. Without this option, on pre-v5 architectures, the
15277 two instruction sets cannot be reliably used inside one program. The
15278 default is @option{-mno-thumb-interwork}, since slightly larger code
15279 is generated when @option{-mthumb-interwork} is specified. In AAPCS
15280 configurations this option is meaningless.
15281
15282 @item -mno-sched-prolog
15283 @opindex mno-sched-prolog
15284 Prevent the reordering of instructions in the function prologue, or the
15285 merging of those instruction with the instructions in the function's
15286 body. This means that all functions start with a recognizable set
15287 of instructions (or in fact one of a choice from a small set of
15288 different function prologues), and this information can be used to
15289 locate the start of functions inside an executable piece of code. The
15290 default is @option{-msched-prolog}.
15291
15292 @item -mfloat-abi=@var{name}
15293 @opindex mfloat-abi
15294 Specifies which floating-point ABI to use. Permissible values
15295 are: @samp{soft}, @samp{softfp} and @samp{hard}.
15296
15297 Specifying @samp{soft} causes GCC to generate output containing
15298 library calls for floating-point operations.
15299 @samp{softfp} allows the generation of code using hardware floating-point
15300 instructions, but still uses the soft-float calling conventions.
15301 @samp{hard} allows generation of floating-point instructions
15302 and uses FPU-specific calling conventions.
15303
15304 The default depends on the specific target configuration. Note that
15305 the hard-float and soft-float ABIs are not link-compatible; you must
15306 compile your entire program with the same ABI, and link with a
15307 compatible set of libraries.
15308
15309 @item -mlittle-endian
15310 @opindex mlittle-endian
15311 Generate code for a processor running in little-endian mode. This is
15312 the default for all standard configurations.
15313
15314 @item -mbig-endian
15315 @opindex mbig-endian
15316 Generate code for a processor running in big-endian mode; the default is
15317 to compile code for a little-endian processor.
15318
15319 @item -mbe8
15320 @itemx -mbe32
15321 @opindex mbe8
15322 When linking a big-endian image select between BE8 and BE32 formats.
15323 The option has no effect for little-endian images and is ignored. The
15324 default is dependent on the selected target architecture. For ARMv6
15325 and later architectures the default is BE8, for older architectures
15326 the default is BE32. BE32 format has been deprecated by ARM.
15327
15328 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
15329 @opindex march
15330 This specifies the name of the target ARM architecture. GCC uses this
15331 name to determine what kind of instructions it can emit when generating
15332 assembly code. This option can be used in conjunction with or instead
15333 of the @option{-mcpu=} option.
15334
15335 Permissible names are:
15336 @samp{armv4t},
15337 @samp{armv5t}, @samp{armv5te},
15338 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
15339 @samp{armv6z}, @samp{armv6zk},
15340 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
15341 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a},
15342 @samp{armv7-r},
15343 @samp{armv8-r},
15344 @samp{armv6-m}, @samp{armv6s-m},
15345 @samp{armv7-m}, @samp{armv7e-m},
15346 @samp{armv8-m.base}, @samp{armv8-m.main},
15347 @samp{iwmmxt} and @samp{iwmmxt2}.
15348
15349 Additionally, the following architectures, which lack support for the
15350 Thumb exection state, are recognized but support is deprecated:
15351 @samp{armv2}, @samp{armv2a}, @samp{armv3}, @samp{armv3m},
15352 @samp{armv4}, @samp{armv5} and @samp{armv5e}.
15353
15354 Many of the architectures support extensions. These can be added by
15355 appending @samp{+@var{extension}} to the architecture name. Extension
15356 options are processed in order and capabilities accumulate. An extension
15357 will also enable any necessary base extensions
15358 upon which it depends. For example, the @samp{+crypto} extension
15359 will always enable the @samp{+simd} extension. The exception to the
15360 additive construction is for extensions that are prefixed with
15361 @samp{+no@dots{}}: these extensions disable the specified option and
15362 any other extensions that may depend on the presence of that
15363 extension.
15364
15365 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
15366 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
15367 entirely disabled by the @samp{+nofp} option that follows it.
15368
15369 Most extension names are generically named, but have an effect that is
15370 dependent upon the architecture to which it is applied. For example,
15371 the @samp{+simd} option can be applied to both @samp{armv7-a} and
15372 @samp{armv8-a} architectures, but will enable the original ARMv7
15373 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-a
15374 variant for @samp{armv8-a}.
15375
15376 The table below lists the supported extensions for each architecture.
15377 Architectures not mentioned do not support any extensions.
15378
15379 @table @samp
15380 @item armv5e
15381 @itemx armv5te
15382 @itemx armv6
15383 @itemx armv6j
15384 @itemx armv6k
15385 @itemx armv6kz
15386 @itemx armv6t2
15387 @itemx armv6z
15388 @itemx armv6zk
15389 @table @samp
15390 @item +fp
15391 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
15392 used as an alias for this extension.
15393
15394 @item +nofp
15395 Disable the floating-point instructions.
15396 @end table
15397
15398 @item armv7
15399 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
15400 @table @samp
15401 @item +fp
15402 The VFPv3 floating-point instructions, with 16 double-precision
15403 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15404 for this extension. Note that floating-point is not supported by the
15405 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
15406 ARMv7-R architectures.
15407
15408 @item +nofp
15409 Disable the floating-point instructions.
15410 @end table
15411
15412 @item armv7-a
15413 @table @samp
15414 @item +fp
15415 The VFPv3 floating-point instructions, with 16 double-precision
15416 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15417 for this extension.
15418
15419 @item +simd
15420 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
15421 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
15422 for this extension.
15423
15424 @item +vfpv3
15425 The VFPv3 floating-point instructions, with 32 double-precision
15426 registers.
15427
15428 @item +vfpv3-d16-fp16
15429 The VFPv3 floating-point instructions, with 16 double-precision
15430 registers and the half-precision floating-point conversion operations.
15431
15432 @item +vfpv3-fp16
15433 The VFPv3 floating-point instructions, with 32 double-precision
15434 registers and the half-precision floating-point conversion operations.
15435
15436 @item +vfpv4-d16
15437 The VFPv4 floating-point instructions, with 16 double-precision
15438 registers.
15439
15440 @item +vfpv4
15441 The VFPv4 floating-point instructions, with 32 double-precision
15442 registers.
15443
15444 @item +neon-fp16
15445 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
15446 the half-precision floating-point conversion operations.
15447
15448 @item +neon-vfpv4
15449 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
15450
15451 @item +nosimd
15452 Disable the Advanced SIMD instructions (does not disable floating point).
15453
15454 @item +nofp
15455 Disable the floating-point and Advanced SIMD instructions.
15456 @end table
15457
15458 @item armv7ve
15459 The extended version of the ARMv7-A architecture with support for
15460 virtualization.
15461 @table @samp
15462 @item +fp
15463 The VFPv4 floating-point instructions, with 16 double-precision registers.
15464 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
15465
15466 @item +simd
15467 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
15468 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
15469
15470 @item +vfpv3-d16
15471 The VFPv3 floating-point instructions, with 16 double-precision
15472 registers.
15473
15474 @item +vfpv3
15475 The VFPv3 floating-point instructions, with 32 double-precision
15476 registers.
15477
15478 @item +vfpv3-d16-fp16
15479 The VFPv3 floating-point instructions, with 16 double-precision
15480 registers and the half-precision floating-point conversion operations.
15481
15482 @item +vfpv3-fp16
15483 The VFPv3 floating-point instructions, with 32 double-precision
15484 registers and the half-precision floating-point conversion operations.
15485
15486 @item +vfpv4-d16
15487 The VFPv4 floating-point instructions, with 16 double-precision
15488 registers.
15489
15490 @item +vfpv4
15491 The VFPv4 floating-point instructions, with 32 double-precision
15492 registers.
15493
15494 @item +neon
15495 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
15496 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
15497
15498 @item +neon-fp16
15499 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
15500 the half-precision floating-point conversion operations.
15501
15502 @item +nosimd
15503 Disable the Advanced SIMD instructions (does not disable floating point).
15504
15505 @item +nofp
15506 Disable the floating-point and Advanced SIMD instructions.
15507 @end table
15508
15509 @item armv8-a
15510 @table @samp
15511 @item +crc
15512 The Cyclic Redundancy Check (CRC) instructions.
15513 @item +simd
15514 The ARMv8 Advanced SIMD and floating-point instructions.
15515 @item +crypto
15516 The cryptographic instructions.
15517 @item +nocrypto
15518 Disable the cryptographic isntructions.
15519 @item +nofp
15520 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15521 @end table
15522
15523 @item armv8.1-a
15524 @table @samp
15525 @item +simd
15526 The ARMv8.1 Advanced SIMD and floating-point instructions.
15527
15528 @item +crypto
15529 The cryptographic instructions. This also enables the Advanced SIMD and
15530 floating-point instructions.
15531
15532 @item +nocrypto
15533 Disable the cryptographic isntructions.
15534
15535 @item +nofp
15536 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15537 @end table
15538
15539 @item armv8.2-a
15540 @table @samp
15541 @item +fp16
15542 The half-precision floating-point data processing instructions.
15543 This also enables the Advanced SIMD and floating-point instructions.
15544
15545 @item +simd
15546 The ARMv8.1 Advanced SIMD and floating-point instructions.
15547
15548 @item +crypto
15549 The cryptographic instructions. This also enables the Advanced SIMD and
15550 floating-point instructions.
15551
15552 @item +nocrypto
15553 Disable the cryptographic extension.
15554
15555 @item +nofp
15556 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15557 @end table
15558
15559 @item armv7-r
15560 @table @samp
15561 @item +fp.sp
15562 The single-precision VFPv3 floating-point instructions. The extension
15563 @samp{+vfpv3xd} can be used as an alias for this extension.
15564
15565 @item +fp
15566 The VFPv3 floating-point instructions with 16 double-precision registers.
15567 The extension +vfpv3-d16 can be used as an alias for this extension.
15568
15569 @item +nofp
15570 Disable the floating-point extension.
15571
15572 @item +idiv
15573 The ARM-state integer division instructions.
15574
15575 @item +noidiv
15576 Disable the ARM-state integer division extension.
15577 @end table
15578
15579 @item armv7e-m
15580 @table @samp
15581 @item +fp
15582 The single-precision VFPv4 floating-point instructions.
15583
15584 @item +fpv5
15585 The single-precision FPv5 floating-point instructions.
15586
15587 @item +fp.dp
15588 The single- and double-precision FPv5 floating-point instructions.
15589
15590 @item +nofp
15591 Disable the floating-point extensions.
15592 @end table
15593
15594 @item armv8-m.main
15595 @table @samp
15596 @item +dsp
15597 The DSP instructions.
15598
15599 @item +nodsp
15600 Disable the DSP extension.
15601
15602 @item +fp
15603 The single-precision floating-point instructions.
15604
15605 @item +fp.dp
15606 The single- and double-precision floating-point instructions.
15607
15608 @item +nofp
15609 Disable the floating-point extension.
15610 @end table
15611
15612 @item armv8-r
15613 @table @samp
15614 @item +crc
15615 The Cyclic Redundancy Check (CRC) instructions.
15616 @item +fp.sp
15617 The single-precision FPv5 floating-point instructions.
15618 @item +simd
15619 The ARMv8 Advanced SIMD and floating-point instructions.
15620 @item +crypto
15621 The cryptographic instructions.
15622 @item +nocrypto
15623 Disable the cryptographic isntructions.
15624 @item +nofp
15625 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15626 @end table
15627
15628 @end table
15629
15630 @option{-march=native} causes the compiler to auto-detect the architecture
15631 of the build computer. At present, this feature is only supported on
15632 GNU/Linux, and not all architectures are recognized. If the auto-detect
15633 is unsuccessful the option has no effect.
15634
15635 @item -mtune=@var{name}
15636 @opindex mtune
15637 This option specifies the name of the target ARM processor for
15638 which GCC should tune the performance of the code.
15639 For some ARM implementations better performance can be obtained by using
15640 this option.
15641 Permissible names are: @samp{arm2}, @samp{arm250},
15642 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
15643 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
15644 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
15645 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
15646 @samp{arm720},
15647 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
15648 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
15649 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
15650 @samp{strongarm1110},
15651 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
15652 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
15653 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
15654 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
15655 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
15656 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
15657 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
15658 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
15659 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
15660 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15661 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15662 @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7},
15663 @samp{cortex-r8}, @samp{cortex-r52},
15664 @samp{cortex-m33},
15665 @samp{cortex-m23},
15666 @samp{cortex-m7},
15667 @samp{cortex-m4},
15668 @samp{cortex-m3},
15669 @samp{cortex-m1},
15670 @samp{cortex-m0},
15671 @samp{cortex-m0plus},
15672 @samp{cortex-m1.small-multiply},
15673 @samp{cortex-m0.small-multiply},
15674 @samp{cortex-m0plus.small-multiply},
15675 @samp{exynos-m1},
15676 @samp{marvell-pj4},
15677 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
15678 @samp{fa526}, @samp{fa626},
15679 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
15680 @samp{xgene1}.
15681
15682 Additionally, this option can specify that GCC should tune the performance
15683 of the code for a big.LITTLE system. Permissible names are:
15684 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
15685 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15686 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
15687 @samp{cortex-a75.cortex-a55}.
15688
15689 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
15690 performance for a blend of processors within architecture @var{arch}.
15691 The aim is to generate code that run well on the current most popular
15692 processors, balancing between optimizations that benefit some CPUs in the
15693 range, and avoiding performance pitfalls of other CPUs. The effects of
15694 this option may change in future GCC versions as CPU models come and go.
15695
15696 @option{-mtune} permits the same extension options as @option{-mcpu}, but
15697 the extension options do not affect the tuning of the generated code.
15698
15699 @option{-mtune=native} causes the compiler to auto-detect the CPU
15700 of the build computer. At present, this feature is only supported on
15701 GNU/Linux, and not all architectures are recognized. If the auto-detect is
15702 unsuccessful the option has no effect.
15703
15704 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
15705 @opindex mcpu
15706 This specifies the name of the target ARM processor. GCC uses this name
15707 to derive the name of the target ARM architecture (as if specified
15708 by @option{-march}) and the ARM processor type for which to tune for
15709 performance (as if specified by @option{-mtune}). Where this option
15710 is used in conjunction with @option{-march} or @option{-mtune},
15711 those options take precedence over the appropriate part of this option.
15712
15713 Many of the supported CPUs implement optional architectural
15714 extensions. Where this is so the architectural extensions are
15715 normally enabled by default. If implementations that lack the
15716 extension exist, then the extension syntax can be used to disable
15717 those extensions that have been omitted. For floating-point and
15718 Advanced SIMD (Neon) instructions, the settings of the options
15719 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
15720 floating-point and Advanced SIMD instructions will only be used if
15721 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
15722 @option{-mfpu} other than @samp{auto} will override the available
15723 floating-point and SIMD extension instructions.
15724
15725 For example, @samp{cortex-a9} can be found in three major
15726 configurations: integer only, with just a floating-point unit or with
15727 floating-point and Advanced SIMD. The default is to enable all the
15728 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
15729 be used to disable just the SIMD or both the SIMD and floating-point
15730 instructions respectively.
15731
15732 Permissible names for this option are the same as those for
15733 @option{-mtune}.
15734
15735 The following extension options are common to the listed CPUs:
15736
15737 @table @samp
15738 @item +nofp
15739 Disables the floating-point instructions on @samp{arm9e},
15740 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
15741 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
15742 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
15743 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
15744 Disables the floating-point and SIMD instructions on
15745 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
15746 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
15747 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
15748 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
15749 @samp{cortex-a53} and @samp{cortex-a55}.
15750
15751 @item +nofp.dp
15752 Disables the double-precision component of the floating-point instructions
15753 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
15754
15755 @item +nosimd
15756 Disables the SIMD (but not floating-point) instructions on
15757 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
15758 and @samp{cortex-a9}.
15759
15760 @item +crypto
15761 Enables the cryptographic instructions on @samp{cortex-a32},
15762 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
15763 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
15764 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15765 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
15766 @samp{cortex-a75.cortex-a55}.
15767 @end table
15768
15769 Additionally the @samp{generic-armv7-a} pseudo target defaults to
15770 VFPv3 with 16 double-precision registers. It supports the following
15771 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
15772 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
15773 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
15774 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
15775 @option{-march=armv7-a}.
15776
15777 @option{-mcpu=generic-@var{arch}} is also permissible, and is
15778 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
15779 See @option{-mtune} for more information.
15780
15781 @option{-mcpu=native} causes the compiler to auto-detect the CPU
15782 of the build computer. At present, this feature is only supported on
15783 GNU/Linux, and not all architectures are recognized. If the auto-detect
15784 is unsuccessful the option has no effect.
15785
15786 @item -mfpu=@var{name}
15787 @opindex mfpu
15788 This specifies what floating-point hardware (or hardware emulation) is
15789 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
15790 @samp{vfpv3},
15791 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
15792 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
15793 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
15794 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
15795 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
15796 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
15797 is an alias for @samp{vfpv2}.
15798
15799 The setting @samp{auto} is the default and is special. It causes the
15800 compiler to select the floating-point and Advanced SIMD instructions
15801 based on the settings of @option{-mcpu} and @option{-march}.
15802
15803 If the selected floating-point hardware includes the NEON extension
15804 (e.g. @option{-mfpu=neon}), note that floating-point
15805 operations are not generated by GCC's auto-vectorization pass unless
15806 @option{-funsafe-math-optimizations} is also specified. This is
15807 because NEON hardware does not fully implement the IEEE 754 standard for
15808 floating-point arithmetic (in particular denormal values are treated as
15809 zero), so the use of NEON instructions may lead to a loss of precision.
15810
15811 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}).
15812
15813 @item -mfp16-format=@var{name}
15814 @opindex mfp16-format
15815 Specify the format of the @code{__fp16} half-precision floating-point type.
15816 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
15817 the default is @samp{none}, in which case the @code{__fp16} type is not
15818 defined. @xref{Half-Precision}, for more information.
15819
15820 @item -mstructure-size-boundary=@var{n}
15821 @opindex mstructure-size-boundary
15822 The sizes of all structures and unions are rounded up to a multiple
15823 of the number of bits set by this option. Permissible values are 8, 32
15824 and 64. The default value varies for different toolchains. For the COFF
15825 targeted toolchain the default value is 8. A value of 64 is only allowed
15826 if the underlying ABI supports it.
15827
15828 Specifying a larger number can produce faster, more efficient code, but
15829 can also increase the size of the program. Different values are potentially
15830 incompatible. Code compiled with one value cannot necessarily expect to
15831 work with code or libraries compiled with another value, if they exchange
15832 information using structures or unions.
15833
15834 This option is deprecated.
15835
15836 @item -mabort-on-noreturn
15837 @opindex mabort-on-noreturn
15838 Generate a call to the function @code{abort} at the end of a
15839 @code{noreturn} function. It is executed if the function tries to
15840 return.
15841
15842 @item -mlong-calls
15843 @itemx -mno-long-calls
15844 @opindex mlong-calls
15845 @opindex mno-long-calls
15846 Tells the compiler to perform function calls by first loading the
15847 address of the function into a register and then performing a subroutine
15848 call on this register. This switch is needed if the target function
15849 lies outside of the 64-megabyte addressing range of the offset-based
15850 version of subroutine call instruction.
15851
15852 Even if this switch is enabled, not all function calls are turned
15853 into long calls. The heuristic is that static functions, functions
15854 that have the @code{short_call} attribute, functions that are inside
15855 the scope of a @code{#pragma no_long_calls} directive, and functions whose
15856 definitions have already been compiled within the current compilation
15857 unit are not turned into long calls. The exceptions to this rule are
15858 that weak function definitions, functions with the @code{long_call}
15859 attribute or the @code{section} attribute, and functions that are within
15860 the scope of a @code{#pragma long_calls} directive are always
15861 turned into long calls.
15862
15863 This feature is not enabled by default. Specifying
15864 @option{-mno-long-calls} restores the default behavior, as does
15865 placing the function calls within the scope of a @code{#pragma
15866 long_calls_off} directive. Note these switches have no effect on how
15867 the compiler generates code to handle function calls via function
15868 pointers.
15869
15870 @item -msingle-pic-base
15871 @opindex msingle-pic-base
15872 Treat the register used for PIC addressing as read-only, rather than
15873 loading it in the prologue for each function. The runtime system is
15874 responsible for initializing this register with an appropriate value
15875 before execution begins.
15876
15877 @item -mpic-register=@var{reg}
15878 @opindex mpic-register
15879 Specify the register to be used for PIC addressing.
15880 For standard PIC base case, the default is any suitable register
15881 determined by compiler. For single PIC base case, the default is
15882 @samp{R9} if target is EABI based or stack-checking is enabled,
15883 otherwise the default is @samp{R10}.
15884
15885 @item -mpic-data-is-text-relative
15886 @opindex mpic-data-is-text-relative
15887 Assume that the displacement between the text and data segments is fixed
15888 at static link time. This permits using PC-relative addressing
15889 operations to access data known to be in the data segment. For
15890 non-VxWorks RTP targets, this option is enabled by default. When
15891 disabled on such targets, it will enable @option{-msingle-pic-base} by
15892 default.
15893
15894 @item -mpoke-function-name
15895 @opindex mpoke-function-name
15896 Write the name of each function into the text section, directly
15897 preceding the function prologue. The generated code is similar to this:
15898
15899 @smallexample
15900 t0
15901 .ascii "arm_poke_function_name", 0
15902 .align
15903 t1
15904 .word 0xff000000 + (t1 - t0)
15905 arm_poke_function_name
15906 mov ip, sp
15907 stmfd sp!, @{fp, ip, lr, pc@}
15908 sub fp, ip, #4
15909 @end smallexample
15910
15911 When performing a stack backtrace, code can inspect the value of
15912 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
15913 location @code{pc - 12} and the top 8 bits are set, then we know that
15914 there is a function name embedded immediately preceding this location
15915 and has length @code{((pc[-3]) & 0xff000000)}.
15916
15917 @item -mthumb
15918 @itemx -marm
15919 @opindex marm
15920 @opindex mthumb
15921
15922 Select between generating code that executes in ARM and Thumb
15923 states. The default for most configurations is to generate code
15924 that executes in ARM state, but the default can be changed by
15925 configuring GCC with the @option{--with-mode=}@var{state}
15926 configure option.
15927
15928 You can also override the ARM and Thumb mode for each function
15929 by using the @code{target("thumb")} and @code{target("arm")} function attributes
15930 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
15931
15932 @item -mtpcs-frame
15933 @opindex mtpcs-frame
15934 Generate a stack frame that is compliant with the Thumb Procedure Call
15935 Standard for all non-leaf functions. (A leaf function is one that does
15936 not call any other functions.) The default is @option{-mno-tpcs-frame}.
15937
15938 @item -mtpcs-leaf-frame
15939 @opindex mtpcs-leaf-frame
15940 Generate a stack frame that is compliant with the Thumb Procedure Call
15941 Standard for all leaf functions. (A leaf function is one that does
15942 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
15943
15944 @item -mcallee-super-interworking
15945 @opindex mcallee-super-interworking
15946 Gives all externally visible functions in the file being compiled an ARM
15947 instruction set header which switches to Thumb mode before executing the
15948 rest of the function. This allows these functions to be called from
15949 non-interworking code. This option is not valid in AAPCS configurations
15950 because interworking is enabled by default.
15951
15952 @item -mcaller-super-interworking
15953 @opindex mcaller-super-interworking
15954 Allows calls via function pointers (including virtual functions) to
15955 execute correctly regardless of whether the target code has been
15956 compiled for interworking or not. There is a small overhead in the cost
15957 of executing a function pointer if this option is enabled. This option
15958 is not valid in AAPCS configurations because interworking is enabled
15959 by default.
15960
15961 @item -mtp=@var{name}
15962 @opindex mtp
15963 Specify the access model for the thread local storage pointer. The valid
15964 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
15965 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
15966 (supported in the arm6k architecture), and @samp{auto}, which uses the
15967 best available method for the selected processor. The default setting is
15968 @samp{auto}.
15969
15970 @item -mtls-dialect=@var{dialect}
15971 @opindex mtls-dialect
15972 Specify the dialect to use for accessing thread local storage. Two
15973 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
15974 @samp{gnu} dialect selects the original GNU scheme for supporting
15975 local and global dynamic TLS models. The @samp{gnu2} dialect
15976 selects the GNU descriptor scheme, which provides better performance
15977 for shared libraries. The GNU descriptor scheme is compatible with
15978 the original scheme, but does require new assembler, linker and
15979 library support. Initial and local exec TLS models are unaffected by
15980 this option and always use the original scheme.
15981
15982 @item -mword-relocations
15983 @opindex mword-relocations
15984 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
15985 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
15986 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
15987 is specified.
15988
15989 @item -mfix-cortex-m3-ldrd
15990 @opindex mfix-cortex-m3-ldrd
15991 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
15992 with overlapping destination and base registers are used. This option avoids
15993 generating these instructions. This option is enabled by default when
15994 @option{-mcpu=cortex-m3} is specified.
15995
15996 @item -munaligned-access
15997 @itemx -mno-unaligned-access
15998 @opindex munaligned-access
15999 @opindex mno-unaligned-access
16000 Enables (or disables) reading and writing of 16- and 32- bit values
16001 from addresses that are not 16- or 32- bit aligned. By default
16002 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
16003 ARMv8-M Baseline architectures, and enabled for all other
16004 architectures. If unaligned access is not enabled then words in packed
16005 data structures are accessed a byte at a time.
16006
16007 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
16008 generated object file to either true or false, depending upon the
16009 setting of this option. If unaligned access is enabled then the
16010 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
16011 defined.
16012
16013 @item -mneon-for-64bits
16014 @opindex mneon-for-64bits
16015 Enables using Neon to handle scalar 64-bits operations. This is
16016 disabled by default since the cost of moving data from core registers
16017 to Neon is high.
16018
16019 @item -mslow-flash-data
16020 @opindex mslow-flash-data
16021 Assume loading data from flash is slower than fetching instruction.
16022 Therefore literal load is minimized for better performance.
16023 This option is only supported when compiling for ARMv7 M-profile and
16024 off by default.
16025
16026 @item -masm-syntax-unified
16027 @opindex masm-syntax-unified
16028 Assume inline assembler is using unified asm syntax. The default is
16029 currently off which implies divided syntax. This option has no impact
16030 on Thumb2. However, this may change in future releases of GCC.
16031 Divided syntax should be considered deprecated.
16032
16033 @item -mrestrict-it
16034 @opindex mrestrict-it
16035 Restricts generation of IT blocks to conform to the rules of ARMv8.
16036 IT blocks can only contain a single 16-bit instruction from a select
16037 set of instructions. This option is on by default for ARMv8 Thumb mode.
16038
16039 @item -mprint-tune-info
16040 @opindex mprint-tune-info
16041 Print CPU tuning information as comment in assembler file. This is
16042 an option used only for regression testing of the compiler and not
16043 intended for ordinary use in compiling code. This option is disabled
16044 by default.
16045
16046 @item -mpure-code
16047 @opindex mpure-code
16048 Do not allow constant data to be placed in code sections.
16049 Additionally, when compiling for ELF object format give all text sections the
16050 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
16051 is only available when generating non-pic code for M-profile targets with the
16052 MOVT instruction.
16053
16054 @item -mcmse
16055 @opindex mcmse
16056 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
16057 Development Tools Engineering Specification", which can be found on
16058 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
16059 @end table
16060
16061 @node AVR Options
16062 @subsection AVR Options
16063 @cindex AVR Options
16064
16065 These options are defined for AVR implementations:
16066
16067 @table @gcctabopt
16068 @item -mmcu=@var{mcu}
16069 @opindex mmcu
16070 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
16071
16072 The default for this option is@tie{}@samp{avr2}.
16073
16074 GCC supports the following AVR devices and ISAs:
16075
16076 @include avr-mmcu.texi
16077
16078 @item -mabsdata
16079 @opindex mabsdata
16080
16081 Assume that all data in static storage can be accessed by LDS / STS
16082 instructions. This option has only an effect on reduced Tiny devices like
16083 ATtiny40. See also the @code{absdata}
16084 @ref{AVR Variable Attributes,variable attribute}.
16085
16086 @item -maccumulate-args
16087 @opindex maccumulate-args
16088 Accumulate outgoing function arguments and acquire/release the needed
16089 stack space for outgoing function arguments once in function
16090 prologue/epilogue. Without this option, outgoing arguments are pushed
16091 before calling a function and popped afterwards.
16092
16093 Popping the arguments after the function call can be expensive on
16094 AVR so that accumulating the stack space might lead to smaller
16095 executables because arguments need not be removed from the
16096 stack after such a function call.
16097
16098 This option can lead to reduced code size for functions that perform
16099 several calls to functions that get their arguments on the stack like
16100 calls to printf-like functions.
16101
16102 @item -mbranch-cost=@var{cost}
16103 @opindex mbranch-cost
16104 Set the branch costs for conditional branch instructions to
16105 @var{cost}. Reasonable values for @var{cost} are small, non-negative
16106 integers. The default branch cost is 0.
16107
16108 @item -mcall-prologues
16109 @opindex mcall-prologues
16110 Functions prologues/epilogues are expanded as calls to appropriate
16111 subroutines. Code size is smaller.
16112
16113 @item -mgas-isr-prologues
16114 @opindex mgas-isr-prologues
16115 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
16116 instruction supported by GNU Binutils.
16117 If this option is on, the feature can still be disabled for individual
16118 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
16119 function attribute. This feature is activated per default
16120 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
16121 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
16122
16123 @item -mint8
16124 @opindex mint8
16125 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
16126 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
16127 and @code{long long} is 4 bytes. Please note that this option does not
16128 conform to the C standards, but it results in smaller code
16129 size.
16130
16131 @item -mn-flash=@var{num}
16132 @opindex mn-flash
16133 Assume that the flash memory has a size of
16134 @var{num} times 64@tie{}KiB.
16135
16136 @item -mno-interrupts
16137 @opindex mno-interrupts
16138 Generated code is not compatible with hardware interrupts.
16139 Code size is smaller.
16140
16141 @item -mrelax
16142 @opindex mrelax
16143 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
16144 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
16145 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
16146 the assembler's command line and the @option{--relax} option to the
16147 linker's command line.
16148
16149 Jump relaxing is performed by the linker because jump offsets are not
16150 known before code is located. Therefore, the assembler code generated by the
16151 compiler is the same, but the instructions in the executable may
16152 differ from instructions in the assembler code.
16153
16154 Relaxing must be turned on if linker stubs are needed, see the
16155 section on @code{EIND} and linker stubs below.
16156
16157 @item -mrmw
16158 @opindex mrmw
16159 Assume that the device supports the Read-Modify-Write
16160 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
16161
16162 @item -mshort-calls
16163 @opindex mshort-calls
16164
16165 Assume that @code{RJMP} and @code{RCALL} can target the whole
16166 program memory.
16167
16168 This option is used internally for multilib selection. It is
16169 not an optimization option, and you don't need to set it by hand.
16170
16171 @item -msp8
16172 @opindex msp8
16173 Treat the stack pointer register as an 8-bit register,
16174 i.e.@: assume the high byte of the stack pointer is zero.
16175 In general, you don't need to set this option by hand.
16176
16177 This option is used internally by the compiler to select and
16178 build multilibs for architectures @code{avr2} and @code{avr25}.
16179 These architectures mix devices with and without @code{SPH}.
16180 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
16181 the compiler driver adds or removes this option from the compiler
16182 proper's command line, because the compiler then knows if the device
16183 or architecture has an 8-bit stack pointer and thus no @code{SPH}
16184 register or not.
16185
16186 @item -mstrict-X
16187 @opindex mstrict-X
16188 Use address register @code{X} in a way proposed by the hardware. This means
16189 that @code{X} is only used in indirect, post-increment or
16190 pre-decrement addressing.
16191
16192 Without this option, the @code{X} register may be used in the same way
16193 as @code{Y} or @code{Z} which then is emulated by additional
16194 instructions.
16195 For example, loading a value with @code{X+const} addressing with a
16196 small non-negative @code{const < 64} to a register @var{Rn} is
16197 performed as
16198
16199 @example
16200 adiw r26, const ; X += const
16201 ld @var{Rn}, X ; @var{Rn} = *X
16202 sbiw r26, const ; X -= const
16203 @end example
16204
16205 @item -mtiny-stack
16206 @opindex mtiny-stack
16207 Only change the lower 8@tie{}bits of the stack pointer.
16208
16209 @item -mfract-convert-truncate
16210 @opindex mfract-convert-truncate
16211 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
16212
16213 @item -nodevicelib
16214 @opindex nodevicelib
16215 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
16216
16217 @item -Waddr-space-convert
16218 @opindex Waddr-space-convert
16219 Warn about conversions between address spaces in the case where the
16220 resulting address space is not contained in the incoming address space.
16221
16222 @item -Wmisspelled-isr
16223 @opindex Wmisspelled-isr
16224 Warn if the ISR is misspelled, i.e. without __vector prefix.
16225 Enabled by default.
16226 @end table
16227
16228 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
16229 @cindex @code{EIND}
16230 Pointers in the implementation are 16@tie{}bits wide.
16231 The address of a function or label is represented as word address so
16232 that indirect jumps and calls can target any code address in the
16233 range of 64@tie{}Ki words.
16234
16235 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
16236 bytes of program memory space, there is a special function register called
16237 @code{EIND} that serves as most significant part of the target address
16238 when @code{EICALL} or @code{EIJMP} instructions are used.
16239
16240 Indirect jumps and calls on these devices are handled as follows by
16241 the compiler and are subject to some limitations:
16242
16243 @itemize @bullet
16244
16245 @item
16246 The compiler never sets @code{EIND}.
16247
16248 @item
16249 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
16250 instructions or might read @code{EIND} directly in order to emulate an
16251 indirect call/jump by means of a @code{RET} instruction.
16252
16253 @item
16254 The compiler assumes that @code{EIND} never changes during the startup
16255 code or during the application. In particular, @code{EIND} is not
16256 saved/restored in function or interrupt service routine
16257 prologue/epilogue.
16258
16259 @item
16260 For indirect calls to functions and computed goto, the linker
16261 generates @emph{stubs}. Stubs are jump pads sometimes also called
16262 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
16263 The stub contains a direct jump to the desired address.
16264
16265 @item
16266 Linker relaxation must be turned on so that the linker generates
16267 the stubs correctly in all situations. See the compiler option
16268 @option{-mrelax} and the linker option @option{--relax}.
16269 There are corner cases where the linker is supposed to generate stubs
16270 but aborts without relaxation and without a helpful error message.
16271
16272 @item
16273 The default linker script is arranged for code with @code{EIND = 0}.
16274 If code is supposed to work for a setup with @code{EIND != 0}, a custom
16275 linker script has to be used in order to place the sections whose
16276 name start with @code{.trampolines} into the segment where @code{EIND}
16277 points to.
16278
16279 @item
16280 The startup code from libgcc never sets @code{EIND}.
16281 Notice that startup code is a blend of code from libgcc and AVR-LibC.
16282 For the impact of AVR-LibC on @code{EIND}, see the
16283 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
16284
16285 @item
16286 It is legitimate for user-specific startup code to set up @code{EIND}
16287 early, for example by means of initialization code located in
16288 section @code{.init3}. Such code runs prior to general startup code
16289 that initializes RAM and calls constructors, but after the bit
16290 of startup code from AVR-LibC that sets @code{EIND} to the segment
16291 where the vector table is located.
16292 @example
16293 #include <avr/io.h>
16294
16295 static void
16296 __attribute__((section(".init3"),naked,used,no_instrument_function))
16297 init3_set_eind (void)
16298 @{
16299 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
16300 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
16301 @}
16302 @end example
16303
16304 @noindent
16305 The @code{__trampolines_start} symbol is defined in the linker script.
16306
16307 @item
16308 Stubs are generated automatically by the linker if
16309 the following two conditions are met:
16310 @itemize @minus
16311
16312 @item The address of a label is taken by means of the @code{gs} modifier
16313 (short for @emph{generate stubs}) like so:
16314 @example
16315 LDI r24, lo8(gs(@var{func}))
16316 LDI r25, hi8(gs(@var{func}))
16317 @end example
16318 @item The final location of that label is in a code segment
16319 @emph{outside} the segment where the stubs are located.
16320 @end itemize
16321
16322 @item
16323 The compiler emits such @code{gs} modifiers for code labels in the
16324 following situations:
16325 @itemize @minus
16326 @item Taking address of a function or code label.
16327 @item Computed goto.
16328 @item If prologue-save function is used, see @option{-mcall-prologues}
16329 command-line option.
16330 @item Switch/case dispatch tables. If you do not want such dispatch
16331 tables you can specify the @option{-fno-jump-tables} command-line option.
16332 @item C and C++ constructors/destructors called during startup/shutdown.
16333 @item If the tools hit a @code{gs()} modifier explained above.
16334 @end itemize
16335
16336 @item
16337 Jumping to non-symbolic addresses like so is @emph{not} supported:
16338
16339 @example
16340 int main (void)
16341 @{
16342 /* Call function at word address 0x2 */
16343 return ((int(*)(void)) 0x2)();
16344 @}
16345 @end example
16346
16347 Instead, a stub has to be set up, i.e.@: the function has to be called
16348 through a symbol (@code{func_4} in the example):
16349
16350 @example
16351 int main (void)
16352 @{
16353 extern int func_4 (void);
16354
16355 /* Call function at byte address 0x4 */
16356 return func_4();
16357 @}
16358 @end example
16359
16360 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
16361 Alternatively, @code{func_4} can be defined in the linker script.
16362 @end itemize
16363
16364 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
16365 @cindex @code{RAMPD}
16366 @cindex @code{RAMPX}
16367 @cindex @code{RAMPY}
16368 @cindex @code{RAMPZ}
16369 Some AVR devices support memories larger than the 64@tie{}KiB range
16370 that can be accessed with 16-bit pointers. To access memory locations
16371 outside this 64@tie{}KiB range, the content of a @code{RAMP}
16372 register is used as high part of the address:
16373 The @code{X}, @code{Y}, @code{Z} address register is concatenated
16374 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
16375 register, respectively, to get a wide address. Similarly,
16376 @code{RAMPD} is used together with direct addressing.
16377
16378 @itemize
16379 @item
16380 The startup code initializes the @code{RAMP} special function
16381 registers with zero.
16382
16383 @item
16384 If a @ref{AVR Named Address Spaces,named address space} other than
16385 generic or @code{__flash} is used, then @code{RAMPZ} is set
16386 as needed before the operation.
16387
16388 @item
16389 If the device supports RAM larger than 64@tie{}KiB and the compiler
16390 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
16391 is reset to zero after the operation.
16392
16393 @item
16394 If the device comes with a specific @code{RAMP} register, the ISR
16395 prologue/epilogue saves/restores that SFR and initializes it with
16396 zero in case the ISR code might (implicitly) use it.
16397
16398 @item
16399 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
16400 If you use inline assembler to read from locations outside the
16401 16-bit address range and change one of the @code{RAMP} registers,
16402 you must reset it to zero after the access.
16403
16404 @end itemize
16405
16406 @subsubsection AVR Built-in Macros
16407
16408 GCC defines several built-in macros so that the user code can test
16409 for the presence or absence of features. Almost any of the following
16410 built-in macros are deduced from device capabilities and thus
16411 triggered by the @option{-mmcu=} command-line option.
16412
16413 For even more AVR-specific built-in macros see
16414 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
16415
16416 @table @code
16417
16418 @item __AVR_ARCH__
16419 Build-in macro that resolves to a decimal number that identifies the
16420 architecture and depends on the @option{-mmcu=@var{mcu}} option.
16421 Possible values are:
16422
16423 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
16424 @code{4}, @code{5}, @code{51}, @code{6}
16425
16426 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
16427 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
16428
16429 respectively and
16430
16431 @code{100},
16432 @code{102}, @code{103}, @code{104},
16433 @code{105}, @code{106}, @code{107}
16434
16435 for @var{mcu}=@code{avrtiny},
16436 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
16437 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
16438 If @var{mcu} specifies a device, this built-in macro is set
16439 accordingly. For example, with @option{-mmcu=atmega8} the macro is
16440 defined to @code{4}.
16441
16442 @item __AVR_@var{Device}__
16443 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
16444 the device's name. For example, @option{-mmcu=atmega8} defines the
16445 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
16446 @code{__AVR_ATtiny261A__}, etc.
16447
16448 The built-in macros' names follow
16449 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
16450 the device name as from the AVR user manual. The difference between
16451 @var{Device} in the built-in macro and @var{device} in
16452 @option{-mmcu=@var{device}} is that the latter is always lowercase.
16453
16454 If @var{device} is not a device but only a core architecture like
16455 @samp{avr51}, this macro is not defined.
16456
16457 @item __AVR_DEVICE_NAME__
16458 Setting @option{-mmcu=@var{device}} defines this built-in macro to
16459 the device's name. For example, with @option{-mmcu=atmega8} the macro
16460 is defined to @code{atmega8}.
16461
16462 If @var{device} is not a device but only a core architecture like
16463 @samp{avr51}, this macro is not defined.
16464
16465 @item __AVR_XMEGA__
16466 The device / architecture belongs to the XMEGA family of devices.
16467
16468 @item __AVR_HAVE_ELPM__
16469 The device has the @code{ELPM} instruction.
16470
16471 @item __AVR_HAVE_ELPMX__
16472 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
16473 R@var{n},Z+} instructions.
16474
16475 @item __AVR_HAVE_MOVW__
16476 The device has the @code{MOVW} instruction to perform 16-bit
16477 register-register moves.
16478
16479 @item __AVR_HAVE_LPMX__
16480 The device has the @code{LPM R@var{n},Z} and
16481 @code{LPM R@var{n},Z+} instructions.
16482
16483 @item __AVR_HAVE_MUL__
16484 The device has a hardware multiplier.
16485
16486 @item __AVR_HAVE_JMP_CALL__
16487 The device has the @code{JMP} and @code{CALL} instructions.
16488 This is the case for devices with more than 8@tie{}KiB of program
16489 memory.
16490
16491 @item __AVR_HAVE_EIJMP_EICALL__
16492 @itemx __AVR_3_BYTE_PC__
16493 The device has the @code{EIJMP} and @code{EICALL} instructions.
16494 This is the case for devices with more than 128@tie{}KiB of program memory.
16495 This also means that the program counter
16496 (PC) is 3@tie{}bytes wide.
16497
16498 @item __AVR_2_BYTE_PC__
16499 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
16500 with up to 128@tie{}KiB of program memory.
16501
16502 @item __AVR_HAVE_8BIT_SP__
16503 @itemx __AVR_HAVE_16BIT_SP__
16504 The stack pointer (SP) register is treated as 8-bit respectively
16505 16-bit register by the compiler.
16506 The definition of these macros is affected by @option{-mtiny-stack}.
16507
16508 @item __AVR_HAVE_SPH__
16509 @itemx __AVR_SP8__
16510 The device has the SPH (high part of stack pointer) special function
16511 register or has an 8-bit stack pointer, respectively.
16512 The definition of these macros is affected by @option{-mmcu=} and
16513 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
16514 by @option{-msp8}.
16515
16516 @item __AVR_HAVE_RAMPD__
16517 @itemx __AVR_HAVE_RAMPX__
16518 @itemx __AVR_HAVE_RAMPY__
16519 @itemx __AVR_HAVE_RAMPZ__
16520 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
16521 @code{RAMPZ} special function register, respectively.
16522
16523 @item __NO_INTERRUPTS__
16524 This macro reflects the @option{-mno-interrupts} command-line option.
16525
16526 @item __AVR_ERRATA_SKIP__
16527 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
16528 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
16529 instructions because of a hardware erratum. Skip instructions are
16530 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
16531 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
16532 set.
16533
16534 @item __AVR_ISA_RMW__
16535 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
16536
16537 @item __AVR_SFR_OFFSET__=@var{offset}
16538 Instructions that can address I/O special function registers directly
16539 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
16540 address as if addressed by an instruction to access RAM like @code{LD}
16541 or @code{STS}. This offset depends on the device architecture and has
16542 to be subtracted from the RAM address in order to get the
16543 respective I/O@tie{}address.
16544
16545 @item __AVR_SHORT_CALLS__
16546 The @option{-mshort-calls} command line option is set.
16547
16548 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
16549 Some devices support reading from flash memory by means of @code{LD*}
16550 instructions. The flash memory is seen in the data address space
16551 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
16552 is not defined, this feature is not available. If defined,
16553 the address space is linear and there is no need to put
16554 @code{.rodata} into RAM. This is handled by the default linker
16555 description file, and is currently available for
16556 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
16557 there is no need to use address spaces like @code{__flash} or
16558 features like attribute @code{progmem} and @code{pgm_read_*}.
16559
16560 @item __WITH_AVRLIBC__
16561 The compiler is configured to be used together with AVR-Libc.
16562 See the @option{--with-avrlibc} configure option.
16563
16564 @end table
16565
16566 @node Blackfin Options
16567 @subsection Blackfin Options
16568 @cindex Blackfin Options
16569
16570 @table @gcctabopt
16571 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
16572 @opindex mcpu=
16573 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
16574 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
16575 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
16576 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
16577 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
16578 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
16579 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
16580 @samp{bf561}, @samp{bf592}.
16581
16582 The optional @var{sirevision} specifies the silicon revision of the target
16583 Blackfin processor. Any workarounds available for the targeted silicon revision
16584 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
16585 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
16586 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
16587 hexadecimal digits representing the major and minor numbers in the silicon
16588 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
16589 is not defined. If @var{sirevision} is @samp{any}, the
16590 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
16591 If this optional @var{sirevision} is not used, GCC assumes the latest known
16592 silicon revision of the targeted Blackfin processor.
16593
16594 GCC defines a preprocessor macro for the specified @var{cpu}.
16595 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
16596 provided by libgloss to be linked in if @option{-msim} is not given.
16597
16598 Without this option, @samp{bf532} is used as the processor by default.
16599
16600 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
16601 only the preprocessor macro is defined.
16602
16603 @item -msim
16604 @opindex msim
16605 Specifies that the program will be run on the simulator. This causes
16606 the simulator BSP provided by libgloss to be linked in. This option
16607 has effect only for @samp{bfin-elf} toolchain.
16608 Certain other options, such as @option{-mid-shared-library} and
16609 @option{-mfdpic}, imply @option{-msim}.
16610
16611 @item -momit-leaf-frame-pointer
16612 @opindex momit-leaf-frame-pointer
16613 Don't keep the frame pointer in a register for leaf functions. This
16614 avoids the instructions to save, set up and restore frame pointers and
16615 makes an extra register available in leaf functions. The option
16616 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
16617 which might make debugging harder.
16618
16619 @item -mspecld-anomaly
16620 @opindex mspecld-anomaly
16621 When enabled, the compiler ensures that the generated code does not
16622 contain speculative loads after jump instructions. If this option is used,
16623 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
16624
16625 @item -mno-specld-anomaly
16626 @opindex mno-specld-anomaly
16627 Don't generate extra code to prevent speculative loads from occurring.
16628
16629 @item -mcsync-anomaly
16630 @opindex mcsync-anomaly
16631 When enabled, the compiler ensures that the generated code does not
16632 contain CSYNC or SSYNC instructions too soon after conditional branches.
16633 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
16634
16635 @item -mno-csync-anomaly
16636 @opindex mno-csync-anomaly
16637 Don't generate extra code to prevent CSYNC or SSYNC instructions from
16638 occurring too soon after a conditional branch.
16639
16640 @item -mlow-64k
16641 @opindex mlow-64k
16642 When enabled, the compiler is free to take advantage of the knowledge that
16643 the entire program fits into the low 64k of memory.
16644
16645 @item -mno-low-64k
16646 @opindex mno-low-64k
16647 Assume that the program is arbitrarily large. This is the default.
16648
16649 @item -mstack-check-l1
16650 @opindex mstack-check-l1
16651 Do stack checking using information placed into L1 scratchpad memory by the
16652 uClinux kernel.
16653
16654 @item -mid-shared-library
16655 @opindex mid-shared-library
16656 Generate code that supports shared libraries via the library ID method.
16657 This allows for execute in place and shared libraries in an environment
16658 without virtual memory management. This option implies @option{-fPIC}.
16659 With a @samp{bfin-elf} target, this option implies @option{-msim}.
16660
16661 @item -mno-id-shared-library
16662 @opindex mno-id-shared-library
16663 Generate code that doesn't assume ID-based shared libraries are being used.
16664 This is the default.
16665
16666 @item -mleaf-id-shared-library
16667 @opindex mleaf-id-shared-library
16668 Generate code that supports shared libraries via the library ID method,
16669 but assumes that this library or executable won't link against any other
16670 ID shared libraries. That allows the compiler to use faster code for jumps
16671 and calls.
16672
16673 @item -mno-leaf-id-shared-library
16674 @opindex mno-leaf-id-shared-library
16675 Do not assume that the code being compiled won't link against any ID shared
16676 libraries. Slower code is generated for jump and call insns.
16677
16678 @item -mshared-library-id=n
16679 @opindex mshared-library-id
16680 Specifies the identification number of the ID-based shared library being
16681 compiled. Specifying a value of 0 generates more compact code; specifying
16682 other values forces the allocation of that number to the current
16683 library but is no more space- or time-efficient than omitting this option.
16684
16685 @item -msep-data
16686 @opindex msep-data
16687 Generate code that allows the data segment to be located in a different
16688 area of memory from the text segment. This allows for execute in place in
16689 an environment without virtual memory management by eliminating relocations
16690 against the text section.
16691
16692 @item -mno-sep-data
16693 @opindex mno-sep-data
16694 Generate code that assumes that the data segment follows the text segment.
16695 This is the default.
16696
16697 @item -mlong-calls
16698 @itemx -mno-long-calls
16699 @opindex mlong-calls
16700 @opindex mno-long-calls
16701 Tells the compiler to perform function calls by first loading the
16702 address of the function into a register and then performing a subroutine
16703 call on this register. This switch is needed if the target function
16704 lies outside of the 24-bit addressing range of the offset-based
16705 version of subroutine call instruction.
16706
16707 This feature is not enabled by default. Specifying
16708 @option{-mno-long-calls} restores the default behavior. Note these
16709 switches have no effect on how the compiler generates code to handle
16710 function calls via function pointers.
16711
16712 @item -mfast-fp
16713 @opindex mfast-fp
16714 Link with the fast floating-point library. This library relaxes some of
16715 the IEEE floating-point standard's rules for checking inputs against
16716 Not-a-Number (NAN), in the interest of performance.
16717
16718 @item -minline-plt
16719 @opindex minline-plt
16720 Enable inlining of PLT entries in function calls to functions that are
16721 not known to bind locally. It has no effect without @option{-mfdpic}.
16722
16723 @item -mmulticore
16724 @opindex mmulticore
16725 Build a standalone application for multicore Blackfin processors.
16726 This option causes proper start files and link scripts supporting
16727 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
16728 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
16729
16730 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
16731 selects the one-application-per-core programming model. Without
16732 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
16733 programming model is used. In this model, the main function of Core B
16734 should be named as @code{coreb_main}.
16735
16736 If this option is not used, the single-core application programming
16737 model is used.
16738
16739 @item -mcorea
16740 @opindex mcorea
16741 Build a standalone application for Core A of BF561 when using
16742 the one-application-per-core programming model. Proper start files
16743 and link scripts are used to support Core A, and the macro
16744 @code{__BFIN_COREA} is defined.
16745 This option can only be used in conjunction with @option{-mmulticore}.
16746
16747 @item -mcoreb
16748 @opindex mcoreb
16749 Build a standalone application for Core B of BF561 when using
16750 the one-application-per-core programming model. Proper start files
16751 and link scripts are used to support Core B, and the macro
16752 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
16753 should be used instead of @code{main}.
16754 This option can only be used in conjunction with @option{-mmulticore}.
16755
16756 @item -msdram
16757 @opindex msdram
16758 Build a standalone application for SDRAM. Proper start files and
16759 link scripts are used to put the application into SDRAM, and the macro
16760 @code{__BFIN_SDRAM} is defined.
16761 The loader should initialize SDRAM before loading the application.
16762
16763 @item -micplb
16764 @opindex micplb
16765 Assume that ICPLBs are enabled at run time. This has an effect on certain
16766 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
16767 are enabled; for standalone applications the default is off.
16768 @end table
16769
16770 @node C6X Options
16771 @subsection C6X Options
16772 @cindex C6X Options
16773
16774 @table @gcctabopt
16775 @item -march=@var{name}
16776 @opindex march
16777 This specifies the name of the target architecture. GCC uses this
16778 name to determine what kind of instructions it can emit when generating
16779 assembly code. Permissible names are: @samp{c62x},
16780 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
16781
16782 @item -mbig-endian
16783 @opindex mbig-endian
16784 Generate code for a big-endian target.
16785
16786 @item -mlittle-endian
16787 @opindex mlittle-endian
16788 Generate code for a little-endian target. This is the default.
16789
16790 @item -msim
16791 @opindex msim
16792 Choose startup files and linker script suitable for the simulator.
16793
16794 @item -msdata=default
16795 @opindex msdata=default
16796 Put small global and static data in the @code{.neardata} section,
16797 which is pointed to by register @code{B14}. Put small uninitialized
16798 global and static data in the @code{.bss} section, which is adjacent
16799 to the @code{.neardata} section. Put small read-only data into the
16800 @code{.rodata} section. The corresponding sections used for large
16801 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
16802
16803 @item -msdata=all
16804 @opindex msdata=all
16805 Put all data, not just small objects, into the sections reserved for
16806 small data, and use addressing relative to the @code{B14} register to
16807 access them.
16808
16809 @item -msdata=none
16810 @opindex msdata=none
16811 Make no use of the sections reserved for small data, and use absolute
16812 addresses to access all data. Put all initialized global and static
16813 data in the @code{.fardata} section, and all uninitialized data in the
16814 @code{.far} section. Put all constant data into the @code{.const}
16815 section.
16816 @end table
16817
16818 @node CRIS Options
16819 @subsection CRIS Options
16820 @cindex CRIS Options
16821
16822 These options are defined specifically for the CRIS ports.
16823
16824 @table @gcctabopt
16825 @item -march=@var{architecture-type}
16826 @itemx -mcpu=@var{architecture-type}
16827 @opindex march
16828 @opindex mcpu
16829 Generate code for the specified architecture. The choices for
16830 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
16831 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
16832 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
16833 @samp{v10}.
16834
16835 @item -mtune=@var{architecture-type}
16836 @opindex mtune
16837 Tune to @var{architecture-type} everything applicable about the generated
16838 code, except for the ABI and the set of available instructions. The
16839 choices for @var{architecture-type} are the same as for
16840 @option{-march=@var{architecture-type}}.
16841
16842 @item -mmax-stack-frame=@var{n}
16843 @opindex mmax-stack-frame
16844 Warn when the stack frame of a function exceeds @var{n} bytes.
16845
16846 @item -metrax4
16847 @itemx -metrax100
16848 @opindex metrax4
16849 @opindex metrax100
16850 The options @option{-metrax4} and @option{-metrax100} are synonyms for
16851 @option{-march=v3} and @option{-march=v8} respectively.
16852
16853 @item -mmul-bug-workaround
16854 @itemx -mno-mul-bug-workaround
16855 @opindex mmul-bug-workaround
16856 @opindex mno-mul-bug-workaround
16857 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
16858 models where it applies. This option is active by default.
16859
16860 @item -mpdebug
16861 @opindex mpdebug
16862 Enable CRIS-specific verbose debug-related information in the assembly
16863 code. This option also has the effect of turning off the @samp{#NO_APP}
16864 formatted-code indicator to the assembler at the beginning of the
16865 assembly file.
16866
16867 @item -mcc-init
16868 @opindex mcc-init
16869 Do not use condition-code results from previous instruction; always emit
16870 compare and test instructions before use of condition codes.
16871
16872 @item -mno-side-effects
16873 @opindex mno-side-effects
16874 Do not emit instructions with side effects in addressing modes other than
16875 post-increment.
16876
16877 @item -mstack-align
16878 @itemx -mno-stack-align
16879 @itemx -mdata-align
16880 @itemx -mno-data-align
16881 @itemx -mconst-align
16882 @itemx -mno-const-align
16883 @opindex mstack-align
16884 @opindex mno-stack-align
16885 @opindex mdata-align
16886 @opindex mno-data-align
16887 @opindex mconst-align
16888 @opindex mno-const-align
16889 These options (@samp{no-} options) arrange (eliminate arrangements) for the
16890 stack frame, individual data and constants to be aligned for the maximum
16891 single data access size for the chosen CPU model. The default is to
16892 arrange for 32-bit alignment. ABI details such as structure layout are
16893 not affected by these options.
16894
16895 @item -m32-bit
16896 @itemx -m16-bit
16897 @itemx -m8-bit
16898 @opindex m32-bit
16899 @opindex m16-bit
16900 @opindex m8-bit
16901 Similar to the stack- data- and const-align options above, these options
16902 arrange for stack frame, writable data and constants to all be 32-bit,
16903 16-bit or 8-bit aligned. The default is 32-bit alignment.
16904
16905 @item -mno-prologue-epilogue
16906 @itemx -mprologue-epilogue
16907 @opindex mno-prologue-epilogue
16908 @opindex mprologue-epilogue
16909 With @option{-mno-prologue-epilogue}, the normal function prologue and
16910 epilogue which set up the stack frame are omitted and no return
16911 instructions or return sequences are generated in the code. Use this
16912 option only together with visual inspection of the compiled code: no
16913 warnings or errors are generated when call-saved registers must be saved,
16914 or storage for local variables needs to be allocated.
16915
16916 @item -mno-gotplt
16917 @itemx -mgotplt
16918 @opindex mno-gotplt
16919 @opindex mgotplt
16920 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
16921 instruction sequences that load addresses for functions from the PLT part
16922 of the GOT rather than (traditional on other architectures) calls to the
16923 PLT@. The default is @option{-mgotplt}.
16924
16925 @item -melf
16926 @opindex melf
16927 Legacy no-op option only recognized with the cris-axis-elf and
16928 cris-axis-linux-gnu targets.
16929
16930 @item -mlinux
16931 @opindex mlinux
16932 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
16933
16934 @item -sim
16935 @opindex sim
16936 This option, recognized for the cris-axis-elf, arranges
16937 to link with input-output functions from a simulator library. Code,
16938 initialized data and zero-initialized data are allocated consecutively.
16939
16940 @item -sim2
16941 @opindex sim2
16942 Like @option{-sim}, but pass linker options to locate initialized data at
16943 0x40000000 and zero-initialized data at 0x80000000.
16944 @end table
16945
16946 @node CR16 Options
16947 @subsection CR16 Options
16948 @cindex CR16 Options
16949
16950 These options are defined specifically for the CR16 ports.
16951
16952 @table @gcctabopt
16953
16954 @item -mmac
16955 @opindex mmac
16956 Enable the use of multiply-accumulate instructions. Disabled by default.
16957
16958 @item -mcr16cplus
16959 @itemx -mcr16c
16960 @opindex mcr16cplus
16961 @opindex mcr16c
16962 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
16963 is default.
16964
16965 @item -msim
16966 @opindex msim
16967 Links the library libsim.a which is in compatible with simulator. Applicable
16968 to ELF compiler only.
16969
16970 @item -mint32
16971 @opindex mint32
16972 Choose integer type as 32-bit wide.
16973
16974 @item -mbit-ops
16975 @opindex mbit-ops
16976 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
16977
16978 @item -mdata-model=@var{model}
16979 @opindex mdata-model
16980 Choose a data model. The choices for @var{model} are @samp{near},
16981 @samp{far} or @samp{medium}. @samp{medium} is default.
16982 However, @samp{far} is not valid with @option{-mcr16c}, as the
16983 CR16C architecture does not support the far data model.
16984 @end table
16985
16986 @node Darwin Options
16987 @subsection Darwin Options
16988 @cindex Darwin options
16989
16990 These options are defined for all architectures running the Darwin operating
16991 system.
16992
16993 FSF GCC on Darwin does not create ``fat'' object files; it creates
16994 an object file for the single architecture that GCC was built to
16995 target. Apple's GCC on Darwin does create ``fat'' files if multiple
16996 @option{-arch} options are used; it does so by running the compiler or
16997 linker multiple times and joining the results together with
16998 @file{lipo}.
16999
17000 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
17001 @samp{i686}) is determined by the flags that specify the ISA
17002 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
17003 @option{-force_cpusubtype_ALL} option can be used to override this.
17004
17005 The Darwin tools vary in their behavior when presented with an ISA
17006 mismatch. The assembler, @file{as}, only permits instructions to
17007 be used that are valid for the subtype of the file it is generating,
17008 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
17009 The linker for shared libraries, @file{/usr/bin/libtool}, fails
17010 and prints an error if asked to create a shared library with a less
17011 restrictive subtype than its input files (for instance, trying to put
17012 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
17013 for executables, @command{ld}, quietly gives the executable the most
17014 restrictive subtype of any of its input files.
17015
17016 @table @gcctabopt
17017 @item -F@var{dir}
17018 @opindex F
17019 Add the framework directory @var{dir} to the head of the list of
17020 directories to be searched for header files. These directories are
17021 interleaved with those specified by @option{-I} options and are
17022 scanned in a left-to-right order.
17023
17024 A framework directory is a directory with frameworks in it. A
17025 framework is a directory with a @file{Headers} and/or
17026 @file{PrivateHeaders} directory contained directly in it that ends
17027 in @file{.framework}. The name of a framework is the name of this
17028 directory excluding the @file{.framework}. Headers associated with
17029 the framework are found in one of those two directories, with
17030 @file{Headers} being searched first. A subframework is a framework
17031 directory that is in a framework's @file{Frameworks} directory.
17032 Includes of subframework headers can only appear in a header of a
17033 framework that contains the subframework, or in a sibling subframework
17034 header. Two subframeworks are siblings if they occur in the same
17035 framework. A subframework should not have the same name as a
17036 framework; a warning is issued if this is violated. Currently a
17037 subframework cannot have subframeworks; in the future, the mechanism
17038 may be extended to support this. The standard frameworks can be found
17039 in @file{/System/Library/Frameworks} and
17040 @file{/Library/Frameworks}. An example include looks like
17041 @code{#include <Framework/header.h>}, where @file{Framework} denotes
17042 the name of the framework and @file{header.h} is found in the
17043 @file{PrivateHeaders} or @file{Headers} directory.
17044
17045 @item -iframework@var{dir}
17046 @opindex iframework
17047 Like @option{-F} except the directory is a treated as a system
17048 directory. The main difference between this @option{-iframework} and
17049 @option{-F} is that with @option{-iframework} the compiler does not
17050 warn about constructs contained within header files found via
17051 @var{dir}. This option is valid only for the C family of languages.
17052
17053 @item -gused
17054 @opindex gused
17055 Emit debugging information for symbols that are used. For stabs
17056 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
17057 This is by default ON@.
17058
17059 @item -gfull
17060 @opindex gfull
17061 Emit debugging information for all symbols and types.
17062
17063 @item -mmacosx-version-min=@var{version}
17064 The earliest version of MacOS X that this executable will run on
17065 is @var{version}. Typical values of @var{version} include @code{10.1},
17066 @code{10.2}, and @code{10.3.9}.
17067
17068 If the compiler was built to use the system's headers by default,
17069 then the default for this option is the system version on which the
17070 compiler is running, otherwise the default is to make choices that
17071 are compatible with as many systems and code bases as possible.
17072
17073 @item -mkernel
17074 @opindex mkernel
17075 Enable kernel development mode. The @option{-mkernel} option sets
17076 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
17077 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
17078 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
17079 applicable. This mode also sets @option{-mno-altivec},
17080 @option{-msoft-float}, @option{-fno-builtin} and
17081 @option{-mlong-branch} for PowerPC targets.
17082
17083 @item -mone-byte-bool
17084 @opindex mone-byte-bool
17085 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
17086 By default @code{sizeof(bool)} is @code{4} when compiling for
17087 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
17088 option has no effect on x86.
17089
17090 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
17091 to generate code that is not binary compatible with code generated
17092 without that switch. Using this switch may require recompiling all
17093 other modules in a program, including system libraries. Use this
17094 switch to conform to a non-default data model.
17095
17096 @item -mfix-and-continue
17097 @itemx -ffix-and-continue
17098 @itemx -findirect-data
17099 @opindex mfix-and-continue
17100 @opindex ffix-and-continue
17101 @opindex findirect-data
17102 Generate code suitable for fast turnaround development, such as to
17103 allow GDB to dynamically load @file{.o} files into already-running
17104 programs. @option{-findirect-data} and @option{-ffix-and-continue}
17105 are provided for backwards compatibility.
17106
17107 @item -all_load
17108 @opindex all_load
17109 Loads all members of static archive libraries.
17110 See man ld(1) for more information.
17111
17112 @item -arch_errors_fatal
17113 @opindex arch_errors_fatal
17114 Cause the errors having to do with files that have the wrong architecture
17115 to be fatal.
17116
17117 @item -bind_at_load
17118 @opindex bind_at_load
17119 Causes the output file to be marked such that the dynamic linker will
17120 bind all undefined references when the file is loaded or launched.
17121
17122 @item -bundle
17123 @opindex bundle
17124 Produce a Mach-o bundle format file.
17125 See man ld(1) for more information.
17126
17127 @item -bundle_loader @var{executable}
17128 @opindex bundle_loader
17129 This option specifies the @var{executable} that will load the build
17130 output file being linked. See man ld(1) for more information.
17131
17132 @item -dynamiclib
17133 @opindex dynamiclib
17134 When passed this option, GCC produces a dynamic library instead of
17135 an executable when linking, using the Darwin @file{libtool} command.
17136
17137 @item -force_cpusubtype_ALL
17138 @opindex force_cpusubtype_ALL
17139 This causes GCC's output file to have the @samp{ALL} subtype, instead of
17140 one controlled by the @option{-mcpu} or @option{-march} option.
17141
17142 @item -allowable_client @var{client_name}
17143 @itemx -client_name
17144 @itemx -compatibility_version
17145 @itemx -current_version
17146 @itemx -dead_strip
17147 @itemx -dependency-file
17148 @itemx -dylib_file
17149 @itemx -dylinker_install_name
17150 @itemx -dynamic
17151 @itemx -exported_symbols_list
17152 @itemx -filelist
17153 @need 800
17154 @itemx -flat_namespace
17155 @itemx -force_flat_namespace
17156 @itemx -headerpad_max_install_names
17157 @itemx -image_base
17158 @itemx -init
17159 @itemx -install_name
17160 @itemx -keep_private_externs
17161 @itemx -multi_module
17162 @itemx -multiply_defined
17163 @itemx -multiply_defined_unused
17164 @need 800
17165 @itemx -noall_load
17166 @itemx -no_dead_strip_inits_and_terms
17167 @itemx -nofixprebinding
17168 @itemx -nomultidefs
17169 @itemx -noprebind
17170 @itemx -noseglinkedit
17171 @itemx -pagezero_size
17172 @itemx -prebind
17173 @itemx -prebind_all_twolevel_modules
17174 @itemx -private_bundle
17175 @need 800
17176 @itemx -read_only_relocs
17177 @itemx -sectalign
17178 @itemx -sectobjectsymbols
17179 @itemx -whyload
17180 @itemx -seg1addr
17181 @itemx -sectcreate
17182 @itemx -sectobjectsymbols
17183 @itemx -sectorder
17184 @itemx -segaddr
17185 @itemx -segs_read_only_addr
17186 @need 800
17187 @itemx -segs_read_write_addr
17188 @itemx -seg_addr_table
17189 @itemx -seg_addr_table_filename
17190 @itemx -seglinkedit
17191 @itemx -segprot
17192 @itemx -segs_read_only_addr
17193 @itemx -segs_read_write_addr
17194 @itemx -single_module
17195 @itemx -static
17196 @itemx -sub_library
17197 @need 800
17198 @itemx -sub_umbrella
17199 @itemx -twolevel_namespace
17200 @itemx -umbrella
17201 @itemx -undefined
17202 @itemx -unexported_symbols_list
17203 @itemx -weak_reference_mismatches
17204 @itemx -whatsloaded
17205 @opindex allowable_client
17206 @opindex client_name
17207 @opindex compatibility_version
17208 @opindex current_version
17209 @opindex dead_strip
17210 @opindex dependency-file
17211 @opindex dylib_file
17212 @opindex dylinker_install_name
17213 @opindex dynamic
17214 @opindex exported_symbols_list
17215 @opindex filelist
17216 @opindex flat_namespace
17217 @opindex force_flat_namespace
17218 @opindex headerpad_max_install_names
17219 @opindex image_base
17220 @opindex init
17221 @opindex install_name
17222 @opindex keep_private_externs
17223 @opindex multi_module
17224 @opindex multiply_defined
17225 @opindex multiply_defined_unused
17226 @opindex noall_load
17227 @opindex no_dead_strip_inits_and_terms
17228 @opindex nofixprebinding
17229 @opindex nomultidefs
17230 @opindex noprebind
17231 @opindex noseglinkedit
17232 @opindex pagezero_size
17233 @opindex prebind
17234 @opindex prebind_all_twolevel_modules
17235 @opindex private_bundle
17236 @opindex read_only_relocs
17237 @opindex sectalign
17238 @opindex sectobjectsymbols
17239 @opindex whyload
17240 @opindex seg1addr
17241 @opindex sectcreate
17242 @opindex sectobjectsymbols
17243 @opindex sectorder
17244 @opindex segaddr
17245 @opindex segs_read_only_addr
17246 @opindex segs_read_write_addr
17247 @opindex seg_addr_table
17248 @opindex seg_addr_table_filename
17249 @opindex seglinkedit
17250 @opindex segprot
17251 @opindex segs_read_only_addr
17252 @opindex segs_read_write_addr
17253 @opindex single_module
17254 @opindex static
17255 @opindex sub_library
17256 @opindex sub_umbrella
17257 @opindex twolevel_namespace
17258 @opindex umbrella
17259 @opindex undefined
17260 @opindex unexported_symbols_list
17261 @opindex weak_reference_mismatches
17262 @opindex whatsloaded
17263 These options are passed to the Darwin linker. The Darwin linker man page
17264 describes them in detail.
17265 @end table
17266
17267 @node DEC Alpha Options
17268 @subsection DEC Alpha Options
17269
17270 These @samp{-m} options are defined for the DEC Alpha implementations:
17271
17272 @table @gcctabopt
17273 @item -mno-soft-float
17274 @itemx -msoft-float
17275 @opindex mno-soft-float
17276 @opindex msoft-float
17277 Use (do not use) the hardware floating-point instructions for
17278 floating-point operations. When @option{-msoft-float} is specified,
17279 functions in @file{libgcc.a} are used to perform floating-point
17280 operations. Unless they are replaced by routines that emulate the
17281 floating-point operations, or compiled in such a way as to call such
17282 emulations routines, these routines issue floating-point
17283 operations. If you are compiling for an Alpha without floating-point
17284 operations, you must ensure that the library is built so as not to call
17285 them.
17286
17287 Note that Alpha implementations without floating-point operations are
17288 required to have floating-point registers.
17289
17290 @item -mfp-reg
17291 @itemx -mno-fp-regs
17292 @opindex mfp-reg
17293 @opindex mno-fp-regs
17294 Generate code that uses (does not use) the floating-point register set.
17295 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
17296 register set is not used, floating-point operands are passed in integer
17297 registers as if they were integers and floating-point results are passed
17298 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
17299 so any function with a floating-point argument or return value called by code
17300 compiled with @option{-mno-fp-regs} must also be compiled with that
17301 option.
17302
17303 A typical use of this option is building a kernel that does not use,
17304 and hence need not save and restore, any floating-point registers.
17305
17306 @item -mieee
17307 @opindex mieee
17308 The Alpha architecture implements floating-point hardware optimized for
17309 maximum performance. It is mostly compliant with the IEEE floating-point
17310 standard. However, for full compliance, software assistance is
17311 required. This option generates code fully IEEE-compliant code
17312 @emph{except} that the @var{inexact-flag} is not maintained (see below).
17313 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
17314 defined during compilation. The resulting code is less efficient but is
17315 able to correctly support denormalized numbers and exceptional IEEE
17316 values such as not-a-number and plus/minus infinity. Other Alpha
17317 compilers call this option @option{-ieee_with_no_inexact}.
17318
17319 @item -mieee-with-inexact
17320 @opindex mieee-with-inexact
17321 This is like @option{-mieee} except the generated code also maintains
17322 the IEEE @var{inexact-flag}. Turning on this option causes the
17323 generated code to implement fully-compliant IEEE math. In addition to
17324 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
17325 macro. On some Alpha implementations the resulting code may execute
17326 significantly slower than the code generated by default. Since there is
17327 very little code that depends on the @var{inexact-flag}, you should
17328 normally not specify this option. Other Alpha compilers call this
17329 option @option{-ieee_with_inexact}.
17330
17331 @item -mfp-trap-mode=@var{trap-mode}
17332 @opindex mfp-trap-mode
17333 This option controls what floating-point related traps are enabled.
17334 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
17335 The trap mode can be set to one of four values:
17336
17337 @table @samp
17338 @item n
17339 This is the default (normal) setting. The only traps that are enabled
17340 are the ones that cannot be disabled in software (e.g., division by zero
17341 trap).
17342
17343 @item u
17344 In addition to the traps enabled by @samp{n}, underflow traps are enabled
17345 as well.
17346
17347 @item su
17348 Like @samp{u}, but the instructions are marked to be safe for software
17349 completion (see Alpha architecture manual for details).
17350
17351 @item sui
17352 Like @samp{su}, but inexact traps are enabled as well.
17353 @end table
17354
17355 @item -mfp-rounding-mode=@var{rounding-mode}
17356 @opindex mfp-rounding-mode
17357 Selects the IEEE rounding mode. Other Alpha compilers call this option
17358 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
17359 of:
17360
17361 @table @samp
17362 @item n
17363 Normal IEEE rounding mode. Floating-point numbers are rounded towards
17364 the nearest machine number or towards the even machine number in case
17365 of a tie.
17366
17367 @item m
17368 Round towards minus infinity.
17369
17370 @item c
17371 Chopped rounding mode. Floating-point numbers are rounded towards zero.
17372
17373 @item d
17374 Dynamic rounding mode. A field in the floating-point control register
17375 (@var{fpcr}, see Alpha architecture reference manual) controls the
17376 rounding mode in effect. The C library initializes this register for
17377 rounding towards plus infinity. Thus, unless your program modifies the
17378 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
17379 @end table
17380
17381 @item -mtrap-precision=@var{trap-precision}
17382 @opindex mtrap-precision
17383 In the Alpha architecture, floating-point traps are imprecise. This
17384 means without software assistance it is impossible to recover from a
17385 floating trap and program execution normally needs to be terminated.
17386 GCC can generate code that can assist operating system trap handlers
17387 in determining the exact location that caused a floating-point trap.
17388 Depending on the requirements of an application, different levels of
17389 precisions can be selected:
17390
17391 @table @samp
17392 @item p
17393 Program precision. This option is the default and means a trap handler
17394 can only identify which program caused a floating-point exception.
17395
17396 @item f
17397 Function precision. The trap handler can determine the function that
17398 caused a floating-point exception.
17399
17400 @item i
17401 Instruction precision. The trap handler can determine the exact
17402 instruction that caused a floating-point exception.
17403 @end table
17404
17405 Other Alpha compilers provide the equivalent options called
17406 @option{-scope_safe} and @option{-resumption_safe}.
17407
17408 @item -mieee-conformant
17409 @opindex mieee-conformant
17410 This option marks the generated code as IEEE conformant. You must not
17411 use this option unless you also specify @option{-mtrap-precision=i} and either
17412 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
17413 is to emit the line @samp{.eflag 48} in the function prologue of the
17414 generated assembly file.
17415
17416 @item -mbuild-constants
17417 @opindex mbuild-constants
17418 Normally GCC examines a 32- or 64-bit integer constant to
17419 see if it can construct it from smaller constants in two or three
17420 instructions. If it cannot, it outputs the constant as a literal and
17421 generates code to load it from the data segment at run time.
17422
17423 Use this option to require GCC to construct @emph{all} integer constants
17424 using code, even if it takes more instructions (the maximum is six).
17425
17426 You typically use this option to build a shared library dynamic
17427 loader. Itself a shared library, it must relocate itself in memory
17428 before it can find the variables and constants in its own data segment.
17429
17430 @item -mbwx
17431 @itemx -mno-bwx
17432 @itemx -mcix
17433 @itemx -mno-cix
17434 @itemx -mfix
17435 @itemx -mno-fix
17436 @itemx -mmax
17437 @itemx -mno-max
17438 @opindex mbwx
17439 @opindex mno-bwx
17440 @opindex mcix
17441 @opindex mno-cix
17442 @opindex mfix
17443 @opindex mno-fix
17444 @opindex mmax
17445 @opindex mno-max
17446 Indicate whether GCC should generate code to use the optional BWX,
17447 CIX, FIX and MAX instruction sets. The default is to use the instruction
17448 sets supported by the CPU type specified via @option{-mcpu=} option or that
17449 of the CPU on which GCC was built if none is specified.
17450
17451 @item -mfloat-vax
17452 @itemx -mfloat-ieee
17453 @opindex mfloat-vax
17454 @opindex mfloat-ieee
17455 Generate code that uses (does not use) VAX F and G floating-point
17456 arithmetic instead of IEEE single and double precision.
17457
17458 @item -mexplicit-relocs
17459 @itemx -mno-explicit-relocs
17460 @opindex mexplicit-relocs
17461 @opindex mno-explicit-relocs
17462 Older Alpha assemblers provided no way to generate symbol relocations
17463 except via assembler macros. Use of these macros does not allow
17464 optimal instruction scheduling. GNU binutils as of version 2.12
17465 supports a new syntax that allows the compiler to explicitly mark
17466 which relocations should apply to which instructions. This option
17467 is mostly useful for debugging, as GCC detects the capabilities of
17468 the assembler when it is built and sets the default accordingly.
17469
17470 @item -msmall-data
17471 @itemx -mlarge-data
17472 @opindex msmall-data
17473 @opindex mlarge-data
17474 When @option{-mexplicit-relocs} is in effect, static data is
17475 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
17476 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
17477 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
17478 16-bit relocations off of the @code{$gp} register. This limits the
17479 size of the small data area to 64KB, but allows the variables to be
17480 directly accessed via a single instruction.
17481
17482 The default is @option{-mlarge-data}. With this option the data area
17483 is limited to just below 2GB@. Programs that require more than 2GB of
17484 data must use @code{malloc} or @code{mmap} to allocate the data in the
17485 heap instead of in the program's data segment.
17486
17487 When generating code for shared libraries, @option{-fpic} implies
17488 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
17489
17490 @item -msmall-text
17491 @itemx -mlarge-text
17492 @opindex msmall-text
17493 @opindex mlarge-text
17494 When @option{-msmall-text} is used, the compiler assumes that the
17495 code of the entire program (or shared library) fits in 4MB, and is
17496 thus reachable with a branch instruction. When @option{-msmall-data}
17497 is used, the compiler can assume that all local symbols share the
17498 same @code{$gp} value, and thus reduce the number of instructions
17499 required for a function call from 4 to 1.
17500
17501 The default is @option{-mlarge-text}.
17502
17503 @item -mcpu=@var{cpu_type}
17504 @opindex mcpu
17505 Set the instruction set and instruction scheduling parameters for
17506 machine type @var{cpu_type}. You can specify either the @samp{EV}
17507 style name or the corresponding chip number. GCC supports scheduling
17508 parameters for the EV4, EV5 and EV6 family of processors and
17509 chooses the default values for the instruction set from the processor
17510 you specify. If you do not specify a processor type, GCC defaults
17511 to the processor on which the compiler was built.
17512
17513 Supported values for @var{cpu_type} are
17514
17515 @table @samp
17516 @item ev4
17517 @itemx ev45
17518 @itemx 21064
17519 Schedules as an EV4 and has no instruction set extensions.
17520
17521 @item ev5
17522 @itemx 21164
17523 Schedules as an EV5 and has no instruction set extensions.
17524
17525 @item ev56
17526 @itemx 21164a
17527 Schedules as an EV5 and supports the BWX extension.
17528
17529 @item pca56
17530 @itemx 21164pc
17531 @itemx 21164PC
17532 Schedules as an EV5 and supports the BWX and MAX extensions.
17533
17534 @item ev6
17535 @itemx 21264
17536 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
17537
17538 @item ev67
17539 @itemx 21264a
17540 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
17541 @end table
17542
17543 Native toolchains also support the value @samp{native},
17544 which selects the best architecture option for the host processor.
17545 @option{-mcpu=native} has no effect if GCC does not recognize
17546 the processor.
17547
17548 @item -mtune=@var{cpu_type}
17549 @opindex mtune
17550 Set only the instruction scheduling parameters for machine type
17551 @var{cpu_type}. The instruction set is not changed.
17552
17553 Native toolchains also support the value @samp{native},
17554 which selects the best architecture option for the host processor.
17555 @option{-mtune=native} has no effect if GCC does not recognize
17556 the processor.
17557
17558 @item -mmemory-latency=@var{time}
17559 @opindex mmemory-latency
17560 Sets the latency the scheduler should assume for typical memory
17561 references as seen by the application. This number is highly
17562 dependent on the memory access patterns used by the application
17563 and the size of the external cache on the machine.
17564
17565 Valid options for @var{time} are
17566
17567 @table @samp
17568 @item @var{number}
17569 A decimal number representing clock cycles.
17570
17571 @item L1
17572 @itemx L2
17573 @itemx L3
17574 @itemx main
17575 The compiler contains estimates of the number of clock cycles for
17576 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
17577 (also called Dcache, Scache, and Bcache), as well as to main memory.
17578 Note that L3 is only valid for EV5.
17579
17580 @end table
17581 @end table
17582
17583 @node FR30 Options
17584 @subsection FR30 Options
17585 @cindex FR30 Options
17586
17587 These options are defined specifically for the FR30 port.
17588
17589 @table @gcctabopt
17590
17591 @item -msmall-model
17592 @opindex msmall-model
17593 Use the small address space model. This can produce smaller code, but
17594 it does assume that all symbolic values and addresses fit into a
17595 20-bit range.
17596
17597 @item -mno-lsim
17598 @opindex mno-lsim
17599 Assume that runtime support has been provided and so there is no need
17600 to include the simulator library (@file{libsim.a}) on the linker
17601 command line.
17602
17603 @end table
17604
17605 @node FT32 Options
17606 @subsection FT32 Options
17607 @cindex FT32 Options
17608
17609 These options are defined specifically for the FT32 port.
17610
17611 @table @gcctabopt
17612
17613 @item -msim
17614 @opindex msim
17615 Specifies that the program will be run on the simulator. This causes
17616 an alternate runtime startup and library to be linked.
17617 You must not use this option when generating programs that will run on
17618 real hardware; you must provide your own runtime library for whatever
17619 I/O functions are needed.
17620
17621 @item -mlra
17622 @opindex mlra
17623 Enable Local Register Allocation. This is still experimental for FT32,
17624 so by default the compiler uses standard reload.
17625
17626 @item -mnodiv
17627 @opindex mnodiv
17628 Do not use div and mod instructions.
17629
17630 @end table
17631
17632 @node FRV Options
17633 @subsection FRV Options
17634 @cindex FRV Options
17635
17636 @table @gcctabopt
17637 @item -mgpr-32
17638 @opindex mgpr-32
17639
17640 Only use the first 32 general-purpose registers.
17641
17642 @item -mgpr-64
17643 @opindex mgpr-64
17644
17645 Use all 64 general-purpose registers.
17646
17647 @item -mfpr-32
17648 @opindex mfpr-32
17649
17650 Use only the first 32 floating-point registers.
17651
17652 @item -mfpr-64
17653 @opindex mfpr-64
17654
17655 Use all 64 floating-point registers.
17656
17657 @item -mhard-float
17658 @opindex mhard-float
17659
17660 Use hardware instructions for floating-point operations.
17661
17662 @item -msoft-float
17663 @opindex msoft-float
17664
17665 Use library routines for floating-point operations.
17666
17667 @item -malloc-cc
17668 @opindex malloc-cc
17669
17670 Dynamically allocate condition code registers.
17671
17672 @item -mfixed-cc
17673 @opindex mfixed-cc
17674
17675 Do not try to dynamically allocate condition code registers, only
17676 use @code{icc0} and @code{fcc0}.
17677
17678 @item -mdword
17679 @opindex mdword
17680
17681 Change ABI to use double word insns.
17682
17683 @item -mno-dword
17684 @opindex mno-dword
17685
17686 Do not use double word instructions.
17687
17688 @item -mdouble
17689 @opindex mdouble
17690
17691 Use floating-point double instructions.
17692
17693 @item -mno-double
17694 @opindex mno-double
17695
17696 Do not use floating-point double instructions.
17697
17698 @item -mmedia
17699 @opindex mmedia
17700
17701 Use media instructions.
17702
17703 @item -mno-media
17704 @opindex mno-media
17705
17706 Do not use media instructions.
17707
17708 @item -mmuladd
17709 @opindex mmuladd
17710
17711 Use multiply and add/subtract instructions.
17712
17713 @item -mno-muladd
17714 @opindex mno-muladd
17715
17716 Do not use multiply and add/subtract instructions.
17717
17718 @item -mfdpic
17719 @opindex mfdpic
17720
17721 Select the FDPIC ABI, which uses function descriptors to represent
17722 pointers to functions. Without any PIC/PIE-related options, it
17723 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
17724 assumes GOT entries and small data are within a 12-bit range from the
17725 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
17726 are computed with 32 bits.
17727 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17728
17729 @item -minline-plt
17730 @opindex minline-plt
17731
17732 Enable inlining of PLT entries in function calls to functions that are
17733 not known to bind locally. It has no effect without @option{-mfdpic}.
17734 It's enabled by default if optimizing for speed and compiling for
17735 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
17736 optimization option such as @option{-O3} or above is present in the
17737 command line.
17738
17739 @item -mTLS
17740 @opindex mTLS
17741
17742 Assume a large TLS segment when generating thread-local code.
17743
17744 @item -mtls
17745 @opindex mtls
17746
17747 Do not assume a large TLS segment when generating thread-local code.
17748
17749 @item -mgprel-ro
17750 @opindex mgprel-ro
17751
17752 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
17753 that is known to be in read-only sections. It's enabled by default,
17754 except for @option{-fpic} or @option{-fpie}: even though it may help
17755 make the global offset table smaller, it trades 1 instruction for 4.
17756 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
17757 one of which may be shared by multiple symbols, and it avoids the need
17758 for a GOT entry for the referenced symbol, so it's more likely to be a
17759 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
17760
17761 @item -multilib-library-pic
17762 @opindex multilib-library-pic
17763
17764 Link with the (library, not FD) pic libraries. It's implied by
17765 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
17766 @option{-fpic} without @option{-mfdpic}. You should never have to use
17767 it explicitly.
17768
17769 @item -mlinked-fp
17770 @opindex mlinked-fp
17771
17772 Follow the EABI requirement of always creating a frame pointer whenever
17773 a stack frame is allocated. This option is enabled by default and can
17774 be disabled with @option{-mno-linked-fp}.
17775
17776 @item -mlong-calls
17777 @opindex mlong-calls
17778
17779 Use indirect addressing to call functions outside the current
17780 compilation unit. This allows the functions to be placed anywhere
17781 within the 32-bit address space.
17782
17783 @item -malign-labels
17784 @opindex malign-labels
17785
17786 Try to align labels to an 8-byte boundary by inserting NOPs into the
17787 previous packet. This option only has an effect when VLIW packing
17788 is enabled. It doesn't create new packets; it merely adds NOPs to
17789 existing ones.
17790
17791 @item -mlibrary-pic
17792 @opindex mlibrary-pic
17793
17794 Generate position-independent EABI code.
17795
17796 @item -macc-4
17797 @opindex macc-4
17798
17799 Use only the first four media accumulator registers.
17800
17801 @item -macc-8
17802 @opindex macc-8
17803
17804 Use all eight media accumulator registers.
17805
17806 @item -mpack
17807 @opindex mpack
17808
17809 Pack VLIW instructions.
17810
17811 @item -mno-pack
17812 @opindex mno-pack
17813
17814 Do not pack VLIW instructions.
17815
17816 @item -mno-eflags
17817 @opindex mno-eflags
17818
17819 Do not mark ABI switches in e_flags.
17820
17821 @item -mcond-move
17822 @opindex mcond-move
17823
17824 Enable the use of conditional-move instructions (default).
17825
17826 This switch is mainly for debugging the compiler and will likely be removed
17827 in a future version.
17828
17829 @item -mno-cond-move
17830 @opindex mno-cond-move
17831
17832 Disable the use of conditional-move instructions.
17833
17834 This switch is mainly for debugging the compiler and will likely be removed
17835 in a future version.
17836
17837 @item -mscc
17838 @opindex mscc
17839
17840 Enable the use of conditional set instructions (default).
17841
17842 This switch is mainly for debugging the compiler and will likely be removed
17843 in a future version.
17844
17845 @item -mno-scc
17846 @opindex mno-scc
17847
17848 Disable the use of conditional set instructions.
17849
17850 This switch is mainly for debugging the compiler and will likely be removed
17851 in a future version.
17852
17853 @item -mcond-exec
17854 @opindex mcond-exec
17855
17856 Enable the use of conditional execution (default).
17857
17858 This switch is mainly for debugging the compiler and will likely be removed
17859 in a future version.
17860
17861 @item -mno-cond-exec
17862 @opindex mno-cond-exec
17863
17864 Disable the use of conditional execution.
17865
17866 This switch is mainly for debugging the compiler and will likely be removed
17867 in a future version.
17868
17869 @item -mvliw-branch
17870 @opindex mvliw-branch
17871
17872 Run a pass to pack branches into VLIW instructions (default).
17873
17874 This switch is mainly for debugging the compiler and will likely be removed
17875 in a future version.
17876
17877 @item -mno-vliw-branch
17878 @opindex mno-vliw-branch
17879
17880 Do not run a pass to pack branches into VLIW instructions.
17881
17882 This switch is mainly for debugging the compiler and will likely be removed
17883 in a future version.
17884
17885 @item -mmulti-cond-exec
17886 @opindex mmulti-cond-exec
17887
17888 Enable optimization of @code{&&} and @code{||} in conditional execution
17889 (default).
17890
17891 This switch is mainly for debugging the compiler and will likely be removed
17892 in a future version.
17893
17894 @item -mno-multi-cond-exec
17895 @opindex mno-multi-cond-exec
17896
17897 Disable optimization of @code{&&} and @code{||} in conditional execution.
17898
17899 This switch is mainly for debugging the compiler and will likely be removed
17900 in a future version.
17901
17902 @item -mnested-cond-exec
17903 @opindex mnested-cond-exec
17904
17905 Enable nested conditional execution optimizations (default).
17906
17907 This switch is mainly for debugging the compiler and will likely be removed
17908 in a future version.
17909
17910 @item -mno-nested-cond-exec
17911 @opindex mno-nested-cond-exec
17912
17913 Disable nested conditional execution optimizations.
17914
17915 This switch is mainly for debugging the compiler and will likely be removed
17916 in a future version.
17917
17918 @item -moptimize-membar
17919 @opindex moptimize-membar
17920
17921 This switch removes redundant @code{membar} instructions from the
17922 compiler-generated code. It is enabled by default.
17923
17924 @item -mno-optimize-membar
17925 @opindex mno-optimize-membar
17926
17927 This switch disables the automatic removal of redundant @code{membar}
17928 instructions from the generated code.
17929
17930 @item -mtomcat-stats
17931 @opindex mtomcat-stats
17932
17933 Cause gas to print out tomcat statistics.
17934
17935 @item -mcpu=@var{cpu}
17936 @opindex mcpu
17937
17938 Select the processor type for which to generate code. Possible values are
17939 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
17940 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
17941
17942 @end table
17943
17944 @node GNU/Linux Options
17945 @subsection GNU/Linux Options
17946
17947 These @samp{-m} options are defined for GNU/Linux targets:
17948
17949 @table @gcctabopt
17950 @item -mglibc
17951 @opindex mglibc
17952 Use the GNU C library. This is the default except
17953 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
17954 @samp{*-*-linux-*android*} targets.
17955
17956 @item -muclibc
17957 @opindex muclibc
17958 Use uClibc C library. This is the default on
17959 @samp{*-*-linux-*uclibc*} targets.
17960
17961 @item -mmusl
17962 @opindex mmusl
17963 Use the musl C library. This is the default on
17964 @samp{*-*-linux-*musl*} targets.
17965
17966 @item -mbionic
17967 @opindex mbionic
17968 Use Bionic C library. This is the default on
17969 @samp{*-*-linux-*android*} targets.
17970
17971 @item -mandroid
17972 @opindex mandroid
17973 Compile code compatible with Android platform. This is the default on
17974 @samp{*-*-linux-*android*} targets.
17975
17976 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
17977 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
17978 this option makes the GCC driver pass Android-specific options to the linker.
17979 Finally, this option causes the preprocessor macro @code{__ANDROID__}
17980 to be defined.
17981
17982 @item -tno-android-cc
17983 @opindex tno-android-cc
17984 Disable compilation effects of @option{-mandroid}, i.e., do not enable
17985 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
17986 @option{-fno-rtti} by default.
17987
17988 @item -tno-android-ld
17989 @opindex tno-android-ld
17990 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
17991 linking options to the linker.
17992
17993 @end table
17994
17995 @node H8/300 Options
17996 @subsection H8/300 Options
17997
17998 These @samp{-m} options are defined for the H8/300 implementations:
17999
18000 @table @gcctabopt
18001 @item -mrelax
18002 @opindex mrelax
18003 Shorten some address references at link time, when possible; uses the
18004 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
18005 ld, Using ld}, for a fuller description.
18006
18007 @item -mh
18008 @opindex mh
18009 Generate code for the H8/300H@.
18010
18011 @item -ms
18012 @opindex ms
18013 Generate code for the H8S@.
18014
18015 @item -mn
18016 @opindex mn
18017 Generate code for the H8S and H8/300H in the normal mode. This switch
18018 must be used either with @option{-mh} or @option{-ms}.
18019
18020 @item -ms2600
18021 @opindex ms2600
18022 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
18023
18024 @item -mexr
18025 @opindex mexr
18026 Extended registers are stored on stack before execution of function
18027 with monitor attribute. Default option is @option{-mexr}.
18028 This option is valid only for H8S targets.
18029
18030 @item -mno-exr
18031 @opindex mno-exr
18032 Extended registers are not stored on stack before execution of function
18033 with monitor attribute. Default option is @option{-mno-exr}.
18034 This option is valid only for H8S targets.
18035
18036 @item -mint32
18037 @opindex mint32
18038 Make @code{int} data 32 bits by default.
18039
18040 @item -malign-300
18041 @opindex malign-300
18042 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
18043 The default for the H8/300H and H8S is to align longs and floats on
18044 4-byte boundaries.
18045 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
18046 This option has no effect on the H8/300.
18047 @end table
18048
18049 @node HPPA Options
18050 @subsection HPPA Options
18051 @cindex HPPA Options
18052
18053 These @samp{-m} options are defined for the HPPA family of computers:
18054
18055 @table @gcctabopt
18056 @item -march=@var{architecture-type}
18057 @opindex march
18058 Generate code for the specified architecture. The choices for
18059 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
18060 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
18061 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
18062 architecture option for your machine. Code compiled for lower numbered
18063 architectures runs on higher numbered architectures, but not the
18064 other way around.
18065
18066 @item -mpa-risc-1-0
18067 @itemx -mpa-risc-1-1
18068 @itemx -mpa-risc-2-0
18069 @opindex mpa-risc-1-0
18070 @opindex mpa-risc-1-1
18071 @opindex mpa-risc-2-0
18072 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
18073
18074 @item -mcaller-copies
18075 @opindex mcaller-copies
18076 The caller copies function arguments passed by hidden reference. This
18077 option should be used with care as it is not compatible with the default
18078 32-bit runtime. However, only aggregates larger than eight bytes are
18079 passed by hidden reference and the option provides better compatibility
18080 with OpenMP.
18081
18082 @item -mjump-in-delay
18083 @opindex mjump-in-delay
18084 This option is ignored and provided for compatibility purposes only.
18085
18086 @item -mdisable-fpregs
18087 @opindex mdisable-fpregs
18088 Prevent floating-point registers from being used in any manner. This is
18089 necessary for compiling kernels that perform lazy context switching of
18090 floating-point registers. If you use this option and attempt to perform
18091 floating-point operations, the compiler aborts.
18092
18093 @item -mdisable-indexing
18094 @opindex mdisable-indexing
18095 Prevent the compiler from using indexing address modes. This avoids some
18096 rather obscure problems when compiling MIG generated code under MACH@.
18097
18098 @item -mno-space-regs
18099 @opindex mno-space-regs
18100 Generate code that assumes the target has no space registers. This allows
18101 GCC to generate faster indirect calls and use unscaled index address modes.
18102
18103 Such code is suitable for level 0 PA systems and kernels.
18104
18105 @item -mfast-indirect-calls
18106 @opindex mfast-indirect-calls
18107 Generate code that assumes calls never cross space boundaries. This
18108 allows GCC to emit code that performs faster indirect calls.
18109
18110 This option does not work in the presence of shared libraries or nested
18111 functions.
18112
18113 @item -mfixed-range=@var{register-range}
18114 @opindex mfixed-range
18115 Generate code treating the given register range as fixed registers.
18116 A fixed register is one that the register allocator cannot use. This is
18117 useful when compiling kernel code. A register range is specified as
18118 two registers separated by a dash. Multiple register ranges can be
18119 specified separated by a comma.
18120
18121 @item -mlong-load-store
18122 @opindex mlong-load-store
18123 Generate 3-instruction load and store sequences as sometimes required by
18124 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
18125 the HP compilers.
18126
18127 @item -mportable-runtime
18128 @opindex mportable-runtime
18129 Use the portable calling conventions proposed by HP for ELF systems.
18130
18131 @item -mgas
18132 @opindex mgas
18133 Enable the use of assembler directives only GAS understands.
18134
18135 @item -mschedule=@var{cpu-type}
18136 @opindex mschedule
18137 Schedule code according to the constraints for the machine type
18138 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
18139 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
18140 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
18141 proper scheduling option for your machine. The default scheduling is
18142 @samp{8000}.
18143
18144 @item -mlinker-opt
18145 @opindex mlinker-opt
18146 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
18147 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
18148 linkers in which they give bogus error messages when linking some programs.
18149
18150 @item -msoft-float
18151 @opindex msoft-float
18152 Generate output containing library calls for floating point.
18153 @strong{Warning:} the requisite libraries are not available for all HPPA
18154 targets. Normally the facilities of the machine's usual C compiler are
18155 used, but this cannot be done directly in cross-compilation. You must make
18156 your own arrangements to provide suitable library functions for
18157 cross-compilation.
18158
18159 @option{-msoft-float} changes the calling convention in the output file;
18160 therefore, it is only useful if you compile @emph{all} of a program with
18161 this option. In particular, you need to compile @file{libgcc.a}, the
18162 library that comes with GCC, with @option{-msoft-float} in order for
18163 this to work.
18164
18165 @item -msio
18166 @opindex msio
18167 Generate the predefine, @code{_SIO}, for server IO@. The default is
18168 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
18169 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
18170 options are available under HP-UX and HI-UX@.
18171
18172 @item -mgnu-ld
18173 @opindex mgnu-ld
18174 Use options specific to GNU @command{ld}.
18175 This passes @option{-shared} to @command{ld} when
18176 building a shared library. It is the default when GCC is configured,
18177 explicitly or implicitly, with the GNU linker. This option does not
18178 affect which @command{ld} is called; it only changes what parameters
18179 are passed to that @command{ld}.
18180 The @command{ld} that is called is determined by the
18181 @option{--with-ld} configure option, GCC's program search path, and
18182 finally by the user's @env{PATH}. The linker used by GCC can be printed
18183 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
18184 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18185
18186 @item -mhp-ld
18187 @opindex mhp-ld
18188 Use options specific to HP @command{ld}.
18189 This passes @option{-b} to @command{ld} when building
18190 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
18191 links. It is the default when GCC is configured, explicitly or
18192 implicitly, with the HP linker. This option does not affect
18193 which @command{ld} is called; it only changes what parameters are passed to that
18194 @command{ld}.
18195 The @command{ld} that is called is determined by the @option{--with-ld}
18196 configure option, GCC's program search path, and finally by the user's
18197 @env{PATH}. The linker used by GCC can be printed using @samp{which
18198 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
18199 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18200
18201 @item -mlong-calls
18202 @opindex mno-long-calls
18203 Generate code that uses long call sequences. This ensures that a call
18204 is always able to reach linker generated stubs. The default is to generate
18205 long calls only when the distance from the call site to the beginning
18206 of the function or translation unit, as the case may be, exceeds a
18207 predefined limit set by the branch type being used. The limits for
18208 normal calls are 7,600,000 and 240,000 bytes, respectively for the
18209 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
18210 240,000 bytes.
18211
18212 Distances are measured from the beginning of functions when using the
18213 @option{-ffunction-sections} option, or when using the @option{-mgas}
18214 and @option{-mno-portable-runtime} options together under HP-UX with
18215 the SOM linker.
18216
18217 It is normally not desirable to use this option as it degrades
18218 performance. However, it may be useful in large applications,
18219 particularly when partial linking is used to build the application.
18220
18221 The types of long calls used depends on the capabilities of the
18222 assembler and linker, and the type of code being generated. The
18223 impact on systems that support long absolute calls, and long pic
18224 symbol-difference or pc-relative calls should be relatively small.
18225 However, an indirect call is used on 32-bit ELF systems in pic code
18226 and it is quite long.
18227
18228 @item -munix=@var{unix-std}
18229 @opindex march
18230 Generate compiler predefines and select a startfile for the specified
18231 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
18232 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
18233 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
18234 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
18235 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
18236 and later.
18237
18238 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
18239 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
18240 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
18241 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
18242 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
18243 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
18244
18245 It is @emph{important} to note that this option changes the interfaces
18246 for various library routines. It also affects the operational behavior
18247 of the C library. Thus, @emph{extreme} care is needed in using this
18248 option.
18249
18250 Library code that is intended to operate with more than one UNIX
18251 standard must test, set and restore the variable @code{__xpg4_extended_mask}
18252 as appropriate. Most GNU software doesn't provide this capability.
18253
18254 @item -nolibdld
18255 @opindex nolibdld
18256 Suppress the generation of link options to search libdld.sl when the
18257 @option{-static} option is specified on HP-UX 10 and later.
18258
18259 @item -static
18260 @opindex static
18261 The HP-UX implementation of setlocale in libc has a dependency on
18262 libdld.sl. There isn't an archive version of libdld.sl. Thus,
18263 when the @option{-static} option is specified, special link options
18264 are needed to resolve this dependency.
18265
18266 On HP-UX 10 and later, the GCC driver adds the necessary options to
18267 link with libdld.sl when the @option{-static} option is specified.
18268 This causes the resulting binary to be dynamic. On the 64-bit port,
18269 the linkers generate dynamic binaries by default in any case. The
18270 @option{-nolibdld} option can be used to prevent the GCC driver from
18271 adding these link options.
18272
18273 @item -threads
18274 @opindex threads
18275 Add support for multithreading with the @dfn{dce thread} library
18276 under HP-UX@. This option sets flags for both the preprocessor and
18277 linker.
18278 @end table
18279
18280 @node IA-64 Options
18281 @subsection IA-64 Options
18282 @cindex IA-64 Options
18283
18284 These are the @samp{-m} options defined for the Intel IA-64 architecture.
18285
18286 @table @gcctabopt
18287 @item -mbig-endian
18288 @opindex mbig-endian
18289 Generate code for a big-endian target. This is the default for HP-UX@.
18290
18291 @item -mlittle-endian
18292 @opindex mlittle-endian
18293 Generate code for a little-endian target. This is the default for AIX5
18294 and GNU/Linux.
18295
18296 @item -mgnu-as
18297 @itemx -mno-gnu-as
18298 @opindex mgnu-as
18299 @opindex mno-gnu-as
18300 Generate (or don't) code for the GNU assembler. This is the default.
18301 @c Also, this is the default if the configure option @option{--with-gnu-as}
18302 @c is used.
18303
18304 @item -mgnu-ld
18305 @itemx -mno-gnu-ld
18306 @opindex mgnu-ld
18307 @opindex mno-gnu-ld
18308 Generate (or don't) code for the GNU linker. This is the default.
18309 @c Also, this is the default if the configure option @option{--with-gnu-ld}
18310 @c is used.
18311
18312 @item -mno-pic
18313 @opindex mno-pic
18314 Generate code that does not use a global pointer register. The result
18315 is not position independent code, and violates the IA-64 ABI@.
18316
18317 @item -mvolatile-asm-stop
18318 @itemx -mno-volatile-asm-stop
18319 @opindex mvolatile-asm-stop
18320 @opindex mno-volatile-asm-stop
18321 Generate (or don't) a stop bit immediately before and after volatile asm
18322 statements.
18323
18324 @item -mregister-names
18325 @itemx -mno-register-names
18326 @opindex mregister-names
18327 @opindex mno-register-names
18328 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
18329 the stacked registers. This may make assembler output more readable.
18330
18331 @item -mno-sdata
18332 @itemx -msdata
18333 @opindex mno-sdata
18334 @opindex msdata
18335 Disable (or enable) optimizations that use the small data section. This may
18336 be useful for working around optimizer bugs.
18337
18338 @item -mconstant-gp
18339 @opindex mconstant-gp
18340 Generate code that uses a single constant global pointer value. This is
18341 useful when compiling kernel code.
18342
18343 @item -mauto-pic
18344 @opindex mauto-pic
18345 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
18346 This is useful when compiling firmware code.
18347
18348 @item -minline-float-divide-min-latency
18349 @opindex minline-float-divide-min-latency
18350 Generate code for inline divides of floating-point values
18351 using the minimum latency algorithm.
18352
18353 @item -minline-float-divide-max-throughput
18354 @opindex minline-float-divide-max-throughput
18355 Generate code for inline divides of floating-point values
18356 using the maximum throughput algorithm.
18357
18358 @item -mno-inline-float-divide
18359 @opindex mno-inline-float-divide
18360 Do not generate inline code for divides of floating-point values.
18361
18362 @item -minline-int-divide-min-latency
18363 @opindex minline-int-divide-min-latency
18364 Generate code for inline divides of integer values
18365 using the minimum latency algorithm.
18366
18367 @item -minline-int-divide-max-throughput
18368 @opindex minline-int-divide-max-throughput
18369 Generate code for inline divides of integer values
18370 using the maximum throughput algorithm.
18371
18372 @item -mno-inline-int-divide
18373 @opindex mno-inline-int-divide
18374 Do not generate inline code for divides of integer values.
18375
18376 @item -minline-sqrt-min-latency
18377 @opindex minline-sqrt-min-latency
18378 Generate code for inline square roots
18379 using the minimum latency algorithm.
18380
18381 @item -minline-sqrt-max-throughput
18382 @opindex minline-sqrt-max-throughput
18383 Generate code for inline square roots
18384 using the maximum throughput algorithm.
18385
18386 @item -mno-inline-sqrt
18387 @opindex mno-inline-sqrt
18388 Do not generate inline code for @code{sqrt}.
18389
18390 @item -mfused-madd
18391 @itemx -mno-fused-madd
18392 @opindex mfused-madd
18393 @opindex mno-fused-madd
18394 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
18395 instructions. The default is to use these instructions.
18396
18397 @item -mno-dwarf2-asm
18398 @itemx -mdwarf2-asm
18399 @opindex mno-dwarf2-asm
18400 @opindex mdwarf2-asm
18401 Don't (or do) generate assembler code for the DWARF line number debugging
18402 info. This may be useful when not using the GNU assembler.
18403
18404 @item -mearly-stop-bits
18405 @itemx -mno-early-stop-bits
18406 @opindex mearly-stop-bits
18407 @opindex mno-early-stop-bits
18408 Allow stop bits to be placed earlier than immediately preceding the
18409 instruction that triggered the stop bit. This can improve instruction
18410 scheduling, but does not always do so.
18411
18412 @item -mfixed-range=@var{register-range}
18413 @opindex mfixed-range
18414 Generate code treating the given register range as fixed registers.
18415 A fixed register is one that the register allocator cannot use. This is
18416 useful when compiling kernel code. A register range is specified as
18417 two registers separated by a dash. Multiple register ranges can be
18418 specified separated by a comma.
18419
18420 @item -mtls-size=@var{tls-size}
18421 @opindex mtls-size
18422 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
18423 64.
18424
18425 @item -mtune=@var{cpu-type}
18426 @opindex mtune
18427 Tune the instruction scheduling for a particular CPU, Valid values are
18428 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
18429 and @samp{mckinley}.
18430
18431 @item -milp32
18432 @itemx -mlp64
18433 @opindex milp32
18434 @opindex mlp64
18435 Generate code for a 32-bit or 64-bit environment.
18436 The 32-bit environment sets int, long and pointer to 32 bits.
18437 The 64-bit environment sets int to 32 bits and long and pointer
18438 to 64 bits. These are HP-UX specific flags.
18439
18440 @item -mno-sched-br-data-spec
18441 @itemx -msched-br-data-spec
18442 @opindex mno-sched-br-data-spec
18443 @opindex msched-br-data-spec
18444 (Dis/En)able data speculative scheduling before reload.
18445 This results in generation of @code{ld.a} instructions and
18446 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
18447 The default setting is disabled.
18448
18449 @item -msched-ar-data-spec
18450 @itemx -mno-sched-ar-data-spec
18451 @opindex msched-ar-data-spec
18452 @opindex mno-sched-ar-data-spec
18453 (En/Dis)able data speculative scheduling after reload.
18454 This results in generation of @code{ld.a} instructions and
18455 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
18456 The default setting is enabled.
18457
18458 @item -mno-sched-control-spec
18459 @itemx -msched-control-spec
18460 @opindex mno-sched-control-spec
18461 @opindex msched-control-spec
18462 (Dis/En)able control speculative scheduling. This feature is
18463 available only during region scheduling (i.e.@: before reload).
18464 This results in generation of the @code{ld.s} instructions and
18465 the corresponding check instructions @code{chk.s}.
18466 The default setting is disabled.
18467
18468 @item -msched-br-in-data-spec
18469 @itemx -mno-sched-br-in-data-spec
18470 @opindex msched-br-in-data-spec
18471 @opindex mno-sched-br-in-data-spec
18472 (En/Dis)able speculative scheduling of the instructions that
18473 are dependent on the data speculative loads before reload.
18474 This is effective only with @option{-msched-br-data-spec} enabled.
18475 The default setting is enabled.
18476
18477 @item -msched-ar-in-data-spec
18478 @itemx -mno-sched-ar-in-data-spec
18479 @opindex msched-ar-in-data-spec
18480 @opindex mno-sched-ar-in-data-spec
18481 (En/Dis)able speculative scheduling of the instructions that
18482 are dependent on the data speculative loads after reload.
18483 This is effective only with @option{-msched-ar-data-spec} enabled.
18484 The default setting is enabled.
18485
18486 @item -msched-in-control-spec
18487 @itemx -mno-sched-in-control-spec
18488 @opindex msched-in-control-spec
18489 @opindex mno-sched-in-control-spec
18490 (En/Dis)able speculative scheduling of the instructions that
18491 are dependent on the control speculative loads.
18492 This is effective only with @option{-msched-control-spec} enabled.
18493 The default setting is enabled.
18494
18495 @item -mno-sched-prefer-non-data-spec-insns
18496 @itemx -msched-prefer-non-data-spec-insns
18497 @opindex mno-sched-prefer-non-data-spec-insns
18498 @opindex msched-prefer-non-data-spec-insns
18499 If enabled, data-speculative instructions are chosen for schedule
18500 only if there are no other choices at the moment. This makes
18501 the use of the data speculation much more conservative.
18502 The default setting is disabled.
18503
18504 @item -mno-sched-prefer-non-control-spec-insns
18505 @itemx -msched-prefer-non-control-spec-insns
18506 @opindex mno-sched-prefer-non-control-spec-insns
18507 @opindex msched-prefer-non-control-spec-insns
18508 If enabled, control-speculative instructions are chosen for schedule
18509 only if there are no other choices at the moment. This makes
18510 the use of the control speculation much more conservative.
18511 The default setting is disabled.
18512
18513 @item -mno-sched-count-spec-in-critical-path
18514 @itemx -msched-count-spec-in-critical-path
18515 @opindex mno-sched-count-spec-in-critical-path
18516 @opindex msched-count-spec-in-critical-path
18517 If enabled, speculative dependencies are considered during
18518 computation of the instructions priorities. This makes the use of the
18519 speculation a bit more conservative.
18520 The default setting is disabled.
18521
18522 @item -msched-spec-ldc
18523 @opindex msched-spec-ldc
18524 Use a simple data speculation check. This option is on by default.
18525
18526 @item -msched-control-spec-ldc
18527 @opindex msched-spec-ldc
18528 Use a simple check for control speculation. This option is on by default.
18529
18530 @item -msched-stop-bits-after-every-cycle
18531 @opindex msched-stop-bits-after-every-cycle
18532 Place a stop bit after every cycle when scheduling. This option is on
18533 by default.
18534
18535 @item -msched-fp-mem-deps-zero-cost
18536 @opindex msched-fp-mem-deps-zero-cost
18537 Assume that floating-point stores and loads are not likely to cause a conflict
18538 when placed into the same instruction group. This option is disabled by
18539 default.
18540
18541 @item -msel-sched-dont-check-control-spec
18542 @opindex msel-sched-dont-check-control-spec
18543 Generate checks for control speculation in selective scheduling.
18544 This flag is disabled by default.
18545
18546 @item -msched-max-memory-insns=@var{max-insns}
18547 @opindex msched-max-memory-insns
18548 Limit on the number of memory insns per instruction group, giving lower
18549 priority to subsequent memory insns attempting to schedule in the same
18550 instruction group. Frequently useful to prevent cache bank conflicts.
18551 The default value is 1.
18552
18553 @item -msched-max-memory-insns-hard-limit
18554 @opindex msched-max-memory-insns-hard-limit
18555 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
18556 disallowing more than that number in an instruction group.
18557 Otherwise, the limit is ``soft'', meaning that non-memory operations
18558 are preferred when the limit is reached, but memory operations may still
18559 be scheduled.
18560
18561 @end table
18562
18563 @node LM32 Options
18564 @subsection LM32 Options
18565 @cindex LM32 options
18566
18567 These @option{-m} options are defined for the LatticeMico32 architecture:
18568
18569 @table @gcctabopt
18570 @item -mbarrel-shift-enabled
18571 @opindex mbarrel-shift-enabled
18572 Enable barrel-shift instructions.
18573
18574 @item -mdivide-enabled
18575 @opindex mdivide-enabled
18576 Enable divide and modulus instructions.
18577
18578 @item -mmultiply-enabled
18579 @opindex multiply-enabled
18580 Enable multiply instructions.
18581
18582 @item -msign-extend-enabled
18583 @opindex msign-extend-enabled
18584 Enable sign extend instructions.
18585
18586 @item -muser-enabled
18587 @opindex muser-enabled
18588 Enable user-defined instructions.
18589
18590 @end table
18591
18592 @node M32C Options
18593 @subsection M32C Options
18594 @cindex M32C options
18595
18596 @table @gcctabopt
18597 @item -mcpu=@var{name}
18598 @opindex mcpu=
18599 Select the CPU for which code is generated. @var{name} may be one of
18600 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
18601 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
18602 the M32C/80 series.
18603
18604 @item -msim
18605 @opindex msim
18606 Specifies that the program will be run on the simulator. This causes
18607 an alternate runtime library to be linked in which supports, for
18608 example, file I/O@. You must not use this option when generating
18609 programs that will run on real hardware; you must provide your own
18610 runtime library for whatever I/O functions are needed.
18611
18612 @item -memregs=@var{number}
18613 @opindex memregs=
18614 Specifies the number of memory-based pseudo-registers GCC uses
18615 during code generation. These pseudo-registers are used like real
18616 registers, so there is a tradeoff between GCC's ability to fit the
18617 code into available registers, and the performance penalty of using
18618 memory instead of registers. Note that all modules in a program must
18619 be compiled with the same value for this option. Because of that, you
18620 must not use this option with GCC's default runtime libraries.
18621
18622 @end table
18623
18624 @node M32R/D Options
18625 @subsection M32R/D Options
18626 @cindex M32R/D options
18627
18628 These @option{-m} options are defined for Renesas M32R/D architectures:
18629
18630 @table @gcctabopt
18631 @item -m32r2
18632 @opindex m32r2
18633 Generate code for the M32R/2@.
18634
18635 @item -m32rx
18636 @opindex m32rx
18637 Generate code for the M32R/X@.
18638
18639 @item -m32r
18640 @opindex m32r
18641 Generate code for the M32R@. This is the default.
18642
18643 @item -mmodel=small
18644 @opindex mmodel=small
18645 Assume all objects live in the lower 16MB of memory (so that their addresses
18646 can be loaded with the @code{ld24} instruction), and assume all subroutines
18647 are reachable with the @code{bl} instruction.
18648 This is the default.
18649
18650 The addressability of a particular object can be set with the
18651 @code{model} attribute.
18652
18653 @item -mmodel=medium
18654 @opindex mmodel=medium
18655 Assume objects may be anywhere in the 32-bit address space (the compiler
18656 generates @code{seth/add3} instructions to load their addresses), and
18657 assume all subroutines are reachable with the @code{bl} instruction.
18658
18659 @item -mmodel=large
18660 @opindex mmodel=large
18661 Assume objects may be anywhere in the 32-bit address space (the compiler
18662 generates @code{seth/add3} instructions to load their addresses), and
18663 assume subroutines may not be reachable with the @code{bl} instruction
18664 (the compiler generates the much slower @code{seth/add3/jl}
18665 instruction sequence).
18666
18667 @item -msdata=none
18668 @opindex msdata=none
18669 Disable use of the small data area. Variables are put into
18670 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
18671 @code{section} attribute has been specified).
18672 This is the default.
18673
18674 The small data area consists of sections @code{.sdata} and @code{.sbss}.
18675 Objects may be explicitly put in the small data area with the
18676 @code{section} attribute using one of these sections.
18677
18678 @item -msdata=sdata
18679 @opindex msdata=sdata
18680 Put small global and static data in the small data area, but do not
18681 generate special code to reference them.
18682
18683 @item -msdata=use
18684 @opindex msdata=use
18685 Put small global and static data in the small data area, and generate
18686 special instructions to reference them.
18687
18688 @item -G @var{num}
18689 @opindex G
18690 @cindex smaller data references
18691 Put global and static objects less than or equal to @var{num} bytes
18692 into the small data or BSS sections instead of the normal data or BSS
18693 sections. The default value of @var{num} is 8.
18694 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
18695 for this option to have any effect.
18696
18697 All modules should be compiled with the same @option{-G @var{num}} value.
18698 Compiling with different values of @var{num} may or may not work; if it
18699 doesn't the linker gives an error message---incorrect code is not
18700 generated.
18701
18702 @item -mdebug
18703 @opindex mdebug
18704 Makes the M32R-specific code in the compiler display some statistics
18705 that might help in debugging programs.
18706
18707 @item -malign-loops
18708 @opindex malign-loops
18709 Align all loops to a 32-byte boundary.
18710
18711 @item -mno-align-loops
18712 @opindex mno-align-loops
18713 Do not enforce a 32-byte alignment for loops. This is the default.
18714
18715 @item -missue-rate=@var{number}
18716 @opindex missue-rate=@var{number}
18717 Issue @var{number} instructions per cycle. @var{number} can only be 1
18718 or 2.
18719
18720 @item -mbranch-cost=@var{number}
18721 @opindex mbranch-cost=@var{number}
18722 @var{number} can only be 1 or 2. If it is 1 then branches are
18723 preferred over conditional code, if it is 2, then the opposite applies.
18724
18725 @item -mflush-trap=@var{number}
18726 @opindex mflush-trap=@var{number}
18727 Specifies the trap number to use to flush the cache. The default is
18728 12. Valid numbers are between 0 and 15 inclusive.
18729
18730 @item -mno-flush-trap
18731 @opindex mno-flush-trap
18732 Specifies that the cache cannot be flushed by using a trap.
18733
18734 @item -mflush-func=@var{name}
18735 @opindex mflush-func=@var{name}
18736 Specifies the name of the operating system function to call to flush
18737 the cache. The default is @samp{_flush_cache}, but a function call
18738 is only used if a trap is not available.
18739
18740 @item -mno-flush-func
18741 @opindex mno-flush-func
18742 Indicates that there is no OS function for flushing the cache.
18743
18744 @end table
18745
18746 @node M680x0 Options
18747 @subsection M680x0 Options
18748 @cindex M680x0 options
18749
18750 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
18751 The default settings depend on which architecture was selected when
18752 the compiler was configured; the defaults for the most common choices
18753 are given below.
18754
18755 @table @gcctabopt
18756 @item -march=@var{arch}
18757 @opindex march
18758 Generate code for a specific M680x0 or ColdFire instruction set
18759 architecture. Permissible values of @var{arch} for M680x0
18760 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
18761 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
18762 architectures are selected according to Freescale's ISA classification
18763 and the permissible values are: @samp{isaa}, @samp{isaaplus},
18764 @samp{isab} and @samp{isac}.
18765
18766 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
18767 code for a ColdFire target. The @var{arch} in this macro is one of the
18768 @option{-march} arguments given above.
18769
18770 When used together, @option{-march} and @option{-mtune} select code
18771 that runs on a family of similar processors but that is optimized
18772 for a particular microarchitecture.
18773
18774 @item -mcpu=@var{cpu}
18775 @opindex mcpu
18776 Generate code for a specific M680x0 or ColdFire processor.
18777 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
18778 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
18779 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
18780 below, which also classifies the CPUs into families:
18781
18782 @multitable @columnfractions 0.20 0.80
18783 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
18784 @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}
18785 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
18786 @item @samp{5206e} @tab @samp{5206e}
18787 @item @samp{5208} @tab @samp{5207} @samp{5208}
18788 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
18789 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
18790 @item @samp{5216} @tab @samp{5214} @samp{5216}
18791 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
18792 @item @samp{5225} @tab @samp{5224} @samp{5225}
18793 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
18794 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
18795 @item @samp{5249} @tab @samp{5249}
18796 @item @samp{5250} @tab @samp{5250}
18797 @item @samp{5271} @tab @samp{5270} @samp{5271}
18798 @item @samp{5272} @tab @samp{5272}
18799 @item @samp{5275} @tab @samp{5274} @samp{5275}
18800 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
18801 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
18802 @item @samp{5307} @tab @samp{5307}
18803 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
18804 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
18805 @item @samp{5407} @tab @samp{5407}
18806 @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}
18807 @end multitable
18808
18809 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
18810 @var{arch} is compatible with @var{cpu}. Other combinations of
18811 @option{-mcpu} and @option{-march} are rejected.
18812
18813 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
18814 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
18815 where the value of @var{family} is given by the table above.
18816
18817 @item -mtune=@var{tune}
18818 @opindex mtune
18819 Tune the code for a particular microarchitecture within the
18820 constraints set by @option{-march} and @option{-mcpu}.
18821 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
18822 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
18823 and @samp{cpu32}. The ColdFire microarchitectures
18824 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
18825
18826 You can also use @option{-mtune=68020-40} for code that needs
18827 to run relatively well on 68020, 68030 and 68040 targets.
18828 @option{-mtune=68020-60} is similar but includes 68060 targets
18829 as well. These two options select the same tuning decisions as
18830 @option{-m68020-40} and @option{-m68020-60} respectively.
18831
18832 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
18833 when tuning for 680x0 architecture @var{arch}. It also defines
18834 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
18835 option is used. If GCC is tuning for a range of architectures,
18836 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
18837 it defines the macros for every architecture in the range.
18838
18839 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
18840 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
18841 of the arguments given above.
18842
18843 @item -m68000
18844 @itemx -mc68000
18845 @opindex m68000
18846 @opindex mc68000
18847 Generate output for a 68000. This is the default
18848 when the compiler is configured for 68000-based systems.
18849 It is equivalent to @option{-march=68000}.
18850
18851 Use this option for microcontrollers with a 68000 or EC000 core,
18852 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
18853
18854 @item -m68010
18855 @opindex m68010
18856 Generate output for a 68010. This is the default
18857 when the compiler is configured for 68010-based systems.
18858 It is equivalent to @option{-march=68010}.
18859
18860 @item -m68020
18861 @itemx -mc68020
18862 @opindex m68020
18863 @opindex mc68020
18864 Generate output for a 68020. This is the default
18865 when the compiler is configured for 68020-based systems.
18866 It is equivalent to @option{-march=68020}.
18867
18868 @item -m68030
18869 @opindex m68030
18870 Generate output for a 68030. This is the default when the compiler is
18871 configured for 68030-based systems. It is equivalent to
18872 @option{-march=68030}.
18873
18874 @item -m68040
18875 @opindex m68040
18876 Generate output for a 68040. This is the default when the compiler is
18877 configured for 68040-based systems. It is equivalent to
18878 @option{-march=68040}.
18879
18880 This option inhibits the use of 68881/68882 instructions that have to be
18881 emulated by software on the 68040. Use this option if your 68040 does not
18882 have code to emulate those instructions.
18883
18884 @item -m68060
18885 @opindex m68060
18886 Generate output for a 68060. This is the default when the compiler is
18887 configured for 68060-based systems. It is equivalent to
18888 @option{-march=68060}.
18889
18890 This option inhibits the use of 68020 and 68881/68882 instructions that
18891 have to be emulated by software on the 68060. Use this option if your 68060
18892 does not have code to emulate those instructions.
18893
18894 @item -mcpu32
18895 @opindex mcpu32
18896 Generate output for a CPU32. This is the default
18897 when the compiler is configured for CPU32-based systems.
18898 It is equivalent to @option{-march=cpu32}.
18899
18900 Use this option for microcontrollers with a
18901 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
18902 68336, 68340, 68341, 68349 and 68360.
18903
18904 @item -m5200
18905 @opindex m5200
18906 Generate output for a 520X ColdFire CPU@. This is the default
18907 when the compiler is configured for 520X-based systems.
18908 It is equivalent to @option{-mcpu=5206}, and is now deprecated
18909 in favor of that option.
18910
18911 Use this option for microcontroller with a 5200 core, including
18912 the MCF5202, MCF5203, MCF5204 and MCF5206.
18913
18914 @item -m5206e
18915 @opindex m5206e
18916 Generate output for a 5206e ColdFire CPU@. The option is now
18917 deprecated in favor of the equivalent @option{-mcpu=5206e}.
18918
18919 @item -m528x
18920 @opindex m528x
18921 Generate output for a member of the ColdFire 528X family.
18922 The option is now deprecated in favor of the equivalent
18923 @option{-mcpu=528x}.
18924
18925 @item -m5307
18926 @opindex m5307
18927 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
18928 in favor of the equivalent @option{-mcpu=5307}.
18929
18930 @item -m5407
18931 @opindex m5407
18932 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
18933 in favor of the equivalent @option{-mcpu=5407}.
18934
18935 @item -mcfv4e
18936 @opindex mcfv4e
18937 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
18938 This includes use of hardware floating-point instructions.
18939 The option is equivalent to @option{-mcpu=547x}, and is now
18940 deprecated in favor of that option.
18941
18942 @item -m68020-40
18943 @opindex m68020-40
18944 Generate output for a 68040, without using any of the new instructions.
18945 This results in code that can run relatively efficiently on either a
18946 68020/68881 or a 68030 or a 68040. The generated code does use the
18947 68881 instructions that are emulated on the 68040.
18948
18949 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
18950
18951 @item -m68020-60
18952 @opindex m68020-60
18953 Generate output for a 68060, without using any of the new instructions.
18954 This results in code that can run relatively efficiently on either a
18955 68020/68881 or a 68030 or a 68040. The generated code does use the
18956 68881 instructions that are emulated on the 68060.
18957
18958 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
18959
18960 @item -mhard-float
18961 @itemx -m68881
18962 @opindex mhard-float
18963 @opindex m68881
18964 Generate floating-point instructions. This is the default for 68020
18965 and above, and for ColdFire devices that have an FPU@. It defines the
18966 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
18967 on ColdFire targets.
18968
18969 @item -msoft-float
18970 @opindex msoft-float
18971 Do not generate floating-point instructions; use library calls instead.
18972 This is the default for 68000, 68010, and 68832 targets. It is also
18973 the default for ColdFire devices that have no FPU.
18974
18975 @item -mdiv
18976 @itemx -mno-div
18977 @opindex mdiv
18978 @opindex mno-div
18979 Generate (do not generate) ColdFire hardware divide and remainder
18980 instructions. If @option{-march} is used without @option{-mcpu},
18981 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
18982 architectures. Otherwise, the default is taken from the target CPU
18983 (either the default CPU, or the one specified by @option{-mcpu}). For
18984 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
18985 @option{-mcpu=5206e}.
18986
18987 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
18988
18989 @item -mshort
18990 @opindex mshort
18991 Consider type @code{int} to be 16 bits wide, like @code{short int}.
18992 Additionally, parameters passed on the stack are also aligned to a
18993 16-bit boundary even on targets whose API mandates promotion to 32-bit.
18994
18995 @item -mno-short
18996 @opindex mno-short
18997 Do not consider type @code{int} to be 16 bits wide. This is the default.
18998
18999 @item -mnobitfield
19000 @itemx -mno-bitfield
19001 @opindex mnobitfield
19002 @opindex mno-bitfield
19003 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
19004 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
19005
19006 @item -mbitfield
19007 @opindex mbitfield
19008 Do use the bit-field instructions. The @option{-m68020} option implies
19009 @option{-mbitfield}. This is the default if you use a configuration
19010 designed for a 68020.
19011
19012 @item -mrtd
19013 @opindex mrtd
19014 Use a different function-calling convention, in which functions
19015 that take a fixed number of arguments return with the @code{rtd}
19016 instruction, which pops their arguments while returning. This
19017 saves one instruction in the caller since there is no need to pop
19018 the arguments there.
19019
19020 This calling convention is incompatible with the one normally
19021 used on Unix, so you cannot use it if you need to call libraries
19022 compiled with the Unix compiler.
19023
19024 Also, you must provide function prototypes for all functions that
19025 take variable numbers of arguments (including @code{printf});
19026 otherwise incorrect code is generated for calls to those
19027 functions.
19028
19029 In addition, seriously incorrect code results if you call a
19030 function with too many arguments. (Normally, extra arguments are
19031 harmlessly ignored.)
19032
19033 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
19034 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
19035
19036 @item -mno-rtd
19037 @opindex mno-rtd
19038 Do not use the calling conventions selected by @option{-mrtd}.
19039 This is the default.
19040
19041 @item -malign-int
19042 @itemx -mno-align-int
19043 @opindex malign-int
19044 @opindex mno-align-int
19045 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
19046 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
19047 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
19048 Aligning variables on 32-bit boundaries produces code that runs somewhat
19049 faster on processors with 32-bit busses at the expense of more memory.
19050
19051 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
19052 aligns structures containing the above types differently than
19053 most published application binary interface specifications for the m68k.
19054
19055 @item -mpcrel
19056 @opindex mpcrel
19057 Use the pc-relative addressing mode of the 68000 directly, instead of
19058 using a global offset table. At present, this option implies @option{-fpic},
19059 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
19060 not presently supported with @option{-mpcrel}, though this could be supported for
19061 68020 and higher processors.
19062
19063 @item -mno-strict-align
19064 @itemx -mstrict-align
19065 @opindex mno-strict-align
19066 @opindex mstrict-align
19067 Do not (do) assume that unaligned memory references are handled by
19068 the system.
19069
19070 @item -msep-data
19071 Generate code that allows the data segment to be located in a different
19072 area of memory from the text segment. This allows for execute-in-place in
19073 an environment without virtual memory management. This option implies
19074 @option{-fPIC}.
19075
19076 @item -mno-sep-data
19077 Generate code that assumes that the data segment follows the text segment.
19078 This is the default.
19079
19080 @item -mid-shared-library
19081 Generate code that supports shared libraries via the library ID method.
19082 This allows for execute-in-place and shared libraries in an environment
19083 without virtual memory management. This option implies @option{-fPIC}.
19084
19085 @item -mno-id-shared-library
19086 Generate code that doesn't assume ID-based shared libraries are being used.
19087 This is the default.
19088
19089 @item -mshared-library-id=n
19090 Specifies the identification number of the ID-based shared library being
19091 compiled. Specifying a value of 0 generates more compact code; specifying
19092 other values forces the allocation of that number to the current
19093 library, but is no more space- or time-efficient than omitting this option.
19094
19095 @item -mxgot
19096 @itemx -mno-xgot
19097 @opindex mxgot
19098 @opindex mno-xgot
19099 When generating position-independent code for ColdFire, generate code
19100 that works if the GOT has more than 8192 entries. This code is
19101 larger and slower than code generated without this option. On M680x0
19102 processors, this option is not needed; @option{-fPIC} suffices.
19103
19104 GCC normally uses a single instruction to load values from the GOT@.
19105 While this is relatively efficient, it only works if the GOT
19106 is smaller than about 64k. Anything larger causes the linker
19107 to report an error such as:
19108
19109 @cindex relocation truncated to fit (ColdFire)
19110 @smallexample
19111 relocation truncated to fit: R_68K_GOT16O foobar
19112 @end smallexample
19113
19114 If this happens, you should recompile your code with @option{-mxgot}.
19115 It should then work with very large GOTs. However, code generated with
19116 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
19117 the value of a global symbol.
19118
19119 Note that some linkers, including newer versions of the GNU linker,
19120 can create multiple GOTs and sort GOT entries. If you have such a linker,
19121 you should only need to use @option{-mxgot} when compiling a single
19122 object file that accesses more than 8192 GOT entries. Very few do.
19123
19124 These options have no effect unless GCC is generating
19125 position-independent code.
19126
19127 @item -mlong-jump-table-offsets
19128 @opindex mlong-jump-table-offsets
19129 Use 32-bit offsets in @code{switch} tables. The default is to use
19130 16-bit offsets.
19131
19132 @end table
19133
19134 @node MCore Options
19135 @subsection MCore Options
19136 @cindex MCore options
19137
19138 These are the @samp{-m} options defined for the Motorola M*Core
19139 processors.
19140
19141 @table @gcctabopt
19142
19143 @item -mhardlit
19144 @itemx -mno-hardlit
19145 @opindex mhardlit
19146 @opindex mno-hardlit
19147 Inline constants into the code stream if it can be done in two
19148 instructions or less.
19149
19150 @item -mdiv
19151 @itemx -mno-div
19152 @opindex mdiv
19153 @opindex mno-div
19154 Use the divide instruction. (Enabled by default).
19155
19156 @item -mrelax-immediate
19157 @itemx -mno-relax-immediate
19158 @opindex mrelax-immediate
19159 @opindex mno-relax-immediate
19160 Allow arbitrary-sized immediates in bit operations.
19161
19162 @item -mwide-bitfields
19163 @itemx -mno-wide-bitfields
19164 @opindex mwide-bitfields
19165 @opindex mno-wide-bitfields
19166 Always treat bit-fields as @code{int}-sized.
19167
19168 @item -m4byte-functions
19169 @itemx -mno-4byte-functions
19170 @opindex m4byte-functions
19171 @opindex mno-4byte-functions
19172 Force all functions to be aligned to a 4-byte boundary.
19173
19174 @item -mcallgraph-data
19175 @itemx -mno-callgraph-data
19176 @opindex mcallgraph-data
19177 @opindex mno-callgraph-data
19178 Emit callgraph information.
19179
19180 @item -mslow-bytes
19181 @itemx -mno-slow-bytes
19182 @opindex mslow-bytes
19183 @opindex mno-slow-bytes
19184 Prefer word access when reading byte quantities.
19185
19186 @item -mlittle-endian
19187 @itemx -mbig-endian
19188 @opindex mlittle-endian
19189 @opindex mbig-endian
19190 Generate code for a little-endian target.
19191
19192 @item -m210
19193 @itemx -m340
19194 @opindex m210
19195 @opindex m340
19196 Generate code for the 210 processor.
19197
19198 @item -mno-lsim
19199 @opindex mno-lsim
19200 Assume that runtime support has been provided and so omit the
19201 simulator library (@file{libsim.a)} from the linker command line.
19202
19203 @item -mstack-increment=@var{size}
19204 @opindex mstack-increment
19205 Set the maximum amount for a single stack increment operation. Large
19206 values can increase the speed of programs that contain functions
19207 that need a large amount of stack space, but they can also trigger a
19208 segmentation fault if the stack is extended too much. The default
19209 value is 0x1000.
19210
19211 @end table
19212
19213 @node MeP Options
19214 @subsection MeP Options
19215 @cindex MeP options
19216
19217 @table @gcctabopt
19218
19219 @item -mabsdiff
19220 @opindex mabsdiff
19221 Enables the @code{abs} instruction, which is the absolute difference
19222 between two registers.
19223
19224 @item -mall-opts
19225 @opindex mall-opts
19226 Enables all the optional instructions---average, multiply, divide, bit
19227 operations, leading zero, absolute difference, min/max, clip, and
19228 saturation.
19229
19230
19231 @item -maverage
19232 @opindex maverage
19233 Enables the @code{ave} instruction, which computes the average of two
19234 registers.
19235
19236 @item -mbased=@var{n}
19237 @opindex mbased=
19238 Variables of size @var{n} bytes or smaller are placed in the
19239 @code{.based} section by default. Based variables use the @code{$tp}
19240 register as a base register, and there is a 128-byte limit to the
19241 @code{.based} section.
19242
19243 @item -mbitops
19244 @opindex mbitops
19245 Enables the bit operation instructions---bit test (@code{btstm}), set
19246 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
19247 test-and-set (@code{tas}).
19248
19249 @item -mc=@var{name}
19250 @opindex mc=
19251 Selects which section constant data is placed in. @var{name} may
19252 be @samp{tiny}, @samp{near}, or @samp{far}.
19253
19254 @item -mclip
19255 @opindex mclip
19256 Enables the @code{clip} instruction. Note that @option{-mclip} is not
19257 useful unless you also provide @option{-mminmax}.
19258
19259 @item -mconfig=@var{name}
19260 @opindex mconfig=
19261 Selects one of the built-in core configurations. Each MeP chip has
19262 one or more modules in it; each module has a core CPU and a variety of
19263 coprocessors, optional instructions, and peripherals. The
19264 @code{MeP-Integrator} tool, not part of GCC, provides these
19265 configurations through this option; using this option is the same as
19266 using all the corresponding command-line options. The default
19267 configuration is @samp{default}.
19268
19269 @item -mcop
19270 @opindex mcop
19271 Enables the coprocessor instructions. By default, this is a 32-bit
19272 coprocessor. Note that the coprocessor is normally enabled via the
19273 @option{-mconfig=} option.
19274
19275 @item -mcop32
19276 @opindex mcop32
19277 Enables the 32-bit coprocessor's instructions.
19278
19279 @item -mcop64
19280 @opindex mcop64
19281 Enables the 64-bit coprocessor's instructions.
19282
19283 @item -mivc2
19284 @opindex mivc2
19285 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
19286
19287 @item -mdc
19288 @opindex mdc
19289 Causes constant variables to be placed in the @code{.near} section.
19290
19291 @item -mdiv
19292 @opindex mdiv
19293 Enables the @code{div} and @code{divu} instructions.
19294
19295 @item -meb
19296 @opindex meb
19297 Generate big-endian code.
19298
19299 @item -mel
19300 @opindex mel
19301 Generate little-endian code.
19302
19303 @item -mio-volatile
19304 @opindex mio-volatile
19305 Tells the compiler that any variable marked with the @code{io}
19306 attribute is to be considered volatile.
19307
19308 @item -ml
19309 @opindex ml
19310 Causes variables to be assigned to the @code{.far} section by default.
19311
19312 @item -mleadz
19313 @opindex mleadz
19314 Enables the @code{leadz} (leading zero) instruction.
19315
19316 @item -mm
19317 @opindex mm
19318 Causes variables to be assigned to the @code{.near} section by default.
19319
19320 @item -mminmax
19321 @opindex mminmax
19322 Enables the @code{min} and @code{max} instructions.
19323
19324 @item -mmult
19325 @opindex mmult
19326 Enables the multiplication and multiply-accumulate instructions.
19327
19328 @item -mno-opts
19329 @opindex mno-opts
19330 Disables all the optional instructions enabled by @option{-mall-opts}.
19331
19332 @item -mrepeat
19333 @opindex mrepeat
19334 Enables the @code{repeat} and @code{erepeat} instructions, used for
19335 low-overhead looping.
19336
19337 @item -ms
19338 @opindex ms
19339 Causes all variables to default to the @code{.tiny} section. Note
19340 that there is a 65536-byte limit to this section. Accesses to these
19341 variables use the @code{%gp} base register.
19342
19343 @item -msatur
19344 @opindex msatur
19345 Enables the saturation instructions. Note that the compiler does not
19346 currently generate these itself, but this option is included for
19347 compatibility with other tools, like @code{as}.
19348
19349 @item -msdram
19350 @opindex msdram
19351 Link the SDRAM-based runtime instead of the default ROM-based runtime.
19352
19353 @item -msim
19354 @opindex msim
19355 Link the simulator run-time libraries.
19356
19357 @item -msimnovec
19358 @opindex msimnovec
19359 Link the simulator runtime libraries, excluding built-in support
19360 for reset and exception vectors and tables.
19361
19362 @item -mtf
19363 @opindex mtf
19364 Causes all functions to default to the @code{.far} section. Without
19365 this option, functions default to the @code{.near} section.
19366
19367 @item -mtiny=@var{n}
19368 @opindex mtiny=
19369 Variables that are @var{n} bytes or smaller are allocated to the
19370 @code{.tiny} section. These variables use the @code{$gp} base
19371 register. The default for this option is 4, but note that there's a
19372 65536-byte limit to the @code{.tiny} section.
19373
19374 @end table
19375
19376 @node MicroBlaze Options
19377 @subsection MicroBlaze Options
19378 @cindex MicroBlaze Options
19379
19380 @table @gcctabopt
19381
19382 @item -msoft-float
19383 @opindex msoft-float
19384 Use software emulation for floating point (default).
19385
19386 @item -mhard-float
19387 @opindex mhard-float
19388 Use hardware floating-point instructions.
19389
19390 @item -mmemcpy
19391 @opindex mmemcpy
19392 Do not optimize block moves, use @code{memcpy}.
19393
19394 @item -mno-clearbss
19395 @opindex mno-clearbss
19396 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
19397
19398 @item -mcpu=@var{cpu-type}
19399 @opindex mcpu=
19400 Use features of, and schedule code for, the given CPU.
19401 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
19402 where @var{X} is a major version, @var{YY} is the minor version, and
19403 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
19404 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
19405
19406 @item -mxl-soft-mul
19407 @opindex mxl-soft-mul
19408 Use software multiply emulation (default).
19409
19410 @item -mxl-soft-div
19411 @opindex mxl-soft-div
19412 Use software emulation for divides (default).
19413
19414 @item -mxl-barrel-shift
19415 @opindex mxl-barrel-shift
19416 Use the hardware barrel shifter.
19417
19418 @item -mxl-pattern-compare
19419 @opindex mxl-pattern-compare
19420 Use pattern compare instructions.
19421
19422 @item -msmall-divides
19423 @opindex msmall-divides
19424 Use table lookup optimization for small signed integer divisions.
19425
19426 @item -mxl-stack-check
19427 @opindex mxl-stack-check
19428 This option is deprecated. Use @option{-fstack-check} instead.
19429
19430 @item -mxl-gp-opt
19431 @opindex mxl-gp-opt
19432 Use GP-relative @code{.sdata}/@code{.sbss} sections.
19433
19434 @item -mxl-multiply-high
19435 @opindex mxl-multiply-high
19436 Use multiply high instructions for high part of 32x32 multiply.
19437
19438 @item -mxl-float-convert
19439 @opindex mxl-float-convert
19440 Use hardware floating-point conversion instructions.
19441
19442 @item -mxl-float-sqrt
19443 @opindex mxl-float-sqrt
19444 Use hardware floating-point square root instruction.
19445
19446 @item -mbig-endian
19447 @opindex mbig-endian
19448 Generate code for a big-endian target.
19449
19450 @item -mlittle-endian
19451 @opindex mlittle-endian
19452 Generate code for a little-endian target.
19453
19454 @item -mxl-reorder
19455 @opindex mxl-reorder
19456 Use reorder instructions (swap and byte reversed load/store).
19457
19458 @item -mxl-mode-@var{app-model}
19459 Select application model @var{app-model}. Valid models are
19460 @table @samp
19461 @item executable
19462 normal executable (default), uses startup code @file{crt0.o}.
19463
19464 @item xmdstub
19465 for use with Xilinx Microprocessor Debugger (XMD) based
19466 software intrusive debug agent called xmdstub. This uses startup file
19467 @file{crt1.o} and sets the start address of the program to 0x800.
19468
19469 @item bootstrap
19470 for applications that are loaded using a bootloader.
19471 This model uses startup file @file{crt2.o} which does not contain a processor
19472 reset vector handler. This is suitable for transferring control on a
19473 processor reset to the bootloader rather than the application.
19474
19475 @item novectors
19476 for applications that do not require any of the
19477 MicroBlaze vectors. This option may be useful for applications running
19478 within a monitoring application. This model uses @file{crt3.o} as a startup file.
19479 @end table
19480
19481 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
19482 @option{-mxl-mode-@var{app-model}}.
19483
19484 @end table
19485
19486 @node MIPS Options
19487 @subsection MIPS Options
19488 @cindex MIPS options
19489
19490 @table @gcctabopt
19491
19492 @item -EB
19493 @opindex EB
19494 Generate big-endian code.
19495
19496 @item -EL
19497 @opindex EL
19498 Generate little-endian code. This is the default for @samp{mips*el-*-*}
19499 configurations.
19500
19501 @item -march=@var{arch}
19502 @opindex march
19503 Generate code that runs on @var{arch}, which can be the name of a
19504 generic MIPS ISA, or the name of a particular processor.
19505 The ISA names are:
19506 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
19507 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
19508 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
19509 @samp{mips64r5} and @samp{mips64r6}.
19510 The processor names are:
19511 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
19512 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
19513 @samp{5kc}, @samp{5kf},
19514 @samp{20kc},
19515 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
19516 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
19517 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
19518 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
19519 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
19520 @samp{i6400},
19521 @samp{interaptiv},
19522 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
19523 @samp{m4k},
19524 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
19525 @samp{m5100}, @samp{m5101},
19526 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
19527 @samp{orion},
19528 @samp{p5600},
19529 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
19530 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
19531 @samp{rm7000}, @samp{rm9000},
19532 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
19533 @samp{sb1},
19534 @samp{sr71000},
19535 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
19536 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
19537 @samp{xlr} and @samp{xlp}.
19538 The special value @samp{from-abi} selects the
19539 most compatible architecture for the selected ABI (that is,
19540 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
19541
19542 The native Linux/GNU toolchain also supports the value @samp{native},
19543 which selects the best architecture option for the host processor.
19544 @option{-march=native} has no effect if GCC does not recognize
19545 the processor.
19546
19547 In processor names, a final @samp{000} can be abbreviated as @samp{k}
19548 (for example, @option{-march=r2k}). Prefixes are optional, and
19549 @samp{vr} may be written @samp{r}.
19550
19551 Names of the form @samp{@var{n}f2_1} refer to processors with
19552 FPUs clocked at half the rate of the core, names of the form
19553 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
19554 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
19555 processors with FPUs clocked a ratio of 3:2 with respect to the core.
19556 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
19557 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
19558 accepted as synonyms for @samp{@var{n}f1_1}.
19559
19560 GCC defines two macros based on the value of this option. The first
19561 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
19562 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
19563 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
19564 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
19565 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
19566
19567 Note that the @code{_MIPS_ARCH} macro uses the processor names given
19568 above. In other words, it has the full prefix and does not
19569 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
19570 the macro names the resolved architecture (either @code{"mips1"} or
19571 @code{"mips3"}). It names the default architecture when no
19572 @option{-march} option is given.
19573
19574 @item -mtune=@var{arch}
19575 @opindex mtune
19576 Optimize for @var{arch}. Among other things, this option controls
19577 the way instructions are scheduled, and the perceived cost of arithmetic
19578 operations. The list of @var{arch} values is the same as for
19579 @option{-march}.
19580
19581 When this option is not used, GCC optimizes for the processor
19582 specified by @option{-march}. By using @option{-march} and
19583 @option{-mtune} together, it is possible to generate code that
19584 runs on a family of processors, but optimize the code for one
19585 particular member of that family.
19586
19587 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
19588 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
19589 @option{-march} ones described above.
19590
19591 @item -mips1
19592 @opindex mips1
19593 Equivalent to @option{-march=mips1}.
19594
19595 @item -mips2
19596 @opindex mips2
19597 Equivalent to @option{-march=mips2}.
19598
19599 @item -mips3
19600 @opindex mips3
19601 Equivalent to @option{-march=mips3}.
19602
19603 @item -mips4
19604 @opindex mips4
19605 Equivalent to @option{-march=mips4}.
19606
19607 @item -mips32
19608 @opindex mips32
19609 Equivalent to @option{-march=mips32}.
19610
19611 @item -mips32r3
19612 @opindex mips32r3
19613 Equivalent to @option{-march=mips32r3}.
19614
19615 @item -mips32r5
19616 @opindex mips32r5
19617 Equivalent to @option{-march=mips32r5}.
19618
19619 @item -mips32r6
19620 @opindex mips32r6
19621 Equivalent to @option{-march=mips32r6}.
19622
19623 @item -mips64
19624 @opindex mips64
19625 Equivalent to @option{-march=mips64}.
19626
19627 @item -mips64r2
19628 @opindex mips64r2
19629 Equivalent to @option{-march=mips64r2}.
19630
19631 @item -mips64r3
19632 @opindex mips64r3
19633 Equivalent to @option{-march=mips64r3}.
19634
19635 @item -mips64r5
19636 @opindex mips64r5
19637 Equivalent to @option{-march=mips64r5}.
19638
19639 @item -mips64r6
19640 @opindex mips64r6
19641 Equivalent to @option{-march=mips64r6}.
19642
19643 @item -mips16
19644 @itemx -mno-mips16
19645 @opindex mips16
19646 @opindex mno-mips16
19647 Generate (do not generate) MIPS16 code. If GCC is targeting a
19648 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
19649
19650 MIPS16 code generation can also be controlled on a per-function basis
19651 by means of @code{mips16} and @code{nomips16} attributes.
19652 @xref{Function Attributes}, for more information.
19653
19654 @item -mflip-mips16
19655 @opindex mflip-mips16
19656 Generate MIPS16 code on alternating functions. This option is provided
19657 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
19658 not intended for ordinary use in compiling user code.
19659
19660 @item -minterlink-compressed
19661 @item -mno-interlink-compressed
19662 @opindex minterlink-compressed
19663 @opindex mno-interlink-compressed
19664 Require (do not require) that code using the standard (uncompressed) MIPS ISA
19665 be link-compatible with MIPS16 and microMIPS code, and vice versa.
19666
19667 For example, code using the standard ISA encoding cannot jump directly
19668 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
19669 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
19670 knows that the target of the jump is not compressed.
19671
19672 @item -minterlink-mips16
19673 @itemx -mno-interlink-mips16
19674 @opindex minterlink-mips16
19675 @opindex mno-interlink-mips16
19676 Aliases of @option{-minterlink-compressed} and
19677 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
19678 and are retained for backwards compatibility.
19679
19680 @item -mabi=32
19681 @itemx -mabi=o64
19682 @itemx -mabi=n32
19683 @itemx -mabi=64
19684 @itemx -mabi=eabi
19685 @opindex mabi=32
19686 @opindex mabi=o64
19687 @opindex mabi=n32
19688 @opindex mabi=64
19689 @opindex mabi=eabi
19690 Generate code for the given ABI@.
19691
19692 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
19693 generates 64-bit code when you select a 64-bit architecture, but you
19694 can use @option{-mgp32} to get 32-bit code instead.
19695
19696 For information about the O64 ABI, see
19697 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
19698
19699 GCC supports a variant of the o32 ABI in which floating-point registers
19700 are 64 rather than 32 bits wide. You can select this combination with
19701 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
19702 and @code{mfhc1} instructions and is therefore only supported for
19703 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
19704
19705 The register assignments for arguments and return values remain the
19706 same, but each scalar value is passed in a single 64-bit register
19707 rather than a pair of 32-bit registers. For example, scalar
19708 floating-point values are returned in @samp{$f0} only, not a
19709 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
19710 remains the same in that the even-numbered double-precision registers
19711 are saved.
19712
19713 Two additional variants of the o32 ABI are supported to enable
19714 a transition from 32-bit to 64-bit registers. These are FPXX
19715 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
19716 The FPXX extension mandates that all code must execute correctly
19717 when run using 32-bit or 64-bit registers. The code can be interlinked
19718 with either FP32 or FP64, but not both.
19719 The FP64A extension is similar to the FP64 extension but forbids the
19720 use of odd-numbered single-precision registers. This can be used
19721 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
19722 processors and allows both FP32 and FP64A code to interlink and
19723 run in the same process without changing FPU modes.
19724
19725 @item -mabicalls
19726 @itemx -mno-abicalls
19727 @opindex mabicalls
19728 @opindex mno-abicalls
19729 Generate (do not generate) code that is suitable for SVR4-style
19730 dynamic objects. @option{-mabicalls} is the default for SVR4-based
19731 systems.
19732
19733 @item -mshared
19734 @itemx -mno-shared
19735 Generate (do not generate) code that is fully position-independent,
19736 and that can therefore be linked into shared libraries. This option
19737 only affects @option{-mabicalls}.
19738
19739 All @option{-mabicalls} code has traditionally been position-independent,
19740 regardless of options like @option{-fPIC} and @option{-fpic}. However,
19741 as an extension, the GNU toolchain allows executables to use absolute
19742 accesses for locally-binding symbols. It can also use shorter GP
19743 initialization sequences and generate direct calls to locally-defined
19744 functions. This mode is selected by @option{-mno-shared}.
19745
19746 @option{-mno-shared} depends on binutils 2.16 or higher and generates
19747 objects that can only be linked by the GNU linker. However, the option
19748 does not affect the ABI of the final executable; it only affects the ABI
19749 of relocatable objects. Using @option{-mno-shared} generally makes
19750 executables both smaller and quicker.
19751
19752 @option{-mshared} is the default.
19753
19754 @item -mplt
19755 @itemx -mno-plt
19756 @opindex mplt
19757 @opindex mno-plt
19758 Assume (do not assume) that the static and dynamic linkers
19759 support PLTs and copy relocations. This option only affects
19760 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
19761 has no effect without @option{-msym32}.
19762
19763 You can make @option{-mplt} the default by configuring
19764 GCC with @option{--with-mips-plt}. The default is
19765 @option{-mno-plt} otherwise.
19766
19767 @item -mxgot
19768 @itemx -mno-xgot
19769 @opindex mxgot
19770 @opindex mno-xgot
19771 Lift (do not lift) the usual restrictions on the size of the global
19772 offset table.
19773
19774 GCC normally uses a single instruction to load values from the GOT@.
19775 While this is relatively efficient, it only works if the GOT
19776 is smaller than about 64k. Anything larger causes the linker
19777 to report an error such as:
19778
19779 @cindex relocation truncated to fit (MIPS)
19780 @smallexample
19781 relocation truncated to fit: R_MIPS_GOT16 foobar
19782 @end smallexample
19783
19784 If this happens, you should recompile your code with @option{-mxgot}.
19785 This works with very large GOTs, although the code is also
19786 less efficient, since it takes three instructions to fetch the
19787 value of a global symbol.
19788
19789 Note that some linkers can create multiple GOTs. If you have such a
19790 linker, you should only need to use @option{-mxgot} when a single object
19791 file accesses more than 64k's worth of GOT entries. Very few do.
19792
19793 These options have no effect unless GCC is generating position
19794 independent code.
19795
19796 @item -mgp32
19797 @opindex mgp32
19798 Assume that general-purpose registers are 32 bits wide.
19799
19800 @item -mgp64
19801 @opindex mgp64
19802 Assume that general-purpose registers are 64 bits wide.
19803
19804 @item -mfp32
19805 @opindex mfp32
19806 Assume that floating-point registers are 32 bits wide.
19807
19808 @item -mfp64
19809 @opindex mfp64
19810 Assume that floating-point registers are 64 bits wide.
19811
19812 @item -mfpxx
19813 @opindex mfpxx
19814 Do not assume the width of floating-point registers.
19815
19816 @item -mhard-float
19817 @opindex mhard-float
19818 Use floating-point coprocessor instructions.
19819
19820 @item -msoft-float
19821 @opindex msoft-float
19822 Do not use floating-point coprocessor instructions. Implement
19823 floating-point calculations using library calls instead.
19824
19825 @item -mno-float
19826 @opindex mno-float
19827 Equivalent to @option{-msoft-float}, but additionally asserts that the
19828 program being compiled does not perform any floating-point operations.
19829 This option is presently supported only by some bare-metal MIPS
19830 configurations, where it may select a special set of libraries
19831 that lack all floating-point support (including, for example, the
19832 floating-point @code{printf} formats).
19833 If code compiled with @option{-mno-float} accidentally contains
19834 floating-point operations, it is likely to suffer a link-time
19835 or run-time failure.
19836
19837 @item -msingle-float
19838 @opindex msingle-float
19839 Assume that the floating-point coprocessor only supports single-precision
19840 operations.
19841
19842 @item -mdouble-float
19843 @opindex mdouble-float
19844 Assume that the floating-point coprocessor supports double-precision
19845 operations. This is the default.
19846
19847 @item -modd-spreg
19848 @itemx -mno-odd-spreg
19849 @opindex modd-spreg
19850 @opindex mno-odd-spreg
19851 Enable the use of odd-numbered single-precision floating-point registers
19852 for the o32 ABI. This is the default for processors that are known to
19853 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
19854 is set by default.
19855
19856 @item -mabs=2008
19857 @itemx -mabs=legacy
19858 @opindex mabs=2008
19859 @opindex mabs=legacy
19860 These options control the treatment of the special not-a-number (NaN)
19861 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
19862 @code{neg.@i{fmt}} machine instructions.
19863
19864 By default or when @option{-mabs=legacy} is used the legacy
19865 treatment is selected. In this case these instructions are considered
19866 arithmetic and avoided where correct operation is required and the
19867 input operand might be a NaN. A longer sequence of instructions that
19868 manipulate the sign bit of floating-point datum manually is used
19869 instead unless the @option{-ffinite-math-only} option has also been
19870 specified.
19871
19872 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
19873 this case these instructions are considered non-arithmetic and therefore
19874 operating correctly in all cases, including in particular where the
19875 input operand is a NaN. These instructions are therefore always used
19876 for the respective operations.
19877
19878 @item -mnan=2008
19879 @itemx -mnan=legacy
19880 @opindex mnan=2008
19881 @opindex mnan=legacy
19882 These options control the encoding of the special not-a-number (NaN)
19883 IEEE 754 floating-point data.
19884
19885 The @option{-mnan=legacy} option selects the legacy encoding. In this
19886 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
19887 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
19888 by the first bit of their trailing significand field being 1.
19889
19890 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
19891 this case qNaNs are denoted by the first bit of their trailing
19892 significand field being 1, whereas sNaNs are denoted by the first bit of
19893 their trailing significand field being 0.
19894
19895 The default is @option{-mnan=legacy} unless GCC has been configured with
19896 @option{--with-nan=2008}.
19897
19898 @item -mllsc
19899 @itemx -mno-llsc
19900 @opindex mllsc
19901 @opindex mno-llsc
19902 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
19903 implement atomic memory built-in functions. When neither option is
19904 specified, GCC uses the instructions if the target architecture
19905 supports them.
19906
19907 @option{-mllsc} is useful if the runtime environment can emulate the
19908 instructions and @option{-mno-llsc} can be useful when compiling for
19909 nonstandard ISAs. You can make either option the default by
19910 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
19911 respectively. @option{--with-llsc} is the default for some
19912 configurations; see the installation documentation for details.
19913
19914 @item -mdsp
19915 @itemx -mno-dsp
19916 @opindex mdsp
19917 @opindex mno-dsp
19918 Use (do not use) revision 1 of the MIPS DSP ASE@.
19919 @xref{MIPS DSP Built-in Functions}. This option defines the
19920 preprocessor macro @code{__mips_dsp}. It also defines
19921 @code{__mips_dsp_rev} to 1.
19922
19923 @item -mdspr2
19924 @itemx -mno-dspr2
19925 @opindex mdspr2
19926 @opindex mno-dspr2
19927 Use (do not use) revision 2 of the MIPS DSP ASE@.
19928 @xref{MIPS DSP Built-in Functions}. This option defines the
19929 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
19930 It also defines @code{__mips_dsp_rev} to 2.
19931
19932 @item -msmartmips
19933 @itemx -mno-smartmips
19934 @opindex msmartmips
19935 @opindex mno-smartmips
19936 Use (do not use) the MIPS SmartMIPS ASE.
19937
19938 @item -mpaired-single
19939 @itemx -mno-paired-single
19940 @opindex mpaired-single
19941 @opindex mno-paired-single
19942 Use (do not use) paired-single floating-point instructions.
19943 @xref{MIPS Paired-Single Support}. This option requires
19944 hardware floating-point support to be enabled.
19945
19946 @item -mdmx
19947 @itemx -mno-mdmx
19948 @opindex mdmx
19949 @opindex mno-mdmx
19950 Use (do not use) MIPS Digital Media Extension instructions.
19951 This option can only be used when generating 64-bit code and requires
19952 hardware floating-point support to be enabled.
19953
19954 @item -mips3d
19955 @itemx -mno-mips3d
19956 @opindex mips3d
19957 @opindex mno-mips3d
19958 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
19959 The option @option{-mips3d} implies @option{-mpaired-single}.
19960
19961 @item -mmicromips
19962 @itemx -mno-micromips
19963 @opindex mmicromips
19964 @opindex mno-mmicromips
19965 Generate (do not generate) microMIPS code.
19966
19967 MicroMIPS code generation can also be controlled on a per-function basis
19968 by means of @code{micromips} and @code{nomicromips} attributes.
19969 @xref{Function Attributes}, for more information.
19970
19971 @item -mmt
19972 @itemx -mno-mt
19973 @opindex mmt
19974 @opindex mno-mt
19975 Use (do not use) MT Multithreading instructions.
19976
19977 @item -mmcu
19978 @itemx -mno-mcu
19979 @opindex mmcu
19980 @opindex mno-mcu
19981 Use (do not use) the MIPS MCU ASE instructions.
19982
19983 @item -meva
19984 @itemx -mno-eva
19985 @opindex meva
19986 @opindex mno-eva
19987 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
19988
19989 @item -mvirt
19990 @itemx -mno-virt
19991 @opindex mvirt
19992 @opindex mno-virt
19993 Use (do not use) the MIPS Virtualization (VZ) instructions.
19994
19995 @item -mxpa
19996 @itemx -mno-xpa
19997 @opindex mxpa
19998 @opindex mno-xpa
19999 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
20000
20001 @item -mlong64
20002 @opindex mlong64
20003 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
20004 an explanation of the default and the way that the pointer size is
20005 determined.
20006
20007 @item -mlong32
20008 @opindex mlong32
20009 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
20010
20011 The default size of @code{int}s, @code{long}s and pointers depends on
20012 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
20013 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
20014 32-bit @code{long}s. Pointers are the same size as @code{long}s,
20015 or the same size as integer registers, whichever is smaller.
20016
20017 @item -msym32
20018 @itemx -mno-sym32
20019 @opindex msym32
20020 @opindex mno-sym32
20021 Assume (do not assume) that all symbols have 32-bit values, regardless
20022 of the selected ABI@. This option is useful in combination with
20023 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
20024 to generate shorter and faster references to symbolic addresses.
20025
20026 @item -G @var{num}
20027 @opindex G
20028 Put definitions of externally-visible data in a small data section
20029 if that data is no bigger than @var{num} bytes. GCC can then generate
20030 more efficient accesses to the data; see @option{-mgpopt} for details.
20031
20032 The default @option{-G} option depends on the configuration.
20033
20034 @item -mlocal-sdata
20035 @itemx -mno-local-sdata
20036 @opindex mlocal-sdata
20037 @opindex mno-local-sdata
20038 Extend (do not extend) the @option{-G} behavior to local data too,
20039 such as to static variables in C@. @option{-mlocal-sdata} is the
20040 default for all configurations.
20041
20042 If the linker complains that an application is using too much small data,
20043 you might want to try rebuilding the less performance-critical parts with
20044 @option{-mno-local-sdata}. You might also want to build large
20045 libraries with @option{-mno-local-sdata}, so that the libraries leave
20046 more room for the main program.
20047
20048 @item -mextern-sdata
20049 @itemx -mno-extern-sdata
20050 @opindex mextern-sdata
20051 @opindex mno-extern-sdata
20052 Assume (do not assume) that externally-defined data is in
20053 a small data section if the size of that data is within the @option{-G} limit.
20054 @option{-mextern-sdata} is the default for all configurations.
20055
20056 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
20057 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
20058 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
20059 is placed in a small data section. If @var{Var} is defined by another
20060 module, you must either compile that module with a high-enough
20061 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
20062 definition. If @var{Var} is common, you must link the application
20063 with a high-enough @option{-G} setting.
20064
20065 The easiest way of satisfying these restrictions is to compile
20066 and link every module with the same @option{-G} option. However,
20067 you may wish to build a library that supports several different
20068 small data limits. You can do this by compiling the library with
20069 the highest supported @option{-G} setting and additionally using
20070 @option{-mno-extern-sdata} to stop the library from making assumptions
20071 about externally-defined data.
20072
20073 @item -mgpopt
20074 @itemx -mno-gpopt
20075 @opindex mgpopt
20076 @opindex mno-gpopt
20077 Use (do not use) GP-relative accesses for symbols that are known to be
20078 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
20079 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
20080 configurations.
20081
20082 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
20083 might not hold the value of @code{_gp}. For example, if the code is
20084 part of a library that might be used in a boot monitor, programs that
20085 call boot monitor routines pass an unknown value in @code{$gp}.
20086 (In such situations, the boot monitor itself is usually compiled
20087 with @option{-G0}.)
20088
20089 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
20090 @option{-mno-extern-sdata}.
20091
20092 @item -membedded-data
20093 @itemx -mno-embedded-data
20094 @opindex membedded-data
20095 @opindex mno-embedded-data
20096 Allocate variables to the read-only data section first if possible, then
20097 next in the small data section if possible, otherwise in data. This gives
20098 slightly slower code than the default, but reduces the amount of RAM required
20099 when executing, and thus may be preferred for some embedded systems.
20100
20101 @item -muninit-const-in-rodata
20102 @itemx -mno-uninit-const-in-rodata
20103 @opindex muninit-const-in-rodata
20104 @opindex mno-uninit-const-in-rodata
20105 Put uninitialized @code{const} variables in the read-only data section.
20106 This option is only meaningful in conjunction with @option{-membedded-data}.
20107
20108 @item -mcode-readable=@var{setting}
20109 @opindex mcode-readable
20110 Specify whether GCC may generate code that reads from executable sections.
20111 There are three possible settings:
20112
20113 @table @gcctabopt
20114 @item -mcode-readable=yes
20115 Instructions may freely access executable sections. This is the
20116 default setting.
20117
20118 @item -mcode-readable=pcrel
20119 MIPS16 PC-relative load instructions can access executable sections,
20120 but other instructions must not do so. This option is useful on 4KSc
20121 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
20122 It is also useful on processors that can be configured to have a dual
20123 instruction/data SRAM interface and that, like the M4K, automatically
20124 redirect PC-relative loads to the instruction RAM.
20125
20126 @item -mcode-readable=no
20127 Instructions must not access executable sections. This option can be
20128 useful on targets that are configured to have a dual instruction/data
20129 SRAM interface but that (unlike the M4K) do not automatically redirect
20130 PC-relative loads to the instruction RAM.
20131 @end table
20132
20133 @item -msplit-addresses
20134 @itemx -mno-split-addresses
20135 @opindex msplit-addresses
20136 @opindex mno-split-addresses
20137 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
20138 relocation operators. This option has been superseded by
20139 @option{-mexplicit-relocs} but is retained for backwards compatibility.
20140
20141 @item -mexplicit-relocs
20142 @itemx -mno-explicit-relocs
20143 @opindex mexplicit-relocs
20144 @opindex mno-explicit-relocs
20145 Use (do not use) assembler relocation operators when dealing with symbolic
20146 addresses. The alternative, selected by @option{-mno-explicit-relocs},
20147 is to use assembler macros instead.
20148
20149 @option{-mexplicit-relocs} is the default if GCC was configured
20150 to use an assembler that supports relocation operators.
20151
20152 @item -mcheck-zero-division
20153 @itemx -mno-check-zero-division
20154 @opindex mcheck-zero-division
20155 @opindex mno-check-zero-division
20156 Trap (do not trap) on integer division by zero.
20157
20158 The default is @option{-mcheck-zero-division}.
20159
20160 @item -mdivide-traps
20161 @itemx -mdivide-breaks
20162 @opindex mdivide-traps
20163 @opindex mdivide-breaks
20164 MIPS systems check for division by zero by generating either a
20165 conditional trap or a break instruction. Using traps results in
20166 smaller code, but is only supported on MIPS II and later. Also, some
20167 versions of the Linux kernel have a bug that prevents trap from
20168 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
20169 allow conditional traps on architectures that support them and
20170 @option{-mdivide-breaks} to force the use of breaks.
20171
20172 The default is usually @option{-mdivide-traps}, but this can be
20173 overridden at configure time using @option{--with-divide=breaks}.
20174 Divide-by-zero checks can be completely disabled using
20175 @option{-mno-check-zero-division}.
20176
20177 @item -mload-store-pairs
20178 @itemx -mno-load-store-pairs
20179 @opindex mload-store-pairs
20180 @opindex mno-load-store-pairs
20181 Enable (disable) an optimization that pairs consecutive load or store
20182 instructions to enable load/store bonding. This option is enabled by
20183 default but only takes effect when the selected architecture is known
20184 to support bonding.
20185
20186 @item -mmemcpy
20187 @itemx -mno-memcpy
20188 @opindex mmemcpy
20189 @opindex mno-memcpy
20190 Force (do not force) the use of @code{memcpy} for non-trivial block
20191 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
20192 most constant-sized copies.
20193
20194 @item -mlong-calls
20195 @itemx -mno-long-calls
20196 @opindex mlong-calls
20197 @opindex mno-long-calls
20198 Disable (do not disable) use of the @code{jal} instruction. Calling
20199 functions using @code{jal} is more efficient but requires the caller
20200 and callee to be in the same 256 megabyte segment.
20201
20202 This option has no effect on abicalls code. The default is
20203 @option{-mno-long-calls}.
20204
20205 @item -mmad
20206 @itemx -mno-mad
20207 @opindex mmad
20208 @opindex mno-mad
20209 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
20210 instructions, as provided by the R4650 ISA@.
20211
20212 @item -mimadd
20213 @itemx -mno-imadd
20214 @opindex mimadd
20215 @opindex mno-imadd
20216 Enable (disable) use of the @code{madd} and @code{msub} integer
20217 instructions. The default is @option{-mimadd} on architectures
20218 that support @code{madd} and @code{msub} except for the 74k
20219 architecture where it was found to generate slower code.
20220
20221 @item -mfused-madd
20222 @itemx -mno-fused-madd
20223 @opindex mfused-madd
20224 @opindex mno-fused-madd
20225 Enable (disable) use of the floating-point multiply-accumulate
20226 instructions, when they are available. The default is
20227 @option{-mfused-madd}.
20228
20229 On the R8000 CPU when multiply-accumulate instructions are used,
20230 the intermediate product is calculated to infinite precision
20231 and is not subject to the FCSR Flush to Zero bit. This may be
20232 undesirable in some circumstances. On other processors the result
20233 is numerically identical to the equivalent computation using
20234 separate multiply, add, subtract and negate instructions.
20235
20236 @item -nocpp
20237 @opindex nocpp
20238 Tell the MIPS assembler to not run its preprocessor over user
20239 assembler files (with a @samp{.s} suffix) when assembling them.
20240
20241 @item -mfix-24k
20242 @item -mno-fix-24k
20243 @opindex mfix-24k
20244 @opindex mno-fix-24k
20245 Work around the 24K E48 (lost data on stores during refill) errata.
20246 The workarounds are implemented by the assembler rather than by GCC@.
20247
20248 @item -mfix-r4000
20249 @itemx -mno-fix-r4000
20250 @opindex mfix-r4000
20251 @opindex mno-fix-r4000
20252 Work around certain R4000 CPU errata:
20253 @itemize @minus
20254 @item
20255 A double-word or a variable shift may give an incorrect result if executed
20256 immediately after starting an integer division.
20257 @item
20258 A double-word or a variable shift may give an incorrect result if executed
20259 while an integer multiplication is in progress.
20260 @item
20261 An integer division may give an incorrect result if started in a delay slot
20262 of a taken branch or a jump.
20263 @end itemize
20264
20265 @item -mfix-r4400
20266 @itemx -mno-fix-r4400
20267 @opindex mfix-r4400
20268 @opindex mno-fix-r4400
20269 Work around certain R4400 CPU errata:
20270 @itemize @minus
20271 @item
20272 A double-word or a variable shift may give an incorrect result if executed
20273 immediately after starting an integer division.
20274 @end itemize
20275
20276 @item -mfix-r10000
20277 @itemx -mno-fix-r10000
20278 @opindex mfix-r10000
20279 @opindex mno-fix-r10000
20280 Work around certain R10000 errata:
20281 @itemize @minus
20282 @item
20283 @code{ll}/@code{sc} sequences may not behave atomically on revisions
20284 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
20285 @end itemize
20286
20287 This option can only be used if the target architecture supports
20288 branch-likely instructions. @option{-mfix-r10000} is the default when
20289 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
20290 otherwise.
20291
20292 @item -mfix-rm7000
20293 @itemx -mno-fix-rm7000
20294 @opindex mfix-rm7000
20295 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
20296 workarounds are implemented by the assembler rather than by GCC@.
20297
20298 @item -mfix-vr4120
20299 @itemx -mno-fix-vr4120
20300 @opindex mfix-vr4120
20301 Work around certain VR4120 errata:
20302 @itemize @minus
20303 @item
20304 @code{dmultu} does not always produce the correct result.
20305 @item
20306 @code{div} and @code{ddiv} do not always produce the correct result if one
20307 of the operands is negative.
20308 @end itemize
20309 The workarounds for the division errata rely on special functions in
20310 @file{libgcc.a}. At present, these functions are only provided by
20311 the @code{mips64vr*-elf} configurations.
20312
20313 Other VR4120 errata require a NOP to be inserted between certain pairs of
20314 instructions. These errata are handled by the assembler, not by GCC itself.
20315
20316 @item -mfix-vr4130
20317 @opindex mfix-vr4130
20318 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
20319 workarounds are implemented by the assembler rather than by GCC,
20320 although GCC avoids using @code{mflo} and @code{mfhi} if the
20321 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
20322 instructions are available instead.
20323
20324 @item -mfix-sb1
20325 @itemx -mno-fix-sb1
20326 @opindex mfix-sb1
20327 Work around certain SB-1 CPU core errata.
20328 (This flag currently works around the SB-1 revision 2
20329 ``F1'' and ``F2'' floating-point errata.)
20330
20331 @item -mr10k-cache-barrier=@var{setting}
20332 @opindex mr10k-cache-barrier
20333 Specify whether GCC should insert cache barriers to avoid the
20334 side-effects of speculation on R10K processors.
20335
20336 In common with many processors, the R10K tries to predict the outcome
20337 of a conditional branch and speculatively executes instructions from
20338 the ``taken'' branch. It later aborts these instructions if the
20339 predicted outcome is wrong. However, on the R10K, even aborted
20340 instructions can have side effects.
20341
20342 This problem only affects kernel stores and, depending on the system,
20343 kernel loads. As an example, a speculatively-executed store may load
20344 the target memory into cache and mark the cache line as dirty, even if
20345 the store itself is later aborted. If a DMA operation writes to the
20346 same area of memory before the ``dirty'' line is flushed, the cached
20347 data overwrites the DMA-ed data. See the R10K processor manual
20348 for a full description, including other potential problems.
20349
20350 One workaround is to insert cache barrier instructions before every memory
20351 access that might be speculatively executed and that might have side
20352 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
20353 controls GCC's implementation of this workaround. It assumes that
20354 aborted accesses to any byte in the following regions does not have
20355 side effects:
20356
20357 @enumerate
20358 @item
20359 the memory occupied by the current function's stack frame;
20360
20361 @item
20362 the memory occupied by an incoming stack argument;
20363
20364 @item
20365 the memory occupied by an object with a link-time-constant address.
20366 @end enumerate
20367
20368 It is the kernel's responsibility to ensure that speculative
20369 accesses to these regions are indeed safe.
20370
20371 If the input program contains a function declaration such as:
20372
20373 @smallexample
20374 void foo (void);
20375 @end smallexample
20376
20377 then the implementation of @code{foo} must allow @code{j foo} and
20378 @code{jal foo} to be executed speculatively. GCC honors this
20379 restriction for functions it compiles itself. It expects non-GCC
20380 functions (such as hand-written assembly code) to do the same.
20381
20382 The option has three forms:
20383
20384 @table @gcctabopt
20385 @item -mr10k-cache-barrier=load-store
20386 Insert a cache barrier before a load or store that might be
20387 speculatively executed and that might have side effects even
20388 if aborted.
20389
20390 @item -mr10k-cache-barrier=store
20391 Insert a cache barrier before a store that might be speculatively
20392 executed and that might have side effects even if aborted.
20393
20394 @item -mr10k-cache-barrier=none
20395 Disable the insertion of cache barriers. This is the default setting.
20396 @end table
20397
20398 @item -mflush-func=@var{func}
20399 @itemx -mno-flush-func
20400 @opindex mflush-func
20401 Specifies the function to call to flush the I and D caches, or to not
20402 call any such function. If called, the function must take the same
20403 arguments as the common @code{_flush_func}, that is, the address of the
20404 memory range for which the cache is being flushed, the size of the
20405 memory range, and the number 3 (to flush both caches). The default
20406 depends on the target GCC was configured for, but commonly is either
20407 @code{_flush_func} or @code{__cpu_flush}.
20408
20409 @item mbranch-cost=@var{num}
20410 @opindex mbranch-cost
20411 Set the cost of branches to roughly @var{num} ``simple'' instructions.
20412 This cost is only a heuristic and is not guaranteed to produce
20413 consistent results across releases. A zero cost redundantly selects
20414 the default, which is based on the @option{-mtune} setting.
20415
20416 @item -mbranch-likely
20417 @itemx -mno-branch-likely
20418 @opindex mbranch-likely
20419 @opindex mno-branch-likely
20420 Enable or disable use of Branch Likely instructions, regardless of the
20421 default for the selected architecture. By default, Branch Likely
20422 instructions may be generated if they are supported by the selected
20423 architecture. An exception is for the MIPS32 and MIPS64 architectures
20424 and processors that implement those architectures; for those, Branch
20425 Likely instructions are not be generated by default because the MIPS32
20426 and MIPS64 architectures specifically deprecate their use.
20427
20428 @item -mcompact-branches=never
20429 @itemx -mcompact-branches=optimal
20430 @itemx -mcompact-branches=always
20431 @opindex mcompact-branches=never
20432 @opindex mcompact-branches=optimal
20433 @opindex mcompact-branches=always
20434 These options control which form of branches will be generated. The
20435 default is @option{-mcompact-branches=optimal}.
20436
20437 The @option{-mcompact-branches=never} option ensures that compact branch
20438 instructions will never be generated.
20439
20440 The @option{-mcompact-branches=always} option ensures that a compact
20441 branch instruction will be generated if available. If a compact branch
20442 instruction is not available, a delay slot form of the branch will be
20443 used instead.
20444
20445 This option is supported from MIPS Release 6 onwards.
20446
20447 The @option{-mcompact-branches=optimal} option will cause a delay slot
20448 branch to be used if one is available in the current ISA and the delay
20449 slot is successfully filled. If the delay slot is not filled, a compact
20450 branch will be chosen if one is available.
20451
20452 @item -mfp-exceptions
20453 @itemx -mno-fp-exceptions
20454 @opindex mfp-exceptions
20455 Specifies whether FP exceptions are enabled. This affects how
20456 FP instructions are scheduled for some processors.
20457 The default is that FP exceptions are
20458 enabled.
20459
20460 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
20461 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
20462 FP pipe.
20463
20464 @item -mvr4130-align
20465 @itemx -mno-vr4130-align
20466 @opindex mvr4130-align
20467 The VR4130 pipeline is two-way superscalar, but can only issue two
20468 instructions together if the first one is 8-byte aligned. When this
20469 option is enabled, GCC aligns pairs of instructions that it
20470 thinks should execute in parallel.
20471
20472 This option only has an effect when optimizing for the VR4130.
20473 It normally makes code faster, but at the expense of making it bigger.
20474 It is enabled by default at optimization level @option{-O3}.
20475
20476 @item -msynci
20477 @itemx -mno-synci
20478 @opindex msynci
20479 Enable (disable) generation of @code{synci} instructions on
20480 architectures that support it. The @code{synci} instructions (if
20481 enabled) are generated when @code{__builtin___clear_cache} is
20482 compiled.
20483
20484 This option defaults to @option{-mno-synci}, but the default can be
20485 overridden by configuring GCC with @option{--with-synci}.
20486
20487 When compiling code for single processor systems, it is generally safe
20488 to use @code{synci}. However, on many multi-core (SMP) systems, it
20489 does not invalidate the instruction caches on all cores and may lead
20490 to undefined behavior.
20491
20492 @item -mrelax-pic-calls
20493 @itemx -mno-relax-pic-calls
20494 @opindex mrelax-pic-calls
20495 Try to turn PIC calls that are normally dispatched via register
20496 @code{$25} into direct calls. This is only possible if the linker can
20497 resolve the destination at link time and if the destination is within
20498 range for a direct call.
20499
20500 @option{-mrelax-pic-calls} is the default if GCC was configured to use
20501 an assembler and a linker that support the @code{.reloc} assembly
20502 directive and @option{-mexplicit-relocs} is in effect. With
20503 @option{-mno-explicit-relocs}, this optimization can be performed by the
20504 assembler and the linker alone without help from the compiler.
20505
20506 @item -mmcount-ra-address
20507 @itemx -mno-mcount-ra-address
20508 @opindex mmcount-ra-address
20509 @opindex mno-mcount-ra-address
20510 Emit (do not emit) code that allows @code{_mcount} to modify the
20511 calling function's return address. When enabled, this option extends
20512 the usual @code{_mcount} interface with a new @var{ra-address}
20513 parameter, which has type @code{intptr_t *} and is passed in register
20514 @code{$12}. @code{_mcount} can then modify the return address by
20515 doing both of the following:
20516 @itemize
20517 @item
20518 Returning the new address in register @code{$31}.
20519 @item
20520 Storing the new address in @code{*@var{ra-address}},
20521 if @var{ra-address} is nonnull.
20522 @end itemize
20523
20524 The default is @option{-mno-mcount-ra-address}.
20525
20526 @item -mframe-header-opt
20527 @itemx -mno-frame-header-opt
20528 @opindex mframe-header-opt
20529 Enable (disable) frame header optimization in the o32 ABI. When using the
20530 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
20531 function to write out register arguments. When enabled, this optimization
20532 will suppress the allocation of the frame header if it can be determined that
20533 it is unused.
20534
20535 This optimization is off by default at all optimization levels.
20536
20537 @item -mlxc1-sxc1
20538 @itemx -mno-lxc1-sxc1
20539 @opindex mlxc1-sxc1
20540 When applicable, enable (disable) the generation of @code{lwxc1},
20541 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
20542
20543 @item -mmadd4
20544 @itemx -mno-madd4
20545 @opindex mmadd4
20546 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
20547 @code{madd.d} and related instructions. Enabled by default.
20548
20549 @end table
20550
20551 @node MMIX Options
20552 @subsection MMIX Options
20553 @cindex MMIX Options
20554
20555 These options are defined for the MMIX:
20556
20557 @table @gcctabopt
20558 @item -mlibfuncs
20559 @itemx -mno-libfuncs
20560 @opindex mlibfuncs
20561 @opindex mno-libfuncs
20562 Specify that intrinsic library functions are being compiled, passing all
20563 values in registers, no matter the size.
20564
20565 @item -mepsilon
20566 @itemx -mno-epsilon
20567 @opindex mepsilon
20568 @opindex mno-epsilon
20569 Generate floating-point comparison instructions that compare with respect
20570 to the @code{rE} epsilon register.
20571
20572 @item -mabi=mmixware
20573 @itemx -mabi=gnu
20574 @opindex mabi=mmixware
20575 @opindex mabi=gnu
20576 Generate code that passes function parameters and return values that (in
20577 the called function) are seen as registers @code{$0} and up, as opposed to
20578 the GNU ABI which uses global registers @code{$231} and up.
20579
20580 @item -mzero-extend
20581 @itemx -mno-zero-extend
20582 @opindex mzero-extend
20583 @opindex mno-zero-extend
20584 When reading data from memory in sizes shorter than 64 bits, use (do not
20585 use) zero-extending load instructions by default, rather than
20586 sign-extending ones.
20587
20588 @item -mknuthdiv
20589 @itemx -mno-knuthdiv
20590 @opindex mknuthdiv
20591 @opindex mno-knuthdiv
20592 Make the result of a division yielding a remainder have the same sign as
20593 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
20594 remainder follows the sign of the dividend. Both methods are
20595 arithmetically valid, the latter being almost exclusively used.
20596
20597 @item -mtoplevel-symbols
20598 @itemx -mno-toplevel-symbols
20599 @opindex mtoplevel-symbols
20600 @opindex mno-toplevel-symbols
20601 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
20602 code can be used with the @code{PREFIX} assembly directive.
20603
20604 @item -melf
20605 @opindex melf
20606 Generate an executable in the ELF format, rather than the default
20607 @samp{mmo} format used by the @command{mmix} simulator.
20608
20609 @item -mbranch-predict
20610 @itemx -mno-branch-predict
20611 @opindex mbranch-predict
20612 @opindex mno-branch-predict
20613 Use (do not use) the probable-branch instructions, when static branch
20614 prediction indicates a probable branch.
20615
20616 @item -mbase-addresses
20617 @itemx -mno-base-addresses
20618 @opindex mbase-addresses
20619 @opindex mno-base-addresses
20620 Generate (do not generate) code that uses @emph{base addresses}. Using a
20621 base address automatically generates a request (handled by the assembler
20622 and the linker) for a constant to be set up in a global register. The
20623 register is used for one or more base address requests within the range 0
20624 to 255 from the value held in the register. The generally leads to short
20625 and fast code, but the number of different data items that can be
20626 addressed is limited. This means that a program that uses lots of static
20627 data may require @option{-mno-base-addresses}.
20628
20629 @item -msingle-exit
20630 @itemx -mno-single-exit
20631 @opindex msingle-exit
20632 @opindex mno-single-exit
20633 Force (do not force) generated code to have a single exit point in each
20634 function.
20635 @end table
20636
20637 @node MN10300 Options
20638 @subsection MN10300 Options
20639 @cindex MN10300 options
20640
20641 These @option{-m} options are defined for Matsushita MN10300 architectures:
20642
20643 @table @gcctabopt
20644 @item -mmult-bug
20645 @opindex mmult-bug
20646 Generate code to avoid bugs in the multiply instructions for the MN10300
20647 processors. This is the default.
20648
20649 @item -mno-mult-bug
20650 @opindex mno-mult-bug
20651 Do not generate code to avoid bugs in the multiply instructions for the
20652 MN10300 processors.
20653
20654 @item -mam33
20655 @opindex mam33
20656 Generate code using features specific to the AM33 processor.
20657
20658 @item -mno-am33
20659 @opindex mno-am33
20660 Do not generate code using features specific to the AM33 processor. This
20661 is the default.
20662
20663 @item -mam33-2
20664 @opindex mam33-2
20665 Generate code using features specific to the AM33/2.0 processor.
20666
20667 @item -mam34
20668 @opindex mam34
20669 Generate code using features specific to the AM34 processor.
20670
20671 @item -mtune=@var{cpu-type}
20672 @opindex mtune
20673 Use the timing characteristics of the indicated CPU type when
20674 scheduling instructions. This does not change the targeted processor
20675 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
20676 @samp{am33-2} or @samp{am34}.
20677
20678 @item -mreturn-pointer-on-d0
20679 @opindex mreturn-pointer-on-d0
20680 When generating a function that returns a pointer, return the pointer
20681 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
20682 only in @code{a0}, and attempts to call such functions without a prototype
20683 result in errors. Note that this option is on by default; use
20684 @option{-mno-return-pointer-on-d0} to disable it.
20685
20686 @item -mno-crt0
20687 @opindex mno-crt0
20688 Do not link in the C run-time initialization object file.
20689
20690 @item -mrelax
20691 @opindex mrelax
20692 Indicate to the linker that it should perform a relaxation optimization pass
20693 to shorten branches, calls and absolute memory addresses. This option only
20694 has an effect when used on the command line for the final link step.
20695
20696 This option makes symbolic debugging impossible.
20697
20698 @item -mliw
20699 @opindex mliw
20700 Allow the compiler to generate @emph{Long Instruction Word}
20701 instructions if the target is the @samp{AM33} or later. This is the
20702 default. This option defines the preprocessor macro @code{__LIW__}.
20703
20704 @item -mnoliw
20705 @opindex mnoliw
20706 Do not allow the compiler to generate @emph{Long Instruction Word}
20707 instructions. This option defines the preprocessor macro
20708 @code{__NO_LIW__}.
20709
20710 @item -msetlb
20711 @opindex msetlb
20712 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
20713 instructions if the target is the @samp{AM33} or later. This is the
20714 default. This option defines the preprocessor macro @code{__SETLB__}.
20715
20716 @item -mnosetlb
20717 @opindex mnosetlb
20718 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
20719 instructions. This option defines the preprocessor macro
20720 @code{__NO_SETLB__}.
20721
20722 @end table
20723
20724 @node Moxie Options
20725 @subsection Moxie Options
20726 @cindex Moxie Options
20727
20728 @table @gcctabopt
20729
20730 @item -meb
20731 @opindex meb
20732 Generate big-endian code. This is the default for @samp{moxie-*-*}
20733 configurations.
20734
20735 @item -mel
20736 @opindex mel
20737 Generate little-endian code.
20738
20739 @item -mmul.x
20740 @opindex mmul.x
20741 Generate mul.x and umul.x instructions. This is the default for
20742 @samp{moxiebox-*-*} configurations.
20743
20744 @item -mno-crt0
20745 @opindex mno-crt0
20746 Do not link in the C run-time initialization object file.
20747
20748 @end table
20749
20750 @node MSP430 Options
20751 @subsection MSP430 Options
20752 @cindex MSP430 Options
20753
20754 These options are defined for the MSP430:
20755
20756 @table @gcctabopt
20757
20758 @item -masm-hex
20759 @opindex masm-hex
20760 Force assembly output to always use hex constants. Normally such
20761 constants are signed decimals, but this option is available for
20762 testsuite and/or aesthetic purposes.
20763
20764 @item -mmcu=
20765 @opindex mmcu=
20766 Select the MCU to target. This is used to create a C preprocessor
20767 symbol based upon the MCU name, converted to upper case and pre- and
20768 post-fixed with @samp{__}. This in turn is used by the
20769 @file{msp430.h} header file to select an MCU-specific supplementary
20770 header file.
20771
20772 The option also sets the ISA to use. If the MCU name is one that is
20773 known to only support the 430 ISA then that is selected, otherwise the
20774 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
20775 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
20776 name selects the 430X ISA.
20777
20778 In addition an MCU-specific linker script is added to the linker
20779 command line. The script's name is the name of the MCU with
20780 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
20781 command line defines the C preprocessor symbol @code{__XXX__} and
20782 cause the linker to search for a script called @file{xxx.ld}.
20783
20784 This option is also passed on to the assembler.
20785
20786 @item -mwarn-mcu
20787 @itemx -mno-warn-mcu
20788 @opindex mwarn-mcu
20789 @opindex mno-warn-mcu
20790 This option enables or disables warnings about conflicts between the
20791 MCU name specified by the @option{-mmcu} option and the ISA set by the
20792 @option{-mcpu} option and/or the hardware multiply support set by the
20793 @option{-mhwmult} option. It also toggles warnings about unrecognized
20794 MCU names. This option is on by default.
20795
20796 @item -mcpu=
20797 @opindex mcpu=
20798 Specifies the ISA to use. Accepted values are @samp{msp430},
20799 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
20800 @option{-mmcu=} option should be used to select the ISA.
20801
20802 @item -msim
20803 @opindex msim
20804 Link to the simulator runtime libraries and linker script. Overrides
20805 any scripts that would be selected by the @option{-mmcu=} option.
20806
20807 @item -mlarge
20808 @opindex mlarge
20809 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
20810
20811 @item -msmall
20812 @opindex msmall
20813 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
20814
20815 @item -mrelax
20816 @opindex mrelax
20817 This option is passed to the assembler and linker, and allows the
20818 linker to perform certain optimizations that cannot be done until
20819 the final link.
20820
20821 @item mhwmult=
20822 @opindex mhwmult=
20823 Describes the type of hardware multiply supported by the target.
20824 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
20825 for the original 16-bit-only multiply supported by early MCUs.
20826 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
20827 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
20828 A value of @samp{auto} can also be given. This tells GCC to deduce
20829 the hardware multiply support based upon the MCU name provided by the
20830 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
20831 the MCU name is not recognized then no hardware multiply support is
20832 assumed. @code{auto} is the default setting.
20833
20834 Hardware multiplies are normally performed by calling a library
20835 routine. This saves space in the generated code. When compiling at
20836 @option{-O3} or higher however the hardware multiplier is invoked
20837 inline. This makes for bigger, but faster code.
20838
20839 The hardware multiply routines disable interrupts whilst running and
20840 restore the previous interrupt state when they finish. This makes
20841 them safe to use inside interrupt handlers as well as in normal code.
20842
20843 @item -minrt
20844 @opindex minrt
20845 Enable the use of a minimum runtime environment - no static
20846 initializers or constructors. This is intended for memory-constrained
20847 devices. The compiler includes special symbols in some objects
20848 that tell the linker and runtime which code fragments are required.
20849
20850 @item -mcode-region=
20851 @itemx -mdata-region=
20852 @opindex mcode-region
20853 @opindex mdata-region
20854 These options tell the compiler where to place functions and data that
20855 do not have one of the @code{lower}, @code{upper}, @code{either} or
20856 @code{section} attributes. Possible values are @code{lower},
20857 @code{upper}, @code{either} or @code{any}. The first three behave
20858 like the corresponding attribute. The fourth possible value -
20859 @code{any} - is the default. It leaves placement entirely up to the
20860 linker script and how it assigns the standard sections
20861 (@code{.text}, @code{.data}, etc) to the memory regions.
20862
20863 @item -msilicon-errata=
20864 @opindex msilicon-errata
20865 This option passes on a request to assembler to enable the fixes for
20866 the named silicon errata.
20867
20868 @item -msilicon-errata-warn=
20869 @opindex msilicon-errata-warn
20870 This option passes on a request to the assembler to enable warning
20871 messages when a silicon errata might need to be applied.
20872
20873 @end table
20874
20875 @node NDS32 Options
20876 @subsection NDS32 Options
20877 @cindex NDS32 Options
20878
20879 These options are defined for NDS32 implementations:
20880
20881 @table @gcctabopt
20882
20883 @item -mbig-endian
20884 @opindex mbig-endian
20885 Generate code in big-endian mode.
20886
20887 @item -mlittle-endian
20888 @opindex mlittle-endian
20889 Generate code in little-endian mode.
20890
20891 @item -mreduced-regs
20892 @opindex mreduced-regs
20893 Use reduced-set registers for register allocation.
20894
20895 @item -mfull-regs
20896 @opindex mfull-regs
20897 Use full-set registers for register allocation.
20898
20899 @item -mcmov
20900 @opindex mcmov
20901 Generate conditional move instructions.
20902
20903 @item -mno-cmov
20904 @opindex mno-cmov
20905 Do not generate conditional move instructions.
20906
20907 @item -mperf-ext
20908 @opindex mperf-ext
20909 Generate performance extension instructions.
20910
20911 @item -mno-perf-ext
20912 @opindex mno-perf-ext
20913 Do not generate performance extension instructions.
20914
20915 @item -mv3push
20916 @opindex mv3push
20917 Generate v3 push25/pop25 instructions.
20918
20919 @item -mno-v3push
20920 @opindex mno-v3push
20921 Do not generate v3 push25/pop25 instructions.
20922
20923 @item -m16-bit
20924 @opindex m16-bit
20925 Generate 16-bit instructions.
20926
20927 @item -mno-16-bit
20928 @opindex mno-16-bit
20929 Do not generate 16-bit instructions.
20930
20931 @item -misr-vector-size=@var{num}
20932 @opindex misr-vector-size
20933 Specify the size of each interrupt vector, which must be 4 or 16.
20934
20935 @item -mcache-block-size=@var{num}
20936 @opindex mcache-block-size
20937 Specify the size of each cache block,
20938 which must be a power of 2 between 4 and 512.
20939
20940 @item -march=@var{arch}
20941 @opindex march
20942 Specify the name of the target architecture.
20943
20944 @item -mcmodel=@var{code-model}
20945 @opindex mcmodel
20946 Set the code model to one of
20947 @table @asis
20948 @item @samp{small}
20949 All the data and read-only data segments must be within 512KB addressing space.
20950 The text segment must be within 16MB addressing space.
20951 @item @samp{medium}
20952 The data segment must be within 512KB while the read-only data segment can be
20953 within 4GB addressing space. The text segment should be still within 16MB
20954 addressing space.
20955 @item @samp{large}
20956 All the text and data segments can be within 4GB addressing space.
20957 @end table
20958
20959 @item -mctor-dtor
20960 @opindex mctor-dtor
20961 Enable constructor/destructor feature.
20962
20963 @item -mrelax
20964 @opindex mrelax
20965 Guide linker to relax instructions.
20966
20967 @end table
20968
20969 @node Nios II Options
20970 @subsection Nios II Options
20971 @cindex Nios II options
20972 @cindex Altera Nios II options
20973
20974 These are the options defined for the Altera Nios II processor.
20975
20976 @table @gcctabopt
20977
20978 @item -G @var{num}
20979 @opindex G
20980 @cindex smaller data references
20981 Put global and static objects less than or equal to @var{num} bytes
20982 into the small data or BSS sections instead of the normal data or BSS
20983 sections. The default value of @var{num} is 8.
20984
20985 @item -mgpopt=@var{option}
20986 @item -mgpopt
20987 @itemx -mno-gpopt
20988 @opindex mgpopt
20989 @opindex mno-gpopt
20990 Generate (do not generate) GP-relative accesses. The following
20991 @var{option} names are recognized:
20992
20993 @table @samp
20994
20995 @item none
20996 Do not generate GP-relative accesses.
20997
20998 @item local
20999 Generate GP-relative accesses for small data objects that are not
21000 external, weak, or uninitialized common symbols.
21001 Also use GP-relative addressing for objects that
21002 have been explicitly placed in a small data section via a @code{section}
21003 attribute.
21004
21005 @item global
21006 As for @samp{local}, but also generate GP-relative accesses for
21007 small data objects that are external, weak, or common. If you use this option,
21008 you must ensure that all parts of your program (including libraries) are
21009 compiled with the same @option{-G} setting.
21010
21011 @item data
21012 Generate GP-relative accesses for all data objects in the program. If you
21013 use this option, the entire data and BSS segments
21014 of your program must fit in 64K of memory and you must use an appropriate
21015 linker script to allocate them within the addressable range of the
21016 global pointer.
21017
21018 @item all
21019 Generate GP-relative addresses for function pointers as well as data
21020 pointers. If you use this option, the entire text, data, and BSS segments
21021 of your program must fit in 64K of memory and you must use an appropriate
21022 linker script to allocate them within the addressable range of the
21023 global pointer.
21024
21025 @end table
21026
21027 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
21028 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
21029
21030 The default is @option{-mgpopt} except when @option{-fpic} or
21031 @option{-fPIC} is specified to generate position-independent code.
21032 Note that the Nios II ABI does not permit GP-relative accesses from
21033 shared libraries.
21034
21035 You may need to specify @option{-mno-gpopt} explicitly when building
21036 programs that include large amounts of small data, including large
21037 GOT data sections. In this case, the 16-bit offset for GP-relative
21038 addressing may not be large enough to allow access to the entire
21039 small data section.
21040
21041 @item -mel
21042 @itemx -meb
21043 @opindex mel
21044 @opindex meb
21045 Generate little-endian (default) or big-endian (experimental) code,
21046 respectively.
21047
21048 @item -march=@var{arch}
21049 @opindex march
21050 This specifies the name of the target Nios II architecture. GCC uses this
21051 name to determine what kind of instructions it can emit when generating
21052 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
21053
21054 The preprocessor macro @code{__nios2_arch__} is available to programs,
21055 with value 1 or 2, indicating the targeted ISA level.
21056
21057 @item -mbypass-cache
21058 @itemx -mno-bypass-cache
21059 @opindex mno-bypass-cache
21060 @opindex mbypass-cache
21061 Force all load and store instructions to always bypass cache by
21062 using I/O variants of the instructions. The default is not to
21063 bypass the cache.
21064
21065 @item -mno-cache-volatile
21066 @itemx -mcache-volatile
21067 @opindex mcache-volatile
21068 @opindex mno-cache-volatile
21069 Volatile memory access bypass the cache using the I/O variants of
21070 the load and store instructions. The default is not to bypass the cache.
21071
21072 @item -mno-fast-sw-div
21073 @itemx -mfast-sw-div
21074 @opindex mno-fast-sw-div
21075 @opindex mfast-sw-div
21076 Do not use table-based fast divide for small numbers. The default
21077 is to use the fast divide at @option{-O3} and above.
21078
21079 @item -mno-hw-mul
21080 @itemx -mhw-mul
21081 @itemx -mno-hw-mulx
21082 @itemx -mhw-mulx
21083 @itemx -mno-hw-div
21084 @itemx -mhw-div
21085 @opindex mno-hw-mul
21086 @opindex mhw-mul
21087 @opindex mno-hw-mulx
21088 @opindex mhw-mulx
21089 @opindex mno-hw-div
21090 @opindex mhw-div
21091 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
21092 instructions by the compiler. The default is to emit @code{mul}
21093 and not emit @code{div} and @code{mulx}.
21094
21095 @item -mbmx
21096 @itemx -mno-bmx
21097 @itemx -mcdx
21098 @itemx -mno-cdx
21099 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
21100 CDX (code density) instructions. Enabling these instructions also
21101 requires @option{-march=r2}. Since these instructions are optional
21102 extensions to the R2 architecture, the default is not to emit them.
21103
21104 @item -mcustom-@var{insn}=@var{N}
21105 @itemx -mno-custom-@var{insn}
21106 @opindex mcustom-@var{insn}
21107 @opindex mno-custom-@var{insn}
21108 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
21109 custom instruction with encoding @var{N} when generating code that uses
21110 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
21111 instruction 253 for single-precision floating-point add operations instead
21112 of the default behavior of using a library call.
21113
21114 The following values of @var{insn} are supported. Except as otherwise
21115 noted, floating-point operations are expected to be implemented with
21116 normal IEEE 754 semantics and correspond directly to the C operators or the
21117 equivalent GCC built-in functions (@pxref{Other Builtins}).
21118
21119 Single-precision floating point:
21120 @table @asis
21121
21122 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
21123 Binary arithmetic operations.
21124
21125 @item @samp{fnegs}
21126 Unary negation.
21127
21128 @item @samp{fabss}
21129 Unary absolute value.
21130
21131 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
21132 Comparison operations.
21133
21134 @item @samp{fmins}, @samp{fmaxs}
21135 Floating-point minimum and maximum. These instructions are only
21136 generated if @option{-ffinite-math-only} is specified.
21137
21138 @item @samp{fsqrts}
21139 Unary square root operation.
21140
21141 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
21142 Floating-point trigonometric and exponential functions. These instructions
21143 are only generated if @option{-funsafe-math-optimizations} is also specified.
21144
21145 @end table
21146
21147 Double-precision floating point:
21148 @table @asis
21149
21150 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
21151 Binary arithmetic operations.
21152
21153 @item @samp{fnegd}
21154 Unary negation.
21155
21156 @item @samp{fabsd}
21157 Unary absolute value.
21158
21159 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
21160 Comparison operations.
21161
21162 @item @samp{fmind}, @samp{fmaxd}
21163 Double-precision minimum and maximum. These instructions are only
21164 generated if @option{-ffinite-math-only} is specified.
21165
21166 @item @samp{fsqrtd}
21167 Unary square root operation.
21168
21169 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
21170 Double-precision trigonometric and exponential functions. These instructions
21171 are only generated if @option{-funsafe-math-optimizations} is also specified.
21172
21173 @end table
21174
21175 Conversions:
21176 @table @asis
21177 @item @samp{fextsd}
21178 Conversion from single precision to double precision.
21179
21180 @item @samp{ftruncds}
21181 Conversion from double precision to single precision.
21182
21183 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
21184 Conversion from floating point to signed or unsigned integer types, with
21185 truncation towards zero.
21186
21187 @item @samp{round}
21188 Conversion from single-precision floating point to signed integer,
21189 rounding to the nearest integer and ties away from zero.
21190 This corresponds to the @code{__builtin_lroundf} function when
21191 @option{-fno-math-errno} is used.
21192
21193 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
21194 Conversion from signed or unsigned integer types to floating-point types.
21195
21196 @end table
21197
21198 In addition, all of the following transfer instructions for internal
21199 registers X and Y must be provided to use any of the double-precision
21200 floating-point instructions. Custom instructions taking two
21201 double-precision source operands expect the first operand in the
21202 64-bit register X. The other operand (or only operand of a unary
21203 operation) is given to the custom arithmetic instruction with the
21204 least significant half in source register @var{src1} and the most
21205 significant half in @var{src2}. A custom instruction that returns a
21206 double-precision result returns the most significant 32 bits in the
21207 destination register and the other half in 32-bit register Y.
21208 GCC automatically generates the necessary code sequences to write
21209 register X and/or read register Y when double-precision floating-point
21210 instructions are used.
21211
21212 @table @asis
21213
21214 @item @samp{fwrx}
21215 Write @var{src1} into the least significant half of X and @var{src2} into
21216 the most significant half of X.
21217
21218 @item @samp{fwry}
21219 Write @var{src1} into Y.
21220
21221 @item @samp{frdxhi}, @samp{frdxlo}
21222 Read the most or least (respectively) significant half of X and store it in
21223 @var{dest}.
21224
21225 @item @samp{frdy}
21226 Read the value of Y and store it into @var{dest}.
21227 @end table
21228
21229 Note that you can gain more local control over generation of Nios II custom
21230 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
21231 and @code{target("no-custom-@var{insn}")} function attributes
21232 (@pxref{Function Attributes})
21233 or pragmas (@pxref{Function Specific Option Pragmas}).
21234
21235 @item -mcustom-fpu-cfg=@var{name}
21236 @opindex mcustom-fpu-cfg
21237
21238 This option enables a predefined, named set of custom instruction encodings
21239 (see @option{-mcustom-@var{insn}} above).
21240 Currently, the following sets are defined:
21241
21242 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
21243 @gccoptlist{-mcustom-fmuls=252 @gol
21244 -mcustom-fadds=253 @gol
21245 -mcustom-fsubs=254 @gol
21246 -fsingle-precision-constant}
21247
21248 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
21249 @gccoptlist{-mcustom-fmuls=252 @gol
21250 -mcustom-fadds=253 @gol
21251 -mcustom-fsubs=254 @gol
21252 -mcustom-fdivs=255 @gol
21253 -fsingle-precision-constant}
21254
21255 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
21256 @gccoptlist{-mcustom-floatus=243 @gol
21257 -mcustom-fixsi=244 @gol
21258 -mcustom-floatis=245 @gol
21259 -mcustom-fcmpgts=246 @gol
21260 -mcustom-fcmples=249 @gol
21261 -mcustom-fcmpeqs=250 @gol
21262 -mcustom-fcmpnes=251 @gol
21263 -mcustom-fmuls=252 @gol
21264 -mcustom-fadds=253 @gol
21265 -mcustom-fsubs=254 @gol
21266 -mcustom-fdivs=255 @gol
21267 -fsingle-precision-constant}
21268
21269 Custom instruction assignments given by individual
21270 @option{-mcustom-@var{insn}=} options override those given by
21271 @option{-mcustom-fpu-cfg=}, regardless of the
21272 order of the options on the command line.
21273
21274 Note that you can gain more local control over selection of a FPU
21275 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
21276 function attribute (@pxref{Function Attributes})
21277 or pragma (@pxref{Function Specific Option Pragmas}).
21278
21279 @end table
21280
21281 These additional @samp{-m} options are available for the Altera Nios II
21282 ELF (bare-metal) target:
21283
21284 @table @gcctabopt
21285
21286 @item -mhal
21287 @opindex mhal
21288 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
21289 startup and termination code, and is typically used in conjunction with
21290 @option{-msys-crt0=} to specify the location of the alternate startup code
21291 provided by the HAL BSP.
21292
21293 @item -msmallc
21294 @opindex msmallc
21295 Link with a limited version of the C library, @option{-lsmallc}, rather than
21296 Newlib.
21297
21298 @item -msys-crt0=@var{startfile}
21299 @opindex msys-crt0
21300 @var{startfile} is the file name of the startfile (crt0) to use
21301 when linking. This option is only useful in conjunction with @option{-mhal}.
21302
21303 @item -msys-lib=@var{systemlib}
21304 @opindex msys-lib
21305 @var{systemlib} is the library name of the library that provides
21306 low-level system calls required by the C library,
21307 e.g. @code{read} and @code{write}.
21308 This option is typically used to link with a library provided by a HAL BSP.
21309
21310 @end table
21311
21312 @node Nvidia PTX Options
21313 @subsection Nvidia PTX Options
21314 @cindex Nvidia PTX options
21315 @cindex nvptx options
21316
21317 These options are defined for Nvidia PTX:
21318
21319 @table @gcctabopt
21320
21321 @item -m32
21322 @itemx -m64
21323 @opindex m32
21324 @opindex m64
21325 Generate code for 32-bit or 64-bit ABI.
21326
21327 @item -mmainkernel
21328 @opindex mmainkernel
21329 Link in code for a __main kernel. This is for stand-alone instead of
21330 offloading execution.
21331
21332 @item -moptimize
21333 @opindex moptimize
21334 Apply partitioned execution optimizations. This is the default when any
21335 level of optimization is selected.
21336
21337 @item -msoft-stack
21338 @opindex msoft-stack
21339 Generate code that does not use @code{.local} memory
21340 directly for stack storage. Instead, a per-warp stack pointer is
21341 maintained explicitly. This enables variable-length stack allocation (with
21342 variable-length arrays or @code{alloca}), and when global memory is used for
21343 underlying storage, makes it possible to access automatic variables from other
21344 threads, or with atomic instructions. This code generation variant is used
21345 for OpenMP offloading, but the option is exposed on its own for the purpose
21346 of testing the compiler; to generate code suitable for linking into programs
21347 using OpenMP offloading, use option @option{-mgomp}.
21348
21349 @item -muniform-simt
21350 @opindex muniform-simt
21351 Switch to code generation variant that allows to execute all threads in each
21352 warp, while maintaining memory state and side effects as if only one thread
21353 in each warp was active outside of OpenMP SIMD regions. All atomic operations
21354 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
21355 current lane index equals the master lane index), and the register being
21356 assigned is copied via a shuffle instruction from the master lane. Outside of
21357 SIMD regions lane 0 is the master; inside, each thread sees itself as the
21358 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
21359 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
21360 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
21361 with current lane index to compute the master lane index.
21362
21363 @item -mgomp
21364 @opindex mgomp
21365 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
21366 @option{-muniform-simt} options, and selects corresponding multilib variant.
21367
21368 @end table
21369
21370 @node PDP-11 Options
21371 @subsection PDP-11 Options
21372 @cindex PDP-11 Options
21373
21374 These options are defined for the PDP-11:
21375
21376 @table @gcctabopt
21377 @item -mfpu
21378 @opindex mfpu
21379 Use hardware FPP floating point. This is the default. (FIS floating
21380 point on the PDP-11/40 is not supported.)
21381
21382 @item -msoft-float
21383 @opindex msoft-float
21384 Do not use hardware floating point.
21385
21386 @item -mac0
21387 @opindex mac0
21388 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
21389
21390 @item -mno-ac0
21391 @opindex mno-ac0
21392 Return floating-point results in memory. This is the default.
21393
21394 @item -m40
21395 @opindex m40
21396 Generate code for a PDP-11/40.
21397
21398 @item -m45
21399 @opindex m45
21400 Generate code for a PDP-11/45. This is the default.
21401
21402 @item -m10
21403 @opindex m10
21404 Generate code for a PDP-11/10.
21405
21406 @item -mbcopy-builtin
21407 @opindex mbcopy-builtin
21408 Use inline @code{movmemhi} patterns for copying memory. This is the
21409 default.
21410
21411 @item -mbcopy
21412 @opindex mbcopy
21413 Do not use inline @code{movmemhi} patterns for copying memory.
21414
21415 @item -mint16
21416 @itemx -mno-int32
21417 @opindex mint16
21418 @opindex mno-int32
21419 Use 16-bit @code{int}. This is the default.
21420
21421 @item -mint32
21422 @itemx -mno-int16
21423 @opindex mint32
21424 @opindex mno-int16
21425 Use 32-bit @code{int}.
21426
21427 @item -mfloat64
21428 @itemx -mno-float32
21429 @opindex mfloat64
21430 @opindex mno-float32
21431 Use 64-bit @code{float}. This is the default.
21432
21433 @item -mfloat32
21434 @itemx -mno-float64
21435 @opindex mfloat32
21436 @opindex mno-float64
21437 Use 32-bit @code{float}.
21438
21439 @item -mabshi
21440 @opindex mabshi
21441 Use @code{abshi2} pattern. This is the default.
21442
21443 @item -mno-abshi
21444 @opindex mno-abshi
21445 Do not use @code{abshi2} pattern.
21446
21447 @item -mbranch-expensive
21448 @opindex mbranch-expensive
21449 Pretend that branches are expensive. This is for experimenting with
21450 code generation only.
21451
21452 @item -mbranch-cheap
21453 @opindex mbranch-cheap
21454 Do not pretend that branches are expensive. This is the default.
21455
21456 @item -munix-asm
21457 @opindex munix-asm
21458 Use Unix assembler syntax. This is the default when configured for
21459 @samp{pdp11-*-bsd}.
21460
21461 @item -mdec-asm
21462 @opindex mdec-asm
21463 Use DEC assembler syntax. This is the default when configured for any
21464 PDP-11 target other than @samp{pdp11-*-bsd}.
21465 @end table
21466
21467 @node picoChip Options
21468 @subsection picoChip Options
21469 @cindex picoChip options
21470
21471 These @samp{-m} options are defined for picoChip implementations:
21472
21473 @table @gcctabopt
21474
21475 @item -mae=@var{ae_type}
21476 @opindex mcpu
21477 Set the instruction set, register set, and instruction scheduling
21478 parameters for array element type @var{ae_type}. Supported values
21479 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
21480
21481 @option{-mae=ANY} selects a completely generic AE type. Code
21482 generated with this option runs on any of the other AE types. The
21483 code is not as efficient as it would be if compiled for a specific
21484 AE type, and some types of operation (e.g., multiplication) do not
21485 work properly on all types of AE.
21486
21487 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
21488 for compiled code, and is the default.
21489
21490 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
21491 option may suffer from poor performance of byte (char) manipulation,
21492 since the DSP AE does not provide hardware support for byte load/stores.
21493
21494 @item -msymbol-as-address
21495 Enable the compiler to directly use a symbol name as an address in a
21496 load/store instruction, without first loading it into a
21497 register. Typically, the use of this option generates larger
21498 programs, which run faster than when the option isn't used. However, the
21499 results vary from program to program, so it is left as a user option,
21500 rather than being permanently enabled.
21501
21502 @item -mno-inefficient-warnings
21503 Disables warnings about the generation of inefficient code. These
21504 warnings can be generated, for example, when compiling code that
21505 performs byte-level memory operations on the MAC AE type. The MAC AE has
21506 no hardware support for byte-level memory operations, so all byte
21507 load/stores must be synthesized from word load/store operations. This is
21508 inefficient and a warning is generated to indicate
21509 that you should rewrite the code to avoid byte operations, or to target
21510 an AE type that has the necessary hardware support. This option disables
21511 these warnings.
21512
21513 @end table
21514
21515 @node PowerPC Options
21516 @subsection PowerPC Options
21517 @cindex PowerPC options
21518
21519 These are listed under @xref{RS/6000 and PowerPC Options}.
21520
21521 @node RISC-V Options
21522 @subsection RISC-V Options
21523 @cindex RISC-V Options
21524
21525 These command-line options are defined for RISC-V targets:
21526
21527 @table @gcctabopt
21528 @item -mbranch-cost=@var{n}
21529 @opindex mbranch-cost
21530 Set the cost of branches to roughly @var{n} instructions.
21531
21532 @item -mmemcpy
21533 @itemx -mno-memcpy
21534 @opindex mmemcpy
21535 Don't optimize block moves.
21536
21537 @item -mplt
21538 @itemx -mno-plt
21539 @opindex plt
21540 When generating PIC code, allow the use of PLTs. Ignored for non-PIC.
21541
21542 @item -mabi=@var{ABI-string}
21543 @opindex mabi
21544 Specify integer and floating-point calling convention. This defaults to the
21545 natural calling convention: e.g.@ LP64 for RV64I, ILP32 for RV32I, LP64D for
21546 RV64G.
21547
21548 @item -mfdiv
21549 @itemx -mno-fdiv
21550 @opindex mfdiv
21551 Use hardware floating-point divide and square root instructions. This requires
21552 the F or D extensions for floating-point registers.
21553
21554 @item -mdiv
21555 @itemx -mno-div
21556 @opindex mdiv
21557 Use hardware instructions for integer division. This requires the M extension.
21558
21559 @item -march=@var{ISA-string}
21560 @opindex march
21561 Generate code for given RISC-V ISA (e.g.@ @samp{rv64im}). ISA strings must be
21562 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, and @samp{rv32imaf}.
21563
21564 @item -mtune=@var{processor-string}
21565 @opindex mtune
21566 Optimize the output for the given processor, specified by microarchitecture
21567 name.
21568
21569 @item -msmall-data-limit=@var{n}
21570 @opindex msmall-data-limit
21571 Put global and static data smaller than @var{n} bytes into a special section
21572 (on some targets).
21573
21574 @item -msave-restore
21575 @itemx -mno-save-restore
21576 @opindex msave-restore
21577 Use smaller but slower prologue and epilogue code.
21578
21579 @item -mstrict-align
21580 @itemx -mno-strict-align
21581 @opindex mstrict-align
21582 Do not generate unaligned memory accesses.
21583
21584 @item -mcmodel=@var{code-model}
21585 @opindex mcmodel
21586 Specify the code model.
21587
21588 @end table
21589
21590 @node RL78 Options
21591 @subsection RL78 Options
21592 @cindex RL78 Options
21593
21594 @table @gcctabopt
21595
21596 @item -msim
21597 @opindex msim
21598 Links in additional target libraries to support operation within a
21599 simulator.
21600
21601 @item -mmul=none
21602 @itemx -mmul=g10
21603 @itemx -mmul=g13
21604 @itemx -mmul=g14
21605 @itemx -mmul=rl78
21606 @opindex mmul
21607 Specifies the type of hardware multiplication and division support to
21608 be used. The simplest is @code{none}, which uses software for both
21609 multiplication and division. This is the default. The @code{g13}
21610 value is for the hardware multiply/divide peripheral found on the
21611 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
21612 the multiplication and division instructions supported by the RL78/G14
21613 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
21614 the value @code{mg10} is an alias for @code{none}.
21615
21616 In addition a C preprocessor macro is defined, based upon the setting
21617 of this option. Possible values are: @code{__RL78_MUL_NONE__},
21618 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
21619
21620 @item -mcpu=g10
21621 @itemx -mcpu=g13
21622 @itemx -mcpu=g14
21623 @itemx -mcpu=rl78
21624 @opindex mcpu
21625 Specifies the RL78 core to target. The default is the G14 core, also
21626 known as an S3 core or just RL78. The G13 or S2 core does not have
21627 multiply or divide instructions, instead it uses a hardware peripheral
21628 for these operations. The G10 or S1 core does not have register
21629 banks, so it uses a different calling convention.
21630
21631 If this option is set it also selects the type of hardware multiply
21632 support to use, unless this is overridden by an explicit
21633 @option{-mmul=none} option on the command line. Thus specifying
21634 @option{-mcpu=g13} enables the use of the G13 hardware multiply
21635 peripheral and specifying @option{-mcpu=g10} disables the use of
21636 hardware multiplications altogether.
21637
21638 Note, although the RL78/G14 core is the default target, specifying
21639 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
21640 change the behavior of the toolchain since it also enables G14
21641 hardware multiply support. If these options are not specified on the
21642 command line then software multiplication routines will be used even
21643 though the code targets the RL78 core. This is for backwards
21644 compatibility with older toolchains which did not have hardware
21645 multiply and divide support.
21646
21647 In addition a C preprocessor macro is defined, based upon the setting
21648 of this option. Possible values are: @code{__RL78_G10__},
21649 @code{__RL78_G13__} or @code{__RL78_G14__}.
21650
21651 @item -mg10
21652 @itemx -mg13
21653 @itemx -mg14
21654 @itemx -mrl78
21655 @opindex mg10
21656 @opindex mg13
21657 @opindex mg14
21658 @opindex mrl78
21659 These are aliases for the corresponding @option{-mcpu=} option. They
21660 are provided for backwards compatibility.
21661
21662 @item -mallregs
21663 @opindex mallregs
21664 Allow the compiler to use all of the available registers. By default
21665 registers @code{r24..r31} are reserved for use in interrupt handlers.
21666 With this option enabled these registers can be used in ordinary
21667 functions as well.
21668
21669 @item -m64bit-doubles
21670 @itemx -m32bit-doubles
21671 @opindex m64bit-doubles
21672 @opindex m32bit-doubles
21673 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
21674 or 32 bits (@option{-m32bit-doubles}) in size. The default is
21675 @option{-m32bit-doubles}.
21676
21677 @item -msave-mduc-in-interrupts
21678 @item -mno-save-mduc-in-interrupts
21679 @opindex msave-mduc-in-interrupts
21680 @opindex mno-save-mduc-in-interrupts
21681 Specifies that interrupt handler functions should preserve the
21682 MDUC registers. This is only necessary if normal code might use
21683 the MDUC registers, for example because it performs multiplication
21684 and division operations. The default is to ignore the MDUC registers
21685 as this makes the interrupt handlers faster. The target option -mg13
21686 needs to be passed for this to work as this feature is only available
21687 on the G13 target (S2 core). The MDUC registers will only be saved
21688 if the interrupt handler performs a multiplication or division
21689 operation or it calls another function.
21690
21691 @end table
21692
21693 @node RS/6000 and PowerPC Options
21694 @subsection IBM RS/6000 and PowerPC Options
21695 @cindex RS/6000 and PowerPC Options
21696 @cindex IBM RS/6000 and PowerPC Options
21697
21698 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
21699 @table @gcctabopt
21700 @item -mpowerpc-gpopt
21701 @itemx -mno-powerpc-gpopt
21702 @itemx -mpowerpc-gfxopt
21703 @itemx -mno-powerpc-gfxopt
21704 @need 800
21705 @itemx -mpowerpc64
21706 @itemx -mno-powerpc64
21707 @itemx -mmfcrf
21708 @itemx -mno-mfcrf
21709 @itemx -mpopcntb
21710 @itemx -mno-popcntb
21711 @itemx -mpopcntd
21712 @itemx -mno-popcntd
21713 @itemx -mfprnd
21714 @itemx -mno-fprnd
21715 @need 800
21716 @itemx -mcmpb
21717 @itemx -mno-cmpb
21718 @itemx -mmfpgpr
21719 @itemx -mno-mfpgpr
21720 @itemx -mhard-dfp
21721 @itemx -mno-hard-dfp
21722 @opindex mpowerpc-gpopt
21723 @opindex mno-powerpc-gpopt
21724 @opindex mpowerpc-gfxopt
21725 @opindex mno-powerpc-gfxopt
21726 @opindex mpowerpc64
21727 @opindex mno-powerpc64
21728 @opindex mmfcrf
21729 @opindex mno-mfcrf
21730 @opindex mpopcntb
21731 @opindex mno-popcntb
21732 @opindex mpopcntd
21733 @opindex mno-popcntd
21734 @opindex mfprnd
21735 @opindex mno-fprnd
21736 @opindex mcmpb
21737 @opindex mno-cmpb
21738 @opindex mmfpgpr
21739 @opindex mno-mfpgpr
21740 @opindex mhard-dfp
21741 @opindex mno-hard-dfp
21742 You use these options to specify which instructions are available on the
21743 processor you are using. The default value of these options is
21744 determined when configuring GCC@. Specifying the
21745 @option{-mcpu=@var{cpu_type}} overrides the specification of these
21746 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
21747 rather than the options listed above.
21748
21749 Specifying @option{-mpowerpc-gpopt} allows
21750 GCC to use the optional PowerPC architecture instructions in the
21751 General Purpose group, including floating-point square root. Specifying
21752 @option{-mpowerpc-gfxopt} allows GCC to
21753 use the optional PowerPC architecture instructions in the Graphics
21754 group, including floating-point select.
21755
21756 The @option{-mmfcrf} option allows GCC to generate the move from
21757 condition register field instruction implemented on the POWER4
21758 processor and other processors that support the PowerPC V2.01
21759 architecture.
21760 The @option{-mpopcntb} option allows GCC to generate the popcount and
21761 double-precision FP reciprocal estimate instruction implemented on the
21762 POWER5 processor and other processors that support the PowerPC V2.02
21763 architecture.
21764 The @option{-mpopcntd} option allows GCC to generate the popcount
21765 instruction implemented on the POWER7 processor and other processors
21766 that support the PowerPC V2.06 architecture.
21767 The @option{-mfprnd} option allows GCC to generate the FP round to
21768 integer instructions implemented on the POWER5+ processor and other
21769 processors that support the PowerPC V2.03 architecture.
21770 The @option{-mcmpb} option allows GCC to generate the compare bytes
21771 instruction implemented on the POWER6 processor and other processors
21772 that support the PowerPC V2.05 architecture.
21773 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
21774 general-purpose register instructions implemented on the POWER6X
21775 processor and other processors that support the extended PowerPC V2.05
21776 architecture.
21777 The @option{-mhard-dfp} option allows GCC to generate the decimal
21778 floating-point instructions implemented on some POWER processors.
21779
21780 The @option{-mpowerpc64} option allows GCC to generate the additional
21781 64-bit instructions that are found in the full PowerPC64 architecture
21782 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
21783 @option{-mno-powerpc64}.
21784
21785 @item -mcpu=@var{cpu_type}
21786 @opindex mcpu
21787 Set architecture type, register usage, and
21788 instruction scheduling parameters for machine type @var{cpu_type}.
21789 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
21790 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
21791 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
21792 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
21793 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
21794 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
21795 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
21796 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
21797 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
21798 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
21799 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
21800 and @samp{rs64}.
21801
21802 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
21803 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
21804 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
21805 architecture machine types, with an appropriate, generic processor
21806 model assumed for scheduling purposes.
21807
21808 The other options specify a specific processor. Code generated under
21809 those options runs best on that processor, and may not run at all on
21810 others.
21811
21812 The @option{-mcpu} options automatically enable or disable the
21813 following options:
21814
21815 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
21816 -mpopcntb -mpopcntd -mpowerpc64 @gol
21817 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
21818 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
21819 -mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol
21820 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
21821
21822 The particular options set for any particular CPU varies between
21823 compiler versions, depending on what setting seems to produce optimal
21824 code for that CPU; it doesn't necessarily reflect the actual hardware's
21825 capabilities. If you wish to set an individual option to a particular
21826 value, you may specify it after the @option{-mcpu} option, like
21827 @option{-mcpu=970 -mno-altivec}.
21828
21829 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
21830 not enabled or disabled by the @option{-mcpu} option at present because
21831 AIX does not have full support for these options. You may still
21832 enable or disable them individually if you're sure it'll work in your
21833 environment.
21834
21835 @item -mtune=@var{cpu_type}
21836 @opindex mtune
21837 Set the instruction scheduling parameters for machine type
21838 @var{cpu_type}, but do not set the architecture type or register usage,
21839 as @option{-mcpu=@var{cpu_type}} does. The same
21840 values for @var{cpu_type} are used for @option{-mtune} as for
21841 @option{-mcpu}. If both are specified, the code generated uses the
21842 architecture and registers set by @option{-mcpu}, but the
21843 scheduling parameters set by @option{-mtune}.
21844
21845 @item -mcmodel=small
21846 @opindex mcmodel=small
21847 Generate PowerPC64 code for the small model: The TOC is limited to
21848 64k.
21849
21850 @item -mcmodel=medium
21851 @opindex mcmodel=medium
21852 Generate PowerPC64 code for the medium model: The TOC and other static
21853 data may be up to a total of 4G in size. This is the default for 64-bit
21854 Linux.
21855
21856 @item -mcmodel=large
21857 @opindex mcmodel=large
21858 Generate PowerPC64 code for the large model: The TOC may be up to 4G
21859 in size. Other data and code is only limited by the 64-bit address
21860 space.
21861
21862 @item -maltivec
21863 @itemx -mno-altivec
21864 @opindex maltivec
21865 @opindex mno-altivec
21866 Generate code that uses (does not use) AltiVec instructions, and also
21867 enable the use of built-in functions that allow more direct access to
21868 the AltiVec instruction set. You may also need to set
21869 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
21870 enhancements.
21871
21872 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
21873 @option{-maltivec=be}, the element order for AltiVec intrinsics such
21874 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
21875 match array element order corresponding to the endianness of the
21876 target. That is, element zero identifies the leftmost element in a
21877 vector register when targeting a big-endian platform, and identifies
21878 the rightmost element in a vector register when targeting a
21879 little-endian platform.
21880
21881 @item -maltivec=be
21882 @opindex maltivec=be
21883 Generate AltiVec instructions using big-endian element order,
21884 regardless of whether the target is big- or little-endian. This is
21885 the default when targeting a big-endian platform.
21886
21887 The element order is used to interpret element numbers in AltiVec
21888 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
21889 @code{vec_insert}. By default, these match array element order
21890 corresponding to the endianness for the target.
21891
21892 @item -maltivec=le
21893 @opindex maltivec=le
21894 Generate AltiVec instructions using little-endian element order,
21895 regardless of whether the target is big- or little-endian. This is
21896 the default when targeting a little-endian platform. This option is
21897 currently ignored when targeting a big-endian platform.
21898
21899 The element order is used to interpret element numbers in AltiVec
21900 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
21901 @code{vec_insert}. By default, these match array element order
21902 corresponding to the endianness for the target.
21903
21904 @item -mvrsave
21905 @itemx -mno-vrsave
21906 @opindex mvrsave
21907 @opindex mno-vrsave
21908 Generate VRSAVE instructions when generating AltiVec code.
21909
21910 @item -msecure-plt
21911 @opindex msecure-plt
21912 Generate code that allows @command{ld} and @command{ld.so}
21913 to build executables and shared
21914 libraries with non-executable @code{.plt} and @code{.got} sections.
21915 This is a PowerPC
21916 32-bit SYSV ABI option.
21917
21918 @item -mbss-plt
21919 @opindex mbss-plt
21920 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
21921 fills in, and
21922 requires @code{.plt} and @code{.got}
21923 sections that are both writable and executable.
21924 This is a PowerPC 32-bit SYSV ABI option.
21925
21926 @item -misel
21927 @itemx -mno-isel
21928 @opindex misel
21929 @opindex mno-isel
21930 This switch enables or disables the generation of ISEL instructions.
21931
21932 @item -misel=@var{yes/no}
21933 This switch has been deprecated. Use @option{-misel} and
21934 @option{-mno-isel} instead.
21935
21936 @item -mspe
21937 @itemx -mno-spe
21938 @opindex mspe
21939 @opindex mno-spe
21940 This switch enables or disables the generation of SPE simd
21941 instructions.
21942
21943 @item -mpaired
21944 @itemx -mno-paired
21945 @opindex mpaired
21946 @opindex mno-paired
21947 This switch enables or disables the generation of PAIRED simd
21948 instructions.
21949
21950 @item -mspe=@var{yes/no}
21951 This option has been deprecated. Use @option{-mspe} and
21952 @option{-mno-spe} instead.
21953
21954 @item -mvsx
21955 @itemx -mno-vsx
21956 @opindex mvsx
21957 @opindex mno-vsx
21958 Generate code that uses (does not use) vector/scalar (VSX)
21959 instructions, and also enable the use of built-in functions that allow
21960 more direct access to the VSX instruction set.
21961
21962 @item -mcrypto
21963 @itemx -mno-crypto
21964 @opindex mcrypto
21965 @opindex mno-crypto
21966 Enable the use (disable) of the built-in functions that allow direct
21967 access to the cryptographic instructions that were added in version
21968 2.07 of the PowerPC ISA.
21969
21970 @item -mdirect-move
21971 @itemx -mno-direct-move
21972 @opindex mdirect-move
21973 @opindex mno-direct-move
21974 Generate code that uses (does not use) the instructions to move data
21975 between the general purpose registers and the vector/scalar (VSX)
21976 registers that were added in version 2.07 of the PowerPC ISA.
21977
21978 @item -mhtm
21979 @itemx -mno-htm
21980 @opindex mhtm
21981 @opindex mno-htm
21982 Enable (disable) the use of the built-in functions that allow direct
21983 access to the Hardware Transactional Memory (HTM) instructions that
21984 were added in version 2.07 of the PowerPC ISA.
21985
21986 @item -mpower8-fusion
21987 @itemx -mno-power8-fusion
21988 @opindex mpower8-fusion
21989 @opindex mno-power8-fusion
21990 Generate code that keeps (does not keeps) some integer operations
21991 adjacent so that the instructions can be fused together on power8 and
21992 later processors.
21993
21994 @item -mpower8-vector
21995 @itemx -mno-power8-vector
21996 @opindex mpower8-vector
21997 @opindex mno-power8-vector
21998 Generate code that uses (does not use) the vector and scalar
21999 instructions that were added in version 2.07 of the PowerPC ISA. Also
22000 enable the use of built-in functions that allow more direct access to
22001 the vector instructions.
22002
22003 @item -mquad-memory
22004 @itemx -mno-quad-memory
22005 @opindex mquad-memory
22006 @opindex mno-quad-memory
22007 Generate code that uses (does not use) the non-atomic quad word memory
22008 instructions. The @option{-mquad-memory} option requires use of
22009 64-bit mode.
22010
22011 @item -mquad-memory-atomic
22012 @itemx -mno-quad-memory-atomic
22013 @opindex mquad-memory-atomic
22014 @opindex mno-quad-memory-atomic
22015 Generate code that uses (does not use) the atomic quad word memory
22016 instructions. The @option{-mquad-memory-atomic} option requires use of
22017 64-bit mode.
22018
22019 @item -mfloat128
22020 @itemx -mno-float128
22021 @opindex mfloat128
22022 @opindex mno-float128
22023 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
22024 and use either software emulation for IEEE 128-bit floating point or
22025 hardware instructions.
22026
22027 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
22028 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
22029 use the IEEE 128-bit floating point support. The IEEE 128-bit
22030 floating point support only works on PowerPC Linux systems.
22031
22032 The default for @option{-mfloat128} is enabled on PowerPC Linux
22033 systems using the VSX instruction set, and disabled on other systems.
22034
22035 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
22036 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
22037 point support will also enable the generation of ISA 3.0 IEEE 128-bit
22038 floating point instructions. Otherwise, if you do not specify to
22039 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
22040 system, IEEE 128-bit floating point will be done with software
22041 emulation.
22042
22043 @item -mfloat128-hardware
22044 @itemx -mno-float128-hardware
22045 @opindex mfloat128-hardware
22046 @opindex mno-float128-hardware
22047 Enable/disable using ISA 3.0 hardware instructions to support the
22048 @var{__float128} data type.
22049
22050 The default for @option{-mfloat128-hardware} is enabled on PowerPC
22051 Linux systems using the ISA 3.0 instruction set, and disabled on other
22052 systems.
22053
22054 @item -mfloat-gprs=@var{yes/single/double/no}
22055 @itemx -mfloat-gprs
22056 @opindex mfloat-gprs
22057 This switch enables or disables the generation of floating-point
22058 operations on the general-purpose registers for architectures that
22059 support it.
22060
22061 The argument @samp{yes} or @samp{single} enables the use of
22062 single-precision floating-point operations.
22063
22064 The argument @samp{double} enables the use of single and
22065 double-precision floating-point operations.
22066
22067 The argument @samp{no} disables floating-point operations on the
22068 general-purpose registers.
22069
22070 This option is currently only available on the MPC854x.
22071
22072 @item -m32
22073 @itemx -m64
22074 @opindex m32
22075 @opindex m64
22076 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
22077 targets (including GNU/Linux). The 32-bit environment sets int, long
22078 and pointer to 32 bits and generates code that runs on any PowerPC
22079 variant. The 64-bit environment sets int to 32 bits and long and
22080 pointer to 64 bits, and generates code for PowerPC64, as for
22081 @option{-mpowerpc64}.
22082
22083 @item -mfull-toc
22084 @itemx -mno-fp-in-toc
22085 @itemx -mno-sum-in-toc
22086 @itemx -mminimal-toc
22087 @opindex mfull-toc
22088 @opindex mno-fp-in-toc
22089 @opindex mno-sum-in-toc
22090 @opindex mminimal-toc
22091 Modify generation of the TOC (Table Of Contents), which is created for
22092 every executable file. The @option{-mfull-toc} option is selected by
22093 default. In that case, GCC allocates at least one TOC entry for
22094 each unique non-automatic variable reference in your program. GCC
22095 also places floating-point constants in the TOC@. However, only
22096 16,384 entries are available in the TOC@.
22097
22098 If you receive a linker error message that saying you have overflowed
22099 the available TOC space, you can reduce the amount of TOC space used
22100 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
22101 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
22102 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
22103 generate code to calculate the sum of an address and a constant at
22104 run time instead of putting that sum into the TOC@. You may specify one
22105 or both of these options. Each causes GCC to produce very slightly
22106 slower and larger code at the expense of conserving TOC space.
22107
22108 If you still run out of space in the TOC even when you specify both of
22109 these options, specify @option{-mminimal-toc} instead. This option causes
22110 GCC to make only one TOC entry for every file. When you specify this
22111 option, GCC produces code that is slower and larger but which
22112 uses extremely little TOC space. You may wish to use this option
22113 only on files that contain less frequently-executed code.
22114
22115 @item -maix64
22116 @itemx -maix32
22117 @opindex maix64
22118 @opindex maix32
22119 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
22120 @code{long} type, and the infrastructure needed to support them.
22121 Specifying @option{-maix64} implies @option{-mpowerpc64},
22122 while @option{-maix32} disables the 64-bit ABI and
22123 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
22124
22125 @item -mxl-compat
22126 @itemx -mno-xl-compat
22127 @opindex mxl-compat
22128 @opindex mno-xl-compat
22129 Produce code that conforms more closely to IBM XL compiler semantics
22130 when using AIX-compatible ABI@. Pass floating-point arguments to
22131 prototyped functions beyond the register save area (RSA) on the stack
22132 in addition to argument FPRs. Do not assume that most significant
22133 double in 128-bit long double value is properly rounded when comparing
22134 values and converting to double. Use XL symbol names for long double
22135 support routines.
22136
22137 The AIX calling convention was extended but not initially documented to
22138 handle an obscure K&R C case of calling a function that takes the
22139 address of its arguments with fewer arguments than declared. IBM XL
22140 compilers access floating-point arguments that do not fit in the
22141 RSA from the stack when a subroutine is compiled without
22142 optimization. Because always storing floating-point arguments on the
22143 stack is inefficient and rarely needed, this option is not enabled by
22144 default and only is necessary when calling subroutines compiled by IBM
22145 XL compilers without optimization.
22146
22147 @item -mpe
22148 @opindex mpe
22149 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
22150 application written to use message passing with special startup code to
22151 enable the application to run. The system must have PE installed in the
22152 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
22153 must be overridden with the @option{-specs=} option to specify the
22154 appropriate directory location. The Parallel Environment does not
22155 support threads, so the @option{-mpe} option and the @option{-pthread}
22156 option are incompatible.
22157
22158 @item -malign-natural
22159 @itemx -malign-power
22160 @opindex malign-natural
22161 @opindex malign-power
22162 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
22163 @option{-malign-natural} overrides the ABI-defined alignment of larger
22164 types, such as floating-point doubles, on their natural size-based boundary.
22165 The option @option{-malign-power} instructs GCC to follow the ABI-specified
22166 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
22167
22168 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
22169 is not supported.
22170
22171 @item -msoft-float
22172 @itemx -mhard-float
22173 @opindex msoft-float
22174 @opindex mhard-float
22175 Generate code that does not use (uses) the floating-point register set.
22176 Software floating-point emulation is provided if you use the
22177 @option{-msoft-float} option, and pass the option to GCC when linking.
22178
22179 @item -msingle-float
22180 @itemx -mdouble-float
22181 @opindex msingle-float
22182 @opindex mdouble-float
22183 Generate code for single- or double-precision floating-point operations.
22184 @option{-mdouble-float} implies @option{-msingle-float}.
22185
22186 @item -msimple-fpu
22187 @opindex msimple-fpu
22188 Do not generate @code{sqrt} and @code{div} instructions for hardware
22189 floating-point unit.
22190
22191 @item -mfpu=@var{name}
22192 @opindex mfpu
22193 Specify type of floating-point unit. Valid values for @var{name} are
22194 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
22195 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
22196 @samp{sp_full} (equivalent to @option{-msingle-float}),
22197 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
22198
22199 @item -mxilinx-fpu
22200 @opindex mxilinx-fpu
22201 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
22202
22203 @item -mmultiple
22204 @itemx -mno-multiple
22205 @opindex mmultiple
22206 @opindex mno-multiple
22207 Generate code that uses (does not use) the load multiple word
22208 instructions and the store multiple word instructions. These
22209 instructions are generated by default on POWER systems, and not
22210 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
22211 PowerPC systems, since those instructions do not work when the
22212 processor is in little-endian mode. The exceptions are PPC740 and
22213 PPC750 which permit these instructions in little-endian mode.
22214
22215 @item -mstring
22216 @itemx -mno-string
22217 @opindex mstring
22218 @opindex mno-string
22219 Generate code that uses (does not use) the load string instructions
22220 and the store string word instructions to save multiple registers and
22221 do small block moves. These instructions are generated by default on
22222 POWER systems, and not generated on PowerPC systems. Do not use
22223 @option{-mstring} on little-endian PowerPC systems, since those
22224 instructions do not work when the processor is in little-endian mode.
22225 The exceptions are PPC740 and PPC750 which permit these instructions
22226 in little-endian mode.
22227
22228 @item -mupdate
22229 @itemx -mno-update
22230 @opindex mupdate
22231 @opindex mno-update
22232 Generate code that uses (does not use) the load or store instructions
22233 that update the base register to the address of the calculated memory
22234 location. These instructions are generated by default. If you use
22235 @option{-mno-update}, there is a small window between the time that the
22236 stack pointer is updated and the address of the previous frame is
22237 stored, which means code that walks the stack frame across interrupts or
22238 signals may get corrupted data.
22239
22240 @item -mavoid-indexed-addresses
22241 @itemx -mno-avoid-indexed-addresses
22242 @opindex mavoid-indexed-addresses
22243 @opindex mno-avoid-indexed-addresses
22244 Generate code that tries to avoid (not avoid) the use of indexed load
22245 or store instructions. These instructions can incur a performance
22246 penalty on Power6 processors in certain situations, such as when
22247 stepping through large arrays that cross a 16M boundary. This option
22248 is enabled by default when targeting Power6 and disabled otherwise.
22249
22250 @item -mfused-madd
22251 @itemx -mno-fused-madd
22252 @opindex mfused-madd
22253 @opindex mno-fused-madd
22254 Generate code that uses (does not use) the floating-point multiply and
22255 accumulate instructions. These instructions are generated by default
22256 if hardware floating point is used. The machine-dependent
22257 @option{-mfused-madd} option is now mapped to the machine-independent
22258 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22259 mapped to @option{-ffp-contract=off}.
22260
22261 @item -mmulhw
22262 @itemx -mno-mulhw
22263 @opindex mmulhw
22264 @opindex mno-mulhw
22265 Generate code that uses (does not use) the half-word multiply and
22266 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
22267 These instructions are generated by default when targeting those
22268 processors.
22269
22270 @item -mdlmzb
22271 @itemx -mno-dlmzb
22272 @opindex mdlmzb
22273 @opindex mno-dlmzb
22274 Generate code that uses (does not use) the string-search @samp{dlmzb}
22275 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
22276 generated by default when targeting those processors.
22277
22278 @item -mno-bit-align
22279 @itemx -mbit-align
22280 @opindex mno-bit-align
22281 @opindex mbit-align
22282 On System V.4 and embedded PowerPC systems do not (do) force structures
22283 and unions that contain bit-fields to be aligned to the base type of the
22284 bit-field.
22285
22286 For example, by default a structure containing nothing but 8
22287 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
22288 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
22289 the structure is aligned to a 1-byte boundary and is 1 byte in
22290 size.
22291
22292 @item -mno-strict-align
22293 @itemx -mstrict-align
22294 @opindex mno-strict-align
22295 @opindex mstrict-align
22296 On System V.4 and embedded PowerPC systems do not (do) assume that
22297 unaligned memory references are handled by the system.
22298
22299 @item -mrelocatable
22300 @itemx -mno-relocatable
22301 @opindex mrelocatable
22302 @opindex mno-relocatable
22303 Generate code that allows (does not allow) a static executable to be
22304 relocated to a different address at run time. A simple embedded
22305 PowerPC system loader should relocate the entire contents of
22306 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
22307 a table of 32-bit addresses generated by this option. For this to
22308 work, all objects linked together must be compiled with
22309 @option{-mrelocatable} or @option{-mrelocatable-lib}.
22310 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
22311
22312 @item -mrelocatable-lib
22313 @itemx -mno-relocatable-lib
22314 @opindex mrelocatable-lib
22315 @opindex mno-relocatable-lib
22316 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
22317 @code{.fixup} section to allow static executables to be relocated at
22318 run time, but @option{-mrelocatable-lib} does not use the smaller stack
22319 alignment of @option{-mrelocatable}. Objects compiled with
22320 @option{-mrelocatable-lib} may be linked with objects compiled with
22321 any combination of the @option{-mrelocatable} options.
22322
22323 @item -mno-toc
22324 @itemx -mtoc
22325 @opindex mno-toc
22326 @opindex mtoc
22327 On System V.4 and embedded PowerPC systems do not (do) assume that
22328 register 2 contains a pointer to a global area pointing to the addresses
22329 used in the program.
22330
22331 @item -mlittle
22332 @itemx -mlittle-endian
22333 @opindex mlittle
22334 @opindex mlittle-endian
22335 On System V.4 and embedded PowerPC systems compile code for the
22336 processor in little-endian mode. The @option{-mlittle-endian} option is
22337 the same as @option{-mlittle}.
22338
22339 @item -mbig
22340 @itemx -mbig-endian
22341 @opindex mbig
22342 @opindex mbig-endian
22343 On System V.4 and embedded PowerPC systems compile code for the
22344 processor in big-endian mode. The @option{-mbig-endian} option is
22345 the same as @option{-mbig}.
22346
22347 @item -mdynamic-no-pic
22348 @opindex mdynamic-no-pic
22349 On Darwin and Mac OS X systems, compile code so that it is not
22350 relocatable, but that its external references are relocatable. The
22351 resulting code is suitable for applications, but not shared
22352 libraries.
22353
22354 @item -msingle-pic-base
22355 @opindex msingle-pic-base
22356 Treat the register used for PIC addressing as read-only, rather than
22357 loading it in the prologue for each function. The runtime system is
22358 responsible for initializing this register with an appropriate value
22359 before execution begins.
22360
22361 @item -mprioritize-restricted-insns=@var{priority}
22362 @opindex mprioritize-restricted-insns
22363 This option controls the priority that is assigned to
22364 dispatch-slot restricted instructions during the second scheduling
22365 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
22366 or @samp{2} to assign no, highest, or second-highest (respectively)
22367 priority to dispatch-slot restricted
22368 instructions.
22369
22370 @item -msched-costly-dep=@var{dependence_type}
22371 @opindex msched-costly-dep
22372 This option controls which dependences are considered costly
22373 by the target during instruction scheduling. The argument
22374 @var{dependence_type} takes one of the following values:
22375
22376 @table @asis
22377 @item @samp{no}
22378 No dependence is costly.
22379
22380 @item @samp{all}
22381 All dependences are costly.
22382
22383 @item @samp{true_store_to_load}
22384 A true dependence from store to load is costly.
22385
22386 @item @samp{store_to_load}
22387 Any dependence from store to load is costly.
22388
22389 @item @var{number}
22390 Any dependence for which the latency is greater than or equal to
22391 @var{number} is costly.
22392 @end table
22393
22394 @item -minsert-sched-nops=@var{scheme}
22395 @opindex minsert-sched-nops
22396 This option controls which NOP insertion scheme is used during
22397 the second scheduling pass. The argument @var{scheme} takes one of the
22398 following values:
22399
22400 @table @asis
22401 @item @samp{no}
22402 Don't insert NOPs.
22403
22404 @item @samp{pad}
22405 Pad with NOPs any dispatch group that has vacant issue slots,
22406 according to the scheduler's grouping.
22407
22408 @item @samp{regroup_exact}
22409 Insert NOPs to force costly dependent insns into
22410 separate groups. Insert exactly as many NOPs as needed to force an insn
22411 to a new group, according to the estimated processor grouping.
22412
22413 @item @var{number}
22414 Insert NOPs to force costly dependent insns into
22415 separate groups. Insert @var{number} NOPs to force an insn to a new group.
22416 @end table
22417
22418 @item -mcall-sysv
22419 @opindex mcall-sysv
22420 On System V.4 and embedded PowerPC systems compile code using calling
22421 conventions that adhere to the March 1995 draft of the System V
22422 Application Binary Interface, PowerPC processor supplement. This is the
22423 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
22424
22425 @item -mcall-sysv-eabi
22426 @itemx -mcall-eabi
22427 @opindex mcall-sysv-eabi
22428 @opindex mcall-eabi
22429 Specify both @option{-mcall-sysv} and @option{-meabi} options.
22430
22431 @item -mcall-sysv-noeabi
22432 @opindex mcall-sysv-noeabi
22433 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
22434
22435 @item -mcall-aixdesc
22436 @opindex m
22437 On System V.4 and embedded PowerPC systems compile code for the AIX
22438 operating system.
22439
22440 @item -mcall-linux
22441 @opindex mcall-linux
22442 On System V.4 and embedded PowerPC systems compile code for the
22443 Linux-based GNU system.
22444
22445 @item -mcall-freebsd
22446 @opindex mcall-freebsd
22447 On System V.4 and embedded PowerPC systems compile code for the
22448 FreeBSD operating system.
22449
22450 @item -mcall-netbsd
22451 @opindex mcall-netbsd
22452 On System V.4 and embedded PowerPC systems compile code for the
22453 NetBSD operating system.
22454
22455 @item -mcall-openbsd
22456 @opindex mcall-netbsd
22457 On System V.4 and embedded PowerPC systems compile code for the
22458 OpenBSD operating system.
22459
22460 @item -maix-struct-return
22461 @opindex maix-struct-return
22462 Return all structures in memory (as specified by the AIX ABI)@.
22463
22464 @item -msvr4-struct-return
22465 @opindex msvr4-struct-return
22466 Return structures smaller than 8 bytes in registers (as specified by the
22467 SVR4 ABI)@.
22468
22469 @item -mabi=@var{abi-type}
22470 @opindex mabi
22471 Extend the current ABI with a particular extension, or remove such extension.
22472 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
22473 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
22474 @samp{elfv1}, @samp{elfv2}@.
22475
22476 @item -mabi=spe
22477 @opindex mabi=spe
22478 Extend the current ABI with SPE ABI extensions. This does not change
22479 the default ABI, instead it adds the SPE ABI extensions to the current
22480 ABI@.
22481
22482 @item -mabi=no-spe
22483 @opindex mabi=no-spe
22484 Disable Book-E SPE ABI extensions for the current ABI@.
22485
22486 @item -mabi=ibmlongdouble
22487 @opindex mabi=ibmlongdouble
22488 Change the current ABI to use IBM extended-precision long double.
22489 This is a PowerPC 32-bit SYSV ABI option.
22490
22491 @item -mabi=ieeelongdouble
22492 @opindex mabi=ieeelongdouble
22493 Change the current ABI to use IEEE extended-precision long double.
22494 This is a PowerPC 32-bit Linux ABI option.
22495
22496 @item -mabi=elfv1
22497 @opindex mabi=elfv1
22498 Change the current ABI to use the ELFv1 ABI.
22499 This is the default ABI for big-endian PowerPC 64-bit Linux.
22500 Overriding the default ABI requires special system support and is
22501 likely to fail in spectacular ways.
22502
22503 @item -mabi=elfv2
22504 @opindex mabi=elfv2
22505 Change the current ABI to use the ELFv2 ABI.
22506 This is the default ABI for little-endian PowerPC 64-bit Linux.
22507 Overriding the default ABI requires special system support and is
22508 likely to fail in spectacular ways.
22509
22510 @item -mgnu-attribute
22511 @itemx -mno-gnu-attribute
22512 @opindex mgnu-attribute
22513 @opindex mno-gnu-attribute
22514 Emit .gnu_attribute assembly directives to set tag/value pairs in a
22515 .gnu.attributes section that specify ABI variations in function
22516 parameters or return values.
22517
22518 @item -mprototype
22519 @itemx -mno-prototype
22520 @opindex mprototype
22521 @opindex mno-prototype
22522 On System V.4 and embedded PowerPC systems assume that all calls to
22523 variable argument functions are properly prototyped. Otherwise, the
22524 compiler must insert an instruction before every non-prototyped call to
22525 set or clear bit 6 of the condition code register (@code{CR}) to
22526 indicate whether floating-point values are passed in the floating-point
22527 registers in case the function takes variable arguments. With
22528 @option{-mprototype}, only calls to prototyped variable argument functions
22529 set or clear the bit.
22530
22531 @item -msim
22532 @opindex msim
22533 On embedded PowerPC systems, assume that the startup module is called
22534 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
22535 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
22536 configurations.
22537
22538 @item -mmvme
22539 @opindex mmvme
22540 On embedded PowerPC systems, assume that the startup module is called
22541 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
22542 @file{libc.a}.
22543
22544 @item -mads
22545 @opindex mads
22546 On embedded PowerPC systems, assume that the startup module is called
22547 @file{crt0.o} and the standard C libraries are @file{libads.a} and
22548 @file{libc.a}.
22549
22550 @item -myellowknife
22551 @opindex myellowknife
22552 On embedded PowerPC systems, assume that the startup module is called
22553 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
22554 @file{libc.a}.
22555
22556 @item -mvxworks
22557 @opindex mvxworks
22558 On System V.4 and embedded PowerPC systems, specify that you are
22559 compiling for a VxWorks system.
22560
22561 @item -memb
22562 @opindex memb
22563 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
22564 header to indicate that @samp{eabi} extended relocations are used.
22565
22566 @item -meabi
22567 @itemx -mno-eabi
22568 @opindex meabi
22569 @opindex mno-eabi
22570 On System V.4 and embedded PowerPC systems do (do not) adhere to the
22571 Embedded Applications Binary Interface (EABI), which is a set of
22572 modifications to the System V.4 specifications. Selecting @option{-meabi}
22573 means that the stack is aligned to an 8-byte boundary, a function
22574 @code{__eabi} is called from @code{main} to set up the EABI
22575 environment, and the @option{-msdata} option can use both @code{r2} and
22576 @code{r13} to point to two separate small data areas. Selecting
22577 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
22578 no EABI initialization function is called from @code{main}, and the
22579 @option{-msdata} option only uses @code{r13} to point to a single
22580 small data area. The @option{-meabi} option is on by default if you
22581 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
22582
22583 @item -msdata=eabi
22584 @opindex msdata=eabi
22585 On System V.4 and embedded PowerPC systems, put small initialized
22586 @code{const} global and static data in the @code{.sdata2} section, which
22587 is pointed to by register @code{r2}. Put small initialized
22588 non-@code{const} global and static data in the @code{.sdata} section,
22589 which is pointed to by register @code{r13}. Put small uninitialized
22590 global and static data in the @code{.sbss} section, which is adjacent to
22591 the @code{.sdata} section. The @option{-msdata=eabi} option is
22592 incompatible with the @option{-mrelocatable} option. The
22593 @option{-msdata=eabi} option also sets the @option{-memb} option.
22594
22595 @item -msdata=sysv
22596 @opindex msdata=sysv
22597 On System V.4 and embedded PowerPC systems, put small global and static
22598 data in the @code{.sdata} section, which is pointed to by register
22599 @code{r13}. Put small uninitialized global and static data in the
22600 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
22601 The @option{-msdata=sysv} option is incompatible with the
22602 @option{-mrelocatable} option.
22603
22604 @item -msdata=default
22605 @itemx -msdata
22606 @opindex msdata=default
22607 @opindex msdata
22608 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
22609 compile code the same as @option{-msdata=eabi}, otherwise compile code the
22610 same as @option{-msdata=sysv}.
22611
22612 @item -msdata=data
22613 @opindex msdata=data
22614 On System V.4 and embedded PowerPC systems, put small global
22615 data in the @code{.sdata} section. Put small uninitialized global
22616 data in the @code{.sbss} section. Do not use register @code{r13}
22617 to address small data however. This is the default behavior unless
22618 other @option{-msdata} options are used.
22619
22620 @item -msdata=none
22621 @itemx -mno-sdata
22622 @opindex msdata=none
22623 @opindex mno-sdata
22624 On embedded PowerPC systems, put all initialized global and static data
22625 in the @code{.data} section, and all uninitialized data in the
22626 @code{.bss} section.
22627
22628 @item -mblock-move-inline-limit=@var{num}
22629 @opindex mblock-move-inline-limit
22630 Inline all block moves (such as calls to @code{memcpy} or structure
22631 copies) less than or equal to @var{num} bytes. The minimum value for
22632 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
22633 targets. The default value is target-specific.
22634
22635 @item -G @var{num}
22636 @opindex G
22637 @cindex smaller data references (PowerPC)
22638 @cindex .sdata/.sdata2 references (PowerPC)
22639 On embedded PowerPC systems, put global and static items less than or
22640 equal to @var{num} bytes into the small data or BSS sections instead of
22641 the normal data or BSS section. By default, @var{num} is 8. The
22642 @option{-G @var{num}} switch is also passed to the linker.
22643 All modules should be compiled with the same @option{-G @var{num}} value.
22644
22645 @item -mregnames
22646 @itemx -mno-regnames
22647 @opindex mregnames
22648 @opindex mno-regnames
22649 On System V.4 and embedded PowerPC systems do (do not) emit register
22650 names in the assembly language output using symbolic forms.
22651
22652 @item -mlongcall
22653 @itemx -mno-longcall
22654 @opindex mlongcall
22655 @opindex mno-longcall
22656 By default assume that all calls are far away so that a longer and more
22657 expensive calling sequence is required. This is required for calls
22658 farther than 32 megabytes (33,554,432 bytes) from the current location.
22659 A short call is generated if the compiler knows
22660 the call cannot be that far away. This setting can be overridden by
22661 the @code{shortcall} function attribute, or by @code{#pragma
22662 longcall(0)}.
22663
22664 Some linkers are capable of detecting out-of-range calls and generating
22665 glue code on the fly. On these systems, long calls are unnecessary and
22666 generate slower code. As of this writing, the AIX linker can do this,
22667 as can the GNU linker for PowerPC/64. It is planned to add this feature
22668 to the GNU linker for 32-bit PowerPC systems as well.
22669
22670 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
22671 callee, L42}, plus a @dfn{branch island} (glue code). The two target
22672 addresses represent the callee and the branch island. The
22673 Darwin/PPC linker prefers the first address and generates a @code{bl
22674 callee} if the PPC @code{bl} instruction reaches the callee directly;
22675 otherwise, the linker generates @code{bl L42} to call the branch
22676 island. The branch island is appended to the body of the
22677 calling function; it computes the full 32-bit address of the callee
22678 and jumps to it.
22679
22680 On Mach-O (Darwin) systems, this option directs the compiler emit to
22681 the glue for every direct call, and the Darwin linker decides whether
22682 to use or discard it.
22683
22684 In the future, GCC may ignore all longcall specifications
22685 when the linker is known to generate glue.
22686
22687 @item -mtls-markers
22688 @itemx -mno-tls-markers
22689 @opindex mtls-markers
22690 @opindex mno-tls-markers
22691 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
22692 specifying the function argument. The relocation allows the linker to
22693 reliably associate function call with argument setup instructions for
22694 TLS optimization, which in turn allows GCC to better schedule the
22695 sequence.
22696
22697 @item -mrecip
22698 @itemx -mno-recip
22699 @opindex mrecip
22700 This option enables use of the reciprocal estimate and
22701 reciprocal square root estimate instructions with additional
22702 Newton-Raphson steps to increase precision instead of doing a divide or
22703 square root and divide for floating-point arguments. You should use
22704 the @option{-ffast-math} option when using @option{-mrecip} (or at
22705 least @option{-funsafe-math-optimizations},
22706 @option{-ffinite-math-only}, @option{-freciprocal-math} and
22707 @option{-fno-trapping-math}). Note that while the throughput of the
22708 sequence is generally higher than the throughput of the non-reciprocal
22709 instruction, the precision of the sequence can be decreased by up to 2
22710 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
22711 roots.
22712
22713 @item -mrecip=@var{opt}
22714 @opindex mrecip=opt
22715 This option controls which reciprocal estimate instructions
22716 may be used. @var{opt} is a comma-separated list of options, which may
22717 be preceded by a @code{!} to invert the option:
22718
22719 @table @samp
22720
22721 @item all
22722 Enable all estimate instructions.
22723
22724 @item default
22725 Enable the default instructions, equivalent to @option{-mrecip}.
22726
22727 @item none
22728 Disable all estimate instructions, equivalent to @option{-mno-recip}.
22729
22730 @item div
22731 Enable the reciprocal approximation instructions for both
22732 single and double precision.
22733
22734 @item divf
22735 Enable the single-precision reciprocal approximation instructions.
22736
22737 @item divd
22738 Enable the double-precision reciprocal approximation instructions.
22739
22740 @item rsqrt
22741 Enable the reciprocal square root approximation instructions for both
22742 single and double precision.
22743
22744 @item rsqrtf
22745 Enable the single-precision reciprocal square root approximation instructions.
22746
22747 @item rsqrtd
22748 Enable the double-precision reciprocal square root approximation instructions.
22749
22750 @end table
22751
22752 So, for example, @option{-mrecip=all,!rsqrtd} enables
22753 all of the reciprocal estimate instructions, except for the
22754 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
22755 which handle the double-precision reciprocal square root calculations.
22756
22757 @item -mrecip-precision
22758 @itemx -mno-recip-precision
22759 @opindex mrecip-precision
22760 Assume (do not assume) that the reciprocal estimate instructions
22761 provide higher-precision estimates than is mandated by the PowerPC
22762 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
22763 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
22764 The double-precision square root estimate instructions are not generated by
22765 default on low-precision machines, since they do not provide an
22766 estimate that converges after three steps.
22767
22768 @item -mveclibabi=@var{type}
22769 @opindex mveclibabi
22770 Specifies the ABI type to use for vectorizing intrinsics using an
22771 external library. The only type supported at present is @samp{mass},
22772 which specifies to use IBM's Mathematical Acceleration Subsystem
22773 (MASS) libraries for vectorizing intrinsics using external libraries.
22774 GCC currently emits calls to @code{acosd2}, @code{acosf4},
22775 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
22776 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
22777 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
22778 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
22779 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
22780 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
22781 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
22782 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
22783 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
22784 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
22785 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
22786 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
22787 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
22788 for power7. Both @option{-ftree-vectorize} and
22789 @option{-funsafe-math-optimizations} must also be enabled. The MASS
22790 libraries must be specified at link time.
22791
22792 @item -mfriz
22793 @itemx -mno-friz
22794 @opindex mfriz
22795 Generate (do not generate) the @code{friz} instruction when the
22796 @option{-funsafe-math-optimizations} option is used to optimize
22797 rounding of floating-point values to 64-bit integer and back to floating
22798 point. The @code{friz} instruction does not return the same value if
22799 the floating-point number is too large to fit in an integer.
22800
22801 @item -mpointers-to-nested-functions
22802 @itemx -mno-pointers-to-nested-functions
22803 @opindex mpointers-to-nested-functions
22804 Generate (do not generate) code to load up the static chain register
22805 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
22806 systems where a function pointer points to a 3-word descriptor giving
22807 the function address, TOC value to be loaded in register @code{r2}, and
22808 static chain value to be loaded in register @code{r11}. The
22809 @option{-mpointers-to-nested-functions} is on by default. You cannot
22810 call through pointers to nested functions or pointers
22811 to functions compiled in other languages that use the static chain if
22812 you use @option{-mno-pointers-to-nested-functions}.
22813
22814 @item -msave-toc-indirect
22815 @itemx -mno-save-toc-indirect
22816 @opindex msave-toc-indirect
22817 Generate (do not generate) code to save the TOC value in the reserved
22818 stack location in the function prologue if the function calls through
22819 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
22820 saved in the prologue, it is saved just before the call through the
22821 pointer. The @option{-mno-save-toc-indirect} option is the default.
22822
22823 @item -mcompat-align-parm
22824 @itemx -mno-compat-align-parm
22825 @opindex mcompat-align-parm
22826 Generate (do not generate) code to pass structure parameters with a
22827 maximum alignment of 64 bits, for compatibility with older versions
22828 of GCC.
22829
22830 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
22831 structure parameter on a 128-bit boundary when that structure contained
22832 a member requiring 128-bit alignment. This is corrected in more
22833 recent versions of GCC. This option may be used to generate code
22834 that is compatible with functions compiled with older versions of
22835 GCC.
22836
22837 The @option{-mno-compat-align-parm} option is the default.
22838
22839 @item -mstack-protector-guard=@var{guard}
22840 @itemx -mstack-protector-guard-reg=@var{reg}
22841 @itemx -mstack-protector-guard-offset=@var{offset}
22842 @itemx -mstack-protector-guard-symbol=@var{symbol}
22843 @opindex mstack-protector-guard
22844 @opindex mstack-protector-guard-reg
22845 @opindex mstack-protector-guard-offset
22846 @opindex mstack-protector-guard-symbol
22847 Generate stack protection code using canary at @var{guard}. Supported
22848 locations are @samp{global} for global canary or @samp{tls} for per-thread
22849 canary in the TLS block (the default with GNU libc version 2.4 or later).
22850
22851 With the latter choice the options
22852 @option{-mstack-protector-guard-reg=@var{reg}} and
22853 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
22854 which register to use as base register for reading the canary, and from what
22855 offset from that base register. The default for those is as specified in the
22856 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
22857 the offset with a symbol reference to a canary in the TLS block.
22858 @end table
22859
22860 @node RX Options
22861 @subsection RX Options
22862 @cindex RX Options
22863
22864 These command-line options are defined for RX targets:
22865
22866 @table @gcctabopt
22867 @item -m64bit-doubles
22868 @itemx -m32bit-doubles
22869 @opindex m64bit-doubles
22870 @opindex m32bit-doubles
22871 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
22872 or 32 bits (@option{-m32bit-doubles}) in size. The default is
22873 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
22874 works on 32-bit values, which is why the default is
22875 @option{-m32bit-doubles}.
22876
22877 @item -fpu
22878 @itemx -nofpu
22879 @opindex fpu
22880 @opindex nofpu
22881 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
22882 floating-point hardware. The default is enabled for the RX600
22883 series and disabled for the RX200 series.
22884
22885 Floating-point instructions are only generated for 32-bit floating-point
22886 values, however, so the FPU hardware is not used for doubles if the
22887 @option{-m64bit-doubles} option is used.
22888
22889 @emph{Note} If the @option{-fpu} option is enabled then
22890 @option{-funsafe-math-optimizations} is also enabled automatically.
22891 This is because the RX FPU instructions are themselves unsafe.
22892
22893 @item -mcpu=@var{name}
22894 @opindex mcpu
22895 Selects the type of RX CPU to be targeted. Currently three types are
22896 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
22897 the specific @samp{RX610} CPU. The default is @samp{RX600}.
22898
22899 The only difference between @samp{RX600} and @samp{RX610} is that the
22900 @samp{RX610} does not support the @code{MVTIPL} instruction.
22901
22902 The @samp{RX200} series does not have a hardware floating-point unit
22903 and so @option{-nofpu} is enabled by default when this type is
22904 selected.
22905
22906 @item -mbig-endian-data
22907 @itemx -mlittle-endian-data
22908 @opindex mbig-endian-data
22909 @opindex mlittle-endian-data
22910 Store data (but not code) in the big-endian format. The default is
22911 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
22912 format.
22913
22914 @item -msmall-data-limit=@var{N}
22915 @opindex msmall-data-limit
22916 Specifies the maximum size in bytes of global and static variables
22917 which can be placed into the small data area. Using the small data
22918 area can lead to smaller and faster code, but the size of area is
22919 limited and it is up to the programmer to ensure that the area does
22920 not overflow. Also when the small data area is used one of the RX's
22921 registers (usually @code{r13}) is reserved for use pointing to this
22922 area, so it is no longer available for use by the compiler. This
22923 could result in slower and/or larger code if variables are pushed onto
22924 the stack instead of being held in this register.
22925
22926 Note, common variables (variables that have not been initialized) and
22927 constants are not placed into the small data area as they are assigned
22928 to other sections in the output executable.
22929
22930 The default value is zero, which disables this feature. Note, this
22931 feature is not enabled by default with higher optimization levels
22932 (@option{-O2} etc) because of the potentially detrimental effects of
22933 reserving a register. It is up to the programmer to experiment and
22934 discover whether this feature is of benefit to their program. See the
22935 description of the @option{-mpid} option for a description of how the
22936 actual register to hold the small data area pointer is chosen.
22937
22938 @item -msim
22939 @itemx -mno-sim
22940 @opindex msim
22941 @opindex mno-sim
22942 Use the simulator runtime. The default is to use the libgloss
22943 board-specific runtime.
22944
22945 @item -mas100-syntax
22946 @itemx -mno-as100-syntax
22947 @opindex mas100-syntax
22948 @opindex mno-as100-syntax
22949 When generating assembler output use a syntax that is compatible with
22950 Renesas's AS100 assembler. This syntax can also be handled by the GAS
22951 assembler, but it has some restrictions so it is not generated by default.
22952
22953 @item -mmax-constant-size=@var{N}
22954 @opindex mmax-constant-size
22955 Specifies the maximum size, in bytes, of a constant that can be used as
22956 an operand in a RX instruction. Although the RX instruction set does
22957 allow constants of up to 4 bytes in length to be used in instructions,
22958 a longer value equates to a longer instruction. Thus in some
22959 circumstances it can be beneficial to restrict the size of constants
22960 that are used in instructions. Constants that are too big are instead
22961 placed into a constant pool and referenced via register indirection.
22962
22963 The value @var{N} can be between 0 and 4. A value of 0 (the default)
22964 or 4 means that constants of any size are allowed.
22965
22966 @item -mrelax
22967 @opindex mrelax
22968 Enable linker relaxation. Linker relaxation is a process whereby the
22969 linker attempts to reduce the size of a program by finding shorter
22970 versions of various instructions. Disabled by default.
22971
22972 @item -mint-register=@var{N}
22973 @opindex mint-register
22974 Specify the number of registers to reserve for fast interrupt handler
22975 functions. The value @var{N} can be between 0 and 4. A value of 1
22976 means that register @code{r13} is reserved for the exclusive use
22977 of fast interrupt handlers. A value of 2 reserves @code{r13} and
22978 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
22979 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
22980 A value of 0, the default, does not reserve any registers.
22981
22982 @item -msave-acc-in-interrupts
22983 @opindex msave-acc-in-interrupts
22984 Specifies that interrupt handler functions should preserve the
22985 accumulator register. This is only necessary if normal code might use
22986 the accumulator register, for example because it performs 64-bit
22987 multiplications. The default is to ignore the accumulator as this
22988 makes the interrupt handlers faster.
22989
22990 @item -mpid
22991 @itemx -mno-pid
22992 @opindex mpid
22993 @opindex mno-pid
22994 Enables the generation of position independent data. When enabled any
22995 access to constant data is done via an offset from a base address
22996 held in a register. This allows the location of constant data to be
22997 determined at run time without requiring the executable to be
22998 relocated, which is a benefit to embedded applications with tight
22999 memory constraints. Data that can be modified is not affected by this
23000 option.
23001
23002 Note, using this feature reserves a register, usually @code{r13}, for
23003 the constant data base address. This can result in slower and/or
23004 larger code, especially in complicated functions.
23005
23006 The actual register chosen to hold the constant data base address
23007 depends upon whether the @option{-msmall-data-limit} and/or the
23008 @option{-mint-register} command-line options are enabled. Starting
23009 with register @code{r13} and proceeding downwards, registers are
23010 allocated first to satisfy the requirements of @option{-mint-register},
23011 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
23012 is possible for the small data area register to be @code{r8} if both
23013 @option{-mint-register=4} and @option{-mpid} are specified on the
23014 command line.
23015
23016 By default this feature is not enabled. The default can be restored
23017 via the @option{-mno-pid} command-line option.
23018
23019 @item -mno-warn-multiple-fast-interrupts
23020 @itemx -mwarn-multiple-fast-interrupts
23021 @opindex mno-warn-multiple-fast-interrupts
23022 @opindex mwarn-multiple-fast-interrupts
23023 Prevents GCC from issuing a warning message if it finds more than one
23024 fast interrupt handler when it is compiling a file. The default is to
23025 issue a warning for each extra fast interrupt handler found, as the RX
23026 only supports one such interrupt.
23027
23028 @item -mallow-string-insns
23029 @itemx -mno-allow-string-insns
23030 @opindex mallow-string-insns
23031 @opindex mno-allow-string-insns
23032 Enables or disables the use of the string manipulation instructions
23033 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
23034 @code{SWHILE} and also the @code{RMPA} instruction. These
23035 instructions may prefetch data, which is not safe to do if accessing
23036 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
23037 for more information).
23038
23039 The default is to allow these instructions, but it is not possible for
23040 GCC to reliably detect all circumstances where a string instruction
23041 might be used to access an I/O register, so their use cannot be
23042 disabled automatically. Instead it is reliant upon the programmer to
23043 use the @option{-mno-allow-string-insns} option if their program
23044 accesses I/O space.
23045
23046 When the instructions are enabled GCC defines the C preprocessor
23047 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
23048 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
23049
23050 @item -mjsr
23051 @itemx -mno-jsr
23052 @opindex mjsr
23053 @opindex mno-jsr
23054 Use only (or not only) @code{JSR} instructions to access functions.
23055 This option can be used when code size exceeds the range of @code{BSR}
23056 instructions. Note that @option{-mno-jsr} does not mean to not use
23057 @code{JSR} but instead means that any type of branch may be used.
23058 @end table
23059
23060 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
23061 has special significance to the RX port when used with the
23062 @code{interrupt} function attribute. This attribute indicates a
23063 function intended to process fast interrupts. GCC ensures
23064 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
23065 and/or @code{r13} and only provided that the normal use of the
23066 corresponding registers have been restricted via the
23067 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
23068 options.
23069
23070 @node S/390 and zSeries Options
23071 @subsection S/390 and zSeries Options
23072 @cindex S/390 and zSeries Options
23073
23074 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
23075
23076 @table @gcctabopt
23077 @item -mhard-float
23078 @itemx -msoft-float
23079 @opindex mhard-float
23080 @opindex msoft-float
23081 Use (do not use) the hardware floating-point instructions and registers
23082 for floating-point operations. When @option{-msoft-float} is specified,
23083 functions in @file{libgcc.a} are used to perform floating-point
23084 operations. When @option{-mhard-float} is specified, the compiler
23085 generates IEEE floating-point instructions. This is the default.
23086
23087 @item -mhard-dfp
23088 @itemx -mno-hard-dfp
23089 @opindex mhard-dfp
23090 @opindex mno-hard-dfp
23091 Use (do not use) the hardware decimal-floating-point instructions for
23092 decimal-floating-point operations. When @option{-mno-hard-dfp} is
23093 specified, functions in @file{libgcc.a} are used to perform
23094 decimal-floating-point operations. When @option{-mhard-dfp} is
23095 specified, the compiler generates decimal-floating-point hardware
23096 instructions. This is the default for @option{-march=z9-ec} or higher.
23097
23098 @item -mlong-double-64
23099 @itemx -mlong-double-128
23100 @opindex mlong-double-64
23101 @opindex mlong-double-128
23102 These switches control the size of @code{long double} type. A size
23103 of 64 bits makes the @code{long double} type equivalent to the @code{double}
23104 type. This is the default.
23105
23106 @item -mbackchain
23107 @itemx -mno-backchain
23108 @opindex mbackchain
23109 @opindex mno-backchain
23110 Store (do not store) the address of the caller's frame as backchain pointer
23111 into the callee's stack frame.
23112 A backchain may be needed to allow debugging using tools that do not understand
23113 DWARF call frame information.
23114 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
23115 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
23116 the backchain is placed into the topmost word of the 96/160 byte register
23117 save area.
23118
23119 In general, code compiled with @option{-mbackchain} is call-compatible with
23120 code compiled with @option{-mmo-backchain}; however, use of the backchain
23121 for debugging purposes usually requires that the whole binary is built with
23122 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
23123 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
23124 to build a linux kernel use @option{-msoft-float}.
23125
23126 The default is to not maintain the backchain.
23127
23128 @item -mpacked-stack
23129 @itemx -mno-packed-stack
23130 @opindex mpacked-stack
23131 @opindex mno-packed-stack
23132 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
23133 specified, the compiler uses the all fields of the 96/160 byte register save
23134 area only for their default purpose; unused fields still take up stack space.
23135 When @option{-mpacked-stack} is specified, register save slots are densely
23136 packed at the top of the register save area; unused space is reused for other
23137 purposes, allowing for more efficient use of the available stack space.
23138 However, when @option{-mbackchain} is also in effect, the topmost word of
23139 the save area is always used to store the backchain, and the return address
23140 register is always saved two words below the backchain.
23141
23142 As long as the stack frame backchain is not used, code generated with
23143 @option{-mpacked-stack} is call-compatible with code generated with
23144 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
23145 S/390 or zSeries generated code that uses the stack frame backchain at run
23146 time, not just for debugging purposes. Such code is not call-compatible
23147 with code compiled with @option{-mpacked-stack}. Also, note that the
23148 combination of @option{-mbackchain},
23149 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
23150 to build a linux kernel use @option{-msoft-float}.
23151
23152 The default is to not use the packed stack layout.
23153
23154 @item -msmall-exec
23155 @itemx -mno-small-exec
23156 @opindex msmall-exec
23157 @opindex mno-small-exec
23158 Generate (or do not generate) code using the @code{bras} instruction
23159 to do subroutine calls.
23160 This only works reliably if the total executable size does not
23161 exceed 64k. The default is to use the @code{basr} instruction instead,
23162 which does not have this limitation.
23163
23164 @item -m64
23165 @itemx -m31
23166 @opindex m64
23167 @opindex m31
23168 When @option{-m31} is specified, generate code compliant to the
23169 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
23170 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
23171 particular to generate 64-bit instructions. For the @samp{s390}
23172 targets, the default is @option{-m31}, while the @samp{s390x}
23173 targets default to @option{-m64}.
23174
23175 @item -mzarch
23176 @itemx -mesa
23177 @opindex mzarch
23178 @opindex mesa
23179 When @option{-mzarch} is specified, generate code using the
23180 instructions available on z/Architecture.
23181 When @option{-mesa} is specified, generate code using the
23182 instructions available on ESA/390. Note that @option{-mesa} is
23183 not possible with @option{-m64}.
23184 When generating code compliant to the GNU/Linux for S/390 ABI,
23185 the default is @option{-mesa}. When generating code compliant
23186 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
23187
23188 @item -mhtm
23189 @itemx -mno-htm
23190 @opindex mhtm
23191 @opindex mno-htm
23192 The @option{-mhtm} option enables a set of builtins making use of
23193 instructions available with the transactional execution facility
23194 introduced with the IBM zEnterprise EC12 machine generation
23195 @ref{S/390 System z Built-in Functions}.
23196 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
23197
23198 @item -mvx
23199 @itemx -mno-vx
23200 @opindex mvx
23201 @opindex mno-vx
23202 When @option{-mvx} is specified, generate code using the instructions
23203 available with the vector extension facility introduced with the IBM
23204 z13 machine generation.
23205 This option changes the ABI for some vector type values with regard to
23206 alignment and calling conventions. In case vector type values are
23207 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
23208 command will be added to mark the resulting binary with the ABI used.
23209 @option{-mvx} is enabled by default when using @option{-march=z13}.
23210
23211 @item -mzvector
23212 @itemx -mno-zvector
23213 @opindex mzvector
23214 @opindex mno-zvector
23215 The @option{-mzvector} option enables vector language extensions and
23216 builtins using instructions available with the vector extension
23217 facility introduced with the IBM z13 machine generation.
23218 This option adds support for @samp{vector} to be used as a keyword to
23219 define vector type variables and arguments. @samp{vector} is only
23220 available when GNU extensions are enabled. It will not be expanded
23221 when requesting strict standard compliance e.g. with @option{-std=c99}.
23222 In addition to the GCC low-level builtins @option{-mzvector} enables
23223 a set of builtins added for compatibility with AltiVec-style
23224 implementations like Power and Cell. In order to make use of these
23225 builtins the header file @file{vecintrin.h} needs to be included.
23226 @option{-mzvector} is disabled by default.
23227
23228 @item -mmvcle
23229 @itemx -mno-mvcle
23230 @opindex mmvcle
23231 @opindex mno-mvcle
23232 Generate (or do not generate) code using the @code{mvcle} instruction
23233 to perform block moves. When @option{-mno-mvcle} is specified,
23234 use a @code{mvc} loop instead. This is the default unless optimizing for
23235 size.
23236
23237 @item -mdebug
23238 @itemx -mno-debug
23239 @opindex mdebug
23240 @opindex mno-debug
23241 Print (or do not print) additional debug information when compiling.
23242 The default is to not print debug information.
23243
23244 @item -march=@var{cpu-type}
23245 @opindex march
23246 Generate code that runs on @var{cpu-type}, which is the name of a
23247 system representing a certain processor type. Possible values for
23248 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
23249 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
23250 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
23251 @samp{native}.
23252
23253 The default is @option{-march=z900}. @samp{g5}/@samp{arch3} and
23254 @samp{g6} are deprecated and will be removed with future releases.
23255
23256 Specifying @samp{native} as cpu type can be used to select the best
23257 architecture option for the host processor.
23258 @option{-march=native} has no effect if GCC does not recognize the
23259 processor.
23260
23261 @item -mtune=@var{cpu-type}
23262 @opindex mtune
23263 Tune to @var{cpu-type} everything applicable about the generated code,
23264 except for the ABI and the set of available instructions.
23265 The list of @var{cpu-type} values is the same as for @option{-march}.
23266 The default is the value used for @option{-march}.
23267
23268 @item -mtpf-trace
23269 @itemx -mno-tpf-trace
23270 @opindex mtpf-trace
23271 @opindex mno-tpf-trace
23272 Generate code that adds (does not add) in TPF OS specific branches to trace
23273 routines in the operating system. This option is off by default, even
23274 when compiling for the TPF OS@.
23275
23276 @item -mfused-madd
23277 @itemx -mno-fused-madd
23278 @opindex mfused-madd
23279 @opindex mno-fused-madd
23280 Generate code that uses (does not use) the floating-point multiply and
23281 accumulate instructions. These instructions are generated by default if
23282 hardware floating point is used.
23283
23284 @item -mwarn-framesize=@var{framesize}
23285 @opindex mwarn-framesize
23286 Emit a warning if the current function exceeds the given frame size. Because
23287 this is a compile-time check it doesn't need to be a real problem when the program
23288 runs. It is intended to identify functions that most probably cause
23289 a stack overflow. It is useful to be used in an environment with limited stack
23290 size e.g.@: the linux kernel.
23291
23292 @item -mwarn-dynamicstack
23293 @opindex mwarn-dynamicstack
23294 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
23295 arrays. This is generally a bad idea with a limited stack size.
23296
23297 @item -mstack-guard=@var{stack-guard}
23298 @itemx -mstack-size=@var{stack-size}
23299 @opindex mstack-guard
23300 @opindex mstack-size
23301 If these options are provided the S/390 back end emits additional instructions in
23302 the function prologue that trigger a trap if the stack size is @var{stack-guard}
23303 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
23304 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
23305 the frame size of the compiled function is chosen.
23306 These options are intended to be used to help debugging stack overflow problems.
23307 The additionally emitted code causes only little overhead and hence can also be
23308 used in production-like systems without greater performance degradation. The given
23309 values have to be exact powers of 2 and @var{stack-size} has to be greater than
23310 @var{stack-guard} without exceeding 64k.
23311 In order to be efficient the extra code makes the assumption that the stack starts
23312 at an address aligned to the value given by @var{stack-size}.
23313 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
23314
23315 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
23316 @opindex mhotpatch
23317 If the hotpatch option is enabled, a ``hot-patching'' function
23318 prologue is generated for all functions in the compilation unit.
23319 The funtion label is prepended with the given number of two-byte
23320 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
23321 the label, 2 * @var{post-halfwords} bytes are appended, using the
23322 largest NOP like instructions the architecture allows (maximum
23323 1000000).
23324
23325 If both arguments are zero, hotpatching is disabled.
23326
23327 This option can be overridden for individual functions with the
23328 @code{hotpatch} attribute.
23329 @end table
23330
23331 @node Score Options
23332 @subsection Score Options
23333 @cindex Score Options
23334
23335 These options are defined for Score implementations:
23336
23337 @table @gcctabopt
23338 @item -meb
23339 @opindex meb
23340 Compile code for big-endian mode. This is the default.
23341
23342 @item -mel
23343 @opindex mel
23344 Compile code for little-endian mode.
23345
23346 @item -mnhwloop
23347 @opindex mnhwloop
23348 Disable generation of @code{bcnz} instructions.
23349
23350 @item -muls
23351 @opindex muls
23352 Enable generation of unaligned load and store instructions.
23353
23354 @item -mmac
23355 @opindex mmac
23356 Enable the use of multiply-accumulate instructions. Disabled by default.
23357
23358 @item -mscore5
23359 @opindex mscore5
23360 Specify the SCORE5 as the target architecture.
23361
23362 @item -mscore5u
23363 @opindex mscore5u
23364 Specify the SCORE5U of the target architecture.
23365
23366 @item -mscore7
23367 @opindex mscore7
23368 Specify the SCORE7 as the target architecture. This is the default.
23369
23370 @item -mscore7d
23371 @opindex mscore7d
23372 Specify the SCORE7D as the target architecture.
23373 @end table
23374
23375 @node SH Options
23376 @subsection SH Options
23377
23378 These @samp{-m} options are defined for the SH implementations:
23379
23380 @table @gcctabopt
23381 @item -m1
23382 @opindex m1
23383 Generate code for the SH1.
23384
23385 @item -m2
23386 @opindex m2
23387 Generate code for the SH2.
23388
23389 @item -m2e
23390 Generate code for the SH2e.
23391
23392 @item -m2a-nofpu
23393 @opindex m2a-nofpu
23394 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
23395 that the floating-point unit is not used.
23396
23397 @item -m2a-single-only
23398 @opindex m2a-single-only
23399 Generate code for the SH2a-FPU, in such a way that no double-precision
23400 floating-point operations are used.
23401
23402 @item -m2a-single
23403 @opindex m2a-single
23404 Generate code for the SH2a-FPU assuming the floating-point unit is in
23405 single-precision mode by default.
23406
23407 @item -m2a
23408 @opindex m2a
23409 Generate code for the SH2a-FPU assuming the floating-point unit is in
23410 double-precision mode by default.
23411
23412 @item -m3
23413 @opindex m3
23414 Generate code for the SH3.
23415
23416 @item -m3e
23417 @opindex m3e
23418 Generate code for the SH3e.
23419
23420 @item -m4-nofpu
23421 @opindex m4-nofpu
23422 Generate code for the SH4 without a floating-point unit.
23423
23424 @item -m4-single-only
23425 @opindex m4-single-only
23426 Generate code for the SH4 with a floating-point unit that only
23427 supports single-precision arithmetic.
23428
23429 @item -m4-single
23430 @opindex m4-single
23431 Generate code for the SH4 assuming the floating-point unit is in
23432 single-precision mode by default.
23433
23434 @item -m4
23435 @opindex m4
23436 Generate code for the SH4.
23437
23438 @item -m4-100
23439 @opindex m4-100
23440 Generate code for SH4-100.
23441
23442 @item -m4-100-nofpu
23443 @opindex m4-100-nofpu
23444 Generate code for SH4-100 in such a way that the
23445 floating-point unit is not used.
23446
23447 @item -m4-100-single
23448 @opindex m4-100-single
23449 Generate code for SH4-100 assuming the floating-point unit is in
23450 single-precision mode by default.
23451
23452 @item -m4-100-single-only
23453 @opindex m4-100-single-only
23454 Generate code for SH4-100 in such a way that no double-precision
23455 floating-point operations are used.
23456
23457 @item -m4-200
23458 @opindex m4-200
23459 Generate code for SH4-200.
23460
23461 @item -m4-200-nofpu
23462 @opindex m4-200-nofpu
23463 Generate code for SH4-200 without in such a way that the
23464 floating-point unit is not used.
23465
23466 @item -m4-200-single
23467 @opindex m4-200-single
23468 Generate code for SH4-200 assuming the floating-point unit is in
23469 single-precision mode by default.
23470
23471 @item -m4-200-single-only
23472 @opindex m4-200-single-only
23473 Generate code for SH4-200 in such a way that no double-precision
23474 floating-point operations are used.
23475
23476 @item -m4-300
23477 @opindex m4-300
23478 Generate code for SH4-300.
23479
23480 @item -m4-300-nofpu
23481 @opindex m4-300-nofpu
23482 Generate code for SH4-300 without in such a way that the
23483 floating-point unit is not used.
23484
23485 @item -m4-300-single
23486 @opindex m4-300-single
23487 Generate code for SH4-300 in such a way that no double-precision
23488 floating-point operations are used.
23489
23490 @item -m4-300-single-only
23491 @opindex m4-300-single-only
23492 Generate code for SH4-300 in such a way that no double-precision
23493 floating-point operations are used.
23494
23495 @item -m4-340
23496 @opindex m4-340
23497 Generate code for SH4-340 (no MMU, no FPU).
23498
23499 @item -m4-500
23500 @opindex m4-500
23501 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
23502 assembler.
23503
23504 @item -m4a-nofpu
23505 @opindex m4a-nofpu
23506 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
23507 floating-point unit is not used.
23508
23509 @item -m4a-single-only
23510 @opindex m4a-single-only
23511 Generate code for the SH4a, in such a way that no double-precision
23512 floating-point operations are used.
23513
23514 @item -m4a-single
23515 @opindex m4a-single
23516 Generate code for the SH4a assuming the floating-point unit is in
23517 single-precision mode by default.
23518
23519 @item -m4a
23520 @opindex m4a
23521 Generate code for the SH4a.
23522
23523 @item -m4al
23524 @opindex m4al
23525 Same as @option{-m4a-nofpu}, except that it implicitly passes
23526 @option{-dsp} to the assembler. GCC doesn't generate any DSP
23527 instructions at the moment.
23528
23529 @item -mb
23530 @opindex mb
23531 Compile code for the processor in big-endian mode.
23532
23533 @item -ml
23534 @opindex ml
23535 Compile code for the processor in little-endian mode.
23536
23537 @item -mdalign
23538 @opindex mdalign
23539 Align doubles at 64-bit boundaries. Note that this changes the calling
23540 conventions, and thus some functions from the standard C library do
23541 not work unless you recompile it first with @option{-mdalign}.
23542
23543 @item -mrelax
23544 @opindex mrelax
23545 Shorten some address references at link time, when possible; uses the
23546 linker option @option{-relax}.
23547
23548 @item -mbigtable
23549 @opindex mbigtable
23550 Use 32-bit offsets in @code{switch} tables. The default is to use
23551 16-bit offsets.
23552
23553 @item -mbitops
23554 @opindex mbitops
23555 Enable the use of bit manipulation instructions on SH2A.
23556
23557 @item -mfmovd
23558 @opindex mfmovd
23559 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
23560 alignment constraints.
23561
23562 @item -mrenesas
23563 @opindex mrenesas
23564 Comply with the calling conventions defined by Renesas.
23565
23566 @item -mno-renesas
23567 @opindex mno-renesas
23568 Comply with the calling conventions defined for GCC before the Renesas
23569 conventions were available. This option is the default for all
23570 targets of the SH toolchain.
23571
23572 @item -mnomacsave
23573 @opindex mnomacsave
23574 Mark the @code{MAC} register as call-clobbered, even if
23575 @option{-mrenesas} is given.
23576
23577 @item -mieee
23578 @itemx -mno-ieee
23579 @opindex mieee
23580 @opindex mno-ieee
23581 Control the IEEE compliance of floating-point comparisons, which affects the
23582 handling of cases where the result of a comparison is unordered. By default
23583 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
23584 enabled @option{-mno-ieee} is implicitly set, which results in faster
23585 floating-point greater-equal and less-equal comparisons. The implicit settings
23586 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
23587
23588 @item -minline-ic_invalidate
23589 @opindex minline-ic_invalidate
23590 Inline code to invalidate instruction cache entries after setting up
23591 nested function trampolines.
23592 This option has no effect if @option{-musermode} is in effect and the selected
23593 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
23594 instruction.
23595 If the selected code generation option does not allow the use of the @code{icbi}
23596 instruction, and @option{-musermode} is not in effect, the inlined code
23597 manipulates the instruction cache address array directly with an associative
23598 write. This not only requires privileged mode at run time, but it also
23599 fails if the cache line had been mapped via the TLB and has become unmapped.
23600
23601 @item -misize
23602 @opindex misize
23603 Dump instruction size and location in the assembly code.
23604
23605 @item -mpadstruct
23606 @opindex mpadstruct
23607 This option is deprecated. It pads structures to multiple of 4 bytes,
23608 which is incompatible with the SH ABI@.
23609
23610 @item -matomic-model=@var{model}
23611 @opindex matomic-model=@var{model}
23612 Sets the model of atomic operations and additional parameters as a comma
23613 separated list. For details on the atomic built-in functions see
23614 @ref{__atomic Builtins}. The following models and parameters are supported:
23615
23616 @table @samp
23617
23618 @item none
23619 Disable compiler generated atomic sequences and emit library calls for atomic
23620 operations. This is the default if the target is not @code{sh*-*-linux*}.
23621
23622 @item soft-gusa
23623 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
23624 built-in functions. The generated atomic sequences require additional support
23625 from the interrupt/exception handling code of the system and are only suitable
23626 for SH3* and SH4* single-core systems. This option is enabled by default when
23627 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
23628 this option also partially utilizes the hardware atomic instructions
23629 @code{movli.l} and @code{movco.l} to create more efficient code, unless
23630 @samp{strict} is specified.
23631
23632 @item soft-tcb
23633 Generate software atomic sequences that use a variable in the thread control
23634 block. This is a variation of the gUSA sequences which can also be used on
23635 SH1* and SH2* targets. The generated atomic sequences require additional
23636 support from the interrupt/exception handling code of the system and are only
23637 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
23638 parameter has to be specified as well.
23639
23640 @item soft-imask
23641 Generate software atomic sequences that temporarily disable interrupts by
23642 setting @code{SR.IMASK = 1111}. This model works only when the program runs
23643 in privileged mode and is only suitable for single-core systems. Additional
23644 support from the interrupt/exception handling code of the system is not
23645 required. This model is enabled by default when the target is
23646 @code{sh*-*-linux*} and SH1* or SH2*.
23647
23648 @item hard-llcs
23649 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
23650 instructions only. This is only available on SH4A and is suitable for
23651 multi-core systems. Since the hardware instructions support only 32 bit atomic
23652 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
23653 Code compiled with this option is also compatible with other software
23654 atomic model interrupt/exception handling systems if executed on an SH4A
23655 system. Additional support from the interrupt/exception handling code of the
23656 system is not required for this model.
23657
23658 @item gbr-offset=
23659 This parameter specifies the offset in bytes of the variable in the thread
23660 control block structure that should be used by the generated atomic sequences
23661 when the @samp{soft-tcb} model has been selected. For other models this
23662 parameter is ignored. The specified value must be an integer multiple of four
23663 and in the range 0-1020.
23664
23665 @item strict
23666 This parameter prevents mixed usage of multiple atomic models, even if they
23667 are compatible, and makes the compiler generate atomic sequences of the
23668 specified model only.
23669
23670 @end table
23671
23672 @item -mtas
23673 @opindex mtas
23674 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
23675 Notice that depending on the particular hardware and software configuration
23676 this can degrade overall performance due to the operand cache line flushes
23677 that are implied by the @code{tas.b} instruction. On multi-core SH4A
23678 processors the @code{tas.b} instruction must be used with caution since it
23679 can result in data corruption for certain cache configurations.
23680
23681 @item -mprefergot
23682 @opindex mprefergot
23683 When generating position-independent code, emit function calls using
23684 the Global Offset Table instead of the Procedure Linkage Table.
23685
23686 @item -musermode
23687 @itemx -mno-usermode
23688 @opindex musermode
23689 @opindex mno-usermode
23690 Don't allow (allow) the compiler generating privileged mode code. Specifying
23691 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
23692 inlined code would not work in user mode. @option{-musermode} is the default
23693 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
23694 @option{-musermode} has no effect, since there is no user mode.
23695
23696 @item -multcost=@var{number}
23697 @opindex multcost=@var{number}
23698 Set the cost to assume for a multiply insn.
23699
23700 @item -mdiv=@var{strategy}
23701 @opindex mdiv=@var{strategy}
23702 Set the division strategy to be used for integer division operations.
23703 @var{strategy} can be one of:
23704
23705 @table @samp
23706
23707 @item call-div1
23708 Calls a library function that uses the single-step division instruction
23709 @code{div1} to perform the operation. Division by zero calculates an
23710 unspecified result and does not trap. This is the default except for SH4,
23711 SH2A and SHcompact.
23712
23713 @item call-fp
23714 Calls a library function that performs the operation in double precision
23715 floating point. Division by zero causes a floating-point exception. This is
23716 the default for SHcompact with FPU. Specifying this for targets that do not
23717 have a double precision FPU defaults to @code{call-div1}.
23718
23719 @item call-table
23720 Calls a library function that uses a lookup table for small divisors and
23721 the @code{div1} instruction with case distinction for larger divisors. Division
23722 by zero calculates an unspecified result and does not trap. This is the default
23723 for SH4. Specifying this for targets that do not have dynamic shift
23724 instructions defaults to @code{call-div1}.
23725
23726 @end table
23727
23728 When a division strategy has not been specified the default strategy is
23729 selected based on the current target. For SH2A the default strategy is to
23730 use the @code{divs} and @code{divu} instructions instead of library function
23731 calls.
23732
23733 @item -maccumulate-outgoing-args
23734 @opindex maccumulate-outgoing-args
23735 Reserve space once for outgoing arguments in the function prologue rather
23736 than around each call. Generally beneficial for performance and size. Also
23737 needed for unwinding to avoid changing the stack frame around conditional code.
23738
23739 @item -mdivsi3_libfunc=@var{name}
23740 @opindex mdivsi3_libfunc=@var{name}
23741 Set the name of the library function used for 32-bit signed division to
23742 @var{name}.
23743 This only affects the name used in the @samp{call} division strategies, and
23744 the compiler still expects the same sets of input/output/clobbered registers as
23745 if this option were not present.
23746
23747 @item -mfixed-range=@var{register-range}
23748 @opindex mfixed-range
23749 Generate code treating the given register range as fixed registers.
23750 A fixed register is one that the register allocator can not use. This is
23751 useful when compiling kernel code. A register range is specified as
23752 two registers separated by a dash. Multiple register ranges can be
23753 specified separated by a comma.
23754
23755 @item -mbranch-cost=@var{num}
23756 @opindex mbranch-cost=@var{num}
23757 Assume @var{num} to be the cost for a branch instruction. Higher numbers
23758 make the compiler try to generate more branch-free code if possible.
23759 If not specified the value is selected depending on the processor type that
23760 is being compiled for.
23761
23762 @item -mzdcbranch
23763 @itemx -mno-zdcbranch
23764 @opindex mzdcbranch
23765 @opindex mno-zdcbranch
23766 Assume (do not assume) that zero displacement conditional branch instructions
23767 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
23768 compiler prefers zero displacement branch code sequences. This is
23769 enabled by default when generating code for SH4 and SH4A. It can be explicitly
23770 disabled by specifying @option{-mno-zdcbranch}.
23771
23772 @item -mcbranch-force-delay-slot
23773 @opindex mcbranch-force-delay-slot
23774 Force the usage of delay slots for conditional branches, which stuffs the delay
23775 slot with a @code{nop} if a suitable instruction cannot be found. By default
23776 this option is disabled. It can be enabled to work around hardware bugs as
23777 found in the original SH7055.
23778
23779 @item -mfused-madd
23780 @itemx -mno-fused-madd
23781 @opindex mfused-madd
23782 @opindex mno-fused-madd
23783 Generate code that uses (does not use) the floating-point multiply and
23784 accumulate instructions. These instructions are generated by default
23785 if hardware floating point is used. The machine-dependent
23786 @option{-mfused-madd} option is now mapped to the machine-independent
23787 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23788 mapped to @option{-ffp-contract=off}.
23789
23790 @item -mfsca
23791 @itemx -mno-fsca
23792 @opindex mfsca
23793 @opindex mno-fsca
23794 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
23795 and cosine approximations. The option @option{-mfsca} must be used in
23796 combination with @option{-funsafe-math-optimizations}. It is enabled by default
23797 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
23798 approximations even if @option{-funsafe-math-optimizations} is in effect.
23799
23800 @item -mfsrra
23801 @itemx -mno-fsrra
23802 @opindex mfsrra
23803 @opindex mno-fsrra
23804 Allow or disallow the compiler to emit the @code{fsrra} instruction for
23805 reciprocal square root approximations. The option @option{-mfsrra} must be used
23806 in combination with @option{-funsafe-math-optimizations} and
23807 @option{-ffinite-math-only}. It is enabled by default when generating code for
23808 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
23809 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
23810 in effect.
23811
23812 @item -mpretend-cmove
23813 @opindex mpretend-cmove
23814 Prefer zero-displacement conditional branches for conditional move instruction
23815 patterns. This can result in faster code on the SH4 processor.
23816
23817 @item -mfdpic
23818 @opindex fdpic
23819 Generate code using the FDPIC ABI.
23820
23821 @end table
23822
23823 @node Solaris 2 Options
23824 @subsection Solaris 2 Options
23825 @cindex Solaris 2 options
23826
23827 These @samp{-m} options are supported on Solaris 2:
23828
23829 @table @gcctabopt
23830 @item -mclear-hwcap
23831 @opindex mclear-hwcap
23832 @option{-mclear-hwcap} tells the compiler to remove the hardware
23833 capabilities generated by the Solaris assembler. This is only necessary
23834 when object files use ISA extensions not supported by the current
23835 machine, but check at runtime whether or not to use them.
23836
23837 @item -mimpure-text
23838 @opindex mimpure-text
23839 @option{-mimpure-text}, used in addition to @option{-shared}, tells
23840 the compiler to not pass @option{-z text} to the linker when linking a
23841 shared object. Using this option, you can link position-dependent
23842 code into a shared object.
23843
23844 @option{-mimpure-text} suppresses the ``relocations remain against
23845 allocatable but non-writable sections'' linker error message.
23846 However, the necessary relocations trigger copy-on-write, and the
23847 shared object is not actually shared across processes. Instead of
23848 using @option{-mimpure-text}, you should compile all source code with
23849 @option{-fpic} or @option{-fPIC}.
23850
23851 @end table
23852
23853 These switches are supported in addition to the above on Solaris 2:
23854
23855 @table @gcctabopt
23856 @item -pthreads
23857 @opindex pthreads
23858 This is a synonym for @option{-pthread}.
23859 @end table
23860
23861 @node SPARC Options
23862 @subsection SPARC Options
23863 @cindex SPARC options
23864
23865 These @samp{-m} options are supported on the SPARC:
23866
23867 @table @gcctabopt
23868 @item -mno-app-regs
23869 @itemx -mapp-regs
23870 @opindex mno-app-regs
23871 @opindex mapp-regs
23872 Specify @option{-mapp-regs} to generate output using the global registers
23873 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
23874 global register 1, each global register 2 through 4 is then treated as an
23875 allocable register that is clobbered by function calls. This is the default.
23876
23877 To be fully SVR4 ABI-compliant at the cost of some performance loss,
23878 specify @option{-mno-app-regs}. You should compile libraries and system
23879 software with this option.
23880
23881 @item -mflat
23882 @itemx -mno-flat
23883 @opindex mflat
23884 @opindex mno-flat
23885 With @option{-mflat}, the compiler does not generate save/restore instructions
23886 and uses a ``flat'' or single register window model. This model is compatible
23887 with the regular register window model. The local registers and the input
23888 registers (0--5) are still treated as ``call-saved'' registers and are
23889 saved on the stack as needed.
23890
23891 With @option{-mno-flat} (the default), the compiler generates save/restore
23892 instructions (except for leaf functions). This is the normal operating mode.
23893
23894 @item -mfpu
23895 @itemx -mhard-float
23896 @opindex mfpu
23897 @opindex mhard-float
23898 Generate output containing floating-point instructions. This is the
23899 default.
23900
23901 @item -mno-fpu
23902 @itemx -msoft-float
23903 @opindex mno-fpu
23904 @opindex msoft-float
23905 Generate output containing library calls for floating point.
23906 @strong{Warning:} the requisite libraries are not available for all SPARC
23907 targets. Normally the facilities of the machine's usual C compiler are
23908 used, but this cannot be done directly in cross-compilation. You must make
23909 your own arrangements to provide suitable library functions for
23910 cross-compilation. The embedded targets @samp{sparc-*-aout} and
23911 @samp{sparclite-*-*} do provide software floating-point support.
23912
23913 @option{-msoft-float} changes the calling convention in the output file;
23914 therefore, it is only useful if you compile @emph{all} of a program with
23915 this option. In particular, you need to compile @file{libgcc.a}, the
23916 library that comes with GCC, with @option{-msoft-float} in order for
23917 this to work.
23918
23919 @item -mhard-quad-float
23920 @opindex mhard-quad-float
23921 Generate output containing quad-word (long double) floating-point
23922 instructions.
23923
23924 @item -msoft-quad-float
23925 @opindex msoft-quad-float
23926 Generate output containing library calls for quad-word (long double)
23927 floating-point instructions. The functions called are those specified
23928 in the SPARC ABI@. This is the default.
23929
23930 As of this writing, there are no SPARC implementations that have hardware
23931 support for the quad-word floating-point instructions. They all invoke
23932 a trap handler for one of these instructions, and then the trap handler
23933 emulates the effect of the instruction. Because of the trap handler overhead,
23934 this is much slower than calling the ABI library routines. Thus the
23935 @option{-msoft-quad-float} option is the default.
23936
23937 @item -mno-unaligned-doubles
23938 @itemx -munaligned-doubles
23939 @opindex mno-unaligned-doubles
23940 @opindex munaligned-doubles
23941 Assume that doubles have 8-byte alignment. This is the default.
23942
23943 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
23944 alignment only if they are contained in another type, or if they have an
23945 absolute address. Otherwise, it assumes they have 4-byte alignment.
23946 Specifying this option avoids some rare compatibility problems with code
23947 generated by other compilers. It is not the default because it results
23948 in a performance loss, especially for floating-point code.
23949
23950 @item -muser-mode
23951 @itemx -mno-user-mode
23952 @opindex muser-mode
23953 @opindex mno-user-mode
23954 Do not generate code that can only run in supervisor mode. This is relevant
23955 only for the @code{casa} instruction emitted for the LEON3 processor. This
23956 is the default.
23957
23958 @item -mfaster-structs
23959 @itemx -mno-faster-structs
23960 @opindex mfaster-structs
23961 @opindex mno-faster-structs
23962 With @option{-mfaster-structs}, the compiler assumes that structures
23963 should have 8-byte alignment. This enables the use of pairs of
23964 @code{ldd} and @code{std} instructions for copies in structure
23965 assignment, in place of twice as many @code{ld} and @code{st} pairs.
23966 However, the use of this changed alignment directly violates the SPARC
23967 ABI@. Thus, it's intended only for use on targets where the developer
23968 acknowledges that their resulting code is not directly in line with
23969 the rules of the ABI@.
23970
23971 @item -mstd-struct-return
23972 @itemx -mno-std-struct-return
23973 @opindex mstd-struct-return
23974 @opindex mno-std-struct-return
23975 With @option{-mstd-struct-return}, the compiler generates checking code
23976 in functions returning structures or unions to detect size mismatches
23977 between the two sides of function calls, as per the 32-bit ABI@.
23978
23979 The default is @option{-mno-std-struct-return}. This option has no effect
23980 in 64-bit mode.
23981
23982 @item -mlra
23983 @itemx -mno-lra
23984 @opindex mlra
23985 @opindex mno-lra
23986 Enable Local Register Allocation. This is the default for SPARC since GCC 7
23987 so @option{-mno-lra} needs to be passed to get old Reload.
23988
23989 @item -mcpu=@var{cpu_type}
23990 @opindex mcpu
23991 Set the instruction set, register set, and instruction scheduling parameters
23992 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
23993 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
23994 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
23995 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
23996 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
23997 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
23998
23999 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
24000 which selects the best architecture option for the host processor.
24001 @option{-mcpu=native} has no effect if GCC does not recognize
24002 the processor.
24003
24004 Default instruction scheduling parameters are used for values that select
24005 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
24006 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
24007
24008 Here is a list of each supported architecture and their supported
24009 implementations.
24010
24011 @table @asis
24012 @item v7
24013 cypress, leon3v7
24014
24015 @item v8
24016 supersparc, hypersparc, leon, leon3
24017
24018 @item sparclite
24019 f930, f934, sparclite86x
24020
24021 @item sparclet
24022 tsc701
24023
24024 @item v9
24025 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
24026 niagara7, m8
24027 @end table
24028
24029 By default (unless configured otherwise), GCC generates code for the V7
24030 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
24031 additionally optimizes it for the Cypress CY7C602 chip, as used in the
24032 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
24033 SPARCStation 1, 2, IPX etc.
24034
24035 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
24036 architecture. The only difference from V7 code is that the compiler emits
24037 the integer multiply and integer divide instructions which exist in SPARC-V8
24038 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
24039 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
24040 2000 series.
24041
24042 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
24043 the SPARC architecture. This adds the integer multiply, integer divide step
24044 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
24045 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
24046 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
24047 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
24048 MB86934 chip, which is the more recent SPARClite with FPU@.
24049
24050 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
24051 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
24052 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
24053 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
24054 optimizes it for the TEMIC SPARClet chip.
24055
24056 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
24057 architecture. This adds 64-bit integer and floating-point move instructions,
24058 3 additional floating-point condition code registers and conditional move
24059 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
24060 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
24061 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
24062 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
24063 @option{-mcpu=niagara}, the compiler additionally optimizes it for
24064 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
24065 additionally optimizes it for Sun UltraSPARC T2 chips. With
24066 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
24067 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
24068 additionally optimizes it for Sun UltraSPARC T4 chips. With
24069 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
24070 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
24071 additionally optimizes it for Oracle M8 chips.
24072
24073 @item -mtune=@var{cpu_type}
24074 @opindex mtune
24075 Set the instruction scheduling parameters for machine type
24076 @var{cpu_type}, but do not set the instruction set or register set that the
24077 option @option{-mcpu=@var{cpu_type}} does.
24078
24079 The same values for @option{-mcpu=@var{cpu_type}} can be used for
24080 @option{-mtune=@var{cpu_type}}, but the only useful values are those
24081 that select a particular CPU implementation. Those are
24082 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
24083 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
24084 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
24085 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
24086 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
24087 and GNU/Linux toolchains, @samp{native} can also be used.
24088
24089 @item -mv8plus
24090 @itemx -mno-v8plus
24091 @opindex mv8plus
24092 @opindex mno-v8plus
24093 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
24094 difference from the V8 ABI is that the global and out registers are
24095 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
24096 mode for all SPARC-V9 processors.
24097
24098 @item -mvis
24099 @itemx -mno-vis
24100 @opindex mvis
24101 @opindex mno-vis
24102 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
24103 Visual Instruction Set extensions. The default is @option{-mno-vis}.
24104
24105 @item -mvis2
24106 @itemx -mno-vis2
24107 @opindex mvis2
24108 @opindex mno-vis2
24109 With @option{-mvis2}, GCC generates code that takes advantage of
24110 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
24111 default is @option{-mvis2} when targeting a cpu that supports such
24112 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
24113 also sets @option{-mvis}.
24114
24115 @item -mvis3
24116 @itemx -mno-vis3
24117 @opindex mvis3
24118 @opindex mno-vis3
24119 With @option{-mvis3}, GCC generates code that takes advantage of
24120 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
24121 default is @option{-mvis3} when targeting a cpu that supports such
24122 instructions, such as niagara-3 and later. Setting @option{-mvis3}
24123 also sets @option{-mvis2} and @option{-mvis}.
24124
24125 @item -mvis4
24126 @itemx -mno-vis4
24127 @opindex mvis4
24128 @opindex mno-vis4
24129 With @option{-mvis4}, GCC generates code that takes advantage of
24130 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
24131 default is @option{-mvis4} when targeting a cpu that supports such
24132 instructions, such as niagara-7 and later. Setting @option{-mvis4}
24133 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
24134
24135 @item -mvis4b
24136 @itemx -mno-vis4b
24137 @opindex mvis4b
24138 @opindex mno-vis4b
24139 With @option{-mvis4b}, GCC generates code that takes advantage of
24140 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
24141 the additional VIS instructions introduced in the Oracle SPARC
24142 Architecture 2017. The default is @option{-mvis4b} when targeting a
24143 cpu that supports such instructions, such as m8 and later. Setting
24144 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
24145 @option{-mvis2} and @option{-mvis}.
24146
24147 @item -mcbcond
24148 @itemx -mno-cbcond
24149 @opindex mcbcond
24150 @opindex mno-cbcond
24151 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
24152 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
24153 when targeting a CPU that supports such instructions, such as Niagara-4 and
24154 later.
24155
24156 @item -mfmaf
24157 @itemx -mno-fmaf
24158 @opindex mfmaf
24159 @opindex mno-fmaf
24160 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
24161 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
24162 when targeting a CPU that supports such instructions, such as Niagara-3 and
24163 later.
24164
24165 @item -mfsmuld
24166 @itemx -mno-fsmuld
24167 @opindex mfsmuld
24168 @opindex mno-fsmuld
24169 With @option{-mfsmuld}, GCC generates code that takes advantage of the
24170 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
24171 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
24172 or V9 with FPU except @option{-mcpu=leon}.
24173
24174 @item -mpopc
24175 @itemx -mno-popc
24176 @opindex mpopc
24177 @opindex mno-popc
24178 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
24179 Population Count instruction. The default is @option{-mpopc}
24180 when targeting a CPU that supports such an instruction, such as Niagara-2 and
24181 later.
24182
24183 @item -msubxc
24184 @itemx -mno-subxc
24185 @opindex msubxc
24186 @opindex mno-subxc
24187 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
24188 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
24189 when targeting a CPU that supports such an instruction, such as Niagara-7 and
24190 later.
24191
24192 @item -mfix-at697f
24193 @opindex mfix-at697f
24194 Enable the documented workaround for the single erratum of the Atmel AT697F
24195 processor (which corresponds to erratum #13 of the AT697E processor).
24196
24197 @item -mfix-ut699
24198 @opindex mfix-ut699
24199 Enable the documented workarounds for the floating-point errata and the data
24200 cache nullify errata of the UT699 processor.
24201
24202 @item -mfix-ut700
24203 @opindex mfix-ut700
24204 Enable the documented workaround for the back-to-back store errata of
24205 the UT699E/UT700 processor.
24206
24207 @item -mfix-gr712rc
24208 @opindex mfix-gr712rc
24209 Enable the documented workaround for the back-to-back store errata of
24210 the GR712RC processor.
24211 @end table
24212
24213 These @samp{-m} options are supported in addition to the above
24214 on SPARC-V9 processors in 64-bit environments:
24215
24216 @table @gcctabopt
24217 @item -m32
24218 @itemx -m64
24219 @opindex m32
24220 @opindex m64
24221 Generate code for a 32-bit or 64-bit environment.
24222 The 32-bit environment sets int, long and pointer to 32 bits.
24223 The 64-bit environment sets int to 32 bits and long and pointer
24224 to 64 bits.
24225
24226 @item -mcmodel=@var{which}
24227 @opindex mcmodel
24228 Set the code model to one of
24229
24230 @table @samp
24231 @item medlow
24232 The Medium/Low code model: 64-bit addresses, programs
24233 must be linked in the low 32 bits of memory. Programs can be statically
24234 or dynamically linked.
24235
24236 @item medmid
24237 The Medium/Middle code model: 64-bit addresses, programs
24238 must be linked in the low 44 bits of memory, the text and data segments must
24239 be less than 2GB in size and the data segment must be located within 2GB of
24240 the text segment.
24241
24242 @item medany
24243 The Medium/Anywhere code model: 64-bit addresses, programs
24244 may be linked anywhere in memory, the text and data segments must be less
24245 than 2GB in size and the data segment must be located within 2GB of the
24246 text segment.
24247
24248 @item embmedany
24249 The Medium/Anywhere code model for embedded systems:
24250 64-bit addresses, the text and data segments must be less than 2GB in
24251 size, both starting anywhere in memory (determined at link time). The
24252 global register %g4 points to the base of the data segment. Programs
24253 are statically linked and PIC is not supported.
24254 @end table
24255
24256 @item -mmemory-model=@var{mem-model}
24257 @opindex mmemory-model
24258 Set the memory model in force on the processor to one of
24259
24260 @table @samp
24261 @item default
24262 The default memory model for the processor and operating system.
24263
24264 @item rmo
24265 Relaxed Memory Order
24266
24267 @item pso
24268 Partial Store Order
24269
24270 @item tso
24271 Total Store Order
24272
24273 @item sc
24274 Sequential Consistency
24275 @end table
24276
24277 These memory models are formally defined in Appendix D of the SPARC-V9
24278 architecture manual, as set in the processor's @code{PSTATE.MM} field.
24279
24280 @item -mstack-bias
24281 @itemx -mno-stack-bias
24282 @opindex mstack-bias
24283 @opindex mno-stack-bias
24284 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
24285 frame pointer if present, are offset by @minus{}2047 which must be added back
24286 when making stack frame references. This is the default in 64-bit mode.
24287 Otherwise, assume no such offset is present.
24288 @end table
24289
24290 @node SPU Options
24291 @subsection SPU Options
24292 @cindex SPU options
24293
24294 These @samp{-m} options are supported on the SPU:
24295
24296 @table @gcctabopt
24297 @item -mwarn-reloc
24298 @itemx -merror-reloc
24299 @opindex mwarn-reloc
24300 @opindex merror-reloc
24301
24302 The loader for SPU does not handle dynamic relocations. By default, GCC
24303 gives an error when it generates code that requires a dynamic
24304 relocation. @option{-mno-error-reloc} disables the error,
24305 @option{-mwarn-reloc} generates a warning instead.
24306
24307 @item -msafe-dma
24308 @itemx -munsafe-dma
24309 @opindex msafe-dma
24310 @opindex munsafe-dma
24311
24312 Instructions that initiate or test completion of DMA must not be
24313 reordered with respect to loads and stores of the memory that is being
24314 accessed.
24315 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
24316 memory accesses, but that can lead to inefficient code in places where the
24317 memory is known to not change. Rather than mark the memory as volatile,
24318 you can use @option{-msafe-dma} to tell the compiler to treat
24319 the DMA instructions as potentially affecting all memory.
24320
24321 @item -mbranch-hints
24322 @opindex mbranch-hints
24323
24324 By default, GCC generates a branch hint instruction to avoid
24325 pipeline stalls for always-taken or probably-taken branches. A hint
24326 is not generated closer than 8 instructions away from its branch.
24327 There is little reason to disable them, except for debugging purposes,
24328 or to make an object a little bit smaller.
24329
24330 @item -msmall-mem
24331 @itemx -mlarge-mem
24332 @opindex msmall-mem
24333 @opindex mlarge-mem
24334
24335 By default, GCC generates code assuming that addresses are never larger
24336 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
24337 a full 32-bit address.
24338
24339 @item -mstdmain
24340 @opindex mstdmain
24341
24342 By default, GCC links against startup code that assumes the SPU-style
24343 main function interface (which has an unconventional parameter list).
24344 With @option{-mstdmain}, GCC links your program against startup
24345 code that assumes a C99-style interface to @code{main}, including a
24346 local copy of @code{argv} strings.
24347
24348 @item -mfixed-range=@var{register-range}
24349 @opindex mfixed-range
24350 Generate code treating the given register range as fixed registers.
24351 A fixed register is one that the register allocator cannot use. This is
24352 useful when compiling kernel code. A register range is specified as
24353 two registers separated by a dash. Multiple register ranges can be
24354 specified separated by a comma.
24355
24356 @item -mea32
24357 @itemx -mea64
24358 @opindex mea32
24359 @opindex mea64
24360 Compile code assuming that pointers to the PPU address space accessed
24361 via the @code{__ea} named address space qualifier are either 32 or 64
24362 bits wide. The default is 32 bits. As this is an ABI-changing option,
24363 all object code in an executable must be compiled with the same setting.
24364
24365 @item -maddress-space-conversion
24366 @itemx -mno-address-space-conversion
24367 @opindex maddress-space-conversion
24368 @opindex mno-address-space-conversion
24369 Allow/disallow treating the @code{__ea} address space as superset
24370 of the generic address space. This enables explicit type casts
24371 between @code{__ea} and generic pointer as well as implicit
24372 conversions of generic pointers to @code{__ea} pointers. The
24373 default is to allow address space pointer conversions.
24374
24375 @item -mcache-size=@var{cache-size}
24376 @opindex mcache-size
24377 This option controls the version of libgcc that the compiler links to an
24378 executable and selects a software-managed cache for accessing variables
24379 in the @code{__ea} address space with a particular cache size. Possible
24380 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
24381 and @samp{128}. The default cache size is 64KB.
24382
24383 @item -matomic-updates
24384 @itemx -mno-atomic-updates
24385 @opindex matomic-updates
24386 @opindex mno-atomic-updates
24387 This option controls the version of libgcc that the compiler links to an
24388 executable and selects whether atomic updates to the software-managed
24389 cache of PPU-side variables are used. If you use atomic updates, changes
24390 to a PPU variable from SPU code using the @code{__ea} named address space
24391 qualifier do not interfere with changes to other PPU variables residing
24392 in the same cache line from PPU code. If you do not use atomic updates,
24393 such interference may occur; however, writing back cache lines is
24394 more efficient. The default behavior is to use atomic updates.
24395
24396 @item -mdual-nops
24397 @itemx -mdual-nops=@var{n}
24398 @opindex mdual-nops
24399 By default, GCC inserts NOPs to increase dual issue when it expects
24400 it to increase performance. @var{n} can be a value from 0 to 10. A
24401 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
24402 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
24403
24404 @item -mhint-max-nops=@var{n}
24405 @opindex mhint-max-nops
24406 Maximum number of NOPs to insert for a branch hint. A branch hint must
24407 be at least 8 instructions away from the branch it is affecting. GCC
24408 inserts up to @var{n} NOPs to enforce this, otherwise it does not
24409 generate the branch hint.
24410
24411 @item -mhint-max-distance=@var{n}
24412 @opindex mhint-max-distance
24413 The encoding of the branch hint instruction limits the hint to be within
24414 256 instructions of the branch it is affecting. By default, GCC makes
24415 sure it is within 125.
24416
24417 @item -msafe-hints
24418 @opindex msafe-hints
24419 Work around a hardware bug that causes the SPU to stall indefinitely.
24420 By default, GCC inserts the @code{hbrp} instruction to make sure
24421 this stall won't happen.
24422
24423 @end table
24424
24425 @node System V Options
24426 @subsection Options for System V
24427
24428 These additional options are available on System V Release 4 for
24429 compatibility with other compilers on those systems:
24430
24431 @table @gcctabopt
24432 @item -G
24433 @opindex G
24434 Create a shared object.
24435 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
24436
24437 @item -Qy
24438 @opindex Qy
24439 Identify the versions of each tool used by the compiler, in a
24440 @code{.ident} assembler directive in the output.
24441
24442 @item -Qn
24443 @opindex Qn
24444 Refrain from adding @code{.ident} directives to the output file (this is
24445 the default).
24446
24447 @item -YP,@var{dirs}
24448 @opindex YP
24449 Search the directories @var{dirs}, and no others, for libraries
24450 specified with @option{-l}.
24451
24452 @item -Ym,@var{dir}
24453 @opindex Ym
24454 Look in the directory @var{dir} to find the M4 preprocessor.
24455 The assembler uses this option.
24456 @c This is supposed to go with a -Yd for predefined M4 macro files, but
24457 @c the generic assembler that comes with Solaris takes just -Ym.
24458 @end table
24459
24460 @node TILE-Gx Options
24461 @subsection TILE-Gx Options
24462 @cindex TILE-Gx options
24463
24464 These @samp{-m} options are supported on the TILE-Gx:
24465
24466 @table @gcctabopt
24467 @item -mcmodel=small
24468 @opindex mcmodel=small
24469 Generate code for the small model. The distance for direct calls is
24470 limited to 500M in either direction. PC-relative addresses are 32
24471 bits. Absolute addresses support the full address range.
24472
24473 @item -mcmodel=large
24474 @opindex mcmodel=large
24475 Generate code for the large model. There is no limitation on call
24476 distance, pc-relative addresses, or absolute addresses.
24477
24478 @item -mcpu=@var{name}
24479 @opindex mcpu
24480 Selects the type of CPU to be targeted. Currently the only supported
24481 type is @samp{tilegx}.
24482
24483 @item -m32
24484 @itemx -m64
24485 @opindex m32
24486 @opindex m64
24487 Generate code for a 32-bit or 64-bit environment. The 32-bit
24488 environment sets int, long, and pointer to 32 bits. The 64-bit
24489 environment sets int to 32 bits and long and pointer to 64 bits.
24490
24491 @item -mbig-endian
24492 @itemx -mlittle-endian
24493 @opindex mbig-endian
24494 @opindex mlittle-endian
24495 Generate code in big/little endian mode, respectively.
24496 @end table
24497
24498 @node TILEPro Options
24499 @subsection TILEPro Options
24500 @cindex TILEPro options
24501
24502 These @samp{-m} options are supported on the TILEPro:
24503
24504 @table @gcctabopt
24505 @item -mcpu=@var{name}
24506 @opindex mcpu
24507 Selects the type of CPU to be targeted. Currently the only supported
24508 type is @samp{tilepro}.
24509
24510 @item -m32
24511 @opindex m32
24512 Generate code for a 32-bit environment, which sets int, long, and
24513 pointer to 32 bits. This is the only supported behavior so the flag
24514 is essentially ignored.
24515 @end table
24516
24517 @node V850 Options
24518 @subsection V850 Options
24519 @cindex V850 Options
24520
24521 These @samp{-m} options are defined for V850 implementations:
24522
24523 @table @gcctabopt
24524 @item -mlong-calls
24525 @itemx -mno-long-calls
24526 @opindex mlong-calls
24527 @opindex mno-long-calls
24528 Treat all calls as being far away (near). If calls are assumed to be
24529 far away, the compiler always loads the function's address into a
24530 register, and calls indirect through the pointer.
24531
24532 @item -mno-ep
24533 @itemx -mep
24534 @opindex mno-ep
24535 @opindex mep
24536 Do not optimize (do optimize) basic blocks that use the same index
24537 pointer 4 or more times to copy pointer into the @code{ep} register, and
24538 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
24539 option is on by default if you optimize.
24540
24541 @item -mno-prolog-function
24542 @itemx -mprolog-function
24543 @opindex mno-prolog-function
24544 @opindex mprolog-function
24545 Do not use (do use) external functions to save and restore registers
24546 at the prologue and epilogue of a function. The external functions
24547 are slower, but use less code space if more than one function saves
24548 the same number of registers. The @option{-mprolog-function} option
24549 is on by default if you optimize.
24550
24551 @item -mspace
24552 @opindex mspace
24553 Try to make the code as small as possible. At present, this just turns
24554 on the @option{-mep} and @option{-mprolog-function} options.
24555
24556 @item -mtda=@var{n}
24557 @opindex mtda
24558 Put static or global variables whose size is @var{n} bytes or less into
24559 the tiny data area that register @code{ep} points to. The tiny data
24560 area can hold up to 256 bytes in total (128 bytes for byte references).
24561
24562 @item -msda=@var{n}
24563 @opindex msda
24564 Put static or global variables whose size is @var{n} bytes or less into
24565 the small data area that register @code{gp} points to. The small data
24566 area can hold up to 64 kilobytes.
24567
24568 @item -mzda=@var{n}
24569 @opindex mzda
24570 Put static or global variables whose size is @var{n} bytes or less into
24571 the first 32 kilobytes of memory.
24572
24573 @item -mv850
24574 @opindex mv850
24575 Specify that the target processor is the V850.
24576
24577 @item -mv850e3v5
24578 @opindex mv850e3v5
24579 Specify that the target processor is the V850E3V5. The preprocessor
24580 constant @code{__v850e3v5__} is defined if this option is used.
24581
24582 @item -mv850e2v4
24583 @opindex mv850e2v4
24584 Specify that the target processor is the V850E3V5. This is an alias for
24585 the @option{-mv850e3v5} option.
24586
24587 @item -mv850e2v3
24588 @opindex mv850e2v3
24589 Specify that the target processor is the V850E2V3. The preprocessor
24590 constant @code{__v850e2v3__} is defined if this option is used.
24591
24592 @item -mv850e2
24593 @opindex mv850e2
24594 Specify that the target processor is the V850E2. The preprocessor
24595 constant @code{__v850e2__} is defined if this option is used.
24596
24597 @item -mv850e1
24598 @opindex mv850e1
24599 Specify that the target processor is the V850E1. The preprocessor
24600 constants @code{__v850e1__} and @code{__v850e__} are defined if
24601 this option is used.
24602
24603 @item -mv850es
24604 @opindex mv850es
24605 Specify that the target processor is the V850ES. This is an alias for
24606 the @option{-mv850e1} option.
24607
24608 @item -mv850e
24609 @opindex mv850e
24610 Specify that the target processor is the V850E@. The preprocessor
24611 constant @code{__v850e__} is defined if this option is used.
24612
24613 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
24614 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
24615 are defined then a default target processor is chosen and the
24616 relevant @samp{__v850*__} preprocessor constant is defined.
24617
24618 The preprocessor constants @code{__v850} and @code{__v851__} are always
24619 defined, regardless of which processor variant is the target.
24620
24621 @item -mdisable-callt
24622 @itemx -mno-disable-callt
24623 @opindex mdisable-callt
24624 @opindex mno-disable-callt
24625 This option suppresses generation of the @code{CALLT} instruction for the
24626 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
24627 architecture.
24628
24629 This option is enabled by default when the RH850 ABI is
24630 in use (see @option{-mrh850-abi}), and disabled by default when the
24631 GCC ABI is in use. If @code{CALLT} instructions are being generated
24632 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
24633
24634 @item -mrelax
24635 @itemx -mno-relax
24636 @opindex mrelax
24637 @opindex mno-relax
24638 Pass on (or do not pass on) the @option{-mrelax} command-line option
24639 to the assembler.
24640
24641 @item -mlong-jumps
24642 @itemx -mno-long-jumps
24643 @opindex mlong-jumps
24644 @opindex mno-long-jumps
24645 Disable (or re-enable) the generation of PC-relative jump instructions.
24646
24647 @item -msoft-float
24648 @itemx -mhard-float
24649 @opindex msoft-float
24650 @opindex mhard-float
24651 Disable (or re-enable) the generation of hardware floating point
24652 instructions. This option is only significant when the target
24653 architecture is @samp{V850E2V3} or higher. If hardware floating point
24654 instructions are being generated then the C preprocessor symbol
24655 @code{__FPU_OK__} is defined, otherwise the symbol
24656 @code{__NO_FPU__} is defined.
24657
24658 @item -mloop
24659 @opindex mloop
24660 Enables the use of the e3v5 LOOP instruction. The use of this
24661 instruction is not enabled by default when the e3v5 architecture is
24662 selected because its use is still experimental.
24663
24664 @item -mrh850-abi
24665 @itemx -mghs
24666 @opindex mrh850-abi
24667 @opindex mghs
24668 Enables support for the RH850 version of the V850 ABI. This is the
24669 default. With this version of the ABI the following rules apply:
24670
24671 @itemize
24672 @item
24673 Integer sized structures and unions are returned via a memory pointer
24674 rather than a register.
24675
24676 @item
24677 Large structures and unions (more than 8 bytes in size) are passed by
24678 value.
24679
24680 @item
24681 Functions are aligned to 16-bit boundaries.
24682
24683 @item
24684 The @option{-m8byte-align} command-line option is supported.
24685
24686 @item
24687 The @option{-mdisable-callt} command-line option is enabled by
24688 default. The @option{-mno-disable-callt} command-line option is not
24689 supported.
24690 @end itemize
24691
24692 When this version of the ABI is enabled the C preprocessor symbol
24693 @code{__V850_RH850_ABI__} is defined.
24694
24695 @item -mgcc-abi
24696 @opindex mgcc-abi
24697 Enables support for the old GCC version of the V850 ABI. With this
24698 version of the ABI the following rules apply:
24699
24700 @itemize
24701 @item
24702 Integer sized structures and unions are returned in register @code{r10}.
24703
24704 @item
24705 Large structures and unions (more than 8 bytes in size) are passed by
24706 reference.
24707
24708 @item
24709 Functions are aligned to 32-bit boundaries, unless optimizing for
24710 size.
24711
24712 @item
24713 The @option{-m8byte-align} command-line option is not supported.
24714
24715 @item
24716 The @option{-mdisable-callt} command-line option is supported but not
24717 enabled by default.
24718 @end itemize
24719
24720 When this version of the ABI is enabled the C preprocessor symbol
24721 @code{__V850_GCC_ABI__} is defined.
24722
24723 @item -m8byte-align
24724 @itemx -mno-8byte-align
24725 @opindex m8byte-align
24726 @opindex mno-8byte-align
24727 Enables support for @code{double} and @code{long long} types to be
24728 aligned on 8-byte boundaries. The default is to restrict the
24729 alignment of all objects to at most 4-bytes. When
24730 @option{-m8byte-align} is in effect the C preprocessor symbol
24731 @code{__V850_8BYTE_ALIGN__} is defined.
24732
24733 @item -mbig-switch
24734 @opindex mbig-switch
24735 Generate code suitable for big switch tables. Use this option only if
24736 the assembler/linker complain about out of range branches within a switch
24737 table.
24738
24739 @item -mapp-regs
24740 @opindex mapp-regs
24741 This option causes r2 and r5 to be used in the code generated by
24742 the compiler. This setting is the default.
24743
24744 @item -mno-app-regs
24745 @opindex mno-app-regs
24746 This option causes r2 and r5 to be treated as fixed registers.
24747
24748 @end table
24749
24750 @node VAX Options
24751 @subsection VAX Options
24752 @cindex VAX options
24753
24754 These @samp{-m} options are defined for the VAX:
24755
24756 @table @gcctabopt
24757 @item -munix
24758 @opindex munix
24759 Do not output certain jump instructions (@code{aobleq} and so on)
24760 that the Unix assembler for the VAX cannot handle across long
24761 ranges.
24762
24763 @item -mgnu
24764 @opindex mgnu
24765 Do output those jump instructions, on the assumption that the
24766 GNU assembler is being used.
24767
24768 @item -mg
24769 @opindex mg
24770 Output code for G-format floating-point numbers instead of D-format.
24771 @end table
24772
24773 @node Visium Options
24774 @subsection Visium Options
24775 @cindex Visium options
24776
24777 @table @gcctabopt
24778
24779 @item -mdebug
24780 @opindex mdebug
24781 A program which performs file I/O and is destined to run on an MCM target
24782 should be linked with this option. It causes the libraries libc.a and
24783 libdebug.a to be linked. The program should be run on the target under
24784 the control of the GDB remote debugging stub.
24785
24786 @item -msim
24787 @opindex msim
24788 A program which performs file I/O and is destined to run on the simulator
24789 should be linked with option. This causes libraries libc.a and libsim.a to
24790 be linked.
24791
24792 @item -mfpu
24793 @itemx -mhard-float
24794 @opindex mfpu
24795 @opindex mhard-float
24796 Generate code containing floating-point instructions. This is the
24797 default.
24798
24799 @item -mno-fpu
24800 @itemx -msoft-float
24801 @opindex mno-fpu
24802 @opindex msoft-float
24803 Generate code containing library calls for floating-point.
24804
24805 @option{-msoft-float} changes the calling convention in the output file;
24806 therefore, it is only useful if you compile @emph{all} of a program with
24807 this option. In particular, you need to compile @file{libgcc.a}, the
24808 library that comes with GCC, with @option{-msoft-float} in order for
24809 this to work.
24810
24811 @item -mcpu=@var{cpu_type}
24812 @opindex mcpu
24813 Set the instruction set, register set, and instruction scheduling parameters
24814 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
24815 @samp{mcm}, @samp{gr5} and @samp{gr6}.
24816
24817 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
24818
24819 By default (unless configured otherwise), GCC generates code for the GR5
24820 variant of the Visium architecture.
24821
24822 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
24823 architecture. The only difference from GR5 code is that the compiler will
24824 generate block move instructions.
24825
24826 @item -mtune=@var{cpu_type}
24827 @opindex mtune
24828 Set the instruction scheduling parameters for machine type @var{cpu_type},
24829 but do not set the instruction set or register set that the option
24830 @option{-mcpu=@var{cpu_type}} would.
24831
24832 @item -msv-mode
24833 @opindex msv-mode
24834 Generate code for the supervisor mode, where there are no restrictions on
24835 the access to general registers. This is the default.
24836
24837 @item -muser-mode
24838 @opindex muser-mode
24839 Generate code for the user mode, where the access to some general registers
24840 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
24841 mode; on the GR6, only registers r29 to r31 are affected.
24842 @end table
24843
24844 @node VMS Options
24845 @subsection VMS Options
24846
24847 These @samp{-m} options are defined for the VMS implementations:
24848
24849 @table @gcctabopt
24850 @item -mvms-return-codes
24851 @opindex mvms-return-codes
24852 Return VMS condition codes from @code{main}. The default is to return POSIX-style
24853 condition (e.g.@ error) codes.
24854
24855 @item -mdebug-main=@var{prefix}
24856 @opindex mdebug-main=@var{prefix}
24857 Flag the first routine whose name starts with @var{prefix} as the main
24858 routine for the debugger.
24859
24860 @item -mmalloc64
24861 @opindex mmalloc64
24862 Default to 64-bit memory allocation routines.
24863
24864 @item -mpointer-size=@var{size}
24865 @opindex mpointer-size=@var{size}
24866 Set the default size of pointers. Possible options for @var{size} are
24867 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
24868 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
24869 The later option disables @code{pragma pointer_size}.
24870 @end table
24871
24872 @node VxWorks Options
24873 @subsection VxWorks Options
24874 @cindex VxWorks Options
24875
24876 The options in this section are defined for all VxWorks targets.
24877 Options specific to the target hardware are listed with the other
24878 options for that target.
24879
24880 @table @gcctabopt
24881 @item -mrtp
24882 @opindex mrtp
24883 GCC can generate code for both VxWorks kernels and real time processes
24884 (RTPs). This option switches from the former to the latter. It also
24885 defines the preprocessor macro @code{__RTP__}.
24886
24887 @item -non-static
24888 @opindex non-static
24889 Link an RTP executable against shared libraries rather than static
24890 libraries. The options @option{-static} and @option{-shared} can
24891 also be used for RTPs (@pxref{Link Options}); @option{-static}
24892 is the default.
24893
24894 @item -Bstatic
24895 @itemx -Bdynamic
24896 @opindex Bstatic
24897 @opindex Bdynamic
24898 These options are passed down to the linker. They are defined for
24899 compatibility with Diab.
24900
24901 @item -Xbind-lazy
24902 @opindex Xbind-lazy
24903 Enable lazy binding of function calls. This option is equivalent to
24904 @option{-Wl,-z,now} and is defined for compatibility with Diab.
24905
24906 @item -Xbind-now
24907 @opindex Xbind-now
24908 Disable lazy binding of function calls. This option is the default and
24909 is defined for compatibility with Diab.
24910 @end table
24911
24912 @node x86 Options
24913 @subsection x86 Options
24914 @cindex x86 Options
24915
24916 These @samp{-m} options are defined for the x86 family of computers.
24917
24918 @table @gcctabopt
24919
24920 @item -march=@var{cpu-type}
24921 @opindex march
24922 Generate instructions for the machine type @var{cpu-type}. In contrast to
24923 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
24924 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
24925 to generate code that may not run at all on processors other than the one
24926 indicated. Specifying @option{-march=@var{cpu-type}} implies
24927 @option{-mtune=@var{cpu-type}}.
24928
24929 The choices for @var{cpu-type} are:
24930
24931 @table @samp
24932 @item native
24933 This selects the CPU to generate code for at compilation time by determining
24934 the processor type of the compiling machine. Using @option{-march=native}
24935 enables all instruction subsets supported by the local machine (hence
24936 the result might not run on different machines). Using @option{-mtune=native}
24937 produces code optimized for the local machine under the constraints
24938 of the selected instruction set.
24939
24940 @item i386
24941 Original Intel i386 CPU@.
24942
24943 @item i486
24944 Intel i486 CPU@. (No scheduling is implemented for this chip.)
24945
24946 @item i586
24947 @itemx pentium
24948 Intel Pentium CPU with no MMX support.
24949
24950 @item lakemont
24951 Intel Lakemont MCU, based on Intel Pentium CPU.
24952
24953 @item pentium-mmx
24954 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
24955
24956 @item pentiumpro
24957 Intel Pentium Pro CPU@.
24958
24959 @item i686
24960 When used with @option{-march}, the Pentium Pro
24961 instruction set is used, so the code runs on all i686 family chips.
24962 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
24963
24964 @item pentium2
24965 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
24966 support.
24967
24968 @item pentium3
24969 @itemx pentium3m
24970 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
24971 set support.
24972
24973 @item pentium-m
24974 Intel Pentium M; low-power version of Intel Pentium III CPU
24975 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
24976
24977 @item pentium4
24978 @itemx pentium4m
24979 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
24980
24981 @item prescott
24982 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
24983 set support.
24984
24985 @item nocona
24986 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
24987 SSE2 and SSE3 instruction set support.
24988
24989 @item core2
24990 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
24991 instruction set support.
24992
24993 @item nehalem
24994 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24995 SSE4.1, SSE4.2 and POPCNT instruction set support.
24996
24997 @item westmere
24998 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24999 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
25000
25001 @item sandybridge
25002 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
25003 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
25004
25005 @item ivybridge
25006 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
25007 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
25008 instruction set support.
25009
25010 @item haswell
25011 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
25012 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
25013 BMI, BMI2 and F16C instruction set support.
25014
25015 @item broadwell
25016 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
25017 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
25018 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
25019
25020 @item skylake
25021 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
25022 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
25023 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
25024 XSAVES instruction set support.
25025
25026 @item bonnell
25027 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
25028 instruction set support.
25029
25030 @item silvermont
25031 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
25032 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
25033
25034 @item knl
25035 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
25036 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
25037 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
25038 AVX512CD instruction set support.
25039
25040 @item skylake-avx512
25041 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
25042 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
25043 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
25044 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
25045
25046 @item k6
25047 AMD K6 CPU with MMX instruction set support.
25048
25049 @item k6-2
25050 @itemx k6-3
25051 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
25052
25053 @item athlon
25054 @itemx athlon-tbird
25055 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
25056 support.
25057
25058 @item athlon-4
25059 @itemx athlon-xp
25060 @itemx athlon-mp
25061 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
25062 instruction set support.
25063
25064 @item k8
25065 @itemx opteron
25066 @itemx athlon64
25067 @itemx athlon-fx
25068 Processors based on the AMD K8 core with x86-64 instruction set support,
25069 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
25070 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
25071 instruction set extensions.)
25072
25073 @item k8-sse3
25074 @itemx opteron-sse3
25075 @itemx athlon64-sse3
25076 Improved versions of AMD K8 cores with SSE3 instruction set support.
25077
25078 @item amdfam10
25079 @itemx barcelona
25080 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
25081 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
25082 instruction set extensions.)
25083
25084 @item bdver1
25085 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
25086 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
25087 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
25088 @item bdver2
25089 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
25090 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
25091 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
25092 extensions.)
25093 @item bdver3
25094 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
25095 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
25096 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
25097 64-bit instruction set extensions.
25098 @item bdver4
25099 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
25100 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
25101 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
25102 SSE4.2, ABM and 64-bit instruction set extensions.
25103
25104 @item znver1
25105 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
25106 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
25107 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
25108 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
25109 instruction set extensions.
25110
25111 @item btver1
25112 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
25113 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
25114 instruction set extensions.)
25115
25116 @item btver2
25117 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
25118 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
25119 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
25120
25121 @item winchip-c6
25122 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
25123 set support.
25124
25125 @item winchip2
25126 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
25127 instruction set support.
25128
25129 @item c3
25130 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
25131 (No scheduling is implemented for this chip.)
25132
25133 @item c3-2
25134 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
25135 (No scheduling is implemented for this chip.)
25136
25137 @item c7
25138 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
25139 (No scheduling is implemented for this chip.)
25140
25141 @item samuel-2
25142 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
25143 (No scheduling is implemented for this chip.)
25144
25145 @item nehemiah
25146 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
25147 (No scheduling is implemented for this chip.)
25148
25149 @item esther
25150 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
25151 (No scheduling is implemented for this chip.)
25152
25153 @item eden-x2
25154 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
25155 (No scheduling is implemented for this chip.)
25156
25157 @item eden-x4
25158 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
25159 AVX and AVX2 instruction set support.
25160 (No scheduling is implemented for this chip.)
25161
25162 @item nano
25163 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25164 instruction set support.
25165 (No scheduling is implemented for this chip.)
25166
25167 @item nano-1000
25168 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25169 instruction set support.
25170 (No scheduling is implemented for this chip.)
25171
25172 @item nano-2000
25173 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25174 instruction set support.
25175 (No scheduling is implemented for this chip.)
25176
25177 @item nano-3000
25178 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
25179 instruction set support.
25180 (No scheduling is implemented for this chip.)
25181
25182 @item nano-x2
25183 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
25184 instruction set support.
25185 (No scheduling is implemented for this chip.)
25186
25187 @item nano-x4
25188 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
25189 instruction set support.
25190 (No scheduling is implemented for this chip.)
25191
25192 @item geode
25193 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
25194 @end table
25195
25196 @item -mtune=@var{cpu-type}
25197 @opindex mtune
25198 Tune to @var{cpu-type} everything applicable about the generated code, except
25199 for the ABI and the set of available instructions.
25200 While picking a specific @var{cpu-type} schedules things appropriately
25201 for that particular chip, the compiler does not generate any code that
25202 cannot run on the default machine type unless you use a
25203 @option{-march=@var{cpu-type}} option.
25204 For example, if GCC is configured for i686-pc-linux-gnu
25205 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
25206 but still runs on i686 machines.
25207
25208 The choices for @var{cpu-type} are the same as for @option{-march}.
25209 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
25210
25211 @table @samp
25212 @item generic
25213 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
25214 If you know the CPU on which your code will run, then you should use
25215 the corresponding @option{-mtune} or @option{-march} option instead of
25216 @option{-mtune=generic}. But, if you do not know exactly what CPU users
25217 of your application will have, then you should use this option.
25218
25219 As new processors are deployed in the marketplace, the behavior of this
25220 option will change. Therefore, if you upgrade to a newer version of
25221 GCC, code generation controlled by this option will change to reflect
25222 the processors
25223 that are most common at the time that version of GCC is released.
25224
25225 There is no @option{-march=generic} option because @option{-march}
25226 indicates the instruction set the compiler can use, and there is no
25227 generic instruction set applicable to all processors. In contrast,
25228 @option{-mtune} indicates the processor (or, in this case, collection of
25229 processors) for which the code is optimized.
25230
25231 @item intel
25232 Produce code optimized for the most current Intel processors, which are
25233 Haswell and Silvermont for this version of GCC. If you know the CPU
25234 on which your code will run, then you should use the corresponding
25235 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
25236 But, if you want your application performs better on both Haswell and
25237 Silvermont, then you should use this option.
25238
25239 As new Intel processors are deployed in the marketplace, the behavior of
25240 this option will change. Therefore, if you upgrade to a newer version of
25241 GCC, code generation controlled by this option will change to reflect
25242 the most current Intel processors at the time that version of GCC is
25243 released.
25244
25245 There is no @option{-march=intel} option because @option{-march} indicates
25246 the instruction set the compiler can use, and there is no common
25247 instruction set applicable to all processors. In contrast,
25248 @option{-mtune} indicates the processor (or, in this case, collection of
25249 processors) for which the code is optimized.
25250 @end table
25251
25252 @item -mcpu=@var{cpu-type}
25253 @opindex mcpu
25254 A deprecated synonym for @option{-mtune}.
25255
25256 @item -mfpmath=@var{unit}
25257 @opindex mfpmath
25258 Generate floating-point arithmetic for selected unit @var{unit}. The choices
25259 for @var{unit} are:
25260
25261 @table @samp
25262 @item 387
25263 Use the standard 387 floating-point coprocessor present on the majority of chips and
25264 emulated otherwise. Code compiled with this option runs almost everywhere.
25265 The temporary results are computed in 80-bit precision instead of the precision
25266 specified by the type, resulting in slightly different results compared to most
25267 of other chips. See @option{-ffloat-store} for more detailed description.
25268
25269 This is the default choice for non-Darwin x86-32 targets.
25270
25271 @item sse
25272 Use scalar floating-point instructions present in the SSE instruction set.
25273 This instruction set is supported by Pentium III and newer chips,
25274 and in the AMD line
25275 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
25276 instruction set supports only single-precision arithmetic, thus the double and
25277 extended-precision arithmetic are still done using 387. A later version, present
25278 only in Pentium 4 and AMD x86-64 chips, supports double-precision
25279 arithmetic too.
25280
25281 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
25282 or @option{-msse2} switches to enable SSE extensions and make this option
25283 effective. For the x86-64 compiler, these extensions are enabled by default.
25284
25285 The resulting code should be considerably faster in the majority of cases and avoid
25286 the numerical instability problems of 387 code, but may break some existing
25287 code that expects temporaries to be 80 bits.
25288
25289 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
25290 and the default choice for x86-32 targets with the SSE2 instruction set
25291 when @option{-ffast-math} is enabled.
25292
25293 @item sse,387
25294 @itemx sse+387
25295 @itemx both
25296 Attempt to utilize both instruction sets at once. This effectively doubles the
25297 amount of available registers, and on chips with separate execution units for
25298 387 and SSE the execution resources too. Use this option with care, as it is
25299 still experimental, because the GCC register allocator does not model separate
25300 functional units well, resulting in unstable performance.
25301 @end table
25302
25303 @item -masm=@var{dialect}
25304 @opindex masm=@var{dialect}
25305 Output assembly instructions using selected @var{dialect}. Also affects
25306 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
25307 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
25308 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
25309 not support @samp{intel}.
25310
25311 @item -mieee-fp
25312 @itemx -mno-ieee-fp
25313 @opindex mieee-fp
25314 @opindex mno-ieee-fp
25315 Control whether or not the compiler uses IEEE floating-point
25316 comparisons. These correctly handle the case where the result of a
25317 comparison is unordered.
25318
25319 @item -m80387
25320 @item -mhard-float
25321 @opindex 80387
25322 @opindex mhard-float
25323 Generate output containing 80387 instructions for floating point.
25324
25325 @item -mno-80387
25326 @item -msoft-float
25327 @opindex no-80387
25328 @opindex msoft-float
25329 Generate output containing library calls for floating point.
25330
25331 @strong{Warning:} the requisite libraries are not part of GCC@.
25332 Normally the facilities of the machine's usual C compiler are used, but
25333 this cannot be done directly in cross-compilation. You must make your
25334 own arrangements to provide suitable library functions for
25335 cross-compilation.
25336
25337 On machines where a function returns floating-point results in the 80387
25338 register stack, some floating-point opcodes may be emitted even if
25339 @option{-msoft-float} is used.
25340
25341 @item -mno-fp-ret-in-387
25342 @opindex mno-fp-ret-in-387
25343 Do not use the FPU registers for return values of functions.
25344
25345 The usual calling convention has functions return values of types
25346 @code{float} and @code{double} in an FPU register, even if there
25347 is no FPU@. The idea is that the operating system should emulate
25348 an FPU@.
25349
25350 The option @option{-mno-fp-ret-in-387} causes such values to be returned
25351 in ordinary CPU registers instead.
25352
25353 @item -mno-fancy-math-387
25354 @opindex mno-fancy-math-387
25355 Some 387 emulators do not support the @code{sin}, @code{cos} and
25356 @code{sqrt} instructions for the 387. Specify this option to avoid
25357 generating those instructions. This option is the default on
25358 OpenBSD and NetBSD@. This option is overridden when @option{-march}
25359 indicates that the target CPU always has an FPU and so the
25360 instruction does not need emulation. These
25361 instructions are not generated unless you also use the
25362 @option{-funsafe-math-optimizations} switch.
25363
25364 @item -malign-double
25365 @itemx -mno-align-double
25366 @opindex malign-double
25367 @opindex mno-align-double
25368 Control whether GCC aligns @code{double}, @code{long double}, and
25369 @code{long long} variables on a two-word boundary or a one-word
25370 boundary. Aligning @code{double} variables on a two-word boundary
25371 produces code that runs somewhat faster on a Pentium at the
25372 expense of more memory.
25373
25374 On x86-64, @option{-malign-double} is enabled by default.
25375
25376 @strong{Warning:} if you use the @option{-malign-double} switch,
25377 structures containing the above types are aligned differently than
25378 the published application binary interface specifications for the x86-32
25379 and are not binary compatible with structures in code compiled
25380 without that switch.
25381
25382 @item -m96bit-long-double
25383 @itemx -m128bit-long-double
25384 @opindex m96bit-long-double
25385 @opindex m128bit-long-double
25386 These switches control the size of @code{long double} type. The x86-32
25387 application binary interface specifies the size to be 96 bits,
25388 so @option{-m96bit-long-double} is the default in 32-bit mode.
25389
25390 Modern architectures (Pentium and newer) prefer @code{long double}
25391 to be aligned to an 8- or 16-byte boundary. In arrays or structures
25392 conforming to the ABI, this is not possible. So specifying
25393 @option{-m128bit-long-double} aligns @code{long double}
25394 to a 16-byte boundary by padding the @code{long double} with an additional
25395 32-bit zero.
25396
25397 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
25398 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
25399
25400 Notice that neither of these options enable any extra precision over the x87
25401 standard of 80 bits for a @code{long double}.
25402
25403 @strong{Warning:} if you override the default value for your target ABI, this
25404 changes the size of
25405 structures and arrays containing @code{long double} variables,
25406 as well as modifying the function calling convention for functions taking
25407 @code{long double}. Hence they are not binary-compatible
25408 with code compiled without that switch.
25409
25410 @item -mlong-double-64
25411 @itemx -mlong-double-80
25412 @itemx -mlong-double-128
25413 @opindex mlong-double-64
25414 @opindex mlong-double-80
25415 @opindex mlong-double-128
25416 These switches control the size of @code{long double} type. A size
25417 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25418 type. This is the default for 32-bit Bionic C library. A size
25419 of 128 bits makes the @code{long double} type equivalent to the
25420 @code{__float128} type. This is the default for 64-bit Bionic C library.
25421
25422 @strong{Warning:} if you override the default value for your target ABI, this
25423 changes the size of
25424 structures and arrays containing @code{long double} variables,
25425 as well as modifying the function calling convention for functions taking
25426 @code{long double}. Hence they are not binary-compatible
25427 with code compiled without that switch.
25428
25429 @item -malign-data=@var{type}
25430 @opindex malign-data
25431 Control how GCC aligns variables. Supported values for @var{type} are
25432 @samp{compat} uses increased alignment value compatible uses GCC 4.8
25433 and earlier, @samp{abi} uses alignment value as specified by the
25434 psABI, and @samp{cacheline} uses increased alignment value to match
25435 the cache line size. @samp{compat} is the default.
25436
25437 @item -mlarge-data-threshold=@var{threshold}
25438 @opindex mlarge-data-threshold
25439 When @option{-mcmodel=medium} is specified, data objects larger than
25440 @var{threshold} are placed in the large data section. This value must be the
25441 same across all objects linked into the binary, and defaults to 65535.
25442
25443 @item -mrtd
25444 @opindex mrtd
25445 Use a different function-calling convention, in which functions that
25446 take a fixed number of arguments return with the @code{ret @var{num}}
25447 instruction, which pops their arguments while returning. This saves one
25448 instruction in the caller since there is no need to pop the arguments
25449 there.
25450
25451 You can specify that an individual function is called with this calling
25452 sequence with the function attribute @code{stdcall}. You can also
25453 override the @option{-mrtd} option by using the function attribute
25454 @code{cdecl}. @xref{Function Attributes}.
25455
25456 @strong{Warning:} this calling convention is incompatible with the one
25457 normally used on Unix, so you cannot use it if you need to call
25458 libraries compiled with the Unix compiler.
25459
25460 Also, you must provide function prototypes for all functions that
25461 take variable numbers of arguments (including @code{printf});
25462 otherwise incorrect code is generated for calls to those
25463 functions.
25464
25465 In addition, seriously incorrect code results if you call a
25466 function with too many arguments. (Normally, extra arguments are
25467 harmlessly ignored.)
25468
25469 @item -mregparm=@var{num}
25470 @opindex mregparm
25471 Control how many registers are used to pass integer arguments. By
25472 default, no registers are used to pass arguments, and at most 3
25473 registers can be used. You can control this behavior for a specific
25474 function by using the function attribute @code{regparm}.
25475 @xref{Function Attributes}.
25476
25477 @strong{Warning:} if you use this switch, and
25478 @var{num} is nonzero, then you must build all modules with the same
25479 value, including any libraries. This includes the system libraries and
25480 startup modules.
25481
25482 @item -msseregparm
25483 @opindex msseregparm
25484 Use SSE register passing conventions for float and double arguments
25485 and return values. You can control this behavior for a specific
25486 function by using the function attribute @code{sseregparm}.
25487 @xref{Function Attributes}.
25488
25489 @strong{Warning:} if you use this switch then you must build all
25490 modules with the same value, including any libraries. This includes
25491 the system libraries and startup modules.
25492
25493 @item -mvect8-ret-in-mem
25494 @opindex mvect8-ret-in-mem
25495 Return 8-byte vectors in memory instead of MMX registers. This is the
25496 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
25497 Studio compilers until version 12. Later compiler versions (starting
25498 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
25499 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
25500 you need to remain compatible with existing code produced by those
25501 previous compiler versions or older versions of GCC@.
25502
25503 @item -mpc32
25504 @itemx -mpc64
25505 @itemx -mpc80
25506 @opindex mpc32
25507 @opindex mpc64
25508 @opindex mpc80
25509
25510 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
25511 is specified, the significands of results of floating-point operations are
25512 rounded to 24 bits (single precision); @option{-mpc64} rounds the
25513 significands of results of floating-point operations to 53 bits (double
25514 precision) and @option{-mpc80} rounds the significands of results of
25515 floating-point operations to 64 bits (extended double precision), which is
25516 the default. When this option is used, floating-point operations in higher
25517 precisions are not available to the programmer without setting the FPU
25518 control word explicitly.
25519
25520 Setting the rounding of floating-point operations to less than the default
25521 80 bits can speed some programs by 2% or more. Note that some mathematical
25522 libraries assume that extended-precision (80-bit) floating-point operations
25523 are enabled by default; routines in such libraries could suffer significant
25524 loss of accuracy, typically through so-called ``catastrophic cancellation'',
25525 when this option is used to set the precision to less than extended precision.
25526
25527 @item -mstackrealign
25528 @opindex mstackrealign
25529 Realign the stack at entry. On the x86, the @option{-mstackrealign}
25530 option generates an alternate prologue and epilogue that realigns the
25531 run-time stack if necessary. This supports mixing legacy codes that keep
25532 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
25533 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
25534 applicable to individual functions.
25535
25536 @item -mpreferred-stack-boundary=@var{num}
25537 @opindex mpreferred-stack-boundary
25538 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
25539 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
25540 the default is 4 (16 bytes or 128 bits).
25541
25542 @strong{Warning:} When generating code for the x86-64 architecture with
25543 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
25544 used to keep the stack boundary aligned to 8 byte boundary. Since
25545 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
25546 intended to be used in controlled environment where stack space is
25547 important limitation. This option leads to wrong code when functions
25548 compiled with 16 byte stack alignment (such as functions from a standard
25549 library) are called with misaligned stack. In this case, SSE
25550 instructions may lead to misaligned memory access traps. In addition,
25551 variable arguments are handled incorrectly for 16 byte aligned
25552 objects (including x87 long double and __int128), leading to wrong
25553 results. You must build all modules with
25554 @option{-mpreferred-stack-boundary=3}, including any libraries. This
25555 includes the system libraries and startup modules.
25556
25557 @item -mincoming-stack-boundary=@var{num}
25558 @opindex mincoming-stack-boundary
25559 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
25560 boundary. If @option{-mincoming-stack-boundary} is not specified,
25561 the one specified by @option{-mpreferred-stack-boundary} is used.
25562
25563 On Pentium and Pentium Pro, @code{double} and @code{long double} values
25564 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
25565 suffer significant run time performance penalties. On Pentium III, the
25566 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
25567 properly if it is not 16-byte aligned.
25568
25569 To ensure proper alignment of this values on the stack, the stack boundary
25570 must be as aligned as that required by any value stored on the stack.
25571 Further, every function must be generated such that it keeps the stack
25572 aligned. Thus calling a function compiled with a higher preferred
25573 stack boundary from a function compiled with a lower preferred stack
25574 boundary most likely misaligns the stack. It is recommended that
25575 libraries that use callbacks always use the default setting.
25576
25577 This extra alignment does consume extra stack space, and generally
25578 increases code size. Code that is sensitive to stack space usage, such
25579 as embedded systems and operating system kernels, may want to reduce the
25580 preferred alignment to @option{-mpreferred-stack-boundary=2}.
25581
25582 @need 200
25583 @item -mmmx
25584 @opindex mmmx
25585 @need 200
25586 @itemx -msse
25587 @opindex msse
25588 @need 200
25589 @itemx -msse2
25590 @opindex msse2
25591 @need 200
25592 @itemx -msse3
25593 @opindex msse3
25594 @need 200
25595 @itemx -mssse3
25596 @opindex mssse3
25597 @need 200
25598 @itemx -msse4
25599 @opindex msse4
25600 @need 200
25601 @itemx -msse4a
25602 @opindex msse4a
25603 @need 200
25604 @itemx -msse4.1
25605 @opindex msse4.1
25606 @need 200
25607 @itemx -msse4.2
25608 @opindex msse4.2
25609 @need 200
25610 @itemx -mavx
25611 @opindex mavx
25612 @need 200
25613 @itemx -mavx2
25614 @opindex mavx2
25615 @need 200
25616 @itemx -mavx512f
25617 @opindex mavx512f
25618 @need 200
25619 @itemx -mavx512pf
25620 @opindex mavx512pf
25621 @need 200
25622 @itemx -mavx512er
25623 @opindex mavx512er
25624 @need 200
25625 @itemx -mavx512cd
25626 @opindex mavx512cd
25627 @need 200
25628 @itemx -mavx512vl
25629 @opindex mavx512vl
25630 @need 200
25631 @itemx -mavx512bw
25632 @opindex mavx512bw
25633 @need 200
25634 @itemx -mavx512dq
25635 @opindex mavx512dq
25636 @need 200
25637 @itemx -mavx512ifma
25638 @opindex mavx512ifma
25639 @need 200
25640 @itemx -mavx512vbmi
25641 @opindex mavx512vbmi
25642 @need 200
25643 @itemx -msha
25644 @opindex msha
25645 @need 200
25646 @itemx -maes
25647 @opindex maes
25648 @need 200
25649 @itemx -mpclmul
25650 @opindex mpclmul
25651 @need 200
25652 @itemx -mclfushopt
25653 @opindex mclfushopt
25654 @need 200
25655 @itemx -mfsgsbase
25656 @opindex mfsgsbase
25657 @need 200
25658 @itemx -mrdrnd
25659 @opindex mrdrnd
25660 @need 200
25661 @itemx -mf16c
25662 @opindex mf16c
25663 @need 200
25664 @itemx -mfma
25665 @opindex mfma
25666 @need 200
25667 @itemx -mfma4
25668 @opindex mfma4
25669 @need 200
25670 @itemx -mprefetchwt1
25671 @opindex mprefetchwt1
25672 @need 200
25673 @itemx -mxop
25674 @opindex mxop
25675 @need 200
25676 @itemx -mlwp
25677 @opindex mlwp
25678 @need 200
25679 @itemx -m3dnow
25680 @opindex m3dnow
25681 @need 200
25682 @itemx -m3dnowa
25683 @opindex m3dnowa
25684 @need 200
25685 @itemx -mpopcnt
25686 @opindex mpopcnt
25687 @need 200
25688 @itemx -mabm
25689 @opindex mabm
25690 @need 200
25691 @itemx -mbmi
25692 @opindex mbmi
25693 @need 200
25694 @itemx -mbmi2
25695 @need 200
25696 @itemx -mlzcnt
25697 @opindex mlzcnt
25698 @need 200
25699 @itemx -mfxsr
25700 @opindex mfxsr
25701 @need 200
25702 @itemx -mxsave
25703 @opindex mxsave
25704 @need 200
25705 @itemx -mxsaveopt
25706 @opindex mxsaveopt
25707 @need 200
25708 @itemx -mxsavec
25709 @opindex mxsavec
25710 @need 200
25711 @itemx -mxsaves
25712 @opindex mxsaves
25713 @need 200
25714 @itemx -mrtm
25715 @opindex mrtm
25716 @need 200
25717 @itemx -mtbm
25718 @opindex mtbm
25719 @need 200
25720 @itemx -mmpx
25721 @opindex mmpx
25722 @need 200
25723 @itemx -mmwaitx
25724 @opindex mmwaitx
25725 @need 200
25726 @itemx -mclzero
25727 @opindex mclzero
25728 @itemx -mpku
25729 @opindex mpku
25730 These switches enable the use of instructions in the MMX, SSE,
25731 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
25732 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
25733 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
25734 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU, 3DNow!@: or enhanced 3DNow!@:
25735 extended instruction sets. Each has a corresponding @option{-mno-} option
25736 to disable use of these instructions.
25737
25738 These extensions are also available as built-in functions: see
25739 @ref{x86 Built-in Functions}, for details of the functions enabled and
25740 disabled by these switches.
25741
25742 To generate SSE/SSE2 instructions automatically from floating-point
25743 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
25744
25745 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
25746 generates new AVX instructions or AVX equivalence for all SSEx instructions
25747 when needed.
25748
25749 These options enable GCC to use these extended instructions in
25750 generated code, even without @option{-mfpmath=sse}. Applications that
25751 perform run-time CPU detection must compile separate files for each
25752 supported architecture, using the appropriate flags. In particular,
25753 the file containing the CPU detection code should be compiled without
25754 these options.
25755
25756 @item -mdump-tune-features
25757 @opindex mdump-tune-features
25758 This option instructs GCC to dump the names of the x86 performance
25759 tuning features and default settings. The names can be used in
25760 @option{-mtune-ctrl=@var{feature-list}}.
25761
25762 @item -mtune-ctrl=@var{feature-list}
25763 @opindex mtune-ctrl=@var{feature-list}
25764 This option is used to do fine grain control of x86 code generation features.
25765 @var{feature-list} is a comma separated list of @var{feature} names. See also
25766 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
25767 on if it is not preceded with @samp{^}, otherwise, it is turned off.
25768 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
25769 developers. Using it may lead to code paths not covered by testing and can
25770 potentially result in compiler ICEs or runtime errors.
25771
25772 @item -mno-default
25773 @opindex mno-default
25774 This option instructs GCC to turn off all tunable features. See also
25775 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
25776
25777 @item -mcld
25778 @opindex mcld
25779 This option instructs GCC to emit a @code{cld} instruction in the prologue
25780 of functions that use string instructions. String instructions depend on
25781 the DF flag to select between autoincrement or autodecrement mode. While the
25782 ABI specifies the DF flag to be cleared on function entry, some operating
25783 systems violate this specification by not clearing the DF flag in their
25784 exception dispatchers. The exception handler can be invoked with the DF flag
25785 set, which leads to wrong direction mode when string instructions are used.
25786 This option can be enabled by default on 32-bit x86 targets by configuring
25787 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
25788 instructions can be suppressed with the @option{-mno-cld} compiler option
25789 in this case.
25790
25791 @item -mvzeroupper
25792 @opindex mvzeroupper
25793 This option instructs GCC to emit a @code{vzeroupper} instruction
25794 before a transfer of control flow out of the function to minimize
25795 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
25796 intrinsics.
25797
25798 @item -mprefer-avx128
25799 @opindex mprefer-avx128
25800 This option instructs GCC to use 128-bit AVX instructions instead of
25801 256-bit AVX instructions in the auto-vectorizer.
25802
25803 @item -mcx16
25804 @opindex mcx16
25805 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
25806 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
25807 objects. This is useful for atomic updates of data structures exceeding one
25808 machine word in size. The compiler uses this instruction to implement
25809 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
25810 128-bit integers, a library call is always used.
25811
25812 @item -msahf
25813 @opindex msahf
25814 This option enables generation of @code{SAHF} instructions in 64-bit code.
25815 Early Intel Pentium 4 CPUs with Intel 64 support,
25816 prior to the introduction of Pentium 4 G1 step in December 2005,
25817 lacked the @code{LAHF} and @code{SAHF} instructions
25818 which are supported by AMD64.
25819 These are load and store instructions, respectively, for certain status flags.
25820 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
25821 @code{drem}, and @code{remainder} built-in functions;
25822 see @ref{Other Builtins} for details.
25823
25824 @item -mmovbe
25825 @opindex mmovbe
25826 This option enables use of the @code{movbe} instruction to implement
25827 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
25828
25829 @item -mcrc32
25830 @opindex mcrc32
25831 This option enables built-in functions @code{__builtin_ia32_crc32qi},
25832 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
25833 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
25834
25835 @item -mrecip
25836 @opindex mrecip
25837 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
25838 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
25839 with an additional Newton-Raphson step
25840 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
25841 (and their vectorized
25842 variants) for single-precision floating-point arguments. These instructions
25843 are generated only when @option{-funsafe-math-optimizations} is enabled
25844 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
25845 Note that while the throughput of the sequence is higher than the throughput
25846 of the non-reciprocal instruction, the precision of the sequence can be
25847 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
25848
25849 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
25850 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
25851 combination), and doesn't need @option{-mrecip}.
25852
25853 Also note that GCC emits the above sequence with additional Newton-Raphson step
25854 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
25855 already with @option{-ffast-math} (or the above option combination), and
25856 doesn't need @option{-mrecip}.
25857
25858 @item -mrecip=@var{opt}
25859 @opindex mrecip=opt
25860 This option controls which reciprocal estimate instructions
25861 may be used. @var{opt} is a comma-separated list of options, which may
25862 be preceded by a @samp{!} to invert the option:
25863
25864 @table @samp
25865 @item all
25866 Enable all estimate instructions.
25867
25868 @item default
25869 Enable the default instructions, equivalent to @option{-mrecip}.
25870
25871 @item none
25872 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25873
25874 @item div
25875 Enable the approximation for scalar division.
25876
25877 @item vec-div
25878 Enable the approximation for vectorized division.
25879
25880 @item sqrt
25881 Enable the approximation for scalar square root.
25882
25883 @item vec-sqrt
25884 Enable the approximation for vectorized square root.
25885 @end table
25886
25887 So, for example, @option{-mrecip=all,!sqrt} enables
25888 all of the reciprocal approximations, except for square root.
25889
25890 @item -mveclibabi=@var{type}
25891 @opindex mveclibabi
25892 Specifies the ABI type to use for vectorizing intrinsics using an
25893 external library. Supported values for @var{type} are @samp{svml}
25894 for the Intel short
25895 vector math library and @samp{acml} for the AMD math core library.
25896 To use this option, both @option{-ftree-vectorize} and
25897 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
25898 ABI-compatible library must be specified at link time.
25899
25900 GCC currently emits calls to @code{vmldExp2},
25901 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
25902 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
25903 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
25904 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
25905 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
25906 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
25907 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
25908 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
25909 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
25910 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
25911 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
25912 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
25913 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
25914 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
25915 when @option{-mveclibabi=acml} is used.
25916
25917 @item -mabi=@var{name}
25918 @opindex mabi
25919 Generate code for the specified calling convention. Permissible values
25920 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
25921 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
25922 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
25923 You can control this behavior for specific functions by
25924 using the function attributes @code{ms_abi} and @code{sysv_abi}.
25925 @xref{Function Attributes}.
25926
25927 @item -mcall-ms2sysv-xlogues
25928 @opindex mcall-ms2sysv-xlogues
25929 @opindex mno-call-ms2sysv-xlogues
25930 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
25931 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
25932 default, the code for saving and restoring these registers is emitted inline,
25933 resulting in fairly lengthy prologues and epilogues. Using
25934 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
25935 use stubs in the static portion of libgcc to perform these saves and restores,
25936 thus reducing function size at the cost of a few extra instructions.
25937
25938 @item -mtls-dialect=@var{type}
25939 @opindex mtls-dialect
25940 Generate code to access thread-local storage using the @samp{gnu} or
25941 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
25942 @samp{gnu2} is more efficient, but it may add compile- and run-time
25943 requirements that cannot be satisfied on all systems.
25944
25945 @item -mpush-args
25946 @itemx -mno-push-args
25947 @opindex mpush-args
25948 @opindex mno-push-args
25949 Use PUSH operations to store outgoing parameters. This method is shorter
25950 and usually equally fast as method using SUB/MOV operations and is enabled
25951 by default. In some cases disabling it may improve performance because of
25952 improved scheduling and reduced dependencies.
25953
25954 @item -maccumulate-outgoing-args
25955 @opindex maccumulate-outgoing-args
25956 If enabled, the maximum amount of space required for outgoing arguments is
25957 computed in the function prologue. This is faster on most modern CPUs
25958 because of reduced dependencies, improved scheduling and reduced stack usage
25959 when the preferred stack boundary is not equal to 2. The drawback is a notable
25960 increase in code size. This switch implies @option{-mno-push-args}.
25961
25962 @item -mthreads
25963 @opindex mthreads
25964 Support thread-safe exception handling on MinGW. Programs that rely
25965 on thread-safe exception handling must compile and link all code with the
25966 @option{-mthreads} option. When compiling, @option{-mthreads} defines
25967 @option{-D_MT}; when linking, it links in a special thread helper library
25968 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
25969
25970 @item -mms-bitfields
25971 @itemx -mno-ms-bitfields
25972 @opindex mms-bitfields
25973 @opindex mno-ms-bitfields
25974
25975 Enable/disable bit-field layout compatible with the native Microsoft
25976 Windows compiler.
25977
25978 If @code{packed} is used on a structure, or if bit-fields are used,
25979 it may be that the Microsoft ABI lays out the structure differently
25980 than the way GCC normally does. Particularly when moving packed
25981 data between functions compiled with GCC and the native Microsoft compiler
25982 (either via function call or as data in a file), it may be necessary to access
25983 either format.
25984
25985 This option is enabled by default for Microsoft Windows
25986 targets. This behavior can also be controlled locally by use of variable
25987 or type attributes. For more information, see @ref{x86 Variable Attributes}
25988 and @ref{x86 Type Attributes}.
25989
25990 The Microsoft structure layout algorithm is fairly simple with the exception
25991 of the bit-field packing.
25992 The padding and alignment of members of structures and whether a bit-field
25993 can straddle a storage-unit boundary are determine by these rules:
25994
25995 @enumerate
25996 @item Structure members are stored sequentially in the order in which they are
25997 declared: the first member has the lowest memory address and the last member
25998 the highest.
25999
26000 @item Every data object has an alignment requirement. The alignment requirement
26001 for all data except structures, unions, and arrays is either the size of the
26002 object or the current packing size (specified with either the
26003 @code{aligned} attribute or the @code{pack} pragma),
26004 whichever is less. For structures, unions, and arrays,
26005 the alignment requirement is the largest alignment requirement of its members.
26006 Every object is allocated an offset so that:
26007
26008 @smallexample
26009 offset % alignment_requirement == 0
26010 @end smallexample
26011
26012 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
26013 unit if the integral types are the same size and if the next bit-field fits
26014 into the current allocation unit without crossing the boundary imposed by the
26015 common alignment requirements of the bit-fields.
26016 @end enumerate
26017
26018 MSVC interprets zero-length bit-fields in the following ways:
26019
26020 @enumerate
26021 @item If a zero-length bit-field is inserted between two bit-fields that
26022 are normally coalesced, the bit-fields are not coalesced.
26023
26024 For example:
26025
26026 @smallexample
26027 struct
26028 @{
26029 unsigned long bf_1 : 12;
26030 unsigned long : 0;
26031 unsigned long bf_2 : 12;
26032 @} t1;
26033 @end smallexample
26034
26035 @noindent
26036 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
26037 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
26038
26039 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
26040 alignment of the zero-length bit-field is greater than the member that follows it,
26041 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
26042
26043 For example:
26044
26045 @smallexample
26046 struct
26047 @{
26048 char foo : 4;
26049 short : 0;
26050 char bar;
26051 @} t2;
26052
26053 struct
26054 @{
26055 char foo : 4;
26056 short : 0;
26057 double bar;
26058 @} t3;
26059 @end smallexample
26060
26061 @noindent
26062 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
26063 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
26064 bit-field does not affect the alignment of @code{bar} or, as a result, the size
26065 of the structure.
26066
26067 Taking this into account, it is important to note the following:
26068
26069 @enumerate
26070 @item If a zero-length bit-field follows a normal bit-field, the type of the
26071 zero-length bit-field may affect the alignment of the structure as whole. For
26072 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
26073 normal bit-field, and is of type short.
26074
26075 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
26076 still affect the alignment of the structure:
26077
26078 @smallexample
26079 struct
26080 @{
26081 char foo : 6;
26082 long : 0;
26083 @} t4;
26084 @end smallexample
26085
26086 @noindent
26087 Here, @code{t4} takes up 4 bytes.
26088 @end enumerate
26089
26090 @item Zero-length bit-fields following non-bit-field members are ignored:
26091
26092 @smallexample
26093 struct
26094 @{
26095 char foo;
26096 long : 0;
26097 char bar;
26098 @} t5;
26099 @end smallexample
26100
26101 @noindent
26102 Here, @code{t5} takes up 2 bytes.
26103 @end enumerate
26104
26105
26106 @item -mno-align-stringops
26107 @opindex mno-align-stringops
26108 Do not align the destination of inlined string operations. This switch reduces
26109 code size and improves performance in case the destination is already aligned,
26110 but GCC doesn't know about it.
26111
26112 @item -minline-all-stringops
26113 @opindex minline-all-stringops
26114 By default GCC inlines string operations only when the destination is
26115 known to be aligned to least a 4-byte boundary.
26116 This enables more inlining and increases code
26117 size, but may improve performance of code that depends on fast
26118 @code{memcpy}, @code{strlen},
26119 and @code{memset} for short lengths.
26120
26121 @item -minline-stringops-dynamically
26122 @opindex minline-stringops-dynamically
26123 For string operations of unknown size, use run-time checks with
26124 inline code for small blocks and a library call for large blocks.
26125
26126 @item -mstringop-strategy=@var{alg}
26127 @opindex mstringop-strategy=@var{alg}
26128 Override the internal decision heuristic for the particular algorithm to use
26129 for inlining string operations. The allowed values for @var{alg} are:
26130
26131 @table @samp
26132 @item rep_byte
26133 @itemx rep_4byte
26134 @itemx rep_8byte
26135 Expand using i386 @code{rep} prefix of the specified size.
26136
26137 @item byte_loop
26138 @itemx loop
26139 @itemx unrolled_loop
26140 Expand into an inline loop.
26141
26142 @item libcall
26143 Always use a library call.
26144 @end table
26145
26146 @item -mmemcpy-strategy=@var{strategy}
26147 @opindex mmemcpy-strategy=@var{strategy}
26148 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
26149 should be inlined and what inline algorithm to use when the expected size
26150 of the copy operation is known. @var{strategy}
26151 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
26152 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
26153 the max byte size with which inline algorithm @var{alg} is allowed. For the last
26154 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
26155 in the list must be specified in increasing order. The minimal byte size for
26156 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
26157 preceding range.
26158
26159 @item -mmemset-strategy=@var{strategy}
26160 @opindex mmemset-strategy=@var{strategy}
26161 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
26162 @code{__builtin_memset} expansion.
26163
26164 @item -momit-leaf-frame-pointer
26165 @opindex momit-leaf-frame-pointer
26166 Don't keep the frame pointer in a register for leaf functions. This
26167 avoids the instructions to save, set up, and restore frame pointers and
26168 makes an extra register available in leaf functions. The option
26169 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
26170 which might make debugging harder.
26171
26172 @item -mtls-direct-seg-refs
26173 @itemx -mno-tls-direct-seg-refs
26174 @opindex mtls-direct-seg-refs
26175 Controls whether TLS variables may be accessed with offsets from the
26176 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
26177 or whether the thread base pointer must be added. Whether or not this
26178 is valid depends on the operating system, and whether it maps the
26179 segment to cover the entire TLS area.
26180
26181 For systems that use the GNU C Library, the default is on.
26182
26183 @item -msse2avx
26184 @itemx -mno-sse2avx
26185 @opindex msse2avx
26186 Specify that the assembler should encode SSE instructions with VEX
26187 prefix. The option @option{-mavx} turns this on by default.
26188
26189 @item -mfentry
26190 @itemx -mno-fentry
26191 @opindex mfentry
26192 If profiling is active (@option{-pg}), put the profiling
26193 counter call before the prologue.
26194 Note: On x86 architectures the attribute @code{ms_hook_prologue}
26195 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
26196
26197 @item -mrecord-mcount
26198 @itemx -mno-record-mcount
26199 @opindex mrecord-mcount
26200 If profiling is active (@option{-pg}), generate a __mcount_loc section
26201 that contains pointers to each profiling call. This is useful for
26202 automatically patching and out calls.
26203
26204 @item -mnop-mcount
26205 @itemx -mno-nop-mcount
26206 @opindex mnop-mcount
26207 If profiling is active (@option{-pg}), generate the calls to
26208 the profiling functions as NOPs. This is useful when they
26209 should be patched in later dynamically. This is likely only
26210 useful together with @option{-mrecord-mcount}.
26211
26212 @item -mskip-rax-setup
26213 @itemx -mno-skip-rax-setup
26214 @opindex mskip-rax-setup
26215 When generating code for the x86-64 architecture with SSE extensions
26216 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
26217 register when there are no variable arguments passed in vector registers.
26218
26219 @strong{Warning:} Since RAX register is used to avoid unnecessarily
26220 saving vector registers on stack when passing variable arguments, the
26221 impacts of this option are callees may waste some stack space,
26222 misbehave or jump to a random location. GCC 4.4 or newer don't have
26223 those issues, regardless the RAX register value.
26224
26225 @item -m8bit-idiv
26226 @itemx -mno-8bit-idiv
26227 @opindex m8bit-idiv
26228 On some processors, like Intel Atom, 8-bit unsigned integer divide is
26229 much faster than 32-bit/64-bit integer divide. This option generates a
26230 run-time check. If both dividend and divisor are within range of 0
26231 to 255, 8-bit unsigned integer divide is used instead of
26232 32-bit/64-bit integer divide.
26233
26234 @item -mavx256-split-unaligned-load
26235 @itemx -mavx256-split-unaligned-store
26236 @opindex mavx256-split-unaligned-load
26237 @opindex mavx256-split-unaligned-store
26238 Split 32-byte AVX unaligned load and store.
26239
26240 @item -mstack-protector-guard=@var{guard}
26241 @itemx -mstack-protector-guard-reg=@var{reg}
26242 @itemx -mstack-protector-guard-offset=@var{offset}
26243 @opindex mstack-protector-guard
26244 @opindex mstack-protector-guard-reg
26245 @opindex mstack-protector-guard-offset
26246 Generate stack protection code using canary at @var{guard}. Supported
26247 locations are @samp{global} for global canary or @samp{tls} for per-thread
26248 canary in the TLS block (the default). This option has effect only when
26249 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
26250
26251 With the latter choice the options
26252 @option{-mstack-protector-guard-reg=@var{reg}} and
26253 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
26254 which segment register (@code{%fs} or @code{%gs}) to use as base register
26255 for reading the canary, and from what offset from that base register.
26256 The default for those is as specified in the relevant ABI.
26257
26258 @item -mmitigate-rop
26259 @opindex mmitigate-rop
26260 Try to avoid generating code sequences that contain unintended return
26261 opcodes, to mitigate against certain forms of attack. At the moment,
26262 this option is limited in what it can do and should not be relied
26263 on to provide serious protection.
26264
26265 @item -mgeneral-regs-only
26266 @opindex mgeneral-regs-only
26267 Generate code that uses only the general-purpose registers. This
26268 prevents the compiler from using floating-point, vector, mask and bound
26269 registers.
26270
26271 @end table
26272
26273 These @samp{-m} switches are supported in addition to the above
26274 on x86-64 processors in 64-bit environments.
26275
26276 @table @gcctabopt
26277 @item -m32
26278 @itemx -m64
26279 @itemx -mx32
26280 @itemx -m16
26281 @itemx -miamcu
26282 @opindex m32
26283 @opindex m64
26284 @opindex mx32
26285 @opindex m16
26286 @opindex miamcu
26287 Generate code for a 16-bit, 32-bit or 64-bit environment.
26288 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
26289 to 32 bits, and
26290 generates code that runs on any i386 system.
26291
26292 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
26293 types to 64 bits, and generates code for the x86-64 architecture.
26294 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
26295 and @option{-mdynamic-no-pic} options.
26296
26297 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
26298 to 32 bits, and
26299 generates code for the x86-64 architecture.
26300
26301 The @option{-m16} option is the same as @option{-m32}, except for that
26302 it outputs the @code{.code16gcc} assembly directive at the beginning of
26303 the assembly output so that the binary can run in 16-bit mode.
26304
26305 The @option{-miamcu} option generates code which conforms to Intel MCU
26306 psABI. It requires the @option{-m32} option to be turned on.
26307
26308 @item -mno-red-zone
26309 @opindex mno-red-zone
26310 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
26311 by the x86-64 ABI; it is a 128-byte area beyond the location of the
26312 stack pointer that is not modified by signal or interrupt handlers
26313 and therefore can be used for temporary data without adjusting the stack
26314 pointer. The flag @option{-mno-red-zone} disables this red zone.
26315
26316 @item -mcmodel=small
26317 @opindex mcmodel=small
26318 Generate code for the small code model: the program and its symbols must
26319 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
26320 Programs can be statically or dynamically linked. This is the default
26321 code model.
26322
26323 @item -mcmodel=kernel
26324 @opindex mcmodel=kernel
26325 Generate code for the kernel code model. The kernel runs in the
26326 negative 2 GB of the address space.
26327 This model has to be used for Linux kernel code.
26328
26329 @item -mcmodel=medium
26330 @opindex mcmodel=medium
26331 Generate code for the medium model: the program is linked in the lower 2
26332 GB of the address space. Small symbols are also placed there. Symbols
26333 with sizes larger than @option{-mlarge-data-threshold} are put into
26334 large data or BSS sections and can be located above 2GB. Programs can
26335 be statically or dynamically linked.
26336
26337 @item -mcmodel=large
26338 @opindex mcmodel=large
26339 Generate code for the large model. This model makes no assumptions
26340 about addresses and sizes of sections.
26341
26342 @item -maddress-mode=long
26343 @opindex maddress-mode=long
26344 Generate code for long address mode. This is only supported for 64-bit
26345 and x32 environments. It is the default address mode for 64-bit
26346 environments.
26347
26348 @item -maddress-mode=short
26349 @opindex maddress-mode=short
26350 Generate code for short address mode. This is only supported for 32-bit
26351 and x32 environments. It is the default address mode for 32-bit and
26352 x32 environments.
26353 @end table
26354
26355 @node x86 Windows Options
26356 @subsection x86 Windows Options
26357 @cindex x86 Windows Options
26358 @cindex Windows Options for x86
26359
26360 These additional options are available for Microsoft Windows targets:
26361
26362 @table @gcctabopt
26363 @item -mconsole
26364 @opindex mconsole
26365 This option
26366 specifies that a console application is to be generated, by
26367 instructing the linker to set the PE header subsystem type
26368 required for console applications.
26369 This option is available for Cygwin and MinGW targets and is
26370 enabled by default on those targets.
26371
26372 @item -mdll
26373 @opindex mdll
26374 This option is available for Cygwin and MinGW targets. It
26375 specifies that a DLL---a dynamic link library---is to be
26376 generated, enabling the selection of the required runtime
26377 startup object and entry point.
26378
26379 @item -mnop-fun-dllimport
26380 @opindex mnop-fun-dllimport
26381 This option is available for Cygwin and MinGW targets. It
26382 specifies that the @code{dllimport} attribute should be ignored.
26383
26384 @item -mthread
26385 @opindex mthread
26386 This option is available for MinGW targets. It specifies
26387 that MinGW-specific thread support is to be used.
26388
26389 @item -municode
26390 @opindex municode
26391 This option is available for MinGW-w64 targets. It causes
26392 the @code{UNICODE} preprocessor macro to be predefined, and
26393 chooses Unicode-capable runtime startup code.
26394
26395 @item -mwin32
26396 @opindex mwin32
26397 This option is available for Cygwin and MinGW targets. It
26398 specifies that the typical Microsoft Windows predefined macros are to
26399 be set in the pre-processor, but does not influence the choice
26400 of runtime library/startup code.
26401
26402 @item -mwindows
26403 @opindex mwindows
26404 This option is available for Cygwin and MinGW targets. It
26405 specifies that a GUI application is to be generated by
26406 instructing the linker to set the PE header subsystem type
26407 appropriately.
26408
26409 @item -fno-set-stack-executable
26410 @opindex fno-set-stack-executable
26411 This option is available for MinGW targets. It specifies that
26412 the executable flag for the stack used by nested functions isn't
26413 set. This is necessary for binaries running in kernel mode of
26414 Microsoft Windows, as there the User32 API, which is used to set executable
26415 privileges, isn't available.
26416
26417 @item -fwritable-relocated-rdata
26418 @opindex fno-writable-relocated-rdata
26419 This option is available for MinGW and Cygwin targets. It specifies
26420 that relocated-data in read-only section is put into the @code{.data}
26421 section. This is a necessary for older runtimes not supporting
26422 modification of @code{.rdata} sections for pseudo-relocation.
26423
26424 @item -mpe-aligned-commons
26425 @opindex mpe-aligned-commons
26426 This option is available for Cygwin and MinGW targets. It
26427 specifies that the GNU extension to the PE file format that
26428 permits the correct alignment of COMMON variables should be
26429 used when generating code. It is enabled by default if
26430 GCC detects that the target assembler found during configuration
26431 supports the feature.
26432 @end table
26433
26434 See also under @ref{x86 Options} for standard options.
26435
26436 @node Xstormy16 Options
26437 @subsection Xstormy16 Options
26438 @cindex Xstormy16 Options
26439
26440 These options are defined for Xstormy16:
26441
26442 @table @gcctabopt
26443 @item -msim
26444 @opindex msim
26445 Choose startup files and linker script suitable for the simulator.
26446 @end table
26447
26448 @node Xtensa Options
26449 @subsection Xtensa Options
26450 @cindex Xtensa Options
26451
26452 These options are supported for Xtensa targets:
26453
26454 @table @gcctabopt
26455 @item -mconst16
26456 @itemx -mno-const16
26457 @opindex mconst16
26458 @opindex mno-const16
26459 Enable or disable use of @code{CONST16} instructions for loading
26460 constant values. The @code{CONST16} instruction is currently not a
26461 standard option from Tensilica. When enabled, @code{CONST16}
26462 instructions are always used in place of the standard @code{L32R}
26463 instructions. The use of @code{CONST16} is enabled by default only if
26464 the @code{L32R} instruction is not available.
26465
26466 @item -mfused-madd
26467 @itemx -mno-fused-madd
26468 @opindex mfused-madd
26469 @opindex mno-fused-madd
26470 Enable or disable use of fused multiply/add and multiply/subtract
26471 instructions in the floating-point option. This has no effect if the
26472 floating-point option is not also enabled. Disabling fused multiply/add
26473 and multiply/subtract instructions forces the compiler to use separate
26474 instructions for the multiply and add/subtract operations. This may be
26475 desirable in some cases where strict IEEE 754-compliant results are
26476 required: the fused multiply add/subtract instructions do not round the
26477 intermediate result, thereby producing results with @emph{more} bits of
26478 precision than specified by the IEEE standard. Disabling fused multiply
26479 add/subtract instructions also ensures that the program output is not
26480 sensitive to the compiler's ability to combine multiply and add/subtract
26481 operations.
26482
26483 @item -mserialize-volatile
26484 @itemx -mno-serialize-volatile
26485 @opindex mserialize-volatile
26486 @opindex mno-serialize-volatile
26487 When this option is enabled, GCC inserts @code{MEMW} instructions before
26488 @code{volatile} memory references to guarantee sequential consistency.
26489 The default is @option{-mserialize-volatile}. Use
26490 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
26491
26492 @item -mforce-no-pic
26493 @opindex mforce-no-pic
26494 For targets, like GNU/Linux, where all user-mode Xtensa code must be
26495 position-independent code (PIC), this option disables PIC for compiling
26496 kernel code.
26497
26498 @item -mtext-section-literals
26499 @itemx -mno-text-section-literals
26500 @opindex mtext-section-literals
26501 @opindex mno-text-section-literals
26502 These options control the treatment of literal pools. The default is
26503 @option{-mno-text-section-literals}, which places literals in a separate
26504 section in the output file. This allows the literal pool to be placed
26505 in a data RAM/ROM, and it also allows the linker to combine literal
26506 pools from separate object files to remove redundant literals and
26507 improve code size. With @option{-mtext-section-literals}, the literals
26508 are interspersed in the text section in order to keep them as close as
26509 possible to their references. This may be necessary for large assembly
26510 files. Literals for each function are placed right before that function.
26511
26512 @item -mauto-litpools
26513 @itemx -mno-auto-litpools
26514 @opindex mauto-litpools
26515 @opindex mno-auto-litpools
26516 These options control the treatment of literal pools. The default is
26517 @option{-mno-auto-litpools}, which places literals in a separate
26518 section in the output file unless @option{-mtext-section-literals} is
26519 used. With @option{-mauto-litpools} the literals are interspersed in
26520 the text section by the assembler. Compiler does not produce explicit
26521 @code{.literal} directives and loads literals into registers with
26522 @code{MOVI} instructions instead of @code{L32R} to let the assembler
26523 do relaxation and place literals as necessary. This option allows
26524 assembler to create several literal pools per function and assemble
26525 very big functions, which may not be possible with
26526 @option{-mtext-section-literals}.
26527
26528 @item -mtarget-align
26529 @itemx -mno-target-align
26530 @opindex mtarget-align
26531 @opindex mno-target-align
26532 When this option is enabled, GCC instructs the assembler to
26533 automatically align instructions to reduce branch penalties at the
26534 expense of some code density. The assembler attempts to widen density
26535 instructions to align branch targets and the instructions following call
26536 instructions. If there are not enough preceding safe density
26537 instructions to align a target, no widening is performed. The
26538 default is @option{-mtarget-align}. These options do not affect the
26539 treatment of auto-aligned instructions like @code{LOOP}, which the
26540 assembler always aligns, either by widening density instructions or
26541 by inserting NOP instructions.
26542
26543 @item -mlongcalls
26544 @itemx -mno-longcalls
26545 @opindex mlongcalls
26546 @opindex mno-longcalls
26547 When this option is enabled, GCC instructs the assembler to translate
26548 direct calls to indirect calls unless it can determine that the target
26549 of a direct call is in the range allowed by the call instruction. This
26550 translation typically occurs for calls to functions in other source
26551 files. Specifically, the assembler translates a direct @code{CALL}
26552 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
26553 The default is @option{-mno-longcalls}. This option should be used in
26554 programs where the call target can potentially be out of range. This
26555 option is implemented in the assembler, not the compiler, so the
26556 assembly code generated by GCC still shows direct call
26557 instructions---look at the disassembled object code to see the actual
26558 instructions. Note that the assembler uses an indirect call for
26559 every cross-file call, not just those that really are out of range.
26560 @end table
26561
26562 @node zSeries Options
26563 @subsection zSeries Options
26564 @cindex zSeries options
26565
26566 These are listed under @xref{S/390 and zSeries Options}.
26567
26568
26569 @c man end
26570
26571 @node Spec Files
26572 @section Specifying Subprocesses and the Switches to Pass to Them
26573 @cindex Spec Files
26574
26575 @command{gcc} is a driver program. It performs its job by invoking a
26576 sequence of other programs to do the work of compiling, assembling and
26577 linking. GCC interprets its command-line parameters and uses these to
26578 deduce which programs it should invoke, and which command-line options
26579 it ought to place on their command lines. This behavior is controlled
26580 by @dfn{spec strings}. In most cases there is one spec string for each
26581 program that GCC can invoke, but a few programs have multiple spec
26582 strings to control their behavior. The spec strings built into GCC can
26583 be overridden by using the @option{-specs=} command-line switch to specify
26584 a spec file.
26585
26586 @dfn{Spec files} are plain-text files that are used to construct spec
26587 strings. They consist of a sequence of directives separated by blank
26588 lines. The type of directive is determined by the first non-whitespace
26589 character on the line, which can be one of the following:
26590
26591 @table @code
26592 @item %@var{command}
26593 Issues a @var{command} to the spec file processor. The commands that can
26594 appear here are:
26595
26596 @table @code
26597 @item %include <@var{file}>
26598 @cindex @code{%include}
26599 Search for @var{file} and insert its text at the current point in the
26600 specs file.
26601
26602 @item %include_noerr <@var{file}>
26603 @cindex @code{%include_noerr}
26604 Just like @samp{%include}, but do not generate an error message if the include
26605 file cannot be found.
26606
26607 @item %rename @var{old_name} @var{new_name}
26608 @cindex @code{%rename}
26609 Rename the spec string @var{old_name} to @var{new_name}.
26610
26611 @end table
26612
26613 @item *[@var{spec_name}]:
26614 This tells the compiler to create, override or delete the named spec
26615 string. All lines after this directive up to the next directive or
26616 blank line are considered to be the text for the spec string. If this
26617 results in an empty string then the spec is deleted. (Or, if the
26618 spec did not exist, then nothing happens.) Otherwise, if the spec
26619 does not currently exist a new spec is created. If the spec does
26620 exist then its contents are overridden by the text of this
26621 directive, unless the first character of that text is the @samp{+}
26622 character, in which case the text is appended to the spec.
26623
26624 @item [@var{suffix}]:
26625 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
26626 and up to the next directive or blank line are considered to make up the
26627 spec string for the indicated suffix. When the compiler encounters an
26628 input file with the named suffix, it processes the spec string in
26629 order to work out how to compile that file. For example:
26630
26631 @smallexample
26632 .ZZ:
26633 z-compile -input %i
26634 @end smallexample
26635
26636 This says that any input file whose name ends in @samp{.ZZ} should be
26637 passed to the program @samp{z-compile}, which should be invoked with the
26638 command-line switch @option{-input} and with the result of performing the
26639 @samp{%i} substitution. (See below.)
26640
26641 As an alternative to providing a spec string, the text following a
26642 suffix directive can be one of the following:
26643
26644 @table @code
26645 @item @@@var{language}
26646 This says that the suffix is an alias for a known @var{language}. This is
26647 similar to using the @option{-x} command-line switch to GCC to specify a
26648 language explicitly. For example:
26649
26650 @smallexample
26651 .ZZ:
26652 @@c++
26653 @end smallexample
26654
26655 Says that .ZZ files are, in fact, C++ source files.
26656
26657 @item #@var{name}
26658 This causes an error messages saying:
26659
26660 @smallexample
26661 @var{name} compiler not installed on this system.
26662 @end smallexample
26663 @end table
26664
26665 GCC already has an extensive list of suffixes built into it.
26666 This directive adds an entry to the end of the list of suffixes, but
26667 since the list is searched from the end backwards, it is effectively
26668 possible to override earlier entries using this technique.
26669
26670 @end table
26671
26672 GCC has the following spec strings built into it. Spec files can
26673 override these strings or create their own. Note that individual
26674 targets can also add their own spec strings to this list.
26675
26676 @smallexample
26677 asm Options to pass to the assembler
26678 asm_final Options to pass to the assembler post-processor
26679 cpp Options to pass to the C preprocessor
26680 cc1 Options to pass to the C compiler
26681 cc1plus Options to pass to the C++ compiler
26682 endfile Object files to include at the end of the link
26683 link Options to pass to the linker
26684 lib Libraries to include on the command line to the linker
26685 libgcc Decides which GCC support library to pass to the linker
26686 linker Sets the name of the linker
26687 predefines Defines to be passed to the C preprocessor
26688 signed_char Defines to pass to CPP to say whether @code{char} is signed
26689 by default
26690 startfile Object files to include at the start of the link
26691 @end smallexample
26692
26693 Here is a small example of a spec file:
26694
26695 @smallexample
26696 %rename lib old_lib
26697
26698 *lib:
26699 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
26700 @end smallexample
26701
26702 This example renames the spec called @samp{lib} to @samp{old_lib} and
26703 then overrides the previous definition of @samp{lib} with a new one.
26704 The new definition adds in some extra command-line options before
26705 including the text of the old definition.
26706
26707 @dfn{Spec strings} are a list of command-line options to be passed to their
26708 corresponding program. In addition, the spec strings can contain
26709 @samp{%}-prefixed sequences to substitute variable text or to
26710 conditionally insert text into the command line. Using these constructs
26711 it is possible to generate quite complex command lines.
26712
26713 Here is a table of all defined @samp{%}-sequences for spec
26714 strings. Note that spaces are not generated automatically around the
26715 results of expanding these sequences. Therefore you can concatenate them
26716 together or combine them with constant text in a single argument.
26717
26718 @table @code
26719 @item %%
26720 Substitute one @samp{%} into the program name or argument.
26721
26722 @item %i
26723 Substitute the name of the input file being processed.
26724
26725 @item %b
26726 Substitute the basename of the input file being processed.
26727 This is the substring up to (and not including) the last period
26728 and not including the directory.
26729
26730 @item %B
26731 This is the same as @samp{%b}, but include the file suffix (text after
26732 the last period).
26733
26734 @item %d
26735 Marks the argument containing or following the @samp{%d} as a
26736 temporary file name, so that that file is deleted if GCC exits
26737 successfully. Unlike @samp{%g}, this contributes no text to the
26738 argument.
26739
26740 @item %g@var{suffix}
26741 Substitute a file name that has suffix @var{suffix} and is chosen
26742 once per compilation, and mark the argument in the same way as
26743 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
26744 name is now chosen in a way that is hard to predict even when previously
26745 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
26746 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
26747 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
26748 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
26749 was simply substituted with a file name chosen once per compilation,
26750 without regard to any appended suffix (which was therefore treated
26751 just like ordinary text), making such attacks more likely to succeed.
26752
26753 @item %u@var{suffix}
26754 Like @samp{%g}, but generates a new temporary file name
26755 each time it appears instead of once per compilation.
26756
26757 @item %U@var{suffix}
26758 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
26759 new one if there is no such last file name. In the absence of any
26760 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
26761 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
26762 involves the generation of two distinct file names, one
26763 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
26764 simply substituted with a file name chosen for the previous @samp{%u},
26765 without regard to any appended suffix.
26766
26767 @item %j@var{suffix}
26768 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
26769 writable, and if @option{-save-temps} is not used;
26770 otherwise, substitute the name
26771 of a temporary file, just like @samp{%u}. This temporary file is not
26772 meant for communication between processes, but rather as a junk
26773 disposal mechanism.
26774
26775 @item %|@var{suffix}
26776 @itemx %m@var{suffix}
26777 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
26778 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
26779 all. These are the two most common ways to instruct a program that it
26780 should read from standard input or write to standard output. If you
26781 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
26782 construct: see for example @file{f/lang-specs.h}.
26783
26784 @item %.@var{SUFFIX}
26785 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
26786 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
26787 terminated by the next space or %.
26788
26789 @item %w
26790 Marks the argument containing or following the @samp{%w} as the
26791 designated output file of this compilation. This puts the argument
26792 into the sequence of arguments that @samp{%o} substitutes.
26793
26794 @item %o
26795 Substitutes the names of all the output files, with spaces
26796 automatically placed around them. You should write spaces
26797 around the @samp{%o} as well or the results are undefined.
26798 @samp{%o} is for use in the specs for running the linker.
26799 Input files whose names have no recognized suffix are not compiled
26800 at all, but they are included among the output files, so they are
26801 linked.
26802
26803 @item %O
26804 Substitutes the suffix for object files. Note that this is
26805 handled specially when it immediately follows @samp{%g, %u, or %U},
26806 because of the need for those to form complete file names. The
26807 handling is such that @samp{%O} is treated exactly as if it had already
26808 been substituted, except that @samp{%g, %u, and %U} do not currently
26809 support additional @var{suffix} characters following @samp{%O} as they do
26810 following, for example, @samp{.o}.
26811
26812 @item %p
26813 Substitutes the standard macro predefinitions for the
26814 current target machine. Use this when running @command{cpp}.
26815
26816 @item %P
26817 Like @samp{%p}, but puts @samp{__} before and after the name of each
26818 predefined macro, except for macros that start with @samp{__} or with
26819 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
26820 C@.
26821
26822 @item %I
26823 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
26824 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
26825 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
26826 and @option{-imultilib} as necessary.
26827
26828 @item %s
26829 Current argument is the name of a library or startup file of some sort.
26830 Search for that file in a standard list of directories and substitute
26831 the full name found. The current working directory is included in the
26832 list of directories scanned.
26833
26834 @item %T
26835 Current argument is the name of a linker script. Search for that file
26836 in the current list of directories to scan for libraries. If the file
26837 is located insert a @option{--script} option into the command line
26838 followed by the full path name found. If the file is not found then
26839 generate an error message. Note: the current working directory is not
26840 searched.
26841
26842 @item %e@var{str}
26843 Print @var{str} as an error message. @var{str} is terminated by a newline.
26844 Use this when inconsistent options are detected.
26845
26846 @item %(@var{name})
26847 Substitute the contents of spec string @var{name} at this point.
26848
26849 @item %x@{@var{option}@}
26850 Accumulate an option for @samp{%X}.
26851
26852 @item %X
26853 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
26854 spec string.
26855
26856 @item %Y
26857 Output the accumulated assembler options specified by @option{-Wa}.
26858
26859 @item %Z
26860 Output the accumulated preprocessor options specified by @option{-Wp}.
26861
26862 @item %a
26863 Process the @code{asm} spec. This is used to compute the
26864 switches to be passed to the assembler.
26865
26866 @item %A
26867 Process the @code{asm_final} spec. This is a spec string for
26868 passing switches to an assembler post-processor, if such a program is
26869 needed.
26870
26871 @item %l
26872 Process the @code{link} spec. This is the spec for computing the
26873 command line passed to the linker. Typically it makes use of the
26874 @samp{%L %G %S %D and %E} sequences.
26875
26876 @item %D
26877 Dump out a @option{-L} option for each directory that GCC believes might
26878 contain startup files. If the target supports multilibs then the
26879 current multilib directory is prepended to each of these paths.
26880
26881 @item %L
26882 Process the @code{lib} spec. This is a spec string for deciding which
26883 libraries are included on the command line to the linker.
26884
26885 @item %G
26886 Process the @code{libgcc} spec. This is a spec string for deciding
26887 which GCC support library is included on the command line to the linker.
26888
26889 @item %S
26890 Process the @code{startfile} spec. This is a spec for deciding which
26891 object files are the first ones passed to the linker. Typically
26892 this might be a file named @file{crt0.o}.
26893
26894 @item %E
26895 Process the @code{endfile} spec. This is a spec string that specifies
26896 the last object files that are passed to the linker.
26897
26898 @item %C
26899 Process the @code{cpp} spec. This is used to construct the arguments
26900 to be passed to the C preprocessor.
26901
26902 @item %1
26903 Process the @code{cc1} spec. This is used to construct the options to be
26904 passed to the actual C compiler (@command{cc1}).
26905
26906 @item %2
26907 Process the @code{cc1plus} spec. This is used to construct the options to be
26908 passed to the actual C++ compiler (@command{cc1plus}).
26909
26910 @item %*
26911 Substitute the variable part of a matched option. See below.
26912 Note that each comma in the substituted string is replaced by
26913 a single space.
26914
26915 @item %<S
26916 Remove all occurrences of @code{-S} from the command line. Note---this
26917 command is position dependent. @samp{%} commands in the spec string
26918 before this one see @code{-S}, @samp{%} commands in the spec string
26919 after this one do not.
26920
26921 @item %:@var{function}(@var{args})
26922 Call the named function @var{function}, passing it @var{args}.
26923 @var{args} is first processed as a nested spec string, then split
26924 into an argument vector in the usual fashion. The function returns
26925 a string which is processed as if it had appeared literally as part
26926 of the current spec.
26927
26928 The following built-in spec functions are provided:
26929
26930 @table @code
26931 @item @code{getenv}
26932 The @code{getenv} spec function takes two arguments: an environment
26933 variable name and a string. If the environment variable is not
26934 defined, a fatal error is issued. Otherwise, the return value is the
26935 value of the environment variable concatenated with the string. For
26936 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
26937
26938 @smallexample
26939 %:getenv(TOPDIR /include)
26940 @end smallexample
26941
26942 expands to @file{/path/to/top/include}.
26943
26944 @item @code{if-exists}
26945 The @code{if-exists} spec function takes one argument, an absolute
26946 pathname to a file. If the file exists, @code{if-exists} returns the
26947 pathname. Here is a small example of its usage:
26948
26949 @smallexample
26950 *startfile:
26951 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
26952 @end smallexample
26953
26954 @item @code{if-exists-else}
26955 The @code{if-exists-else} spec function is similar to the @code{if-exists}
26956 spec function, except that it takes two arguments. The first argument is
26957 an absolute pathname to a file. If the file exists, @code{if-exists-else}
26958 returns the pathname. If it does not exist, it returns the second argument.
26959 This way, @code{if-exists-else} can be used to select one file or another,
26960 based on the existence of the first. Here is a small example of its usage:
26961
26962 @smallexample
26963 *startfile:
26964 crt0%O%s %:if-exists(crti%O%s) \
26965 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
26966 @end smallexample
26967
26968 @item @code{replace-outfile}
26969 The @code{replace-outfile} spec function takes two arguments. It looks for the
26970 first argument in the outfiles array and replaces it with the second argument. Here
26971 is a small example of its usage:
26972
26973 @smallexample
26974 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
26975 @end smallexample
26976
26977 @item @code{remove-outfile}
26978 The @code{remove-outfile} spec function takes one argument. It looks for the
26979 first argument in the outfiles array and removes it. Here is a small example
26980 its usage:
26981
26982 @smallexample
26983 %:remove-outfile(-lm)
26984 @end smallexample
26985
26986 @item @code{pass-through-libs}
26987 The @code{pass-through-libs} spec function takes any number of arguments. It
26988 finds any @option{-l} options and any non-options ending in @file{.a} (which it
26989 assumes are the names of linker input library archive files) and returns a
26990 result containing all the found arguments each prepended by
26991 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
26992 intended to be passed to the LTO linker plugin.
26993
26994 @smallexample
26995 %:pass-through-libs(%G %L %G)
26996 @end smallexample
26997
26998 @item @code{print-asm-header}
26999 The @code{print-asm-header} function takes no arguments and simply
27000 prints a banner like:
27001
27002 @smallexample
27003 Assembler options
27004 =================
27005
27006 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
27007 @end smallexample
27008
27009 It is used to separate compiler options from assembler options
27010 in the @option{--target-help} output.
27011 @end table
27012
27013 @item %@{S@}
27014 Substitutes the @code{-S} switch, if that switch is given to GCC@.
27015 If that switch is not specified, this substitutes nothing. Note that
27016 the leading dash is omitted when specifying this option, and it is
27017 automatically inserted if the substitution is performed. Thus the spec
27018 string @samp{%@{foo@}} matches the command-line option @option{-foo}
27019 and outputs the command-line option @option{-foo}.
27020
27021 @item %W@{S@}
27022 Like %@{@code{S}@} but mark last argument supplied within as a file to be
27023 deleted on failure.
27024
27025 @item %@{S*@}
27026 Substitutes all the switches specified to GCC whose names start
27027 with @code{-S}, but which also take an argument. This is used for
27028 switches like @option{-o}, @option{-D}, @option{-I}, etc.
27029 GCC considers @option{-o foo} as being
27030 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
27031 text, including the space. Thus two arguments are generated.
27032
27033 @item %@{S*&T*@}
27034 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
27035 (the order of @code{S} and @code{T} in the spec is not significant).
27036 There can be any number of ampersand-separated variables; for each the
27037 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
27038
27039 @item %@{S:X@}
27040 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
27041
27042 @item %@{!S:X@}
27043 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
27044
27045 @item %@{S*:X@}
27046 Substitutes @code{X} if one or more switches whose names start with
27047 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
27048 once, no matter how many such switches appeared. However, if @code{%*}
27049 appears somewhere in @code{X}, then @code{X} is substituted once
27050 for each matching switch, with the @code{%*} replaced by the part of
27051 that switch matching the @code{*}.
27052
27053 If @code{%*} appears as the last part of a spec sequence then a space
27054 is added after the end of the last substitution. If there is more
27055 text in the sequence, however, then a space is not generated. This
27056 allows the @code{%*} substitution to be used as part of a larger
27057 string. For example, a spec string like this:
27058
27059 @smallexample
27060 %@{mcu=*:--script=%*/memory.ld@}
27061 @end smallexample
27062
27063 @noindent
27064 when matching an option like @option{-mcu=newchip} produces:
27065
27066 @smallexample
27067 --script=newchip/memory.ld
27068 @end smallexample
27069
27070 @item %@{.S:X@}
27071 Substitutes @code{X}, if processing a file with suffix @code{S}.
27072
27073 @item %@{!.S:X@}
27074 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
27075
27076 @item %@{,S:X@}
27077 Substitutes @code{X}, if processing a file for language @code{S}.
27078
27079 @item %@{!,S:X@}
27080 Substitutes @code{X}, if not processing a file for language @code{S}.
27081
27082 @item %@{S|P:X@}
27083 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
27084 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
27085 @code{*} sequences as well, although they have a stronger binding than
27086 the @samp{|}. If @code{%*} appears in @code{X}, all of the
27087 alternatives must be starred, and only the first matching alternative
27088 is substituted.
27089
27090 For example, a spec string like this:
27091
27092 @smallexample
27093 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
27094 @end smallexample
27095
27096 @noindent
27097 outputs the following command-line options from the following input
27098 command-line options:
27099
27100 @smallexample
27101 fred.c -foo -baz
27102 jim.d -bar -boggle
27103 -d fred.c -foo -baz -boggle
27104 -d jim.d -bar -baz -boggle
27105 @end smallexample
27106
27107 @item %@{S:X; T:Y; :D@}
27108
27109 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
27110 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
27111 be as many clauses as you need. This may be combined with @code{.},
27112 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
27113
27114
27115 @end table
27116
27117 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
27118 or similar construct can use a backslash to ignore the special meaning
27119 of the character following it, thus allowing literal matching of a
27120 character that is otherwise specially treated. For example,
27121 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
27122 @option{-std=iso9899:1999} option is given.
27123
27124 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
27125 construct may contain other nested @samp{%} constructs or spaces, or
27126 even newlines. They are processed as usual, as described above.
27127 Trailing white space in @code{X} is ignored. White space may also
27128 appear anywhere on the left side of the colon in these constructs,
27129 except between @code{.} or @code{*} and the corresponding word.
27130
27131 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
27132 handled specifically in these constructs. If another value of
27133 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
27134 @option{-W} switch is found later in the command line, the earlier
27135 switch value is ignored, except with @{@code{S}*@} where @code{S} is
27136 just one letter, which passes all matching options.
27137
27138 The character @samp{|} at the beginning of the predicate text is used to
27139 indicate that a command should be piped to the following command, but
27140 only if @option{-pipe} is specified.
27141
27142 It is built into GCC which switches take arguments and which do not.
27143 (You might think it would be useful to generalize this to allow each
27144 compiler's spec to say which switches take arguments. But this cannot
27145 be done in a consistent fashion. GCC cannot even decide which input
27146 files have been specified without knowing which switches take arguments,
27147 and it must know which input files to compile in order to tell which
27148 compilers to run).
27149
27150 GCC also knows implicitly that arguments starting in @option{-l} are to be
27151 treated as compiler output files, and passed to the linker in their
27152 proper position among the other output files.
27153
27154 @node Environment Variables
27155 @section Environment Variables Affecting GCC
27156 @cindex environment variables
27157
27158 @c man begin ENVIRONMENT
27159 This section describes several environment variables that affect how GCC
27160 operates. Some of them work by specifying directories or prefixes to use
27161 when searching for various kinds of files. Some are used to specify other
27162 aspects of the compilation environment.
27163
27164 Note that you can also specify places to search using options such as
27165 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
27166 take precedence over places specified using environment variables, which
27167 in turn take precedence over those specified by the configuration of GCC@.
27168 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
27169 GNU Compiler Collection (GCC) Internals}.
27170
27171 @table @env
27172 @item LANG
27173 @itemx LC_CTYPE
27174 @c @itemx LC_COLLATE
27175 @itemx LC_MESSAGES
27176 @c @itemx LC_MONETARY
27177 @c @itemx LC_NUMERIC
27178 @c @itemx LC_TIME
27179 @itemx LC_ALL
27180 @findex LANG
27181 @findex LC_CTYPE
27182 @c @findex LC_COLLATE
27183 @findex LC_MESSAGES
27184 @c @findex LC_MONETARY
27185 @c @findex LC_NUMERIC
27186 @c @findex LC_TIME
27187 @findex LC_ALL
27188 @cindex locale
27189 These environment variables control the way that GCC uses
27190 localization information which allows GCC to work with different
27191 national conventions. GCC inspects the locale categories
27192 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
27193 so. These locale categories can be set to any value supported by your
27194 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
27195 Kingdom encoded in UTF-8.
27196
27197 The @env{LC_CTYPE} environment variable specifies character
27198 classification. GCC uses it to determine the character boundaries in
27199 a string; this is needed for some multibyte encodings that contain quote
27200 and escape characters that are otherwise interpreted as a string
27201 end or escape.
27202
27203 The @env{LC_MESSAGES} environment variable specifies the language to
27204 use in diagnostic messages.
27205
27206 If the @env{LC_ALL} environment variable is set, it overrides the value
27207 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
27208 and @env{LC_MESSAGES} default to the value of the @env{LANG}
27209 environment variable. If none of these variables are set, GCC
27210 defaults to traditional C English behavior.
27211
27212 @item TMPDIR
27213 @findex TMPDIR
27214 If @env{TMPDIR} is set, it specifies the directory to use for temporary
27215 files. GCC uses temporary files to hold the output of one stage of
27216 compilation which is to be used as input to the next stage: for example,
27217 the output of the preprocessor, which is the input to the compiler
27218 proper.
27219
27220 @item GCC_COMPARE_DEBUG
27221 @findex GCC_COMPARE_DEBUG
27222 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
27223 @option{-fcompare-debug} to the compiler driver. See the documentation
27224 of this option for more details.
27225
27226 @item GCC_EXEC_PREFIX
27227 @findex GCC_EXEC_PREFIX
27228 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
27229 names of the subprograms executed by the compiler. No slash is added
27230 when this prefix is combined with the name of a subprogram, but you can
27231 specify a prefix that ends with a slash if you wish.
27232
27233 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
27234 an appropriate prefix to use based on the pathname it is invoked with.
27235
27236 If GCC cannot find the subprogram using the specified prefix, it
27237 tries looking in the usual places for the subprogram.
27238
27239 The default value of @env{GCC_EXEC_PREFIX} is
27240 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
27241 the installed compiler. In many cases @var{prefix} is the value
27242 of @code{prefix} when you ran the @file{configure} script.
27243
27244 Other prefixes specified with @option{-B} take precedence over this prefix.
27245
27246 This prefix is also used for finding files such as @file{crt0.o} that are
27247 used for linking.
27248
27249 In addition, the prefix is used in an unusual way in finding the
27250 directories to search for header files. For each of the standard
27251 directories whose name normally begins with @samp{/usr/local/lib/gcc}
27252 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
27253 replacing that beginning with the specified prefix to produce an
27254 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
27255 @file{foo/bar} just before it searches the standard directory
27256 @file{/usr/local/lib/bar}.
27257 If a standard directory begins with the configured
27258 @var{prefix} then the value of @var{prefix} is replaced by
27259 @env{GCC_EXEC_PREFIX} when looking for header files.
27260
27261 @item COMPILER_PATH
27262 @findex COMPILER_PATH
27263 The value of @env{COMPILER_PATH} is a colon-separated list of
27264 directories, much like @env{PATH}. GCC tries the directories thus
27265 specified when searching for subprograms, if it cannot find the
27266 subprograms using @env{GCC_EXEC_PREFIX}.
27267
27268 @item LIBRARY_PATH
27269 @findex LIBRARY_PATH
27270 The value of @env{LIBRARY_PATH} is a colon-separated list of
27271 directories, much like @env{PATH}. When configured as a native compiler,
27272 GCC tries the directories thus specified when searching for special
27273 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
27274 using GCC also uses these directories when searching for ordinary
27275 libraries for the @option{-l} option (but directories specified with
27276 @option{-L} come first).
27277
27278 @item LANG
27279 @findex LANG
27280 @cindex locale definition
27281 This variable is used to pass locale information to the compiler. One way in
27282 which this information is used is to determine the character set to be used
27283 when character literals, string literals and comments are parsed in C and C++.
27284 When the compiler is configured to allow multibyte characters,
27285 the following values for @env{LANG} are recognized:
27286
27287 @table @samp
27288 @item C-JIS
27289 Recognize JIS characters.
27290 @item C-SJIS
27291 Recognize SJIS characters.
27292 @item C-EUCJP
27293 Recognize EUCJP characters.
27294 @end table
27295
27296 If @env{LANG} is not defined, or if it has some other value, then the
27297 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
27298 recognize and translate multibyte characters.
27299 @end table
27300
27301 @noindent
27302 Some additional environment variables affect the behavior of the
27303 preprocessor.
27304
27305 @include cppenv.texi
27306
27307 @c man end
27308
27309 @node Precompiled Headers
27310 @section Using Precompiled Headers
27311 @cindex precompiled headers
27312 @cindex speed of compilation
27313
27314 Often large projects have many header files that are included in every
27315 source file. The time the compiler takes to process these header files
27316 over and over again can account for nearly all of the time required to
27317 build the project. To make builds faster, GCC allows you to
27318 @dfn{precompile} a header file.
27319
27320 To create a precompiled header file, simply compile it as you would any
27321 other file, if necessary using the @option{-x} option to make the driver
27322 treat it as a C or C++ header file. You may want to use a
27323 tool like @command{make} to keep the precompiled header up-to-date when
27324 the headers it contains change.
27325
27326 A precompiled header file is searched for when @code{#include} is
27327 seen in the compilation. As it searches for the included file
27328 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
27329 compiler looks for a precompiled header in each directory just before it
27330 looks for the include file in that directory. The name searched for is
27331 the name specified in the @code{#include} with @samp{.gch} appended. If
27332 the precompiled header file cannot be used, it is ignored.
27333
27334 For instance, if you have @code{#include "all.h"}, and you have
27335 @file{all.h.gch} in the same directory as @file{all.h}, then the
27336 precompiled header file is used if possible, and the original
27337 header is used otherwise.
27338
27339 Alternatively, you might decide to put the precompiled header file in a
27340 directory and use @option{-I} to ensure that directory is searched
27341 before (or instead of) the directory containing the original header.
27342 Then, if you want to check that the precompiled header file is always
27343 used, you can put a file of the same name as the original header in this
27344 directory containing an @code{#error} command.
27345
27346 This also works with @option{-include}. So yet another way to use
27347 precompiled headers, good for projects not designed with precompiled
27348 header files in mind, is to simply take most of the header files used by
27349 a project, include them from another header file, precompile that header
27350 file, and @option{-include} the precompiled header. If the header files
27351 have guards against multiple inclusion, they are skipped because
27352 they've already been included (in the precompiled header).
27353
27354 If you need to precompile the same header file for different
27355 languages, targets, or compiler options, you can instead make a
27356 @emph{directory} named like @file{all.h.gch}, and put each precompiled
27357 header in the directory, perhaps using @option{-o}. It doesn't matter
27358 what you call the files in the directory; every precompiled header in
27359 the directory is considered. The first precompiled header
27360 encountered in the directory that is valid for this compilation is
27361 used; they're searched in no particular order.
27362
27363 There are many other possibilities, limited only by your imagination,
27364 good sense, and the constraints of your build system.
27365
27366 A precompiled header file can be used only when these conditions apply:
27367
27368 @itemize
27369 @item
27370 Only one precompiled header can be used in a particular compilation.
27371
27372 @item
27373 A precompiled header cannot be used once the first C token is seen. You
27374 can have preprocessor directives before a precompiled header; you cannot
27375 include a precompiled header from inside another header.
27376
27377 @item
27378 The precompiled header file must be produced for the same language as
27379 the current compilation. You cannot use a C precompiled header for a C++
27380 compilation.
27381
27382 @item
27383 The precompiled header file must have been produced by the same compiler
27384 binary as the current compilation is using.
27385
27386 @item
27387 Any macros defined before the precompiled header is included must
27388 either be defined in the same way as when the precompiled header was
27389 generated, or must not affect the precompiled header, which usually
27390 means that they don't appear in the precompiled header at all.
27391
27392 The @option{-D} option is one way to define a macro before a
27393 precompiled header is included; using a @code{#define} can also do it.
27394 There are also some options that define macros implicitly, like
27395 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
27396 defined this way.
27397
27398 @item If debugging information is output when using the precompiled
27399 header, using @option{-g} or similar, the same kind of debugging information
27400 must have been output when building the precompiled header. However,
27401 a precompiled header built using @option{-g} can be used in a compilation
27402 when no debugging information is being output.
27403
27404 @item The same @option{-m} options must generally be used when building
27405 and using the precompiled header. @xref{Submodel Options},
27406 for any cases where this rule is relaxed.
27407
27408 @item Each of the following options must be the same when building and using
27409 the precompiled header:
27410
27411 @gccoptlist{-fexceptions}
27412
27413 @item
27414 Some other command-line options starting with @option{-f},
27415 @option{-p}, or @option{-O} must be defined in the same way as when
27416 the precompiled header was generated. At present, it's not clear
27417 which options are safe to change and which are not; the safest choice
27418 is to use exactly the same options when generating and using the
27419 precompiled header. The following are known to be safe:
27420
27421 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
27422 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
27423 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
27424 -pedantic-errors}
27425
27426 @end itemize
27427
27428 For all of these except the last, the compiler automatically
27429 ignores the precompiled header if the conditions aren't met. If you
27430 find an option combination that doesn't work and doesn't cause the
27431 precompiled header to be ignored, please consider filing a bug report,
27432 see @ref{Bugs}.
27433
27434 If you do use differing options when generating and using the
27435 precompiled header, the actual behavior is a mixture of the
27436 behavior for the options. For instance, if you use @option{-g} to
27437 generate the precompiled header but not when using it, you may or may
27438 not get debugging information for routines in the precompiled header.
This page took 1.302553 seconds and 5 git commands to generate.