]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
Support changing fentry name per function
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2018 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-2018 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), dbx(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 Some options take one or more arguments typically separated either
125 by a space or by the equals sign (@samp{=}) from the option name.
126 Unless documented otherwise, an argument can be either numeric or
127 a string. Numeric arguments must typically be small unsigned decimal
128 or hexadecimal integers. Hexadecimal arguments must begin with
129 the @samp{0x} prefix. Arguments to options that specify a size
130 threshold of some sort may be arbitrarily large decimal or hexadecimal
131 integers followed by a byte size suffix designating a multiple of bytes
132 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133 @code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134 @code{GiB} for gigabyte and gigibyte, and so on. Such arguments are
135 designated by @var{byte-size} in the following text. Refer to the NIST,
136 IEC, and other relevant national and international standards for the full
137 listing and explanation of the binary and decimal byte size prefixes.
138
139 @c man end
140
141 @xref{Option Index}, for an index to GCC's options.
142
143 @menu
144 * Option Summary:: Brief list of all options, without explanations.
145 * Overall Options:: Controlling the kind of output:
146 an executable, object files, assembler files,
147 or preprocessed source.
148 * Invoking G++:: Compiling C++ programs.
149 * C Dialect Options:: Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152 and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154 be formatted.
155 * Warning Options:: How picky should the compiler be?
156 * Debugging Options:: Producing debuggable code.
157 * Optimize Options:: How much optimization?
158 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
159 * Preprocessor Options:: Controlling header files and macro definitions.
160 Also, getting dependency information for Make.
161 * Assembler Options:: Passing options to the assembler.
162 * Link Options:: Specifying libraries and so on.
163 * Directory Options:: Where to find header files and libraries.
164 Where to find the compiler executable files.
165 * Code Gen Options:: Specifying conventions for function calls, data layout
166 and register usage.
167 * Developer Options:: Printing GCC configuration info, statistics, and
168 debugging dumps.
169 * Submodel Options:: Target-specific options, such as compiling for a
170 specific processor variant.
171 * Spec Files:: How to pass switches to sub-processes.
172 * Environment Variables:: Env vars that affect GCC.
173 * Precompiled Headers:: Compiling a header once, and using it many times.
174 @end menu
175
176 @c man begin OPTIONS
177
178 @node Option Summary
179 @section Option Summary
180
181 Here is a summary of all the options, grouped by type. Explanations are
182 in the following sections.
183
184 @table @emph
185 @item Overall Options
186 @xref{Overall Options,,Options Controlling the Kind of Output}.
187 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
188 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
189 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
190 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
191 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
192 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
193
194 @item C Language Options
195 @xref{C Dialect Options,,Options Controlling C Dialect}.
196 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
197 -fpermitted-flt-eval-methods=@var{standard} @gol
198 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
199 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
200 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
201 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
202 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
203 -fsigned-bitfields -fsigned-char @gol
204 -funsigned-bitfields -funsigned-char}
205
206 @item C++ Language Options
207 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
208 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
209 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
210 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
211 -fno-elide-constructors @gol
212 -fno-enforce-eh-specs @gol
213 -fno-gnu-keywords @gol
214 -fno-implicit-templates @gol
215 -fno-implicit-inline-templates @gol
216 -fno-implement-inlines -fms-extensions @gol
217 -fnew-inheriting-ctors @gol
218 -fnew-ttp-matching @gol
219 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
220 -fno-optional-diags -fpermissive @gol
221 -fno-pretty-templates @gol
222 -frepo -fno-rtti -fsized-deallocation @gol
223 -ftemplate-backtrace-limit=@var{n} @gol
224 -ftemplate-depth=@var{n} @gol
225 -fno-threadsafe-statics -fuse-cxa-atexit @gol
226 -fno-weak -nostdinc++ @gol
227 -fvisibility-inlines-hidden @gol
228 -fvisibility-ms-compat @gol
229 -fext-numeric-literals @gol
230 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
231 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wliteral-suffix @gol
232 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
233 -Wnamespaces -Wnarrowing @gol
234 -Wpessimizing-move -Wredundant-move @gol
235 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
236 -Wnon-virtual-dtor -Wreorder -Wregister @gol
237 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
238 -Wno-non-template-friend -Wold-style-cast @gol
239 -Woverloaded-virtual -Wno-pmf-conversions @gol
240 -Wno-class-conversion -Wno-terminate @gol
241 -Wsign-promo -Wvirtual-inheritance}
242
243 @item Objective-C and Objective-C++ Language Options
244 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
245 Objective-C and Objective-C++ Dialects}.
246 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
247 -fgnu-runtime -fnext-runtime @gol
248 -fno-nil-receivers @gol
249 -fobjc-abi-version=@var{n} @gol
250 -fobjc-call-cxx-cdtors @gol
251 -fobjc-direct-dispatch @gol
252 -fobjc-exceptions @gol
253 -fobjc-gc @gol
254 -fobjc-nilcheck @gol
255 -fobjc-std=objc1 @gol
256 -fno-local-ivars @gol
257 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
258 -freplace-objc-classes @gol
259 -fzero-link @gol
260 -gen-decls @gol
261 -Wassign-intercept @gol
262 -Wno-protocol -Wselector @gol
263 -Wstrict-selector-match @gol
264 -Wundeclared-selector}
265
266 @item Diagnostic Message Formatting Options
267 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
268 @gccoptlist{-fmessage-length=@var{n} @gol
269 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
270 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
271 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
272 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
273 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
274 -fdiagnostics-minimum-margin-width=@var{width} @gol
275 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
276 -fdiagnostics-show-template-tree -fno-elide-type @gol
277 -fno-show-column}
278
279 @item Warning Options
280 @xref{Warning Options,,Options to Request or Suppress Warnings}.
281 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
282 -pedantic-errors @gol
283 -w -Wextra -Wall -Waddress -Waggregate-return -Waligned-new @gol
284 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
285 -Walloca -Walloca-larger-than=@var{byte-size} @gol
286 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
287 -Wno-attributes -Wno-attribute-alias @gol
288 -Wbool-compare -Wbool-operation @gol
289 -Wno-builtin-declaration-mismatch @gol
290 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
291 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
292 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
293 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
294 -Wclobbered -Wcomment -Wconditionally-supported @gol
295 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
296 -Wdelete-incomplete @gol
297 -Wno-attribute-warning @gol
298 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
299 -Wdisabled-optimization @gol
300 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
301 -Wno-div-by-zero -Wdouble-promotion @gol
302 -Wduplicated-branches -Wduplicated-cond @gol
303 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
304 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
305 -Wfloat-equal -Wformat -Wformat=2 @gol
306 -Wno-format-contains-nul -Wno-format-extra-args @gol
307 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
308 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
309 -Wformat-y2k -Wframe-address @gol
310 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
311 -Wjump-misses-init @gol
312 -Wif-not-aligned @gol
313 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
314 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
315 -Wimplicit-function-declaration -Wimplicit-int @gol
316 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
317 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
318 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
319 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
320 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
321 -Wmisleading-indentation -Wno-missing-attributes -Wmissing-braces @gol
322 -Wmissing-field-initializers -Wmissing-format-attribute @gol
323 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
324 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
325 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
326 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
327 -Woverride-init-side-effects -Woverlength-strings @gol
328 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
329 -Wparentheses -Wno-pedantic-ms-format @gol
330 -Wplacement-new -Wplacement-new=@var{n} @gol
331 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
332 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
333 -Wrestrict -Wno-return-local-addr @gol
334 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
335 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
336 -Wshift-overflow -Wshift-overflow=@var{n} @gol
337 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
338 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
339 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
340 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
341 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
342 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
343 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
344 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
345 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
346 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
347 -Wswitch-unreachable -Wsync-nand @gol
348 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
349 -Wtype-limits -Wundef @gol
350 -Wuninitialized -Wunknown-pragmas @gol
351 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
352 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
353 -Wunused-parameter -Wno-unused-result @gol
354 -Wunused-value -Wunused-variable @gol
355 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
356 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
357 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
358 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
359 -Wwrite-strings @gol
360 -Wzero-as-null-pointer-constant -Whsa}
361
362 @item C and Objective-C-only Warning Options
363 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
364 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
365 -Wold-style-declaration -Wold-style-definition @gol
366 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
367 -Wdeclaration-after-statement -Wpointer-sign}
368
369 @item Debugging Options
370 @xref{Debugging Options,,Options for Debugging Your Program}.
371 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
372 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
373 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
374 -gas-loc-support -gno-as-loc-support @gol
375 -gas-locview-support -gno-as-locview-support @gol
376 -gcolumn-info -gno-column-info @gol
377 -gstatement-frontiers -gno-statement-frontiers @gol
378 -gvariable-location-views -gno-variable-location-views @gol
379 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
380 -ginline-points -gno-inline-points @gol
381 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
382 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
383 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
384 -fno-eliminate-unused-debug-types @gol
385 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
386 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
387 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
388 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
389 -fvar-tracking -fvar-tracking-assignments}
390
391 @item Optimization Options
392 @xref{Optimize Options,,Options that Control Optimization}.
393 @gccoptlist{-faggressive-loop-optimizations @gol
394 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
395 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
396 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
397 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
398 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
399 -fauto-inc-dec -fbranch-probabilities @gol
400 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
401 -fbtr-bb-exclusive -fcaller-saves @gol
402 -fcombine-stack-adjustments -fconserve-stack @gol
403 -fcompare-elim -fcprop-registers -fcrossjumping @gol
404 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
405 -fcx-limited-range @gol
406 -fdata-sections -fdce -fdelayed-branch @gol
407 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
408 -fdevirtualize-at-ltrans -fdse @gol
409 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
410 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
411 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
412 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
413 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
414 -fif-conversion2 -findirect-inlining @gol
415 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
416 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
417 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
418 -fipa-reference -fipa-reference-addressable @gol
419 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
420 -flive-patching=@var{level} @gol
421 -fira-region=@var{region} -fira-hoist-pressure @gol
422 -fira-loop-pressure -fno-ira-share-save-slots @gol
423 -fno-ira-share-spill-slots @gol
424 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
425 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
426 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
427 -floop-block -floop-interchange -floop-strip-mine @gol
428 -floop-unroll-and-jam -floop-nest-optimize @gol
429 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
430 -flto-partition=@var{alg} -fmerge-all-constants @gol
431 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
432 -fmove-loop-invariants -fno-branch-count-reg @gol
433 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
434 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
435 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
436 -fno-sched-spec -fno-signed-zeros @gol
437 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
438 -fomit-frame-pointer -foptimize-sibling-calls @gol
439 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
440 -fprefetch-loop-arrays @gol
441 -fprofile-correction @gol
442 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
443 -fprofile-reorder-functions @gol
444 -freciprocal-math -free -frename-registers -freorder-blocks @gol
445 -freorder-blocks-algorithm=@var{algorithm} @gol
446 -freorder-blocks-and-partition -freorder-functions @gol
447 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
448 -frounding-math -fsave-optimization-record @gol
449 -fsched2-use-superblocks -fsched-pressure @gol
450 -fsched-spec-load -fsched-spec-load-dangerous @gol
451 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
452 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
453 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
454 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
455 -fschedule-fusion @gol
456 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
457 -fselective-scheduling -fselective-scheduling2 @gol
458 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
459 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
460 -fsignaling-nans @gol
461 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
462 -fsplit-paths @gol
463 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
464 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
465 -fthread-jumps -ftracer -ftree-bit-ccp @gol
466 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
467 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
468 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
469 -ftree-loop-if-convert -ftree-loop-im @gol
470 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
471 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
472 -ftree-loop-vectorize @gol
473 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
474 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
475 -ftree-switch-conversion -ftree-tail-merge @gol
476 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
477 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
478 -funsafe-math-optimizations -funswitch-loops @gol
479 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
480 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
481 --param @var{name}=@var{value}
482 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
483
484 @item Program Instrumentation Options
485 @xref{Instrumentation Options,,Program Instrumentation Options}.
486 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
487 -fprofile-abs-path @gol
488 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
489 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
490 -fprofile-exclude-files=@var{regex} @gol
491 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
492 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
493 -fsanitize-undefined-trap-on-error -fbounds-check @gol
494 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
495 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
496 -fstack-protector-explicit -fstack-check @gol
497 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
498 -fno-stack-limit -fsplit-stack @gol
499 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
500 -fvtv-counts -fvtv-debug @gol
501 -finstrument-functions @gol
502 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
503 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
504
505 @item Preprocessor Options
506 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
507 @gccoptlist{-A@var{question}=@var{answer} @gol
508 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
509 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
510 -dD -dI -dM -dN -dU @gol
511 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
512 -fexec-charset=@var{charset} -fextended-identifiers @gol
513 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
514 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
515 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
516 -fwide-exec-charset=@var{charset} -fworking-directory @gol
517 -H -imacros @var{file} -include @var{file} @gol
518 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
519 -no-integrated-cpp -P -pthread -remap @gol
520 -traditional -traditional-cpp -trigraphs @gol
521 -U@var{macro} -undef @gol
522 -Wp,@var{option} -Xpreprocessor @var{option}}
523
524 @item Assembler Options
525 @xref{Assembler Options,,Passing Options to the Assembler}.
526 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
527
528 @item Linker Options
529 @xref{Link Options,,Options for Linking}.
530 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
531 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
532 -e @var{entry} --entry=@var{entry} @gol
533 -pie -pthread -r -rdynamic @gol
534 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
535 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
536 -shared -shared-libgcc -symbolic @gol
537 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
538 -u @var{symbol} -z @var{keyword}}
539
540 @item Directory Options
541 @xref{Directory Options,,Options for Directory Search}.
542 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
543 -idirafter @var{dir} @gol
544 -imacros @var{file} -imultilib @var{dir} @gol
545 -iplugindir=@var{dir} -iprefix @var{file} @gol
546 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
547 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
548 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
549 -nostdinc -nostdinc++ --sysroot=@var{dir}}
550
551 @item Code Generation Options
552 @xref{Code Gen Options,,Options for Code Generation Conventions}.
553 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
554 -ffixed-@var{reg} -fexceptions @gol
555 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
556 -fasynchronous-unwind-tables @gol
557 -fno-gnu-unique @gol
558 -finhibit-size-directive -fno-common -fno-ident @gol
559 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
560 -fno-jump-tables @gol
561 -frecord-gcc-switches @gol
562 -freg-struct-return -fshort-enums -fshort-wchar @gol
563 -fverbose-asm -fpack-struct[=@var{n}] @gol
564 -fleading-underscore -ftls-model=@var{model} @gol
565 -fstack-reuse=@var{reuse_level} @gol
566 -ftrampolines -ftrapv -fwrapv @gol
567 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
568 -fstrict-volatile-bitfields -fsync-libcalls}
569
570 @item Developer Options
571 @xref{Developer Options,,GCC Developer Options}.
572 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
573 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
574 -fdbg-cnt=@var{counter-value-list} @gol
575 -fdisable-ipa-@var{pass_name} @gol
576 -fdisable-rtl-@var{pass_name} @gol
577 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
578 -fdisable-tree-@var{pass_name} @gol
579 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
580 -fdump-debug -fdump-earlydebug @gol
581 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
582 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
583 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
584 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
585 -fdump-lang-all @gol
586 -fdump-lang-@var{switch} @gol
587 -fdump-lang-@var{switch}-@var{options} @gol
588 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
589 -fdump-passes @gol
590 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
591 -fdump-statistics @gol
592 -fdump-tree-all @gol
593 -fdump-tree-@var{switch} @gol
594 -fdump-tree-@var{switch}-@var{options} @gol
595 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
596 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
597 -fenable-@var{kind}-@var{pass} @gol
598 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
599 -fira-verbose=@var{n} @gol
600 -flto-report -flto-report-wpa -fmem-report-wpa @gol
601 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
602 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
603 -fprofile-report @gol
604 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
605 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
606 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
607 -fvar-tracking-assignments-toggle -gtoggle @gol
608 -print-file-name=@var{library} -print-libgcc-file-name @gol
609 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
610 -print-prog-name=@var{program} -print-search-dirs -Q @gol
611 -print-sysroot -print-sysroot-headers-suffix @gol
612 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
613
614 @item Machine-Dependent Options
615 @xref{Submodel Options,,Machine-Dependent Options}.
616 @c This list is ordered alphanumerically by subsection name.
617 @c Try and put the significant identifier (CPU or system) first,
618 @c so users have a clue at guessing where the ones they want will be.
619
620 @emph{AArch64 Options}
621 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
622 -mgeneral-regs-only @gol
623 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
624 -mstrict-align -mno-strict-align @gol
625 -momit-leaf-frame-pointer @gol
626 -mtls-dialect=desc -mtls-dialect=traditional @gol
627 -mtls-size=@var{size} @gol
628 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
629 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
630 -mpc-relative-literal-loads @gol
631 -msign-return-address=@var{scope} @gol
632 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
633 -moverride=@var{string} -mverbose-cost-dump -mtrack-speculation}
634
635 @emph{Adapteva Epiphany Options}
636 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
637 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
638 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
639 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
640 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
641 -msplit-vecmove-early -m1reg-@var{reg}}
642
643 @emph{ARC Options}
644 @gccoptlist{-mbarrel-shifter -mjli-always @gol
645 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
646 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
647 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
648 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
649 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
650 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
651 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
652 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
653 -mvolatile-cache -mtp-regno=@var{regno} @gol
654 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
655 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
656 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
657 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
658 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
659 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
660 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
661 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
662
663 @emph{ARM Options}
664 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
665 -mabi=@var{name} @gol
666 -mapcs-stack-check -mno-apcs-stack-check @gol
667 -mapcs-reentrant -mno-apcs-reentrant @gol
668 -msched-prolog -mno-sched-prolog @gol
669 -mlittle-endian -mbig-endian @gol
670 -mbe8 -mbe32 @gol
671 -mfloat-abi=@var{name} @gol
672 -mfp16-format=@var{name}
673 -mthumb-interwork -mno-thumb-interwork @gol
674 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
675 -mtune=@var{name} -mprint-tune-info @gol
676 -mstructure-size-boundary=@var{n} @gol
677 -mabort-on-noreturn @gol
678 -mlong-calls -mno-long-calls @gol
679 -msingle-pic-base -mno-single-pic-base @gol
680 -mpic-register=@var{reg} @gol
681 -mnop-fun-dllimport @gol
682 -mpoke-function-name @gol
683 -mthumb -marm -mflip-thumb @gol
684 -mtpcs-frame -mtpcs-leaf-frame @gol
685 -mcaller-super-interworking -mcallee-super-interworking @gol
686 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
687 -mword-relocations @gol
688 -mfix-cortex-m3-ldrd @gol
689 -munaligned-access @gol
690 -mneon-for-64bits @gol
691 -mslow-flash-data @gol
692 -masm-syntax-unified @gol
693 -mrestrict-it @gol
694 -mverbose-cost-dump @gol
695 -mpure-code @gol
696 -mcmse}
697
698 @emph{AVR Options}
699 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
700 -mbranch-cost=@var{cost} @gol
701 -mcall-prologues -mgas-isr-prologues -mint8 @gol
702 -mn_flash=@var{size} -mno-interrupts @gol
703 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
704 -mfract-convert-truncate @gol
705 -mshort-calls -nodevicelib @gol
706 -Waddr-space-convert -Wmisspelled-isr}
707
708 @emph{Blackfin Options}
709 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
710 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
711 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
712 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
713 -mno-id-shared-library -mshared-library-id=@var{n} @gol
714 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
715 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
716 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
717 -micplb}
718
719 @emph{C6X Options}
720 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
721 -msim -msdata=@var{sdata-type}}
722
723 @emph{CRIS Options}
724 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
725 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
726 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
727 -mstack-align -mdata-align -mconst-align @gol
728 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
729 -melf -maout -melinux -mlinux -sim -sim2 @gol
730 -mmul-bug-workaround -mno-mul-bug-workaround}
731
732 @emph{CR16 Options}
733 @gccoptlist{-mmac @gol
734 -mcr16cplus -mcr16c @gol
735 -msim -mint32 -mbit-ops
736 -mdata-model=@var{model}}
737
738 @emph{C-SKY Options}
739 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
740 -mbig-endian -EB -mlittle-endian -EL @gol
741 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
742 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
743 -mdsp -medsp -mvdsp @gol
744 -mdiv -msmart -mhigh-registers -manchor @gol
745 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
746 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
747
748 @emph{Darwin Options}
749 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
750 -arch_only -bind_at_load -bundle -bundle_loader @gol
751 -client_name -compatibility_version -current_version @gol
752 -dead_strip @gol
753 -dependency-file -dylib_file -dylinker_install_name @gol
754 -dynamic -dynamiclib -exported_symbols_list @gol
755 -filelist -flat_namespace -force_cpusubtype_ALL @gol
756 -force_flat_namespace -headerpad_max_install_names @gol
757 -iframework @gol
758 -image_base -init -install_name -keep_private_externs @gol
759 -multi_module -multiply_defined -multiply_defined_unused @gol
760 -noall_load -no_dead_strip_inits_and_terms @gol
761 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
762 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
763 -private_bundle -read_only_relocs -sectalign @gol
764 -sectobjectsymbols -whyload -seg1addr @gol
765 -sectcreate -sectobjectsymbols -sectorder @gol
766 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
767 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
768 -segprot -segs_read_only_addr -segs_read_write_addr @gol
769 -single_module -static -sub_library -sub_umbrella @gol
770 -twolevel_namespace -umbrella -undefined @gol
771 -unexported_symbols_list -weak_reference_mismatches @gol
772 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
773 -mkernel -mone-byte-bool}
774
775 @emph{DEC Alpha Options}
776 @gccoptlist{-mno-fp-regs -msoft-float @gol
777 -mieee -mieee-with-inexact -mieee-conformant @gol
778 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
779 -mtrap-precision=@var{mode} -mbuild-constants @gol
780 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
781 -mbwx -mmax -mfix -mcix @gol
782 -mfloat-vax -mfloat-ieee @gol
783 -mexplicit-relocs -msmall-data -mlarge-data @gol
784 -msmall-text -mlarge-text @gol
785 -mmemory-latency=@var{time}}
786
787 @emph{FR30 Options}
788 @gccoptlist{-msmall-model -mno-lsim}
789
790 @emph{FT32 Options}
791 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
792
793 @emph{FRV Options}
794 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
795 -mhard-float -msoft-float @gol
796 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
797 -mdouble -mno-double @gol
798 -mmedia -mno-media -mmuladd -mno-muladd @gol
799 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
800 -mlinked-fp -mlong-calls -malign-labels @gol
801 -mlibrary-pic -macc-4 -macc-8 @gol
802 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
803 -moptimize-membar -mno-optimize-membar @gol
804 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
805 -mvliw-branch -mno-vliw-branch @gol
806 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
807 -mno-nested-cond-exec -mtomcat-stats @gol
808 -mTLS -mtls @gol
809 -mcpu=@var{cpu}}
810
811 @emph{GNU/Linux Options}
812 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
813 -tno-android-cc -tno-android-ld}
814
815 @emph{H8/300 Options}
816 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
817
818 @emph{HPPA Options}
819 @gccoptlist{-march=@var{architecture-type} @gol
820 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
821 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
822 -mfixed-range=@var{register-range} @gol
823 -mjump-in-delay -mlinker-opt -mlong-calls @gol
824 -mlong-load-store -mno-disable-fpregs @gol
825 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
826 -mno-jump-in-delay -mno-long-load-store @gol
827 -mno-portable-runtime -mno-soft-float @gol
828 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
829 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
830 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
831 -munix=@var{unix-std} -nolibdld -static -threads}
832
833 @emph{IA-64 Options}
834 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
835 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
836 -mconstant-gp -mauto-pic -mfused-madd @gol
837 -minline-float-divide-min-latency @gol
838 -minline-float-divide-max-throughput @gol
839 -mno-inline-float-divide @gol
840 -minline-int-divide-min-latency @gol
841 -minline-int-divide-max-throughput @gol
842 -mno-inline-int-divide @gol
843 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
844 -mno-inline-sqrt @gol
845 -mdwarf2-asm -mearly-stop-bits @gol
846 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
847 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
848 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
849 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
850 -msched-spec-ldc -msched-spec-control-ldc @gol
851 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
852 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
853 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
854 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
855
856 @emph{LM32 Options}
857 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
858 -msign-extend-enabled -muser-enabled}
859
860 @emph{M32R/D Options}
861 @gccoptlist{-m32r2 -m32rx -m32r @gol
862 -mdebug @gol
863 -malign-loops -mno-align-loops @gol
864 -missue-rate=@var{number} @gol
865 -mbranch-cost=@var{number} @gol
866 -mmodel=@var{code-size-model-type} @gol
867 -msdata=@var{sdata-type} @gol
868 -mno-flush-func -mflush-func=@var{name} @gol
869 -mno-flush-trap -mflush-trap=@var{number} @gol
870 -G @var{num}}
871
872 @emph{M32C Options}
873 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
874
875 @emph{M680x0 Options}
876 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
877 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
878 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
879 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
880 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
881 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
882 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
883 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
884 -mxgot -mno-xgot -mlong-jump-table-offsets}
885
886 @emph{MCore Options}
887 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
888 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
889 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
890 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
891 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
892
893 @emph{MeP Options}
894 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
895 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
896 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
897 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
898 -mtiny=@var{n}}
899
900 @emph{MicroBlaze Options}
901 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
902 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
903 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
904 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
905 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
906 -mpic-data-is-text-relative}
907
908 @emph{MIPS Options}
909 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
910 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
911 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
912 -mips16 -mno-mips16 -mflip-mips16 @gol
913 -minterlink-compressed -mno-interlink-compressed @gol
914 -minterlink-mips16 -mno-interlink-mips16 @gol
915 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
916 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
917 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
918 -mno-float -msingle-float -mdouble-float @gol
919 -modd-spreg -mno-odd-spreg @gol
920 -mabs=@var{mode} -mnan=@var{encoding} @gol
921 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
922 -mmcu -mmno-mcu @gol
923 -meva -mno-eva @gol
924 -mvirt -mno-virt @gol
925 -mxpa -mno-xpa @gol
926 -mcrc -mno-crc @gol
927 -mginv -mno-ginv @gol
928 -mmicromips -mno-micromips @gol
929 -mmsa -mno-msa @gol
930 -mloongson-mmi -mno-loongson-mmi @gol
931 -mloongson-ext -mno-loongson-ext @gol
932 -mloongson-ext2 -mno-loongson-ext2 @gol
933 -mfpu=@var{fpu-type} @gol
934 -msmartmips -mno-smartmips @gol
935 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
936 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
937 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
938 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
939 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
940 -membedded-data -mno-embedded-data @gol
941 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
942 -mcode-readable=@var{setting} @gol
943 -msplit-addresses -mno-split-addresses @gol
944 -mexplicit-relocs -mno-explicit-relocs @gol
945 -mcheck-zero-division -mno-check-zero-division @gol
946 -mdivide-traps -mdivide-breaks @gol
947 -mload-store-pairs -mno-load-store-pairs @gol
948 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
949 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
950 -mfix-24k -mno-fix-24k @gol
951 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
952 -mfix-r5900 -mno-fix-r5900 @gol
953 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
954 -mfix-vr4120 -mno-fix-vr4120 @gol
955 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
956 -mflush-func=@var{func} -mno-flush-func @gol
957 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
958 -mcompact-branches=@var{policy} @gol
959 -mfp-exceptions -mno-fp-exceptions @gol
960 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
961 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
962 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
963 -mframe-header-opt -mno-frame-header-opt}
964
965 @emph{MMIX Options}
966 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
967 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
968 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
969 -mno-base-addresses -msingle-exit -mno-single-exit}
970
971 @emph{MN10300 Options}
972 @gccoptlist{-mmult-bug -mno-mult-bug @gol
973 -mno-am33 -mam33 -mam33-2 -mam34 @gol
974 -mtune=@var{cpu-type} @gol
975 -mreturn-pointer-on-d0 @gol
976 -mno-crt0 -mrelax -mliw -msetlb}
977
978 @emph{Moxie Options}
979 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
980
981 @emph{MSP430 Options}
982 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
983 -mwarn-mcu @gol
984 -mcode-region= -mdata-region= @gol
985 -msilicon-errata= -msilicon-errata-warn= @gol
986 -mhwmult= -minrt}
987
988 @emph{NDS32 Options}
989 @gccoptlist{-mbig-endian -mlittle-endian @gol
990 -mreduced-regs -mfull-regs @gol
991 -mcmov -mno-cmov @gol
992 -mext-perf -mno-ext-perf @gol
993 -mext-perf2 -mno-ext-perf2 @gol
994 -mext-string -mno-ext-string @gol
995 -mv3push -mno-v3push @gol
996 -m16bit -mno-16bit @gol
997 -misr-vector-size=@var{num} @gol
998 -mcache-block-size=@var{num} @gol
999 -march=@var{arch} @gol
1000 -mcmodel=@var{code-model} @gol
1001 -mctor-dtor -mrelax}
1002
1003 @emph{Nios II Options}
1004 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1005 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1006 -mel -meb @gol
1007 -mno-bypass-cache -mbypass-cache @gol
1008 -mno-cache-volatile -mcache-volatile @gol
1009 -mno-fast-sw-div -mfast-sw-div @gol
1010 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1011 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1012 -mcustom-fpu-cfg=@var{name} @gol
1013 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1014 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1015
1016 @emph{Nvidia PTX Options}
1017 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1018
1019 @emph{OpenRISC Options}
1020 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1021 -msoft-mul -msoft-div @gol
1022 -mcmov -mror -msext -msfimm -mshftimm}
1023
1024 @emph{PDP-11 Options}
1025 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1026 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1027 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1028
1029 @emph{picoChip Options}
1030 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1031 -msymbol-as-address -mno-inefficient-warnings}
1032
1033 @emph{PowerPC Options}
1034 See RS/6000 and PowerPC Options.
1035
1036 @emph{PowerPC SPE Options}
1037 @gccoptlist{-mcpu=@var{cpu-type} @gol
1038 -mtune=@var{cpu-type} @gol
1039 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb @gol
1040 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1041 -m32 -mxl-compat -mno-xl-compat @gol
1042 -malign-power -malign-natural @gol
1043 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1044 -msingle-float -mdouble-float @gol
1045 -mupdate -mno-update @gol
1046 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1047 -mstrict-align -mno-strict-align -mrelocatable @gol
1048 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1049 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1050 -msingle-pic-base @gol
1051 -mprioritize-restricted-insns=@var{priority} @gol
1052 -msched-costly-dep=@var{dependence_type} @gol
1053 -minsert-sched-nops=@var{scheme} @gol
1054 -mcall-sysv -mcall-netbsd @gol
1055 -maix-struct-return -msvr4-struct-return @gol
1056 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1057 -mblock-move-inline-limit=@var{num} @gol
1058 -misel -mno-isel @gol
1059 -misel=yes -misel=no @gol
1060 -mspe -mno-spe @gol
1061 -mspe=yes -mspe=no @gol
1062 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1063 -mprototype -mno-prototype @gol
1064 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1065 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1066 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1067 -mno-recip-precision @gol
1068 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1069 -msave-toc-indirect -mno-save-toc-indirect @gol
1070 -mcompat-align-parm -mno-compat-align-parm @gol
1071 -mfloat128 -mno-float128 @gol
1072 -mgnu-attribute -mno-gnu-attribute @gol
1073 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1074 -mstack-protector-guard-offset=@var{offset}}
1075
1076 @emph{RISC-V Options}
1077 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1078 -mplt -mno-plt @gol
1079 -mabi=@var{ABI-string} @gol
1080 -mfdiv -mno-fdiv @gol
1081 -mdiv -mno-div @gol
1082 -march=@var{ISA-string} @gol
1083 -mtune=@var{processor-string} @gol
1084 -mpreferred-stack-boundary=@var{num} @gol
1085 -msmall-data-limit=@var{N-bytes} @gol
1086 -msave-restore -mno-save-restore @gol
1087 -mstrict-align -mno-strict-align @gol
1088 -mcmodel=medlow -mcmodel=medany @gol
1089 -mexplicit-relocs -mno-explicit-relocs @gol
1090 -mrelax -mno-relax}
1091
1092 @emph{RL78 Options}
1093 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1094 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1095 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1096
1097 @emph{RS/6000 and PowerPC Options}
1098 @gccoptlist{-mcpu=@var{cpu-type} @gol
1099 -mtune=@var{cpu-type} @gol
1100 -mcmodel=@var{code-model} @gol
1101 -mpowerpc64 @gol
1102 -maltivec -mno-altivec @gol
1103 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1104 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1105 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1106 -mfprnd -mno-fprnd @gol
1107 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1108 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1109 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1110 -malign-power -malign-natural @gol
1111 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1112 -mupdate -mno-update @gol
1113 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1114 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1115 -mstrict-align -mno-strict-align -mrelocatable @gol
1116 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1117 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1118 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1119 -mprioritize-restricted-insns=@var{priority} @gol
1120 -msched-costly-dep=@var{dependence_type} @gol
1121 -minsert-sched-nops=@var{scheme} @gol
1122 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1123 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1124 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1125 -mtraceback=@var{traceback_type} @gol
1126 -maix-struct-return -msvr4-struct-return @gol
1127 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1128 -mblock-move-inline-limit=@var{num} @gol
1129 -mblock-compare-inline-limit=@var{num} @gol
1130 -mblock-compare-inline-loop-limit=@var{num} @gol
1131 -mstring-compare-inline-limit=@var{num} @gol
1132 -misel -mno-isel @gol
1133 -mvrsave -mno-vrsave @gol
1134 -mmulhw -mno-mulhw @gol
1135 -mdlmzb -mno-dlmzb @gol
1136 -mprototype -mno-prototype @gol
1137 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1138 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1139 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1140 -mno-recip-precision @gol
1141 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1142 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1143 -msave-toc-indirect -mno-save-toc-indirect @gol
1144 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1145 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1146 -mquad-memory -mno-quad-memory @gol
1147 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1148 -mcompat-align-parm -mno-compat-align-parm @gol
1149 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1150 -mgnu-attribute -mno-gnu-attribute @gol
1151 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1152 -mstack-protector-guard-offset=@var{offset}}
1153
1154 @emph{RX Options}
1155 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1156 -mcpu=@gol
1157 -mbig-endian-data -mlittle-endian-data @gol
1158 -msmall-data @gol
1159 -msim -mno-sim@gol
1160 -mas100-syntax -mno-as100-syntax@gol
1161 -mrelax@gol
1162 -mmax-constant-size=@gol
1163 -mint-register=@gol
1164 -mpid@gol
1165 -mallow-string-insns -mno-allow-string-insns@gol
1166 -mjsr@gol
1167 -mno-warn-multiple-fast-interrupts@gol
1168 -msave-acc-in-interrupts}
1169
1170 @emph{S/390 and zSeries Options}
1171 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1172 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1173 -mlong-double-64 -mlong-double-128 @gol
1174 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1175 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1176 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1177 -mhtm -mvx -mzvector @gol
1178 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1179 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1180 -mhotpatch=@var{halfwords},@var{halfwords}}
1181
1182 @emph{Score Options}
1183 @gccoptlist{-meb -mel @gol
1184 -mnhwloop @gol
1185 -muls @gol
1186 -mmac @gol
1187 -mscore5 -mscore5u -mscore7 -mscore7d}
1188
1189 @emph{SH Options}
1190 @gccoptlist{-m1 -m2 -m2e @gol
1191 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1192 -m3 -m3e @gol
1193 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1194 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1195 -mb -ml -mdalign -mrelax @gol
1196 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1197 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1198 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1199 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1200 -maccumulate-outgoing-args @gol
1201 -matomic-model=@var{atomic-model} @gol
1202 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1203 -mcbranch-force-delay-slot @gol
1204 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1205 -mpretend-cmove -mtas}
1206
1207 @emph{Solaris 2 Options}
1208 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1209 -pthreads}
1210
1211 @emph{SPARC Options}
1212 @gccoptlist{-mcpu=@var{cpu-type} @gol
1213 -mtune=@var{cpu-type} @gol
1214 -mcmodel=@var{code-model} @gol
1215 -mmemory-model=@var{mem-model} @gol
1216 -m32 -m64 -mapp-regs -mno-app-regs @gol
1217 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1218 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1219 -mhard-quad-float -msoft-quad-float @gol
1220 -mstack-bias -mno-stack-bias @gol
1221 -mstd-struct-return -mno-std-struct-return @gol
1222 -munaligned-doubles -mno-unaligned-doubles @gol
1223 -muser-mode -mno-user-mode @gol
1224 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1225 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1226 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1227 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1228 -mpopc -mno-popc -msubxc -mno-subxc @gol
1229 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1230 -mlra -mno-lra}
1231
1232 @emph{SPU Options}
1233 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1234 -msafe-dma -munsafe-dma @gol
1235 -mbranch-hints @gol
1236 -msmall-mem -mlarge-mem -mstdmain @gol
1237 -mfixed-range=@var{register-range} @gol
1238 -mea32 -mea64 @gol
1239 -maddress-space-conversion -mno-address-space-conversion @gol
1240 -mcache-size=@var{cache-size} @gol
1241 -matomic-updates -mno-atomic-updates}
1242
1243 @emph{System V Options}
1244 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1245
1246 @emph{TILE-Gx Options}
1247 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1248 -mcmodel=@var{code-model}}
1249
1250 @emph{TILEPro Options}
1251 @gccoptlist{-mcpu=@var{cpu} -m32}
1252
1253 @emph{V850 Options}
1254 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1255 -mprolog-function -mno-prolog-function -mspace @gol
1256 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1257 -mapp-regs -mno-app-regs @gol
1258 -mdisable-callt -mno-disable-callt @gol
1259 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1260 -mv850e -mv850 -mv850e3v5 @gol
1261 -mloop @gol
1262 -mrelax @gol
1263 -mlong-jumps @gol
1264 -msoft-float @gol
1265 -mhard-float @gol
1266 -mgcc-abi @gol
1267 -mrh850-abi @gol
1268 -mbig-switch}
1269
1270 @emph{VAX Options}
1271 @gccoptlist{-mg -mgnu -munix}
1272
1273 @emph{Visium Options}
1274 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1275 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1276
1277 @emph{VMS Options}
1278 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1279 -mpointer-size=@var{size}}
1280
1281 @emph{VxWorks Options}
1282 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1283 -Xbind-lazy -Xbind-now}
1284
1285 @emph{x86 Options}
1286 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1287 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1288 -mfpmath=@var{unit} @gol
1289 -masm=@var{dialect} -mno-fancy-math-387 @gol
1290 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1291 -mno-wide-multiply -mrtd -malign-double @gol
1292 -mpreferred-stack-boundary=@var{num} @gol
1293 -mincoming-stack-boundary=@var{num} @gol
1294 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1295 -mrecip -mrecip=@var{opt} @gol
1296 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1297 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1298 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1299 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1300 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1301 -mptwrite -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1302 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1303 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp @gol
1304 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1305 -mshstk -mforce-indirect-call -mavx512vbmi2 @gol
1306 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1307 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1308 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1309 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1310 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1311 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1312 -mregparm=@var{num} -msseregparm @gol
1313 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1314 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1315 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1316 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1317 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1318 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1319 -minstrument-return=@var{type} -mfentry-name=@var{name} @gol
1320 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1321 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1322 -mstack-protector-guard-reg=@var{reg} @gol
1323 -mstack-protector-guard-offset=@var{offset} @gol
1324 -mstack-protector-guard-symbol=@var{symbol} @gol
1325 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1326 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1327 -mindirect-branch-register}
1328
1329 @emph{x86 Windows Options}
1330 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1331 -mnop-fun-dllimport -mthread @gol
1332 -municode -mwin32 -mwindows -fno-set-stack-executable}
1333
1334 @emph{Xstormy16 Options}
1335 @gccoptlist{-msim}
1336
1337 @emph{Xtensa Options}
1338 @gccoptlist{-mconst16 -mno-const16 @gol
1339 -mfused-madd -mno-fused-madd @gol
1340 -mforce-no-pic @gol
1341 -mserialize-volatile -mno-serialize-volatile @gol
1342 -mtext-section-literals -mno-text-section-literals @gol
1343 -mauto-litpools -mno-auto-litpools @gol
1344 -mtarget-align -mno-target-align @gol
1345 -mlongcalls -mno-longcalls}
1346
1347 @emph{zSeries Options}
1348 See S/390 and zSeries Options.
1349 @end table
1350
1351
1352 @node Overall Options
1353 @section Options Controlling the Kind of Output
1354
1355 Compilation can involve up to four stages: preprocessing, compilation
1356 proper, assembly and linking, always in that order. GCC is capable of
1357 preprocessing and compiling several files either into several
1358 assembler input files, or into one assembler input file; then each
1359 assembler input file produces an object file, and linking combines all
1360 the object files (those newly compiled, and those specified as input)
1361 into an executable file.
1362
1363 @cindex file name suffix
1364 For any given input file, the file name suffix determines what kind of
1365 compilation is done:
1366
1367 @table @gcctabopt
1368 @item @var{file}.c
1369 C source code that must be preprocessed.
1370
1371 @item @var{file}.i
1372 C source code that should not be preprocessed.
1373
1374 @item @var{file}.ii
1375 C++ source code that should not be preprocessed.
1376
1377 @item @var{file}.m
1378 Objective-C source code. Note that you must link with the @file{libobjc}
1379 library to make an Objective-C program work.
1380
1381 @item @var{file}.mi
1382 Objective-C source code that should not be preprocessed.
1383
1384 @item @var{file}.mm
1385 @itemx @var{file}.M
1386 Objective-C++ source code. Note that you must link with the @file{libobjc}
1387 library to make an Objective-C++ program work. Note that @samp{.M} refers
1388 to a literal capital M@.
1389
1390 @item @var{file}.mii
1391 Objective-C++ source code that should not be preprocessed.
1392
1393 @item @var{file}.h
1394 C, C++, Objective-C or Objective-C++ header file to be turned into a
1395 precompiled header (default), or C, C++ header file to be turned into an
1396 Ada spec (via the @option{-fdump-ada-spec} switch).
1397
1398 @item @var{file}.cc
1399 @itemx @var{file}.cp
1400 @itemx @var{file}.cxx
1401 @itemx @var{file}.cpp
1402 @itemx @var{file}.CPP
1403 @itemx @var{file}.c++
1404 @itemx @var{file}.C
1405 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1406 the last two letters must both be literally @samp{x}. Likewise,
1407 @samp{.C} refers to a literal capital C@.
1408
1409 @item @var{file}.mm
1410 @itemx @var{file}.M
1411 Objective-C++ source code that must be preprocessed.
1412
1413 @item @var{file}.mii
1414 Objective-C++ source code that should not be preprocessed.
1415
1416 @item @var{file}.hh
1417 @itemx @var{file}.H
1418 @itemx @var{file}.hp
1419 @itemx @var{file}.hxx
1420 @itemx @var{file}.hpp
1421 @itemx @var{file}.HPP
1422 @itemx @var{file}.h++
1423 @itemx @var{file}.tcc
1424 C++ header file to be turned into a precompiled header or Ada spec.
1425
1426 @item @var{file}.f
1427 @itemx @var{file}.for
1428 @itemx @var{file}.ftn
1429 Fixed form Fortran source code that should not be preprocessed.
1430
1431 @item @var{file}.F
1432 @itemx @var{file}.FOR
1433 @itemx @var{file}.fpp
1434 @itemx @var{file}.FPP
1435 @itemx @var{file}.FTN
1436 Fixed form Fortran source code that must be preprocessed (with the traditional
1437 preprocessor).
1438
1439 @item @var{file}.f90
1440 @itemx @var{file}.f95
1441 @itemx @var{file}.f03
1442 @itemx @var{file}.f08
1443 Free form Fortran source code that should not be preprocessed.
1444
1445 @item @var{file}.F90
1446 @itemx @var{file}.F95
1447 @itemx @var{file}.F03
1448 @itemx @var{file}.F08
1449 Free form Fortran source code that must be preprocessed (with the
1450 traditional preprocessor).
1451
1452 @item @var{file}.go
1453 Go source code.
1454
1455 @item @var{file}.brig
1456 BRIG files (binary representation of HSAIL).
1457
1458 @item @var{file}.d
1459 D source code.
1460
1461 @item @var{file}.di
1462 D interface file.
1463
1464 @item @var{file}.dd
1465 D documentation code (Ddoc).
1466
1467 @item @var{file}.ads
1468 Ada source code file that contains a library unit declaration (a
1469 declaration of a package, subprogram, or generic, or a generic
1470 instantiation), or a library unit renaming declaration (a package,
1471 generic, or subprogram renaming declaration). Such files are also
1472 called @dfn{specs}.
1473
1474 @item @var{file}.adb
1475 Ada source code file containing a library unit body (a subprogram or
1476 package body). Such files are also called @dfn{bodies}.
1477
1478 @c GCC also knows about some suffixes for languages not yet included:
1479 @c Ratfor:
1480 @c @var{file}.r
1481
1482 @item @var{file}.s
1483 Assembler code.
1484
1485 @item @var{file}.S
1486 @itemx @var{file}.sx
1487 Assembler code that must be preprocessed.
1488
1489 @item @var{other}
1490 An object file to be fed straight into linking.
1491 Any file name with no recognized suffix is treated this way.
1492 @end table
1493
1494 @opindex x
1495 You can specify the input language explicitly with the @option{-x} option:
1496
1497 @table @gcctabopt
1498 @item -x @var{language}
1499 Specify explicitly the @var{language} for the following input files
1500 (rather than letting the compiler choose a default based on the file
1501 name suffix). This option applies to all following input files until
1502 the next @option{-x} option. Possible values for @var{language} are:
1503 @smallexample
1504 c c-header cpp-output
1505 c++ c++-header c++-cpp-output
1506 objective-c objective-c-header objective-c-cpp-output
1507 objective-c++ objective-c++-header objective-c++-cpp-output
1508 assembler assembler-with-cpp
1509 ada
1510 d
1511 f77 f77-cpp-input f95 f95-cpp-input
1512 go
1513 brig
1514 @end smallexample
1515
1516 @item -x none
1517 Turn off any specification of a language, so that subsequent files are
1518 handled according to their file name suffixes (as they are if @option{-x}
1519 has not been used at all).
1520 @end table
1521
1522 If you only want some of the stages of compilation, you can use
1523 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1524 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1525 @command{gcc} is to stop. Note that some combinations (for example,
1526 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1527
1528 @table @gcctabopt
1529 @item -c
1530 @opindex c
1531 Compile or assemble the source files, but do not link. The linking
1532 stage simply is not done. The ultimate output is in the form of an
1533 object file for each source file.
1534
1535 By default, the object file name for a source file is made by replacing
1536 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1537
1538 Unrecognized input files, not requiring compilation or assembly, are
1539 ignored.
1540
1541 @item -S
1542 @opindex S
1543 Stop after the stage of compilation proper; do not assemble. The output
1544 is in the form of an assembler code file for each non-assembler input
1545 file specified.
1546
1547 By default, the assembler file name for a source file is made by
1548 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1549
1550 Input files that don't require compilation are ignored.
1551
1552 @item -E
1553 @opindex E
1554 Stop after the preprocessing stage; do not run the compiler proper. The
1555 output is in the form of preprocessed source code, which is sent to the
1556 standard output.
1557
1558 Input files that don't require preprocessing are ignored.
1559
1560 @cindex output file option
1561 @item -o @var{file}
1562 @opindex o
1563 Place output in file @var{file}. This applies to whatever
1564 sort of output is being produced, whether it be an executable file,
1565 an object file, an assembler file or preprocessed C code.
1566
1567 If @option{-o} is not specified, the default is to put an executable
1568 file in @file{a.out}, the object file for
1569 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1570 assembler file in @file{@var{source}.s}, a precompiled header file in
1571 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1572 standard output.
1573
1574 @item -v
1575 @opindex v
1576 Print (on standard error output) the commands executed to run the stages
1577 of compilation. Also print the version number of the compiler driver
1578 program and of the preprocessor and the compiler proper.
1579
1580 @item -###
1581 @opindex ###
1582 Like @option{-v} except the commands are not executed and arguments
1583 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1584 This is useful for shell scripts to capture the driver-generated command lines.
1585
1586 @item --help
1587 @opindex help
1588 Print (on the standard output) a description of the command-line options
1589 understood by @command{gcc}. If the @option{-v} option is also specified
1590 then @option{--help} is also passed on to the various processes
1591 invoked by @command{gcc}, so that they can display the command-line options
1592 they accept. If the @option{-Wextra} option has also been specified
1593 (prior to the @option{--help} option), then command-line options that
1594 have no documentation associated with them are also displayed.
1595
1596 @item --target-help
1597 @opindex target-help
1598 Print (on the standard output) a description of target-specific command-line
1599 options for each tool. For some targets extra target-specific
1600 information may also be printed.
1601
1602 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1603 Print (on the standard output) a description of the command-line
1604 options understood by the compiler that fit into all specified classes
1605 and qualifiers. These are the supported classes:
1606
1607 @table @asis
1608 @item @samp{optimizers}
1609 Display all of the optimization options supported by the
1610 compiler.
1611
1612 @item @samp{warnings}
1613 Display all of the options controlling warning messages
1614 produced by the compiler.
1615
1616 @item @samp{target}
1617 Display target-specific options. Unlike the
1618 @option{--target-help} option however, target-specific options of the
1619 linker and assembler are not displayed. This is because those
1620 tools do not currently support the extended @option{--help=} syntax.
1621
1622 @item @samp{params}
1623 Display the values recognized by the @option{--param}
1624 option.
1625
1626 @item @var{language}
1627 Display the options supported for @var{language}, where
1628 @var{language} is the name of one of the languages supported in this
1629 version of GCC@.
1630
1631 @item @samp{common}
1632 Display the options that are common to all languages.
1633 @end table
1634
1635 These are the supported qualifiers:
1636
1637 @table @asis
1638 @item @samp{undocumented}
1639 Display only those options that are undocumented.
1640
1641 @item @samp{joined}
1642 Display options taking an argument that appears after an equal
1643 sign in the same continuous piece of text, such as:
1644 @samp{--help=target}.
1645
1646 @item @samp{separate}
1647 Display options taking an argument that appears as a separate word
1648 following the original option, such as: @samp{-o output-file}.
1649 @end table
1650
1651 Thus for example to display all the undocumented target-specific
1652 switches supported by the compiler, use:
1653
1654 @smallexample
1655 --help=target,undocumented
1656 @end smallexample
1657
1658 The sense of a qualifier can be inverted by prefixing it with the
1659 @samp{^} character, so for example to display all binary warning
1660 options (i.e., ones that are either on or off and that do not take an
1661 argument) that have a description, use:
1662
1663 @smallexample
1664 --help=warnings,^joined,^undocumented
1665 @end smallexample
1666
1667 The argument to @option{--help=} should not consist solely of inverted
1668 qualifiers.
1669
1670 Combining several classes is possible, although this usually
1671 restricts the output so much that there is nothing to display. One
1672 case where it does work, however, is when one of the classes is
1673 @var{target}. For example, to display all the target-specific
1674 optimization options, use:
1675
1676 @smallexample
1677 --help=target,optimizers
1678 @end smallexample
1679
1680 The @option{--help=} option can be repeated on the command line. Each
1681 successive use displays its requested class of options, skipping
1682 those that have already been displayed. If @option{--help} is also
1683 specified anywhere on the command line then this takes precedence
1684 over any @option{--help=} option.
1685
1686 If the @option{-Q} option appears on the command line before the
1687 @option{--help=} option, then the descriptive text displayed by
1688 @option{--help=} is changed. Instead of describing the displayed
1689 options, an indication is given as to whether the option is enabled,
1690 disabled or set to a specific value (assuming that the compiler
1691 knows this at the point where the @option{--help=} option is used).
1692
1693 Here is a truncated example from the ARM port of @command{gcc}:
1694
1695 @smallexample
1696 % gcc -Q -mabi=2 --help=target -c
1697 The following options are target specific:
1698 -mabi= 2
1699 -mabort-on-noreturn [disabled]
1700 -mapcs [disabled]
1701 @end smallexample
1702
1703 The output is sensitive to the effects of previous command-line
1704 options, so for example it is possible to find out which optimizations
1705 are enabled at @option{-O2} by using:
1706
1707 @smallexample
1708 -Q -O2 --help=optimizers
1709 @end smallexample
1710
1711 Alternatively you can discover which binary optimizations are enabled
1712 by @option{-O3} by using:
1713
1714 @smallexample
1715 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1716 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1717 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1718 @end smallexample
1719
1720 @item --version
1721 @opindex version
1722 Display the version number and copyrights of the invoked GCC@.
1723
1724 @item -pass-exit-codes
1725 @opindex pass-exit-codes
1726 Normally the @command{gcc} program exits with the code of 1 if any
1727 phase of the compiler returns a non-success return code. If you specify
1728 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1729 the numerically highest error produced by any phase returning an error
1730 indication. The C, C++, and Fortran front ends return 4 if an internal
1731 compiler error is encountered.
1732
1733 @item -pipe
1734 @opindex pipe
1735 Use pipes rather than temporary files for communication between the
1736 various stages of compilation. This fails to work on some systems where
1737 the assembler is unable to read from a pipe; but the GNU assembler has
1738 no trouble.
1739
1740 @item -specs=@var{file}
1741 @opindex specs
1742 Process @var{file} after the compiler reads in the standard @file{specs}
1743 file, in order to override the defaults which the @command{gcc} driver
1744 program uses when determining what switches to pass to @command{cc1},
1745 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1746 @option{-specs=@var{file}} can be specified on the command line, and they
1747 are processed in order, from left to right. @xref{Spec Files}, for
1748 information about the format of the @var{file}.
1749
1750 @item -wrapper
1751 @opindex wrapper
1752 Invoke all subcommands under a wrapper program. The name of the
1753 wrapper program and its parameters are passed as a comma separated
1754 list.
1755
1756 @smallexample
1757 gcc -c t.c -wrapper gdb,--args
1758 @end smallexample
1759
1760 @noindent
1761 This invokes all subprograms of @command{gcc} under
1762 @samp{gdb --args}, thus the invocation of @command{cc1} is
1763 @samp{gdb --args cc1 @dots{}}.
1764
1765 @item -ffile-prefix-map=@var{old}=@var{new}
1766 @opindex ffile-prefix-map
1767 When compiling files residing in directory @file{@var{old}}, record
1768 any references to them in the result of the compilation as if the
1769 files resided in directory @file{@var{new}} instead. Specifying this
1770 option is equivalent to specifying all the individual
1771 @option{-f*-prefix-map} options. This can be used to make reproducible
1772 builds that are location independent. See also
1773 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1774
1775 @item -fplugin=@var{name}.so
1776 @opindex fplugin
1777 Load the plugin code in file @var{name}.so, assumed to be a
1778 shared object to be dlopen'd by the compiler. The base name of
1779 the shared object file is used to identify the plugin for the
1780 purposes of argument parsing (See
1781 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1782 Each plugin should define the callback functions specified in the
1783 Plugins API.
1784
1785 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1786 @opindex fplugin-arg
1787 Define an argument called @var{key} with a value of @var{value}
1788 for the plugin called @var{name}.
1789
1790 @item -fdump-ada-spec@r{[}-slim@r{]}
1791 @opindex fdump-ada-spec
1792 For C and C++ source and include files, generate corresponding Ada specs.
1793 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1794 GNAT User's Guide}, which provides detailed documentation on this feature.
1795
1796 @item -fada-spec-parent=@var{unit}
1797 @opindex fada-spec-parent
1798 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1799 Ada specs as child units of parent @var{unit}.
1800
1801 @item -fdump-go-spec=@var{file}
1802 @opindex fdump-go-spec
1803 For input files in any language, generate corresponding Go
1804 declarations in @var{file}. This generates Go @code{const},
1805 @code{type}, @code{var}, and @code{func} declarations which may be a
1806 useful way to start writing a Go interface to code written in some
1807 other language.
1808
1809 @include @value{srcdir}/../libiberty/at-file.texi
1810 @end table
1811
1812 @node Invoking G++
1813 @section Compiling C++ Programs
1814
1815 @cindex suffixes for C++ source
1816 @cindex C++ source file suffixes
1817 C++ source files conventionally use one of the suffixes @samp{.C},
1818 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1819 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1820 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1821 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1822 files with these names and compiles them as C++ programs even if you
1823 call the compiler the same way as for compiling C programs (usually
1824 with the name @command{gcc}).
1825
1826 @findex g++
1827 @findex c++
1828 However, the use of @command{gcc} does not add the C++ library.
1829 @command{g++} is a program that calls GCC and automatically specifies linking
1830 against the C++ library. It treats @samp{.c},
1831 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1832 files unless @option{-x} is used. This program is also useful when
1833 precompiling a C header file with a @samp{.h} extension for use in C++
1834 compilations. On many systems, @command{g++} is also installed with
1835 the name @command{c++}.
1836
1837 @cindex invoking @command{g++}
1838 When you compile C++ programs, you may specify many of the same
1839 command-line options that you use for compiling programs in any
1840 language; or command-line options meaningful for C and related
1841 languages; or options that are meaningful only for C++ programs.
1842 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1843 explanations of options for languages related to C@.
1844 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1845 explanations of options that are meaningful only for C++ programs.
1846
1847 @node C Dialect Options
1848 @section Options Controlling C Dialect
1849 @cindex dialect options
1850 @cindex language dialect options
1851 @cindex options, dialect
1852
1853 The following options control the dialect of C (or languages derived
1854 from C, such as C++, Objective-C and Objective-C++) that the compiler
1855 accepts:
1856
1857 @table @gcctabopt
1858 @cindex ANSI support
1859 @cindex ISO support
1860 @item -ansi
1861 @opindex ansi
1862 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1863 equivalent to @option{-std=c++98}.
1864
1865 This turns off certain features of GCC that are incompatible with ISO
1866 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1867 such as the @code{asm} and @code{typeof} keywords, and
1868 predefined macros such as @code{unix} and @code{vax} that identify the
1869 type of system you are using. It also enables the undesirable and
1870 rarely used ISO trigraph feature. For the C compiler,
1871 it disables recognition of C++ style @samp{//} comments as well as
1872 the @code{inline} keyword.
1873
1874 The alternate keywords @code{__asm__}, @code{__extension__},
1875 @code{__inline__} and @code{__typeof__} continue to work despite
1876 @option{-ansi}. You would not want to use them in an ISO C program, of
1877 course, but it is useful to put them in header files that might be included
1878 in compilations done with @option{-ansi}. Alternate predefined macros
1879 such as @code{__unix__} and @code{__vax__} are also available, with or
1880 without @option{-ansi}.
1881
1882 The @option{-ansi} option does not cause non-ISO programs to be
1883 rejected gratuitously. For that, @option{-Wpedantic} is required in
1884 addition to @option{-ansi}. @xref{Warning Options}.
1885
1886 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1887 option is used. Some header files may notice this macro and refrain
1888 from declaring certain functions or defining certain macros that the
1889 ISO standard doesn't call for; this is to avoid interfering with any
1890 programs that might use these names for other things.
1891
1892 Functions that are normally built in but do not have semantics
1893 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1894 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1895 built-in functions provided by GCC}, for details of the functions
1896 affected.
1897
1898 @item -std=
1899 @opindex std
1900 Determine the language standard. @xref{Standards,,Language Standards
1901 Supported by GCC}, for details of these standard versions. This option
1902 is currently only supported when compiling C or C++.
1903
1904 The compiler can accept several base standards, such as @samp{c90} or
1905 @samp{c++98}, and GNU dialects of those standards, such as
1906 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1907 compiler accepts all programs following that standard plus those
1908 using GNU extensions that do not contradict it. For example,
1909 @option{-std=c90} turns off certain features of GCC that are
1910 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1911 keywords, but not other GNU extensions that do not have a meaning in
1912 ISO C90, such as omitting the middle term of a @code{?:}
1913 expression. On the other hand, when a GNU dialect of a standard is
1914 specified, all features supported by the compiler are enabled, even when
1915 those features change the meaning of the base standard. As a result, some
1916 strict-conforming programs may be rejected. The particular standard
1917 is used by @option{-Wpedantic} to identify which features are GNU
1918 extensions given that version of the standard. For example
1919 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1920 comments, while @option{-std=gnu99 -Wpedantic} does not.
1921
1922 A value for this option must be provided; possible values are
1923
1924 @table @samp
1925 @item c90
1926 @itemx c89
1927 @itemx iso9899:1990
1928 Support all ISO C90 programs (certain GNU extensions that conflict
1929 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1930
1931 @item iso9899:199409
1932 ISO C90 as modified in amendment 1.
1933
1934 @item c99
1935 @itemx c9x
1936 @itemx iso9899:1999
1937 @itemx iso9899:199x
1938 ISO C99. This standard is substantially completely supported, modulo
1939 bugs and floating-point issues
1940 (mainly but not entirely relating to optional C99 features from
1941 Annexes F and G). See
1942 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1943 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1944
1945 @item c11
1946 @itemx c1x
1947 @itemx iso9899:2011
1948 ISO C11, the 2011 revision of the ISO C standard. This standard is
1949 substantially completely supported, modulo bugs, floating-point issues
1950 (mainly but not entirely relating to optional C11 features from
1951 Annexes F and G) and the optional Annexes K (Bounds-checking
1952 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1953
1954 @item c17
1955 @itemx c18
1956 @itemx iso9899:2017
1957 @itemx iso9899:2018
1958 ISO C17, the 2017 revision of the ISO C standard
1959 (published in 2018). This standard is
1960 same as C11 except for corrections of defects (all of which are also
1961 applied with @option{-std=c11}) and a new value of
1962 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1963
1964 @item c2x
1965 The next version of the ISO C standard, still under development. The
1966 support for this version is experimental and incomplete.
1967
1968 @item gnu90
1969 @itemx gnu89
1970 GNU dialect of ISO C90 (including some C99 features).
1971
1972 @item gnu99
1973 @itemx gnu9x
1974 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1975
1976 @item gnu11
1977 @itemx gnu1x
1978 GNU dialect of ISO C11.
1979 The name @samp{gnu1x} is deprecated.
1980
1981 @item gnu17
1982 @itemx gnu18
1983 GNU dialect of ISO C17. This is the default for C code.
1984
1985 @item gnu2x
1986 The next version of the ISO C standard, still under development, plus
1987 GNU extensions. The support for this version is experimental and
1988 incomplete.
1989
1990 @item c++98
1991 @itemx c++03
1992 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1993 additional defect reports. Same as @option{-ansi} for C++ code.
1994
1995 @item gnu++98
1996 @itemx gnu++03
1997 GNU dialect of @option{-std=c++98}.
1998
1999 @item c++11
2000 @itemx c++0x
2001 The 2011 ISO C++ standard plus amendments.
2002 The name @samp{c++0x} is deprecated.
2003
2004 @item gnu++11
2005 @itemx gnu++0x
2006 GNU dialect of @option{-std=c++11}.
2007 The name @samp{gnu++0x} is deprecated.
2008
2009 @item c++14
2010 @itemx c++1y
2011 The 2014 ISO C++ standard plus amendments.
2012 The name @samp{c++1y} is deprecated.
2013
2014 @item gnu++14
2015 @itemx gnu++1y
2016 GNU dialect of @option{-std=c++14}.
2017 This is the default for C++ code.
2018 The name @samp{gnu++1y} is deprecated.
2019
2020 @item c++17
2021 @itemx c++1z
2022 The 2017 ISO C++ standard plus amendments.
2023 The name @samp{c++1z} is deprecated.
2024
2025 @item gnu++17
2026 @itemx gnu++1z
2027 GNU dialect of @option{-std=c++17}.
2028 The name @samp{gnu++1z} is deprecated.
2029
2030 @item c++2a
2031 The next revision of the ISO C++ standard, tentatively planned for
2032 2020. Support is highly experimental, and will almost certainly
2033 change in incompatible ways in future releases.
2034
2035 @item gnu++2a
2036 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2037 and will almost certainly change in incompatible ways in future
2038 releases.
2039 @end table
2040
2041 @item -fgnu89-inline
2042 @opindex fgnu89-inline
2043 The option @option{-fgnu89-inline} tells GCC to use the traditional
2044 GNU semantics for @code{inline} functions when in C99 mode.
2045 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2046 Using this option is roughly equivalent to adding the
2047 @code{gnu_inline} function attribute to all inline functions
2048 (@pxref{Function Attributes}).
2049
2050 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2051 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2052 specifies the default behavior).
2053 This option is not supported in @option{-std=c90} or
2054 @option{-std=gnu90} mode.
2055
2056 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2057 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2058 in effect for @code{inline} functions. @xref{Common Predefined
2059 Macros,,,cpp,The C Preprocessor}.
2060
2061 @item -fpermitted-flt-eval-methods=@var{style}
2062 @opindex fpermitted-flt-eval-methods
2063 @opindex fpermitted-flt-eval-methods=c11
2064 @opindex fpermitted-flt-eval-methods=ts-18661-3
2065 ISO/IEC TS 18661-3 defines new permissible values for
2066 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2067 a semantic type that is an interchange or extended format should be
2068 evaluated to the precision and range of that type. These new values are
2069 a superset of those permitted under C99/C11, which does not specify the
2070 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2071 conforming to C11 may not have been written expecting the possibility of
2072 the new values.
2073
2074 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2075 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2076 or the extended set of values specified in ISO/IEC TS 18661-3.
2077
2078 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2079
2080 The default when in a standards compliant mode (@option{-std=c11} or similar)
2081 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2082 dialect (@option{-std=gnu11} or similar) is
2083 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2084
2085 @item -aux-info @var{filename}
2086 @opindex aux-info
2087 Output to the given filename prototyped declarations for all functions
2088 declared and/or defined in a translation unit, including those in header
2089 files. This option is silently ignored in any language other than C@.
2090
2091 Besides declarations, the file indicates, in comments, the origin of
2092 each declaration (source file and line), whether the declaration was
2093 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2094 @samp{O} for old, respectively, in the first character after the line
2095 number and the colon), and whether it came from a declaration or a
2096 definition (@samp{C} or @samp{F}, respectively, in the following
2097 character). In the case of function definitions, a K&R-style list of
2098 arguments followed by their declarations is also provided, inside
2099 comments, after the declaration.
2100
2101 @item -fallow-parameterless-variadic-functions
2102 @opindex fallow-parameterless-variadic-functions
2103 Accept variadic functions without named parameters.
2104
2105 Although it is possible to define such a function, this is not very
2106 useful as it is not possible to read the arguments. This is only
2107 supported for C as this construct is allowed by C++.
2108
2109 @item -fno-asm
2110 @opindex fno-asm
2111 @opindex fasm
2112 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2113 keyword, so that code can use these words as identifiers. You can use
2114 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2115 instead. @option{-ansi} implies @option{-fno-asm}.
2116
2117 In C++, this switch only affects the @code{typeof} keyword, since
2118 @code{asm} and @code{inline} are standard keywords. You may want to
2119 use the @option{-fno-gnu-keywords} flag instead, which has the same
2120 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2121 switch only affects the @code{asm} and @code{typeof} keywords, since
2122 @code{inline} is a standard keyword in ISO C99.
2123
2124 @item -fno-builtin
2125 @itemx -fno-builtin-@var{function}
2126 @opindex fno-builtin
2127 @opindex fbuiltin
2128 @cindex built-in functions
2129 Don't recognize built-in functions that do not begin with
2130 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2131 functions provided by GCC}, for details of the functions affected,
2132 including those which are not built-in functions when @option{-ansi} or
2133 @option{-std} options for strict ISO C conformance are used because they
2134 do not have an ISO standard meaning.
2135
2136 GCC normally generates special code to handle certain built-in functions
2137 more efficiently; for instance, calls to @code{alloca} may become single
2138 instructions which adjust the stack directly, and calls to @code{memcpy}
2139 may become inline copy loops. The resulting code is often both smaller
2140 and faster, but since the function calls no longer appear as such, you
2141 cannot set a breakpoint on those calls, nor can you change the behavior
2142 of the functions by linking with a different library. In addition,
2143 when a function is recognized as a built-in function, GCC may use
2144 information about that function to warn about problems with calls to
2145 that function, or to generate more efficient code, even if the
2146 resulting code still contains calls to that function. For example,
2147 warnings are given with @option{-Wformat} for bad calls to
2148 @code{printf} when @code{printf} is built in and @code{strlen} is
2149 known not to modify global memory.
2150
2151 With the @option{-fno-builtin-@var{function}} option
2152 only the built-in function @var{function} is
2153 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2154 function is named that is not built-in in this version of GCC, this
2155 option is ignored. There is no corresponding
2156 @option{-fbuiltin-@var{function}} option; if you wish to enable
2157 built-in functions selectively when using @option{-fno-builtin} or
2158 @option{-ffreestanding}, you may define macros such as:
2159
2160 @smallexample
2161 #define abs(n) __builtin_abs ((n))
2162 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2163 @end smallexample
2164
2165 @item -fgimple
2166 @opindex fgimple
2167
2168 Enable parsing of function definitions marked with @code{__GIMPLE}.
2169 This is an experimental feature that allows unit testing of GIMPLE
2170 passes.
2171
2172 @item -fhosted
2173 @opindex fhosted
2174 @cindex hosted environment
2175
2176 Assert that compilation targets a hosted environment. This implies
2177 @option{-fbuiltin}. A hosted environment is one in which the
2178 entire standard library is available, and in which @code{main} has a return
2179 type of @code{int}. Examples are nearly everything except a kernel.
2180 This is equivalent to @option{-fno-freestanding}.
2181
2182 @item -ffreestanding
2183 @opindex ffreestanding
2184 @cindex hosted environment
2185
2186 Assert that compilation targets a freestanding environment. This
2187 implies @option{-fno-builtin}. A freestanding environment
2188 is one in which the standard library may not exist, and program startup may
2189 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2190 This is equivalent to @option{-fno-hosted}.
2191
2192 @xref{Standards,,Language Standards Supported by GCC}, for details of
2193 freestanding and hosted environments.
2194
2195 @item -fopenacc
2196 @opindex fopenacc
2197 @cindex OpenACC accelerator programming
2198 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2199 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2200 compiler generates accelerated code according to the OpenACC Application
2201 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2202 implies @option{-pthread}, and thus is only supported on targets that
2203 have support for @option{-pthread}.
2204
2205 @item -fopenacc-dim=@var{geom}
2206 @opindex fopenacc-dim
2207 @cindex OpenACC accelerator programming
2208 Specify default compute dimensions for parallel offload regions that do
2209 not explicitly specify. The @var{geom} value is a triple of
2210 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2211 can be omitted, to use a target-specific default value.
2212
2213 @item -fopenmp
2214 @opindex fopenmp
2215 @cindex OpenMP parallel
2216 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2217 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2218 compiler generates parallel code according to the OpenMP Application
2219 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2220 implies @option{-pthread}, and thus is only supported on targets that
2221 have support for @option{-pthread}. @option{-fopenmp} implies
2222 @option{-fopenmp-simd}.
2223
2224 @item -fopenmp-simd
2225 @opindex fopenmp-simd
2226 @cindex OpenMP SIMD
2227 @cindex SIMD
2228 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2229 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2230 are ignored.
2231
2232 @item -fgnu-tm
2233 @opindex fgnu-tm
2234 When the option @option{-fgnu-tm} is specified, the compiler
2235 generates code for the Linux variant of Intel's current Transactional
2236 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2237 an experimental feature whose interface may change in future versions
2238 of GCC, as the official specification changes. Please note that not
2239 all architectures are supported for this feature.
2240
2241 For more information on GCC's support for transactional memory,
2242 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2243 Transactional Memory Library}.
2244
2245 Note that the transactional memory feature is not supported with
2246 non-call exceptions (@option{-fnon-call-exceptions}).
2247
2248 @item -fms-extensions
2249 @opindex fms-extensions
2250 Accept some non-standard constructs used in Microsoft header files.
2251
2252 In C++ code, this allows member names in structures to be similar
2253 to previous types declarations.
2254
2255 @smallexample
2256 typedef int UOW;
2257 struct ABC @{
2258 UOW UOW;
2259 @};
2260 @end smallexample
2261
2262 Some cases of unnamed fields in structures and unions are only
2263 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2264 fields within structs/unions}, for details.
2265
2266 Note that this option is off for all targets but x86
2267 targets using ms-abi.
2268
2269 @item -fplan9-extensions
2270 @opindex fplan9-extensions
2271 Accept some non-standard constructs used in Plan 9 code.
2272
2273 This enables @option{-fms-extensions}, permits passing pointers to
2274 structures with anonymous fields to functions that expect pointers to
2275 elements of the type of the field, and permits referring to anonymous
2276 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2277 struct/union fields within structs/unions}, for details. This is only
2278 supported for C, not C++.
2279
2280 @item -fcond-mismatch
2281 @opindex fcond-mismatch
2282 Allow conditional expressions with mismatched types in the second and
2283 third arguments. The value of such an expression is void. This option
2284 is not supported for C++.
2285
2286 @item -flax-vector-conversions
2287 @opindex flax-vector-conversions
2288 Allow implicit conversions between vectors with differing numbers of
2289 elements and/or incompatible element types. This option should not be
2290 used for new code.
2291
2292 @item -funsigned-char
2293 @opindex funsigned-char
2294 Let the type @code{char} be unsigned, like @code{unsigned char}.
2295
2296 Each kind of machine has a default for what @code{char} should
2297 be. It is either like @code{unsigned char} by default or like
2298 @code{signed char} by default.
2299
2300 Ideally, a portable program should always use @code{signed char} or
2301 @code{unsigned char} when it depends on the signedness of an object.
2302 But many programs have been written to use plain @code{char} and
2303 expect it to be signed, or expect it to be unsigned, depending on the
2304 machines they were written for. This option, and its inverse, let you
2305 make such a program work with the opposite default.
2306
2307 The type @code{char} is always a distinct type from each of
2308 @code{signed char} or @code{unsigned char}, even though its behavior
2309 is always just like one of those two.
2310
2311 @item -fsigned-char
2312 @opindex fsigned-char
2313 Let the type @code{char} be signed, like @code{signed char}.
2314
2315 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2316 the negative form of @option{-funsigned-char}. Likewise, the option
2317 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2318
2319 @item -fsigned-bitfields
2320 @itemx -funsigned-bitfields
2321 @itemx -fno-signed-bitfields
2322 @itemx -fno-unsigned-bitfields
2323 @opindex fsigned-bitfields
2324 @opindex funsigned-bitfields
2325 @opindex fno-signed-bitfields
2326 @opindex fno-unsigned-bitfields
2327 These options control whether a bit-field is signed or unsigned, when the
2328 declaration does not use either @code{signed} or @code{unsigned}. By
2329 default, such a bit-field is signed, because this is consistent: the
2330 basic integer types such as @code{int} are signed types.
2331
2332 @item -fsso-struct=@var{endianness}
2333 @opindex fsso-struct
2334 Set the default scalar storage order of structures and unions to the
2335 specified endianness. The accepted values are @samp{big-endian},
2336 @samp{little-endian} and @samp{native} for the native endianness of
2337 the target (the default). This option is not supported for C++.
2338
2339 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2340 code that is not binary compatible with code generated without it if the
2341 specified endianness is not the native endianness of the target.
2342 @end table
2343
2344 @node C++ Dialect Options
2345 @section Options Controlling C++ Dialect
2346
2347 @cindex compiler options, C++
2348 @cindex C++ options, command-line
2349 @cindex options, C++
2350 This section describes the command-line options that are only meaningful
2351 for C++ programs. You can also use most of the GNU compiler options
2352 regardless of what language your program is in. For example, you
2353 might compile a file @file{firstClass.C} like this:
2354
2355 @smallexample
2356 g++ -g -fstrict-enums -O -c firstClass.C
2357 @end smallexample
2358
2359 @noindent
2360 In this example, only @option{-fstrict-enums} is an option meant
2361 only for C++ programs; you can use the other options with any
2362 language supported by GCC@.
2363
2364 Some options for compiling C programs, such as @option{-std}, are also
2365 relevant for C++ programs.
2366 @xref{C Dialect Options,,Options Controlling C Dialect}.
2367
2368 Here is a list of options that are @emph{only} for compiling C++ programs:
2369
2370 @table @gcctabopt
2371
2372 @item -fabi-version=@var{n}
2373 @opindex fabi-version
2374 Use version @var{n} of the C++ ABI@. The default is version 0.
2375
2376 Version 0 refers to the version conforming most closely to
2377 the C++ ABI specification. Therefore, the ABI obtained using version 0
2378 will change in different versions of G++ as ABI bugs are fixed.
2379
2380 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2381
2382 Version 2 is the version of the C++ ABI that first appeared in G++
2383 3.4, and was the default through G++ 4.9.
2384
2385 Version 3 corrects an error in mangling a constant address as a
2386 template argument.
2387
2388 Version 4, which first appeared in G++ 4.5, implements a standard
2389 mangling for vector types.
2390
2391 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2392 attribute const/volatile on function pointer types, decltype of a
2393 plain decl, and use of a function parameter in the declaration of
2394 another parameter.
2395
2396 Version 6, which first appeared in G++ 4.7, corrects the promotion
2397 behavior of C++11 scoped enums and the mangling of template argument
2398 packs, const/static_cast, prefix ++ and --, and a class scope function
2399 used as a template argument.
2400
2401 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2402 builtin type and corrects the mangling of lambdas in default argument
2403 scope.
2404
2405 Version 8, which first appeared in G++ 4.9, corrects the substitution
2406 behavior of function types with function-cv-qualifiers.
2407
2408 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2409 @code{nullptr_t}.
2410
2411 Version 10, which first appeared in G++ 6.1, adds mangling of
2412 attributes that affect type identity, such as ia32 calling convention
2413 attributes (e.g.@: @samp{stdcall}).
2414
2415 Version 11, which first appeared in G++ 7, corrects the mangling of
2416 sizeof... expressions and operator names. For multiple entities with
2417 the same name within a function, that are declared in different scopes,
2418 the mangling now changes starting with the twelfth occurrence. It also
2419 implies @option{-fnew-inheriting-ctors}.
2420
2421 Version 12, which first appeared in G++ 8, corrects the calling
2422 conventions for empty classes on the x86_64 target and for classes
2423 with only deleted copy/move constructors. It accidentally changes the
2424 calling convention for classes with a deleted copy constructor and a
2425 trivial move constructor.
2426
2427 Version 13, which first appeared in G++ 8.2, fixes the accidental
2428 change in version 12.
2429
2430 See also @option{-Wabi}.
2431
2432 @item -fabi-compat-version=@var{n}
2433 @opindex fabi-compat-version
2434 On targets that support strong aliases, G++
2435 works around mangling changes by creating an alias with the correct
2436 mangled name when defining a symbol with an incorrect mangled name.
2437 This switch specifies which ABI version to use for the alias.
2438
2439 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2440 compatibility). If another ABI version is explicitly selected, this
2441 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2442 use @option{-fabi-compat-version=2}.
2443
2444 If this option is not provided but @option{-Wabi=@var{n}} is, that
2445 version is used for compatibility aliases. If this option is provided
2446 along with @option{-Wabi} (without the version), the version from this
2447 option is used for the warning.
2448
2449 @item -fno-access-control
2450 @opindex fno-access-control
2451 @opindex faccess-control
2452 Turn off all access checking. This switch is mainly useful for working
2453 around bugs in the access control code.
2454
2455 @item -faligned-new
2456 @opindex faligned-new
2457 Enable support for C++17 @code{new} of types that require more
2458 alignment than @code{void* ::operator new(std::size_t)} provides. A
2459 numeric argument such as @code{-faligned-new=32} can be used to
2460 specify how much alignment (in bytes) is provided by that function,
2461 but few users will need to override the default of
2462 @code{alignof(std::max_align_t)}.
2463
2464 This flag is enabled by default for @option{-std=c++17}.
2465
2466 @item -fcheck-new
2467 @opindex fcheck-new
2468 Check that the pointer returned by @code{operator new} is non-null
2469 before attempting to modify the storage allocated. This check is
2470 normally unnecessary because the C++ standard specifies that
2471 @code{operator new} only returns @code{0} if it is declared
2472 @code{throw()}, in which case the compiler always checks the
2473 return value even without this option. In all other cases, when
2474 @code{operator new} has a non-empty exception specification, memory
2475 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2476 @samp{new (nothrow)}.
2477
2478 @item -fconcepts
2479 @opindex fconcepts
2480 Enable support for the C++ Extensions for Concepts Technical
2481 Specification, ISO 19217 (2015), which allows code like
2482
2483 @smallexample
2484 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2485 template <Addable T> T add (T a, T b) @{ return a + b; @}
2486 @end smallexample
2487
2488 @item -fconstexpr-depth=@var{n}
2489 @opindex fconstexpr-depth
2490 Set the maximum nested evaluation depth for C++11 constexpr functions
2491 to @var{n}. A limit is needed to detect endless recursion during
2492 constant expression evaluation. The minimum specified by the standard
2493 is 512.
2494
2495 @item -fconstexpr-loop-limit=@var{n}
2496 @opindex fconstexpr-loop-limit
2497 Set the maximum number of iterations for a loop in C++14 constexpr functions
2498 to @var{n}. A limit is needed to detect infinite loops during
2499 constant expression evaluation. The default is 262144 (1<<18).
2500
2501 @item -fdeduce-init-list
2502 @opindex fdeduce-init-list
2503 Enable deduction of a template type parameter as
2504 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2505
2506 @smallexample
2507 template <class T> auto forward(T t) -> decltype (realfn (t))
2508 @{
2509 return realfn (t);
2510 @}
2511
2512 void f()
2513 @{
2514 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2515 @}
2516 @end smallexample
2517
2518 This deduction was implemented as a possible extension to the
2519 originally proposed semantics for the C++11 standard, but was not part
2520 of the final standard, so it is disabled by default. This option is
2521 deprecated, and may be removed in a future version of G++.
2522
2523 @item -fno-elide-constructors
2524 @opindex fno-elide-constructors
2525 @opindex felide-constructors
2526 The C++ standard allows an implementation to omit creating a temporary
2527 that is only used to initialize another object of the same type.
2528 Specifying this option disables that optimization, and forces G++ to
2529 call the copy constructor in all cases. This option also causes G++
2530 to call trivial member functions which otherwise would be expanded inline.
2531
2532 In C++17, the compiler is required to omit these temporaries, but this
2533 option still affects trivial member functions.
2534
2535 @item -fno-enforce-eh-specs
2536 @opindex fno-enforce-eh-specs
2537 @opindex fenforce-eh-specs
2538 Don't generate code to check for violation of exception specifications
2539 at run time. This option violates the C++ standard, but may be useful
2540 for reducing code size in production builds, much like defining
2541 @code{NDEBUG}. This does not give user code permission to throw
2542 exceptions in violation of the exception specifications; the compiler
2543 still optimizes based on the specifications, so throwing an
2544 unexpected exception results in undefined behavior at run time.
2545
2546 @item -fextern-tls-init
2547 @itemx -fno-extern-tls-init
2548 @opindex fextern-tls-init
2549 @opindex fno-extern-tls-init
2550 The C++11 and OpenMP standards allow @code{thread_local} and
2551 @code{threadprivate} variables to have dynamic (runtime)
2552 initialization. To support this, any use of such a variable goes
2553 through a wrapper function that performs any necessary initialization.
2554 When the use and definition of the variable are in the same
2555 translation unit, this overhead can be optimized away, but when the
2556 use is in a different translation unit there is significant overhead
2557 even if the variable doesn't actually need dynamic initialization. If
2558 the programmer can be sure that no use of the variable in a
2559 non-defining TU needs to trigger dynamic initialization (either
2560 because the variable is statically initialized, or a use of the
2561 variable in the defining TU will be executed before any uses in
2562 another TU), they can avoid this overhead with the
2563 @option{-fno-extern-tls-init} option.
2564
2565 On targets that support symbol aliases, the default is
2566 @option{-fextern-tls-init}. On targets that do not support symbol
2567 aliases, the default is @option{-fno-extern-tls-init}.
2568
2569 @item -fno-gnu-keywords
2570 @opindex fno-gnu-keywords
2571 @opindex fgnu-keywords
2572 Do not recognize @code{typeof} as a keyword, so that code can use this
2573 word as an identifier. You can use the keyword @code{__typeof__} instead.
2574 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2575 @option{-std=c++98}, @option{-std=c++11}, etc.
2576
2577 @item -fno-implicit-templates
2578 @opindex fno-implicit-templates
2579 @opindex fimplicit-templates
2580 Never emit code for non-inline templates that are instantiated
2581 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2582 If you use this option, you must take care to structure your code to
2583 include all the necessary explicit instantiations to avoid getting
2584 undefined symbols at link time.
2585 @xref{Template Instantiation}, for more information.
2586
2587 @item -fno-implicit-inline-templates
2588 @opindex fno-implicit-inline-templates
2589 @opindex fimplicit-inline-templates
2590 Don't emit code for implicit instantiations of inline templates, either.
2591 The default is to handle inlines differently so that compiles with and
2592 without optimization need the same set of explicit instantiations.
2593
2594 @item -fno-implement-inlines
2595 @opindex fno-implement-inlines
2596 @opindex fimplement-inlines
2597 To save space, do not emit out-of-line copies of inline functions
2598 controlled by @code{#pragma implementation}. This causes linker
2599 errors if these functions are not inlined everywhere they are called.
2600
2601 @item -fms-extensions
2602 @opindex fms-extensions
2603 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2604 int and getting a pointer to member function via non-standard syntax.
2605
2606 @item -fnew-inheriting-ctors
2607 @opindex fnew-inheriting-ctors
2608 Enable the P0136 adjustment to the semantics of C++11 constructor
2609 inheritance. This is part of C++17 but also considered to be a Defect
2610 Report against C++11 and C++14. This flag is enabled by default
2611 unless @option{-fabi-version=10} or lower is specified.
2612
2613 @item -fnew-ttp-matching
2614 @opindex fnew-ttp-matching
2615 Enable the P0522 resolution to Core issue 150, template template
2616 parameters and default arguments: this allows a template with default
2617 template arguments as an argument for a template template parameter
2618 with fewer template parameters. This flag is enabled by default for
2619 @option{-std=c++17}.
2620
2621 @item -fno-nonansi-builtins
2622 @opindex fno-nonansi-builtins
2623 @opindex fnonansi-builtins
2624 Disable built-in declarations of functions that are not mandated by
2625 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2626 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2627
2628 @item -fnothrow-opt
2629 @opindex fnothrow-opt
2630 Treat a @code{throw()} exception specification as if it were a
2631 @code{noexcept} specification to reduce or eliminate the text size
2632 overhead relative to a function with no exception specification. If
2633 the function has local variables of types with non-trivial
2634 destructors, the exception specification actually makes the
2635 function smaller because the EH cleanups for those variables can be
2636 optimized away. The semantic effect is that an exception thrown out of
2637 a function with such an exception specification results in a call
2638 to @code{terminate} rather than @code{unexpected}.
2639
2640 @item -fno-operator-names
2641 @opindex fno-operator-names
2642 @opindex foperator-names
2643 Do not treat the operator name keywords @code{and}, @code{bitand},
2644 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2645 synonyms as keywords.
2646
2647 @item -fno-optional-diags
2648 @opindex fno-optional-diags
2649 @opindex foptional-diags
2650 Disable diagnostics that the standard says a compiler does not need to
2651 issue. Currently, the only such diagnostic issued by G++ is the one for
2652 a name having multiple meanings within a class.
2653
2654 @item -fpermissive
2655 @opindex fpermissive
2656 Downgrade some diagnostics about nonconformant code from errors to
2657 warnings. Thus, using @option{-fpermissive} allows some
2658 nonconforming code to compile.
2659
2660 @item -fno-pretty-templates
2661 @opindex fno-pretty-templates
2662 @opindex fpretty-templates
2663 When an error message refers to a specialization of a function
2664 template, the compiler normally prints the signature of the
2665 template followed by the template arguments and any typedefs or
2666 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2667 rather than @code{void f(int)}) so that it's clear which template is
2668 involved. When an error message refers to a specialization of a class
2669 template, the compiler omits any template arguments that match
2670 the default template arguments for that template. If either of these
2671 behaviors make it harder to understand the error message rather than
2672 easier, you can use @option{-fno-pretty-templates} to disable them.
2673
2674 @item -frepo
2675 @opindex frepo
2676 Enable automatic template instantiation at link time. This option also
2677 implies @option{-fno-implicit-templates}. @xref{Template
2678 Instantiation}, for more information.
2679
2680 @item -fno-rtti
2681 @opindex fno-rtti
2682 @opindex frtti
2683 Disable generation of information about every class with virtual
2684 functions for use by the C++ run-time type identification features
2685 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2686 of the language, you can save some space by using this flag. Note that
2687 exception handling uses the same information, but G++ generates it as
2688 needed. The @code{dynamic_cast} operator can still be used for casts that
2689 do not require run-time type information, i.e.@: casts to @code{void *} or to
2690 unambiguous base classes.
2691
2692 Mixing code compiled with @option{-frtti} with that compiled with
2693 @option{-fno-rtti} may not work. For example, programs may
2694 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2695 for a class compiled with @option{-frtti}.
2696
2697 @item -fsized-deallocation
2698 @opindex fsized-deallocation
2699 Enable the built-in global declarations
2700 @smallexample
2701 void operator delete (void *, std::size_t) noexcept;
2702 void operator delete[] (void *, std::size_t) noexcept;
2703 @end smallexample
2704 as introduced in C++14. This is useful for user-defined replacement
2705 deallocation functions that, for example, use the size of the object
2706 to make deallocation faster. Enabled by default under
2707 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2708 warns about places that might want to add a definition.
2709
2710 @item -fstrict-enums
2711 @opindex fstrict-enums
2712 Allow the compiler to optimize using the assumption that a value of
2713 enumerated type can only be one of the values of the enumeration (as
2714 defined in the C++ standard; basically, a value that can be
2715 represented in the minimum number of bits needed to represent all the
2716 enumerators). This assumption may not be valid if the program uses a
2717 cast to convert an arbitrary integer value to the enumerated type.
2718
2719 @item -fstrong-eval-order
2720 @opindex fstrong-eval-order
2721 Evaluate member access, array subscripting, and shift expressions in
2722 left-to-right order, and evaluate assignment in right-to-left order,
2723 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2724 @option{-fstrong-eval-order=some} enables just the ordering of member
2725 access and shift expressions, and is the default without
2726 @option{-std=c++17}.
2727
2728 @item -ftemplate-backtrace-limit=@var{n}
2729 @opindex ftemplate-backtrace-limit
2730 Set the maximum number of template instantiation notes for a single
2731 warning or error to @var{n}. The default value is 10.
2732
2733 @item -ftemplate-depth=@var{n}
2734 @opindex ftemplate-depth
2735 Set the maximum instantiation depth for template classes to @var{n}.
2736 A limit on the template instantiation depth is needed to detect
2737 endless recursions during template class instantiation. ANSI/ISO C++
2738 conforming programs must not rely on a maximum depth greater than 17
2739 (changed to 1024 in C++11). The default value is 900, as the compiler
2740 can run out of stack space before hitting 1024 in some situations.
2741
2742 @item -fno-threadsafe-statics
2743 @opindex fno-threadsafe-statics
2744 @opindex fthreadsafe-statics
2745 Do not emit the extra code to use the routines specified in the C++
2746 ABI for thread-safe initialization of local statics. You can use this
2747 option to reduce code size slightly in code that doesn't need to be
2748 thread-safe.
2749
2750 @item -fuse-cxa-atexit
2751 @opindex fuse-cxa-atexit
2752 Register destructors for objects with static storage duration with the
2753 @code{__cxa_atexit} function rather than the @code{atexit} function.
2754 This option is required for fully standards-compliant handling of static
2755 destructors, but only works if your C library supports
2756 @code{__cxa_atexit}.
2757
2758 @item -fno-use-cxa-get-exception-ptr
2759 @opindex fno-use-cxa-get-exception-ptr
2760 @opindex fuse-cxa-get-exception-ptr
2761 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2762 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2763 if the runtime routine is not available.
2764
2765 @item -fvisibility-inlines-hidden
2766 @opindex fvisibility-inlines-hidden
2767 This switch declares that the user does not attempt to compare
2768 pointers to inline functions or methods where the addresses of the two functions
2769 are taken in different shared objects.
2770
2771 The effect of this is that GCC may, effectively, mark inline methods with
2772 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2773 appear in the export table of a DSO and do not require a PLT indirection
2774 when used within the DSO@. Enabling this option can have a dramatic effect
2775 on load and link times of a DSO as it massively reduces the size of the
2776 dynamic export table when the library makes heavy use of templates.
2777
2778 The behavior of this switch is not quite the same as marking the
2779 methods as hidden directly, because it does not affect static variables
2780 local to the function or cause the compiler to deduce that
2781 the function is defined in only one shared object.
2782
2783 You may mark a method as having a visibility explicitly to negate the
2784 effect of the switch for that method. For example, if you do want to
2785 compare pointers to a particular inline method, you might mark it as
2786 having default visibility. Marking the enclosing class with explicit
2787 visibility has no effect.
2788
2789 Explicitly instantiated inline methods are unaffected by this option
2790 as their linkage might otherwise cross a shared library boundary.
2791 @xref{Template Instantiation}.
2792
2793 @item -fvisibility-ms-compat
2794 @opindex fvisibility-ms-compat
2795 This flag attempts to use visibility settings to make GCC's C++
2796 linkage model compatible with that of Microsoft Visual Studio.
2797
2798 The flag makes these changes to GCC's linkage model:
2799
2800 @enumerate
2801 @item
2802 It sets the default visibility to @code{hidden}, like
2803 @option{-fvisibility=hidden}.
2804
2805 @item
2806 Types, but not their members, are not hidden by default.
2807
2808 @item
2809 The One Definition Rule is relaxed for types without explicit
2810 visibility specifications that are defined in more than one
2811 shared object: those declarations are permitted if they are
2812 permitted when this option is not used.
2813 @end enumerate
2814
2815 In new code it is better to use @option{-fvisibility=hidden} and
2816 export those classes that are intended to be externally visible.
2817 Unfortunately it is possible for code to rely, perhaps accidentally,
2818 on the Visual Studio behavior.
2819
2820 Among the consequences of these changes are that static data members
2821 of the same type with the same name but defined in different shared
2822 objects are different, so changing one does not change the other;
2823 and that pointers to function members defined in different shared
2824 objects may not compare equal. When this flag is given, it is a
2825 violation of the ODR to define types with the same name differently.
2826
2827 @item -fno-weak
2828 @opindex fno-weak
2829 @opindex fweak
2830 Do not use weak symbol support, even if it is provided by the linker.
2831 By default, G++ uses weak symbols if they are available. This
2832 option exists only for testing, and should not be used by end-users;
2833 it results in inferior code and has no benefits. This option may
2834 be removed in a future release of G++.
2835
2836 @item -nostdinc++
2837 @opindex nostdinc++
2838 Do not search for header files in the standard directories specific to
2839 C++, but do still search the other standard directories. (This option
2840 is used when building the C++ library.)
2841 @end table
2842
2843 In addition, these optimization, warning, and code generation options
2844 have meanings only for C++ programs:
2845
2846 @table @gcctabopt
2847 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2848 @opindex Wabi
2849 @opindex Wno-abi
2850 Warn when G++ it generates code that is probably not compatible with
2851 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2852 ABI with each major release, normally @option{-Wabi} will warn only if
2853 there is a check added later in a release series for an ABI issue
2854 discovered since the initial release. @option{-Wabi} will warn about
2855 more things if an older ABI version is selected (with
2856 @option{-fabi-version=@var{n}}).
2857
2858 @option{-Wabi} can also be used with an explicit version number to
2859 warn about compatibility with a particular @option{-fabi-version}
2860 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2861 @option{-fabi-version=2}.
2862
2863 If an explicit version number is provided and
2864 @option{-fabi-compat-version} is not specified, the version number
2865 from this option is used for compatibility aliases. If no explicit
2866 version number is provided with this option, but
2867 @option{-fabi-compat-version} is specified, that version number is
2868 used for ABI warnings.
2869
2870 Although an effort has been made to warn about
2871 all such cases, there are probably some cases that are not warned about,
2872 even though G++ is generating incompatible code. There may also be
2873 cases where warnings are emitted even though the code that is generated
2874 is compatible.
2875
2876 You should rewrite your code to avoid these warnings if you are
2877 concerned about the fact that code generated by G++ may not be binary
2878 compatible with code generated by other compilers.
2879
2880 Known incompatibilities in @option{-fabi-version=2} (which was the
2881 default from GCC 3.4 to 4.9) include:
2882
2883 @itemize @bullet
2884
2885 @item
2886 A template with a non-type template parameter of reference type was
2887 mangled incorrectly:
2888 @smallexample
2889 extern int N;
2890 template <int &> struct S @{@};
2891 void n (S<N>) @{2@}
2892 @end smallexample
2893
2894 This was fixed in @option{-fabi-version=3}.
2895
2896 @item
2897 SIMD vector types declared using @code{__attribute ((vector_size))} were
2898 mangled in a non-standard way that does not allow for overloading of
2899 functions taking vectors of different sizes.
2900
2901 The mangling was changed in @option{-fabi-version=4}.
2902
2903 @item
2904 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2905 qualifiers, and @code{decltype} of a plain declaration was folded away.
2906
2907 These mangling issues were fixed in @option{-fabi-version=5}.
2908
2909 @item
2910 Scoped enumerators passed as arguments to a variadic function are
2911 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2912 On most targets this does not actually affect the parameter passing
2913 ABI, as there is no way to pass an argument smaller than @code{int}.
2914
2915 Also, the ABI changed the mangling of template argument packs,
2916 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2917 a class scope function used as a template argument.
2918
2919 These issues were corrected in @option{-fabi-version=6}.
2920
2921 @item
2922 Lambdas in default argument scope were mangled incorrectly, and the
2923 ABI changed the mangling of @code{nullptr_t}.
2924
2925 These issues were corrected in @option{-fabi-version=7}.
2926
2927 @item
2928 When mangling a function type with function-cv-qualifiers, the
2929 un-qualified function type was incorrectly treated as a substitution
2930 candidate.
2931
2932 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2933
2934 @item
2935 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2936 unaligned accesses. Note that this did not affect the ABI of a
2937 function with a @code{nullptr_t} parameter, as parameters have a
2938 minimum alignment.
2939
2940 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2941
2942 @item
2943 Target-specific attributes that affect the identity of a type, such as
2944 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2945 did not affect the mangled name, leading to name collisions when
2946 function pointers were used as template arguments.
2947
2948 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2949
2950 @end itemize
2951
2952 It also warns about psABI-related changes. The known psABI changes at this
2953 point include:
2954
2955 @itemize @bullet
2956
2957 @item
2958 For SysV/x86-64, unions with @code{long double} members are
2959 passed in memory as specified in psABI. For example:
2960
2961 @smallexample
2962 union U @{
2963 long double ld;
2964 int i;
2965 @};
2966 @end smallexample
2967
2968 @noindent
2969 @code{union U} is always passed in memory.
2970
2971 @end itemize
2972
2973 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2974 @opindex Wabi-tag
2975 @opindex Wabi-tag
2976 Warn when a type with an ABI tag is used in a context that does not
2977 have that ABI tag. See @ref{C++ Attributes} for more information
2978 about ABI tags.
2979
2980 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2981 @opindex Wctor-dtor-privacy
2982 @opindex Wno-ctor-dtor-privacy
2983 Warn when a class seems unusable because all the constructors or
2984 destructors in that class are private, and it has neither friends nor
2985 public static member functions. Also warn if there are no non-private
2986 methods, and there's at least one private member function that isn't
2987 a constructor or destructor.
2988
2989 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2990 @opindex Wdelete-non-virtual-dtor
2991 @opindex Wno-delete-non-virtual-dtor
2992 Warn when @code{delete} is used to destroy an instance of a class that
2993 has virtual functions and non-virtual destructor. It is unsafe to delete
2994 an instance of a derived class through a pointer to a base class if the
2995 base class does not have a virtual destructor. This warning is enabled
2996 by @option{-Wall}.
2997
2998 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
2999 @opindex Wdeprecated-copy
3000 @opindex Wno-deprecated-copy
3001 Warn that the implicit declaration of a copy constructor or copy
3002 assignment operator is deprecated if the class has a user-provided
3003 copy constructor, copy assignment operator, or destructor, in C++11
3004 and up. This warning is enabled by @option{-Wall}.
3005
3006 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3007 @opindex Winit-list-lifetime
3008 @opindex Wno-init-list-lifetime
3009 Do not warn about uses of @code{std::initializer_list} that are likely
3010 to result in dangling pointers. Since the underlying array for an
3011 @code{initializer_list} is handled like a normal C++ temporary object,
3012 it is easy to inadvertently keep a pointer to the array past the end
3013 of the array's lifetime. For example:
3014
3015 @itemize @bullet
3016 @item
3017 If a function returns a temporary @code{initializer_list}, or a local
3018 @code{initializer_list} variable, the array's lifetime ends at the end
3019 of the return statement, so the value returned has a dangling pointer.
3020
3021 @item
3022 If a new-expression creates an @code{initializer_list}, the array only
3023 lives until the end of the enclosing full-expression, so the
3024 @code{initializer_list} in the heap has a dangling pointer.
3025
3026 @item
3027 When an @code{initializer_list} variable is assigned from a
3028 brace-enclosed initializer list, the temporary array created for the
3029 right side of the assignment only lives until the end of the
3030 full-expression, so at the next statement the @code{initializer_list}
3031 variable has a dangling pointer.
3032
3033 @smallexample
3034 // li's initial underlying array lives as long as li
3035 std::initializer_list<int> li = @{ 1,2,3 @};
3036 // assignment changes li to point to a temporary array
3037 li = @{ 4, 5 @};
3038 // now the temporary is gone and li has a dangling pointer
3039 int i = li.begin()[0] // undefined behavior
3040 @end smallexample
3041
3042 @item
3043 When a list constructor stores the @code{begin} pointer from the
3044 @code{initializer_list} argument, this doesn't extend the lifetime of
3045 the array, so if a class variable is constructed from a temporary
3046 @code{initializer_list}, the pointer is left dangling by the end of
3047 the variable declaration statement.
3048
3049 @end itemize
3050
3051 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3052 @opindex Wliteral-suffix
3053 @opindex Wno-literal-suffix
3054 Warn when a string or character literal is followed by a ud-suffix which does
3055 not begin with an underscore. As a conforming extension, GCC treats such
3056 suffixes as separate preprocessing tokens in order to maintain backwards
3057 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3058 For example:
3059
3060 @smallexample
3061 #define __STDC_FORMAT_MACROS
3062 #include <inttypes.h>
3063 #include <stdio.h>
3064
3065 int main() @{
3066 int64_t i64 = 123;
3067 printf("My int64: %" PRId64"\n", i64);
3068 @}
3069 @end smallexample
3070
3071 In this case, @code{PRId64} is treated as a separate preprocessing token.
3072
3073 Additionally, warn when a user-defined literal operator is declared with
3074 a literal suffix identifier that doesn't begin with an underscore. Literal
3075 suffix identifiers that don't begin with an underscore are reserved for
3076 future standardization.
3077
3078 This warning is enabled by default.
3079
3080 @item -Wlto-type-mismatch
3081 @opindex Wlto-type-mismatch
3082 @opindex Wno-lto-type-mismatch
3083
3084 During the link-time optimization warn about type mismatches in
3085 global declarations from different compilation units.
3086 Requires @option{-flto} to be enabled. Enabled by default.
3087
3088 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3089 @opindex Wnarrowing
3090 @opindex Wno-narrowing
3091 For C++11 and later standards, narrowing conversions are diagnosed by default,
3092 as required by the standard. A narrowing conversion from a constant produces
3093 an error, and a narrowing conversion from a non-constant produces a warning,
3094 but @option{-Wno-narrowing} suppresses the diagnostic.
3095 Note that this does not affect the meaning of well-formed code;
3096 narrowing conversions are still considered ill-formed in SFINAE contexts.
3097
3098 With @option{-Wnarrowing} in C++98, warn when a narrowing
3099 conversion prohibited by C++11 occurs within
3100 @samp{@{ @}}, e.g.
3101
3102 @smallexample
3103 int i = @{ 2.2 @}; // error: narrowing from double to int
3104 @end smallexample
3105
3106 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3107
3108 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3109 @opindex Wnoexcept
3110 @opindex Wno-noexcept
3111 Warn when a noexcept-expression evaluates to false because of a call
3112 to a function that does not have a non-throwing exception
3113 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3114 the compiler to never throw an exception.
3115
3116 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3117 @opindex Wnoexcept-type
3118 @opindex Wno-noexcept-type
3119 Warn if the C++17 feature making @code{noexcept} part of a function
3120 type changes the mangled name of a symbol relative to C++14. Enabled
3121 by @option{-Wabi} and @option{-Wc++17-compat}.
3122
3123 As an example:
3124
3125 @smallexample
3126 template <class T> void f(T t) @{ t(); @};
3127 void g() noexcept;
3128 void h() @{ f(g); @}
3129 @end smallexample
3130
3131 @noindent
3132 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3133 C++17 it calls @code{f<void(*)()noexcept>}.
3134
3135 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3136 @opindex Wclass-memaccess
3137 @opindex Wno-class-memaccess
3138 Warn when the destination of a call to a raw memory function such as
3139 @code{memset} or @code{memcpy} is an object of class type, and when writing
3140 into such an object might bypass the class non-trivial or deleted constructor
3141 or copy assignment, violate const-correctness or encapsulation, or corrupt
3142 virtual table pointers. Modifying the representation of such objects may
3143 violate invariants maintained by member functions of the class. For example,
3144 the call to @code{memset} below is undefined because it modifies a non-trivial
3145 class object and is, therefore, diagnosed. The safe way to either initialize
3146 or clear the storage of objects of such types is by using the appropriate
3147 constructor or assignment operator, if one is available.
3148 @smallexample
3149 std::string str = "abc";
3150 memset (&str, 0, sizeof str);
3151 @end smallexample
3152 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3153 Explicitly casting the pointer to the class object to @code{void *} or
3154 to a type that can be safely accessed by the raw memory function suppresses
3155 the warning.
3156
3157 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3158 @opindex Wnon-virtual-dtor
3159 @opindex Wno-non-virtual-dtor
3160 Warn when a class has virtual functions and an accessible non-virtual
3161 destructor itself or in an accessible polymorphic base class, in which
3162 case it is possible but unsafe to delete an instance of a derived
3163 class through a pointer to the class itself or base class. This
3164 warning is automatically enabled if @option{-Weffc++} is specified.
3165
3166 @item -Wregister @r{(C++ and Objective-C++ only)}
3167 @opindex Wregister
3168 @opindex Wno-register
3169 Warn on uses of the @code{register} storage class specifier, except
3170 when it is part of the GNU @ref{Explicit Register Variables} extension.
3171 The use of the @code{register} keyword as storage class specifier has
3172 been deprecated in C++11 and removed in C++17.
3173 Enabled by default with @option{-std=c++17}.
3174
3175 @item -Wreorder @r{(C++ and Objective-C++ only)}
3176 @opindex Wreorder
3177 @opindex Wno-reorder
3178 @cindex reordering, warning
3179 @cindex warning for reordering of member initializers
3180 Warn when the order of member initializers given in the code does not
3181 match the order in which they must be executed. For instance:
3182
3183 @smallexample
3184 struct A @{
3185 int i;
3186 int j;
3187 A(): j (0), i (1) @{ @}
3188 @};
3189 @end smallexample
3190
3191 @noindent
3192 The compiler rearranges the member initializers for @code{i}
3193 and @code{j} to match the declaration order of the members, emitting
3194 a warning to that effect. This warning is enabled by @option{-Wall}.
3195
3196 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3197 @opindex Wpessimizing-move
3198 @opindex Wno-pessimizing-move
3199 This warning warns when a call to @code{std::move} prevents copy
3200 elision. A typical scenario when copy elision can occur is when returning in
3201 a function with a class return type, when the expression being returned is the
3202 name of a non-volatile automatic object, and is not a function parameter, and
3203 has the same type as the function return type.
3204
3205 @smallexample
3206 struct T @{
3207 @dots{}
3208 @};
3209 T fn()
3210 @{
3211 T t;
3212 @dots{}
3213 return std::move (t);
3214 @}
3215 @end smallexample
3216
3217 But in this example, the @code{std::move} call prevents copy elision.
3218
3219 This warning is enabled by @option{-Wall}.
3220
3221 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3222 @opindex Wredundant-move
3223 @opindex Wno-redundant-move
3224 This warning warns about redundant calls to @code{std::move}; that is, when
3225 a move operation would have been performed even without the @code{std::move}
3226 call. This happens because the compiler is forced to treat the object as if
3227 it were an rvalue in certain situations such as returning a local variable,
3228 where copy elision isn't applicable. Consider:
3229
3230 @smallexample
3231 struct T @{
3232 @dots{}
3233 @};
3234 T fn(T t)
3235 @{
3236 @dots{}
3237 return std::move (t);
3238 @}
3239 @end smallexample
3240
3241 Here, the @code{std::move} call is redundant. Because G++ implements Core
3242 Issue 1579, another example is:
3243
3244 @smallexample
3245 struct T @{ // convertible to U
3246 @dots{}
3247 @};
3248 struct U @{
3249 @dots{}
3250 @};
3251 U fn()
3252 @{
3253 T t;
3254 @dots{}
3255 return std::move (t);
3256 @}
3257 @end smallexample
3258 In this example, copy elision isn't applicable because the type of the
3259 expression being returned and the function return type differ, yet G++
3260 treats the return value as if it were designated by an rvalue.
3261
3262 This warning is enabled by @option{-Wextra}.
3263
3264 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3265 @opindex fext-numeric-literals
3266 @opindex fno-ext-numeric-literals
3267 Accept imaginary, fixed-point, or machine-defined
3268 literal number suffixes as GNU extensions.
3269 When this option is turned off these suffixes are treated
3270 as C++11 user-defined literal numeric suffixes.
3271 This is on by default for all pre-C++11 dialects and all GNU dialects:
3272 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3273 @option{-std=gnu++14}.
3274 This option is off by default
3275 for ISO C++11 onwards (@option{-std=c++11}, ...).
3276 @end table
3277
3278 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3279
3280 @table @gcctabopt
3281 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3282 @opindex Weffc++
3283 @opindex Wno-effc++
3284 Warn about violations of the following style guidelines from Scott Meyers'
3285 @cite{Effective C++} series of books:
3286
3287 @itemize @bullet
3288 @item
3289 Define a copy constructor and an assignment operator for classes
3290 with dynamically-allocated memory.
3291
3292 @item
3293 Prefer initialization to assignment in constructors.
3294
3295 @item
3296 Have @code{operator=} return a reference to @code{*this}.
3297
3298 @item
3299 Don't try to return a reference when you must return an object.
3300
3301 @item
3302 Distinguish between prefix and postfix forms of increment and
3303 decrement operators.
3304
3305 @item
3306 Never overload @code{&&}, @code{||}, or @code{,}.
3307
3308 @end itemize
3309
3310 This option also enables @option{-Wnon-virtual-dtor}, which is also
3311 one of the effective C++ recommendations. However, the check is
3312 extended to warn about the lack of virtual destructor in accessible
3313 non-polymorphic bases classes too.
3314
3315 When selecting this option, be aware that the standard library
3316 headers do not obey all of these guidelines; use @samp{grep -v}
3317 to filter out those warnings.
3318
3319 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3320 @opindex Wstrict-null-sentinel
3321 @opindex Wno-strict-null-sentinel
3322 Warn about the use of an uncasted @code{NULL} as sentinel. When
3323 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3324 to @code{__null}. Although it is a null pointer constant rather than a
3325 null pointer, it is guaranteed to be of the same size as a pointer.
3326 But this use is not portable across different compilers.
3327
3328 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3329 @opindex Wno-non-template-friend
3330 @opindex Wnon-template-friend
3331 Disable warnings when non-template friend functions are declared
3332 within a template. In very old versions of GCC that predate implementation
3333 of the ISO standard, declarations such as
3334 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3335 could be interpreted as a particular specialization of a template
3336 function; the warning exists to diagnose compatibility problems,
3337 and is enabled by default.
3338
3339 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3340 @opindex Wold-style-cast
3341 @opindex Wno-old-style-cast
3342 Warn if an old-style (C-style) cast to a non-void type is used within
3343 a C++ program. The new-style casts (@code{dynamic_cast},
3344 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3345 less vulnerable to unintended effects and much easier to search for.
3346
3347 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3348 @opindex Woverloaded-virtual
3349 @opindex Wno-overloaded-virtual
3350 @cindex overloaded virtual function, warning
3351 @cindex warning for overloaded virtual function
3352 Warn when a function declaration hides virtual functions from a
3353 base class. For example, in:
3354
3355 @smallexample
3356 struct A @{
3357 virtual void f();
3358 @};
3359
3360 struct B: public A @{
3361 void f(int);
3362 @};
3363 @end smallexample
3364
3365 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3366 like:
3367
3368 @smallexample
3369 B* b;
3370 b->f();
3371 @end smallexample
3372
3373 @noindent
3374 fails to compile.
3375
3376 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3377 @opindex Wno-pmf-conversions
3378 @opindex Wpmf-conversions
3379 Disable the diagnostic for converting a bound pointer to member function
3380 to a plain pointer.
3381
3382 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3383 @opindex Wsign-promo
3384 @opindex Wno-sign-promo
3385 Warn when overload resolution chooses a promotion from unsigned or
3386 enumerated type to a signed type, over a conversion to an unsigned type of
3387 the same size. Previous versions of G++ tried to preserve
3388 unsignedness, but the standard mandates the current behavior.
3389
3390 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3391 @opindex Wtemplates
3392 @opindex Wno-templates
3393 Warn when a primary template declaration is encountered. Some coding
3394 rules disallow templates, and this may be used to enforce that rule.
3395 The warning is inactive inside a system header file, such as the STL, so
3396 one can still use the STL. One may also instantiate or specialize
3397 templates.
3398
3399 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3400 @opindex Wmultiple-inheritance
3401 @opindex Wno-multiple-inheritance
3402 Warn when a class is defined with multiple direct base classes. Some
3403 coding rules disallow multiple inheritance, and this may be used to
3404 enforce that rule. The warning is inactive inside a system header file,
3405 such as the STL, so one can still use the STL. One may also define
3406 classes that indirectly use multiple inheritance.
3407
3408 @item -Wvirtual-inheritance
3409 @opindex Wvirtual-inheritance
3410 @opindex Wno-virtual-inheritance
3411 Warn when a class is defined with a virtual direct base class. Some
3412 coding rules disallow multiple inheritance, and this may be used to
3413 enforce that rule. The warning is inactive inside a system header file,
3414 such as the STL, so one can still use the STL. One may also define
3415 classes that indirectly use virtual inheritance.
3416
3417 @item -Wnamespaces
3418 @opindex Wnamespaces
3419 @opindex Wno-namespaces
3420 Warn when a namespace definition is opened. Some coding rules disallow
3421 namespaces, and this may be used to enforce that rule. The warning is
3422 inactive inside a system header file, such as the STL, so one can still
3423 use the STL. One may also use using directives and qualified names.
3424
3425 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3426 @opindex Wterminate
3427 @opindex Wno-terminate
3428 Disable the warning about a throw-expression that will immediately
3429 result in a call to @code{terminate}.
3430
3431 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3432 @opindex Wno-class-conversion
3433 @opindex Wclass-conversion
3434 Disable the warning about the case when a conversion function converts an
3435 object to the same type, to a base class of that type, or to void; such
3436 a conversion function will never be called.
3437 @end table
3438
3439 @node Objective-C and Objective-C++ Dialect Options
3440 @section Options Controlling Objective-C and Objective-C++ Dialects
3441
3442 @cindex compiler options, Objective-C and Objective-C++
3443 @cindex Objective-C and Objective-C++ options, command-line
3444 @cindex options, Objective-C and Objective-C++
3445 (NOTE: This manual does not describe the Objective-C and Objective-C++
3446 languages themselves. @xref{Standards,,Language Standards
3447 Supported by GCC}, for references.)
3448
3449 This section describes the command-line options that are only meaningful
3450 for Objective-C and Objective-C++ programs. You can also use most of
3451 the language-independent GNU compiler options.
3452 For example, you might compile a file @file{some_class.m} like this:
3453
3454 @smallexample
3455 gcc -g -fgnu-runtime -O -c some_class.m
3456 @end smallexample
3457
3458 @noindent
3459 In this example, @option{-fgnu-runtime} is an option meant only for
3460 Objective-C and Objective-C++ programs; you can use the other options with
3461 any language supported by GCC@.
3462
3463 Note that since Objective-C is an extension of the C language, Objective-C
3464 compilations may also use options specific to the C front-end (e.g.,
3465 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3466 C++-specific options (e.g., @option{-Wabi}).
3467
3468 Here is a list of options that are @emph{only} for compiling Objective-C
3469 and Objective-C++ programs:
3470
3471 @table @gcctabopt
3472 @item -fconstant-string-class=@var{class-name}
3473 @opindex fconstant-string-class
3474 Use @var{class-name} as the name of the class to instantiate for each
3475 literal string specified with the syntax @code{@@"@dots{}"}. The default
3476 class name is @code{NXConstantString} if the GNU runtime is being used, and
3477 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3478 @option{-fconstant-cfstrings} option, if also present, overrides the
3479 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3480 to be laid out as constant CoreFoundation strings.
3481
3482 @item -fgnu-runtime
3483 @opindex fgnu-runtime
3484 Generate object code compatible with the standard GNU Objective-C
3485 runtime. This is the default for most types of systems.
3486
3487 @item -fnext-runtime
3488 @opindex fnext-runtime
3489 Generate output compatible with the NeXT runtime. This is the default
3490 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3491 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3492 used.
3493
3494 @item -fno-nil-receivers
3495 @opindex fno-nil-receivers
3496 @opindex fnil-receivers
3497 Assume that all Objective-C message dispatches (@code{[receiver
3498 message:arg]}) in this translation unit ensure that the receiver is
3499 not @code{nil}. This allows for more efficient entry points in the
3500 runtime to be used. This option is only available in conjunction with
3501 the NeXT runtime and ABI version 0 or 1.
3502
3503 @item -fobjc-abi-version=@var{n}
3504 @opindex fobjc-abi-version
3505 Use version @var{n} of the Objective-C ABI for the selected runtime.
3506 This option is currently supported only for the NeXT runtime. In that
3507 case, Version 0 is the traditional (32-bit) ABI without support for
3508 properties and other Objective-C 2.0 additions. Version 1 is the
3509 traditional (32-bit) ABI with support for properties and other
3510 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3511 nothing is specified, the default is Version 0 on 32-bit target
3512 machines, and Version 2 on 64-bit target machines.
3513
3514 @item -fobjc-call-cxx-cdtors
3515 @opindex fobjc-call-cxx-cdtors
3516 For each Objective-C class, check if any of its instance variables is a
3517 C++ object with a non-trivial default constructor. If so, synthesize a
3518 special @code{- (id) .cxx_construct} instance method which runs
3519 non-trivial default constructors on any such instance variables, in order,
3520 and then return @code{self}. Similarly, check if any instance variable
3521 is a C++ object with a non-trivial destructor, and if so, synthesize a
3522 special @code{- (void) .cxx_destruct} method which runs
3523 all such default destructors, in reverse order.
3524
3525 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3526 methods thusly generated only operate on instance variables
3527 declared in the current Objective-C class, and not those inherited
3528 from superclasses. It is the responsibility of the Objective-C
3529 runtime to invoke all such methods in an object's inheritance
3530 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3531 by the runtime immediately after a new object instance is allocated;
3532 the @code{- (void) .cxx_destruct} methods are invoked immediately
3533 before the runtime deallocates an object instance.
3534
3535 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3536 support for invoking the @code{- (id) .cxx_construct} and
3537 @code{- (void) .cxx_destruct} methods.
3538
3539 @item -fobjc-direct-dispatch
3540 @opindex fobjc-direct-dispatch
3541 Allow fast jumps to the message dispatcher. On Darwin this is
3542 accomplished via the comm page.
3543
3544 @item -fobjc-exceptions
3545 @opindex fobjc-exceptions
3546 Enable syntactic support for structured exception handling in
3547 Objective-C, similar to what is offered by C++. This option
3548 is required to use the Objective-C keywords @code{@@try},
3549 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3550 @code{@@synchronized}. This option is available with both the GNU
3551 runtime and the NeXT runtime (but not available in conjunction with
3552 the NeXT runtime on Mac OS X 10.2 and earlier).
3553
3554 @item -fobjc-gc
3555 @opindex fobjc-gc
3556 Enable garbage collection (GC) in Objective-C and Objective-C++
3557 programs. This option is only available with the NeXT runtime; the
3558 GNU runtime has a different garbage collection implementation that
3559 does not require special compiler flags.
3560
3561 @item -fobjc-nilcheck
3562 @opindex fobjc-nilcheck
3563 For the NeXT runtime with version 2 of the ABI, check for a nil
3564 receiver in method invocations before doing the actual method call.
3565 This is the default and can be disabled using
3566 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3567 checked for nil in this way no matter what this flag is set to.
3568 Currently this flag does nothing when the GNU runtime, or an older
3569 version of the NeXT runtime ABI, is used.
3570
3571 @item -fobjc-std=objc1
3572 @opindex fobjc-std
3573 Conform to the language syntax of Objective-C 1.0, the language
3574 recognized by GCC 4.0. This only affects the Objective-C additions to
3575 the C/C++ language; it does not affect conformance to C/C++ standards,
3576 which is controlled by the separate C/C++ dialect option flags. When
3577 this option is used with the Objective-C or Objective-C++ compiler,
3578 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3579 This is useful if you need to make sure that your Objective-C code can
3580 be compiled with older versions of GCC@.
3581
3582 @item -freplace-objc-classes
3583 @opindex freplace-objc-classes
3584 Emit a special marker instructing @command{ld(1)} not to statically link in
3585 the resulting object file, and allow @command{dyld(1)} to load it in at
3586 run time instead. This is used in conjunction with the Fix-and-Continue
3587 debugging mode, where the object file in question may be recompiled and
3588 dynamically reloaded in the course of program execution, without the need
3589 to restart the program itself. Currently, Fix-and-Continue functionality
3590 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3591 and later.
3592
3593 @item -fzero-link
3594 @opindex fzero-link
3595 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3596 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3597 compile time) with static class references that get initialized at load time,
3598 which improves run-time performance. Specifying the @option{-fzero-link} flag
3599 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3600 to be retained. This is useful in Zero-Link debugging mode, since it allows
3601 for individual class implementations to be modified during program execution.
3602 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3603 regardless of command-line options.
3604
3605 @item -fno-local-ivars
3606 @opindex fno-local-ivars
3607 @opindex flocal-ivars
3608 By default instance variables in Objective-C can be accessed as if
3609 they were local variables from within the methods of the class they're
3610 declared in. This can lead to shadowing between instance variables
3611 and other variables declared either locally inside a class method or
3612 globally with the same name. Specifying the @option{-fno-local-ivars}
3613 flag disables this behavior thus avoiding variable shadowing issues.
3614
3615 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3616 @opindex fivar-visibility
3617 Set the default instance variable visibility to the specified option
3618 so that instance variables declared outside the scope of any access
3619 modifier directives default to the specified visibility.
3620
3621 @item -gen-decls
3622 @opindex gen-decls
3623 Dump interface declarations for all classes seen in the source file to a
3624 file named @file{@var{sourcename}.decl}.
3625
3626 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3627 @opindex Wassign-intercept
3628 @opindex Wno-assign-intercept
3629 Warn whenever an Objective-C assignment is being intercepted by the
3630 garbage collector.
3631
3632 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3633 @opindex Wno-protocol
3634 @opindex Wprotocol
3635 If a class is declared to implement a protocol, a warning is issued for
3636 every method in the protocol that is not implemented by the class. The
3637 default behavior is to issue a warning for every method not explicitly
3638 implemented in the class, even if a method implementation is inherited
3639 from the superclass. If you use the @option{-Wno-protocol} option, then
3640 methods inherited from the superclass are considered to be implemented,
3641 and no warning is issued for them.
3642
3643 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3644 @opindex Wselector
3645 @opindex Wno-selector
3646 Warn if multiple methods of different types for the same selector are
3647 found during compilation. The check is performed on the list of methods
3648 in the final stage of compilation. Additionally, a check is performed
3649 for each selector appearing in a @code{@@selector(@dots{})}
3650 expression, and a corresponding method for that selector has been found
3651 during compilation. Because these checks scan the method table only at
3652 the end of compilation, these warnings are not produced if the final
3653 stage of compilation is not reached, for example because an error is
3654 found during compilation, or because the @option{-fsyntax-only} option is
3655 being used.
3656
3657 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3658 @opindex Wstrict-selector-match
3659 @opindex Wno-strict-selector-match
3660 Warn if multiple methods with differing argument and/or return types are
3661 found for a given selector when attempting to send a message using this
3662 selector to a receiver of type @code{id} or @code{Class}. When this flag
3663 is off (which is the default behavior), the compiler omits such warnings
3664 if any differences found are confined to types that share the same size
3665 and alignment.
3666
3667 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3668 @opindex Wundeclared-selector
3669 @opindex Wno-undeclared-selector
3670 Warn if a @code{@@selector(@dots{})} expression referring to an
3671 undeclared selector is found. A selector is considered undeclared if no
3672 method with that name has been declared before the
3673 @code{@@selector(@dots{})} expression, either explicitly in an
3674 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3675 an @code{@@implementation} section. This option always performs its
3676 checks as soon as a @code{@@selector(@dots{})} expression is found,
3677 while @option{-Wselector} only performs its checks in the final stage of
3678 compilation. This also enforces the coding style convention
3679 that methods and selectors must be declared before being used.
3680
3681 @item -print-objc-runtime-info
3682 @opindex print-objc-runtime-info
3683 Generate C header describing the largest structure that is passed by
3684 value, if any.
3685
3686 @end table
3687
3688 @node Diagnostic Message Formatting Options
3689 @section Options to Control Diagnostic Messages Formatting
3690 @cindex options to control diagnostics formatting
3691 @cindex diagnostic messages
3692 @cindex message formatting
3693
3694 Traditionally, diagnostic messages have been formatted irrespective of
3695 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3696 options described below
3697 to control the formatting algorithm for diagnostic messages,
3698 e.g.@: how many characters per line, how often source location
3699 information should be reported. Note that some language front ends may not
3700 honor these options.
3701
3702 @table @gcctabopt
3703 @item -fmessage-length=@var{n}
3704 @opindex fmessage-length
3705 Try to format error messages so that they fit on lines of about
3706 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3707 done; each error message appears on a single line. This is the
3708 default for all front ends.
3709
3710 Note - this option also affects the display of the @samp{#error} and
3711 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3712 function/type/variable attribute. It does not however affect the
3713 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3714
3715 @item -fdiagnostics-show-location=once
3716 @opindex fdiagnostics-show-location
3717 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3718 reporter to emit source location information @emph{once}; that is, in
3719 case the message is too long to fit on a single physical line and has to
3720 be wrapped, the source location won't be emitted (as prefix) again,
3721 over and over, in subsequent continuation lines. This is the default
3722 behavior.
3723
3724 @item -fdiagnostics-show-location=every-line
3725 Only meaningful in line-wrapping mode. Instructs the diagnostic
3726 messages reporter to emit the same source location information (as
3727 prefix) for physical lines that result from the process of breaking
3728 a message which is too long to fit on a single line.
3729
3730 @item -fdiagnostics-color[=@var{WHEN}]
3731 @itemx -fno-diagnostics-color
3732 @opindex fdiagnostics-color
3733 @cindex highlight, color
3734 @vindex GCC_COLORS @r{environment variable}
3735 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3736 or @samp{auto}. The default depends on how the compiler has been configured,
3737 it can be any of the above @var{WHEN} options or also @samp{never}
3738 if @env{GCC_COLORS} environment variable isn't present in the environment,
3739 and @samp{auto} otherwise.
3740 @samp{auto} means to use color only when the standard error is a terminal.
3741 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3742 aliases for @option{-fdiagnostics-color=always} and
3743 @option{-fdiagnostics-color=never}, respectively.
3744
3745 The colors are defined by the environment variable @env{GCC_COLORS}.
3746 Its value is a colon-separated list of capabilities and Select Graphic
3747 Rendition (SGR) substrings. SGR commands are interpreted by the
3748 terminal or terminal emulator. (See the section in the documentation
3749 of your text terminal for permitted values and their meanings as
3750 character attributes.) These substring values are integers in decimal
3751 representation and can be concatenated with semicolons.
3752 Common values to concatenate include
3753 @samp{1} for bold,
3754 @samp{4} for underline,
3755 @samp{5} for blink,
3756 @samp{7} for inverse,
3757 @samp{39} for default foreground color,
3758 @samp{30} to @samp{37} for foreground colors,
3759 @samp{90} to @samp{97} for 16-color mode foreground colors,
3760 @samp{38;5;0} to @samp{38;5;255}
3761 for 88-color and 256-color modes foreground colors,
3762 @samp{49} for default background color,
3763 @samp{40} to @samp{47} for background colors,
3764 @samp{100} to @samp{107} for 16-color mode background colors,
3765 and @samp{48;5;0} to @samp{48;5;255}
3766 for 88-color and 256-color modes background colors.
3767
3768 The default @env{GCC_COLORS} is
3769 @smallexample
3770 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3771 quote=01:fixit-insert=32:fixit-delete=31:\
3772 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3773 type-diff=01;32
3774 @end smallexample
3775 @noindent
3776 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3777 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3778 @samp{01} is bold, and @samp{31} is red.
3779 Setting @env{GCC_COLORS} to the empty string disables colors.
3780 Supported capabilities are as follows.
3781
3782 @table @code
3783 @item error=
3784 @vindex error GCC_COLORS @r{capability}
3785 SGR substring for error: markers.
3786
3787 @item warning=
3788 @vindex warning GCC_COLORS @r{capability}
3789 SGR substring for warning: markers.
3790
3791 @item note=
3792 @vindex note GCC_COLORS @r{capability}
3793 SGR substring for note: markers.
3794
3795 @item range1=
3796 @vindex range1 GCC_COLORS @r{capability}
3797 SGR substring for first additional range.
3798
3799 @item range2=
3800 @vindex range2 GCC_COLORS @r{capability}
3801 SGR substring for second additional range.
3802
3803 @item locus=
3804 @vindex locus GCC_COLORS @r{capability}
3805 SGR substring for location information, @samp{file:line} or
3806 @samp{file:line:column} etc.
3807
3808 @item quote=
3809 @vindex quote GCC_COLORS @r{capability}
3810 SGR substring for information printed within quotes.
3811
3812 @item fixit-insert=
3813 @vindex fixit-insert GCC_COLORS @r{capability}
3814 SGR substring for fix-it hints suggesting text to
3815 be inserted or replaced.
3816
3817 @item fixit-delete=
3818 @vindex fixit-delete GCC_COLORS @r{capability}
3819 SGR substring for fix-it hints suggesting text to
3820 be deleted.
3821
3822 @item diff-filename=
3823 @vindex diff-filename GCC_COLORS @r{capability}
3824 SGR substring for filename headers within generated patches.
3825
3826 @item diff-hunk=
3827 @vindex diff-hunk GCC_COLORS @r{capability}
3828 SGR substring for the starts of hunks within generated patches.
3829
3830 @item diff-delete=
3831 @vindex diff-delete GCC_COLORS @r{capability}
3832 SGR substring for deleted lines within generated patches.
3833
3834 @item diff-insert=
3835 @vindex diff-insert GCC_COLORS @r{capability}
3836 SGR substring for inserted lines within generated patches.
3837
3838 @item type-diff=
3839 @vindex type-diff GCC_COLORS @r{capability}
3840 SGR substring for highlighting mismatching types within template
3841 arguments in the C++ frontend.
3842 @end table
3843
3844 @item -fno-diagnostics-show-option
3845 @opindex fno-diagnostics-show-option
3846 @opindex fdiagnostics-show-option
3847 By default, each diagnostic emitted includes text indicating the
3848 command-line option that directly controls the diagnostic (if such an
3849 option is known to the diagnostic machinery). Specifying the
3850 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3851
3852 @item -fno-diagnostics-show-caret
3853 @opindex fno-diagnostics-show-caret
3854 @opindex fdiagnostics-show-caret
3855 By default, each diagnostic emitted includes the original source line
3856 and a caret @samp{^} indicating the column. This option suppresses this
3857 information. The source line is truncated to @var{n} characters, if
3858 the @option{-fmessage-length=n} option is given. When the output is done
3859 to the terminal, the width is limited to the width given by the
3860 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3861
3862 @item -fno-diagnostics-show-labels
3863 @opindex fno-diagnostics-show-labels
3864 @opindex fdiagnostics-show-labels
3865 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3866 diagnostics can label ranges of source code with pertinent information, such
3867 as the types of expressions:
3868
3869 @smallexample
3870 printf ("foo %s bar", long_i + long_j);
3871 ~^ ~~~~~~~~~~~~~~~
3872 | |
3873 char * long int
3874 @end smallexample
3875
3876 This option suppresses the printing of these labels (in the example above,
3877 the vertical bars and the ``char *'' and ``long int'' text).
3878
3879 @item -fno-diagnostics-show-line-numbers
3880 @opindex fno-diagnostics-show-line-numbers
3881 @opindex fdiagnostics-show-line-numbers
3882 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3883 a left margin is printed, showing line numbers. This option suppresses this
3884 left margin.
3885
3886 @item -fdiagnostics-minimum-margin-width=@var{width}
3887 @opindex fdiagnostics-minimum-margin-width
3888 This option controls the minimum width of the left margin printed by
3889 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3890
3891 @item -fdiagnostics-parseable-fixits
3892 @opindex fdiagnostics-parseable-fixits
3893 Emit fix-it hints in a machine-parseable format, suitable for consumption
3894 by IDEs. For each fix-it, a line will be printed after the relevant
3895 diagnostic, starting with the string ``fix-it:''. For example:
3896
3897 @smallexample
3898 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3899 @end smallexample
3900
3901 The location is expressed as a half-open range, expressed as a count of
3902 bytes, starting at byte 1 for the initial column. In the above example,
3903 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3904 given string:
3905
3906 @smallexample
3907 00000000011111111112222222222
3908 12345678901234567890123456789
3909 gtk_widget_showall (dlg);
3910 ^^^^^^^^^^^^^^^^^^
3911 gtk_widget_show_all
3912 @end smallexample
3913
3914 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3915 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3916 (e.g. vertical tab as ``\013'').
3917
3918 An empty replacement string indicates that the given range is to be removed.
3919 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3920 be inserted at the given position.
3921
3922 @item -fdiagnostics-generate-patch
3923 @opindex fdiagnostics-generate-patch
3924 Print fix-it hints to stderr in unified diff format, after any diagnostics
3925 are printed. For example:
3926
3927 @smallexample
3928 --- test.c
3929 +++ test.c
3930 @@ -42,5 +42,5 @@
3931
3932 void show_cb(GtkDialog *dlg)
3933 @{
3934 - gtk_widget_showall(dlg);
3935 + gtk_widget_show_all(dlg);
3936 @}
3937
3938 @end smallexample
3939
3940 The diff may or may not be colorized, following the same rules
3941 as for diagnostics (see @option{-fdiagnostics-color}).
3942
3943 @item -fdiagnostics-show-template-tree
3944 @opindex fdiagnostics-show-template-tree
3945
3946 In the C++ frontend, when printing diagnostics showing mismatching
3947 template types, such as:
3948
3949 @smallexample
3950 could not convert 'std::map<int, std::vector<double> >()'
3951 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3952 @end smallexample
3953
3954 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3955 tree-like structure showing the common and differing parts of the types,
3956 such as:
3957
3958 @smallexample
3959 map<
3960 [...],
3961 vector<
3962 [double != float]>>
3963 @end smallexample
3964
3965 The parts that differ are highlighted with color (``double'' and
3966 ``float'' in this case).
3967
3968 @item -fno-elide-type
3969 @opindex fno-elide-type
3970 @opindex felide-type
3971 By default when the C++ frontend prints diagnostics showing mismatching
3972 template types, common parts of the types are printed as ``[...]'' to
3973 simplify the error message. For example:
3974
3975 @smallexample
3976 could not convert 'std::map<int, std::vector<double> >()'
3977 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3978 @end smallexample
3979
3980 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3981 This flag also affects the output of the
3982 @option{-fdiagnostics-show-template-tree} flag.
3983
3984 @item -fno-show-column
3985 @opindex fno-show-column
3986 @opindex fshow-column
3987 Do not print column numbers in diagnostics. This may be necessary if
3988 diagnostics are being scanned by a program that does not understand the
3989 column numbers, such as @command{dejagnu}.
3990
3991 @item -fdiagnostics-format=@var{FORMAT}
3992 @opindex fdiagnostics-format
3993 Select a different format for printing diagnostics.
3994 @var{FORMAT} is @samp{text} or @samp{json}.
3995 The default is @samp{text}.
3996
3997 The @samp{json} format consists of a top-level JSON array containing JSON
3998 objects representing the diagnostics.
3999
4000 The JSON is emitted as one line, without formatting; the examples below
4001 have been formatted for clarity.
4002
4003 Diagnostics can have child diagnostics. For example, this error and note:
4004
4005 @smallexample
4006 misleading-indentation.c:15:3: warning: this 'if' clause does not
4007 guard... [-Wmisleading-indentation]
4008 15 | if (flag)
4009 | ^~
4010 misleading-indentation.c:17:5: note: ...this statement, but the latter
4011 is misleadingly indented as if it were guarded by the 'if'
4012 17 | y = 2;
4013 | ^
4014 @end smallexample
4015
4016 @noindent
4017 might be printed in JSON form (after formatting) like this:
4018
4019 @smallexample
4020 [
4021 @{
4022 "kind": "warning",
4023 "locations": [
4024 @{
4025 "caret": @{
4026 "column": 3,
4027 "file": "misleading-indentation.c",
4028 "line": 15
4029 @},
4030 "finish": @{
4031 "column": 4,
4032 "file": "misleading-indentation.c",
4033 "line": 15
4034 @}
4035 @}
4036 ],
4037 "message": "this \u2018if\u2019 clause does not guard...",
4038 "option": "-Wmisleading-indentation",
4039 "children": [
4040 @{
4041 "kind": "note",
4042 "locations": [
4043 @{
4044 "caret": @{
4045 "column": 5,
4046 "file": "misleading-indentation.c",
4047 "line": 17
4048 @}
4049 @}
4050 ],
4051 "message": "...this statement, but the latter is @dots{}"
4052 @}
4053 ]
4054 @},
4055 @dots{}
4056 ]
4057 @end smallexample
4058
4059 @noindent
4060 where the @code{note} is a child of the @code{warning}.
4061
4062 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4063 an @code{option} key describing the command-line option controlling the
4064 warning.
4065
4066 A diagnostic can contain zero or more locations. Each location has up
4067 to three positions within it: a @code{caret} position and optional
4068 @code{start} and @code{finish} positions. A location can also have
4069 an optional @code{label} string. For example, this error:
4070
4071 @smallexample
4072 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4073 'struct s'@} and 'T' @{aka 'struct t'@})
4074 64 | return callee_4a () + callee_4b ();
4075 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4076 | | |
4077 | | T @{aka struct t@}
4078 | S @{aka struct s@}
4079 @end smallexample
4080
4081 @noindent
4082 has three locations. Its primary location is at the ``+'' token at column
4083 23. It has two secondary locations, describing the left and right-hand sides
4084 of the expression, which have labels. It might be printed in JSON form as:
4085
4086 @smallexample
4087 @{
4088 "children": [],
4089 "kind": "error",
4090 "locations": [
4091 @{
4092 "caret": @{
4093 "column": 23, "file": "bad-binary-ops.c", "line": 64
4094 @}
4095 @},
4096 @{
4097 "caret": @{
4098 "column": 10, "file": "bad-binary-ops.c", "line": 64
4099 @},
4100 "finish": @{
4101 "column": 21, "file": "bad-binary-ops.c", "line": 64
4102 @},
4103 "label": "S @{aka struct s@}"
4104 @},
4105 @{
4106 "caret": @{
4107 "column": 25, "file": "bad-binary-ops.c", "line": 64
4108 @},
4109 "finish": @{
4110 "column": 36, "file": "bad-binary-ops.c", "line": 64
4111 @},
4112 "label": "T @{aka struct t@}"
4113 @}
4114 ],
4115 "message": "invalid operands to binary + @dots{}"
4116 @}
4117 @end smallexample
4118
4119 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4120 consisting of half-open intervals, similar to the output of
4121 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4122 with a replacement fix-it hint:
4123
4124 @smallexample
4125 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4126 mean 'color'?
4127 8 | return ptr->colour;
4128 | ^~~~~~
4129 | color
4130 @end smallexample
4131
4132 @noindent
4133 might be printed in JSON form as:
4134
4135 @smallexample
4136 @{
4137 "children": [],
4138 "fixits": [
4139 @{
4140 "next": @{
4141 "column": 21,
4142 "file": "demo.c",
4143 "line": 8
4144 @},
4145 "start": @{
4146 "column": 15,
4147 "file": "demo.c",
4148 "line": 8
4149 @},
4150 "string": "color"
4151 @}
4152 ],
4153 "kind": "error",
4154 "locations": [
4155 @{
4156 "caret": @{
4157 "column": 15,
4158 "file": "demo.c",
4159 "line": 8
4160 @},
4161 "finish": @{
4162 "column": 20,
4163 "file": "demo.c",
4164 "line": 8
4165 @}
4166 @}
4167 ],
4168 "message": "\u2018struct s\u2019 has no member named @dots{}"
4169 @}
4170 @end smallexample
4171
4172 @noindent
4173 where the fix-it hint suggests replacing the text from @code{start} up
4174 to but not including @code{next} with @code{string}'s value. Deletions
4175 are expressed via an empty value for @code{string}, insertions by
4176 having @code{start} equal @code{next}.
4177
4178 @end table
4179
4180 @node Warning Options
4181 @section Options to Request or Suppress Warnings
4182 @cindex options to control warnings
4183 @cindex warning messages
4184 @cindex messages, warning
4185 @cindex suppressing warnings
4186
4187 Warnings are diagnostic messages that report constructions that
4188 are not inherently erroneous but that are risky or suggest there
4189 may have been an error.
4190
4191 The following language-independent options do not enable specific
4192 warnings but control the kinds of diagnostics produced by GCC@.
4193
4194 @table @gcctabopt
4195 @cindex syntax checking
4196 @item -fsyntax-only
4197 @opindex fsyntax-only
4198 Check the code for syntax errors, but don't do anything beyond that.
4199
4200 @item -fmax-errors=@var{n}
4201 @opindex fmax-errors
4202 Limits the maximum number of error messages to @var{n}, at which point
4203 GCC bails out rather than attempting to continue processing the source
4204 code. If @var{n} is 0 (the default), there is no limit on the number
4205 of error messages produced. If @option{-Wfatal-errors} is also
4206 specified, then @option{-Wfatal-errors} takes precedence over this
4207 option.
4208
4209 @item -w
4210 @opindex w
4211 Inhibit all warning messages.
4212
4213 @item -Werror
4214 @opindex Werror
4215 @opindex Wno-error
4216 Make all warnings into errors.
4217
4218 @item -Werror=
4219 @opindex Werror=
4220 @opindex Wno-error=
4221 Make the specified warning into an error. The specifier for a warning
4222 is appended; for example @option{-Werror=switch} turns the warnings
4223 controlled by @option{-Wswitch} into errors. This switch takes a
4224 negative form, to be used to negate @option{-Werror} for specific
4225 warnings; for example @option{-Wno-error=switch} makes
4226 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4227 is in effect.
4228
4229 The warning message for each controllable warning includes the
4230 option that controls the warning. That option can then be used with
4231 @option{-Werror=} and @option{-Wno-error=} as described above.
4232 (Printing of the option in the warning message can be disabled using the
4233 @option{-fno-diagnostics-show-option} flag.)
4234
4235 Note that specifying @option{-Werror=}@var{foo} automatically implies
4236 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4237 imply anything.
4238
4239 @item -Wfatal-errors
4240 @opindex Wfatal-errors
4241 @opindex Wno-fatal-errors
4242 This option causes the compiler to abort compilation on the first error
4243 occurred rather than trying to keep going and printing further error
4244 messages.
4245
4246 @end table
4247
4248 You can request many specific warnings with options beginning with
4249 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4250 implicit declarations. Each of these specific warning options also
4251 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4252 example, @option{-Wno-implicit}. This manual lists only one of the
4253 two forms, whichever is not the default. For further
4254 language-specific options also refer to @ref{C++ Dialect Options} and
4255 @ref{Objective-C and Objective-C++ Dialect Options}.
4256
4257 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4258 options, such as @option{-Wunused}, which may turn on further options,
4259 such as @option{-Wunused-value}. The combined effect of positive and
4260 negative forms is that more specific options have priority over less
4261 specific ones, independently of their position in the command-line. For
4262 options of the same specificity, the last one takes effect. Options
4263 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4264 as if they appeared at the end of the command-line.
4265
4266 When an unrecognized warning option is requested (e.g.,
4267 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4268 that the option is not recognized. However, if the @option{-Wno-} form
4269 is used, the behavior is slightly different: no diagnostic is
4270 produced for @option{-Wno-unknown-warning} unless other diagnostics
4271 are being produced. This allows the use of new @option{-Wno-} options
4272 with old compilers, but if something goes wrong, the compiler
4273 warns that an unrecognized option is present.
4274
4275 @table @gcctabopt
4276 @item -Wpedantic
4277 @itemx -pedantic
4278 @opindex pedantic
4279 @opindex Wpedantic
4280 @opindex Wno-pedantic
4281 Issue all the warnings demanded by strict ISO C and ISO C++;
4282 reject all programs that use forbidden extensions, and some other
4283 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4284 version of the ISO C standard specified by any @option{-std} option used.
4285
4286 Valid ISO C and ISO C++ programs should compile properly with or without
4287 this option (though a rare few require @option{-ansi} or a
4288 @option{-std} option specifying the required version of ISO C)@. However,
4289 without this option, certain GNU extensions and traditional C and C++
4290 features are supported as well. With this option, they are rejected.
4291
4292 @option{-Wpedantic} does not cause warning messages for use of the
4293 alternate keywords whose names begin and end with @samp{__}. Pedantic
4294 warnings are also disabled in the expression that follows
4295 @code{__extension__}. However, only system header files should use
4296 these escape routes; application programs should avoid them.
4297 @xref{Alternate Keywords}.
4298
4299 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4300 C conformance. They soon find that it does not do quite what they want:
4301 it finds some non-ISO practices, but not all---only those for which
4302 ISO C @emph{requires} a diagnostic, and some others for which
4303 diagnostics have been added.
4304
4305 A feature to report any failure to conform to ISO C might be useful in
4306 some instances, but would require considerable additional work and would
4307 be quite different from @option{-Wpedantic}. We don't have plans to
4308 support such a feature in the near future.
4309
4310 Where the standard specified with @option{-std} represents a GNU
4311 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4312 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4313 extended dialect is based. Warnings from @option{-Wpedantic} are given
4314 where they are required by the base standard. (It does not make sense
4315 for such warnings to be given only for features not in the specified GNU
4316 C dialect, since by definition the GNU dialects of C include all
4317 features the compiler supports with the given option, and there would be
4318 nothing to warn about.)
4319
4320 @item -pedantic-errors
4321 @opindex pedantic-errors
4322 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4323 requires a diagnostic, in some cases where there is undefined behavior
4324 at compile-time and in some other cases that do not prevent compilation
4325 of programs that are valid according to the standard. This is not
4326 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4327 by this option and not enabled by the latter and vice versa.
4328
4329 @item -Wall
4330 @opindex Wall
4331 @opindex Wno-all
4332 This enables all the warnings about constructions that some users
4333 consider questionable, and that are easy to avoid (or modify to
4334 prevent the warning), even in conjunction with macros. This also
4335 enables some language-specific warnings described in @ref{C++ Dialect
4336 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4337
4338 @option{-Wall} turns on the following warning flags:
4339
4340 @gccoptlist{-Waddress @gol
4341 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4342 -Wbool-compare @gol
4343 -Wbool-operation @gol
4344 -Wc++11-compat -Wc++14-compat @gol
4345 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4346 -Wchar-subscripts @gol
4347 -Wcomment @gol
4348 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4349 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4350 -Wformat @gol
4351 -Wint-in-bool-context @gol
4352 -Wimplicit @r{(C and Objective-C only)} @gol
4353 -Wimplicit-int @r{(C and Objective-C only)} @gol
4354 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4355 -Winit-self @r{(only for C++)} @gol
4356 -Wlogical-not-parentheses @gol
4357 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4358 -Wmaybe-uninitialized @gol
4359 -Wmemset-elt-size @gol
4360 -Wmemset-transposed-args @gol
4361 -Wmisleading-indentation @r{(only for C/C++)} @gol
4362 -Wmissing-attributes @gol
4363 -Wmissing-braces @r{(only for C/ObjC)} @gol
4364 -Wmultistatement-macros @gol
4365 -Wnarrowing @r{(only for C++)} @gol
4366 -Wnonnull @gol
4367 -Wnonnull-compare @gol
4368 -Wopenmp-simd @gol
4369 -Wparentheses @gol
4370 -Wpessimizing-move @r{(only for C++)} @gol
4371 -Wpointer-sign @gol
4372 -Wreorder @gol
4373 -Wrestrict @gol
4374 -Wreturn-type @gol
4375 -Wsequence-point @gol
4376 -Wsign-compare @r{(only in C++)} @gol
4377 -Wsizeof-pointer-div @gol
4378 -Wsizeof-pointer-memaccess @gol
4379 -Wstrict-aliasing @gol
4380 -Wstrict-overflow=1 @gol
4381 -Wswitch @gol
4382 -Wtautological-compare @gol
4383 -Wtrigraphs @gol
4384 -Wuninitialized @gol
4385 -Wunknown-pragmas @gol
4386 -Wunused-function @gol
4387 -Wunused-label @gol
4388 -Wunused-value @gol
4389 -Wunused-variable @gol
4390 -Wvolatile-register-var}
4391
4392 Note that some warning flags are not implied by @option{-Wall}. Some of
4393 them warn about constructions that users generally do not consider
4394 questionable, but which occasionally you might wish to check for;
4395 others warn about constructions that are necessary or hard to avoid in
4396 some cases, and there is no simple way to modify the code to suppress
4397 the warning. Some of them are enabled by @option{-Wextra} but many of
4398 them must be enabled individually.
4399
4400 @item -Wextra
4401 @opindex W
4402 @opindex Wextra
4403 @opindex Wno-extra
4404 This enables some extra warning flags that are not enabled by
4405 @option{-Wall}. (This option used to be called @option{-W}. The older
4406 name is still supported, but the newer name is more descriptive.)
4407
4408 @gccoptlist{-Wclobbered @gol
4409 -Wcast-function-type @gol
4410 -Wempty-body @gol
4411 -Wignored-qualifiers @gol
4412 -Wimplicit-fallthrough=3 @gol
4413 -Wmissing-field-initializers @gol
4414 -Wmissing-parameter-type @r{(C only)} @gol
4415 -Wold-style-declaration @r{(C only)} @gol
4416 -Woverride-init @gol
4417 -Wsign-compare @r{(C only)} @gol
4418 -Wredundant-move @r{(only for C++)} @gol
4419 -Wtype-limits @gol
4420 -Wuninitialized @gol
4421 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4422 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4423 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4424
4425
4426 The option @option{-Wextra} also prints warning messages for the
4427 following cases:
4428
4429 @itemize @bullet
4430
4431 @item
4432 A pointer is compared against integer zero with @code{<}, @code{<=},
4433 @code{>}, or @code{>=}.
4434
4435 @item
4436 (C++ only) An enumerator and a non-enumerator both appear in a
4437 conditional expression.
4438
4439 @item
4440 (C++ only) Ambiguous virtual bases.
4441
4442 @item
4443 (C++ only) Subscripting an array that has been declared @code{register}.
4444
4445 @item
4446 (C++ only) Taking the address of a variable that has been declared
4447 @code{register}.
4448
4449 @item
4450 (C++ only) A base class is not initialized in the copy constructor
4451 of a derived class.
4452
4453 @end itemize
4454
4455 @item -Wchar-subscripts
4456 @opindex Wchar-subscripts
4457 @opindex Wno-char-subscripts
4458 Warn if an array subscript has type @code{char}. This is a common cause
4459 of error, as programmers often forget that this type is signed on some
4460 machines.
4461 This warning is enabled by @option{-Wall}.
4462
4463 @item -Wchkp
4464 @opindex Wchkp
4465 @opindex Wno-chkp
4466 Warn about an invalid memory access that is found by Pointer Bounds Checker
4467 (@option{-fcheck-pointer-bounds}).
4468
4469 @item -Wno-coverage-mismatch
4470 @opindex Wno-coverage-mismatch
4471 @opindex Wcoverage-mismatch
4472 Warn if feedback profiles do not match when using the
4473 @option{-fprofile-use} option.
4474 If a source file is changed between compiling with @option{-fprofile-generate}
4475 and with @option{-fprofile-use}, the files with the profile feedback can fail
4476 to match the source file and GCC cannot use the profile feedback
4477 information. By default, this warning is enabled and is treated as an
4478 error. @option{-Wno-coverage-mismatch} can be used to disable the
4479 warning or @option{-Wno-error=coverage-mismatch} can be used to
4480 disable the error. Disabling the error for this warning can result in
4481 poorly optimized code and is useful only in the
4482 case of very minor changes such as bug fixes to an existing code-base.
4483 Completely disabling the warning is not recommended.
4484
4485 @item -Wno-cpp
4486 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4487
4488 Suppress warning messages emitted by @code{#warning} directives.
4489
4490 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4491 @opindex Wdouble-promotion
4492 @opindex Wno-double-promotion
4493 Give a warning when a value of type @code{float} is implicitly
4494 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4495 floating-point unit implement @code{float} in hardware, but emulate
4496 @code{double} in software. On such a machine, doing computations
4497 using @code{double} values is much more expensive because of the
4498 overhead required for software emulation.
4499
4500 It is easy to accidentally do computations with @code{double} because
4501 floating-point literals are implicitly of type @code{double}. For
4502 example, in:
4503 @smallexample
4504 @group
4505 float area(float radius)
4506 @{
4507 return 3.14159 * radius * radius;
4508 @}
4509 @end group
4510 @end smallexample
4511 the compiler performs the entire computation with @code{double}
4512 because the floating-point literal is a @code{double}.
4513
4514 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4515 @opindex Wduplicate-decl-specifier
4516 @opindex Wno-duplicate-decl-specifier
4517 Warn if a declaration has duplicate @code{const}, @code{volatile},
4518 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4519 @option{-Wall}.
4520
4521 @item -Wformat
4522 @itemx -Wformat=@var{n}
4523 @opindex Wformat
4524 @opindex Wno-format
4525 @opindex ffreestanding
4526 @opindex fno-builtin
4527 @opindex Wformat=
4528 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4529 the arguments supplied have types appropriate to the format string
4530 specified, and that the conversions specified in the format string make
4531 sense. This includes standard functions, and others specified by format
4532 attributes (@pxref{Function Attributes}), in the @code{printf},
4533 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4534 not in the C standard) families (or other target-specific families).
4535 Which functions are checked without format attributes having been
4536 specified depends on the standard version selected, and such checks of
4537 functions without the attribute specified are disabled by
4538 @option{-ffreestanding} or @option{-fno-builtin}.
4539
4540 The formats are checked against the format features supported by GNU
4541 libc version 2.2. These include all ISO C90 and C99 features, as well
4542 as features from the Single Unix Specification and some BSD and GNU
4543 extensions. Other library implementations may not support all these
4544 features; GCC does not support warning about features that go beyond a
4545 particular library's limitations. However, if @option{-Wpedantic} is used
4546 with @option{-Wformat}, warnings are given about format features not
4547 in the selected standard version (but not for @code{strfmon} formats,
4548 since those are not in any version of the C standard). @xref{C Dialect
4549 Options,,Options Controlling C Dialect}.
4550
4551 @table @gcctabopt
4552 @item -Wformat=1
4553 @itemx -Wformat
4554 @opindex Wformat
4555 @opindex Wformat=1
4556 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4557 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4558 @option{-Wformat} also checks for null format arguments for several
4559 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4560 aspects of this level of format checking can be disabled by the
4561 options: @option{-Wno-format-contains-nul},
4562 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4563 @option{-Wformat} is enabled by @option{-Wall}.
4564
4565 @item -Wno-format-contains-nul
4566 @opindex Wno-format-contains-nul
4567 @opindex Wformat-contains-nul
4568 If @option{-Wformat} is specified, do not warn about format strings that
4569 contain NUL bytes.
4570
4571 @item -Wno-format-extra-args
4572 @opindex Wno-format-extra-args
4573 @opindex Wformat-extra-args
4574 If @option{-Wformat} is specified, do not warn about excess arguments to a
4575 @code{printf} or @code{scanf} format function. The C standard specifies
4576 that such arguments are ignored.
4577
4578 Where the unused arguments lie between used arguments that are
4579 specified with @samp{$} operand number specifications, normally
4580 warnings are still given, since the implementation could not know what
4581 type to pass to @code{va_arg} to skip the unused arguments. However,
4582 in the case of @code{scanf} formats, this option suppresses the
4583 warning if the unused arguments are all pointers, since the Single
4584 Unix Specification says that such unused arguments are allowed.
4585
4586 @item -Wformat-overflow
4587 @itemx -Wformat-overflow=@var{level}
4588 @opindex Wformat-overflow
4589 @opindex Wno-format-overflow
4590 Warn about calls to formatted input/output functions such as @code{sprintf}
4591 and @code{vsprintf} that might overflow the destination buffer. When the
4592 exact number of bytes written by a format directive cannot be determined
4593 at compile-time it is estimated based on heuristics that depend on the
4594 @var{level} argument and on optimization. While enabling optimization
4595 will in most cases improve the accuracy of the warning, it may also
4596 result in false positives.
4597
4598 @table @gcctabopt
4599 @item -Wformat-overflow
4600 @itemx -Wformat-overflow=1
4601 @opindex Wformat-overflow
4602 @opindex Wno-format-overflow
4603 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4604 employs a conservative approach that warns only about calls that most
4605 likely overflow the buffer. At this level, numeric arguments to format
4606 directives with unknown values are assumed to have the value of one, and
4607 strings of unknown length to be empty. Numeric arguments that are known
4608 to be bounded to a subrange of their type, or string arguments whose output
4609 is bounded either by their directive's precision or by a finite set of
4610 string literals, are assumed to take on the value within the range that
4611 results in the most bytes on output. For example, the call to @code{sprintf}
4612 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4613 the terminating NUL character (@code{'\0'}) appended by the function
4614 to the destination buffer will be written past its end. Increasing
4615 the size of the buffer by a single byte is sufficient to avoid the
4616 warning, though it may not be sufficient to avoid the overflow.
4617
4618 @smallexample
4619 void f (int a, int b)
4620 @{
4621 char buf [13];
4622 sprintf (buf, "a = %i, b = %i\n", a, b);
4623 @}
4624 @end smallexample
4625
4626 @item -Wformat-overflow=2
4627 Level @var{2} warns also about calls that might overflow the destination
4628 buffer given an argument of sufficient length or magnitude. At level
4629 @var{2}, unknown numeric arguments are assumed to have the minimum
4630 representable value for signed types with a precision greater than 1, and
4631 the maximum representable value otherwise. Unknown string arguments whose
4632 length cannot be assumed to be bounded either by the directive's precision,
4633 or by a finite set of string literals they may evaluate to, or the character
4634 array they may point to, are assumed to be 1 character long.
4635
4636 At level @var{2}, the call in the example above is again diagnosed, but
4637 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4638 @code{%i} directive will write some of its digits beyond the end of
4639 the destination buffer. To make the call safe regardless of the values
4640 of the two variables, the size of the destination buffer must be increased
4641 to at least 34 bytes. GCC includes the minimum size of the buffer in
4642 an informational note following the warning.
4643
4644 An alternative to increasing the size of the destination buffer is to
4645 constrain the range of formatted values. The maximum length of string
4646 arguments can be bounded by specifying the precision in the format
4647 directive. When numeric arguments of format directives can be assumed
4648 to be bounded by less than the precision of their type, choosing
4649 an appropriate length modifier to the format specifier will reduce
4650 the required buffer size. For example, if @var{a} and @var{b} in the
4651 example above can be assumed to be within the precision of
4652 the @code{short int} type then using either the @code{%hi} format
4653 directive or casting the argument to @code{short} reduces the maximum
4654 required size of the buffer to 24 bytes.
4655
4656 @smallexample
4657 void f (int a, int b)
4658 @{
4659 char buf [23];
4660 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4661 @}
4662 @end smallexample
4663 @end table
4664
4665 @item -Wno-format-zero-length
4666 @opindex Wno-format-zero-length
4667 @opindex Wformat-zero-length
4668 If @option{-Wformat} is specified, do not warn about zero-length formats.
4669 The C standard specifies that zero-length formats are allowed.
4670
4671
4672 @item -Wformat=2
4673 @opindex Wformat=2
4674 Enable @option{-Wformat} plus additional format checks. Currently
4675 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4676 -Wformat-y2k}.
4677
4678 @item -Wformat-nonliteral
4679 @opindex Wformat-nonliteral
4680 @opindex Wno-format-nonliteral
4681 If @option{-Wformat} is specified, also warn if the format string is not a
4682 string literal and so cannot be checked, unless the format function
4683 takes its format arguments as a @code{va_list}.
4684
4685 @item -Wformat-security
4686 @opindex Wformat-security
4687 @opindex Wno-format-security
4688 If @option{-Wformat} is specified, also warn about uses of format
4689 functions that represent possible security problems. At present, this
4690 warns about calls to @code{printf} and @code{scanf} functions where the
4691 format string is not a string literal and there are no format arguments,
4692 as in @code{printf (foo);}. This may be a security hole if the format
4693 string came from untrusted input and contains @samp{%n}. (This is
4694 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4695 in future warnings may be added to @option{-Wformat-security} that are not
4696 included in @option{-Wformat-nonliteral}.)
4697
4698 @item -Wformat-signedness
4699 @opindex Wformat-signedness
4700 @opindex Wno-format-signedness
4701 If @option{-Wformat} is specified, also warn if the format string
4702 requires an unsigned argument and the argument is signed and vice versa.
4703
4704 @item -Wformat-truncation
4705 @itemx -Wformat-truncation=@var{level}
4706 @opindex Wformat-truncation
4707 @opindex Wno-format-truncation
4708 Warn about calls to formatted input/output functions such as @code{snprintf}
4709 and @code{vsnprintf} that might result in output truncation. When the exact
4710 number of bytes written by a format directive cannot be determined at
4711 compile-time it is estimated based on heuristics that depend on
4712 the @var{level} argument and on optimization. While enabling optimization
4713 will in most cases improve the accuracy of the warning, it may also result
4714 in false positives. Except as noted otherwise, the option uses the same
4715 logic @option{-Wformat-overflow}.
4716
4717 @table @gcctabopt
4718 @item -Wformat-truncation
4719 @itemx -Wformat-truncation=1
4720 @opindex Wformat-truncation
4721 @opindex Wno-format-truncation
4722 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4723 employs a conservative approach that warns only about calls to bounded
4724 functions whose return value is unused and that will most likely result
4725 in output truncation.
4726
4727 @item -Wformat-truncation=2
4728 Level @var{2} warns also about calls to bounded functions whose return
4729 value is used and that might result in truncation given an argument of
4730 sufficient length or magnitude.
4731 @end table
4732
4733 @item -Wformat-y2k
4734 @opindex Wformat-y2k
4735 @opindex Wno-format-y2k
4736 If @option{-Wformat} is specified, also warn about @code{strftime}
4737 formats that may yield only a two-digit year.
4738 @end table
4739
4740 @item -Wnonnull
4741 @opindex Wnonnull
4742 @opindex Wno-nonnull
4743 Warn about passing a null pointer for arguments marked as
4744 requiring a non-null value by the @code{nonnull} function attribute.
4745
4746 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4747 can be disabled with the @option{-Wno-nonnull} option.
4748
4749 @item -Wnonnull-compare
4750 @opindex Wnonnull-compare
4751 @opindex Wno-nonnull-compare
4752 Warn when comparing an argument marked with the @code{nonnull}
4753 function attribute against null inside the function.
4754
4755 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4756 can be disabled with the @option{-Wno-nonnull-compare} option.
4757
4758 @item -Wnull-dereference
4759 @opindex Wnull-dereference
4760 @opindex Wno-null-dereference
4761 Warn if the compiler detects paths that trigger erroneous or
4762 undefined behavior due to dereferencing a null pointer. This option
4763 is only active when @option{-fdelete-null-pointer-checks} is active,
4764 which is enabled by optimizations in most targets. The precision of
4765 the warnings depends on the optimization options used.
4766
4767 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4768 @opindex Winit-self
4769 @opindex Wno-init-self
4770 Warn about uninitialized variables that are initialized with themselves.
4771 Note this option can only be used with the @option{-Wuninitialized} option.
4772
4773 For example, GCC warns about @code{i} being uninitialized in the
4774 following snippet only when @option{-Winit-self} has been specified:
4775 @smallexample
4776 @group
4777 int f()
4778 @{
4779 int i = i;
4780 return i;
4781 @}
4782 @end group
4783 @end smallexample
4784
4785 This warning is enabled by @option{-Wall} in C++.
4786
4787 @item -Wimplicit-int @r{(C and Objective-C only)}
4788 @opindex Wimplicit-int
4789 @opindex Wno-implicit-int
4790 Warn when a declaration does not specify a type.
4791 This warning is enabled by @option{-Wall}.
4792
4793 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4794 @opindex Wimplicit-function-declaration
4795 @opindex Wno-implicit-function-declaration
4796 Give a warning whenever a function is used before being declared. In
4797 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4798 enabled by default and it is made into an error by
4799 @option{-pedantic-errors}. This warning is also enabled by
4800 @option{-Wall}.
4801
4802 @item -Wimplicit @r{(C and Objective-C only)}
4803 @opindex Wimplicit
4804 @opindex Wno-implicit
4805 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4806 This warning is enabled by @option{-Wall}.
4807
4808 @item -Wimplicit-fallthrough
4809 @opindex Wimplicit-fallthrough
4810 @opindex Wno-implicit-fallthrough
4811 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4812 and @option{-Wno-implicit-fallthrough} is the same as
4813 @option{-Wimplicit-fallthrough=0}.
4814
4815 @item -Wimplicit-fallthrough=@var{n}
4816 @opindex Wimplicit-fallthrough=
4817 Warn when a switch case falls through. For example:
4818
4819 @smallexample
4820 @group
4821 switch (cond)
4822 @{
4823 case 1:
4824 a = 1;
4825 break;
4826 case 2:
4827 a = 2;
4828 case 3:
4829 a = 3;
4830 break;
4831 @}
4832 @end group
4833 @end smallexample
4834
4835 This warning does not warn when the last statement of a case cannot
4836 fall through, e.g. when there is a return statement or a call to function
4837 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4838 also takes into account control flow statements, such as ifs, and only
4839 warns when appropriate. E.g.@:
4840
4841 @smallexample
4842 @group
4843 switch (cond)
4844 @{
4845 case 1:
4846 if (i > 3) @{
4847 bar (5);
4848 break;
4849 @} else if (i < 1) @{
4850 bar (0);
4851 @} else
4852 return;
4853 default:
4854 @dots{}
4855 @}
4856 @end group
4857 @end smallexample
4858
4859 Since there are occasions where a switch case fall through is desirable,
4860 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4861 to be used along with a null statement to suppress this warning that
4862 would normally occur:
4863
4864 @smallexample
4865 @group
4866 switch (cond)
4867 @{
4868 case 1:
4869 bar (0);
4870 __attribute__ ((fallthrough));
4871 default:
4872 @dots{}
4873 @}
4874 @end group
4875 @end smallexample
4876
4877 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4878 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4879 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4880 Instead of these attributes, it is also possible to add a fallthrough comment
4881 to silence the warning. The whole body of the C or C++ style comment should
4882 match the given regular expressions listed below. The option argument @var{n}
4883 specifies what kind of comments are accepted:
4884
4885 @itemize @bullet
4886
4887 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4888
4889 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4890 expression, any comment is used as fallthrough comment.
4891
4892 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4893 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4894
4895 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4896 following regular expressions:
4897
4898 @itemize @bullet
4899
4900 @item @code{-fallthrough}
4901
4902 @item @code{@@fallthrough@@}
4903
4904 @item @code{lint -fallthrough[ \t]*}
4905
4906 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4907
4908 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4909
4910 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4911
4912 @end itemize
4913
4914 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4915 following regular expressions:
4916
4917 @itemize @bullet
4918
4919 @item @code{-fallthrough}
4920
4921 @item @code{@@fallthrough@@}
4922
4923 @item @code{lint -fallthrough[ \t]*}
4924
4925 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4926
4927 @end itemize
4928
4929 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4930 fallthrough comments, only attributes disable the warning.
4931
4932 @end itemize
4933
4934 The comment needs to be followed after optional whitespace and other comments
4935 by @code{case} or @code{default} keywords or by a user label that precedes some
4936 @code{case} or @code{default} label.
4937
4938 @smallexample
4939 @group
4940 switch (cond)
4941 @{
4942 case 1:
4943 bar (0);
4944 /* FALLTHRU */
4945 default:
4946 @dots{}
4947 @}
4948 @end group
4949 @end smallexample
4950
4951 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4952
4953 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4954 @opindex Wif-not-aligned
4955 @opindex Wno-if-not-aligned
4956 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4957 should be issued. This is enabled by default.
4958 Use @option{-Wno-if-not-aligned} to disable it.
4959
4960 @item -Wignored-qualifiers @r{(C and C++ only)}
4961 @opindex Wignored-qualifiers
4962 @opindex Wno-ignored-qualifiers
4963 Warn if the return type of a function has a type qualifier
4964 such as @code{const}. For ISO C such a type qualifier has no effect,
4965 since the value returned by a function is not an lvalue.
4966 For C++, the warning is only emitted for scalar types or @code{void}.
4967 ISO C prohibits qualified @code{void} return types on function
4968 definitions, so such return types always receive a warning
4969 even without this option.
4970
4971 This warning is also enabled by @option{-Wextra}.
4972
4973 @item -Wignored-attributes @r{(C and C++ only)}
4974 @opindex Wignored-attributes
4975 @opindex Wno-ignored-attributes
4976 Warn when an attribute is ignored. This is different from the
4977 @option{-Wattributes} option in that it warns whenever the compiler decides
4978 to drop an attribute, not that the attribute is either unknown, used in a
4979 wrong place, etc. This warning is enabled by default.
4980
4981 @item -Wmain
4982 @opindex Wmain
4983 @opindex Wno-main
4984 Warn if the type of @code{main} is suspicious. @code{main} should be
4985 a function with external linkage, returning int, taking either zero
4986 arguments, two, or three arguments of appropriate types. This warning
4987 is enabled by default in C++ and is enabled by either @option{-Wall}
4988 or @option{-Wpedantic}.
4989
4990 @item -Wmisleading-indentation @r{(C and C++ only)}
4991 @opindex Wmisleading-indentation
4992 @opindex Wno-misleading-indentation
4993 Warn when the indentation of the code does not reflect the block structure.
4994 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4995 @code{for} clauses with a guarded statement that does not use braces,
4996 followed by an unguarded statement with the same indentation.
4997
4998 In the following example, the call to ``bar'' is misleadingly indented as
4999 if it were guarded by the ``if'' conditional.
5000
5001 @smallexample
5002 if (some_condition ())
5003 foo ();
5004 bar (); /* Gotcha: this is not guarded by the "if". */
5005 @end smallexample
5006
5007 In the case of mixed tabs and spaces, the warning uses the
5008 @option{-ftabstop=} option to determine if the statements line up
5009 (defaulting to 8).
5010
5011 The warning is not issued for code involving multiline preprocessor logic
5012 such as the following example.
5013
5014 @smallexample
5015 if (flagA)
5016 foo (0);
5017 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5018 if (flagB)
5019 #endif
5020 foo (1);
5021 @end smallexample
5022
5023 The warning is not issued after a @code{#line} directive, since this
5024 typically indicates autogenerated code, and no assumptions can be made
5025 about the layout of the file that the directive references.
5026
5027 This warning is enabled by @option{-Wall} in C and C++.
5028
5029 @item -Wno-missing-attributes
5030 @opindex Wmissing-attributes
5031 @opindex Wno-missing-attributes
5032 Warn when a declaration of a function is missing one or more attributes
5033 that a related function is declared with and whose absence may adversely
5034 affect the correctness or efficiency of generated code. For example,
5035 the warning is issued for declarations of aliases that use attributes
5036 to specify less restrictive requirements than those of their targets.
5037 This typically represents a potential optimization oportunity rather
5038 than a hidden bug. The @option{-Wattribute-alias} option controls warnings
5039 issued for mismatches between declarations of aliases and their targets
5040 that might be indicative of code generation bugs.
5041 Attributes considered include @code{alloc_align}, @code{alloc_size},
5042 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5043 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5044 @code{returns_nonnull}, and @code{returns_twice}.
5045
5046 In C++, the warning is issued when an explicit specialization of a primary
5047 template declared with attribute @code{alloc_align}, @code{alloc_size},
5048 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5049 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5050 @code{error}, and @code{warning} suppress the warning.
5051 (@pxref{Function Attributes}).
5052
5053 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5054
5055 For example, since the declaration of the primary function template
5056 below makes use of both attribute @code{malloc} and @code{alloc_size}
5057 the declaration of the explicit specialization of the template is
5058 diagnosed because it is missing one of the attributes.
5059
5060 @smallexample
5061 template <class T>
5062 T* __attribute__ ((malloc, alloc_size (1)))
5063 allocate (size_t);
5064
5065 template <>
5066 void* __attribute__ ((malloc)) // missing alloc_size
5067 allocate<void> (size_t);
5068 @end smallexample
5069
5070 @item -Wmissing-braces
5071 @opindex Wmissing-braces
5072 @opindex Wno-missing-braces
5073 Warn if an aggregate or union initializer is not fully bracketed. In
5074 the following example, the initializer for @code{a} is not fully
5075 bracketed, but that for @code{b} is fully bracketed. This warning is
5076 enabled by @option{-Wall} in C.
5077
5078 @smallexample
5079 int a[2][2] = @{ 0, 1, 2, 3 @};
5080 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5081 @end smallexample
5082
5083 This warning is enabled by @option{-Wall}.
5084
5085 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5086 @opindex Wmissing-include-dirs
5087 @opindex Wno-missing-include-dirs
5088 Warn if a user-supplied include directory does not exist.
5089
5090 @item -Wmissing-profile
5091 @opindex Wmissing-profile
5092 @opindex Wno-missing-profile
5093 Warn if feedback profiles are missing when using the
5094 @option{-fprofile-use} option.
5095 This option diagnoses those cases where a new function or a new file is added
5096 to the user code between compiling with @option{-fprofile-generate} and with
5097 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5098 profile feedback data files do not contain any profile feedback information for
5099 the newly added function or file respectively. Also, in the case when profile
5100 count data (.gcda) files are removed, GCC cannot use any profile feedback
5101 information. In all these cases, warnings are issued to inform the user that a
5102 profile generation step is due. @option{-Wno-missing-profile} can be used to
5103 disable the warning. Ignoring the warning can result in poorly optimized code.
5104 Completely disabling the warning is not recommended and should be done only
5105 when non-existent profile data is justified.
5106
5107 @item -Wmultistatement-macros
5108 @opindex Wmultistatement-macros
5109 @opindex Wno-multistatement-macros
5110 Warn about unsafe multiple statement macros that appear to be guarded
5111 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5112 @code{while}, in which only the first statement is actually guarded after
5113 the macro is expanded.
5114
5115 For example:
5116
5117 @smallexample
5118 #define DOIT x++; y++
5119 if (c)
5120 DOIT;
5121 @end smallexample
5122
5123 will increment @code{y} unconditionally, not just when @code{c} holds.
5124 The can usually be fixed by wrapping the macro in a do-while loop:
5125 @smallexample
5126 #define DOIT do @{ x++; y++; @} while (0)
5127 if (c)
5128 DOIT;
5129 @end smallexample
5130
5131 This warning is enabled by @option{-Wall} in C and C++.
5132
5133 @item -Wparentheses
5134 @opindex Wparentheses
5135 @opindex Wno-parentheses
5136 Warn if parentheses are omitted in certain contexts, such
5137 as when there is an assignment in a context where a truth value
5138 is expected, or when operators are nested whose precedence people
5139 often get confused about.
5140
5141 Also warn if a comparison like @code{x<=y<=z} appears; this is
5142 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5143 interpretation from that of ordinary mathematical notation.
5144
5145 Also warn for dangerous uses of the GNU extension to
5146 @code{?:} with omitted middle operand. When the condition
5147 in the @code{?}: operator is a boolean expression, the omitted value is
5148 always 1. Often programmers expect it to be a value computed
5149 inside the conditional expression instead.
5150
5151 For C++ this also warns for some cases of unnecessary parentheses in
5152 declarations, which can indicate an attempt at a function call instead
5153 of a declaration:
5154 @smallexample
5155 @{
5156 // Declares a local variable called mymutex.
5157 std::unique_lock<std::mutex> (mymutex);
5158 // User meant std::unique_lock<std::mutex> lock (mymutex);
5159 @}
5160 @end smallexample
5161
5162 This warning is enabled by @option{-Wall}.
5163
5164 @item -Wsequence-point
5165 @opindex Wsequence-point
5166 @opindex Wno-sequence-point
5167 Warn about code that may have undefined semantics because of violations
5168 of sequence point rules in the C and C++ standards.
5169
5170 The C and C++ standards define the order in which expressions in a C/C++
5171 program are evaluated in terms of @dfn{sequence points}, which represent
5172 a partial ordering between the execution of parts of the program: those
5173 executed before the sequence point, and those executed after it. These
5174 occur after the evaluation of a full expression (one which is not part
5175 of a larger expression), after the evaluation of the first operand of a
5176 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5177 function is called (but after the evaluation of its arguments and the
5178 expression denoting the called function), and in certain other places.
5179 Other than as expressed by the sequence point rules, the order of
5180 evaluation of subexpressions of an expression is not specified. All
5181 these rules describe only a partial order rather than a total order,
5182 since, for example, if two functions are called within one expression
5183 with no sequence point between them, the order in which the functions
5184 are called is not specified. However, the standards committee have
5185 ruled that function calls do not overlap.
5186
5187 It is not specified when between sequence points modifications to the
5188 values of objects take effect. Programs whose behavior depends on this
5189 have undefined behavior; the C and C++ standards specify that ``Between
5190 the previous and next sequence point an object shall have its stored
5191 value modified at most once by the evaluation of an expression.
5192 Furthermore, the prior value shall be read only to determine the value
5193 to be stored.''. If a program breaks these rules, the results on any
5194 particular implementation are entirely unpredictable.
5195
5196 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5197 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5198 diagnosed by this option, and it may give an occasional false positive
5199 result, but in general it has been found fairly effective at detecting
5200 this sort of problem in programs.
5201
5202 The C++17 standard will define the order of evaluation of operands in
5203 more cases: in particular it requires that the right-hand side of an
5204 assignment be evaluated before the left-hand side, so the above
5205 examples are no longer undefined. But this warning will still warn
5206 about them, to help people avoid writing code that is undefined in C
5207 and earlier revisions of C++.
5208
5209 The standard is worded confusingly, therefore there is some debate
5210 over the precise meaning of the sequence point rules in subtle cases.
5211 Links to discussions of the problem, including proposed formal
5212 definitions, may be found on the GCC readings page, at
5213 @uref{http://gcc.gnu.org/@/readings.html}.
5214
5215 This warning is enabled by @option{-Wall} for C and C++.
5216
5217 @item -Wno-return-local-addr
5218 @opindex Wno-return-local-addr
5219 @opindex Wreturn-local-addr
5220 Do not warn about returning a pointer (or in C++, a reference) to a
5221 variable that goes out of scope after the function returns.
5222
5223 @item -Wreturn-type
5224 @opindex Wreturn-type
5225 @opindex Wno-return-type
5226 Warn whenever a function is defined with a return type that defaults
5227 to @code{int}. Also warn about any @code{return} statement with no
5228 return value in a function whose return type is not @code{void}
5229 (falling off the end of the function body is considered returning
5230 without a value).
5231
5232 For C only, warn about a @code{return} statement with an expression in a
5233 function whose return type is @code{void}, unless the expression type is
5234 also @code{void}. As a GNU extension, the latter case is accepted
5235 without a warning unless @option{-Wpedantic} is used.
5236
5237 For C++, a function without return type always produces a diagnostic
5238 message, even when @option{-Wno-return-type} is specified. The only
5239 exceptions are @code{main} and functions defined in system headers.
5240
5241 This warning is enabled by default for C++ and is enabled by @option{-Wall}.
5242
5243 @item -Wshift-count-negative
5244 @opindex Wshift-count-negative
5245 @opindex Wno-shift-count-negative
5246 Warn if shift count is negative. This warning is enabled by default.
5247
5248 @item -Wshift-count-overflow
5249 @opindex Wshift-count-overflow
5250 @opindex Wno-shift-count-overflow
5251 Warn if shift count >= width of type. This warning is enabled by default.
5252
5253 @item -Wshift-negative-value
5254 @opindex Wshift-negative-value
5255 @opindex Wno-shift-negative-value
5256 Warn if left shifting a negative value. This warning is enabled by
5257 @option{-Wextra} in C99 and C++11 modes (and newer).
5258
5259 @item -Wshift-overflow
5260 @itemx -Wshift-overflow=@var{n}
5261 @opindex Wshift-overflow
5262 @opindex Wno-shift-overflow
5263 Warn about left shift overflows. This warning is enabled by
5264 default in C99 and C++11 modes (and newer).
5265
5266 @table @gcctabopt
5267 @item -Wshift-overflow=1
5268 This is the warning level of @option{-Wshift-overflow} and is enabled
5269 by default in C99 and C++11 modes (and newer). This warning level does
5270 not warn about left-shifting 1 into the sign bit. (However, in C, such
5271 an overflow is still rejected in contexts where an integer constant expression
5272 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5273 shifts always wrap.
5274
5275 @item -Wshift-overflow=2
5276 This warning level also warns about left-shifting 1 into the sign bit,
5277 unless C++14 mode (or newer) is active.
5278 @end table
5279
5280 @item -Wswitch
5281 @opindex Wswitch
5282 @opindex Wno-switch
5283 Warn whenever a @code{switch} statement has an index of enumerated type
5284 and lacks a @code{case} for one or more of the named codes of that
5285 enumeration. (The presence of a @code{default} label prevents this
5286 warning.) @code{case} labels outside the enumeration range also
5287 provoke warnings when this option is used (even if there is a
5288 @code{default} label).
5289 This warning is enabled by @option{-Wall}.
5290
5291 @item -Wswitch-default
5292 @opindex Wswitch-default
5293 @opindex Wno-switch-default
5294 Warn whenever a @code{switch} statement does not have a @code{default}
5295 case.
5296
5297 @item -Wswitch-enum
5298 @opindex Wswitch-enum
5299 @opindex Wno-switch-enum
5300 Warn whenever a @code{switch} statement has an index of enumerated type
5301 and lacks a @code{case} for one or more of the named codes of that
5302 enumeration. @code{case} labels outside the enumeration range also
5303 provoke warnings when this option is used. The only difference
5304 between @option{-Wswitch} and this option is that this option gives a
5305 warning about an omitted enumeration code even if there is a
5306 @code{default} label.
5307
5308 @item -Wswitch-bool
5309 @opindex Wswitch-bool
5310 @opindex Wno-switch-bool
5311 Warn whenever a @code{switch} statement has an index of boolean type
5312 and the case values are outside the range of a boolean type.
5313 It is possible to suppress this warning by casting the controlling
5314 expression to a type other than @code{bool}. For example:
5315 @smallexample
5316 @group
5317 switch ((int) (a == 4))
5318 @{
5319 @dots{}
5320 @}
5321 @end group
5322 @end smallexample
5323 This warning is enabled by default for C and C++ programs.
5324
5325 @item -Wswitch-unreachable
5326 @opindex Wswitch-unreachable
5327 @opindex Wno-switch-unreachable
5328 Warn whenever a @code{switch} statement contains statements between the
5329 controlling expression and the first case label, which will never be
5330 executed. For example:
5331 @smallexample
5332 @group
5333 switch (cond)
5334 @{
5335 i = 15;
5336 @dots{}
5337 case 5:
5338 @dots{}
5339 @}
5340 @end group
5341 @end smallexample
5342 @option{-Wswitch-unreachable} does not warn if the statement between the
5343 controlling expression and the first case label is just a declaration:
5344 @smallexample
5345 @group
5346 switch (cond)
5347 @{
5348 int i;
5349 @dots{}
5350 case 5:
5351 i = 5;
5352 @dots{}
5353 @}
5354 @end group
5355 @end smallexample
5356 This warning is enabled by default for C and C++ programs.
5357
5358 @item -Wsync-nand @r{(C and C++ only)}
5359 @opindex Wsync-nand
5360 @opindex Wno-sync-nand
5361 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5362 built-in functions are used. These functions changed semantics in GCC 4.4.
5363
5364 @item -Wunused-but-set-parameter
5365 @opindex Wunused-but-set-parameter
5366 @opindex Wno-unused-but-set-parameter
5367 Warn whenever a function parameter is assigned to, but otherwise unused
5368 (aside from its declaration).
5369
5370 To suppress this warning use the @code{unused} attribute
5371 (@pxref{Variable Attributes}).
5372
5373 This warning is also enabled by @option{-Wunused} together with
5374 @option{-Wextra}.
5375
5376 @item -Wunused-but-set-variable
5377 @opindex Wunused-but-set-variable
5378 @opindex Wno-unused-but-set-variable
5379 Warn whenever a local variable is assigned to, but otherwise unused
5380 (aside from its declaration).
5381 This warning is enabled by @option{-Wall}.
5382
5383 To suppress this warning use the @code{unused} attribute
5384 (@pxref{Variable Attributes}).
5385
5386 This warning is also enabled by @option{-Wunused}, which is enabled
5387 by @option{-Wall}.
5388
5389 @item -Wunused-function
5390 @opindex Wunused-function
5391 @opindex Wno-unused-function
5392 Warn whenever a static function is declared but not defined or a
5393 non-inline static function is unused.
5394 This warning is enabled by @option{-Wall}.
5395
5396 @item -Wunused-label
5397 @opindex Wunused-label
5398 @opindex Wno-unused-label
5399 Warn whenever a label is declared but not used.
5400 This warning is enabled by @option{-Wall}.
5401
5402 To suppress this warning use the @code{unused} attribute
5403 (@pxref{Variable Attributes}).
5404
5405 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5406 @opindex Wunused-local-typedefs
5407 @opindex Wno-unused-local-typedefs
5408 Warn when a typedef locally defined in a function is not used.
5409 This warning is enabled by @option{-Wall}.
5410
5411 @item -Wunused-parameter
5412 @opindex Wunused-parameter
5413 @opindex Wno-unused-parameter
5414 Warn whenever a function parameter is unused aside from its declaration.
5415
5416 To suppress this warning use the @code{unused} attribute
5417 (@pxref{Variable Attributes}).
5418
5419 @item -Wno-unused-result
5420 @opindex Wunused-result
5421 @opindex Wno-unused-result
5422 Do not warn if a caller of a function marked with attribute
5423 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5424 its return value. The default is @option{-Wunused-result}.
5425
5426 @item -Wunused-variable
5427 @opindex Wunused-variable
5428 @opindex Wno-unused-variable
5429 Warn whenever a local or static variable is unused aside from its
5430 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5431 but not for C++. This warning is enabled by @option{-Wall}.
5432
5433 To suppress this warning use the @code{unused} attribute
5434 (@pxref{Variable Attributes}).
5435
5436 @item -Wunused-const-variable
5437 @itemx -Wunused-const-variable=@var{n}
5438 @opindex Wunused-const-variable
5439 @opindex Wno-unused-const-variable
5440 Warn whenever a constant static variable is unused aside from its declaration.
5441 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5442 for C, but not for C++. In C this declares variable storage, but in C++ this
5443 is not an error since const variables take the place of @code{#define}s.
5444
5445 To suppress this warning use the @code{unused} attribute
5446 (@pxref{Variable Attributes}).
5447
5448 @table @gcctabopt
5449 @item -Wunused-const-variable=1
5450 This is the warning level that is enabled by @option{-Wunused-variable} for
5451 C. It warns only about unused static const variables defined in the main
5452 compilation unit, but not about static const variables declared in any
5453 header included.
5454
5455 @item -Wunused-const-variable=2
5456 This warning level also warns for unused constant static variables in
5457 headers (excluding system headers). This is the warning level of
5458 @option{-Wunused-const-variable} and must be explicitly requested since
5459 in C++ this isn't an error and in C it might be harder to clean up all
5460 headers included.
5461 @end table
5462
5463 @item -Wunused-value
5464 @opindex Wunused-value
5465 @opindex Wno-unused-value
5466 Warn whenever a statement computes a result that is explicitly not
5467 used. To suppress this warning cast the unused expression to
5468 @code{void}. This includes an expression-statement or the left-hand
5469 side of a comma expression that contains no side effects. For example,
5470 an expression such as @code{x[i,j]} causes a warning, while
5471 @code{x[(void)i,j]} does not.
5472
5473 This warning is enabled by @option{-Wall}.
5474
5475 @item -Wunused
5476 @opindex Wunused
5477 @opindex Wno-unused
5478 All the above @option{-Wunused} options combined.
5479
5480 In order to get a warning about an unused function parameter, you must
5481 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5482 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5483
5484 @item -Wuninitialized
5485 @opindex Wuninitialized
5486 @opindex Wno-uninitialized
5487 Warn if an automatic variable is used without first being initialized
5488 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5489 warn if a non-static reference or non-static @code{const} member
5490 appears in a class without constructors.
5491
5492 If you want to warn about code that uses the uninitialized value of the
5493 variable in its own initializer, use the @option{-Winit-self} option.
5494
5495 These warnings occur for individual uninitialized or clobbered
5496 elements of structure, union or array variables as well as for
5497 variables that are uninitialized or clobbered as a whole. They do
5498 not occur for variables or elements declared @code{volatile}. Because
5499 these warnings depend on optimization, the exact variables or elements
5500 for which there are warnings depends on the precise optimization
5501 options and version of GCC used.
5502
5503 Note that there may be no warning about a variable that is used only
5504 to compute a value that itself is never used, because such
5505 computations may be deleted by data flow analysis before the warnings
5506 are printed.
5507
5508 @item -Winvalid-memory-model
5509 @opindex Winvalid-memory-model
5510 @opindex Wno-invalid-memory-model
5511 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5512 and the C11 atomic generic functions with a memory consistency argument
5513 that is either invalid for the operation or outside the range of values
5514 of the @code{memory_order} enumeration. For example, since the
5515 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5516 defined for the relaxed, release, and sequentially consistent memory
5517 orders the following code is diagnosed:
5518
5519 @smallexample
5520 void store (int *i)
5521 @{
5522 __atomic_store_n (i, 0, memory_order_consume);
5523 @}
5524 @end smallexample
5525
5526 @option{-Winvalid-memory-model} is enabled by default.
5527
5528 @item -Wmaybe-uninitialized
5529 @opindex Wmaybe-uninitialized
5530 @opindex Wno-maybe-uninitialized
5531 For an automatic (i.e.@: local) variable, if there exists a path from the
5532 function entry to a use of the variable that is initialized, but there exist
5533 some other paths for which the variable is not initialized, the compiler
5534 emits a warning if it cannot prove the uninitialized paths are not
5535 executed at run time.
5536
5537 These warnings are only possible in optimizing compilation, because otherwise
5538 GCC does not keep track of the state of variables.
5539
5540 These warnings are made optional because GCC may not be able to determine when
5541 the code is correct in spite of appearing to have an error. Here is one
5542 example of how this can happen:
5543
5544 @smallexample
5545 @group
5546 @{
5547 int x;
5548 switch (y)
5549 @{
5550 case 1: x = 1;
5551 break;
5552 case 2: x = 4;
5553 break;
5554 case 3: x = 5;
5555 @}
5556 foo (x);
5557 @}
5558 @end group
5559 @end smallexample
5560
5561 @noindent
5562 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5563 always initialized, but GCC doesn't know this. To suppress the
5564 warning, you need to provide a default case with assert(0) or
5565 similar code.
5566
5567 @cindex @code{longjmp} warnings
5568 This option also warns when a non-volatile automatic variable might be
5569 changed by a call to @code{longjmp}.
5570 The compiler sees only the calls to @code{setjmp}. It cannot know
5571 where @code{longjmp} will be called; in fact, a signal handler could
5572 call it at any point in the code. As a result, you may get a warning
5573 even when there is in fact no problem because @code{longjmp} cannot
5574 in fact be called at the place that would cause a problem.
5575
5576 Some spurious warnings can be avoided if you declare all the functions
5577 you use that never return as @code{noreturn}. @xref{Function
5578 Attributes}.
5579
5580 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5581
5582 @item -Wunknown-pragmas
5583 @opindex Wunknown-pragmas
5584 @opindex Wno-unknown-pragmas
5585 @cindex warning for unknown pragmas
5586 @cindex unknown pragmas, warning
5587 @cindex pragmas, warning of unknown
5588 Warn when a @code{#pragma} directive is encountered that is not understood by
5589 GCC@. If this command-line option is used, warnings are even issued
5590 for unknown pragmas in system header files. This is not the case if
5591 the warnings are only enabled by the @option{-Wall} command-line option.
5592
5593 @item -Wno-pragmas
5594 @opindex Wno-pragmas
5595 @opindex Wpragmas
5596 Do not warn about misuses of pragmas, such as incorrect parameters,
5597 invalid syntax, or conflicts between pragmas. See also
5598 @option{-Wunknown-pragmas}.
5599
5600 @item -Wno-prio-ctor-dtor
5601 @opindex Wno-prio-ctor-dtor
5602 @opindex Wprio-ctor-dtor
5603 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5604 The use of constructor and destructor attributes allow you to assign a
5605 priority to the constructor/destructor to control its order of execution
5606 before @code{main} is called or after it returns. The priority values must be
5607 greater than 100 as the compiler reserves priority values between 0--100 for
5608 the implementation.
5609
5610 @item -Wstrict-aliasing
5611 @opindex Wstrict-aliasing
5612 @opindex Wno-strict-aliasing
5613 This option is only active when @option{-fstrict-aliasing} is active.
5614 It warns about code that might break the strict aliasing rules that the
5615 compiler is using for optimization. The warning does not catch all
5616 cases, but does attempt to catch the more common pitfalls. It is
5617 included in @option{-Wall}.
5618 It is equivalent to @option{-Wstrict-aliasing=3}
5619
5620 @item -Wstrict-aliasing=n
5621 @opindex Wstrict-aliasing=n
5622 This option is only active when @option{-fstrict-aliasing} is active.
5623 It warns about code that might break the strict aliasing rules that the
5624 compiler is using for optimization.
5625 Higher levels correspond to higher accuracy (fewer false positives).
5626 Higher levels also correspond to more effort, similar to the way @option{-O}
5627 works.
5628 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5629
5630 Level 1: Most aggressive, quick, least accurate.
5631 Possibly useful when higher levels
5632 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5633 false negatives. However, it has many false positives.
5634 Warns for all pointer conversions between possibly incompatible types,
5635 even if never dereferenced. Runs in the front end only.
5636
5637 Level 2: Aggressive, quick, not too precise.
5638 May still have many false positives (not as many as level 1 though),
5639 and few false negatives (but possibly more than level 1).
5640 Unlike level 1, it only warns when an address is taken. Warns about
5641 incomplete types. Runs in the front end only.
5642
5643 Level 3 (default for @option{-Wstrict-aliasing}):
5644 Should have very few false positives and few false
5645 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5646 Takes care of the common pun+dereference pattern in the front end:
5647 @code{*(int*)&some_float}.
5648 If optimization is enabled, it also runs in the back end, where it deals
5649 with multiple statement cases using flow-sensitive points-to information.
5650 Only warns when the converted pointer is dereferenced.
5651 Does not warn about incomplete types.
5652
5653 @item -Wstrict-overflow
5654 @itemx -Wstrict-overflow=@var{n}
5655 @opindex Wstrict-overflow
5656 @opindex Wno-strict-overflow
5657 This option is only active when signed overflow is undefined.
5658 It warns about cases where the compiler optimizes based on the
5659 assumption that signed overflow does not occur. Note that it does not
5660 warn about all cases where the code might overflow: it only warns
5661 about cases where the compiler implements some optimization. Thus
5662 this warning depends on the optimization level.
5663
5664 An optimization that assumes that signed overflow does not occur is
5665 perfectly safe if the values of the variables involved are such that
5666 overflow never does, in fact, occur. Therefore this warning can
5667 easily give a false positive: a warning about code that is not
5668 actually a problem. To help focus on important issues, several
5669 warning levels are defined. No warnings are issued for the use of
5670 undefined signed overflow when estimating how many iterations a loop
5671 requires, in particular when determining whether a loop will be
5672 executed at all.
5673
5674 @table @gcctabopt
5675 @item -Wstrict-overflow=1
5676 Warn about cases that are both questionable and easy to avoid. For
5677 example the compiler simplifies
5678 @code{x + 1 > x} to @code{1}. This level of
5679 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5680 are not, and must be explicitly requested.
5681
5682 @item -Wstrict-overflow=2
5683 Also warn about other cases where a comparison is simplified to a
5684 constant. For example: @code{abs (x) >= 0}. This can only be
5685 simplified when signed integer overflow is undefined, because
5686 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5687 zero. @option{-Wstrict-overflow} (with no level) is the same as
5688 @option{-Wstrict-overflow=2}.
5689
5690 @item -Wstrict-overflow=3
5691 Also warn about other cases where a comparison is simplified. For
5692 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5693
5694 @item -Wstrict-overflow=4
5695 Also warn about other simplifications not covered by the above cases.
5696 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5697
5698 @item -Wstrict-overflow=5
5699 Also warn about cases where the compiler reduces the magnitude of a
5700 constant involved in a comparison. For example: @code{x + 2 > y} is
5701 simplified to @code{x + 1 >= y}. This is reported only at the
5702 highest warning level because this simplification applies to many
5703 comparisons, so this warning level gives a very large number of
5704 false positives.
5705 @end table
5706
5707 @item -Wstringop-overflow
5708 @itemx -Wstringop-overflow=@var{type}
5709 @opindex Wstringop-overflow
5710 @opindex Wno-stringop-overflow
5711 Warn for calls to string manipulation functions such as @code{memcpy} and
5712 @code{strcpy} that are determined to overflow the destination buffer. The
5713 optional argument is one greater than the type of Object Size Checking to
5714 perform to determine the size of the destination. @xref{Object Size Checking}.
5715 The argument is meaningful only for functions that operate on character arrays
5716 but not for raw memory functions like @code{memcpy} which always make use
5717 of Object Size type-0. The option also warns for calls that specify a size
5718 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5719 The option produces the best results with optimization enabled but can detect
5720 a small subset of simple buffer overflows even without optimization in
5721 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5722 correspond to the standard functions. In any case, the option warns about
5723 just a subset of buffer overflows detected by the corresponding overflow
5724 checking built-ins. For example, the option will issue a warning for
5725 the @code{strcpy} call below because it copies at least 5 characters
5726 (the string @code{"blue"} including the terminating NUL) into the buffer
5727 of size 4.
5728
5729 @smallexample
5730 enum Color @{ blue, purple, yellow @};
5731 const char* f (enum Color clr)
5732 @{
5733 static char buf [4];
5734 const char *str;
5735 switch (clr)
5736 @{
5737 case blue: str = "blue"; break;
5738 case purple: str = "purple"; break;
5739 case yellow: str = "yellow"; break;
5740 @}
5741
5742 return strcpy (buf, str); // warning here
5743 @}
5744 @end smallexample
5745
5746 Option @option{-Wstringop-overflow=2} is enabled by default.
5747
5748 @table @gcctabopt
5749 @item -Wstringop-overflow
5750 @itemx -Wstringop-overflow=1
5751 @opindex Wstringop-overflow
5752 @opindex Wno-stringop-overflow
5753 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5754 to determine the sizes of destination objects. This is the default setting
5755 of the option. At this setting the option will not warn for writes past
5756 the end of subobjects of larger objects accessed by pointers unless the
5757 size of the largest surrounding object is known. When the destination may
5758 be one of several objects it is assumed to be the largest one of them. On
5759 Linux systems, when optimization is enabled at this setting the option warns
5760 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5761 a non-zero value.
5762
5763 @item -Wstringop-overflow=2
5764 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5765 to determine the sizes of destination objects. At this setting the option
5766 will warn about overflows when writing to members of the largest complete
5767 objects whose exact size is known. It will, however, not warn for excessive
5768 writes to the same members of unknown objects referenced by pointers since
5769 they may point to arrays containing unknown numbers of elements.
5770
5771 @item -Wstringop-overflow=3
5772 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5773 to determine the sizes of destination objects. At this setting the option
5774 warns about overflowing the smallest object or data member. This is the
5775 most restrictive setting of the option that may result in warnings for safe
5776 code.
5777
5778 @item -Wstringop-overflow=4
5779 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5780 to determine the sizes of destination objects. At this setting the option
5781 will warn about overflowing any data members, and when the destination is
5782 one of several objects it uses the size of the largest of them to decide
5783 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5784 setting of the option may result in warnings for benign code.
5785 @end table
5786
5787 @item -Wstringop-truncation
5788 @opindex Wstringop-truncation
5789 @opindex Wno-stringop-truncation
5790 Warn for calls to bounded string manipulation functions such as @code{strncat},
5791 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5792 or leave the destination unchanged.
5793
5794 In the following example, the call to @code{strncat} specifies a bound that
5795 is less than the length of the source string. As a result, the copy of
5796 the source will be truncated and so the call is diagnosed. To avoid the
5797 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5798
5799 @smallexample
5800 void append (char *buf, size_t bufsize)
5801 @{
5802 strncat (buf, ".txt", 3);
5803 @}
5804 @end smallexample
5805
5806 As another example, the following call to @code{strncpy} results in copying
5807 to @code{d} just the characters preceding the terminating NUL, without
5808 appending the NUL to the end. Assuming the result of @code{strncpy} is
5809 necessarily a NUL-terminated string is a common mistake, and so the call
5810 is diagnosed. To avoid the warning when the result is not expected to be
5811 NUL-terminated, call @code{memcpy} instead.
5812
5813 @smallexample
5814 void copy (char *d, const char *s)
5815 @{
5816 strncpy (d, s, strlen (s));
5817 @}
5818 @end smallexample
5819
5820 In the following example, the call to @code{strncpy} specifies the size
5821 of the destination buffer as the bound. If the length of the source
5822 string is equal to or greater than this size the result of the copy will
5823 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5824 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5825 element of the buffer to @code{NUL}.
5826
5827 @smallexample
5828 void copy (const char *s)
5829 @{
5830 char buf[80];
5831 strncpy (buf, s, sizeof buf);
5832 @dots{}
5833 @}
5834 @end smallexample
5835
5836 In situations where a character array is intended to store a sequence
5837 of bytes with no terminating @code{NUL} such an array may be annotated
5838 with attribute @code{nonstring} to avoid this warning. Such arrays,
5839 however, are not suitable arguments to functions that expect
5840 @code{NUL}-terminated strings. To help detect accidental misuses of
5841 such arrays GCC issues warnings unless it can prove that the use is
5842 safe. @xref{Common Variable Attributes}.
5843
5844 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5845 @opindex Wsuggest-attribute=
5846 @opindex Wno-suggest-attribute=
5847 Warn for cases where adding an attribute may be beneficial. The
5848 attributes currently supported are listed below.
5849
5850 @table @gcctabopt
5851 @item -Wsuggest-attribute=pure
5852 @itemx -Wsuggest-attribute=const
5853 @itemx -Wsuggest-attribute=noreturn
5854 @itemx -Wmissing-noreturn
5855 @itemx -Wsuggest-attribute=malloc
5856 @opindex Wsuggest-attribute=pure
5857 @opindex Wno-suggest-attribute=pure
5858 @opindex Wsuggest-attribute=const
5859 @opindex Wno-suggest-attribute=const
5860 @opindex Wsuggest-attribute=noreturn
5861 @opindex Wno-suggest-attribute=noreturn
5862 @opindex Wmissing-noreturn
5863 @opindex Wno-missing-noreturn
5864 @opindex Wsuggest-attribute=malloc
5865 @opindex Wno-suggest-attribute=malloc
5866
5867 Warn about functions that might be candidates for attributes
5868 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5869 only warns for functions visible in other compilation units or (in the case of
5870 @code{pure} and @code{const}) if it cannot prove that the function returns
5871 normally. A function returns normally if it doesn't contain an infinite loop or
5872 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5873 requires option @option{-fipa-pure-const}, which is enabled by default at
5874 @option{-O} and higher. Higher optimization levels improve the accuracy
5875 of the analysis.
5876
5877 @item -Wsuggest-attribute=format
5878 @itemx -Wmissing-format-attribute
5879 @opindex Wsuggest-attribute=format
5880 @opindex Wmissing-format-attribute
5881 @opindex Wno-suggest-attribute=format
5882 @opindex Wno-missing-format-attribute
5883 @opindex Wformat
5884 @opindex Wno-format
5885
5886 Warn about function pointers that might be candidates for @code{format}
5887 attributes. Note these are only possible candidates, not absolute ones.
5888 GCC guesses that function pointers with @code{format} attributes that
5889 are used in assignment, initialization, parameter passing or return
5890 statements should have a corresponding @code{format} attribute in the
5891 resulting type. I.e.@: the left-hand side of the assignment or
5892 initialization, the type of the parameter variable, or the return type
5893 of the containing function respectively should also have a @code{format}
5894 attribute to avoid the warning.
5895
5896 GCC also warns about function definitions that might be
5897 candidates for @code{format} attributes. Again, these are only
5898 possible candidates. GCC guesses that @code{format} attributes
5899 might be appropriate for any function that calls a function like
5900 @code{vprintf} or @code{vscanf}, but this might not always be the
5901 case, and some functions for which @code{format} attributes are
5902 appropriate may not be detected.
5903
5904 @item -Wsuggest-attribute=cold
5905 @opindex Wsuggest-attribute=cold
5906 @opindex Wno-suggest-attribute=cold
5907
5908 Warn about functions that might be candidates for @code{cold} attribute. This
5909 is based on static detection and generally will only warn about functions which
5910 always leads to a call to another @code{cold} function such as wrappers of
5911 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5912 @end table
5913
5914 @item -Wsuggest-final-types
5915 @opindex Wno-suggest-final-types
5916 @opindex Wsuggest-final-types
5917 Warn about types with virtual methods where code quality would be improved
5918 if the type were declared with the C++11 @code{final} specifier,
5919 or, if possible,
5920 declared in an anonymous namespace. This allows GCC to more aggressively
5921 devirtualize the polymorphic calls. This warning is more effective with link
5922 time optimization, where the information about the class hierarchy graph is
5923 more complete.
5924
5925 @item -Wsuggest-final-methods
5926 @opindex Wno-suggest-final-methods
5927 @opindex Wsuggest-final-methods
5928 Warn about virtual methods where code quality would be improved if the method
5929 were declared with the C++11 @code{final} specifier,
5930 or, if possible, its type were
5931 declared in an anonymous namespace or with the @code{final} specifier.
5932 This warning is
5933 more effective with link-time optimization, where the information about the
5934 class hierarchy graph is more complete. It is recommended to first consider
5935 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5936 annotations.
5937
5938 @item -Wsuggest-override
5939 Warn about overriding virtual functions that are not marked with the override
5940 keyword.
5941
5942 @item -Walloc-zero
5943 @opindex Wno-alloc-zero
5944 @opindex Walloc-zero
5945 Warn about calls to allocation functions decorated with attribute
5946 @code{alloc_size} that specify zero bytes, including those to the built-in
5947 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5948 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5949 when called with a zero size differs among implementations (and in the case
5950 of @code{realloc} has been deprecated) relying on it may result in subtle
5951 portability bugs and should be avoided.
5952
5953 @item -Walloc-size-larger-than=@var{byte-size}
5954 @opindex Walloc-size-larger-than=
5955 @opindex Wno-alloc-size-larger-than
5956 Warn about calls to functions decorated with attribute @code{alloc_size}
5957 that attempt to allocate objects larger than the specified number of bytes,
5958 or where the result of the size computation in an integer type with infinite
5959 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
5960 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
5961 Warnings controlled by the option can be disabled either by specifying
5962 @var{byte-size} of @samp{SIZE_MAX} or more or by
5963 @option{-Wno-alloc-size-larger-than}.
5964 @xref{Function Attributes}.
5965
5966 @item -Wno-alloc-size-larger-than
5967 @opindex Wno-alloc-size-larger-than
5968 Disable @option{-Walloc-size-larger-than=} warnings. The option is
5969 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
5970 larger.
5971
5972 @item -Walloca
5973 @opindex Wno-alloca
5974 @opindex Walloca
5975 This option warns on all uses of @code{alloca} in the source.
5976
5977 @item -Walloca-larger-than=@var{byte-size}
5978 @opindex Walloca-larger-than=
5979 @opindex Wno-alloca-larger-than
5980 This option warns on calls to @code{alloca} with an integer argument whose
5981 value is either zero, or that is not bounded by a controlling predicate
5982 that limits its value to at most @var{byte-size}. It also warns for calls
5983 to @code{alloca} where the bound value is unknown. Arguments of non-integer
5984 types are considered unbounded even if they appear to be constrained to
5985 the expected range.
5986
5987 For example, a bounded case of @code{alloca} could be:
5988
5989 @smallexample
5990 void func (size_t n)
5991 @{
5992 void *p;
5993 if (n <= 1000)
5994 p = alloca (n);
5995 else
5996 p = malloc (n);
5997 f (p);
5998 @}
5999 @end smallexample
6000
6001 In the above example, passing @code{-Walloca-larger-than=1000} would not
6002 issue a warning because the call to @code{alloca} is known to be at most
6003 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6004 the compiler would emit a warning.
6005
6006 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6007 controlling predicate constraining its integer argument. For example:
6008
6009 @smallexample
6010 void func ()
6011 @{
6012 void *p = alloca (n);
6013 f (p);
6014 @}
6015 @end smallexample
6016
6017 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6018 a warning, but this time because of the lack of bounds checking.
6019
6020 Note, that even seemingly correct code involving signed integers could
6021 cause a warning:
6022
6023 @smallexample
6024 void func (signed int n)
6025 @{
6026 if (n < 500)
6027 @{
6028 p = alloca (n);
6029 f (p);
6030 @}
6031 @}
6032 @end smallexample
6033
6034 In the above example, @var{n} could be negative, causing a larger than
6035 expected argument to be implicitly cast into the @code{alloca} call.
6036
6037 This option also warns when @code{alloca} is used in a loop.
6038
6039 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6040 but is usually only effective when @option{-ftree-vrp} is active (default
6041 for @option{-O2} and above).
6042
6043 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6044
6045 @item -Wno-alloca-larger-than
6046 @opindex Wno-alloca-larger-than
6047 Disable @option{-Walloca-larger-than=} warnings. The option is
6048 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6049
6050 @item -Warray-bounds
6051 @itemx -Warray-bounds=@var{n}
6052 @opindex Wno-array-bounds
6053 @opindex Warray-bounds
6054 This option is only active when @option{-ftree-vrp} is active
6055 (default for @option{-O2} and above). It warns about subscripts to arrays
6056 that are always out of bounds. This warning is enabled by @option{-Wall}.
6057
6058 @table @gcctabopt
6059 @item -Warray-bounds=1
6060 This is the warning level of @option{-Warray-bounds} and is enabled
6061 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6062
6063 @item -Warray-bounds=2
6064 This warning level also warns about out of bounds access for
6065 arrays at the end of a struct and for arrays accessed through
6066 pointers. This warning level may give a larger number of
6067 false positives and is deactivated by default.
6068 @end table
6069
6070 @item -Wattribute-alias=@var{n}
6071 @itemx -Wno-attribute-alias
6072 @opindex -Wattribute-alias
6073 @opindex -Wno-attribute-alias
6074 Warn about declarations using the @code{alias} and similar attributes whose
6075 target is incompatible with the type of the alias.
6076 @xref{Function Attributes,,Declaring Attributes of Functions}.
6077 The @option{-Wattribute-alias=1} is enabled by @option{-Wall}.
6078
6079 @table @gcctabopt
6080 @item -Wattribute-alias=1
6081 The default warning level of the @option{-Wattribute-alias} option diagnoses
6082 incompatibilities between the type of the alias declaration and that of its
6083 target. Such incompatibilities are typically indicative of bugs.
6084
6085 @item -Wattribute-alias=2
6086 At this level @option{-Wattribute-alias} also diagnoses mismatches between
6087 the set of attributes of the alias declaration and the attributes applied
6088 to its target. Although in some cases such mismatches may indicate bugs,
6089 in other cases they may be benign and could be resolved simply by adding
6090 the missing attribute to the target.
6091 @end table
6092
6093 @item -Wbool-compare
6094 @opindex Wno-bool-compare
6095 @opindex Wbool-compare
6096 Warn about boolean expression compared with an integer value different from
6097 @code{true}/@code{false}. For instance, the following comparison is
6098 always false:
6099 @smallexample
6100 int n = 5;
6101 @dots{}
6102 if ((n > 1) == 2) @{ @dots{} @}
6103 @end smallexample
6104 This warning is enabled by @option{-Wall}.
6105
6106 @item -Wbool-operation
6107 @opindex Wno-bool-operation
6108 @opindex Wbool-operation
6109 Warn about suspicious operations on expressions of a boolean type. For
6110 instance, bitwise negation of a boolean is very likely a bug in the program.
6111 For C, this warning also warns about incrementing or decrementing a boolean,
6112 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6113 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6114
6115 This warning is enabled by @option{-Wall}.
6116
6117 @item -Wduplicated-branches
6118 @opindex Wno-duplicated-branches
6119 @opindex Wduplicated-branches
6120 Warn when an if-else has identical branches. This warning detects cases like
6121 @smallexample
6122 if (p != NULL)
6123 return 0;
6124 else
6125 return 0;
6126 @end smallexample
6127 It doesn't warn when both branches contain just a null statement. This warning
6128 also warn for conditional operators:
6129 @smallexample
6130 int i = x ? *p : *p;
6131 @end smallexample
6132
6133 @item -Wduplicated-cond
6134 @opindex Wno-duplicated-cond
6135 @opindex Wduplicated-cond
6136 Warn about duplicated conditions in an if-else-if chain. For instance,
6137 warn for the following code:
6138 @smallexample
6139 if (p->q != NULL) @{ @dots{} @}
6140 else if (p->q != NULL) @{ @dots{} @}
6141 @end smallexample
6142
6143 @item -Wframe-address
6144 @opindex Wno-frame-address
6145 @opindex Wframe-address
6146 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6147 is called with an argument greater than 0. Such calls may return indeterminate
6148 values or crash the program. The warning is included in @option{-Wall}.
6149
6150 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6151 @opindex Wno-discarded-qualifiers
6152 @opindex Wdiscarded-qualifiers
6153 Do not warn if type qualifiers on pointers are being discarded.
6154 Typically, the compiler warns if a @code{const char *} variable is
6155 passed to a function that takes a @code{char *} parameter. This option
6156 can be used to suppress such a warning.
6157
6158 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6159 @opindex Wno-discarded-array-qualifiers
6160 @opindex Wdiscarded-array-qualifiers
6161 Do not warn if type qualifiers on arrays which are pointer targets
6162 are being discarded. Typically, the compiler warns if a
6163 @code{const int (*)[]} variable is passed to a function that
6164 takes a @code{int (*)[]} parameter. This option can be used to
6165 suppress such a warning.
6166
6167 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6168 @opindex Wno-incompatible-pointer-types
6169 @opindex Wincompatible-pointer-types
6170 Do not warn when there is a conversion between pointers that have incompatible
6171 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6172 which warns for pointer argument passing or assignment with different
6173 signedness.
6174
6175 @item -Wno-int-conversion @r{(C and Objective-C only)}
6176 @opindex Wno-int-conversion
6177 @opindex Wint-conversion
6178 Do not warn about incompatible integer to pointer and pointer to integer
6179 conversions. This warning is about implicit conversions; for explicit
6180 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6181 @option{-Wno-pointer-to-int-cast} may be used.
6182
6183 @item -Wno-div-by-zero
6184 @opindex Wno-div-by-zero
6185 @opindex Wdiv-by-zero
6186 Do not warn about compile-time integer division by zero. Floating-point
6187 division by zero is not warned about, as it can be a legitimate way of
6188 obtaining infinities and NaNs.
6189
6190 @item -Wsystem-headers
6191 @opindex Wsystem-headers
6192 @opindex Wno-system-headers
6193 @cindex warnings from system headers
6194 @cindex system headers, warnings from
6195 Print warning messages for constructs found in system header files.
6196 Warnings from system headers are normally suppressed, on the assumption
6197 that they usually do not indicate real problems and would only make the
6198 compiler output harder to read. Using this command-line option tells
6199 GCC to emit warnings from system headers as if they occurred in user
6200 code. However, note that using @option{-Wall} in conjunction with this
6201 option does @emph{not} warn about unknown pragmas in system
6202 headers---for that, @option{-Wunknown-pragmas} must also be used.
6203
6204 @item -Wtautological-compare
6205 @opindex Wtautological-compare
6206 @opindex Wno-tautological-compare
6207 Warn if a self-comparison always evaluates to true or false. This
6208 warning detects various mistakes such as:
6209 @smallexample
6210 int i = 1;
6211 @dots{}
6212 if (i > i) @{ @dots{} @}
6213 @end smallexample
6214
6215 This warning also warns about bitwise comparisons that always evaluate
6216 to true or false, for instance:
6217 @smallexample
6218 if ((a & 16) == 10) @{ @dots{} @}
6219 @end smallexample
6220 will always be false.
6221
6222 This warning is enabled by @option{-Wall}.
6223
6224 @item -Wtrampolines
6225 @opindex Wtrampolines
6226 @opindex Wno-trampolines
6227 Warn about trampolines generated for pointers to nested functions.
6228 A trampoline is a small piece of data or code that is created at run
6229 time on the stack when the address of a nested function is taken, and is
6230 used to call the nested function indirectly. For some targets, it is
6231 made up of data only and thus requires no special treatment. But, for
6232 most targets, it is made up of code and thus requires the stack to be
6233 made executable in order for the program to work properly.
6234
6235 @item -Wfloat-equal
6236 @opindex Wfloat-equal
6237 @opindex Wno-float-equal
6238 Warn if floating-point values are used in equality comparisons.
6239
6240 The idea behind this is that sometimes it is convenient (for the
6241 programmer) to consider floating-point values as approximations to
6242 infinitely precise real numbers. If you are doing this, then you need
6243 to compute (by analyzing the code, or in some other way) the maximum or
6244 likely maximum error that the computation introduces, and allow for it
6245 when performing comparisons (and when producing output, but that's a
6246 different problem). In particular, instead of testing for equality, you
6247 should check to see whether the two values have ranges that overlap; and
6248 this is done with the relational operators, so equality comparisons are
6249 probably mistaken.
6250
6251 @item -Wtraditional @r{(C and Objective-C only)}
6252 @opindex Wtraditional
6253 @opindex Wno-traditional
6254 Warn about certain constructs that behave differently in traditional and
6255 ISO C@. Also warn about ISO C constructs that have no traditional C
6256 equivalent, and/or problematic constructs that should be avoided.
6257
6258 @itemize @bullet
6259 @item
6260 Macro parameters that appear within string literals in the macro body.
6261 In traditional C macro replacement takes place within string literals,
6262 but in ISO C it does not.
6263
6264 @item
6265 In traditional C, some preprocessor directives did not exist.
6266 Traditional preprocessors only considered a line to be a directive
6267 if the @samp{#} appeared in column 1 on the line. Therefore
6268 @option{-Wtraditional} warns about directives that traditional C
6269 understands but ignores because the @samp{#} does not appear as the
6270 first character on the line. It also suggests you hide directives like
6271 @code{#pragma} not understood by traditional C by indenting them. Some
6272 traditional implementations do not recognize @code{#elif}, so this option
6273 suggests avoiding it altogether.
6274
6275 @item
6276 A function-like macro that appears without arguments.
6277
6278 @item
6279 The unary plus operator.
6280
6281 @item
6282 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6283 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6284 constants.) Note, these suffixes appear in macros defined in the system
6285 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6286 Use of these macros in user code might normally lead to spurious
6287 warnings, however GCC's integrated preprocessor has enough context to
6288 avoid warning in these cases.
6289
6290 @item
6291 A function declared external in one block and then used after the end of
6292 the block.
6293
6294 @item
6295 A @code{switch} statement has an operand of type @code{long}.
6296
6297 @item
6298 A non-@code{static} function declaration follows a @code{static} one.
6299 This construct is not accepted by some traditional C compilers.
6300
6301 @item
6302 The ISO type of an integer constant has a different width or
6303 signedness from its traditional type. This warning is only issued if
6304 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6305 typically represent bit patterns, are not warned about.
6306
6307 @item
6308 Usage of ISO string concatenation is detected.
6309
6310 @item
6311 Initialization of automatic aggregates.
6312
6313 @item
6314 Identifier conflicts with labels. Traditional C lacks a separate
6315 namespace for labels.
6316
6317 @item
6318 Initialization of unions. If the initializer is zero, the warning is
6319 omitted. This is done under the assumption that the zero initializer in
6320 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6321 initializer warnings and relies on default initialization to zero in the
6322 traditional C case.
6323
6324 @item
6325 Conversions by prototypes between fixed/floating-point values and vice
6326 versa. The absence of these prototypes when compiling with traditional
6327 C causes serious problems. This is a subset of the possible
6328 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6329
6330 @item
6331 Use of ISO C style function definitions. This warning intentionally is
6332 @emph{not} issued for prototype declarations or variadic functions
6333 because these ISO C features appear in your code when using
6334 libiberty's traditional C compatibility macros, @code{PARAMS} and
6335 @code{VPARAMS}. This warning is also bypassed for nested functions
6336 because that feature is already a GCC extension and thus not relevant to
6337 traditional C compatibility.
6338 @end itemize
6339
6340 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6341 @opindex Wtraditional-conversion
6342 @opindex Wno-traditional-conversion
6343 Warn if a prototype causes a type conversion that is different from what
6344 would happen to the same argument in the absence of a prototype. This
6345 includes conversions of fixed point to floating and vice versa, and
6346 conversions changing the width or signedness of a fixed-point argument
6347 except when the same as the default promotion.
6348
6349 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6350 @opindex Wdeclaration-after-statement
6351 @opindex Wno-declaration-after-statement
6352 Warn when a declaration is found after a statement in a block. This
6353 construct, known from C++, was introduced with ISO C99 and is by default
6354 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6355
6356 @item -Wshadow
6357 @opindex Wshadow
6358 @opindex Wno-shadow
6359 Warn whenever a local variable or type declaration shadows another
6360 variable, parameter, type, class member (in C++), or instance variable
6361 (in Objective-C) or whenever a built-in function is shadowed. Note
6362 that in C++, the compiler warns if a local variable shadows an
6363 explicit typedef, but not if it shadows a struct/class/enum.
6364 Same as @option{-Wshadow=global}.
6365
6366 @item -Wno-shadow-ivar @r{(Objective-C only)}
6367 @opindex Wno-shadow-ivar
6368 @opindex Wshadow-ivar
6369 Do not warn whenever a local variable shadows an instance variable in an
6370 Objective-C method.
6371
6372 @item -Wshadow=global
6373 @opindex Wshadow=local
6374 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6375
6376 @item -Wshadow=local
6377 @opindex Wshadow=local
6378 Warn when a local variable shadows another local variable or parameter.
6379 This warning is enabled by @option{-Wshadow=global}.
6380
6381 @item -Wshadow=compatible-local
6382 @opindex Wshadow=compatible-local
6383 Warn when a local variable shadows another local variable or parameter
6384 whose type is compatible with that of the shadowing variable. In C++,
6385 type compatibility here means the type of the shadowing variable can be
6386 converted to that of the shadowed variable. The creation of this flag
6387 (in addition to @option{-Wshadow=local}) is based on the idea that when
6388 a local variable shadows another one of incompatible type, it is most
6389 likely intentional, not a bug or typo, as shown in the following example:
6390
6391 @smallexample
6392 @group
6393 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6394 @{
6395 for (int i = 0; i < N; ++i)
6396 @{
6397 ...
6398 @}
6399 ...
6400 @}
6401 @end group
6402 @end smallexample
6403
6404 Since the two variable @code{i} in the example above have incompatible types,
6405 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6406 Because their types are incompatible, if a programmer accidentally uses one
6407 in place of the other, type checking will catch that and emit an error or
6408 warning. So not warning (about shadowing) in this case will not lead to
6409 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6410 possibly reduce the number of warnings triggered by intentional shadowing.
6411
6412 This warning is enabled by @option{-Wshadow=local}.
6413
6414 @item -Wlarger-than=@var{byte-size}
6415 @opindex Wlarger-than=
6416 @opindex Wlarger-than-@var{byte-size}
6417 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6418 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6419 Warnings controlled by the option can be disabled either by specifying
6420 @var{byte-size} of @samp{SIZE_MAX} or more or by
6421 @option{-Wno-larger-than}.
6422
6423 @item -Wno-larger-than
6424 @opindex Wno-larger-than
6425 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6426 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6427
6428 @item -Wframe-larger-than=@var{byte-size}
6429 @opindex Wframe-larger-than=
6430 @opindex Wno-frame-larger-than
6431 Warn if the size of a function frame exceeds @var{byte-size}.
6432 The computation done to determine the stack frame size is approximate
6433 and not conservative.
6434 The actual requirements may be somewhat greater than @var{byte-size}
6435 even if you do not get a warning. In addition, any space allocated
6436 via @code{alloca}, variable-length arrays, or related constructs
6437 is not included by the compiler when determining
6438 whether or not to issue a warning.
6439 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6440 Warnings controlled by the option can be disabled either by specifying
6441 @var{byte-size} of @samp{SIZE_MAX} or more or by
6442 @option{-Wno-frame-larger-than}.
6443
6444 @item -Wno-frame-larger-than
6445 @opindex Wno-frame-larger-than
6446 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6447 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6448
6449 @item -Wno-free-nonheap-object
6450 @opindex Wno-free-nonheap-object
6451 @opindex Wfree-nonheap-object
6452 Do not warn when attempting to free an object that was not allocated
6453 on the heap.
6454
6455 @item -Wstack-usage=@var{byte-size}
6456 @opindex Wstack-usage
6457 @opindex Wno-stack-usage
6458 Warn if the stack usage of a function might exceed @var{byte-size}.
6459 The computation done to determine the stack usage is conservative.
6460 Any space allocated via @code{alloca}, variable-length arrays, or related
6461 constructs is included by the compiler when determining whether or not to
6462 issue a warning.
6463
6464 The message is in keeping with the output of @option{-fstack-usage}.
6465
6466 @itemize
6467 @item
6468 If the stack usage is fully static but exceeds the specified amount, it's:
6469
6470 @smallexample
6471 warning: stack usage is 1120 bytes
6472 @end smallexample
6473 @item
6474 If the stack usage is (partly) dynamic but bounded, it's:
6475
6476 @smallexample
6477 warning: stack usage might be 1648 bytes
6478 @end smallexample
6479 @item
6480 If the stack usage is (partly) dynamic and not bounded, it's:
6481
6482 @smallexample
6483 warning: stack usage might be unbounded
6484 @end smallexample
6485 @end itemize
6486
6487 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6488 Warnings controlled by the option can be disabled either by specifying
6489 @var{byte-size} of @samp{SIZE_MAX} or more or by
6490 @option{-Wno-stack-usage}.
6491
6492 @item -Wno-stack-usage
6493 @opindex Wno-stack-usage
6494 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6495 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6496
6497 @item -Wunsafe-loop-optimizations
6498 @opindex Wunsafe-loop-optimizations
6499 @opindex Wno-unsafe-loop-optimizations
6500 Warn if the loop cannot be optimized because the compiler cannot
6501 assume anything on the bounds of the loop indices. With
6502 @option{-funsafe-loop-optimizations} warn if the compiler makes
6503 such assumptions.
6504
6505 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6506 @opindex Wno-pedantic-ms-format
6507 @opindex Wpedantic-ms-format
6508 When used in combination with @option{-Wformat}
6509 and @option{-pedantic} without GNU extensions, this option
6510 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6511 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6512 which depend on the MS runtime.
6513
6514 @item -Waligned-new
6515 @opindex Waligned-new
6516 @opindex Wno-aligned-new
6517 Warn about a new-expression of a type that requires greater alignment
6518 than the @code{alignof(std::max_align_t)} but uses an allocation
6519 function without an explicit alignment parameter. This option is
6520 enabled by @option{-Wall}.
6521
6522 Normally this only warns about global allocation functions, but
6523 @option{-Waligned-new=all} also warns about class member allocation
6524 functions.
6525
6526 @item -Wplacement-new
6527 @itemx -Wplacement-new=@var{n}
6528 @opindex Wplacement-new
6529 @opindex Wno-placement-new
6530 Warn about placement new expressions with undefined behavior, such as
6531 constructing an object in a buffer that is smaller than the type of
6532 the object. For example, the placement new expression below is diagnosed
6533 because it attempts to construct an array of 64 integers in a buffer only
6534 64 bytes large.
6535 @smallexample
6536 char buf [64];
6537 new (buf) int[64];
6538 @end smallexample
6539 This warning is enabled by default.
6540
6541 @table @gcctabopt
6542 @item -Wplacement-new=1
6543 This is the default warning level of @option{-Wplacement-new}. At this
6544 level the warning is not issued for some strictly undefined constructs that
6545 GCC allows as extensions for compatibility with legacy code. For example,
6546 the following @code{new} expression is not diagnosed at this level even
6547 though it has undefined behavior according to the C++ standard because
6548 it writes past the end of the one-element array.
6549 @smallexample
6550 struct S @{ int n, a[1]; @};
6551 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6552 new (s->a)int [32]();
6553 @end smallexample
6554
6555 @item -Wplacement-new=2
6556 At this level, in addition to diagnosing all the same constructs as at level
6557 1, a diagnostic is also issued for placement new expressions that construct
6558 an object in the last member of structure whose type is an array of a single
6559 element and whose size is less than the size of the object being constructed.
6560 While the previous example would be diagnosed, the following construct makes
6561 use of the flexible member array extension to avoid the warning at level 2.
6562 @smallexample
6563 struct S @{ int n, a[]; @};
6564 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6565 new (s->a)int [32]();
6566 @end smallexample
6567
6568 @end table
6569
6570 @item -Wpointer-arith
6571 @opindex Wpointer-arith
6572 @opindex Wno-pointer-arith
6573 Warn about anything that depends on the ``size of'' a function type or
6574 of @code{void}. GNU C assigns these types a size of 1, for
6575 convenience in calculations with @code{void *} pointers and pointers
6576 to functions. In C++, warn also when an arithmetic operation involves
6577 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6578
6579 @item -Wpointer-compare
6580 @opindex Wpointer-compare
6581 @opindex Wno-pointer-compare
6582 Warn if a pointer is compared with a zero character constant. This usually
6583 means that the pointer was meant to be dereferenced. For example:
6584
6585 @smallexample
6586 const char *p = foo ();
6587 if (p == '\0')
6588 return 42;
6589 @end smallexample
6590
6591 Note that the code above is invalid in C++11.
6592
6593 This warning is enabled by default.
6594
6595 @item -Wtype-limits
6596 @opindex Wtype-limits
6597 @opindex Wno-type-limits
6598 Warn if a comparison is always true or always false due to the limited
6599 range of the data type, but do not warn for constant expressions. For
6600 example, warn if an unsigned variable is compared against zero with
6601 @code{<} or @code{>=}. This warning is also enabled by
6602 @option{-Wextra}.
6603
6604 @item -Wabsolute-value @r{(C and Objective-C only)}
6605 @opindex Wabsolute-value
6606 @opindex Wno-absolute-value
6607 Warn when a wrong absolute value function seems to be used or when it
6608 does not have any effect because its argument is an unsigned type.
6609 This warning be suppressed with an explicit type cast and it is also
6610 enabled by @option{-Wextra}.
6611
6612 @include cppwarnopts.texi
6613
6614 @item -Wbad-function-cast @r{(C and Objective-C only)}
6615 @opindex Wbad-function-cast
6616 @opindex Wno-bad-function-cast
6617 Warn when a function call is cast to a non-matching type.
6618 For example, warn if a call to a function returning an integer type
6619 is cast to a pointer type.
6620
6621 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6622 @opindex Wc90-c99-compat
6623 @opindex Wno-c90-c99-compat
6624 Warn about features not present in ISO C90, but present in ISO C99.
6625 For instance, warn about use of variable length arrays, @code{long long}
6626 type, @code{bool} type, compound literals, designated initializers, and so
6627 on. This option is independent of the standards mode. Warnings are disabled
6628 in the expression that follows @code{__extension__}.
6629
6630 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6631 @opindex Wc99-c11-compat
6632 @opindex Wno-c99-c11-compat
6633 Warn about features not present in ISO C99, but present in ISO C11.
6634 For instance, warn about use of anonymous structures and unions,
6635 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6636 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6637 and so on. This option is independent of the standards mode. Warnings are
6638 disabled in the expression that follows @code{__extension__}.
6639
6640 @item -Wc++-compat @r{(C and Objective-C only)}
6641 @opindex Wc++-compat
6642 @opindex Wno-c++-compat
6643 Warn about ISO C constructs that are outside of the common subset of
6644 ISO C and ISO C++, e.g.@: request for implicit conversion from
6645 @code{void *} to a pointer to non-@code{void} type.
6646
6647 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6648 @opindex Wc++11-compat
6649 @opindex Wno-c++11-compat
6650 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6651 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6652 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6653 enabled by @option{-Wall}.
6654
6655 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6656 @opindex Wc++14-compat
6657 @opindex Wno-c++14-compat
6658 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6659 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6660
6661 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6662 @opindex Wc++17-compat
6663 @opindex Wno-c++17-compat
6664 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6665 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6666
6667 @item -Wcast-qual
6668 @opindex Wcast-qual
6669 @opindex Wno-cast-qual
6670 Warn whenever a pointer is cast so as to remove a type qualifier from
6671 the target type. For example, warn if a @code{const char *} is cast
6672 to an ordinary @code{char *}.
6673
6674 Also warn when making a cast that introduces a type qualifier in an
6675 unsafe way. For example, casting @code{char **} to @code{const char **}
6676 is unsafe, as in this example:
6677
6678 @smallexample
6679 /* p is char ** value. */
6680 const char **q = (const char **) p;
6681 /* Assignment of readonly string to const char * is OK. */
6682 *q = "string";
6683 /* Now char** pointer points to read-only memory. */
6684 **p = 'b';
6685 @end smallexample
6686
6687 @item -Wcast-align
6688 @opindex Wcast-align
6689 @opindex Wno-cast-align
6690 Warn whenever a pointer is cast such that the required alignment of the
6691 target is increased. For example, warn if a @code{char *} is cast to
6692 an @code{int *} on machines where integers can only be accessed at
6693 two- or four-byte boundaries.
6694
6695 @item -Wcast-align=strict
6696 @opindex Wcast-align=strict
6697 Warn whenever a pointer is cast such that the required alignment of the
6698 target is increased. For example, warn if a @code{char *} is cast to
6699 an @code{int *} regardless of the target machine.
6700
6701 @item -Wcast-function-type
6702 @opindex Wcast-function-type
6703 @opindex Wno-cast-function-type
6704 Warn when a function pointer is cast to an incompatible function pointer.
6705 In a cast involving function types with a variable argument list only
6706 the types of initial arguments that are provided are considered.
6707 Any parameter of pointer-type matches any other pointer-type. Any benign
6708 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6709 on ILP32 targets. Likewise type qualifiers are ignored. The function
6710 type @code{void (*) (void)} is special and matches everything, which can
6711 be used to suppress this warning.
6712 In a cast involving pointer to member types this warning warns whenever
6713 the type cast is changing the pointer to member type.
6714 This warning is enabled by @option{-Wextra}.
6715
6716 @item -Wwrite-strings
6717 @opindex Wwrite-strings
6718 @opindex Wno-write-strings
6719 When compiling C, give string constants the type @code{const
6720 char[@var{length}]} so that copying the address of one into a
6721 non-@code{const} @code{char *} pointer produces a warning. These
6722 warnings help you find at compile time code that can try to write
6723 into a string constant, but only if you have been very careful about
6724 using @code{const} in declarations and prototypes. Otherwise, it is
6725 just a nuisance. This is why we did not make @option{-Wall} request
6726 these warnings.
6727
6728 When compiling C++, warn about the deprecated conversion from string
6729 literals to @code{char *}. This warning is enabled by default for C++
6730 programs.
6731
6732 @item -Wcatch-value
6733 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6734 @opindex Wcatch-value
6735 @opindex Wno-catch-value
6736 Warn about catch handlers that do not catch via reference.
6737 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6738 warn about polymorphic class types that are caught by value.
6739 With @option{-Wcatch-value=2} warn about all class types that are caught
6740 by value. With @option{-Wcatch-value=3} warn about all types that are
6741 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6742
6743 @item -Wclobbered
6744 @opindex Wclobbered
6745 @opindex Wno-clobbered
6746 Warn for variables that might be changed by @code{longjmp} or
6747 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6748
6749 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6750 @opindex Wconditionally-supported
6751 @opindex Wno-conditionally-supported
6752 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6753
6754 @item -Wconversion
6755 @opindex Wconversion
6756 @opindex Wno-conversion
6757 Warn for implicit conversions that may alter a value. This includes
6758 conversions between real and integer, like @code{abs (x)} when
6759 @code{x} is @code{double}; conversions between signed and unsigned,
6760 like @code{unsigned ui = -1}; and conversions to smaller types, like
6761 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6762 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6763 changed by the conversion like in @code{abs (2.0)}. Warnings about
6764 conversions between signed and unsigned integers can be disabled by
6765 using @option{-Wno-sign-conversion}.
6766
6767 For C++, also warn for confusing overload resolution for user-defined
6768 conversions; and conversions that never use a type conversion
6769 operator: conversions to @code{void}, the same type, a base class or a
6770 reference to them. Warnings about conversions between signed and
6771 unsigned integers are disabled by default in C++ unless
6772 @option{-Wsign-conversion} is explicitly enabled.
6773
6774 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6775 @opindex Wconversion-null
6776 @opindex Wno-conversion-null
6777 Do not warn for conversions between @code{NULL} and non-pointer
6778 types. @option{-Wconversion-null} is enabled by default.
6779
6780 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6781 @opindex Wzero-as-null-pointer-constant
6782 @opindex Wno-zero-as-null-pointer-constant
6783 Warn when a literal @samp{0} is used as null pointer constant. This can
6784 be useful to facilitate the conversion to @code{nullptr} in C++11.
6785
6786 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6787 @opindex Wsubobject-linkage
6788 @opindex Wno-subobject-linkage
6789 Warn if a class type has a base or a field whose type uses the anonymous
6790 namespace or depends on a type with no linkage. If a type A depends on
6791 a type B with no or internal linkage, defining it in multiple
6792 translation units would be an ODR violation because the meaning of B
6793 is different in each translation unit. If A only appears in a single
6794 translation unit, the best way to silence the warning is to give it
6795 internal linkage by putting it in an anonymous namespace as well. The
6796 compiler doesn't give this warning for types defined in the main .C
6797 file, as those are unlikely to have multiple definitions.
6798 @option{-Wsubobject-linkage} is enabled by default.
6799
6800 @item -Wdangling-else
6801 @opindex Wdangling-else
6802 @opindex Wno-dangling-else
6803 Warn about constructions where there may be confusion to which
6804 @code{if} statement an @code{else} branch belongs. Here is an example of
6805 such a case:
6806
6807 @smallexample
6808 @group
6809 @{
6810 if (a)
6811 if (b)
6812 foo ();
6813 else
6814 bar ();
6815 @}
6816 @end group
6817 @end smallexample
6818
6819 In C/C++, every @code{else} branch belongs to the innermost possible
6820 @code{if} statement, which in this example is @code{if (b)}. This is
6821 often not what the programmer expected, as illustrated in the above
6822 example by indentation the programmer chose. When there is the
6823 potential for this confusion, GCC issues a warning when this flag
6824 is specified. To eliminate the warning, add explicit braces around
6825 the innermost @code{if} statement so there is no way the @code{else}
6826 can belong to the enclosing @code{if}. The resulting code
6827 looks like this:
6828
6829 @smallexample
6830 @group
6831 @{
6832 if (a)
6833 @{
6834 if (b)
6835 foo ();
6836 else
6837 bar ();
6838 @}
6839 @}
6840 @end group
6841 @end smallexample
6842
6843 This warning is enabled by @option{-Wparentheses}.
6844
6845 @item -Wdate-time
6846 @opindex Wdate-time
6847 @opindex Wno-date-time
6848 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6849 are encountered as they might prevent bit-wise-identical reproducible
6850 compilations.
6851
6852 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6853 @opindex Wdelete-incomplete
6854 @opindex Wno-delete-incomplete
6855 Warn when deleting a pointer to incomplete type, which may cause
6856 undefined behavior at runtime. This warning is enabled by default.
6857
6858 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6859 @opindex Wuseless-cast
6860 @opindex Wno-useless-cast
6861 Warn when an expression is casted to its own type.
6862
6863 @item -Wempty-body
6864 @opindex Wempty-body
6865 @opindex Wno-empty-body
6866 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6867 while} statement. This warning is also enabled by @option{-Wextra}.
6868
6869 @item -Wenum-compare
6870 @opindex Wenum-compare
6871 @opindex Wno-enum-compare
6872 Warn about a comparison between values of different enumerated types.
6873 In C++ enumerated type mismatches in conditional expressions are also
6874 diagnosed and the warning is enabled by default. In C this warning is
6875 enabled by @option{-Wall}.
6876
6877 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6878 @opindex Wextra-semi
6879 @opindex Wno-extra-semi
6880 Warn about redundant semicolon after in-class function definition.
6881
6882 @item -Wjump-misses-init @r{(C, Objective-C only)}
6883 @opindex Wjump-misses-init
6884 @opindex Wno-jump-misses-init
6885 Warn if a @code{goto} statement or a @code{switch} statement jumps
6886 forward across the initialization of a variable, or jumps backward to a
6887 label after the variable has been initialized. This only warns about
6888 variables that are initialized when they are declared. This warning is
6889 only supported for C and Objective-C; in C++ this sort of branch is an
6890 error in any case.
6891
6892 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6893 can be disabled with the @option{-Wno-jump-misses-init} option.
6894
6895 @item -Wsign-compare
6896 @opindex Wsign-compare
6897 @opindex Wno-sign-compare
6898 @cindex warning for comparison of signed and unsigned values
6899 @cindex comparison of signed and unsigned values, warning
6900 @cindex signed and unsigned values, comparison warning
6901 Warn when a comparison between signed and unsigned values could produce
6902 an incorrect result when the signed value is converted to unsigned.
6903 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6904 also enabled by @option{-Wextra}.
6905
6906 @item -Wsign-conversion
6907 @opindex Wsign-conversion
6908 @opindex Wno-sign-conversion
6909 Warn for implicit conversions that may change the sign of an integer
6910 value, like assigning a signed integer expression to an unsigned
6911 integer variable. An explicit cast silences the warning. In C, this
6912 option is enabled also by @option{-Wconversion}.
6913
6914 @item -Wfloat-conversion
6915 @opindex Wfloat-conversion
6916 @opindex Wno-float-conversion
6917 Warn for implicit conversions that reduce the precision of a real value.
6918 This includes conversions from real to integer, and from higher precision
6919 real to lower precision real values. This option is also enabled by
6920 @option{-Wconversion}.
6921
6922 @item -Wno-scalar-storage-order
6923 @opindex Wno-scalar-storage-order
6924 @opindex Wscalar-storage-order
6925 Do not warn on suspicious constructs involving reverse scalar storage order.
6926
6927 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6928 @opindex Wsized-deallocation
6929 @opindex Wno-sized-deallocation
6930 Warn about a definition of an unsized deallocation function
6931 @smallexample
6932 void operator delete (void *) noexcept;
6933 void operator delete[] (void *) noexcept;
6934 @end smallexample
6935 without a definition of the corresponding sized deallocation function
6936 @smallexample
6937 void operator delete (void *, std::size_t) noexcept;
6938 void operator delete[] (void *, std::size_t) noexcept;
6939 @end smallexample
6940 or vice versa. Enabled by @option{-Wextra} along with
6941 @option{-fsized-deallocation}.
6942
6943 @item -Wsizeof-pointer-div
6944 @opindex Wsizeof-pointer-div
6945 @opindex Wno-sizeof-pointer-div
6946 Warn for suspicious divisions of two sizeof expressions that divide
6947 the pointer size by the element size, which is the usual way to compute
6948 the array size but won't work out correctly with pointers. This warning
6949 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6950 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6951
6952 @item -Wsizeof-pointer-memaccess
6953 @opindex Wsizeof-pointer-memaccess
6954 @opindex Wno-sizeof-pointer-memaccess
6955 Warn for suspicious length parameters to certain string and memory built-in
6956 functions if the argument uses @code{sizeof}. This warning triggers for
6957 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6958 an array, but a pointer, and suggests a possible fix, or about
6959 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6960 also warns about calls to bounded string copy functions like @code{strncat}
6961 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6962 the source array. For example, in the following function the call to
6963 @code{strncat} specifies the size of the source string as the bound. That
6964 is almost certainly a mistake and so the call is diagnosed.
6965 @smallexample
6966 void make_file (const char *name)
6967 @{
6968 char path[PATH_MAX];
6969 strncpy (path, name, sizeof path - 1);
6970 strncat (path, ".text", sizeof ".text");
6971 @dots{}
6972 @}
6973 @end smallexample
6974
6975 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6976
6977 @item -Wsizeof-array-argument
6978 @opindex Wsizeof-array-argument
6979 @opindex Wno-sizeof-array-argument
6980 Warn when the @code{sizeof} operator is applied to a parameter that is
6981 declared as an array in a function definition. This warning is enabled by
6982 default for C and C++ programs.
6983
6984 @item -Wmemset-elt-size
6985 @opindex Wmemset-elt-size
6986 @opindex Wno-memset-elt-size
6987 Warn for suspicious calls to the @code{memset} built-in function, if the
6988 first argument references an array, and the third argument is a number
6989 equal to the number of elements, but not equal to the size of the array
6990 in memory. This indicates that the user has omitted a multiplication by
6991 the element size. This warning is enabled by @option{-Wall}.
6992
6993 @item -Wmemset-transposed-args
6994 @opindex Wmemset-transposed-args
6995 @opindex Wno-memset-transposed-args
6996 Warn for suspicious calls to the @code{memset} built-in function, if the
6997 second argument is not zero and the third argument is zero. This warns e.g.@:
6998 about @code{memset (buf, sizeof buf, 0)} where most probably
6999 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
7000 is only emitted if the third argument is literal zero. If it is some
7001 expression that is folded to zero, a cast of zero to some type, etc.,
7002 it is far less likely that the user has mistakenly exchanged the arguments
7003 and no warning is emitted. This warning is enabled by @option{-Wall}.
7004
7005 @item -Waddress
7006 @opindex Waddress
7007 @opindex Wno-address
7008 Warn about suspicious uses of memory addresses. These include using
7009 the address of a function in a conditional expression, such as
7010 @code{void func(void); if (func)}, and comparisons against the memory
7011 address of a string literal, such as @code{if (x == "abc")}. Such
7012 uses typically indicate a programmer error: the address of a function
7013 always evaluates to true, so their use in a conditional usually
7014 indicate that the programmer forgot the parentheses in a function
7015 call; and comparisons against string literals result in unspecified
7016 behavior and are not portable in C, so they usually indicate that the
7017 programmer intended to use @code{strcmp}. This warning is enabled by
7018 @option{-Wall}.
7019
7020 @item -Wlogical-op
7021 @opindex Wlogical-op
7022 @opindex Wno-logical-op
7023 Warn about suspicious uses of logical operators in expressions.
7024 This includes using logical operators in contexts where a
7025 bit-wise operator is likely to be expected. Also warns when
7026 the operands of a logical operator are the same:
7027 @smallexample
7028 extern int a;
7029 if (a < 0 && a < 0) @{ @dots{} @}
7030 @end smallexample
7031
7032 @item -Wlogical-not-parentheses
7033 @opindex Wlogical-not-parentheses
7034 @opindex Wno-logical-not-parentheses
7035 Warn about logical not used on the left hand side operand of a comparison.
7036 This option does not warn if the right operand is considered to be a boolean
7037 expression. Its purpose is to detect suspicious code like the following:
7038 @smallexample
7039 int a;
7040 @dots{}
7041 if (!a > 1) @{ @dots{} @}
7042 @end smallexample
7043
7044 It is possible to suppress the warning by wrapping the LHS into
7045 parentheses:
7046 @smallexample
7047 if ((!a) > 1) @{ @dots{} @}
7048 @end smallexample
7049
7050 This warning is enabled by @option{-Wall}.
7051
7052 @item -Waggregate-return
7053 @opindex Waggregate-return
7054 @opindex Wno-aggregate-return
7055 Warn if any functions that return structures or unions are defined or
7056 called. (In languages where you can return an array, this also elicits
7057 a warning.)
7058
7059 @item -Wno-aggressive-loop-optimizations
7060 @opindex Wno-aggressive-loop-optimizations
7061 @opindex Waggressive-loop-optimizations
7062 Warn if in a loop with constant number of iterations the compiler detects
7063 undefined behavior in some statement during one or more of the iterations.
7064
7065 @item -Wno-attributes
7066 @opindex Wno-attributes
7067 @opindex Wattributes
7068 Do not warn if an unexpected @code{__attribute__} is used, such as
7069 unrecognized attributes, function attributes applied to variables,
7070 etc. This does not stop errors for incorrect use of supported
7071 attributes.
7072
7073 @item -Wno-builtin-declaration-mismatch
7074 @opindex Wno-builtin-declaration-mismatch
7075 @opindex Wbuiltin-declaration-mismatch
7076 Warn if a built-in function is declared with an incompatible signature
7077 or as a non-function, or when a built-in function declared with a type
7078 that does not include a prototype is called with arguments whose promoted
7079 types do not match those expected by the function. When @option{-Wextra}
7080 is specified, also warn when a built-in function that takes arguments is
7081 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7082 warning is enabled by default. To avoid the warning include the appropriate
7083 header to bring the prototypes of built-in functions into scope.
7084
7085 For example, the call to @code{memset} below is diagnosed by the warning
7086 because the function expects a value of type @code{size_t} as its argument
7087 but the type of @code{32} is @code{int}. With @option{-Wextra},
7088 the declaration of the function is diagnosed as well.
7089 @smallexample
7090 extern void* memset ();
7091 void f (void *d)
7092 @{
7093 memset (d, '\0', 32);
7094 @}
7095 @end smallexample
7096
7097 @item -Wno-builtin-macro-redefined
7098 @opindex Wno-builtin-macro-redefined
7099 @opindex Wbuiltin-macro-redefined
7100 Do not warn if certain built-in macros are redefined. This suppresses
7101 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7102 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7103
7104 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7105 @opindex Wstrict-prototypes
7106 @opindex Wno-strict-prototypes
7107 Warn if a function is declared or defined without specifying the
7108 argument types. (An old-style function definition is permitted without
7109 a warning if preceded by a declaration that specifies the argument
7110 types.)
7111
7112 @item -Wold-style-declaration @r{(C and Objective-C only)}
7113 @opindex Wold-style-declaration
7114 @opindex Wno-old-style-declaration
7115 Warn for obsolescent usages, according to the C Standard, in a
7116 declaration. For example, warn if storage-class specifiers like
7117 @code{static} are not the first things in a declaration. This warning
7118 is also enabled by @option{-Wextra}.
7119
7120 @item -Wold-style-definition @r{(C and Objective-C only)}
7121 @opindex Wold-style-definition
7122 @opindex Wno-old-style-definition
7123 Warn if an old-style function definition is used. A warning is given
7124 even if there is a previous prototype.
7125
7126 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7127 @opindex Wmissing-parameter-type
7128 @opindex Wno-missing-parameter-type
7129 A function parameter is declared without a type specifier in K&R-style
7130 functions:
7131
7132 @smallexample
7133 void foo(bar) @{ @}
7134 @end smallexample
7135
7136 This warning is also enabled by @option{-Wextra}.
7137
7138 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7139 @opindex Wmissing-prototypes
7140 @opindex Wno-missing-prototypes
7141 Warn if a global function is defined without a previous prototype
7142 declaration. This warning is issued even if the definition itself
7143 provides a prototype. Use this option to detect global functions
7144 that do not have a matching prototype declaration in a header file.
7145 This option is not valid for C++ because all function declarations
7146 provide prototypes and a non-matching declaration declares an
7147 overload rather than conflict with an earlier declaration.
7148 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7149
7150 @item -Wmissing-declarations
7151 @opindex Wmissing-declarations
7152 @opindex Wno-missing-declarations
7153 Warn if a global function is defined without a previous declaration.
7154 Do so even if the definition itself provides a prototype.
7155 Use this option to detect global functions that are not declared in
7156 header files. In C, no warnings are issued for functions with previous
7157 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7158 missing prototypes. In C++, no warnings are issued for function templates,
7159 or for inline functions, or for functions in anonymous namespaces.
7160
7161 @item -Wmissing-field-initializers
7162 @opindex Wmissing-field-initializers
7163 @opindex Wno-missing-field-initializers
7164 @opindex W
7165 @opindex Wextra
7166 @opindex Wno-extra
7167 Warn if a structure's initializer has some fields missing. For
7168 example, the following code causes such a warning, because
7169 @code{x.h} is implicitly zero:
7170
7171 @smallexample
7172 struct s @{ int f, g, h; @};
7173 struct s x = @{ 3, 4 @};
7174 @end smallexample
7175
7176 This option does not warn about designated initializers, so the following
7177 modification does not trigger a warning:
7178
7179 @smallexample
7180 struct s @{ int f, g, h; @};
7181 struct s x = @{ .f = 3, .g = 4 @};
7182 @end smallexample
7183
7184 In C this option does not warn about the universal zero initializer
7185 @samp{@{ 0 @}}:
7186
7187 @smallexample
7188 struct s @{ int f, g, h; @};
7189 struct s x = @{ 0 @};
7190 @end smallexample
7191
7192 Likewise, in C++ this option does not warn about the empty @{ @}
7193 initializer, for example:
7194
7195 @smallexample
7196 struct s @{ int f, g, h; @};
7197 s x = @{ @};
7198 @end smallexample
7199
7200 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7201 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7202
7203 @item -Wno-multichar
7204 @opindex Wno-multichar
7205 @opindex Wmultichar
7206 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7207 Usually they indicate a typo in the user's code, as they have
7208 implementation-defined values, and should not be used in portable code.
7209
7210 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7211 @opindex Wnormalized=
7212 @opindex Wnormalized
7213 @opindex Wno-normalized
7214 @cindex NFC
7215 @cindex NFKC
7216 @cindex character set, input normalization
7217 In ISO C and ISO C++, two identifiers are different if they are
7218 different sequences of characters. However, sometimes when characters
7219 outside the basic ASCII character set are used, you can have two
7220 different character sequences that look the same. To avoid confusion,
7221 the ISO 10646 standard sets out some @dfn{normalization rules} which
7222 when applied ensure that two sequences that look the same are turned into
7223 the same sequence. GCC can warn you if you are using identifiers that
7224 have not been normalized; this option controls that warning.
7225
7226 There are four levels of warning supported by GCC@. The default is
7227 @option{-Wnormalized=nfc}, which warns about any identifier that is
7228 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7229 recommended form for most uses. It is equivalent to
7230 @option{-Wnormalized}.
7231
7232 Unfortunately, there are some characters allowed in identifiers by
7233 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7234 identifiers. That is, there's no way to use these symbols in portable
7235 ISO C or C++ and have all your identifiers in NFC@.
7236 @option{-Wnormalized=id} suppresses the warning for these characters.
7237 It is hoped that future versions of the standards involved will correct
7238 this, which is why this option is not the default.
7239
7240 You can switch the warning off for all characters by writing
7241 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7242 only do this if you are using some other normalization scheme (like
7243 ``D''), because otherwise you can easily create bugs that are
7244 literally impossible to see.
7245
7246 Some characters in ISO 10646 have distinct meanings but look identical
7247 in some fonts or display methodologies, especially once formatting has
7248 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7249 LETTER N'', displays just like a regular @code{n} that has been
7250 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7251 normalization scheme to convert all these into a standard form as
7252 well, and GCC warns if your code is not in NFKC if you use
7253 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7254 about every identifier that contains the letter O because it might be
7255 confused with the digit 0, and so is not the default, but may be
7256 useful as a local coding convention if the programming environment
7257 cannot be fixed to display these characters distinctly.
7258
7259 @item -Wno-attribute-warning
7260 @opindex Wno-attribute-warning
7261 @opindex Wattribute-warning
7262 Do not warn about usage of functions (@pxref{Function Attributes})
7263 declared with @code{warning} attribute. By default, this warning is
7264 enabled. @option{-Wno-attribute-warning} can be used to disable the
7265 warning or @option{-Wno-error=attribute-warning} can be used to
7266 disable the error when compiled with @option{-Werror} flag.
7267
7268 @item -Wno-deprecated
7269 @opindex Wno-deprecated
7270 @opindex Wdeprecated
7271 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7272
7273 @item -Wno-deprecated-declarations
7274 @opindex Wno-deprecated-declarations
7275 @opindex Wdeprecated-declarations
7276 Do not warn about uses of functions (@pxref{Function Attributes}),
7277 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7278 Attributes}) marked as deprecated by using the @code{deprecated}
7279 attribute.
7280
7281 @item -Wno-overflow
7282 @opindex Wno-overflow
7283 @opindex Woverflow
7284 Do not warn about compile-time overflow in constant expressions.
7285
7286 @item -Wno-odr
7287 @opindex Wno-odr
7288 @opindex Wodr
7289 Warn about One Definition Rule violations during link-time optimization.
7290 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
7291
7292 @item -Wopenmp-simd
7293 @opindex Wopenmp-simd
7294 @opindex Wno-openmp-simd
7295 Warn if the vectorizer cost model overrides the OpenMP
7296 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7297 option can be used to relax the cost model.
7298
7299 @item -Woverride-init @r{(C and Objective-C only)}
7300 @opindex Woverride-init
7301 @opindex Wno-override-init
7302 @opindex W
7303 @opindex Wextra
7304 @opindex Wno-extra
7305 Warn if an initialized field without side effects is overridden when
7306 using designated initializers (@pxref{Designated Inits, , Designated
7307 Initializers}).
7308
7309 This warning is included in @option{-Wextra}. To get other
7310 @option{-Wextra} warnings without this one, use @option{-Wextra
7311 -Wno-override-init}.
7312
7313 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7314 @opindex Woverride-init-side-effects
7315 @opindex Wno-override-init-side-effects
7316 Warn if an initialized field with side effects is overridden when
7317 using designated initializers (@pxref{Designated Inits, , Designated
7318 Initializers}). This warning is enabled by default.
7319
7320 @item -Wpacked
7321 @opindex Wpacked
7322 @opindex Wno-packed
7323 Warn if a structure is given the packed attribute, but the packed
7324 attribute has no effect on the layout or size of the structure.
7325 Such structures may be mis-aligned for little benefit. For
7326 instance, in this code, the variable @code{f.x} in @code{struct bar}
7327 is misaligned even though @code{struct bar} does not itself
7328 have the packed attribute:
7329
7330 @smallexample
7331 @group
7332 struct foo @{
7333 int x;
7334 char a, b, c, d;
7335 @} __attribute__((packed));
7336 struct bar @{
7337 char z;
7338 struct foo f;
7339 @};
7340 @end group
7341 @end smallexample
7342
7343 @item -Wpacked-bitfield-compat
7344 @opindex Wpacked-bitfield-compat
7345 @opindex Wno-packed-bitfield-compat
7346 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7347 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7348 the change can lead to differences in the structure layout. GCC
7349 informs you when the offset of such a field has changed in GCC 4.4.
7350 For example there is no longer a 4-bit padding between field @code{a}
7351 and @code{b} in this structure:
7352
7353 @smallexample
7354 struct foo
7355 @{
7356 char a:4;
7357 char b:8;
7358 @} __attribute__ ((packed));
7359 @end smallexample
7360
7361 This warning is enabled by default. Use
7362 @option{-Wno-packed-bitfield-compat} to disable this warning.
7363
7364 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7365 @opindex Wpacked-not-aligned
7366 @opindex Wno-packed-not-aligned
7367 Warn if a structure field with explicitly specified alignment in a
7368 packed struct or union is misaligned. For example, a warning will
7369 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7370 'struct S' is less than 8}, in this code:
7371
7372 @smallexample
7373 @group
7374 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7375 struct __attribute__ ((packed)) S @{
7376 struct S8 s8;
7377 @};
7378 @end group
7379 @end smallexample
7380
7381 This warning is enabled by @option{-Wall}.
7382
7383 @item -Wpadded
7384 @opindex Wpadded
7385 @opindex Wno-padded
7386 Warn if padding is included in a structure, either to align an element
7387 of the structure or to align the whole structure. Sometimes when this
7388 happens it is possible to rearrange the fields of the structure to
7389 reduce the padding and so make the structure smaller.
7390
7391 @item -Wredundant-decls
7392 @opindex Wredundant-decls
7393 @opindex Wno-redundant-decls
7394 Warn if anything is declared more than once in the same scope, even in
7395 cases where multiple declaration is valid and changes nothing.
7396
7397 @item -Wno-restrict
7398 @opindex Wrestrict
7399 @opindex Wno-restrict
7400 Warn when an object referenced by a @code{restrict}-qualified parameter
7401 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7402 argument, or when copies between such objects overlap. For example,
7403 the call to the @code{strcpy} function below attempts to truncate the string
7404 by replacing its initial characters with the last four. However, because
7405 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7406 the call is diagnosed.
7407
7408 @smallexample
7409 void foo (void)
7410 @{
7411 char a[] = "abcd1234";
7412 strcpy (a, a + 4);
7413 @dots{}
7414 @}
7415 @end smallexample
7416 The @option{-Wrestrict} option detects some instances of simple overlap
7417 even without optimization but works best at @option{-O2} and above. It
7418 is included in @option{-Wall}.
7419
7420 @item -Wnested-externs @r{(C and Objective-C only)}
7421 @opindex Wnested-externs
7422 @opindex Wno-nested-externs
7423 Warn if an @code{extern} declaration is encountered within a function.
7424
7425 @item -Wno-inherited-variadic-ctor
7426 @opindex Winherited-variadic-ctor
7427 @opindex Wno-inherited-variadic-ctor
7428 Suppress warnings about use of C++11 inheriting constructors when the
7429 base class inherited from has a C variadic constructor; the warning is
7430 on by default because the ellipsis is not inherited.
7431
7432 @item -Winline
7433 @opindex Winline
7434 @opindex Wno-inline
7435 Warn if a function that is declared as inline cannot be inlined.
7436 Even with this option, the compiler does not warn about failures to
7437 inline functions declared in system headers.
7438
7439 The compiler uses a variety of heuristics to determine whether or not
7440 to inline a function. For example, the compiler takes into account
7441 the size of the function being inlined and the amount of inlining
7442 that has already been done in the current function. Therefore,
7443 seemingly insignificant changes in the source program can cause the
7444 warnings produced by @option{-Winline} to appear or disappear.
7445
7446 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7447 @opindex Wno-invalid-offsetof
7448 @opindex Winvalid-offsetof
7449 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7450 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7451 to a non-standard-layout type is undefined. In existing C++ implementations,
7452 however, @code{offsetof} typically gives meaningful results.
7453 This flag is for users who are aware that they are
7454 writing nonportable code and who have deliberately chosen to ignore the
7455 warning about it.
7456
7457 The restrictions on @code{offsetof} may be relaxed in a future version
7458 of the C++ standard.
7459
7460 @item -Wint-in-bool-context
7461 @opindex Wint-in-bool-context
7462 @opindex Wno-int-in-bool-context
7463 Warn for suspicious use of integer values where boolean values are expected,
7464 such as conditional expressions (?:) using non-boolean integer constants in
7465 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7466 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7467 for all kinds of multiplications regardless of the data type.
7468 This warning is enabled by @option{-Wall}.
7469
7470 @item -Wno-int-to-pointer-cast
7471 @opindex Wno-int-to-pointer-cast
7472 @opindex Wint-to-pointer-cast
7473 Suppress warnings from casts to pointer type of an integer of a
7474 different size. In C++, casting to a pointer type of smaller size is
7475 an error. @option{Wint-to-pointer-cast} is enabled by default.
7476
7477
7478 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7479 @opindex Wno-pointer-to-int-cast
7480 @opindex Wpointer-to-int-cast
7481 Suppress warnings from casts from a pointer to an integer type of a
7482 different size.
7483
7484 @item -Winvalid-pch
7485 @opindex Winvalid-pch
7486 @opindex Wno-invalid-pch
7487 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7488 the search path but cannot be used.
7489
7490 @item -Wlong-long
7491 @opindex Wlong-long
7492 @opindex Wno-long-long
7493 Warn if @code{long long} type is used. This is enabled by either
7494 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7495 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7496
7497 @item -Wvariadic-macros
7498 @opindex Wvariadic-macros
7499 @opindex Wno-variadic-macros
7500 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7501 alternate syntax is used in ISO C99 mode. This is enabled by either
7502 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7503 messages, use @option{-Wno-variadic-macros}.
7504
7505 @item -Wvarargs
7506 @opindex Wvarargs
7507 @opindex Wno-varargs
7508 Warn upon questionable usage of the macros used to handle variable
7509 arguments like @code{va_start}. This is default. To inhibit the
7510 warning messages, use @option{-Wno-varargs}.
7511
7512 @item -Wvector-operation-performance
7513 @opindex Wvector-operation-performance
7514 @opindex Wno-vector-operation-performance
7515 Warn if vector operation is not implemented via SIMD capabilities of the
7516 architecture. Mainly useful for the performance tuning.
7517 Vector operation can be implemented @code{piecewise}, which means that the
7518 scalar operation is performed on every vector element;
7519 @code{in parallel}, which means that the vector operation is implemented
7520 using scalars of wider type, which normally is more performance efficient;
7521 and @code{as a single scalar}, which means that vector fits into a
7522 scalar type.
7523
7524 @item -Wno-virtual-move-assign
7525 @opindex Wvirtual-move-assign
7526 @opindex Wno-virtual-move-assign
7527 Suppress warnings about inheriting from a virtual base with a
7528 non-trivial C++11 move assignment operator. This is dangerous because
7529 if the virtual base is reachable along more than one path, it is
7530 moved multiple times, which can mean both objects end up in the
7531 moved-from state. If the move assignment operator is written to avoid
7532 moving from a moved-from object, this warning can be disabled.
7533
7534 @item -Wvla
7535 @opindex Wvla
7536 @opindex Wno-vla
7537 Warn if a variable-length array is used in the code.
7538 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7539 the variable-length array.
7540
7541 @item -Wvla-larger-than=@var{byte-size}
7542 @opindex Wvla-larger-than=
7543 @opindex Wno-vla-larger-than
7544 If this option is used, the compiler will warn for declarations of
7545 variable-length arrays whose size is either unbounded, or bounded
7546 by an argument that allows the array size to exceed @var{byte-size}
7547 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7548 works, but with variable-length arrays.
7549
7550 Note that GCC may optimize small variable-length arrays of a known
7551 value into plain arrays, so this warning may not get triggered for
7552 such arrays.
7553
7554 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7555 is typically only effective when @option{-ftree-vrp} is active (default
7556 for @option{-O2} and above).
7557
7558 See also @option{-Walloca-larger-than=@var{byte-size}}.
7559
7560 @item -Wno-vla-larger-than
7561 @opindex Wno-vla-larger-than
7562 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7563 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7564
7565 @item -Wvolatile-register-var
7566 @opindex Wvolatile-register-var
7567 @opindex Wno-volatile-register-var
7568 Warn if a register variable is declared volatile. The volatile
7569 modifier does not inhibit all optimizations that may eliminate reads
7570 and/or writes to register variables. This warning is enabled by
7571 @option{-Wall}.
7572
7573 @item -Wdisabled-optimization
7574 @opindex Wdisabled-optimization
7575 @opindex Wno-disabled-optimization
7576 Warn if a requested optimization pass is disabled. This warning does
7577 not generally indicate that there is anything wrong with your code; it
7578 merely indicates that GCC's optimizers are unable to handle the code
7579 effectively. Often, the problem is that your code is too big or too
7580 complex; GCC refuses to optimize programs when the optimization
7581 itself is likely to take inordinate amounts of time.
7582
7583 @item -Wpointer-sign @r{(C and Objective-C only)}
7584 @opindex Wpointer-sign
7585 @opindex Wno-pointer-sign
7586 Warn for pointer argument passing or assignment with different signedness.
7587 This option is only supported for C and Objective-C@. It is implied by
7588 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7589 @option{-Wno-pointer-sign}.
7590
7591 @item -Wstack-protector
7592 @opindex Wstack-protector
7593 @opindex Wno-stack-protector
7594 This option is only active when @option{-fstack-protector} is active. It
7595 warns about functions that are not protected against stack smashing.
7596
7597 @item -Woverlength-strings
7598 @opindex Woverlength-strings
7599 @opindex Wno-overlength-strings
7600 Warn about string constants that are longer than the ``minimum
7601 maximum'' length specified in the C standard. Modern compilers
7602 generally allow string constants that are much longer than the
7603 standard's minimum limit, but very portable programs should avoid
7604 using longer strings.
7605
7606 The limit applies @emph{after} string constant concatenation, and does
7607 not count the trailing NUL@. In C90, the limit was 509 characters; in
7608 C99, it was raised to 4095. C++98 does not specify a normative
7609 minimum maximum, so we do not diagnose overlength strings in C++@.
7610
7611 This option is implied by @option{-Wpedantic}, and can be disabled with
7612 @option{-Wno-overlength-strings}.
7613
7614 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7615 @opindex Wunsuffixed-float-constants
7616 @opindex Wno-unsuffixed-float-constants
7617
7618 Issue a warning for any floating constant that does not have
7619 a suffix. When used together with @option{-Wsystem-headers} it
7620 warns about such constants in system header files. This can be useful
7621 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7622 from the decimal floating-point extension to C99.
7623
7624 @item -Wno-designated-init @r{(C and Objective-C only)}
7625 Suppress warnings when a positional initializer is used to initialize
7626 a structure that has been marked with the @code{designated_init}
7627 attribute.
7628
7629 @item -Whsa
7630 Issue a warning when HSAIL cannot be emitted for the compiled function or
7631 OpenMP construct.
7632
7633 @end table
7634
7635 @node Debugging Options
7636 @section Options for Debugging Your Program
7637 @cindex options, debugging
7638 @cindex debugging information options
7639
7640 To tell GCC to emit extra information for use by a debugger, in almost
7641 all cases you need only to add @option{-g} to your other options.
7642
7643 GCC allows you to use @option{-g} with
7644 @option{-O}. The shortcuts taken by optimized code may occasionally
7645 be surprising: some variables you declared may not exist
7646 at all; flow of control may briefly move where you did not expect it;
7647 some statements may not be executed because they compute constant
7648 results or their values are already at hand; some statements may
7649 execute in different places because they have been moved out of loops.
7650 Nevertheless it is possible to debug optimized output. This makes
7651 it reasonable to use the optimizer for programs that might have bugs.
7652
7653 If you are not using some other optimization option, consider
7654 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7655 With no @option{-O} option at all, some compiler passes that collect
7656 information useful for debugging do not run at all, so that
7657 @option{-Og} may result in a better debugging experience.
7658
7659 @table @gcctabopt
7660 @item -g
7661 @opindex g
7662 Produce debugging information in the operating system's native format
7663 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7664 information.
7665
7666 On most systems that use stabs format, @option{-g} enables use of extra
7667 debugging information that only GDB can use; this extra information
7668 makes debugging work better in GDB but probably makes other debuggers
7669 crash or
7670 refuse to read the program. If you want to control for certain whether
7671 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7672 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7673
7674 @item -ggdb
7675 @opindex ggdb
7676 Produce debugging information for use by GDB@. This means to use the
7677 most expressive format available (DWARF, stabs, or the native format
7678 if neither of those are supported), including GDB extensions if at all
7679 possible.
7680
7681 @item -gdwarf
7682 @itemx -gdwarf-@var{version}
7683 @opindex gdwarf
7684 Produce debugging information in DWARF format (if that is supported).
7685 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7686 for most targets is 4. DWARF Version 5 is only experimental.
7687
7688 Note that with DWARF Version 2, some ports require and always
7689 use some non-conflicting DWARF 3 extensions in the unwind tables.
7690
7691 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7692 for maximum benefit.
7693
7694 GCC no longer supports DWARF Version 1, which is substantially
7695 different than Version 2 and later. For historical reasons, some
7696 other DWARF-related options such as
7697 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7698 in their names, but apply to all currently-supported versions of DWARF.
7699
7700 @item -gstabs
7701 @opindex gstabs
7702 Produce debugging information in stabs format (if that is supported),
7703 without GDB extensions. This is the format used by DBX on most BSD
7704 systems. On MIPS, Alpha and System V Release 4 systems this option
7705 produces stabs debugging output that is not understood by DBX@.
7706 On System V Release 4 systems this option requires the GNU assembler.
7707
7708 @item -gstabs+
7709 @opindex gstabs+
7710 Produce debugging information in stabs format (if that is supported),
7711 using GNU extensions understood only by the GNU debugger (GDB)@. The
7712 use of these extensions is likely to make other debuggers crash or
7713 refuse to read the program.
7714
7715 @item -gxcoff
7716 @opindex gxcoff
7717 Produce debugging information in XCOFF format (if that is supported).
7718 This is the format used by the DBX debugger on IBM RS/6000 systems.
7719
7720 @item -gxcoff+
7721 @opindex gxcoff+
7722 Produce debugging information in XCOFF format (if that is supported),
7723 using GNU extensions understood only by the GNU debugger (GDB)@. The
7724 use of these extensions is likely to make other debuggers crash or
7725 refuse to read the program, and may cause assemblers other than the GNU
7726 assembler (GAS) to fail with an error.
7727
7728 @item -gvms
7729 @opindex gvms
7730 Produce debugging information in Alpha/VMS debug format (if that is
7731 supported). This is the format used by DEBUG on Alpha/VMS systems.
7732
7733 @item -g@var{level}
7734 @itemx -ggdb@var{level}
7735 @itemx -gstabs@var{level}
7736 @itemx -gxcoff@var{level}
7737 @itemx -gvms@var{level}
7738 Request debugging information and also use @var{level} to specify how
7739 much information. The default level is 2.
7740
7741 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7742 @option{-g}.
7743
7744 Level 1 produces minimal information, enough for making backtraces in
7745 parts of the program that you don't plan to debug. This includes
7746 descriptions of functions and external variables, and line number
7747 tables, but no information about local variables.
7748
7749 Level 3 includes extra information, such as all the macro definitions
7750 present in the program. Some debuggers support macro expansion when
7751 you use @option{-g3}.
7752
7753 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7754 confusion with @option{-gdwarf-@var{level}}.
7755 Instead use an additional @option{-g@var{level}} option to change the
7756 debug level for DWARF.
7757
7758 @item -feliminate-unused-debug-symbols
7759 @opindex feliminate-unused-debug-symbols
7760 Produce debugging information in stabs format (if that is supported),
7761 for only symbols that are actually used.
7762
7763 @item -femit-class-debug-always
7764 @opindex femit-class-debug-always
7765 Instead of emitting debugging information for a C++ class in only one
7766 object file, emit it in all object files using the class. This option
7767 should be used only with debuggers that are unable to handle the way GCC
7768 normally emits debugging information for classes because using this
7769 option increases the size of debugging information by as much as a
7770 factor of two.
7771
7772 @item -fno-merge-debug-strings
7773 @opindex fmerge-debug-strings
7774 @opindex fno-merge-debug-strings
7775 Direct the linker to not merge together strings in the debugging
7776 information that are identical in different object files. Merging is
7777 not supported by all assemblers or linkers. Merging decreases the size
7778 of the debug information in the output file at the cost of increasing
7779 link processing time. Merging is enabled by default.
7780
7781 @item -fdebug-prefix-map=@var{old}=@var{new}
7782 @opindex fdebug-prefix-map
7783 When compiling files residing in directory @file{@var{old}}, record
7784 debugging information describing them as if the files resided in
7785 directory @file{@var{new}} instead. This can be used to replace a
7786 build-time path with an install-time path in the debug info. It can
7787 also be used to change an absolute path to a relative path by using
7788 @file{.} for @var{new}. This can give more reproducible builds, which
7789 are location independent, but may require an extra command to tell GDB
7790 where to find the source files. See also @option{-ffile-prefix-map}.
7791
7792 @item -fvar-tracking
7793 @opindex fvar-tracking
7794 Run variable tracking pass. It computes where variables are stored at each
7795 position in code. Better debugging information is then generated
7796 (if the debugging information format supports this information).
7797
7798 It is enabled by default when compiling with optimization (@option{-Os},
7799 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7800 the debug info format supports it.
7801
7802 @item -fvar-tracking-assignments
7803 @opindex fvar-tracking-assignments
7804 @opindex fno-var-tracking-assignments
7805 Annotate assignments to user variables early in the compilation and
7806 attempt to carry the annotations over throughout the compilation all the
7807 way to the end, in an attempt to improve debug information while
7808 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7809
7810 It can be enabled even if var-tracking is disabled, in which case
7811 annotations are created and maintained, but discarded at the end.
7812 By default, this flag is enabled together with @option{-fvar-tracking},
7813 except when selective scheduling is enabled.
7814
7815 @item -gsplit-dwarf
7816 @opindex gsplit-dwarf
7817 Separate as much DWARF debugging information as possible into a
7818 separate output file with the extension @file{.dwo}. This option allows
7819 the build system to avoid linking files with debug information. To
7820 be useful, this option requires a debugger capable of reading @file{.dwo}
7821 files.
7822
7823 @item -gdescribe-dies
7824 @opindex gdescribe-dies
7825 Add description attributes to some DWARF DIEs that have no name attribute,
7826 such as artificial variables, external references and call site
7827 parameter DIEs.
7828
7829 @item -gpubnames
7830 @opindex gpubnames
7831 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7832
7833 @item -ggnu-pubnames
7834 @opindex ggnu-pubnames
7835 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7836 suitable for conversion into a GDB@ index. This option is only useful
7837 with a linker that can produce GDB@ index version 7.
7838
7839 @item -fdebug-types-section
7840 @opindex fdebug-types-section
7841 @opindex fno-debug-types-section
7842 When using DWARF Version 4 or higher, type DIEs can be put into
7843 their own @code{.debug_types} section instead of making them part of the
7844 @code{.debug_info} section. It is more efficient to put them in a separate
7845 comdat section since the linker can then remove duplicates.
7846 But not all DWARF consumers support @code{.debug_types} sections yet
7847 and on some objects @code{.debug_types} produces larger instead of smaller
7848 debugging information.
7849
7850 @item -grecord-gcc-switches
7851 @itemx -gno-record-gcc-switches
7852 @opindex grecord-gcc-switches
7853 @opindex gno-record-gcc-switches
7854 This switch causes the command-line options used to invoke the
7855 compiler that may affect code generation to be appended to the
7856 DW_AT_producer attribute in DWARF debugging information. The options
7857 are concatenated with spaces separating them from each other and from
7858 the compiler version.
7859 It is enabled by default.
7860 See also @option{-frecord-gcc-switches} for another
7861 way of storing compiler options into the object file.
7862
7863 @item -gstrict-dwarf
7864 @opindex gstrict-dwarf
7865 Disallow using extensions of later DWARF standard version than selected
7866 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7867 DWARF extensions from later standard versions is allowed.
7868
7869 @item -gno-strict-dwarf
7870 @opindex gno-strict-dwarf
7871 Allow using extensions of later DWARF standard version than selected with
7872 @option{-gdwarf-@var{version}}.
7873
7874 @item -gas-loc-support
7875 @opindex gas-loc-support
7876 Inform the compiler that the assembler supports @code{.loc} directives.
7877 It may then use them for the assembler to generate DWARF2+ line number
7878 tables.
7879
7880 This is generally desirable, because assembler-generated line-number
7881 tables are a lot more compact than those the compiler can generate
7882 itself.
7883
7884 This option will be enabled by default if, at GCC configure time, the
7885 assembler was found to support such directives.
7886
7887 @item -gno-as-loc-support
7888 @opindex gno-as-loc-support
7889 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7890 line number tables are to be generated.
7891
7892 @item gas-locview-support
7893 @opindex gas-locview-support
7894 Inform the compiler that the assembler supports @code{view} assignment
7895 and reset assertion checking in @code{.loc} directives.
7896
7897 This option will be enabled by default if, at GCC configure time, the
7898 assembler was found to support them.
7899
7900 @item gno-as-locview-support
7901 Force GCC to assign view numbers internally, if
7902 @option{-gvariable-location-views} are explicitly requested.
7903
7904 @item -gcolumn-info
7905 @itemx -gno-column-info
7906 @opindex gcolumn-info
7907 @opindex gno-column-info
7908 Emit location column information into DWARF debugging information, rather
7909 than just file and line.
7910 This option is enabled by default.
7911
7912 @item -gstatement-frontiers
7913 @itemx -gno-statement-frontiers
7914 @opindex gstatement-frontiers
7915 @opindex gno-statement-frontiers
7916 This option causes GCC to create markers in the internal representation
7917 at the beginning of statements, and to keep them roughly in place
7918 throughout compilation, using them to guide the output of @code{is_stmt}
7919 markers in the line number table. This is enabled by default when
7920 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7921 @dots{}), and outputting DWARF 2 debug information at the normal level.
7922
7923 @item -gvariable-location-views
7924 @itemx -gvariable-location-views=incompat5
7925 @itemx -gno-variable-location-views
7926 @opindex gvariable-location-views
7927 @opindex gvariable-location-views=incompat5
7928 @opindex gno-variable-location-views
7929 Augment variable location lists with progressive view numbers implied
7930 from the line number table. This enables debug information consumers to
7931 inspect state at certain points of the program, even if no instructions
7932 associated with the corresponding source locations are present at that
7933 point. If the assembler lacks support for view numbers in line number
7934 tables, this will cause the compiler to emit the line number table,
7935 which generally makes them somewhat less compact. The augmented line
7936 number tables and location lists are fully backward-compatible, so they
7937 can be consumed by debug information consumers that are not aware of
7938 these augmentations, but they won't derive any benefit from them either.
7939
7940 This is enabled by default when outputting DWARF 2 debug information at
7941 the normal level, as long as there is assembler support,
7942 @option{-fvar-tracking-assignments} is enabled and
7943 @option{-gstrict-dwarf} is not. When assembler support is not
7944 available, this may still be enabled, but it will force GCC to output
7945 internal line number tables, and if
7946 @option{-ginternal-reset-location-views} is not enabled, that will most
7947 certainly lead to silently mismatching location views.
7948
7949 There is a proposed representation for view numbers that is not backward
7950 compatible with the location list format introduced in DWARF 5, that can
7951 be enabled with @option{-gvariable-location-views=incompat5}. This
7952 option may be removed in the future, is only provided as a reference
7953 implementation of the proposed representation. Debug information
7954 consumers are not expected to support this extended format, and they
7955 would be rendered unable to decode location lists using it.
7956
7957 @item -ginternal-reset-location-views
7958 @itemx -gnointernal-reset-location-views
7959 @opindex ginternal-reset-location-views
7960 @opindex gno-internal-reset-location-views
7961 Attempt to determine location views that can be omitted from location
7962 view lists. This requires the compiler to have very accurate insn
7963 length estimates, which isn't always the case, and it may cause
7964 incorrect view lists to be generated silently when using an assembler
7965 that does not support location view lists. The GNU assembler will flag
7966 any such error as a @code{view number mismatch}. This is only enabled
7967 on ports that define a reliable estimation function.
7968
7969 @item -ginline-points
7970 @itemx -gno-inline-points
7971 @opindex ginline-points
7972 @opindex gno-inline-points
7973 Generate extended debug information for inlined functions. Location
7974 view tracking markers are inserted at inlined entry points, so that
7975 address and view numbers can be computed and output in debug
7976 information. This can be enabled independently of location views, in
7977 which case the view numbers won't be output, but it can only be enabled
7978 along with statement frontiers, and it is only enabled by default if
7979 location views are enabled.
7980
7981 @item -gz@r{[}=@var{type}@r{]}
7982 @opindex gz
7983 Produce compressed debug sections in DWARF format, if that is supported.
7984 If @var{type} is not given, the default type depends on the capabilities
7985 of the assembler and linker used. @var{type} may be one of
7986 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7987 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7988 compression in traditional GNU format). If the linker doesn't support
7989 writing compressed debug sections, the option is rejected. Otherwise,
7990 if the assembler does not support them, @option{-gz} is silently ignored
7991 when producing object files.
7992
7993 @item -femit-struct-debug-baseonly
7994 @opindex femit-struct-debug-baseonly
7995 Emit debug information for struct-like types
7996 only when the base name of the compilation source file
7997 matches the base name of file in which the struct is defined.
7998
7999 This option substantially reduces the size of debugging information,
8000 but at significant potential loss in type information to the debugger.
8001 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8002 See @option{-femit-struct-debug-detailed} for more detailed control.
8003
8004 This option works only with DWARF debug output.
8005
8006 @item -femit-struct-debug-reduced
8007 @opindex femit-struct-debug-reduced
8008 Emit debug information for struct-like types
8009 only when the base name of the compilation source file
8010 matches the base name of file in which the type is defined,
8011 unless the struct is a template or defined in a system header.
8012
8013 This option significantly reduces the size of debugging information,
8014 with some potential loss in type information to the debugger.
8015 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8016 See @option{-femit-struct-debug-detailed} for more detailed control.
8017
8018 This option works only with DWARF debug output.
8019
8020 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8021 @opindex femit-struct-debug-detailed
8022 Specify the struct-like types
8023 for which the compiler generates debug information.
8024 The intent is to reduce duplicate struct debug information
8025 between different object files within the same program.
8026
8027 This option is a detailed version of
8028 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8029 which serves for most needs.
8030
8031 A specification has the syntax@*
8032 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8033
8034 The optional first word limits the specification to
8035 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8036 A struct type is used directly when it is the type of a variable, member.
8037 Indirect uses arise through pointers to structs.
8038 That is, when use of an incomplete struct is valid, the use is indirect.
8039 An example is
8040 @samp{struct one direct; struct two * indirect;}.
8041
8042 The optional second word limits the specification to
8043 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8044 Generic structs are a bit complicated to explain.
8045 For C++, these are non-explicit specializations of template classes,
8046 or non-template classes within the above.
8047 Other programming languages have generics,
8048 but @option{-femit-struct-debug-detailed} does not yet implement them.
8049
8050 The third word specifies the source files for those
8051 structs for which the compiler should emit debug information.
8052 The values @samp{none} and @samp{any} have the normal meaning.
8053 The value @samp{base} means that
8054 the base of name of the file in which the type declaration appears
8055 must match the base of the name of the main compilation file.
8056 In practice, this means that when compiling @file{foo.c}, debug information
8057 is generated for types declared in that file and @file{foo.h},
8058 but not other header files.
8059 The value @samp{sys} means those types satisfying @samp{base}
8060 or declared in system or compiler headers.
8061
8062 You may need to experiment to determine the best settings for your application.
8063
8064 The default is @option{-femit-struct-debug-detailed=all}.
8065
8066 This option works only with DWARF debug output.
8067
8068 @item -fno-dwarf2-cfi-asm
8069 @opindex fdwarf2-cfi-asm
8070 @opindex fno-dwarf2-cfi-asm
8071 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8072 instead of using GAS @code{.cfi_*} directives.
8073
8074 @item -fno-eliminate-unused-debug-types
8075 @opindex feliminate-unused-debug-types
8076 @opindex fno-eliminate-unused-debug-types
8077 Normally, when producing DWARF output, GCC avoids producing debug symbol
8078 output for types that are nowhere used in the source file being compiled.
8079 Sometimes it is useful to have GCC emit debugging
8080 information for all types declared in a compilation
8081 unit, regardless of whether or not they are actually used
8082 in that compilation unit, for example
8083 if, in the debugger, you want to cast a value to a type that is
8084 not actually used in your program (but is declared). More often,
8085 however, this results in a significant amount of wasted space.
8086 @end table
8087
8088 @node Optimize Options
8089 @section Options That Control Optimization
8090 @cindex optimize options
8091 @cindex options, optimization
8092
8093 These options control various sorts of optimizations.
8094
8095 Without any optimization option, the compiler's goal is to reduce the
8096 cost of compilation and to make debugging produce the expected
8097 results. Statements are independent: if you stop the program with a
8098 breakpoint between statements, you can then assign a new value to any
8099 variable or change the program counter to any other statement in the
8100 function and get exactly the results you expect from the source
8101 code.
8102
8103 Turning on optimization flags makes the compiler attempt to improve
8104 the performance and/or code size at the expense of compilation time
8105 and possibly the ability to debug the program.
8106
8107 The compiler performs optimization based on the knowledge it has of the
8108 program. Compiling multiple files at once to a single output file mode allows
8109 the compiler to use information gained from all of the files when compiling
8110 each of them.
8111
8112 Not all optimizations are controlled directly by a flag. Only
8113 optimizations that have a flag are listed in this section.
8114
8115 Most optimizations are completely disabled at @option{-O0} or if an
8116 @option{-O} level is not set on the command line, even if individual
8117 optimization flags are specified. Similarly, @option{-Og} suppresses
8118 many optimization passes.
8119
8120 Depending on the target and how GCC was configured, a slightly different
8121 set of optimizations may be enabled at each @option{-O} level than
8122 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8123 to find out the exact set of optimizations that are enabled at each level.
8124 @xref{Overall Options}, for examples.
8125
8126 @table @gcctabopt
8127 @item -O
8128 @itemx -O1
8129 @opindex O
8130 @opindex O1
8131 Optimize. Optimizing compilation takes somewhat more time, and a lot
8132 more memory for a large function.
8133
8134 With @option{-O}, the compiler tries to reduce code size and execution
8135 time, without performing any optimizations that take a great deal of
8136 compilation time.
8137
8138 @c Note that in addition to the default_options_table list in opts.c,
8139 @c several optimization flags default to true but control optimization
8140 @c passes that are explicitly disabled at -O0.
8141
8142 @option{-O} turns on the following optimization flags:
8143
8144 @c Please keep the following list alphabetized.
8145 @gccoptlist{-fauto-inc-dec @gol
8146 -fbranch-count-reg @gol
8147 -fcombine-stack-adjustments @gol
8148 -fcompare-elim @gol
8149 -fcprop-registers @gol
8150 -fdce @gol
8151 -fdefer-pop @gol
8152 -fdelayed-branch @gol
8153 -fdse @gol
8154 -fforward-propagate @gol
8155 -fguess-branch-probability @gol
8156 -fif-conversion @gol
8157 -fif-conversion2 @gol
8158 -finline-functions-called-once @gol
8159 -fipa-profile @gol
8160 -fipa-pure-const @gol
8161 -fipa-reference @gol
8162 -fipa-reference-addressable @gol
8163 -fmerge-constants @gol
8164 -fmove-loop-invariants @gol
8165 -fomit-frame-pointer @gol
8166 -freorder-blocks @gol
8167 -fshrink-wrap @gol
8168 -fshrink-wrap-separate @gol
8169 -fsplit-wide-types @gol
8170 -fssa-backprop @gol
8171 -fssa-phiopt @gol
8172 -ftree-bit-ccp @gol
8173 -ftree-ccp @gol
8174 -ftree-ch @gol
8175 -ftree-coalesce-vars @gol
8176 -ftree-copy-prop @gol
8177 -ftree-dce @gol
8178 -ftree-dominator-opts @gol
8179 -ftree-dse @gol
8180 -ftree-forwprop @gol
8181 -ftree-fre @gol
8182 -ftree-phiprop @gol
8183 -ftree-pta @gol
8184 -ftree-scev-cprop @gol
8185 -ftree-sink @gol
8186 -ftree-slsr @gol
8187 -ftree-sra @gol
8188 -ftree-ter @gol
8189 -funit-at-a-time}
8190
8191 @item -O2
8192 @opindex O2
8193 Optimize even more. GCC performs nearly all supported optimizations
8194 that do not involve a space-speed tradeoff.
8195 As compared to @option{-O}, this option increases both compilation time
8196 and the performance of the generated code.
8197
8198 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8199 also turns on the following optimization flags:
8200
8201 @c Please keep the following list alphabetized!
8202 @gccoptlist{-falign-functions -falign-jumps @gol
8203 -falign-labels -falign-loops @gol
8204 -fcaller-saves @gol
8205 -fcode-hoisting @gol
8206 -fcrossjumping @gol
8207 -fcse-follow-jumps -fcse-skip-blocks @gol
8208 -fdelete-null-pointer-checks @gol
8209 -fdevirtualize -fdevirtualize-speculatively @gol
8210 -fexpensive-optimizations @gol
8211 -fgcse -fgcse-lm @gol
8212 -fhoist-adjacent-loads @gol
8213 -finline-small-functions @gol
8214 -findirect-inlining @gol
8215 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8216 -fipa-ra -fipa-sra -fipa-vrp @gol
8217 -fisolate-erroneous-paths-dereference @gol
8218 -flra-remat @gol
8219 -foptimize-sibling-calls @gol
8220 -foptimize-strlen @gol
8221 -fpartial-inlining @gol
8222 -fpeephole2 @gol
8223 -freorder-blocks-algorithm=stc @gol
8224 -freorder-blocks-and-partition -freorder-functions @gol
8225 -frerun-cse-after-loop @gol
8226 -fschedule-insns -fschedule-insns2 @gol
8227 -fsched-interblock -fsched-spec @gol
8228 -fstore-merging @gol
8229 -fstrict-aliasing @gol
8230 -fthread-jumps @gol
8231 -ftree-builtin-call-dce @gol
8232 -ftree-pre @gol
8233 -ftree-switch-conversion -ftree-tail-merge @gol
8234 -ftree-vrp}
8235
8236 Please note the warning under @option{-fgcse} about
8237 invoking @option{-O2} on programs that use computed gotos.
8238
8239 @item -O3
8240 @opindex O3
8241 Optimize yet more. @option{-O3} turns on all optimizations specified
8242 by @option{-O2} and also turns on the following optimization flags:
8243
8244 @c Please keep the following list alphabetized!
8245 @gccoptlist{-fgcse-after-reload @gol
8246 -finline-functions @gol
8247 -fipa-cp-clone
8248 -floop-interchange @gol
8249 -floop-unroll-and-jam @gol
8250 -fpeel-loops @gol
8251 -fpredictive-commoning @gol
8252 -fsplit-paths @gol
8253 -ftree-loop-distribute-patterns @gol
8254 -ftree-loop-distribution @gol
8255 -ftree-loop-vectorize @gol
8256 -ftree-partial-pre @gol
8257 -ftree-slp-vectorize @gol
8258 -funswitch-loops @gol
8259 -fvect-cost-model}
8260
8261 @item -O0
8262 @opindex O0
8263 Reduce compilation time and make debugging produce the expected
8264 results. This is the default.
8265
8266 @item -Os
8267 @opindex Os
8268 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8269 except those that often increase code size:
8270
8271 @gccoptlist{-falign-functions -falign-jumps @gol
8272 -falign-labels -falign-loops @gol
8273 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8274
8275 It also enables @option{-finline-functions}, causes the compiler to tune for
8276 code size rather than execution speed, and performs further optimizations
8277 designed to reduce code size.
8278
8279 @item -Ofast
8280 @opindex Ofast
8281 Disregard strict standards compliance. @option{-Ofast} enables all
8282 @option{-O3} optimizations. It also enables optimizations that are not
8283 valid for all standard-compliant programs.
8284 It turns on @option{-ffast-math} and the Fortran-specific
8285 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8286 specified, and @option{-fno-protect-parens}.
8287
8288 @item -Og
8289 @opindex Og
8290 Optimize debugging experience. @option{-Og} should be the optimization
8291 level of choice for the standard edit-compile-debug cycle, offering
8292 a reasonable level of optimization while maintaining fast compilation
8293 and a good debugging experience. It is a better choice than @option{-O0}
8294 for producing debuggable code because some compiler passes
8295 that collect debug information are disabled at @option{-O0}.
8296
8297 Like @option{-O0}, @option{-Og} completely disables a number of
8298 optimization passes so that individual options controlling them have
8299 no effect. Otherwise @option{-Og} enables all @option{-O1}
8300 optimization flags except for those that may interfere with debugging:
8301
8302 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8303 -fif-conversion -fif-conversion2 @gol
8304 -finline-functions-called-once @gol
8305 -fmove-loop-invariants -fssa-phiopt @gol
8306 -ftree-bit-ccp -ftree-pta -ftree-sra}
8307
8308 @end table
8309
8310 If you use multiple @option{-O} options, with or without level numbers,
8311 the last such option is the one that is effective.
8312
8313 Options of the form @option{-f@var{flag}} specify machine-independent
8314 flags. Most flags have both positive and negative forms; the negative
8315 form of @option{-ffoo} is @option{-fno-foo}. In the table
8316 below, only one of the forms is listed---the one you typically
8317 use. You can figure out the other form by either removing @samp{no-}
8318 or adding it.
8319
8320 The following options control specific optimizations. They are either
8321 activated by @option{-O} options or are related to ones that are. You
8322 can use the following flags in the rare cases when ``fine-tuning'' of
8323 optimizations to be performed is desired.
8324
8325 @table @gcctabopt
8326 @item -fno-defer-pop
8327 @opindex fno-defer-pop
8328 @opindex fdefer-pop
8329 For machines that must pop arguments after a function call, always pop
8330 the arguments as soon as each function returns.
8331 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8332 this allows the compiler to let arguments accumulate on the stack for several
8333 function calls and pop them all at once.
8334
8335 @item -fforward-propagate
8336 @opindex fforward-propagate
8337 Perform a forward propagation pass on RTL@. The pass tries to combine two
8338 instructions and checks if the result can be simplified. If loop unrolling
8339 is active, two passes are performed and the second is scheduled after
8340 loop unrolling.
8341
8342 This option is enabled by default at optimization levels @option{-O},
8343 @option{-O2}, @option{-O3}, @option{-Os}.
8344
8345 @item -ffp-contract=@var{style}
8346 @opindex ffp-contract
8347 @option{-ffp-contract=off} disables floating-point expression contraction.
8348 @option{-ffp-contract=fast} enables floating-point expression contraction
8349 such as forming of fused multiply-add operations if the target has
8350 native support for them.
8351 @option{-ffp-contract=on} enables floating-point expression contraction
8352 if allowed by the language standard. This is currently not implemented
8353 and treated equal to @option{-ffp-contract=off}.
8354
8355 The default is @option{-ffp-contract=fast}.
8356
8357 @item -fomit-frame-pointer
8358 @opindex fomit-frame-pointer
8359 Omit the frame pointer in functions that don't need one. This avoids the
8360 instructions to save, set up and restore the frame pointer; on many targets
8361 it also makes an extra register available.
8362
8363 On some targets this flag has no effect because the standard calling sequence
8364 always uses a frame pointer, so it cannot be omitted.
8365
8366 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8367 is used in all functions. Several targets always omit the frame pointer in
8368 leaf functions.
8369
8370 Enabled by default at @option{-O} and higher.
8371
8372 @item -foptimize-sibling-calls
8373 @opindex foptimize-sibling-calls
8374 Optimize sibling and tail recursive calls.
8375
8376 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8377
8378 @item -foptimize-strlen
8379 @opindex foptimize-strlen
8380 Optimize various standard C string functions (e.g.@: @code{strlen},
8381 @code{strchr} or @code{strcpy}) and
8382 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8383
8384 Enabled at levels @option{-O2}, @option{-O3}.
8385
8386 @item -fno-inline
8387 @opindex fno-inline
8388 @opindex finline
8389 Do not expand any functions inline apart from those marked with
8390 the @code{always_inline} attribute. This is the default when not
8391 optimizing.
8392
8393 Single functions can be exempted from inlining by marking them
8394 with the @code{noinline} attribute.
8395
8396 @item -finline-small-functions
8397 @opindex finline-small-functions
8398 Integrate functions into their callers when their body is smaller than expected
8399 function call code (so overall size of program gets smaller). The compiler
8400 heuristically decides which functions are simple enough to be worth integrating
8401 in this way. This inlining applies to all functions, even those not declared
8402 inline.
8403
8404 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8405
8406 @item -findirect-inlining
8407 @opindex findirect-inlining
8408 Inline also indirect calls that are discovered to be known at compile
8409 time thanks to previous inlining. This option has any effect only
8410 when inlining itself is turned on by the @option{-finline-functions}
8411 or @option{-finline-small-functions} options.
8412
8413 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8414
8415 @item -finline-functions
8416 @opindex finline-functions
8417 Consider all functions for inlining, even if they are not declared inline.
8418 The compiler heuristically decides which functions are worth integrating
8419 in this way.
8420
8421 If all calls to a given function are integrated, and the function is
8422 declared @code{static}, then the function is normally not output as
8423 assembler code in its own right.
8424
8425 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
8426 by @option{-fprofile-use} and @option{-fauto-profile}.
8427
8428 @item -finline-functions-called-once
8429 @opindex finline-functions-called-once
8430 Consider all @code{static} functions called once for inlining into their
8431 caller even if they are not marked @code{inline}. If a call to a given
8432 function is integrated, then the function is not output as assembler code
8433 in its own right.
8434
8435 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8436 but not @option{-Og}.
8437
8438 @item -fearly-inlining
8439 @opindex fearly-inlining
8440 Inline functions marked by @code{always_inline} and functions whose body seems
8441 smaller than the function call overhead early before doing
8442 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8443 makes profiling significantly cheaper and usually inlining faster on programs
8444 having large chains of nested wrapper functions.
8445
8446 Enabled by default.
8447
8448 @item -fipa-sra
8449 @opindex fipa-sra
8450 Perform interprocedural scalar replacement of aggregates, removal of
8451 unused parameters and replacement of parameters passed by reference
8452 by parameters passed by value.
8453
8454 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8455
8456 @item -finline-limit=@var{n}
8457 @opindex finline-limit
8458 By default, GCC limits the size of functions that can be inlined. This flag
8459 allows coarse control of this limit. @var{n} is the size of functions that
8460 can be inlined in number of pseudo instructions.
8461
8462 Inlining is actually controlled by a number of parameters, which may be
8463 specified individually by using @option{--param @var{name}=@var{value}}.
8464 The @option{-finline-limit=@var{n}} option sets some of these parameters
8465 as follows:
8466
8467 @table @gcctabopt
8468 @item max-inline-insns-single
8469 is set to @var{n}/2.
8470 @item max-inline-insns-auto
8471 is set to @var{n}/2.
8472 @end table
8473
8474 See below for a documentation of the individual
8475 parameters controlling inlining and for the defaults of these parameters.
8476
8477 @emph{Note:} there may be no value to @option{-finline-limit} that results
8478 in default behavior.
8479
8480 @emph{Note:} pseudo instruction represents, in this particular context, an
8481 abstract measurement of function's size. In no way does it represent a count
8482 of assembly instructions and as such its exact meaning might change from one
8483 release to an another.
8484
8485 @item -fno-keep-inline-dllexport
8486 @opindex fno-keep-inline-dllexport
8487 @opindex fkeep-inline-dllexport
8488 This is a more fine-grained version of @option{-fkeep-inline-functions},
8489 which applies only to functions that are declared using the @code{dllexport}
8490 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8491 Functions}.
8492
8493 @item -fkeep-inline-functions
8494 @opindex fkeep-inline-functions
8495 In C, emit @code{static} functions that are declared @code{inline}
8496 into the object file, even if the function has been inlined into all
8497 of its callers. This switch does not affect functions using the
8498 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8499 inline functions into the object file.
8500
8501 @item -fkeep-static-functions
8502 @opindex fkeep-static-functions
8503 Emit @code{static} functions into the object file, even if the function
8504 is never used.
8505
8506 @item -fkeep-static-consts
8507 @opindex fkeep-static-consts
8508 Emit variables declared @code{static const} when optimization isn't turned
8509 on, even if the variables aren't referenced.
8510
8511 GCC enables this option by default. If you want to force the compiler to
8512 check if a variable is referenced, regardless of whether or not
8513 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8514
8515 @item -fmerge-constants
8516 @opindex fmerge-constants
8517 Attempt to merge identical constants (string constants and floating-point
8518 constants) across compilation units.
8519
8520 This option is the default for optimized compilation if the assembler and
8521 linker support it. Use @option{-fno-merge-constants} to inhibit this
8522 behavior.
8523
8524 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8525
8526 @item -fmerge-all-constants
8527 @opindex fmerge-all-constants
8528 Attempt to merge identical constants and identical variables.
8529
8530 This option implies @option{-fmerge-constants}. In addition to
8531 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8532 arrays or initialized constant variables with integral or floating-point
8533 types. Languages like C or C++ require each variable, including multiple
8534 instances of the same variable in recursive calls, to have distinct locations,
8535 so using this option results in non-conforming
8536 behavior.
8537
8538 @item -fmodulo-sched
8539 @opindex fmodulo-sched
8540 Perform swing modulo scheduling immediately before the first scheduling
8541 pass. This pass looks at innermost loops and reorders their
8542 instructions by overlapping different iterations.
8543
8544 @item -fmodulo-sched-allow-regmoves
8545 @opindex fmodulo-sched-allow-regmoves
8546 Perform more aggressive SMS-based modulo scheduling with register moves
8547 allowed. By setting this flag certain anti-dependences edges are
8548 deleted, which triggers the generation of reg-moves based on the
8549 life-range analysis. This option is effective only with
8550 @option{-fmodulo-sched} enabled.
8551
8552 @item -fno-branch-count-reg
8553 @opindex fno-branch-count-reg
8554 @opindex fbranch-count-reg
8555 Disable the optimization pass that scans for opportunities to use
8556 ``decrement and branch'' instructions on a count register instead of
8557 instruction sequences that decrement a register, compare it against zero, and
8558 then branch based upon the result. This option is only meaningful on
8559 architectures that support such instructions, which include x86, PowerPC,
8560 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8561 doesn't remove the decrement and branch instructions from the generated
8562 instruction stream introduced by other optimization passes.
8563
8564 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8565 except for @option{-Og}.
8566
8567 @item -fno-function-cse
8568 @opindex fno-function-cse
8569 @opindex ffunction-cse
8570 Do not put function addresses in registers; make each instruction that
8571 calls a constant function contain the function's address explicitly.
8572
8573 This option results in less efficient code, but some strange hacks
8574 that alter the assembler output may be confused by the optimizations
8575 performed when this option is not used.
8576
8577 The default is @option{-ffunction-cse}
8578
8579 @item -fno-zero-initialized-in-bss
8580 @opindex fno-zero-initialized-in-bss
8581 @opindex fzero-initialized-in-bss
8582 If the target supports a BSS section, GCC by default puts variables that
8583 are initialized to zero into BSS@. This can save space in the resulting
8584 code.
8585
8586 This option turns off this behavior because some programs explicitly
8587 rely on variables going to the data section---e.g., so that the
8588 resulting executable can find the beginning of that section and/or make
8589 assumptions based on that.
8590
8591 The default is @option{-fzero-initialized-in-bss}.
8592
8593 @item -fthread-jumps
8594 @opindex fthread-jumps
8595 Perform optimizations that check to see if a jump branches to a
8596 location where another comparison subsumed by the first is found. If
8597 so, the first branch is redirected to either the destination of the
8598 second branch or a point immediately following it, depending on whether
8599 the condition is known to be true or false.
8600
8601 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8602
8603 @item -fsplit-wide-types
8604 @opindex fsplit-wide-types
8605 When using a type that occupies multiple registers, such as @code{long
8606 long} on a 32-bit system, split the registers apart and allocate them
8607 independently. This normally generates better code for those types,
8608 but may make debugging more difficult.
8609
8610 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8611 @option{-Os}.
8612
8613 @item -fcse-follow-jumps
8614 @opindex fcse-follow-jumps
8615 In common subexpression elimination (CSE), scan through jump instructions
8616 when the target of the jump is not reached by any other path. For
8617 example, when CSE encounters an @code{if} statement with an
8618 @code{else} clause, CSE follows the jump when the condition
8619 tested is false.
8620
8621 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8622
8623 @item -fcse-skip-blocks
8624 @opindex fcse-skip-blocks
8625 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8626 follow jumps that conditionally skip over blocks. When CSE
8627 encounters a simple @code{if} statement with no else clause,
8628 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8629 body of the @code{if}.
8630
8631 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8632
8633 @item -frerun-cse-after-loop
8634 @opindex frerun-cse-after-loop
8635 Re-run common subexpression elimination after loop optimizations are
8636 performed.
8637
8638 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8639
8640 @item -fgcse
8641 @opindex fgcse
8642 Perform a global common subexpression elimination pass.
8643 This pass also performs global constant and copy propagation.
8644
8645 @emph{Note:} When compiling a program using computed gotos, a GCC
8646 extension, you may get better run-time performance if you disable
8647 the global common subexpression elimination pass by adding
8648 @option{-fno-gcse} to the command line.
8649
8650 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8651
8652 @item -fgcse-lm
8653 @opindex fgcse-lm
8654 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8655 attempts to move loads that are only killed by stores into themselves. This
8656 allows a loop containing a load/store sequence to be changed to a load outside
8657 the loop, and a copy/store within the loop.
8658
8659 Enabled by default when @option{-fgcse} is enabled.
8660
8661 @item -fgcse-sm
8662 @opindex fgcse-sm
8663 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8664 global common subexpression elimination. This pass attempts to move
8665 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8666 loops containing a load/store sequence can be changed to a load before
8667 the loop and a store after the loop.
8668
8669 Not enabled at any optimization level.
8670
8671 @item -fgcse-las
8672 @opindex fgcse-las
8673 When @option{-fgcse-las} is enabled, the global common subexpression
8674 elimination pass eliminates redundant loads that come after stores to the
8675 same memory location (both partial and full redundancies).
8676
8677 Not enabled at any optimization level.
8678
8679 @item -fgcse-after-reload
8680 @opindex fgcse-after-reload
8681 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8682 pass is performed after reload. The purpose of this pass is to clean up
8683 redundant spilling.
8684
8685 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8686
8687 @item -faggressive-loop-optimizations
8688 @opindex faggressive-loop-optimizations
8689 This option tells the loop optimizer to use language constraints to
8690 derive bounds for the number of iterations of a loop. This assumes that
8691 loop code does not invoke undefined behavior by for example causing signed
8692 integer overflows or out-of-bound array accesses. The bounds for the
8693 number of iterations of a loop are used to guide loop unrolling and peeling
8694 and loop exit test optimizations.
8695 This option is enabled by default.
8696
8697 @item -funconstrained-commons
8698 @opindex funconstrained-commons
8699 This option tells the compiler that variables declared in common blocks
8700 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8701 prevents certain optimizations that depend on knowing the array bounds.
8702
8703 @item -fcrossjumping
8704 @opindex fcrossjumping
8705 Perform cross-jumping transformation.
8706 This transformation unifies equivalent code and saves code size. The
8707 resulting code may or may not perform better than without cross-jumping.
8708
8709 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8710
8711 @item -fauto-inc-dec
8712 @opindex fauto-inc-dec
8713 Combine increments or decrements of addresses with memory accesses.
8714 This pass is always skipped on architectures that do not have
8715 instructions to support this. Enabled by default at @option{-O} and
8716 higher on architectures that support this.
8717
8718 @item -fdce
8719 @opindex fdce
8720 Perform dead code elimination (DCE) on RTL@.
8721 Enabled by default at @option{-O} and higher.
8722
8723 @item -fdse
8724 @opindex fdse
8725 Perform dead store elimination (DSE) on RTL@.
8726 Enabled by default at @option{-O} and higher.
8727
8728 @item -fif-conversion
8729 @opindex fif-conversion
8730 Attempt to transform conditional jumps into branch-less equivalents. This
8731 includes use of conditional moves, min, max, set flags and abs instructions, and
8732 some tricks doable by standard arithmetics. The use of conditional execution
8733 on chips where it is available is controlled by @option{-fif-conversion2}.
8734
8735 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8736 not with @option{-Og}.
8737
8738 @item -fif-conversion2
8739 @opindex fif-conversion2
8740 Use conditional execution (where available) to transform conditional jumps into
8741 branch-less equivalents.
8742
8743 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8744 not with @option{-Og}.
8745
8746 @item -fdeclone-ctor-dtor
8747 @opindex fdeclone-ctor-dtor
8748 The C++ ABI requires multiple entry points for constructors and
8749 destructors: one for a base subobject, one for a complete object, and
8750 one for a virtual destructor that calls operator delete afterwards.
8751 For a hierarchy with virtual bases, the base and complete variants are
8752 clones, which means two copies of the function. With this option, the
8753 base and complete variants are changed to be thunks that call a common
8754 implementation.
8755
8756 Enabled by @option{-Os}.
8757
8758 @item -fdelete-null-pointer-checks
8759 @opindex fdelete-null-pointer-checks
8760 Assume that programs cannot safely dereference null pointers, and that
8761 no code or data element resides at address zero.
8762 This option enables simple constant
8763 folding optimizations at all optimization levels. In addition, other
8764 optimization passes in GCC use this flag to control global dataflow
8765 analyses that eliminate useless checks for null pointers; these assume
8766 that a memory access to address zero always results in a trap, so
8767 that if a pointer is checked after it has already been dereferenced,
8768 it cannot be null.
8769
8770 Note however that in some environments this assumption is not true.
8771 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8772 for programs that depend on that behavior.
8773
8774 This option is enabled by default on most targets. On Nios II ELF, it
8775 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8776
8777 Passes that use the dataflow information
8778 are enabled independently at different optimization levels.
8779
8780 @item -fdevirtualize
8781 @opindex fdevirtualize
8782 Attempt to convert calls to virtual functions to direct calls. This
8783 is done both within a procedure and interprocedurally as part of
8784 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8785 propagation (@option{-fipa-cp}).
8786 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8787
8788 @item -fdevirtualize-speculatively
8789 @opindex fdevirtualize-speculatively
8790 Attempt to convert calls to virtual functions to speculative direct calls.
8791 Based on the analysis of the type inheritance graph, determine for a given call
8792 the set of likely targets. If the set is small, preferably of size 1, change
8793 the call into a conditional deciding between direct and indirect calls. The
8794 speculative calls enable more optimizations, such as inlining. When they seem
8795 useless after further optimization, they are converted back into original form.
8796
8797 @item -fdevirtualize-at-ltrans
8798 @opindex fdevirtualize-at-ltrans
8799 Stream extra information needed for aggressive devirtualization when running
8800 the link-time optimizer in local transformation mode.
8801 This option enables more devirtualization but
8802 significantly increases the size of streamed data. For this reason it is
8803 disabled by default.
8804
8805 @item -fexpensive-optimizations
8806 @opindex fexpensive-optimizations
8807 Perform a number of minor optimizations that are relatively expensive.
8808
8809 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8810
8811 @item -free
8812 @opindex free
8813 Attempt to remove redundant extension instructions. This is especially
8814 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8815 registers after writing to their lower 32-bit half.
8816
8817 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8818 @option{-O3}, @option{-Os}.
8819
8820 @item -fno-lifetime-dse
8821 @opindex fno-lifetime-dse
8822 @opindex flifetime-dse
8823 In C++ the value of an object is only affected by changes within its
8824 lifetime: when the constructor begins, the object has an indeterminate
8825 value, and any changes during the lifetime of the object are dead when
8826 the object is destroyed. Normally dead store elimination will take
8827 advantage of this; if your code relies on the value of the object
8828 storage persisting beyond the lifetime of the object, you can use this
8829 flag to disable this optimization. To preserve stores before the
8830 constructor starts (e.g.@: because your operator new clears the object
8831 storage) but still treat the object as dead after the destructor you,
8832 can use @option{-flifetime-dse=1}. The default behavior can be
8833 explicitly selected with @option{-flifetime-dse=2}.
8834 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8835
8836 @item -flive-range-shrinkage
8837 @opindex flive-range-shrinkage
8838 Attempt to decrease register pressure through register live range
8839 shrinkage. This is helpful for fast processors with small or moderate
8840 size register sets.
8841
8842 @item -fira-algorithm=@var{algorithm}
8843 @opindex fira-algorithm
8844 Use the specified coloring algorithm for the integrated register
8845 allocator. The @var{algorithm} argument can be @samp{priority}, which
8846 specifies Chow's priority coloring, or @samp{CB}, which specifies
8847 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8848 for all architectures, but for those targets that do support it, it is
8849 the default because it generates better code.
8850
8851 @item -fira-region=@var{region}
8852 @opindex fira-region
8853 Use specified regions for the integrated register allocator. The
8854 @var{region} argument should be one of the following:
8855
8856 @table @samp
8857
8858 @item all
8859 Use all loops as register allocation regions.
8860 This can give the best results for machines with a small and/or
8861 irregular register set.
8862
8863 @item mixed
8864 Use all loops except for loops with small register pressure
8865 as the regions. This value usually gives
8866 the best results in most cases and for most architectures,
8867 and is enabled by default when compiling with optimization for speed
8868 (@option{-O}, @option{-O2}, @dots{}).
8869
8870 @item one
8871 Use all functions as a single region.
8872 This typically results in the smallest code size, and is enabled by default for
8873 @option{-Os} or @option{-O0}.
8874
8875 @end table
8876
8877 @item -fira-hoist-pressure
8878 @opindex fira-hoist-pressure
8879 Use IRA to evaluate register pressure in the code hoisting pass for
8880 decisions to hoist expressions. This option usually results in smaller
8881 code, but it can slow the compiler down.
8882
8883 This option is enabled at level @option{-Os} for all targets.
8884
8885 @item -fira-loop-pressure
8886 @opindex fira-loop-pressure
8887 Use IRA to evaluate register pressure in loops for decisions to move
8888 loop invariants. This option usually results in generation
8889 of faster and smaller code on machines with large register files (>= 32
8890 registers), but it can slow the compiler down.
8891
8892 This option is enabled at level @option{-O3} for some targets.
8893
8894 @item -fno-ira-share-save-slots
8895 @opindex fno-ira-share-save-slots
8896 @opindex fira-share-save-slots
8897 Disable sharing of stack slots used for saving call-used hard
8898 registers living through a call. Each hard register gets a
8899 separate stack slot, and as a result function stack frames are
8900 larger.
8901
8902 @item -fno-ira-share-spill-slots
8903 @opindex fno-ira-share-spill-slots
8904 @opindex fira-share-spill-slots
8905 Disable sharing of stack slots allocated for pseudo-registers. Each
8906 pseudo-register that does not get a hard register gets a separate
8907 stack slot, and as a result function stack frames are larger.
8908
8909 @item -flra-remat
8910 @opindex flra-remat
8911 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8912 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8913 values if it is profitable.
8914
8915 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8916
8917 @item -fdelayed-branch
8918 @opindex fdelayed-branch
8919 If supported for the target machine, attempt to reorder instructions
8920 to exploit instruction slots available after delayed branch
8921 instructions.
8922
8923 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
8924 but not at @option{-Og}.
8925
8926 @item -fschedule-insns
8927 @opindex fschedule-insns
8928 If supported for the target machine, attempt to reorder instructions to
8929 eliminate execution stalls due to required data being unavailable. This
8930 helps machines that have slow floating point or memory load instructions
8931 by allowing other instructions to be issued until the result of the load
8932 or floating-point instruction is required.
8933
8934 Enabled at levels @option{-O2}, @option{-O3}.
8935
8936 @item -fschedule-insns2
8937 @opindex fschedule-insns2
8938 Similar to @option{-fschedule-insns}, but requests an additional pass of
8939 instruction scheduling after register allocation has been done. This is
8940 especially useful on machines with a relatively small number of
8941 registers and where memory load instructions take more than one cycle.
8942
8943 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8944
8945 @item -fno-sched-interblock
8946 @opindex fno-sched-interblock
8947 @opindex fsched-interblock
8948 Disable instruction scheduling across basic blocks, which
8949 is normally enabled when scheduling before register allocation, i.e.@:
8950 with @option{-fschedule-insns} or at @option{-O2} or higher.
8951
8952 @item -fno-sched-spec
8953 @opindex fno-sched-spec
8954 @opindex fsched-spec
8955 Disable speculative motion of non-load instructions, which
8956 is normally enabled when scheduling before register allocation, i.e.@:
8957 with @option{-fschedule-insns} or at @option{-O2} or higher.
8958
8959 @item -fsched-pressure
8960 @opindex fsched-pressure
8961 Enable register pressure sensitive insn scheduling before register
8962 allocation. This only makes sense when scheduling before register
8963 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8964 @option{-O2} or higher. Usage of this option can improve the
8965 generated code and decrease its size by preventing register pressure
8966 increase above the number of available hard registers and subsequent
8967 spills in register allocation.
8968
8969 @item -fsched-spec-load
8970 @opindex fsched-spec-load
8971 Allow speculative motion of some load instructions. This only makes
8972 sense when scheduling before register allocation, i.e.@: with
8973 @option{-fschedule-insns} or at @option{-O2} or higher.
8974
8975 @item -fsched-spec-load-dangerous
8976 @opindex fsched-spec-load-dangerous
8977 Allow speculative motion of more load instructions. This only makes
8978 sense when scheduling before register allocation, i.e.@: with
8979 @option{-fschedule-insns} or at @option{-O2} or higher.
8980
8981 @item -fsched-stalled-insns
8982 @itemx -fsched-stalled-insns=@var{n}
8983 @opindex fsched-stalled-insns
8984 Define how many insns (if any) can be moved prematurely from the queue
8985 of stalled insns into the ready list during the second scheduling pass.
8986 @option{-fno-sched-stalled-insns} means that no insns are moved
8987 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8988 on how many queued insns can be moved prematurely.
8989 @option{-fsched-stalled-insns} without a value is equivalent to
8990 @option{-fsched-stalled-insns=1}.
8991
8992 @item -fsched-stalled-insns-dep
8993 @itemx -fsched-stalled-insns-dep=@var{n}
8994 @opindex fsched-stalled-insns-dep
8995 Define how many insn groups (cycles) are examined for a dependency
8996 on a stalled insn that is a candidate for premature removal from the queue
8997 of stalled insns. This has an effect only during the second scheduling pass,
8998 and only if @option{-fsched-stalled-insns} is used.
8999 @option{-fno-sched-stalled-insns-dep} is equivalent to
9000 @option{-fsched-stalled-insns-dep=0}.
9001 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9002 @option{-fsched-stalled-insns-dep=1}.
9003
9004 @item -fsched2-use-superblocks
9005 @opindex fsched2-use-superblocks
9006 When scheduling after register allocation, use superblock scheduling.
9007 This allows motion across basic block boundaries,
9008 resulting in faster schedules. This option is experimental, as not all machine
9009 descriptions used by GCC model the CPU closely enough to avoid unreliable
9010 results from the algorithm.
9011
9012 This only makes sense when scheduling after register allocation, i.e.@: with
9013 @option{-fschedule-insns2} or at @option{-O2} or higher.
9014
9015 @item -fsched-group-heuristic
9016 @opindex fsched-group-heuristic
9017 Enable the group heuristic in the scheduler. This heuristic favors
9018 the instruction that belongs to a schedule group. This is enabled
9019 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9020 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9021
9022 @item -fsched-critical-path-heuristic
9023 @opindex fsched-critical-path-heuristic
9024 Enable the critical-path heuristic in the scheduler. This heuristic favors
9025 instructions on the critical path. This is enabled by default when
9026 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9027 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9028
9029 @item -fsched-spec-insn-heuristic
9030 @opindex fsched-spec-insn-heuristic
9031 Enable the speculative instruction heuristic in the scheduler. This
9032 heuristic favors speculative instructions with greater dependency weakness.
9033 This is enabled by default when scheduling is enabled, i.e.@:
9034 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9035 or at @option{-O2} or higher.
9036
9037 @item -fsched-rank-heuristic
9038 @opindex fsched-rank-heuristic
9039 Enable the rank heuristic in the scheduler. This heuristic favors
9040 the instruction belonging to a basic block with greater size or frequency.
9041 This is enabled by default when scheduling is enabled, i.e.@:
9042 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9043 at @option{-O2} or higher.
9044
9045 @item -fsched-last-insn-heuristic
9046 @opindex fsched-last-insn-heuristic
9047 Enable the last-instruction heuristic in the scheduler. This heuristic
9048 favors the instruction that is less dependent on the last instruction
9049 scheduled. This is enabled by default when scheduling is enabled,
9050 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9051 at @option{-O2} or higher.
9052
9053 @item -fsched-dep-count-heuristic
9054 @opindex fsched-dep-count-heuristic
9055 Enable the dependent-count heuristic in the scheduler. This heuristic
9056 favors the instruction that has more instructions depending on it.
9057 This is enabled by default when scheduling is enabled, i.e.@:
9058 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9059 at @option{-O2} or higher.
9060
9061 @item -freschedule-modulo-scheduled-loops
9062 @opindex freschedule-modulo-scheduled-loops
9063 Modulo scheduling is performed before traditional scheduling. If a loop
9064 is modulo scheduled, later scheduling passes may change its schedule.
9065 Use this option to control that behavior.
9066
9067 @item -fselective-scheduling
9068 @opindex fselective-scheduling
9069 Schedule instructions using selective scheduling algorithm. Selective
9070 scheduling runs instead of the first scheduler pass.
9071
9072 @item -fselective-scheduling2
9073 @opindex fselective-scheduling2
9074 Schedule instructions using selective scheduling algorithm. Selective
9075 scheduling runs instead of the second scheduler pass.
9076
9077 @item -fsel-sched-pipelining
9078 @opindex fsel-sched-pipelining
9079 Enable software pipelining of innermost loops during selective scheduling.
9080 This option has no effect unless one of @option{-fselective-scheduling} or
9081 @option{-fselective-scheduling2} is turned on.
9082
9083 @item -fsel-sched-pipelining-outer-loops
9084 @opindex fsel-sched-pipelining-outer-loops
9085 When pipelining loops during selective scheduling, also pipeline outer loops.
9086 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9087
9088 @item -fsemantic-interposition
9089 @opindex fsemantic-interposition
9090 Some object formats, like ELF, allow interposing of symbols by the
9091 dynamic linker.
9092 This means that for symbols exported from the DSO, the compiler cannot perform
9093 interprocedural propagation, inlining and other optimizations in anticipation
9094 that the function or variable in question may change. While this feature is
9095 useful, for example, to rewrite memory allocation functions by a debugging
9096 implementation, it is expensive in the terms of code quality.
9097 With @option{-fno-semantic-interposition} the compiler assumes that
9098 if interposition happens for functions the overwriting function will have
9099 precisely the same semantics (and side effects).
9100 Similarly if interposition happens
9101 for variables, the constructor of the variable will be the same. The flag
9102 has no effect for functions explicitly declared inline
9103 (where it is never allowed for interposition to change semantics)
9104 and for symbols explicitly declared weak.
9105
9106 @item -fshrink-wrap
9107 @opindex fshrink-wrap
9108 Emit function prologues only before parts of the function that need it,
9109 rather than at the top of the function. This flag is enabled by default at
9110 @option{-O} and higher.
9111
9112 @item -fshrink-wrap-separate
9113 @opindex fshrink-wrap-separate
9114 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9115 those parts are only executed when needed.
9116 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9117 is also turned on and the target supports this.
9118
9119 @item -fcaller-saves
9120 @opindex fcaller-saves
9121 Enable allocation of values to registers that are clobbered by
9122 function calls, by emitting extra instructions to save and restore the
9123 registers around such calls. Such allocation is done only when it
9124 seems to result in better code.
9125
9126 This option is always enabled by default on certain machines, usually
9127 those which have no call-preserved registers to use instead.
9128
9129 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9130
9131 @item -fcombine-stack-adjustments
9132 @opindex fcombine-stack-adjustments
9133 Tracks stack adjustments (pushes and pops) and stack memory references
9134 and then tries to find ways to combine them.
9135
9136 Enabled by default at @option{-O1} and higher.
9137
9138 @item -fipa-ra
9139 @opindex fipa-ra
9140 Use caller save registers for allocation if those registers are not used by
9141 any called function. In that case it is not necessary to save and restore
9142 them around calls. This is only possible if called functions are part of
9143 same compilation unit as current function and they are compiled before it.
9144
9145 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9146 is disabled if generated code will be instrumented for profiling
9147 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9148 exactly (this happens on targets that do not expose prologues
9149 and epilogues in RTL).
9150
9151 @item -fconserve-stack
9152 @opindex fconserve-stack
9153 Attempt to minimize stack usage. The compiler attempts to use less
9154 stack space, even if that makes the program slower. This option
9155 implies setting the @option{large-stack-frame} parameter to 100
9156 and the @option{large-stack-frame-growth} parameter to 400.
9157
9158 @item -ftree-reassoc
9159 @opindex ftree-reassoc
9160 Perform reassociation on trees. This flag is enabled by default
9161 at @option{-O} and higher.
9162
9163 @item -fcode-hoisting
9164 @opindex fcode-hoisting
9165 Perform code hoisting. Code hoisting tries to move the
9166 evaluation of expressions executed on all paths to the function exit
9167 as early as possible. This is especially useful as a code size
9168 optimization, but it often helps for code speed as well.
9169 This flag is enabled by default at @option{-O2} and higher.
9170
9171 @item -ftree-pre
9172 @opindex ftree-pre
9173 Perform partial redundancy elimination (PRE) on trees. This flag is
9174 enabled by default at @option{-O2} and @option{-O3}.
9175
9176 @item -ftree-partial-pre
9177 @opindex ftree-partial-pre
9178 Make partial redundancy elimination (PRE) more aggressive. This flag is
9179 enabled by default at @option{-O3}.
9180
9181 @item -ftree-forwprop
9182 @opindex ftree-forwprop
9183 Perform forward propagation on trees. This flag is enabled by default
9184 at @option{-O} and higher.
9185
9186 @item -ftree-fre
9187 @opindex ftree-fre
9188 Perform full redundancy elimination (FRE) on trees. The difference
9189 between FRE and PRE is that FRE only considers expressions
9190 that are computed on all paths leading to the redundant computation.
9191 This analysis is faster than PRE, though it exposes fewer redundancies.
9192 This flag is enabled by default at @option{-O} and higher.
9193
9194 @item -ftree-phiprop
9195 @opindex ftree-phiprop
9196 Perform hoisting of loads from conditional pointers on trees. This
9197 pass is enabled by default at @option{-O} and higher.
9198
9199 @item -fhoist-adjacent-loads
9200 @opindex fhoist-adjacent-loads
9201 Speculatively hoist loads from both branches of an if-then-else if the
9202 loads are from adjacent locations in the same structure and the target
9203 architecture has a conditional move instruction. This flag is enabled
9204 by default at @option{-O2} and higher.
9205
9206 @item -ftree-copy-prop
9207 @opindex ftree-copy-prop
9208 Perform copy propagation on trees. This pass eliminates unnecessary
9209 copy operations. This flag is enabled by default at @option{-O} and
9210 higher.
9211
9212 @item -fipa-pure-const
9213 @opindex fipa-pure-const
9214 Discover which functions are pure or constant.
9215 Enabled by default at @option{-O} and higher.
9216
9217 @item -fipa-reference
9218 @opindex fipa-reference
9219 Discover which static variables do not escape the
9220 compilation unit.
9221 Enabled by default at @option{-O} and higher.
9222
9223 @item -fipa-reference-addressable
9224 @opindex fipa-reference-addressable
9225 Discover read-only, write-only and non-addressable static variables.
9226 Enabled by default at @option{-O} and higher.
9227
9228 @item -fipa-stack-alignment
9229 @opindex fipa-stack-alignment
9230 Reduce stack alignment on call sites if possible.
9231 Enabled by default.
9232
9233 @item -fipa-pta
9234 @opindex fipa-pta
9235 Perform interprocedural pointer analysis and interprocedural modification
9236 and reference analysis. This option can cause excessive memory and
9237 compile-time usage on large compilation units. It is not enabled by
9238 default at any optimization level.
9239
9240 @item -fipa-profile
9241 @opindex fipa-profile
9242 Perform interprocedural profile propagation. The functions called only from
9243 cold functions are marked as cold. Also functions executed once (such as
9244 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9245 functions and loop less parts of functions executed once are then optimized for
9246 size.
9247 Enabled by default at @option{-O} and higher.
9248
9249 @item -fipa-cp
9250 @opindex fipa-cp
9251 Perform interprocedural constant propagation.
9252 This optimization analyzes the program to determine when values passed
9253 to functions are constants and then optimizes accordingly.
9254 This optimization can substantially increase performance
9255 if the application has constants passed to functions.
9256 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9257 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9258
9259 @item -fipa-cp-clone
9260 @opindex fipa-cp-clone
9261 Perform function cloning to make interprocedural constant propagation stronger.
9262 When enabled, interprocedural constant propagation performs function cloning
9263 when externally visible function can be called with constant arguments.
9264 Because this optimization can create multiple copies of functions,
9265 it may significantly increase code size
9266 (see @option{--param ipcp-unit-growth=@var{value}}).
9267 This flag is enabled by default at @option{-O3}.
9268 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9269
9270 @item -fipa-bit-cp
9271 @opindex fipa-bit-cp
9272 When enabled, perform interprocedural bitwise constant
9273 propagation. This flag is enabled by default at @option{-O2} and
9274 by @option{-fprofile-use} and @option{-fauto-profile}.
9275 It requires that @option{-fipa-cp} is enabled.
9276
9277 @item -fipa-vrp
9278 @opindex fipa-vrp
9279 When enabled, perform interprocedural propagation of value
9280 ranges. This flag is enabled by default at @option{-O2}. It requires
9281 that @option{-fipa-cp} is enabled.
9282
9283 @item -fipa-icf
9284 @opindex fipa-icf
9285 Perform Identical Code Folding for functions and read-only variables.
9286 The optimization reduces code size and may disturb unwind stacks by replacing
9287 a function by equivalent one with a different name. The optimization works
9288 more effectively with link-time optimization enabled.
9289
9290 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
9291 works on different levels and thus the optimizations are not same - there are
9292 equivalences that are found only by GCC and equivalences found only by Gold.
9293
9294 This flag is enabled by default at @option{-O2} and @option{-Os}.
9295
9296 @item -flive-patching=@var{level}
9297 @opindex flive-patching
9298 Control GCC's optimizations to provide a safe compilation for live-patching.
9299
9300 If the compiler's optimization uses a function's body or information extracted
9301 from its body to optimize/change another function, the latter is called an
9302 impacted function of the former. If a function is patched, its impacted
9303 functions should be patched too.
9304
9305 The impacted functions are decided by the compiler's interprocedural
9306 optimizations. For example, inlining a function into its caller, cloning
9307 a function and changing its caller to call this new clone, or extracting
9308 a function's pureness/constness information to optimize its direct or
9309 indirect callers, etc.
9310
9311 Usually, the more IPA optimizations enabled, the larger the number of
9312 impacted functions for each function. In order to control the number of
9313 impacted functions and computed the list of impacted function easily,
9314 we provide control to partially enable IPA optimizations on two different
9315 levels.
9316
9317 The @var{level} argument should be one of the following:
9318
9319 @table @samp
9320
9321 @item inline-clone
9322
9323 Only enable inlining and cloning optimizations, which includes inlining,
9324 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9325 As a result, when patching a function, all its callers and its clones'
9326 callers need to be patched as well.
9327
9328 @option{-flive-patching=inline-clone} disables the following optimization flags:
9329 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9330 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9331 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9332 -fipa-stack-alignment}
9333
9334 @item inline-only-static
9335
9336 Only enable inlining of static functions.
9337 As a result, when patching a static function, all its callers need to be
9338 patches as well.
9339
9340 In addition to all the flags that -flive-patching=inline-clone disables,
9341 @option{-flive-patching=inline-only-static} disables the following additional
9342 optimization flags:
9343 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9344
9345 @end table
9346
9347 When -flive-patching specified without any value, the default value
9348 is "inline-clone".
9349
9350 This flag is disabled by default.
9351
9352 Note that -flive-patching is not supported with link-time optimizer.
9353 (@option{-flto}).
9354
9355 @item -fisolate-erroneous-paths-dereference
9356 @opindex fisolate-erroneous-paths-dereference
9357 Detect paths that trigger erroneous or undefined behavior due to
9358 dereferencing a null pointer. Isolate those paths from the main control
9359 flow and turn the statement with erroneous or undefined behavior into a trap.
9360 This flag is enabled by default at @option{-O2} and higher and depends on
9361 @option{-fdelete-null-pointer-checks} also being enabled.
9362
9363 @item -fisolate-erroneous-paths-attribute
9364 @opindex fisolate-erroneous-paths-attribute
9365 Detect paths that trigger erroneous or undefined behavior due to a null value
9366 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9367 attribute. Isolate those paths from the main control flow and turn the
9368 statement with erroneous or undefined behavior into a trap. This is not
9369 currently enabled, but may be enabled by @option{-O2} in the future.
9370
9371 @item -ftree-sink
9372 @opindex ftree-sink
9373 Perform forward store motion on trees. This flag is
9374 enabled by default at @option{-O} and higher.
9375
9376 @item -ftree-bit-ccp
9377 @opindex ftree-bit-ccp
9378 Perform sparse conditional bit constant propagation on trees and propagate
9379 pointer alignment information.
9380 This pass only operates on local scalar variables and is enabled by default
9381 at @option{-O1} and higher, except for @option{-Og}.
9382 It requires that @option{-ftree-ccp} is enabled.
9383
9384 @item -ftree-ccp
9385 @opindex ftree-ccp
9386 Perform sparse conditional constant propagation (CCP) on trees. This
9387 pass only operates on local scalar variables and is enabled by default
9388 at @option{-O} and higher.
9389
9390 @item -fssa-backprop
9391 @opindex fssa-backprop
9392 Propagate information about uses of a value up the definition chain
9393 in order to simplify the definitions. For example, this pass strips
9394 sign operations if the sign of a value never matters. The flag is
9395 enabled by default at @option{-O} and higher.
9396
9397 @item -fssa-phiopt
9398 @opindex fssa-phiopt
9399 Perform pattern matching on SSA PHI nodes to optimize conditional
9400 code. This pass is enabled by default at @option{-O1} and higher,
9401 except for @option{-Og}.
9402
9403 @item -ftree-switch-conversion
9404 @opindex ftree-switch-conversion
9405 Perform conversion of simple initializations in a switch to
9406 initializations from a scalar array. This flag is enabled by default
9407 at @option{-O2} and higher.
9408
9409 @item -ftree-tail-merge
9410 @opindex ftree-tail-merge
9411 Look for identical code sequences. When found, replace one with a jump to the
9412 other. This optimization is known as tail merging or cross jumping. This flag
9413 is enabled by default at @option{-O2} and higher. The compilation time
9414 in this pass can
9415 be limited using @option{max-tail-merge-comparisons} parameter and
9416 @option{max-tail-merge-iterations} parameter.
9417
9418 @item -ftree-dce
9419 @opindex ftree-dce
9420 Perform dead code elimination (DCE) on trees. This flag is enabled by
9421 default at @option{-O} and higher.
9422
9423 @item -ftree-builtin-call-dce
9424 @opindex ftree-builtin-call-dce
9425 Perform conditional dead code elimination (DCE) for calls to built-in functions
9426 that may set @code{errno} but are otherwise free of side effects. This flag is
9427 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9428 specified.
9429
9430 @item -ftree-dominator-opts
9431 @opindex ftree-dominator-opts
9432 Perform a variety of simple scalar cleanups (constant/copy
9433 propagation, redundancy elimination, range propagation and expression
9434 simplification) based on a dominator tree traversal. This also
9435 performs jump threading (to reduce jumps to jumps). This flag is
9436 enabled by default at @option{-O} and higher.
9437
9438 @item -ftree-dse
9439 @opindex ftree-dse
9440 Perform dead store elimination (DSE) on trees. A dead store is a store into
9441 a memory location that is later overwritten by another store without
9442 any intervening loads. In this case the earlier store can be deleted. This
9443 flag is enabled by default at @option{-O} and higher.
9444
9445 @item -ftree-ch
9446 @opindex ftree-ch
9447 Perform loop header copying on trees. This is beneficial since it increases
9448 effectiveness of code motion optimizations. It also saves one jump. This flag
9449 is enabled by default at @option{-O} and higher. It is not enabled
9450 for @option{-Os}, since it usually increases code size.
9451
9452 @item -ftree-loop-optimize
9453 @opindex ftree-loop-optimize
9454 Perform loop optimizations on trees. This flag is enabled by default
9455 at @option{-O} and higher.
9456
9457 @item -ftree-loop-linear
9458 @itemx -floop-strip-mine
9459 @itemx -floop-block
9460 @opindex ftree-loop-linear
9461 @opindex floop-strip-mine
9462 @opindex floop-block
9463 Perform loop nest optimizations. Same as
9464 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9465 to be configured with @option{--with-isl} to enable the Graphite loop
9466 transformation infrastructure.
9467
9468 @item -fgraphite-identity
9469 @opindex fgraphite-identity
9470 Enable the identity transformation for graphite. For every SCoP we generate
9471 the polyhedral representation and transform it back to gimple. Using
9472 @option{-fgraphite-identity} we can check the costs or benefits of the
9473 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9474 are also performed by the code generator isl, like index splitting and
9475 dead code elimination in loops.
9476
9477 @item -floop-nest-optimize
9478 @opindex floop-nest-optimize
9479 Enable the isl based loop nest optimizer. This is a generic loop nest
9480 optimizer based on the Pluto optimization algorithms. It calculates a loop
9481 structure optimized for data-locality and parallelism. This option
9482 is experimental.
9483
9484 @item -floop-parallelize-all
9485 @opindex floop-parallelize-all
9486 Use the Graphite data dependence analysis to identify loops that can
9487 be parallelized. Parallelize all the loops that can be analyzed to
9488 not contain loop carried dependences without checking that it is
9489 profitable to parallelize the loops.
9490
9491 @item -ftree-coalesce-vars
9492 @opindex ftree-coalesce-vars
9493 While transforming the program out of the SSA representation, attempt to
9494 reduce copying by coalescing versions of different user-defined
9495 variables, instead of just compiler temporaries. This may severely
9496 limit the ability to debug an optimized program compiled with
9497 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9498 prevents SSA coalescing of user variables. This option is enabled by
9499 default if optimization is enabled, and it does very little otherwise.
9500
9501 @item -ftree-loop-if-convert
9502 @opindex ftree-loop-if-convert
9503 Attempt to transform conditional jumps in the innermost loops to
9504 branch-less equivalents. The intent is to remove control-flow from
9505 the innermost loops in order to improve the ability of the
9506 vectorization pass to handle these loops. This is enabled by default
9507 if vectorization is enabled.
9508
9509 @item -ftree-loop-distribution
9510 @opindex ftree-loop-distribution
9511 Perform loop distribution. This flag can improve cache performance on
9512 big loop bodies and allow further loop optimizations, like
9513 parallelization or vectorization, to take place. For example, the loop
9514 @smallexample
9515 DO I = 1, N
9516 A(I) = B(I) + C
9517 D(I) = E(I) * F
9518 ENDDO
9519 @end smallexample
9520 is transformed to
9521 @smallexample
9522 DO I = 1, N
9523 A(I) = B(I) + C
9524 ENDDO
9525 DO I = 1, N
9526 D(I) = E(I) * F
9527 ENDDO
9528 @end smallexample
9529
9530 @item -ftree-loop-distribute-patterns
9531 @opindex ftree-loop-distribute-patterns
9532 Perform loop distribution of patterns that can be code generated with
9533 calls to a library. This flag is enabled by default at @option{-O3}, and
9534 by @option{-fprofile-use} and @option{-fauto-profile}.
9535
9536 This pass distributes the initialization loops and generates a call to
9537 memset zero. For example, the loop
9538 @smallexample
9539 DO I = 1, N
9540 A(I) = 0
9541 B(I) = A(I) + I
9542 ENDDO
9543 @end smallexample
9544 is transformed to
9545 @smallexample
9546 DO I = 1, N
9547 A(I) = 0
9548 ENDDO
9549 DO I = 1, N
9550 B(I) = A(I) + I
9551 ENDDO
9552 @end smallexample
9553 and the initialization loop is transformed into a call to memset zero.
9554
9555 @item -floop-interchange
9556 @opindex floop-interchange
9557 Perform loop interchange outside of graphite. This flag can improve cache
9558 performance on loop nest and allow further loop optimizations, like
9559 vectorization, to take place. For example, the loop
9560 @smallexample
9561 for (int i = 0; i < N; i++)
9562 for (int j = 0; j < N; j++)
9563 for (int k = 0; k < N; k++)
9564 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9565 @end smallexample
9566 is transformed to
9567 @smallexample
9568 for (int i = 0; i < N; i++)
9569 for (int k = 0; k < N; k++)
9570 for (int j = 0; j < N; j++)
9571 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9572 @end smallexample
9573 This flag is enabled by default at @option{-O3}.
9574
9575 @item -floop-unroll-and-jam
9576 @opindex floop-unroll-and-jam
9577 Apply unroll and jam transformations on feasible loops. In a loop
9578 nest this unrolls the outer loop by some factor and fuses the resulting
9579 multiple inner loops. This flag is enabled by default at @option{-O3}.
9580
9581 @item -ftree-loop-im
9582 @opindex ftree-loop-im
9583 Perform loop invariant motion on trees. This pass moves only invariants that
9584 are hard to handle at RTL level (function calls, operations that expand to
9585 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9586 operands of conditions that are invariant out of the loop, so that we can use
9587 just trivial invariantness analysis in loop unswitching. The pass also includes
9588 store motion.
9589
9590 @item -ftree-loop-ivcanon
9591 @opindex ftree-loop-ivcanon
9592 Create a canonical counter for number of iterations in loops for which
9593 determining number of iterations requires complicated analysis. Later
9594 optimizations then may determine the number easily. Useful especially
9595 in connection with unrolling.
9596
9597 @item -ftree-scev-cprop
9598 @opindex ftree-scev-cprop
9599 Perform final value replacement. If a variable is modified in a loop
9600 in such a way that its value when exiting the loop can be determined using
9601 only its initial value and the number of loop iterations, replace uses of
9602 the final value by such a computation, provided it is sufficiently cheap.
9603 This reduces data dependencies and may allow further simplifications.
9604 Enabled by default at @option{-O} and higher.
9605
9606 @item -fivopts
9607 @opindex fivopts
9608 Perform induction variable optimizations (strength reduction, induction
9609 variable merging and induction variable elimination) on trees.
9610
9611 @item -ftree-parallelize-loops=n
9612 @opindex ftree-parallelize-loops
9613 Parallelize loops, i.e., split their iteration space to run in n threads.
9614 This is only possible for loops whose iterations are independent
9615 and can be arbitrarily reordered. The optimization is only
9616 profitable on multiprocessor machines, for loops that are CPU-intensive,
9617 rather than constrained e.g.@: by memory bandwidth. This option
9618 implies @option{-pthread}, and thus is only supported on targets
9619 that have support for @option{-pthread}.
9620
9621 @item -ftree-pta
9622 @opindex ftree-pta
9623 Perform function-local points-to analysis on trees. This flag is
9624 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9625
9626 @item -ftree-sra
9627 @opindex ftree-sra
9628 Perform scalar replacement of aggregates. This pass replaces structure
9629 references with scalars to prevent committing structures to memory too
9630 early. This flag is enabled by default at @option{-O1} and higher,
9631 except for @option{-Og}.
9632
9633 @item -fstore-merging
9634 @opindex fstore-merging
9635 Perform merging of narrow stores to consecutive memory addresses. This pass
9636 merges contiguous stores of immediate values narrower than a word into fewer
9637 wider stores to reduce the number of instructions. This is enabled by default
9638 at @option{-O2} and higher as well as @option{-Os}.
9639
9640 @item -ftree-ter
9641 @opindex ftree-ter
9642 Perform temporary expression replacement during the SSA->normal phase. Single
9643 use/single def temporaries are replaced at their use location with their
9644 defining expression. This results in non-GIMPLE code, but gives the expanders
9645 much more complex trees to work on resulting in better RTL generation. This is
9646 enabled by default at @option{-O} and higher.
9647
9648 @item -ftree-slsr
9649 @opindex ftree-slsr
9650 Perform straight-line strength reduction on trees. This recognizes related
9651 expressions involving multiplications and replaces them by less expensive
9652 calculations when possible. This is enabled by default at @option{-O} and
9653 higher.
9654
9655 @item -ftree-vectorize
9656 @opindex ftree-vectorize
9657 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9658 and @option{-ftree-slp-vectorize} if not explicitly specified.
9659
9660 @item -ftree-loop-vectorize
9661 @opindex ftree-loop-vectorize
9662 Perform loop vectorization on trees. This flag is enabled by default at
9663 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9664 and @option{-fauto-profile}.
9665
9666 @item -ftree-slp-vectorize
9667 @opindex ftree-slp-vectorize
9668 Perform basic block vectorization on trees. This flag is enabled by default at
9669 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9670 and @option{-fauto-profile}.
9671
9672 @item -fvect-cost-model=@var{model}
9673 @opindex fvect-cost-model
9674 Alter the cost model used for vectorization. The @var{model} argument
9675 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9676 With the @samp{unlimited} model the vectorized code-path is assumed
9677 to be profitable while with the @samp{dynamic} model a runtime check
9678 guards the vectorized code-path to enable it only for iteration
9679 counts that will likely execute faster than when executing the original
9680 scalar loop. The @samp{cheap} model disables vectorization of
9681 loops where doing so would be cost prohibitive for example due to
9682 required runtime checks for data dependence or alignment but otherwise
9683 is equal to the @samp{dynamic} model.
9684 The default cost model depends on other optimization flags and is
9685 either @samp{dynamic} or @samp{cheap}.
9686
9687 @item -fsimd-cost-model=@var{model}
9688 @opindex fsimd-cost-model
9689 Alter the cost model used for vectorization of loops marked with the OpenMP
9690 simd directive. The @var{model} argument should be one of
9691 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9692 have the same meaning as described in @option{-fvect-cost-model} and by
9693 default a cost model defined with @option{-fvect-cost-model} is used.
9694
9695 @item -ftree-vrp
9696 @opindex ftree-vrp
9697 Perform Value Range Propagation on trees. This is similar to the
9698 constant propagation pass, but instead of values, ranges of values are
9699 propagated. This allows the optimizers to remove unnecessary range
9700 checks like array bound checks and null pointer checks. This is
9701 enabled by default at @option{-O2} and higher. Null pointer check
9702 elimination is only done if @option{-fdelete-null-pointer-checks} is
9703 enabled.
9704
9705 @item -fsplit-paths
9706 @opindex fsplit-paths
9707 Split paths leading to loop backedges. This can improve dead code
9708 elimination and common subexpression elimination. This is enabled by
9709 default at @option{-O2} and above.
9710
9711 @item -fsplit-ivs-in-unroller
9712 @opindex fsplit-ivs-in-unroller
9713 Enables expression of values of induction variables in later iterations
9714 of the unrolled loop using the value in the first iteration. This breaks
9715 long dependency chains, thus improving efficiency of the scheduling passes.
9716
9717 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9718 same effect. However, that is not reliable in cases where the loop body
9719 is more complicated than a single basic block. It also does not work at all
9720 on some architectures due to restrictions in the CSE pass.
9721
9722 This optimization is enabled by default.
9723
9724 @item -fvariable-expansion-in-unroller
9725 @opindex fvariable-expansion-in-unroller
9726 With this option, the compiler creates multiple copies of some
9727 local variables when unrolling a loop, which can result in superior code.
9728
9729 @item -fpartial-inlining
9730 @opindex fpartial-inlining
9731 Inline parts of functions. This option has any effect only
9732 when inlining itself is turned on by the @option{-finline-functions}
9733 or @option{-finline-small-functions} options.
9734
9735 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9736
9737 @item -fpredictive-commoning
9738 @opindex fpredictive-commoning
9739 Perform predictive commoning optimization, i.e., reusing computations
9740 (especially memory loads and stores) performed in previous
9741 iterations of loops.
9742
9743 This option is enabled at level @option{-O3}.
9744 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9745
9746 @item -fprefetch-loop-arrays
9747 @opindex fprefetch-loop-arrays
9748 If supported by the target machine, generate instructions to prefetch
9749 memory to improve the performance of loops that access large arrays.
9750
9751 This option may generate better or worse code; results are highly
9752 dependent on the structure of loops within the source code.
9753
9754 Disabled at level @option{-Os}.
9755
9756 @item -fno-printf-return-value
9757 @opindex fno-printf-return-value
9758 @opindex fprintf-return-value
9759 Do not substitute constants for known return value of formatted output
9760 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9761 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9762 transformation allows GCC to optimize or even eliminate branches based
9763 on the known return value of these functions called with arguments that
9764 are either constant, or whose values are known to be in a range that
9765 makes determining the exact return value possible. For example, when
9766 @option{-fprintf-return-value} is in effect, both the branch and the
9767 body of the @code{if} statement (but not the call to @code{snprint})
9768 can be optimized away when @code{i} is a 32-bit or smaller integer
9769 because the return value is guaranteed to be at most 8.
9770
9771 @smallexample
9772 char buf[9];
9773 if (snprintf (buf, "%08x", i) >= sizeof buf)
9774 @dots{}
9775 @end smallexample
9776
9777 The @option{-fprintf-return-value} option relies on other optimizations
9778 and yields best results with @option{-O2} and above. It works in tandem
9779 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9780 options. The @option{-fprintf-return-value} option is enabled by default.
9781
9782 @item -fno-peephole
9783 @itemx -fno-peephole2
9784 @opindex fno-peephole
9785 @opindex fpeephole
9786 @opindex fno-peephole2
9787 @opindex fpeephole2
9788 Disable any machine-specific peephole optimizations. The difference
9789 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9790 are implemented in the compiler; some targets use one, some use the
9791 other, a few use both.
9792
9793 @option{-fpeephole} is enabled by default.
9794 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9795
9796 @item -fno-guess-branch-probability
9797 @opindex fno-guess-branch-probability
9798 @opindex fguess-branch-probability
9799 Do not guess branch probabilities using heuristics.
9800
9801 GCC uses heuristics to guess branch probabilities if they are
9802 not provided by profiling feedback (@option{-fprofile-arcs}). These
9803 heuristics are based on the control flow graph. If some branch probabilities
9804 are specified by @code{__builtin_expect}, then the heuristics are
9805 used to guess branch probabilities for the rest of the control flow graph,
9806 taking the @code{__builtin_expect} info into account. The interactions
9807 between the heuristics and @code{__builtin_expect} can be complex, and in
9808 some cases, it may be useful to disable the heuristics so that the effects
9809 of @code{__builtin_expect} are easier to understand.
9810
9811 It is also possible to specify expected probability of the expression
9812 with @code{__builtin_expect_with_probability} built-in function.
9813
9814 The default is @option{-fguess-branch-probability} at levels
9815 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9816
9817 @item -freorder-blocks
9818 @opindex freorder-blocks
9819 Reorder basic blocks in the compiled function in order to reduce number of
9820 taken branches and improve code locality.
9821
9822 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9823
9824 @item -freorder-blocks-algorithm=@var{algorithm}
9825 @opindex freorder-blocks-algorithm
9826 Use the specified algorithm for basic block reordering. The
9827 @var{algorithm} argument can be @samp{simple}, which does not increase
9828 code size (except sometimes due to secondary effects like alignment),
9829 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9830 put all often executed code together, minimizing the number of branches
9831 executed by making extra copies of code.
9832
9833 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9834 @samp{stc} at levels @option{-O2}, @option{-O3}.
9835
9836 @item -freorder-blocks-and-partition
9837 @opindex freorder-blocks-and-partition
9838 In addition to reordering basic blocks in the compiled function, in order
9839 to reduce number of taken branches, partitions hot and cold basic blocks
9840 into separate sections of the assembly and @file{.o} files, to improve
9841 paging and cache locality performance.
9842
9843 This optimization is automatically turned off in the presence of
9844 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9845 section attribute and on any architecture that does not support named
9846 sections. When @option{-fsplit-stack} is used this option is not
9847 enabled by default (to avoid linker errors), but may be enabled
9848 explicitly (if using a working linker).
9849
9850 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9851
9852 @item -freorder-functions
9853 @opindex freorder-functions
9854 Reorder functions in the object file in order to
9855 improve code locality. This is implemented by using special
9856 subsections @code{.text.hot} for most frequently executed functions and
9857 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9858 the linker so object file format must support named sections and linker must
9859 place them in a reasonable way.
9860
9861 This option isn't effective unless you either provide profile feedback
9862 (see @option{-fprofile-arcs} for details) or manually annotate functions with
9863 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
9864
9865 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9866
9867 @item -fstrict-aliasing
9868 @opindex fstrict-aliasing
9869 Allow the compiler to assume the strictest aliasing rules applicable to
9870 the language being compiled. For C (and C++), this activates
9871 optimizations based on the type of expressions. In particular, an
9872 object of one type is assumed never to reside at the same address as an
9873 object of a different type, unless the types are almost the same. For
9874 example, an @code{unsigned int} can alias an @code{int}, but not a
9875 @code{void*} or a @code{double}. A character type may alias any other
9876 type.
9877
9878 @anchor{Type-punning}Pay special attention to code like this:
9879 @smallexample
9880 union a_union @{
9881 int i;
9882 double d;
9883 @};
9884
9885 int f() @{
9886 union a_union t;
9887 t.d = 3.0;
9888 return t.i;
9889 @}
9890 @end smallexample
9891 The practice of reading from a different union member than the one most
9892 recently written to (called ``type-punning'') is common. Even with
9893 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9894 is accessed through the union type. So, the code above works as
9895 expected. @xref{Structures unions enumerations and bit-fields
9896 implementation}. However, this code might not:
9897 @smallexample
9898 int f() @{
9899 union a_union t;
9900 int* ip;
9901 t.d = 3.0;
9902 ip = &t.i;
9903 return *ip;
9904 @}
9905 @end smallexample
9906
9907 Similarly, access by taking the address, casting the resulting pointer
9908 and dereferencing the result has undefined behavior, even if the cast
9909 uses a union type, e.g.:
9910 @smallexample
9911 int f() @{
9912 double d = 3.0;
9913 return ((union a_union *) &d)->i;
9914 @}
9915 @end smallexample
9916
9917 The @option{-fstrict-aliasing} option is enabled at levels
9918 @option{-O2}, @option{-O3}, @option{-Os}.
9919
9920 @item -falign-functions
9921 @itemx -falign-functions=@var{n}
9922 @itemx -falign-functions=@var{n}:@var{m}
9923 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
9924 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
9925 @opindex falign-functions
9926 Align the start of functions to the next power-of-two greater than
9927 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
9928 the first @var{m} bytes of the function can be fetched by the CPU
9929 without crossing an @var{n}-byte alignment boundary.
9930
9931 If @var{m} is not specified, it defaults to @var{n}.
9932
9933 Examples: @option{-falign-functions=32} aligns functions to the next
9934 32-byte boundary, @option{-falign-functions=24} aligns to the next
9935 32-byte boundary only if this can be done by skipping 23 bytes or less,
9936 @option{-falign-functions=32:7} aligns to the next
9937 32-byte boundary only if this can be done by skipping 6 bytes or less.
9938
9939 The second pair of @var{n2}:@var{m2} values allows you to specify
9940 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
9941 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
9942 otherwise aligns to the next 32-byte boundary if this can be done
9943 by skipping 2 bytes or less.
9944 If @var{m2} is not specified, it defaults to @var{n2}.
9945
9946 Some assemblers only support this flag when @var{n} is a power of two;
9947 in that case, it is rounded up.
9948
9949 @option{-fno-align-functions} and @option{-falign-functions=1} are
9950 equivalent and mean that functions are not aligned.
9951
9952 If @var{n} is not specified or is zero, use a machine-dependent default.
9953 The maximum allowed @var{n} option value is 65536.
9954
9955 Enabled at levels @option{-O2}, @option{-O3}.
9956
9957 @item -flimit-function-alignment
9958 If this option is enabled, the compiler tries to avoid unnecessarily
9959 overaligning functions. It attempts to instruct the assembler to align
9960 by the amount specified by @option{-falign-functions}, but not to
9961 skip more bytes than the size of the function.
9962
9963 @item -falign-labels
9964 @itemx -falign-labels=@var{n}
9965 @itemx -falign-labels=@var{n}:@var{m}
9966 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
9967 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
9968 @opindex falign-labels
9969 Align all branch targets to a power-of-two boundary.
9970
9971 Parameters of this option are analogous to the @option{-falign-functions} option.
9972 @option{-fno-align-labels} and @option{-falign-labels=1} are
9973 equivalent and mean that labels are not aligned.
9974
9975 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9976 are greater than this value, then their values are used instead.
9977
9978 If @var{n} is not specified or is zero, use a machine-dependent default
9979 which is very likely to be @samp{1}, meaning no alignment.
9980 The maximum allowed @var{n} option value is 65536.
9981
9982 Enabled at levels @option{-O2}, @option{-O3}.
9983
9984 @item -falign-loops
9985 @itemx -falign-loops=@var{n}
9986 @itemx -falign-loops=@var{n}:@var{m}
9987 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
9988 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
9989 @opindex falign-loops
9990 Align loops to a power-of-two boundary. If the loops are executed
9991 many times, this makes up for any execution of the dummy padding
9992 instructions.
9993
9994 Parameters of this option are analogous to the @option{-falign-functions} option.
9995 @option{-fno-align-loops} and @option{-falign-loops=1} are
9996 equivalent and mean that loops are not aligned.
9997 The maximum allowed @var{n} option value is 65536.
9998
9999 If @var{n} is not specified or is zero, use a machine-dependent default.
10000
10001 Enabled at levels @option{-O2}, @option{-O3}.
10002
10003 @item -falign-jumps
10004 @itemx -falign-jumps=@var{n}
10005 @itemx -falign-jumps=@var{n}:@var{m}
10006 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10007 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10008 @opindex falign-jumps
10009 Align branch targets to a power-of-two boundary, for branch targets
10010 where the targets can only be reached by jumping. In this case,
10011 no dummy operations need be executed.
10012
10013 Parameters of this option are analogous to the @option{-falign-functions} option.
10014 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10015 equivalent and mean that loops are not aligned.
10016
10017 If @var{n} is not specified or is zero, use a machine-dependent default.
10018 The maximum allowed @var{n} option value is 65536.
10019
10020 Enabled at levels @option{-O2}, @option{-O3}.
10021
10022 @item -funit-at-a-time
10023 @opindex funit-at-a-time
10024 This option is left for compatibility reasons. @option{-funit-at-a-time}
10025 has no effect, while @option{-fno-unit-at-a-time} implies
10026 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10027
10028 Enabled by default.
10029
10030 @item -fno-toplevel-reorder
10031 @opindex fno-toplevel-reorder
10032 @opindex ftoplevel-reorder
10033 Do not reorder top-level functions, variables, and @code{asm}
10034 statements. Output them in the same order that they appear in the
10035 input file. When this option is used, unreferenced static variables
10036 are not removed. This option is intended to support existing code
10037 that relies on a particular ordering. For new code, it is better to
10038 use attributes when possible.
10039
10040 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10041 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10042 Additionally @option{-fno-toplevel-reorder} implies
10043 @option{-fno-section-anchors}.
10044
10045 @item -fweb
10046 @opindex fweb
10047 Constructs webs as commonly used for register allocation purposes and assign
10048 each web individual pseudo register. This allows the register allocation pass
10049 to operate on pseudos directly, but also strengthens several other optimization
10050 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10051 however, make debugging impossible, since variables no longer stay in a
10052 ``home register''.
10053
10054 Enabled by default with @option{-funroll-loops}.
10055
10056 @item -fwhole-program
10057 @opindex fwhole-program
10058 Assume that the current compilation unit represents the whole program being
10059 compiled. All public functions and variables with the exception of @code{main}
10060 and those merged by attribute @code{externally_visible} become static functions
10061 and in effect are optimized more aggressively by interprocedural optimizers.
10062
10063 This option should not be used in combination with @option{-flto}.
10064 Instead relying on a linker plugin should provide safer and more precise
10065 information.
10066
10067 @item -flto[=@var{n}]
10068 @opindex flto
10069 This option runs the standard link-time optimizer. When invoked
10070 with source code, it generates GIMPLE (one of GCC's internal
10071 representations) and writes it to special ELF sections in the object
10072 file. When the object files are linked together, all the function
10073 bodies are read from these ELF sections and instantiated as if they
10074 had been part of the same translation unit.
10075
10076 To use the link-time optimizer, @option{-flto} and optimization
10077 options should be specified at compile time and during the final link.
10078 It is recommended that you compile all the files participating in the
10079 same link with the same options and also specify those options at
10080 link time.
10081 For example:
10082
10083 @smallexample
10084 gcc -c -O2 -flto foo.c
10085 gcc -c -O2 -flto bar.c
10086 gcc -o myprog -flto -O2 foo.o bar.o
10087 @end smallexample
10088
10089 The first two invocations to GCC save a bytecode representation
10090 of GIMPLE into special ELF sections inside @file{foo.o} and
10091 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10092 @file{foo.o} and @file{bar.o}, merges the two files into a single
10093 internal image, and compiles the result as usual. Since both
10094 @file{foo.o} and @file{bar.o} are merged into a single image, this
10095 causes all the interprocedural analyses and optimizations in GCC to
10096 work across the two files as if they were a single one. This means,
10097 for example, that the inliner is able to inline functions in
10098 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10099
10100 Another (simpler) way to enable link-time optimization is:
10101
10102 @smallexample
10103 gcc -o myprog -flto -O2 foo.c bar.c
10104 @end smallexample
10105
10106 The above generates bytecode for @file{foo.c} and @file{bar.c},
10107 merges them together into a single GIMPLE representation and optimizes
10108 them as usual to produce @file{myprog}.
10109
10110 The important thing to keep in mind is that to enable link-time
10111 optimizations you need to use the GCC driver to perform the link step.
10112 GCC automatically performs link-time optimization if any of the
10113 objects involved were compiled with the @option{-flto} command-line option.
10114 You can always override
10115 the automatic decision to do link-time optimization
10116 by passing @option{-fno-lto} to the link command.
10117
10118 To make whole program optimization effective, it is necessary to make
10119 certain whole program assumptions. The compiler needs to know
10120 what functions and variables can be accessed by libraries and runtime
10121 outside of the link-time optimized unit. When supported by the linker,
10122 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10123 to the compiler about used and externally visible symbols. When
10124 the linker plugin is not available, @option{-fwhole-program} should be
10125 used to allow the compiler to make these assumptions, which leads
10126 to more aggressive optimization decisions.
10127
10128 When a file is compiled with @option{-flto} without
10129 @option{-fuse-linker-plugin}, the generated object file is larger than
10130 a regular object file because it contains GIMPLE bytecodes and the usual
10131 final code (see @option{-ffat-lto-objects}. This means that
10132 object files with LTO information can be linked as normal object
10133 files; if @option{-fno-lto} is passed to the linker, no
10134 interprocedural optimizations are applied. Note that when
10135 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10136 but you cannot perform a regular, non-LTO link on them.
10137
10138 When producing the final binary, GCC only
10139 applies link-time optimizations to those files that contain bytecode.
10140 Therefore, you can mix and match object files and libraries with
10141 GIMPLE bytecodes and final object code. GCC automatically selects
10142 which files to optimize in LTO mode and which files to link without
10143 further processing.
10144
10145 Generally, options specified at link time override those
10146 specified at compile time, although in some cases GCC attempts to infer
10147 link-time options from the settings used to compile the input files.
10148
10149 If you do not specify an optimization level option @option{-O} at
10150 link time, then GCC uses the highest optimization level
10151 used when compiling the object files. Note that it is generally
10152 ineffective to specify an optimization level option only at link time and
10153 not at compile time, for two reasons. First, compiling without
10154 optimization suppresses compiler passes that gather information
10155 needed for effective optimization at link time. Second, some early
10156 optimization passes can be performed only at compile time and
10157 not at link time.
10158
10159 There are some code generation flags preserved by GCC when
10160 generating bytecodes, as they need to be used during the final link.
10161 Currently, the following options and their settings are taken from
10162 the first object file that explicitly specifies them:
10163 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10164 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10165 and all the @option{-m} target flags.
10166
10167 Certain ABI-changing flags are required to match in all compilation units,
10168 and trying to override this at link time with a conflicting value
10169 is ignored. This includes options such as @option{-freg-struct-return}
10170 and @option{-fpcc-struct-return}.
10171
10172 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10173 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10174 are passed through to the link stage and merged conservatively for
10175 conflicting translation units. Specifically
10176 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10177 precedence; and for example @option{-ffp-contract=off} takes precedence
10178 over @option{-ffp-contract=fast}. You can override them at link time.
10179
10180 If LTO encounters objects with C linkage declared with incompatible
10181 types in separate translation units to be linked together (undefined
10182 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10183 issued. The behavior is still undefined at run time. Similar
10184 diagnostics may be raised for other languages.
10185
10186 Another feature of LTO is that it is possible to apply interprocedural
10187 optimizations on files written in different languages:
10188
10189 @smallexample
10190 gcc -c -flto foo.c
10191 g++ -c -flto bar.cc
10192 gfortran -c -flto baz.f90
10193 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10194 @end smallexample
10195
10196 Notice that the final link is done with @command{g++} to get the C++
10197 runtime libraries and @option{-lgfortran} is added to get the Fortran
10198 runtime libraries. In general, when mixing languages in LTO mode, you
10199 should use the same link command options as when mixing languages in a
10200 regular (non-LTO) compilation.
10201
10202 If object files containing GIMPLE bytecode are stored in a library archive, say
10203 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10204 are using a linker with plugin support. To create static libraries suitable
10205 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10206 and @command{ranlib};
10207 to show the symbols of object files with GIMPLE bytecode, use
10208 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10209 and @command{nm} have been compiled with plugin support. At link time, use the
10210 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10211 the LTO optimization process:
10212
10213 @smallexample
10214 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10215 @end smallexample
10216
10217 With the linker plugin enabled, the linker extracts the needed
10218 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10219 to make them part of the aggregated GIMPLE image to be optimized.
10220
10221 If you are not using a linker with plugin support and/or do not
10222 enable the linker plugin, then the objects inside @file{libfoo.a}
10223 are extracted and linked as usual, but they do not participate
10224 in the LTO optimization process. In order to make a static library suitable
10225 for both LTO optimization and usual linkage, compile its object files with
10226 @option{-flto} @option{-ffat-lto-objects}.
10227
10228 Link-time optimizations do not require the presence of the whole program to
10229 operate. If the program does not require any symbols to be exported, it is
10230 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10231 the interprocedural optimizers to use more aggressive assumptions which may
10232 lead to improved optimization opportunities.
10233 Use of @option{-fwhole-program} is not needed when linker plugin is
10234 active (see @option{-fuse-linker-plugin}).
10235
10236 The current implementation of LTO makes no
10237 attempt to generate bytecode that is portable between different
10238 types of hosts. The bytecode files are versioned and there is a
10239 strict version check, so bytecode files generated in one version of
10240 GCC do not work with an older or newer version of GCC.
10241
10242 Link-time optimization does not work well with generation of debugging
10243 information on systems other than those using a combination of ELF and
10244 DWARF.
10245
10246 If you specify the optional @var{n}, the optimization and code
10247 generation done at link time is executed in parallel using @var{n}
10248 parallel jobs by utilizing an installed @command{make} program. The
10249 environment variable @env{MAKE} may be used to override the program
10250 used. The default value for @var{n} is 1.
10251
10252 You can also specify @option{-flto=jobserver} to use GNU make's
10253 job server mode to determine the number of parallel jobs. This
10254 is useful when the Makefile calling GCC is already executing in parallel.
10255 You must prepend a @samp{+} to the command recipe in the parent Makefile
10256 for this to work. This option likely only works if @env{MAKE} is
10257 GNU make.
10258
10259 @item -flto-partition=@var{alg}
10260 @opindex flto-partition
10261 Specify the partitioning algorithm used by the link-time optimizer.
10262 The value is either @samp{1to1} to specify a partitioning mirroring
10263 the original source files or @samp{balanced} to specify partitioning
10264 into equally sized chunks (whenever possible) or @samp{max} to create
10265 new partition for every symbol where possible. Specifying @samp{none}
10266 as an algorithm disables partitioning and streaming completely.
10267 The default value is @samp{balanced}. While @samp{1to1} can be used
10268 as an workaround for various code ordering issues, the @samp{max}
10269 partitioning is intended for internal testing only.
10270 The value @samp{one} specifies that exactly one partition should be
10271 used while the value @samp{none} bypasses partitioning and executes
10272 the link-time optimization step directly from the WPA phase.
10273
10274 @item -flto-odr-type-merging
10275 @opindex flto-odr-type-merging
10276 Enable streaming of mangled types names of C++ types and their unification
10277 at link time. This increases size of LTO object files, but enables
10278 diagnostics about One Definition Rule violations.
10279
10280 @item -flto-compression-level=@var{n}
10281 @opindex flto-compression-level
10282 This option specifies the level of compression used for intermediate
10283 language written to LTO object files, and is only meaningful in
10284 conjunction with LTO mode (@option{-flto}). Valid
10285 values are 0 (no compression) to 9 (maximum compression). Values
10286 outside this range are clamped to either 0 or 9. If the option is not
10287 given, a default balanced compression setting is used.
10288
10289 @item -fuse-linker-plugin
10290 @opindex fuse-linker-plugin
10291 Enables the use of a linker plugin during link-time optimization. This
10292 option relies on plugin support in the linker, which is available in gold
10293 or in GNU ld 2.21 or newer.
10294
10295 This option enables the extraction of object files with GIMPLE bytecode out
10296 of library archives. This improves the quality of optimization by exposing
10297 more code to the link-time optimizer. This information specifies what
10298 symbols can be accessed externally (by non-LTO object or during dynamic
10299 linking). Resulting code quality improvements on binaries (and shared
10300 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10301 See @option{-flto} for a description of the effect of this flag and how to
10302 use it.
10303
10304 This option is enabled by default when LTO support in GCC is enabled
10305 and GCC was configured for use with
10306 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10307
10308 @item -ffat-lto-objects
10309 @opindex ffat-lto-objects
10310 Fat LTO objects are object files that contain both the intermediate language
10311 and the object code. This makes them usable for both LTO linking and normal
10312 linking. This option is effective only when compiling with @option{-flto}
10313 and is ignored at link time.
10314
10315 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10316 requires the complete toolchain to be aware of LTO. It requires a linker with
10317 linker plugin support for basic functionality. Additionally,
10318 @command{nm}, @command{ar} and @command{ranlib}
10319 need to support linker plugins to allow a full-featured build environment
10320 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10321 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10322 to these tools. With non fat LTO makefiles need to be modified to use them.
10323
10324 Note that modern binutils provide plugin auto-load mechanism.
10325 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10326 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10327 @command{gcc-ranlib}).
10328
10329 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10330 support.
10331
10332 @item -fcompare-elim
10333 @opindex fcompare-elim
10334 After register allocation and post-register allocation instruction splitting,
10335 identify arithmetic instructions that compute processor flags similar to a
10336 comparison operation based on that arithmetic. If possible, eliminate the
10337 explicit comparison operation.
10338
10339 This pass only applies to certain targets that cannot explicitly represent
10340 the comparison operation before register allocation is complete.
10341
10342 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10343
10344 @item -fcprop-registers
10345 @opindex fcprop-registers
10346 After register allocation and post-register allocation instruction splitting,
10347 perform a copy-propagation pass to try to reduce scheduling dependencies
10348 and occasionally eliminate the copy.
10349
10350 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10351
10352 @item -fprofile-correction
10353 @opindex fprofile-correction
10354 Profiles collected using an instrumented binary for multi-threaded programs may
10355 be inconsistent due to missed counter updates. When this option is specified,
10356 GCC uses heuristics to correct or smooth out such inconsistencies. By
10357 default, GCC emits an error message when an inconsistent profile is detected.
10358
10359 This option is enabled by @option{-fauto-profile}.
10360
10361 @item -fprofile-use
10362 @itemx -fprofile-use=@var{path}
10363 @opindex fprofile-use
10364 Enable profile feedback-directed optimizations,
10365 and the following optimizations, many of which
10366 are generally profitable only with profile feedback available:
10367
10368 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10369 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10370 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10371 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10372 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10373 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10374 -fprofile-reorder-functions}
10375
10376 Before you can use this option, you must first generate profiling information.
10377 @xref{Instrumentation Options}, for information about the
10378 @option{-fprofile-generate} option.
10379
10380 By default, GCC emits an error message if the feedback profiles do not
10381 match the source code. This error can be turned into a warning by using
10382 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10383 optimized code. Additionally, by default, GCC also emits a warning message if
10384 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10385
10386 If @var{path} is specified, GCC looks at the @var{path} to find
10387 the profile feedback data files. See @option{-fprofile-dir}.
10388
10389 @item -fauto-profile
10390 @itemx -fauto-profile=@var{path}
10391 @opindex fauto-profile
10392 Enable sampling-based feedback-directed optimizations,
10393 and the following optimizations,
10394 many of which are generally profitable only with profile feedback available:
10395
10396 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10397 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10398 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10399 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10400 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10401 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10402 -fprofile-correction}
10403
10404 @var{path} is the name of a file containing AutoFDO profile information.
10405 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10406
10407 Producing an AutoFDO profile data file requires running your program
10408 with the @command{perf} utility on a supported GNU/Linux target system.
10409 For more information, see @uref{https://perf.wiki.kernel.org/}.
10410
10411 E.g.
10412 @smallexample
10413 perf record -e br_inst_retired:near_taken -b -o perf.data \
10414 -- your_program
10415 @end smallexample
10416
10417 Then use the @command{create_gcov} tool to convert the raw profile data
10418 to a format that can be used by GCC.@ You must also supply the
10419 unstripped binary for your program to this tool.
10420 See @uref{https://github.com/google/autofdo}.
10421
10422 E.g.
10423 @smallexample
10424 create_gcov --binary=your_program.unstripped --profile=perf.data \
10425 --gcov=profile.afdo
10426 @end smallexample
10427 @end table
10428
10429 The following options control compiler behavior regarding floating-point
10430 arithmetic. These options trade off between speed and
10431 correctness. All must be specifically enabled.
10432
10433 @table @gcctabopt
10434 @item -ffloat-store
10435 @opindex ffloat-store
10436 Do not store floating-point variables in registers, and inhibit other
10437 options that might change whether a floating-point value is taken from a
10438 register or memory.
10439
10440 @cindex floating-point precision
10441 This option prevents undesirable excess precision on machines such as
10442 the 68000 where the floating registers (of the 68881) keep more
10443 precision than a @code{double} is supposed to have. Similarly for the
10444 x86 architecture. For most programs, the excess precision does only
10445 good, but a few programs rely on the precise definition of IEEE floating
10446 point. Use @option{-ffloat-store} for such programs, after modifying
10447 them to store all pertinent intermediate computations into variables.
10448
10449 @item -fexcess-precision=@var{style}
10450 @opindex fexcess-precision
10451 This option allows further control over excess precision on machines
10452 where floating-point operations occur in a format with more precision or
10453 range than the IEEE standard and interchange floating-point types. By
10454 default, @option{-fexcess-precision=fast} is in effect; this means that
10455 operations may be carried out in a wider precision than the types specified
10456 in the source if that would result in faster code, and it is unpredictable
10457 when rounding to the types specified in the source code takes place.
10458 When compiling C, if @option{-fexcess-precision=standard} is specified then
10459 excess precision follows the rules specified in ISO C99; in particular,
10460 both casts and assignments cause values to be rounded to their
10461 semantic types (whereas @option{-ffloat-store} only affects
10462 assignments). This option is enabled by default for C if a strict
10463 conformance option such as @option{-std=c99} is used.
10464 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10465 regardless of whether a strict conformance option is used.
10466
10467 @opindex mfpmath
10468 @option{-fexcess-precision=standard} is not implemented for languages
10469 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10470 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10471 semantics apply without excess precision, and in the latter, rounding
10472 is unpredictable.
10473
10474 @item -ffast-math
10475 @opindex ffast-math
10476 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10477 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10478 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10479 @option{-fexcess-precision=fast}.
10480
10481 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10482
10483 This option is not turned on by any @option{-O} option besides
10484 @option{-Ofast} since it can result in incorrect output for programs
10485 that depend on an exact implementation of IEEE or ISO rules/specifications
10486 for math functions. It may, however, yield faster code for programs
10487 that do not require the guarantees of these specifications.
10488
10489 @item -fno-math-errno
10490 @opindex fno-math-errno
10491 @opindex fmath-errno
10492 Do not set @code{errno} after calling math functions that are executed
10493 with a single instruction, e.g., @code{sqrt}. A program that relies on
10494 IEEE exceptions for math error handling may want to use this flag
10495 for speed while maintaining IEEE arithmetic compatibility.
10496
10497 This option is not turned on by any @option{-O} option since
10498 it can result in incorrect output for programs that depend on
10499 an exact implementation of IEEE or ISO rules/specifications for
10500 math functions. It may, however, yield faster code for programs
10501 that do not require the guarantees of these specifications.
10502
10503 The default is @option{-fmath-errno}.
10504
10505 On Darwin systems, the math library never sets @code{errno}. There is
10506 therefore no reason for the compiler to consider the possibility that
10507 it might, and @option{-fno-math-errno} is the default.
10508
10509 @item -funsafe-math-optimizations
10510 @opindex funsafe-math-optimizations
10511
10512 Allow optimizations for floating-point arithmetic that (a) assume
10513 that arguments and results are valid and (b) may violate IEEE or
10514 ANSI standards. When used at link time, it may include libraries
10515 or startup files that change the default FPU control word or other
10516 similar optimizations.
10517
10518 This option is not turned on by any @option{-O} option since
10519 it can result in incorrect output for programs that depend on
10520 an exact implementation of IEEE or ISO rules/specifications for
10521 math functions. It may, however, yield faster code for programs
10522 that do not require the guarantees of these specifications.
10523 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10524 @option{-fassociative-math} and @option{-freciprocal-math}.
10525
10526 The default is @option{-fno-unsafe-math-optimizations}.
10527
10528 @item -fassociative-math
10529 @opindex fassociative-math
10530
10531 Allow re-association of operands in series of floating-point operations.
10532 This violates the ISO C and C++ language standard by possibly changing
10533 computation result. NOTE: re-ordering may change the sign of zero as
10534 well as ignore NaNs and inhibit or create underflow or overflow (and
10535 thus cannot be used on code that relies on rounding behavior like
10536 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10537 and thus may not be used when ordered comparisons are required.
10538 This option requires that both @option{-fno-signed-zeros} and
10539 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10540 much sense with @option{-frounding-math}. For Fortran the option
10541 is automatically enabled when both @option{-fno-signed-zeros} and
10542 @option{-fno-trapping-math} are in effect.
10543
10544 The default is @option{-fno-associative-math}.
10545
10546 @item -freciprocal-math
10547 @opindex freciprocal-math
10548
10549 Allow the reciprocal of a value to be used instead of dividing by
10550 the value if this enables optimizations. For example @code{x / y}
10551 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10552 is subject to common subexpression elimination. Note that this loses
10553 precision and increases the number of flops operating on the value.
10554
10555 The default is @option{-fno-reciprocal-math}.
10556
10557 @item -ffinite-math-only
10558 @opindex ffinite-math-only
10559 Allow optimizations for floating-point arithmetic that assume
10560 that arguments and results are not NaNs or +-Infs.
10561
10562 This option is not turned on by any @option{-O} option since
10563 it can result in incorrect output for programs that depend on
10564 an exact implementation of IEEE or ISO rules/specifications for
10565 math functions. It may, however, yield faster code for programs
10566 that do not require the guarantees of these specifications.
10567
10568 The default is @option{-fno-finite-math-only}.
10569
10570 @item -fno-signed-zeros
10571 @opindex fno-signed-zeros
10572 @opindex fsigned-zeros
10573 Allow optimizations for floating-point arithmetic that ignore the
10574 signedness of zero. IEEE arithmetic specifies the behavior of
10575 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10576 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10577 This option implies that the sign of a zero result isn't significant.
10578
10579 The default is @option{-fsigned-zeros}.
10580
10581 @item -fno-trapping-math
10582 @opindex fno-trapping-math
10583 @opindex ftrapping-math
10584 Compile code assuming that floating-point operations cannot generate
10585 user-visible traps. These traps include division by zero, overflow,
10586 underflow, inexact result and invalid operation. This option requires
10587 that @option{-fno-signaling-nans} be in effect. Setting this option may
10588 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10589
10590 This option should never be turned on by any @option{-O} option since
10591 it can result in incorrect output for programs that depend on
10592 an exact implementation of IEEE or ISO rules/specifications for
10593 math functions.
10594
10595 The default is @option{-ftrapping-math}.
10596
10597 @item -frounding-math
10598 @opindex frounding-math
10599 Disable transformations and optimizations that assume default floating-point
10600 rounding behavior. This is round-to-zero for all floating point
10601 to integer conversions, and round-to-nearest for all other arithmetic
10602 truncations. This option should be specified for programs that change
10603 the FP rounding mode dynamically, or that may be executed with a
10604 non-default rounding mode. This option disables constant folding of
10605 floating-point expressions at compile time (which may be affected by
10606 rounding mode) and arithmetic transformations that are unsafe in the
10607 presence of sign-dependent rounding modes.
10608
10609 The default is @option{-fno-rounding-math}.
10610
10611 This option is experimental and does not currently guarantee to
10612 disable all GCC optimizations that are affected by rounding mode.
10613 Future versions of GCC may provide finer control of this setting
10614 using C99's @code{FENV_ACCESS} pragma. This command-line option
10615 will be used to specify the default state for @code{FENV_ACCESS}.
10616
10617 @item -fsignaling-nans
10618 @opindex fsignaling-nans
10619 Compile code assuming that IEEE signaling NaNs may generate user-visible
10620 traps during floating-point operations. Setting this option disables
10621 optimizations that may change the number of exceptions visible with
10622 signaling NaNs. This option implies @option{-ftrapping-math}.
10623
10624 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10625 be defined.
10626
10627 The default is @option{-fno-signaling-nans}.
10628
10629 This option is experimental and does not currently guarantee to
10630 disable all GCC optimizations that affect signaling NaN behavior.
10631
10632 @item -fno-fp-int-builtin-inexact
10633 @opindex fno-fp-int-builtin-inexact
10634 @opindex ffp-int-builtin-inexact
10635 Do not allow the built-in functions @code{ceil}, @code{floor},
10636 @code{round} and @code{trunc}, and their @code{float} and @code{long
10637 double} variants, to generate code that raises the ``inexact''
10638 floating-point exception for noninteger arguments. ISO C99 and C11
10639 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10640 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10641 functions to do so.
10642
10643 The default is @option{-ffp-int-builtin-inexact}, allowing the
10644 exception to be raised. This option does nothing unless
10645 @option{-ftrapping-math} is in effect.
10646
10647 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10648 generate a call to a library function then the ``inexact'' exception
10649 may be raised if the library implementation does not follow TS 18661.
10650
10651 @item -fsingle-precision-constant
10652 @opindex fsingle-precision-constant
10653 Treat floating-point constants as single precision instead of
10654 implicitly converting them to double-precision constants.
10655
10656 @item -fcx-limited-range
10657 @opindex fcx-limited-range
10658 When enabled, this option states that a range reduction step is not
10659 needed when performing complex division. Also, there is no checking
10660 whether the result of a complex multiplication or division is @code{NaN
10661 + I*NaN}, with an attempt to rescue the situation in that case. The
10662 default is @option{-fno-cx-limited-range}, but is enabled by
10663 @option{-ffast-math}.
10664
10665 This option controls the default setting of the ISO C99
10666 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10667 all languages.
10668
10669 @item -fcx-fortran-rules
10670 @opindex fcx-fortran-rules
10671 Complex multiplication and division follow Fortran rules. Range
10672 reduction is done as part of complex division, but there is no checking
10673 whether the result of a complex multiplication or division is @code{NaN
10674 + I*NaN}, with an attempt to rescue the situation in that case.
10675
10676 The default is @option{-fno-cx-fortran-rules}.
10677
10678 @end table
10679
10680 The following options control optimizations that may improve
10681 performance, but are not enabled by any @option{-O} options. This
10682 section includes experimental options that may produce broken code.
10683
10684 @table @gcctabopt
10685 @item -fbranch-probabilities
10686 @opindex fbranch-probabilities
10687 After running a program compiled with @option{-fprofile-arcs}
10688 (@pxref{Instrumentation Options}),
10689 you can compile it a second time using
10690 @option{-fbranch-probabilities}, to improve optimizations based on
10691 the number of times each branch was taken. When a program
10692 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10693 counts to a file called @file{@var{sourcename}.gcda} for each source
10694 file. The information in this data file is very dependent on the
10695 structure of the generated code, so you must use the same source code
10696 and the same optimization options for both compilations.
10697
10698 With @option{-fbranch-probabilities}, GCC puts a
10699 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10700 These can be used to improve optimization. Currently, they are only
10701 used in one place: in @file{reorg.c}, instead of guessing which path a
10702 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10703 exactly determine which path is taken more often.
10704
10705 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10706
10707 @item -fprofile-values
10708 @opindex fprofile-values
10709 If combined with @option{-fprofile-arcs}, it adds code so that some
10710 data about values of expressions in the program is gathered.
10711
10712 With @option{-fbranch-probabilities}, it reads back the data gathered
10713 from profiling values of expressions for usage in optimizations.
10714
10715 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10716 @option{-fauto-profile}.
10717
10718 @item -fprofile-reorder-functions
10719 @opindex fprofile-reorder-functions
10720 Function reordering based on profile instrumentation collects
10721 first time of execution of a function and orders these functions
10722 in ascending order.
10723
10724 Enabled with @option{-fprofile-use}.
10725
10726 @item -fvpt
10727 @opindex fvpt
10728 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10729 to add code to gather information about values of expressions.
10730
10731 With @option{-fbranch-probabilities}, it reads back the data gathered
10732 and actually performs the optimizations based on them.
10733 Currently the optimizations include specialization of division operations
10734 using the knowledge about the value of the denominator.
10735
10736 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10737
10738 @item -frename-registers
10739 @opindex frename-registers
10740 Attempt to avoid false dependencies in scheduled code by making use
10741 of registers left over after register allocation. This optimization
10742 most benefits processors with lots of registers. Depending on the
10743 debug information format adopted by the target, however, it can
10744 make debugging impossible, since variables no longer stay in
10745 a ``home register''.
10746
10747 Enabled by default with @option{-funroll-loops}.
10748
10749 @item -fschedule-fusion
10750 @opindex fschedule-fusion
10751 Performs a target dependent pass over the instruction stream to schedule
10752 instructions of same type together because target machine can execute them
10753 more efficiently if they are adjacent to each other in the instruction flow.
10754
10755 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10756
10757 @item -ftracer
10758 @opindex ftracer
10759 Perform tail duplication to enlarge superblock size. This transformation
10760 simplifies the control flow of the function allowing other optimizations to do
10761 a better job.
10762
10763 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10764
10765 @item -funroll-loops
10766 @opindex funroll-loops
10767 Unroll loops whose number of iterations can be determined at compile time or
10768 upon entry to the loop. @option{-funroll-loops} implies
10769 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10770 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10771 a small constant number of iterations). This option makes code larger, and may
10772 or may not make it run faster.
10773
10774 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10775
10776 @item -funroll-all-loops
10777 @opindex funroll-all-loops
10778 Unroll all loops, even if their number of iterations is uncertain when
10779 the loop is entered. This usually makes programs run more slowly.
10780 @option{-funroll-all-loops} implies the same options as
10781 @option{-funroll-loops}.
10782
10783 @item -fpeel-loops
10784 @opindex fpeel-loops
10785 Peels loops for which there is enough information that they do not
10786 roll much (from profile feedback or static analysis). It also turns on
10787 complete loop peeling (i.e.@: complete removal of loops with small constant
10788 number of iterations).
10789
10790 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10791
10792 @item -fmove-loop-invariants
10793 @opindex fmove-loop-invariants
10794 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10795 at level @option{-O1} and higher, except for @option{-Og}.
10796
10797 @item -fsplit-loops
10798 @opindex fsplit-loops
10799 Split a loop into two if it contains a condition that's always true
10800 for one side of the iteration space and false for the other.
10801
10802 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10803
10804 @item -funswitch-loops
10805 @opindex funswitch-loops
10806 Move branches with loop invariant conditions out of the loop, with duplicates
10807 of the loop on both branches (modified according to result of the condition).
10808
10809 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10810
10811 @item -ffunction-sections
10812 @itemx -fdata-sections
10813 @opindex ffunction-sections
10814 @opindex fdata-sections
10815 Place each function or data item into its own section in the output
10816 file if the target supports arbitrary sections. The name of the
10817 function or the name of the data item determines the section's name
10818 in the output file.
10819
10820 Use these options on systems where the linker can perform optimizations to
10821 improve locality of reference in the instruction space. Most systems using the
10822 ELF object format have linkers with such optimizations. On AIX, the linker
10823 rearranges sections (CSECTs) based on the call graph. The performance impact
10824 varies.
10825
10826 Together with a linker garbage collection (linker @option{--gc-sections}
10827 option) these options may lead to smaller statically-linked executables (after
10828 stripping).
10829
10830 On ELF/DWARF systems these options do not degenerate the quality of the debug
10831 information. There could be issues with other object files/debug info formats.
10832
10833 Only use these options when there are significant benefits from doing so. When
10834 you specify these options, the assembler and linker create larger object and
10835 executable files and are also slower. These options affect code generation.
10836 They prevent optimizations by the compiler and assembler using relative
10837 locations inside a translation unit since the locations are unknown until
10838 link time. An example of such an optimization is relaxing calls to short call
10839 instructions.
10840
10841 @item -fbranch-target-load-optimize
10842 @opindex fbranch-target-load-optimize
10843 Perform branch target register load optimization before prologue / epilogue
10844 threading.
10845 The use of target registers can typically be exposed only during reload,
10846 thus hoisting loads out of loops and doing inter-block scheduling needs
10847 a separate optimization pass.
10848
10849 @item -fbranch-target-load-optimize2
10850 @opindex fbranch-target-load-optimize2
10851 Perform branch target register load optimization after prologue / epilogue
10852 threading.
10853
10854 @item -fbtr-bb-exclusive
10855 @opindex fbtr-bb-exclusive
10856 When performing branch target register load optimization, don't reuse
10857 branch target registers within any basic block.
10858
10859 @item -fstdarg-opt
10860 @opindex fstdarg-opt
10861 Optimize the prologue of variadic argument functions with respect to usage of
10862 those arguments.
10863
10864 @item -fsection-anchors
10865 @opindex fsection-anchors
10866 Try to reduce the number of symbolic address calculations by using
10867 shared ``anchor'' symbols to address nearby objects. This transformation
10868 can help to reduce the number of GOT entries and GOT accesses on some
10869 targets.
10870
10871 For example, the implementation of the following function @code{foo}:
10872
10873 @smallexample
10874 static int a, b, c;
10875 int foo (void) @{ return a + b + c; @}
10876 @end smallexample
10877
10878 @noindent
10879 usually calculates the addresses of all three variables, but if you
10880 compile it with @option{-fsection-anchors}, it accesses the variables
10881 from a common anchor point instead. The effect is similar to the
10882 following pseudocode (which isn't valid C):
10883
10884 @smallexample
10885 int foo (void)
10886 @{
10887 register int *xr = &x;
10888 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10889 @}
10890 @end smallexample
10891
10892 Not all targets support this option.
10893
10894 @item --param @var{name}=@var{value}
10895 @opindex param
10896 In some places, GCC uses various constants to control the amount of
10897 optimization that is done. For example, GCC does not inline functions
10898 that contain more than a certain number of instructions. You can
10899 control some of these constants on the command line using the
10900 @option{--param} option.
10901
10902 The names of specific parameters, and the meaning of the values, are
10903 tied to the internals of the compiler, and are subject to change
10904 without notice in future releases.
10905
10906 In order to get minimal, maximal and default value of a parameter,
10907 one can use @option{--help=param -Q} options.
10908
10909 In each case, the @var{value} is an integer. The allowable choices for
10910 @var{name} are:
10911
10912 @table @gcctabopt
10913 @item predictable-branch-outcome
10914 When branch is predicted to be taken with probability lower than this threshold
10915 (in percent), then it is considered well predictable.
10916
10917 @item max-rtl-if-conversion-insns
10918 RTL if-conversion tries to remove conditional branches around a block and
10919 replace them with conditionally executed instructions. This parameter
10920 gives the maximum number of instructions in a block which should be
10921 considered for if-conversion. The compiler will
10922 also use other heuristics to decide whether if-conversion is likely to be
10923 profitable.
10924
10925 @item max-rtl-if-conversion-predictable-cost
10926 @itemx max-rtl-if-conversion-unpredictable-cost
10927 RTL if-conversion will try to remove conditional branches around a block
10928 and replace them with conditionally executed instructions. These parameters
10929 give the maximum permissible cost for the sequence that would be generated
10930 by if-conversion depending on whether the branch is statically determined
10931 to be predictable or not. The units for this parameter are the same as
10932 those for the GCC internal seq_cost metric. The compiler will try to
10933 provide a reasonable default for this parameter using the BRANCH_COST
10934 target macro.
10935
10936 @item max-crossjump-edges
10937 The maximum number of incoming edges to consider for cross-jumping.
10938 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10939 the number of edges incoming to each block. Increasing values mean
10940 more aggressive optimization, making the compilation time increase with
10941 probably small improvement in executable size.
10942
10943 @item min-crossjump-insns
10944 The minimum number of instructions that must be matched at the end
10945 of two blocks before cross-jumping is performed on them. This
10946 value is ignored in the case where all instructions in the block being
10947 cross-jumped from are matched.
10948
10949 @item max-grow-copy-bb-insns
10950 The maximum code size expansion factor when copying basic blocks
10951 instead of jumping. The expansion is relative to a jump instruction.
10952
10953 @item max-goto-duplication-insns
10954 The maximum number of instructions to duplicate to a block that jumps
10955 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10956 passes, GCC factors computed gotos early in the compilation process,
10957 and unfactors them as late as possible. Only computed jumps at the
10958 end of a basic blocks with no more than max-goto-duplication-insns are
10959 unfactored.
10960
10961 @item max-delay-slot-insn-search
10962 The maximum number of instructions to consider when looking for an
10963 instruction to fill a delay slot. If more than this arbitrary number of
10964 instructions are searched, the time savings from filling the delay slot
10965 are minimal, so stop searching. Increasing values mean more
10966 aggressive optimization, making the compilation time increase with probably
10967 small improvement in execution time.
10968
10969 @item max-delay-slot-live-search
10970 When trying to fill delay slots, the maximum number of instructions to
10971 consider when searching for a block with valid live register
10972 information. Increasing this arbitrarily chosen value means more
10973 aggressive optimization, increasing the compilation time. This parameter
10974 should be removed when the delay slot code is rewritten to maintain the
10975 control-flow graph.
10976
10977 @item max-gcse-memory
10978 The approximate maximum amount of memory that can be allocated in
10979 order to perform the global common subexpression elimination
10980 optimization. If more memory than specified is required, the
10981 optimization is not done.
10982
10983 @item max-gcse-insertion-ratio
10984 If the ratio of expression insertions to deletions is larger than this value
10985 for any expression, then RTL PRE inserts or removes the expression and thus
10986 leaves partially redundant computations in the instruction stream.
10987
10988 @item max-pending-list-length
10989 The maximum number of pending dependencies scheduling allows
10990 before flushing the current state and starting over. Large functions
10991 with few branches or calls can create excessively large lists which
10992 needlessly consume memory and resources.
10993
10994 @item max-modulo-backtrack-attempts
10995 The maximum number of backtrack attempts the scheduler should make
10996 when modulo scheduling a loop. Larger values can exponentially increase
10997 compilation time.
10998
10999 @item max-inline-insns-single
11000 Several parameters control the tree inliner used in GCC@.
11001 This number sets the maximum number of instructions (counted in GCC's
11002 internal representation) in a single function that the tree inliner
11003 considers for inlining. This only affects functions declared
11004 inline and methods implemented in a class declaration (C++).
11005
11006 @item max-inline-insns-auto
11007 When you use @option{-finline-functions} (included in @option{-O3}),
11008 a lot of functions that would otherwise not be considered for inlining
11009 by the compiler are investigated. To those functions, a different
11010 (more restrictive) limit compared to functions declared inline can
11011 be applied.
11012
11013 @item inline-min-speedup
11014 When estimated performance improvement of caller + callee runtime exceeds this
11015 threshold (in percent), the function can be inlined regardless of the limit on
11016 @option{--param max-inline-insns-single} and @option{--param
11017 max-inline-insns-auto}.
11018
11019 @item large-function-insns
11020 The limit specifying really large functions. For functions larger than this
11021 limit after inlining, inlining is constrained by
11022 @option{--param large-function-growth}. This parameter is useful primarily
11023 to avoid extreme compilation time caused by non-linear algorithms used by the
11024 back end.
11025
11026 @item large-function-growth
11027 Specifies maximal growth of large function caused by inlining in percents.
11028 For example, parameter value 100 limits large function growth to 2.0 times
11029 the original size.
11030
11031 @item large-unit-insns
11032 The limit specifying large translation unit. Growth caused by inlining of
11033 units larger than this limit is limited by @option{--param inline-unit-growth}.
11034 For small units this might be too tight.
11035 For example, consider a unit consisting of function A
11036 that is inline and B that just calls A three times. If B is small relative to
11037 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11038 large units consisting of small inlineable functions, however, the overall unit
11039 growth limit is needed to avoid exponential explosion of code size. Thus for
11040 smaller units, the size is increased to @option{--param large-unit-insns}
11041 before applying @option{--param inline-unit-growth}.
11042
11043 @item inline-unit-growth
11044 Specifies maximal overall growth of the compilation unit caused by inlining.
11045 For example, parameter value 20 limits unit growth to 1.2 times the original
11046 size. Cold functions (either marked cold via an attribute or by profile
11047 feedback) are not accounted into the unit size.
11048
11049 @item ipcp-unit-growth
11050 Specifies maximal overall growth of the compilation unit caused by
11051 interprocedural constant propagation. For example, parameter value 10 limits
11052 unit growth to 1.1 times the original size.
11053
11054 @item large-stack-frame
11055 The limit specifying large stack frames. While inlining the algorithm is trying
11056 to not grow past this limit too much.
11057
11058 @item large-stack-frame-growth
11059 Specifies maximal growth of large stack frames caused by inlining in percents.
11060 For example, parameter value 1000 limits large stack frame growth to 11 times
11061 the original size.
11062
11063 @item max-inline-insns-recursive
11064 @itemx max-inline-insns-recursive-auto
11065 Specifies the maximum number of instructions an out-of-line copy of a
11066 self-recursive inline
11067 function can grow into by performing recursive inlining.
11068
11069 @option{--param max-inline-insns-recursive} applies to functions
11070 declared inline.
11071 For functions not declared inline, recursive inlining
11072 happens only when @option{-finline-functions} (included in @option{-O3}) is
11073 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11074
11075 @item max-inline-recursive-depth
11076 @itemx max-inline-recursive-depth-auto
11077 Specifies the maximum recursion depth used for recursive inlining.
11078
11079 @option{--param max-inline-recursive-depth} applies to functions
11080 declared inline. For functions not declared inline, recursive inlining
11081 happens only when @option{-finline-functions} (included in @option{-O3}) is
11082 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11083
11084 @item min-inline-recursive-probability
11085 Recursive inlining is profitable only for function having deep recursion
11086 in average and can hurt for function having little recursion depth by
11087 increasing the prologue size or complexity of function body to other
11088 optimizers.
11089
11090 When profile feedback is available (see @option{-fprofile-generate}) the actual
11091 recursion depth can be guessed from the probability that function recurses
11092 via a given call expression. This parameter limits inlining only to call
11093 expressions whose probability exceeds the given threshold (in percents).
11094
11095 @item early-inlining-insns
11096 Specify growth that the early inliner can make. In effect it increases
11097 the amount of inlining for code having a large abstraction penalty.
11098
11099 @item max-early-inliner-iterations
11100 Limit of iterations of the early inliner. This basically bounds
11101 the number of nested indirect calls the early inliner can resolve.
11102 Deeper chains are still handled by late inlining.
11103
11104 @item comdat-sharing-probability
11105 Probability (in percent) that C++ inline function with comdat visibility
11106 are shared across multiple compilation units.
11107
11108 @item profile-func-internal-id
11109 A parameter to control whether to use function internal id in profile
11110 database lookup. If the value is 0, the compiler uses an id that
11111 is based on function assembler name and filename, which makes old profile
11112 data more tolerant to source changes such as function reordering etc.
11113
11114 @item min-vect-loop-bound
11115 The minimum number of iterations under which loops are not vectorized
11116 when @option{-ftree-vectorize} is used. The number of iterations after
11117 vectorization needs to be greater than the value specified by this option
11118 to allow vectorization.
11119
11120 @item gcse-cost-distance-ratio
11121 Scaling factor in calculation of maximum distance an expression
11122 can be moved by GCSE optimizations. This is currently supported only in the
11123 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11124 is with simple expressions, i.e., the expressions that have cost
11125 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11126 hoisting of simple expressions.
11127
11128 @item gcse-unrestricted-cost
11129 Cost, roughly measured as the cost of a single typical machine
11130 instruction, at which GCSE optimizations do not constrain
11131 the distance an expression can travel. This is currently
11132 supported only in the code hoisting pass. The lesser the cost,
11133 the more aggressive code hoisting is. Specifying 0
11134 allows all expressions to travel unrestricted distances.
11135
11136 @item max-hoist-depth
11137 The depth of search in the dominator tree for expressions to hoist.
11138 This is used to avoid quadratic behavior in hoisting algorithm.
11139 The value of 0 does not limit on the search, but may slow down compilation
11140 of huge functions.
11141
11142 @item max-tail-merge-comparisons
11143 The maximum amount of similar bbs to compare a bb with. This is used to
11144 avoid quadratic behavior in tree tail merging.
11145
11146 @item max-tail-merge-iterations
11147 The maximum amount of iterations of the pass over the function. This is used to
11148 limit compilation time in tree tail merging.
11149
11150 @item store-merging-allow-unaligned
11151 Allow the store merging pass to introduce unaligned stores if it is legal to
11152 do so.
11153
11154 @item max-stores-to-merge
11155 The maximum number of stores to attempt to merge into wider stores in the store
11156 merging pass.
11157
11158 @item max-unrolled-insns
11159 The maximum number of instructions that a loop may have to be unrolled.
11160 If a loop is unrolled, this parameter also determines how many times
11161 the loop code is unrolled.
11162
11163 @item max-average-unrolled-insns
11164 The maximum number of instructions biased by probabilities of their execution
11165 that a loop may have to be unrolled. If a loop is unrolled,
11166 this parameter also determines how many times the loop code is unrolled.
11167
11168 @item max-unroll-times
11169 The maximum number of unrollings of a single loop.
11170
11171 @item max-peeled-insns
11172 The maximum number of instructions that a loop may have to be peeled.
11173 If a loop is peeled, this parameter also determines how many times
11174 the loop code is peeled.
11175
11176 @item max-peel-times
11177 The maximum number of peelings of a single loop.
11178
11179 @item max-peel-branches
11180 The maximum number of branches on the hot path through the peeled sequence.
11181
11182 @item max-completely-peeled-insns
11183 The maximum number of insns of a completely peeled loop.
11184
11185 @item max-completely-peel-times
11186 The maximum number of iterations of a loop to be suitable for complete peeling.
11187
11188 @item max-completely-peel-loop-nest-depth
11189 The maximum depth of a loop nest suitable for complete peeling.
11190
11191 @item max-unswitch-insns
11192 The maximum number of insns of an unswitched loop.
11193
11194 @item max-unswitch-level
11195 The maximum number of branches unswitched in a single loop.
11196
11197 @item lim-expensive
11198 The minimum cost of an expensive expression in the loop invariant motion.
11199
11200 @item iv-consider-all-candidates-bound
11201 Bound on number of candidates for induction variables, below which
11202 all candidates are considered for each use in induction variable
11203 optimizations. If there are more candidates than this,
11204 only the most relevant ones are considered to avoid quadratic time complexity.
11205
11206 @item iv-max-considered-uses
11207 The induction variable optimizations give up on loops that contain more
11208 induction variable uses.
11209
11210 @item iv-always-prune-cand-set-bound
11211 If the number of candidates in the set is smaller than this value,
11212 always try to remove unnecessary ivs from the set
11213 when adding a new one.
11214
11215 @item avg-loop-niter
11216 Average number of iterations of a loop.
11217
11218 @item dse-max-object-size
11219 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11220 Larger values may result in larger compilation times.
11221
11222 @item dse-max-alias-queries-per-store
11223 Maximum number of queries into the alias oracle per store.
11224 Larger values result in larger compilation times and may result in more
11225 removed dead stores.
11226
11227 @item scev-max-expr-size
11228 Bound on size of expressions used in the scalar evolutions analyzer.
11229 Large expressions slow the analyzer.
11230
11231 @item scev-max-expr-complexity
11232 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11233 Complex expressions slow the analyzer.
11234
11235 @item max-tree-if-conversion-phi-args
11236 Maximum number of arguments in a PHI supported by TREE if conversion
11237 unless the loop is marked with simd pragma.
11238
11239 @item vect-max-version-for-alignment-checks
11240 The maximum number of run-time checks that can be performed when
11241 doing loop versioning for alignment in the vectorizer.
11242
11243 @item vect-max-version-for-alias-checks
11244 The maximum number of run-time checks that can be performed when
11245 doing loop versioning for alias in the vectorizer.
11246
11247 @item vect-max-peeling-for-alignment
11248 The maximum number of loop peels to enhance access alignment
11249 for vectorizer. Value -1 means no limit.
11250
11251 @item max-iterations-to-track
11252 The maximum number of iterations of a loop the brute-force algorithm
11253 for analysis of the number of iterations of the loop tries to evaluate.
11254
11255 @item hot-bb-count-ws-permille
11256 A basic block profile count is considered hot if it contributes to
11257 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
11258
11259 @item hot-bb-frequency-fraction
11260 Select fraction of the entry block frequency of executions of basic block in
11261 function given basic block needs to have to be considered hot.
11262
11263 @item max-predicted-iterations
11264 The maximum number of loop iterations we predict statically. This is useful
11265 in cases where a function contains a single loop with known bound and
11266 another loop with unknown bound.
11267 The known number of iterations is predicted correctly, while
11268 the unknown number of iterations average to roughly 10. This means that the
11269 loop without bounds appears artificially cold relative to the other one.
11270
11271 @item builtin-expect-probability
11272 Control the probability of the expression having the specified value. This
11273 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11274
11275 @item builtin-string-cmp-inline-length
11276 The maximum length of a constant string for a builtin string cmp call
11277 eligible for inlining.
11278
11279 @item align-threshold
11280
11281 Select fraction of the maximal frequency of executions of a basic block in
11282 a function to align the basic block.
11283
11284 @item align-loop-iterations
11285
11286 A loop expected to iterate at least the selected number of iterations is
11287 aligned.
11288
11289 @item tracer-dynamic-coverage
11290 @itemx tracer-dynamic-coverage-feedback
11291
11292 This value is used to limit superblock formation once the given percentage of
11293 executed instructions is covered. This limits unnecessary code size
11294 expansion.
11295
11296 The @option{tracer-dynamic-coverage-feedback} parameter
11297 is used only when profile
11298 feedback is available. The real profiles (as opposed to statically estimated
11299 ones) are much less balanced allowing the threshold to be larger value.
11300
11301 @item tracer-max-code-growth
11302 Stop tail duplication once code growth has reached given percentage. This is
11303 a rather artificial limit, as most of the duplicates are eliminated later in
11304 cross jumping, so it may be set to much higher values than is the desired code
11305 growth.
11306
11307 @item tracer-min-branch-ratio
11308
11309 Stop reverse growth when the reverse probability of best edge is less than this
11310 threshold (in percent).
11311
11312 @item tracer-min-branch-probability
11313 @itemx tracer-min-branch-probability-feedback
11314
11315 Stop forward growth if the best edge has probability lower than this
11316 threshold.
11317
11318 Similarly to @option{tracer-dynamic-coverage} two parameters are
11319 provided. @option{tracer-min-branch-probability-feedback} is used for
11320 compilation with profile feedback and @option{tracer-min-branch-probability}
11321 compilation without. The value for compilation with profile feedback
11322 needs to be more conservative (higher) in order to make tracer
11323 effective.
11324
11325 @item stack-clash-protection-guard-size
11326 Specify the size of the operating system provided stack guard as
11327 2 raised to @var{num} bytes. Higher values may reduce the
11328 number of explicit probes, but a value larger than the operating system
11329 provided guard will leave code vulnerable to stack clash style attacks.
11330
11331 @item stack-clash-protection-probe-interval
11332 Stack clash protection involves probing stack space as it is allocated. This
11333 param controls the maximum distance between probes into the stack as 2 raised
11334 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11335 larger than the operating system provided guard will leave code vulnerable to
11336 stack clash style attacks.
11337
11338 @item max-cse-path-length
11339
11340 The maximum number of basic blocks on path that CSE considers.
11341
11342 @item max-cse-insns
11343 The maximum number of instructions CSE processes before flushing.
11344
11345 @item ggc-min-expand
11346
11347 GCC uses a garbage collector to manage its own memory allocation. This
11348 parameter specifies the minimum percentage by which the garbage
11349 collector's heap should be allowed to expand between collections.
11350 Tuning this may improve compilation speed; it has no effect on code
11351 generation.
11352
11353 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11354 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11355 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11356 GCC is not able to calculate RAM on a particular platform, the lower
11357 bound of 30% is used. Setting this parameter and
11358 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11359 every opportunity. This is extremely slow, but can be useful for
11360 debugging.
11361
11362 @item ggc-min-heapsize
11363
11364 Minimum size of the garbage collector's heap before it begins bothering
11365 to collect garbage. The first collection occurs after the heap expands
11366 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11367 tuning this may improve compilation speed, and has no effect on code
11368 generation.
11369
11370 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11371 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11372 with a lower bound of 4096 (four megabytes) and an upper bound of
11373 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11374 particular platform, the lower bound is used. Setting this parameter
11375 very large effectively disables garbage collection. Setting this
11376 parameter and @option{ggc-min-expand} to zero causes a full collection
11377 to occur at every opportunity.
11378
11379 @item max-reload-search-insns
11380 The maximum number of instruction reload should look backward for equivalent
11381 register. Increasing values mean more aggressive optimization, making the
11382 compilation time increase with probably slightly better performance.
11383
11384 @item max-cselib-memory-locations
11385 The maximum number of memory locations cselib should take into account.
11386 Increasing values mean more aggressive optimization, making the compilation time
11387 increase with probably slightly better performance.
11388
11389 @item max-sched-ready-insns
11390 The maximum number of instructions ready to be issued the scheduler should
11391 consider at any given time during the first scheduling pass. Increasing
11392 values mean more thorough searches, making the compilation time increase
11393 with probably little benefit.
11394
11395 @item max-sched-region-blocks
11396 The maximum number of blocks in a region to be considered for
11397 interblock scheduling.
11398
11399 @item max-pipeline-region-blocks
11400 The maximum number of blocks in a region to be considered for
11401 pipelining in the selective scheduler.
11402
11403 @item max-sched-region-insns
11404 The maximum number of insns in a region to be considered for
11405 interblock scheduling.
11406
11407 @item max-pipeline-region-insns
11408 The maximum number of insns in a region to be considered for
11409 pipelining in the selective scheduler.
11410
11411 @item min-spec-prob
11412 The minimum probability (in percents) of reaching a source block
11413 for interblock speculative scheduling.
11414
11415 @item max-sched-extend-regions-iters
11416 The maximum number of iterations through CFG to extend regions.
11417 A value of 0 disables region extensions.
11418
11419 @item max-sched-insn-conflict-delay
11420 The maximum conflict delay for an insn to be considered for speculative motion.
11421
11422 @item sched-spec-prob-cutoff
11423 The minimal probability of speculation success (in percents), so that
11424 speculative insns are scheduled.
11425
11426 @item sched-state-edge-prob-cutoff
11427 The minimum probability an edge must have for the scheduler to save its
11428 state across it.
11429
11430 @item sched-mem-true-dep-cost
11431 Minimal distance (in CPU cycles) between store and load targeting same
11432 memory locations.
11433
11434 @item selsched-max-lookahead
11435 The maximum size of the lookahead window of selective scheduling. It is a
11436 depth of search for available instructions.
11437
11438 @item selsched-max-sched-times
11439 The maximum number of times that an instruction is scheduled during
11440 selective scheduling. This is the limit on the number of iterations
11441 through which the instruction may be pipelined.
11442
11443 @item selsched-insns-to-rename
11444 The maximum number of best instructions in the ready list that are considered
11445 for renaming in the selective scheduler.
11446
11447 @item sms-min-sc
11448 The minimum value of stage count that swing modulo scheduler
11449 generates.
11450
11451 @item max-last-value-rtl
11452 The maximum size measured as number of RTLs that can be recorded in an expression
11453 in combiner for a pseudo register as last known value of that register.
11454
11455 @item max-combine-insns
11456 The maximum number of instructions the RTL combiner tries to combine.
11457
11458 @item integer-share-limit
11459 Small integer constants can use a shared data structure, reducing the
11460 compiler's memory usage and increasing its speed. This sets the maximum
11461 value of a shared integer constant.
11462
11463 @item ssp-buffer-size
11464 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11465 protection when @option{-fstack-protection} is used.
11466
11467 @item min-size-for-stack-sharing
11468 The minimum size of variables taking part in stack slot sharing when not
11469 optimizing.
11470
11471 @item max-jump-thread-duplication-stmts
11472 Maximum number of statements allowed in a block that needs to be
11473 duplicated when threading jumps.
11474
11475 @item max-fields-for-field-sensitive
11476 Maximum number of fields in a structure treated in
11477 a field sensitive manner during pointer analysis.
11478
11479 @item prefetch-latency
11480 Estimate on average number of instructions that are executed before
11481 prefetch finishes. The distance prefetched ahead is proportional
11482 to this constant. Increasing this number may also lead to less
11483 streams being prefetched (see @option{simultaneous-prefetches}).
11484
11485 @item simultaneous-prefetches
11486 Maximum number of prefetches that can run at the same time.
11487
11488 @item l1-cache-line-size
11489 The size of cache line in L1 data cache, in bytes.
11490
11491 @item l1-cache-size
11492 The size of L1 data cache, in kilobytes.
11493
11494 @item l2-cache-size
11495 The size of L2 data cache, in kilobytes.
11496
11497 @item prefetch-dynamic-strides
11498 Whether the loop array prefetch pass should issue software prefetch hints
11499 for strides that are non-constant. In some cases this may be
11500 beneficial, though the fact the stride is non-constant may make it
11501 hard to predict when there is clear benefit to issuing these hints.
11502
11503 Set to 1 if the prefetch hints should be issued for non-constant
11504 strides. Set to 0 if prefetch hints should be issued only for strides that
11505 are known to be constant and below @option{prefetch-minimum-stride}.
11506
11507 @item prefetch-minimum-stride
11508 Minimum constant stride, in bytes, to start using prefetch hints for. If
11509 the stride is less than this threshold, prefetch hints will not be issued.
11510
11511 This setting is useful for processors that have hardware prefetchers, in
11512 which case there may be conflicts between the hardware prefetchers and
11513 the software prefetchers. If the hardware prefetchers have a maximum
11514 stride they can handle, it should be used here to improve the use of
11515 software prefetchers.
11516
11517 A value of -1 means we don't have a threshold and therefore
11518 prefetch hints can be issued for any constant stride.
11519
11520 This setting is only useful for strides that are known and constant.
11521
11522 @item loop-interchange-max-num-stmts
11523 The maximum number of stmts in a loop to be interchanged.
11524
11525 @item loop-interchange-stride-ratio
11526 The minimum ratio between stride of two loops for interchange to be profitable.
11527
11528 @item min-insn-to-prefetch-ratio
11529 The minimum ratio between the number of instructions and the
11530 number of prefetches to enable prefetching in a loop.
11531
11532 @item prefetch-min-insn-to-mem-ratio
11533 The minimum ratio between the number of instructions and the
11534 number of memory references to enable prefetching in a loop.
11535
11536 @item use-canonical-types
11537 Whether the compiler should use the ``canonical'' type system.
11538 Should always be 1, which uses a more efficient internal
11539 mechanism for comparing types in C++ and Objective-C++. However, if
11540 bugs in the canonical type system are causing compilation failures,
11541 set this value to 0 to disable canonical types.
11542
11543 @item switch-conversion-max-branch-ratio
11544 Switch initialization conversion refuses to create arrays that are
11545 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11546 branches in the switch.
11547
11548 @item max-partial-antic-length
11549 Maximum length of the partial antic set computed during the tree
11550 partial redundancy elimination optimization (@option{-ftree-pre}) when
11551 optimizing at @option{-O3} and above. For some sorts of source code
11552 the enhanced partial redundancy elimination optimization can run away,
11553 consuming all of the memory available on the host machine. This
11554 parameter sets a limit on the length of the sets that are computed,
11555 which prevents the runaway behavior. Setting a value of 0 for
11556 this parameter allows an unlimited set length.
11557
11558 @item rpo-vn-max-loop-depth
11559 Maximum loop depth that is value-numbered optimistically.
11560 When the limit hits the innermost
11561 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11562 loop nest are value-numbered optimistically and the remaining ones not.
11563
11564 @item sccvn-max-alias-queries-per-access
11565 Maximum number of alias-oracle queries we perform when looking for
11566 redundancies for loads and stores. If this limit is hit the search
11567 is aborted and the load or store is not considered redundant. The
11568 number of queries is algorithmically limited to the number of
11569 stores on all paths from the load to the function entry.
11570
11571 @item ira-max-loops-num
11572 IRA uses regional register allocation by default. If a function
11573 contains more loops than the number given by this parameter, only at most
11574 the given number of the most frequently-executed loops form regions
11575 for regional register allocation.
11576
11577 @item ira-max-conflict-table-size
11578 Although IRA uses a sophisticated algorithm to compress the conflict
11579 table, the table can still require excessive amounts of memory for
11580 huge functions. If the conflict table for a function could be more
11581 than the size in MB given by this parameter, the register allocator
11582 instead uses a faster, simpler, and lower-quality
11583 algorithm that does not require building a pseudo-register conflict table.
11584
11585 @item ira-loop-reserved-regs
11586 IRA can be used to evaluate more accurate register pressure in loops
11587 for decisions to move loop invariants (see @option{-O3}). The number
11588 of available registers reserved for some other purposes is given
11589 by this parameter. Default of the parameter
11590 is the best found from numerous experiments.
11591
11592 @item lra-inheritance-ebb-probability-cutoff
11593 LRA tries to reuse values reloaded in registers in subsequent insns.
11594 This optimization is called inheritance. EBB is used as a region to
11595 do this optimization. The parameter defines a minimal fall-through
11596 edge probability in percentage used to add BB to inheritance EBB in
11597 LRA. The default value was chosen
11598 from numerous runs of SPEC2000 on x86-64.
11599
11600 @item loop-invariant-max-bbs-in-loop
11601 Loop invariant motion can be very expensive, both in compilation time and
11602 in amount of needed compile-time memory, with very large loops. Loops
11603 with more basic blocks than this parameter won't have loop invariant
11604 motion optimization performed on them.
11605
11606 @item loop-max-datarefs-for-datadeps
11607 Building data dependencies is expensive for very large loops. This
11608 parameter limits the number of data references in loops that are
11609 considered for data dependence analysis. These large loops are no
11610 handled by the optimizations using loop data dependencies.
11611
11612 @item max-vartrack-size
11613 Sets a maximum number of hash table slots to use during variable
11614 tracking dataflow analysis of any function. If this limit is exceeded
11615 with variable tracking at assignments enabled, analysis for that
11616 function is retried without it, after removing all debug insns from
11617 the function. If the limit is exceeded even without debug insns, var
11618 tracking analysis is completely disabled for the function. Setting
11619 the parameter to zero makes it unlimited.
11620
11621 @item max-vartrack-expr-depth
11622 Sets a maximum number of recursion levels when attempting to map
11623 variable names or debug temporaries to value expressions. This trades
11624 compilation time for more complete debug information. If this is set too
11625 low, value expressions that are available and could be represented in
11626 debug information may end up not being used; setting this higher may
11627 enable the compiler to find more complex debug expressions, but compile
11628 time and memory use may grow.
11629
11630 @item max-debug-marker-count
11631 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11632 markers) to avoid complexity explosion at inlining or expanding to RTL.
11633 If a function has more such gimple stmts than the set limit, such stmts
11634 will be dropped from the inlined copy of a function, and from its RTL
11635 expansion.
11636
11637 @item min-nondebug-insn-uid
11638 Use uids starting at this parameter for nondebug insns. The range below
11639 the parameter is reserved exclusively for debug insns created by
11640 @option{-fvar-tracking-assignments}, but debug insns may get
11641 (non-overlapping) uids above it if the reserved range is exhausted.
11642
11643 @item ipa-sra-ptr-growth-factor
11644 IPA-SRA replaces a pointer to an aggregate with one or more new
11645 parameters only when their cumulative size is less or equal to
11646 @option{ipa-sra-ptr-growth-factor} times the size of the original
11647 pointer parameter.
11648
11649 @item sra-max-scalarization-size-Ospeed
11650 @itemx sra-max-scalarization-size-Osize
11651 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11652 replace scalar parts of aggregates with uses of independent scalar
11653 variables. These parameters control the maximum size, in storage units,
11654 of aggregate which is considered for replacement when compiling for
11655 speed
11656 (@option{sra-max-scalarization-size-Ospeed}) or size
11657 (@option{sra-max-scalarization-size-Osize}) respectively.
11658
11659 @item tm-max-aggregate-size
11660 When making copies of thread-local variables in a transaction, this
11661 parameter specifies the size in bytes after which variables are
11662 saved with the logging functions as opposed to save/restore code
11663 sequence pairs. This option only applies when using
11664 @option{-fgnu-tm}.
11665
11666 @item graphite-max-nb-scop-params
11667 To avoid exponential effects in the Graphite loop transforms, the
11668 number of parameters in a Static Control Part (SCoP) is bounded.
11669 A value of zero can be used to lift
11670 the bound. A variable whose value is unknown at compilation time and
11671 defined outside a SCoP is a parameter of the SCoP.
11672
11673 @item loop-block-tile-size
11674 Loop blocking or strip mining transforms, enabled with
11675 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11676 loop in the loop nest by a given number of iterations. The strip
11677 length can be changed using the @option{loop-block-tile-size}
11678 parameter.
11679
11680 @item ipa-cp-value-list-size
11681 IPA-CP attempts to track all possible values and types passed to a function's
11682 parameter in order to propagate them and perform devirtualization.
11683 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11684 stores per one formal parameter of a function.
11685
11686 @item ipa-cp-eval-threshold
11687 IPA-CP calculates its own score of cloning profitability heuristics
11688 and performs those cloning opportunities with scores that exceed
11689 @option{ipa-cp-eval-threshold}.
11690
11691 @item ipa-cp-recursion-penalty
11692 Percentage penalty the recursive functions will receive when they
11693 are evaluated for cloning.
11694
11695 @item ipa-cp-single-call-penalty
11696 Percentage penalty functions containing a single call to another
11697 function will receive when they are evaluated for cloning.
11698
11699 @item ipa-max-agg-items
11700 IPA-CP is also capable to propagate a number of scalar values passed
11701 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11702 number of such values per one parameter.
11703
11704 @item ipa-cp-loop-hint-bonus
11705 When IPA-CP determines that a cloning candidate would make the number
11706 of iterations of a loop known, it adds a bonus of
11707 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11708 the candidate.
11709
11710 @item ipa-cp-array-index-hint-bonus
11711 When IPA-CP determines that a cloning candidate would make the index of
11712 an array access known, it adds a bonus of
11713 @option{ipa-cp-array-index-hint-bonus} to the profitability
11714 score of the candidate.
11715
11716 @item ipa-max-aa-steps
11717 During its analysis of function bodies, IPA-CP employs alias analysis
11718 in order to track values pointed to by function parameters. In order
11719 not spend too much time analyzing huge functions, it gives up and
11720 consider all memory clobbered after examining
11721 @option{ipa-max-aa-steps} statements modifying memory.
11722
11723 @item lto-partitions
11724 Specify desired number of partitions produced during WHOPR compilation.
11725 The number of partitions should exceed the number of CPUs used for compilation.
11726
11727 @item lto-min-partition
11728 Size of minimal partition for WHOPR (in estimated instructions).
11729 This prevents expenses of splitting very small programs into too many
11730 partitions.
11731
11732 @item lto-max-partition
11733 Size of max partition for WHOPR (in estimated instructions).
11734 to provide an upper bound for individual size of partition.
11735 Meant to be used only with balanced partitioning.
11736
11737 @item cxx-max-namespaces-for-diagnostic-help
11738 The maximum number of namespaces to consult for suggestions when C++
11739 name lookup fails for an identifier.
11740
11741 @item sink-frequency-threshold
11742 The maximum relative execution frequency (in percents) of the target block
11743 relative to a statement's original block to allow statement sinking of a
11744 statement. Larger numbers result in more aggressive statement sinking.
11745 A small positive adjustment is applied for
11746 statements with memory operands as those are even more profitable so sink.
11747
11748 @item max-stores-to-sink
11749 The maximum number of conditional store pairs that can be sunk. Set to 0
11750 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11751 (@option{-ftree-loop-if-convert}) is disabled.
11752
11753 @item allow-store-data-races
11754 Allow optimizers to introduce new data races on stores.
11755 Set to 1 to allow, otherwise to 0.
11756
11757 @item case-values-threshold
11758 The smallest number of different values for which it is best to use a
11759 jump-table instead of a tree of conditional branches. If the value is
11760 0, use the default for the machine.
11761
11762 @item tree-reassoc-width
11763 Set the maximum number of instructions executed in parallel in
11764 reassociated tree. This parameter overrides target dependent
11765 heuristics used by default if has non zero value.
11766
11767 @item sched-pressure-algorithm
11768 Choose between the two available implementations of
11769 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11770 and is the more likely to prevent instructions from being reordered.
11771 Algorithm 2 was designed to be a compromise between the relatively
11772 conservative approach taken by algorithm 1 and the rather aggressive
11773 approach taken by the default scheduler. It relies more heavily on
11774 having a regular register file and accurate register pressure classes.
11775 See @file{haifa-sched.c} in the GCC sources for more details.
11776
11777 The default choice depends on the target.
11778
11779 @item max-slsr-cand-scan
11780 Set the maximum number of existing candidates that are considered when
11781 seeking a basis for a new straight-line strength reduction candidate.
11782
11783 @item asan-globals
11784 Enable buffer overflow detection for global objects. This kind
11785 of protection is enabled by default if you are using
11786 @option{-fsanitize=address} option.
11787 To disable global objects protection use @option{--param asan-globals=0}.
11788
11789 @item asan-stack
11790 Enable buffer overflow detection for stack objects. This kind of
11791 protection is enabled by default when using @option{-fsanitize=address}.
11792 To disable stack protection use @option{--param asan-stack=0} option.
11793
11794 @item asan-instrument-reads
11795 Enable buffer overflow detection for memory reads. This kind of
11796 protection is enabled by default when using @option{-fsanitize=address}.
11797 To disable memory reads protection use
11798 @option{--param asan-instrument-reads=0}.
11799
11800 @item asan-instrument-writes
11801 Enable buffer overflow detection for memory writes. This kind of
11802 protection is enabled by default when using @option{-fsanitize=address}.
11803 To disable memory writes protection use
11804 @option{--param asan-instrument-writes=0} option.
11805
11806 @item asan-memintrin
11807 Enable detection for built-in functions. This kind of protection
11808 is enabled by default when using @option{-fsanitize=address}.
11809 To disable built-in functions protection use
11810 @option{--param asan-memintrin=0}.
11811
11812 @item asan-use-after-return
11813 Enable detection of use-after-return. This kind of protection
11814 is enabled by default when using the @option{-fsanitize=address} option.
11815 To disable it use @option{--param asan-use-after-return=0}.
11816
11817 Note: By default the check is disabled at run time. To enable it,
11818 add @code{detect_stack_use_after_return=1} to the environment variable
11819 @env{ASAN_OPTIONS}.
11820
11821 @item asan-instrumentation-with-call-threshold
11822 If number of memory accesses in function being instrumented
11823 is greater or equal to this number, use callbacks instead of inline checks.
11824 E.g. to disable inline code use
11825 @option{--param asan-instrumentation-with-call-threshold=0}.
11826
11827 @item use-after-scope-direct-emission-threshold
11828 If the size of a local variable in bytes is smaller or equal to this
11829 number, directly poison (or unpoison) shadow memory instead of using
11830 run-time callbacks.
11831
11832 @item max-fsm-thread-path-insns
11833 Maximum number of instructions to copy when duplicating blocks on a
11834 finite state automaton jump thread path.
11835
11836 @item max-fsm-thread-length
11837 Maximum number of basic blocks on a finite state automaton jump thread
11838 path.
11839
11840 @item max-fsm-thread-paths
11841 Maximum number of new jump thread paths to create for a finite state
11842 automaton.
11843
11844 @item parloops-chunk-size
11845 Chunk size of omp schedule for loops parallelized by parloops.
11846
11847 @item parloops-schedule
11848 Schedule type of omp schedule for loops parallelized by parloops (static,
11849 dynamic, guided, auto, runtime).
11850
11851 @item parloops-min-per-thread
11852 The minimum number of iterations per thread of an innermost parallelized
11853 loop for which the parallelized variant is preferred over the single threaded
11854 one. Note that for a parallelized loop nest the
11855 minimum number of iterations of the outermost loop per thread is two.
11856
11857 @item max-ssa-name-query-depth
11858 Maximum depth of recursion when querying properties of SSA names in things
11859 like fold routines. One level of recursion corresponds to following a
11860 use-def chain.
11861
11862 @item hsa-gen-debug-stores
11863 Enable emission of special debug stores within HSA kernels which are
11864 then read and reported by libgomp plugin. Generation of these stores
11865 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11866 enable it.
11867
11868 @item max-speculative-devirt-maydefs
11869 The maximum number of may-defs we analyze when looking for a must-def
11870 specifying the dynamic type of an object that invokes a virtual call
11871 we may be able to devirtualize speculatively.
11872
11873 @item max-vrp-switch-assertions
11874 The maximum number of assertions to add along the default edge of a switch
11875 statement during VRP.
11876
11877 @item unroll-jam-min-percent
11878 The minimum percentage of memory references that must be optimized
11879 away for the unroll-and-jam transformation to be considered profitable.
11880
11881 @item unroll-jam-max-unroll
11882 The maximum number of times the outer loop should be unrolled by
11883 the unroll-and-jam transformation.
11884
11885 @item max-rtl-if-conversion-unpredictable-cost
11886 Maximum permissible cost for the sequence that would be generated
11887 by the RTL if-conversion pass for a branch that is considered unpredictable.
11888
11889 @item max-variable-expansions-in-unroller
11890 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
11891 of times that an individual variable will be expanded during loop unrolling.
11892
11893 @item tracer-min-branch-probability-feedback
11894 Stop forward growth if the probability of best edge is less than
11895 this threshold (in percent). Used when profile feedback is available.
11896
11897 @item partial-inlining-entry-probability
11898 Maximum probability of the entry BB of split region
11899 (in percent relative to entry BB of the function)
11900 to make partial inlining happen.
11901
11902 @item max-tracked-strlens
11903 Maximum number of strings for which strlen optimization pass will
11904 track string lengths.
11905
11906 @item gcse-after-reload-partial-fraction
11907 The threshold ratio for performing partial redundancy
11908 elimination after reload.
11909
11910 @item gcse-after-reload-critical-fraction
11911 The threshold ratio of critical edges execution count that
11912 permit performing redundancy elimination after reload.
11913
11914 @item max-loop-header-insns
11915 The maximum number of insns in loop header duplicated
11916 by the copy loop headers pass.
11917
11918 @item vect-epilogues-nomask
11919 Enable loop epilogue vectorization using smaller vector size.
11920
11921 @item slp-max-insns-in-bb
11922 Maximum number of instructions in basic block to be
11923 considered for SLP vectorization.
11924
11925 @item avoid-fma-max-bits
11926 Maximum number of bits for which we avoid creating FMAs.
11927
11928 @item sms-loop-average-count-threshold
11929 A threshold on the average loop count considered by the swing modulo scheduler.
11930
11931 @item sms-dfa-history
11932 The number of cycles the swing modulo scheduler considers when checking
11933 conflicts using DFA.
11934
11935 @item hot-bb-count-fraction
11936 Select fraction of the maximal count of repetitions of basic block
11937 in program given basic block needs
11938 to have to be considered hot (used in non-LTO mode)
11939
11940 @item max-inline-insns-recursive-auto
11941 The maximum number of instructions non-inline function
11942 can grow to via recursive inlining.
11943
11944 @item graphite-allow-codegen-errors
11945 Whether codegen errors should be ICEs when @option{-fchecking}.
11946
11947 @item sms-max-ii-factor
11948 A factor for tuning the upper bound that swing modulo scheduler
11949 uses for scheduling a loop.
11950
11951 @item lra-max-considered-reload-pseudos
11952 The max number of reload pseudos which are considered during
11953 spilling a non-reload pseudo.
11954
11955 @item max-pow-sqrt-depth
11956 Maximum depth of sqrt chains to use when synthesizing exponentiation
11957 by a real constant.
11958
11959 @item max-dse-active-local-stores
11960 Maximum number of active local stores in RTL dead store elimination.
11961
11962 @item asan-instrument-allocas
11963 Enable asan allocas/VLAs protection.
11964
11965 @item max-iterations-computation-cost
11966 Bound on the cost of an expression to compute the number of iterations.
11967
11968 @item max-isl-operations
11969 Maximum number of isl operations, 0 means unlimited.
11970
11971 @item graphite-max-arrays-per-scop
11972 Maximum number of arrays per scop.
11973
11974 @item max-vartrack-reverse-op-size
11975 Max. size of loc list for which reverse ops should be added.
11976
11977 @item unlikely-bb-count-fraction
11978 The minimum fraction of profile runs a given basic block execution count
11979 must be not to be considered unlikely.
11980
11981 @item tracer-dynamic-coverage-feedback
11982 The percentage of function, weighted by execution frequency,
11983 that must be covered by trace formation.
11984 Used when profile feedback is available.
11985
11986 @item max-inline-recursive-depth-auto
11987 The maximum depth of recursive inlining for non-inline functions.
11988
11989 @item fsm-scale-path-stmts
11990 Scale factor to apply to the number of statements in a threading path
11991 when comparing to the number of (scaled) blocks.
11992
11993 @item fsm-maximum-phi-arguments
11994 Maximum number of arguments a PHI may have before the FSM threader
11995 will not try to thread through its block.
11996
11997 @item uninit-control-dep-attempts
11998 Maximum number of nested calls to search for control dependencies
11999 during uninitialized variable analysis.
12000
12001 @item indir-call-topn-profile
12002 Track top N target addresses in indirect-call profile.
12003
12004 @item max-once-peeled-insns
12005 The maximum number of insns of a peeled loop that rolls only once.
12006
12007 @item sra-max-scalarization-size-Osize
12008 Maximum size, in storage units, of an aggregate
12009 which should be considered for scalarization when compiling for size.
12010
12011 @item fsm-scale-path-blocks
12012 Scale factor to apply to the number of blocks in a threading path
12013 when comparing to the number of (scaled) statements.
12014
12015 @item sched-autopref-queue-depth
12016 Hardware autoprefetcher scheduler model control flag.
12017 Number of lookahead cycles the model looks into; at '
12018 ' only enable instruction sorting heuristic.
12019
12020
12021 @end table
12022 @end table
12023
12024 @node Instrumentation Options
12025 @section Program Instrumentation Options
12026 @cindex instrumentation options
12027 @cindex program instrumentation options
12028 @cindex run-time error checking options
12029 @cindex profiling options
12030 @cindex options, program instrumentation
12031 @cindex options, run-time error checking
12032 @cindex options, profiling
12033
12034 GCC supports a number of command-line options that control adding
12035 run-time instrumentation to the code it normally generates.
12036 For example, one purpose of instrumentation is collect profiling
12037 statistics for use in finding program hot spots, code coverage
12038 analysis, or profile-guided optimizations.
12039 Another class of program instrumentation is adding run-time checking
12040 to detect programming errors like invalid pointer
12041 dereferences or out-of-bounds array accesses, as well as deliberately
12042 hostile attacks such as stack smashing or C++ vtable hijacking.
12043 There is also a general hook which can be used to implement other
12044 forms of tracing or function-level instrumentation for debug or
12045 program analysis purposes.
12046
12047 @table @gcctabopt
12048 @cindex @command{prof}
12049 @cindex @command{gprof}
12050 @item -p
12051 @itemx -pg
12052 @opindex p
12053 @opindex pg
12054 Generate extra code to write profile information suitable for the
12055 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12056 (for @option{-pg}). You must use this option when compiling
12057 the source files you want data about, and you must also use it when
12058 linking.
12059
12060 You can use the function attribute @code{no_instrument_function} to
12061 suppress profiling of individual functions when compiling with these options.
12062 @xref{Common Function Attributes}.
12063
12064 @item -fprofile-arcs
12065 @opindex fprofile-arcs
12066 Add code so that program flow @dfn{arcs} are instrumented. During
12067 execution the program records how many times each branch and call is
12068 executed and how many times it is taken or returns. On targets that support
12069 constructors with priority support, profiling properly handles constructors,
12070 destructors and C++ constructors (and destructors) of classes which are used
12071 as a type of a global variable.
12072
12073 When the compiled
12074 program exits it saves this data to a file called
12075 @file{@var{auxname}.gcda} for each source file. The data may be used for
12076 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12077 test coverage analysis (@option{-ftest-coverage}). Each object file's
12078 @var{auxname} is generated from the name of the output file, if
12079 explicitly specified and it is not the final executable, otherwise it is
12080 the basename of the source file. In both cases any suffix is removed
12081 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12082 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12083 @xref{Cross-profiling}.
12084
12085 @cindex @command{gcov}
12086 @item --coverage
12087 @opindex coverage
12088
12089 This option is used to compile and link code instrumented for coverage
12090 analysis. The option is a synonym for @option{-fprofile-arcs}
12091 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12092 linking). See the documentation for those options for more details.
12093
12094 @itemize
12095
12096 @item
12097 Compile the source files with @option{-fprofile-arcs} plus optimization
12098 and code generation options. For test coverage analysis, use the
12099 additional @option{-ftest-coverage} option. You do not need to profile
12100 every source file in a program.
12101
12102 @item
12103 Compile the source files additionally with @option{-fprofile-abs-path}
12104 to create absolute path names in the @file{.gcno} files. This allows
12105 @command{gcov} to find the correct sources in projects where compilations
12106 occur with different working directories.
12107
12108 @item
12109 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12110 (the latter implies the former).
12111
12112 @item
12113 Run the program on a representative workload to generate the arc profile
12114 information. This may be repeated any number of times. You can run
12115 concurrent instances of your program, and provided that the file system
12116 supports locking, the data files will be correctly updated. Unless
12117 a strict ISO C dialect option is in effect, @code{fork} calls are
12118 detected and correctly handled without double counting.
12119
12120 @item
12121 For profile-directed optimizations, compile the source files again with
12122 the same optimization and code generation options plus
12123 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12124 Control Optimization}).
12125
12126 @item
12127 For test coverage analysis, use @command{gcov} to produce human readable
12128 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12129 @command{gcov} documentation for further information.
12130
12131 @end itemize
12132
12133 With @option{-fprofile-arcs}, for each function of your program GCC
12134 creates a program flow graph, then finds a spanning tree for the graph.
12135 Only arcs that are not on the spanning tree have to be instrumented: the
12136 compiler adds code to count the number of times that these arcs are
12137 executed. When an arc is the only exit or only entrance to a block, the
12138 instrumentation code can be added to the block; otherwise, a new basic
12139 block must be created to hold the instrumentation code.
12140
12141 @need 2000
12142 @item -ftest-coverage
12143 @opindex ftest-coverage
12144 Produce a notes file that the @command{gcov} code-coverage utility
12145 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12146 show program coverage. Each source file's note file is called
12147 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12148 above for a description of @var{auxname} and instructions on how to
12149 generate test coverage data. Coverage data matches the source files
12150 more closely if you do not optimize.
12151
12152 @item -fprofile-abs-path
12153 @opindex fprofile-abs-path
12154 Automatically convert relative source file names to absolute path names
12155 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12156 sources in projects where compilations occur with different working
12157 directories.
12158
12159 @item -fprofile-dir=@var{path}
12160 @opindex fprofile-dir
12161
12162 Set the directory to search for the profile data files in to @var{path}.
12163 This option affects only the profile data generated by
12164 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12165 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12166 and its related options. Both absolute and relative paths can be used.
12167 By default, GCC uses the current directory as @var{path}, thus the
12168 profile data file appears in the same directory as the object file.
12169 In order to prevent the file name clashing, if the object file name is
12170 not an absolute path, we mangle the absolute path of the
12171 @file{@var{sourcename}.gcda} file and use it as the file name of a
12172 @file{.gcda} file.
12173
12174 When an executable is run in a massive parallel environment, it is recommended
12175 to save profile to different folders. That can be done with variables
12176 in @var{path} that are exported during run-time:
12177
12178 @table @gcctabopt
12179
12180 @item %p
12181 process ID.
12182
12183 @item %q@{VAR@}
12184 value of environment variable @var{VAR}
12185
12186 @end table
12187
12188 @item -fprofile-generate
12189 @itemx -fprofile-generate=@var{path}
12190 @opindex fprofile-generate
12191
12192 Enable options usually used for instrumenting application to produce
12193 profile useful for later recompilation with profile feedback based
12194 optimization. You must use @option{-fprofile-generate} both when
12195 compiling and when linking your program.
12196
12197 The following options are enabled:
12198 @option{-fprofile-arcs}, @option{-fprofile-values},
12199 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12200
12201 If @var{path} is specified, GCC looks at the @var{path} to find
12202 the profile feedback data files. See @option{-fprofile-dir}.
12203
12204 To optimize the program based on the collected profile information, use
12205 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12206
12207 @item -fprofile-update=@var{method}
12208 @opindex fprofile-update
12209
12210 Alter the update method for an application instrumented for profile
12211 feedback based optimization. The @var{method} argument should be one of
12212 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12213 The first one is useful for single-threaded applications,
12214 while the second one prevents profile corruption by emitting thread-safe code.
12215
12216 @strong{Warning:} When an application does not properly join all threads
12217 (or creates an detached thread), a profile file can be still corrupted.
12218
12219 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12220 when supported by a target, or to @samp{single} otherwise. The GCC driver
12221 automatically selects @samp{prefer-atomic} when @option{-pthread}
12222 is present in the command line.
12223
12224 @item -fprofile-filter-files=@var{regex}
12225 @opindex fprofile-filter-files
12226
12227 Instrument only functions from files where names match
12228 any regular expression (separated by a semi-colon).
12229
12230 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12231 only @file{main.c} and all C files starting with 'module'.
12232
12233 @item -fprofile-exclude-files=@var{regex}
12234 @opindex fprofile-exclude-files
12235
12236 Instrument only functions from files where names do not match
12237 all the regular expressions (separated by a semi-colon).
12238
12239 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12240 of all files that are located in @file{/usr/} folder.
12241
12242 @item -fsanitize=address
12243 @opindex fsanitize=address
12244 Enable AddressSanitizer, a fast memory error detector.
12245 Memory access instructions are instrumented to detect
12246 out-of-bounds and use-after-free bugs.
12247 The option enables @option{-fsanitize-address-use-after-scope}.
12248 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12249 more details. The run-time behavior can be influenced using the
12250 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12251 the available options are shown at startup of the instrumented program. See
12252 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12253 for a list of supported options.
12254 The option cannot be combined with @option{-fsanitize=thread}.
12255
12256 @item -fsanitize=kernel-address
12257 @opindex fsanitize=kernel-address
12258 Enable AddressSanitizer for Linux kernel.
12259 See @uref{https://github.com/google/kasan/wiki} for more details.
12260
12261 @item -fsanitize=pointer-compare
12262 @opindex fsanitize=pointer-compare
12263 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12264 The option must be combined with either @option{-fsanitize=kernel-address} or
12265 @option{-fsanitize=address}
12266 The option cannot be combined with @option{-fsanitize=thread}.
12267 Note: By default the check is disabled at run time. To enable it,
12268 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12269 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12270 invalid operation only when both pointers are non-null.
12271
12272 @item -fsanitize=pointer-subtract
12273 @opindex fsanitize=pointer-subtract
12274 Instrument subtraction with pointer operands.
12275 The option must be combined with either @option{-fsanitize=kernel-address} or
12276 @option{-fsanitize=address}
12277 The option cannot be combined with @option{-fsanitize=thread}.
12278 Note: By default the check is disabled at run time. To enable it,
12279 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12280 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12281 invalid operation only when both pointers are non-null.
12282
12283 @item -fsanitize=thread
12284 @opindex fsanitize=thread
12285 Enable ThreadSanitizer, a fast data race detector.
12286 Memory access instructions are instrumented to detect
12287 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12288 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12289 environment variable; see
12290 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12291 supported options.
12292 The option cannot be combined with @option{-fsanitize=address},
12293 @option{-fsanitize=leak}.
12294
12295 Note that sanitized atomic builtins cannot throw exceptions when
12296 operating on invalid memory addresses with non-call exceptions
12297 (@option{-fnon-call-exceptions}).
12298
12299 @item -fsanitize=leak
12300 @opindex fsanitize=leak
12301 Enable LeakSanitizer, a memory leak detector.
12302 This option only matters for linking of executables and
12303 the executable is linked against a library that overrides @code{malloc}
12304 and other allocator functions. See
12305 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12306 details. The run-time behavior can be influenced using the
12307 @env{LSAN_OPTIONS} environment variable.
12308 The option cannot be combined with @option{-fsanitize=thread}.
12309
12310 @item -fsanitize=undefined
12311 @opindex fsanitize=undefined
12312 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12313 Various computations are instrumented to detect undefined behavior
12314 at runtime. Current suboptions are:
12315
12316 @table @gcctabopt
12317
12318 @item -fsanitize=shift
12319 @opindex fsanitize=shift
12320 This option enables checking that the result of a shift operation is
12321 not undefined. Note that what exactly is considered undefined differs
12322 slightly between C and C++, as well as between ISO C90 and C99, etc.
12323 This option has two suboptions, @option{-fsanitize=shift-base} and
12324 @option{-fsanitize=shift-exponent}.
12325
12326 @item -fsanitize=shift-exponent
12327 @opindex fsanitize=shift-exponent
12328 This option enables checking that the second argument of a shift operation
12329 is not negative and is smaller than the precision of the promoted first
12330 argument.
12331
12332 @item -fsanitize=shift-base
12333 @opindex fsanitize=shift-base
12334 If the second argument of a shift operation is within range, check that the
12335 result of a shift operation is not undefined. Note that what exactly is
12336 considered undefined differs slightly between C and C++, as well as between
12337 ISO C90 and C99, etc.
12338
12339 @item -fsanitize=integer-divide-by-zero
12340 @opindex fsanitize=integer-divide-by-zero
12341 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12342
12343 @item -fsanitize=unreachable
12344 @opindex fsanitize=unreachable
12345 With this option, the compiler turns the @code{__builtin_unreachable}
12346 call into a diagnostics message call instead. When reaching the
12347 @code{__builtin_unreachable} call, the behavior is undefined.
12348
12349 @item -fsanitize=vla-bound
12350 @opindex fsanitize=vla-bound
12351 This option instructs the compiler to check that the size of a variable
12352 length array is positive.
12353
12354 @item -fsanitize=null
12355 @opindex fsanitize=null
12356 This option enables pointer checking. Particularly, the application
12357 built with this option turned on will issue an error message when it
12358 tries to dereference a NULL pointer, or if a reference (possibly an
12359 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12360 on an object pointed by a NULL pointer.
12361
12362 @item -fsanitize=return
12363 @opindex fsanitize=return
12364 This option enables return statement checking. Programs
12365 built with this option turned on will issue an error message
12366 when the end of a non-void function is reached without actually
12367 returning a value. This option works in C++ only.
12368
12369 @item -fsanitize=signed-integer-overflow
12370 @opindex fsanitize=signed-integer-overflow
12371 This option enables signed integer overflow checking. We check that
12372 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12373 does not overflow in the signed arithmetics. Note, integer promotion
12374 rules must be taken into account. That is, the following is not an
12375 overflow:
12376 @smallexample
12377 signed char a = SCHAR_MAX;
12378 a++;
12379 @end smallexample
12380
12381 @item -fsanitize=bounds
12382 @opindex fsanitize=bounds
12383 This option enables instrumentation of array bounds. Various out of bounds
12384 accesses are detected. Flexible array members, flexible array member-like
12385 arrays, and initializers of variables with static storage are not instrumented.
12386
12387 @item -fsanitize=bounds-strict
12388 @opindex fsanitize=bounds-strict
12389 This option enables strict instrumentation of array bounds. Most out of bounds
12390 accesses are detected, including flexible array members and flexible array
12391 member-like arrays. Initializers of variables with static storage are not
12392 instrumented.
12393
12394 @item -fsanitize=alignment
12395 @opindex fsanitize=alignment
12396
12397 This option enables checking of alignment of pointers when they are
12398 dereferenced, or when a reference is bound to insufficiently aligned target,
12399 or when a method or constructor is invoked on insufficiently aligned object.
12400
12401 @item -fsanitize=object-size
12402 @opindex fsanitize=object-size
12403 This option enables instrumentation of memory references using the
12404 @code{__builtin_object_size} function. Various out of bounds pointer
12405 accesses are detected.
12406
12407 @item -fsanitize=float-divide-by-zero
12408 @opindex fsanitize=float-divide-by-zero
12409 Detect floating-point division by zero. Unlike other similar options,
12410 @option{-fsanitize=float-divide-by-zero} is not enabled by
12411 @option{-fsanitize=undefined}, since floating-point division by zero can
12412 be a legitimate way of obtaining infinities and NaNs.
12413
12414 @item -fsanitize=float-cast-overflow
12415 @opindex fsanitize=float-cast-overflow
12416 This option enables floating-point type to integer conversion checking.
12417 We check that the result of the conversion does not overflow.
12418 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12419 not enabled by @option{-fsanitize=undefined}.
12420 This option does not work well with @code{FE_INVALID} exceptions enabled.
12421
12422 @item -fsanitize=nonnull-attribute
12423 @opindex fsanitize=nonnull-attribute
12424
12425 This option enables instrumentation of calls, checking whether null values
12426 are not passed to arguments marked as requiring a non-null value by the
12427 @code{nonnull} function attribute.
12428
12429 @item -fsanitize=returns-nonnull-attribute
12430 @opindex fsanitize=returns-nonnull-attribute
12431
12432 This option enables instrumentation of return statements in functions
12433 marked with @code{returns_nonnull} function attribute, to detect returning
12434 of null values from such functions.
12435
12436 @item -fsanitize=bool
12437 @opindex fsanitize=bool
12438
12439 This option enables instrumentation of loads from bool. If a value other
12440 than 0/1 is loaded, a run-time error is issued.
12441
12442 @item -fsanitize=enum
12443 @opindex fsanitize=enum
12444
12445 This option enables instrumentation of loads from an enum type. If
12446 a value outside the range of values for the enum type is loaded,
12447 a run-time error is issued.
12448
12449 @item -fsanitize=vptr
12450 @opindex fsanitize=vptr
12451
12452 This option enables instrumentation of C++ member function calls, member
12453 accesses and some conversions between pointers to base and derived classes,
12454 to verify the referenced object has the correct dynamic type.
12455
12456 @item -fsanitize=pointer-overflow
12457 @opindex fsanitize=pointer-overflow
12458
12459 This option enables instrumentation of pointer arithmetics. If the pointer
12460 arithmetics overflows, a run-time error is issued.
12461
12462 @item -fsanitize=builtin
12463 @opindex fsanitize=builtin
12464
12465 This option enables instrumentation of arguments to selected builtin
12466 functions. If an invalid value is passed to such arguments, a run-time
12467 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12468 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12469 by this option.
12470
12471 @end table
12472
12473 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12474 @option{-fsanitize=undefined} gives a diagnostic message.
12475 This currently works only for the C family of languages.
12476
12477 @item -fno-sanitize=all
12478 @opindex fno-sanitize=all
12479
12480 This option disables all previously enabled sanitizers.
12481 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12482 together.
12483
12484 @item -fasan-shadow-offset=@var{number}
12485 @opindex fasan-shadow-offset
12486 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12487 It is useful for experimenting with different shadow memory layouts in
12488 Kernel AddressSanitizer.
12489
12490 @item -fsanitize-sections=@var{s1},@var{s2},...
12491 @opindex fsanitize-sections
12492 Sanitize global variables in selected user-defined sections. @var{si} may
12493 contain wildcards.
12494
12495 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12496 @opindex fsanitize-recover
12497 @opindex fno-sanitize-recover
12498 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12499 mentioned in comma-separated list of @var{opts}. Enabling this option
12500 for a sanitizer component causes it to attempt to continue
12501 running the program as if no error happened. This means multiple
12502 runtime errors can be reported in a single program run, and the exit
12503 code of the program may indicate success even when errors
12504 have been reported. The @option{-fno-sanitize-recover=} option
12505 can be used to alter
12506 this behavior: only the first detected error is reported
12507 and program then exits with a non-zero exit code.
12508
12509 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12510 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12511 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12512 @option{-fsanitize=bounds-strict},
12513 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12514 For these sanitizers error recovery is turned on by default,
12515 except @option{-fsanitize=address}, for which this feature is experimental.
12516 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12517 accepted, the former enables recovery for all sanitizers that support it,
12518 the latter disables recovery for all sanitizers that support it.
12519
12520 Even if a recovery mode is turned on the compiler side, it needs to be also
12521 enabled on the runtime library side, otherwise the failures are still fatal.
12522 The runtime library defaults to @code{halt_on_error=0} for
12523 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12524 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12525 setting the @code{halt_on_error} flag in the corresponding environment variable.
12526
12527 Syntax without an explicit @var{opts} parameter is deprecated. It is
12528 equivalent to specifying an @var{opts} list of:
12529
12530 @smallexample
12531 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12532 @end smallexample
12533
12534 @item -fsanitize-address-use-after-scope
12535 @opindex fsanitize-address-use-after-scope
12536 Enable sanitization of local variables to detect use-after-scope bugs.
12537 The option sets @option{-fstack-reuse} to @samp{none}.
12538
12539 @item -fsanitize-undefined-trap-on-error
12540 @opindex fsanitize-undefined-trap-on-error
12541 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12542 report undefined behavior using @code{__builtin_trap} rather than
12543 a @code{libubsan} library routine. The advantage of this is that the
12544 @code{libubsan} library is not needed and is not linked in, so this
12545 is usable even in freestanding environments.
12546
12547 @item -fsanitize-coverage=trace-pc
12548 @opindex fsanitize-coverage=trace-pc
12549 Enable coverage-guided fuzzing code instrumentation.
12550 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12551
12552 @item -fsanitize-coverage=trace-cmp
12553 @opindex fsanitize-coverage=trace-cmp
12554 Enable dataflow guided fuzzing code instrumentation.
12555 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12556 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12557 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12558 variable or @code{__sanitizer_cov_trace_const_cmp1},
12559 @code{__sanitizer_cov_trace_const_cmp2},
12560 @code{__sanitizer_cov_trace_const_cmp4} or
12561 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12562 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12563 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12564 @code{__sanitizer_cov_trace_switch} for switch statements.
12565
12566 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12567 @opindex fcf-protection
12568 Enable code instrumentation of control-flow transfers to increase
12569 program security by checking that target addresses of control-flow
12570 transfer instructions (such as indirect function call, function return,
12571 indirect jump) are valid. This prevents diverting the flow of control
12572 to an unexpected target. This is intended to protect against such
12573 threats as Return-oriented Programming (ROP), and similarly
12574 call/jmp-oriented programming (COP/JOP).
12575
12576 The value @code{branch} tells the compiler to implement checking of
12577 validity of control-flow transfer at the point of indirect branch
12578 instructions, i.e.@: call/jmp instructions. The value @code{return}
12579 implements checking of validity at the point of returning from a
12580 function. The value @code{full} is an alias for specifying both
12581 @code{branch} and @code{return}. The value @code{none} turns off
12582 instrumentation.
12583
12584 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12585 used. The first bit of @code{__CET__} is set to 1 for the value
12586 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12587 the @code{return}.
12588
12589 You can also use the @code{nocf_check} attribute to identify
12590 which functions and calls should be skipped from instrumentation
12591 (@pxref{Function Attributes}).
12592
12593 Currently the x86 GNU/Linux target provides an implementation based
12594 on Intel Control-flow Enforcement Technology (CET).
12595
12596 @item -fstack-protector
12597 @opindex fstack-protector
12598 Emit extra code to check for buffer overflows, such as stack smashing
12599 attacks. This is done by adding a guard variable to functions with
12600 vulnerable objects. This includes functions that call @code{alloca}, and
12601 functions with buffers larger than 8 bytes. The guards are initialized
12602 when a function is entered and then checked when the function exits.
12603 If a guard check fails, an error message is printed and the program exits.
12604
12605 @item -fstack-protector-all
12606 @opindex fstack-protector-all
12607 Like @option{-fstack-protector} except that all functions are protected.
12608
12609 @item -fstack-protector-strong
12610 @opindex fstack-protector-strong
12611 Like @option{-fstack-protector} but includes additional functions to
12612 be protected --- those that have local array definitions, or have
12613 references to local frame addresses.
12614
12615 @item -fstack-protector-explicit
12616 @opindex fstack-protector-explicit
12617 Like @option{-fstack-protector} but only protects those functions which
12618 have the @code{stack_protect} attribute.
12619
12620 @item -fstack-check
12621 @opindex fstack-check
12622 Generate code to verify that you do not go beyond the boundary of the
12623 stack. You should specify this flag if you are running in an
12624 environment with multiple threads, but you only rarely need to specify it in
12625 a single-threaded environment since stack overflow is automatically
12626 detected on nearly all systems if there is only one stack.
12627
12628 Note that this switch does not actually cause checking to be done; the
12629 operating system or the language runtime must do that. The switch causes
12630 generation of code to ensure that they see the stack being extended.
12631
12632 You can additionally specify a string parameter: @samp{no} means no
12633 checking, @samp{generic} means force the use of old-style checking,
12634 @samp{specific} means use the best checking method and is equivalent
12635 to bare @option{-fstack-check}.
12636
12637 Old-style checking is a generic mechanism that requires no specific
12638 target support in the compiler but comes with the following drawbacks:
12639
12640 @enumerate
12641 @item
12642 Modified allocation strategy for large objects: they are always
12643 allocated dynamically if their size exceeds a fixed threshold. Note this
12644 may change the semantics of some code.
12645
12646 @item
12647 Fixed limit on the size of the static frame of functions: when it is
12648 topped by a particular function, stack checking is not reliable and
12649 a warning is issued by the compiler.
12650
12651 @item
12652 Inefficiency: because of both the modified allocation strategy and the
12653 generic implementation, code performance is hampered.
12654 @end enumerate
12655
12656 Note that old-style stack checking is also the fallback method for
12657 @samp{specific} if no target support has been added in the compiler.
12658
12659 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12660 and stack overflows. @samp{specific} is an excellent choice when compiling
12661 Ada code. It is not generally sufficient to protect against stack-clash
12662 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12663
12664 @item -fstack-clash-protection
12665 @opindex fstack-clash-protection
12666 Generate code to prevent stack clash style attacks. When this option is
12667 enabled, the compiler will only allocate one page of stack space at a time
12668 and each page is accessed immediately after allocation. Thus, it prevents
12669 allocations from jumping over any stack guard page provided by the
12670 operating system.
12671
12672 Most targets do not fully support stack clash protection. However, on
12673 those targets @option{-fstack-clash-protection} will protect dynamic stack
12674 allocations. @option{-fstack-clash-protection} may also provide limited
12675 protection for static stack allocations if the target supports
12676 @option{-fstack-check=specific}.
12677
12678 @item -fstack-limit-register=@var{reg}
12679 @itemx -fstack-limit-symbol=@var{sym}
12680 @itemx -fno-stack-limit
12681 @opindex fstack-limit-register
12682 @opindex fstack-limit-symbol
12683 @opindex fno-stack-limit
12684 Generate code to ensure that the stack does not grow beyond a certain value,
12685 either the value of a register or the address of a symbol. If a larger
12686 stack is required, a signal is raised at run time. For most targets,
12687 the signal is raised before the stack overruns the boundary, so
12688 it is possible to catch the signal without taking special precautions.
12689
12690 For instance, if the stack starts at absolute address @samp{0x80000000}
12691 and grows downwards, you can use the flags
12692 @option{-fstack-limit-symbol=__stack_limit} and
12693 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12694 of 128KB@. Note that this may only work with the GNU linker.
12695
12696 You can locally override stack limit checking by using the
12697 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12698
12699 @item -fsplit-stack
12700 @opindex fsplit-stack
12701 Generate code to automatically split the stack before it overflows.
12702 The resulting program has a discontiguous stack which can only
12703 overflow if the program is unable to allocate any more memory. This
12704 is most useful when running threaded programs, as it is no longer
12705 necessary to calculate a good stack size to use for each thread. This
12706 is currently only implemented for the x86 targets running
12707 GNU/Linux.
12708
12709 When code compiled with @option{-fsplit-stack} calls code compiled
12710 without @option{-fsplit-stack}, there may not be much stack space
12711 available for the latter code to run. If compiling all code,
12712 including library code, with @option{-fsplit-stack} is not an option,
12713 then the linker can fix up these calls so that the code compiled
12714 without @option{-fsplit-stack} always has a large stack. Support for
12715 this is implemented in the gold linker in GNU binutils release 2.21
12716 and later.
12717
12718 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12719 @opindex fvtable-verify
12720 This option is only available when compiling C++ code.
12721 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12722 feature that verifies at run time, for every virtual call, that
12723 the vtable pointer through which the call is made is valid for the type of
12724 the object, and has not been corrupted or overwritten. If an invalid vtable
12725 pointer is detected at run time, an error is reported and execution of the
12726 program is immediately halted.
12727
12728 This option causes run-time data structures to be built at program startup,
12729 which are used for verifying the vtable pointers.
12730 The options @samp{std} and @samp{preinit}
12731 control the timing of when these data structures are built. In both cases the
12732 data structures are built before execution reaches @code{main}. Using
12733 @option{-fvtable-verify=std} causes the data structures to be built after
12734 shared libraries have been loaded and initialized.
12735 @option{-fvtable-verify=preinit} causes them to be built before shared
12736 libraries have been loaded and initialized.
12737
12738 If this option appears multiple times in the command line with different
12739 values specified, @samp{none} takes highest priority over both @samp{std} and
12740 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12741
12742 @item -fvtv-debug
12743 @opindex fvtv-debug
12744 When used in conjunction with @option{-fvtable-verify=std} or
12745 @option{-fvtable-verify=preinit}, causes debug versions of the
12746 runtime functions for the vtable verification feature to be called.
12747 This flag also causes the compiler to log information about which
12748 vtable pointers it finds for each class.
12749 This information is written to a file named @file{vtv_set_ptr_data.log}
12750 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12751 if that is defined or the current working directory otherwise.
12752
12753 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12754 file, be sure to delete any existing one.
12755
12756 @item -fvtv-counts
12757 @opindex fvtv-counts
12758 This is a debugging flag. When used in conjunction with
12759 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12760 causes the compiler to keep track of the total number of virtual calls
12761 it encounters and the number of verifications it inserts. It also
12762 counts the number of calls to certain run-time library functions
12763 that it inserts and logs this information for each compilation unit.
12764 The compiler writes this information to a file named
12765 @file{vtv_count_data.log} in the directory named by the environment
12766 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12767 directory otherwise. It also counts the size of the vtable pointer sets
12768 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12769 in the same directory.
12770
12771 Note: This feature @emph{appends} data to the log files. To get fresh log
12772 files, be sure to delete any existing ones.
12773
12774 @item -finstrument-functions
12775 @opindex finstrument-functions
12776 Generate instrumentation calls for entry and exit to functions. Just
12777 after function entry and just before function exit, the following
12778 profiling functions are called with the address of the current
12779 function and its call site. (On some platforms,
12780 @code{__builtin_return_address} does not work beyond the current
12781 function, so the call site information may not be available to the
12782 profiling functions otherwise.)
12783
12784 @smallexample
12785 void __cyg_profile_func_enter (void *this_fn,
12786 void *call_site);
12787 void __cyg_profile_func_exit (void *this_fn,
12788 void *call_site);
12789 @end smallexample
12790
12791 The first argument is the address of the start of the current function,
12792 which may be looked up exactly in the symbol table.
12793
12794 This instrumentation is also done for functions expanded inline in other
12795 functions. The profiling calls indicate where, conceptually, the
12796 inline function is entered and exited. This means that addressable
12797 versions of such functions must be available. If all your uses of a
12798 function are expanded inline, this may mean an additional expansion of
12799 code size. If you use @code{extern inline} in your C code, an
12800 addressable version of such functions must be provided. (This is
12801 normally the case anyway, but if you get lucky and the optimizer always
12802 expands the functions inline, you might have gotten away without
12803 providing static copies.)
12804
12805 A function may be given the attribute @code{no_instrument_function}, in
12806 which case this instrumentation is not done. This can be used, for
12807 example, for the profiling functions listed above, high-priority
12808 interrupt routines, and any functions from which the profiling functions
12809 cannot safely be called (perhaps signal handlers, if the profiling
12810 routines generate output or allocate memory).
12811 @xref{Common Function Attributes}.
12812
12813 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12814 @opindex finstrument-functions-exclude-file-list
12815
12816 Set the list of functions that are excluded from instrumentation (see
12817 the description of @option{-finstrument-functions}). If the file that
12818 contains a function definition matches with one of @var{file}, then
12819 that function is not instrumented. The match is done on substrings:
12820 if the @var{file} parameter is a substring of the file name, it is
12821 considered to be a match.
12822
12823 For example:
12824
12825 @smallexample
12826 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12827 @end smallexample
12828
12829 @noindent
12830 excludes any inline function defined in files whose pathnames
12831 contain @file{/bits/stl} or @file{include/sys}.
12832
12833 If, for some reason, you want to include letter @samp{,} in one of
12834 @var{sym}, write @samp{\,}. For example,
12835 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12836 (note the single quote surrounding the option).
12837
12838 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12839 @opindex finstrument-functions-exclude-function-list
12840
12841 This is similar to @option{-finstrument-functions-exclude-file-list},
12842 but this option sets the list of function names to be excluded from
12843 instrumentation. The function name to be matched is its user-visible
12844 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12845 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12846 match is done on substrings: if the @var{sym} parameter is a substring
12847 of the function name, it is considered to be a match. For C99 and C++
12848 extended identifiers, the function name must be given in UTF-8, not
12849 using universal character names.
12850
12851 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12852 @opindex fpatchable-function-entry
12853 Generate @var{N} NOPs right at the beginning
12854 of each function, with the function entry point before the @var{M}th NOP.
12855 If @var{M} is omitted, it defaults to @code{0} so the
12856 function entry points to the address just at the first NOP.
12857 The NOP instructions reserve extra space which can be used to patch in
12858 any desired instrumentation at run time, provided that the code segment
12859 is writable. The amount of space is controllable indirectly via
12860 the number of NOPs; the NOP instruction used corresponds to the instruction
12861 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12862 is target-specific and may also depend on the architecture variant and/or
12863 other compilation options.
12864
12865 For run-time identification, the starting addresses of these areas,
12866 which correspond to their respective function entries minus @var{M},
12867 are additionally collected in the @code{__patchable_function_entries}
12868 section of the resulting binary.
12869
12870 Note that the value of @code{__attribute__ ((patchable_function_entry
12871 (N,M)))} takes precedence over command-line option
12872 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12873 the area size or to remove it completely on a single function.
12874 If @code{N=0}, no pad location is recorded.
12875
12876 The NOP instructions are inserted at---and maybe before, depending on
12877 @var{M}---the function entry address, even before the prologue.
12878
12879 @end table
12880
12881
12882 @node Preprocessor Options
12883 @section Options Controlling the Preprocessor
12884 @cindex preprocessor options
12885 @cindex options, preprocessor
12886
12887 These options control the C preprocessor, which is run on each C source
12888 file before actual compilation.
12889
12890 If you use the @option{-E} option, nothing is done except preprocessing.
12891 Some of these options make sense only together with @option{-E} because
12892 they cause the preprocessor output to be unsuitable for actual
12893 compilation.
12894
12895 In addition to the options listed here, there are a number of options
12896 to control search paths for include files documented in
12897 @ref{Directory Options}.
12898 Options to control preprocessor diagnostics are listed in
12899 @ref{Warning Options}.
12900
12901 @table @gcctabopt
12902 @include cppopts.texi
12903
12904 @item -Wp,@var{option}
12905 @opindex Wp
12906 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12907 and pass @var{option} directly through to the preprocessor. If
12908 @var{option} contains commas, it is split into multiple options at the
12909 commas. However, many options are modified, translated or interpreted
12910 by the compiler driver before being passed to the preprocessor, and
12911 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12912 interface is undocumented and subject to change, so whenever possible
12913 you should avoid using @option{-Wp} and let the driver handle the
12914 options instead.
12915
12916 @item -Xpreprocessor @var{option}
12917 @opindex Xpreprocessor
12918 Pass @var{option} as an option to the preprocessor. You can use this to
12919 supply system-specific preprocessor options that GCC does not
12920 recognize.
12921
12922 If you want to pass an option that takes an argument, you must use
12923 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12924
12925 @item -no-integrated-cpp
12926 @opindex no-integrated-cpp
12927 Perform preprocessing as a separate pass before compilation.
12928 By default, GCC performs preprocessing as an integrated part of
12929 input tokenization and parsing.
12930 If this option is provided, the appropriate language front end
12931 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12932 and Objective-C, respectively) is instead invoked twice,
12933 once for preprocessing only and once for actual compilation
12934 of the preprocessed input.
12935 This option may be useful in conjunction with the @option{-B} or
12936 @option{-wrapper} options to specify an alternate preprocessor or
12937 perform additional processing of the program source between
12938 normal preprocessing and compilation.
12939
12940 @end table
12941
12942 @node Assembler Options
12943 @section Passing Options to the Assembler
12944
12945 @c prevent bad page break with this line
12946 You can pass options to the assembler.
12947
12948 @table @gcctabopt
12949 @item -Wa,@var{option}
12950 @opindex Wa
12951 Pass @var{option} as an option to the assembler. If @var{option}
12952 contains commas, it is split into multiple options at the commas.
12953
12954 @item -Xassembler @var{option}
12955 @opindex Xassembler
12956 Pass @var{option} as an option to the assembler. You can use this to
12957 supply system-specific assembler options that GCC does not
12958 recognize.
12959
12960 If you want to pass an option that takes an argument, you must use
12961 @option{-Xassembler} twice, once for the option and once for the argument.
12962
12963 @end table
12964
12965 @node Link Options
12966 @section Options for Linking
12967 @cindex link options
12968 @cindex options, linking
12969
12970 These options come into play when the compiler links object files into
12971 an executable output file. They are meaningless if the compiler is
12972 not doing a link step.
12973
12974 @table @gcctabopt
12975 @cindex file names
12976 @item @var{object-file-name}
12977 A file name that does not end in a special recognized suffix is
12978 considered to name an object file or library. (Object files are
12979 distinguished from libraries by the linker according to the file
12980 contents.) If linking is done, these object files are used as input
12981 to the linker.
12982
12983 @item -c
12984 @itemx -S
12985 @itemx -E
12986 @opindex c
12987 @opindex S
12988 @opindex E
12989 If any of these options is used, then the linker is not run, and
12990 object file names should not be used as arguments. @xref{Overall
12991 Options}.
12992
12993 @item -flinker-output=@var{type}
12994 @opindex flinker-output
12995 This option controls the code generation of the link time optimizer. By
12996 default the linker output is determined by the linker plugin automatically. For
12997 debugging the compiler and in the case of incremental linking to non-lto object
12998 file is desired, it may be useful to control the type manually.
12999
13000 If @var{type} is @samp{exec} the code generation is configured to produce static
13001 binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
13002
13003 If @var{type} is @samp{dyn} the code generation is configured to produce shared
13004 library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
13005 enabled automatically. This makes it possible to build shared libraries without
13006 position independent code on architectures this is possible, i.e.@: on x86.
13007
13008 If @var{type} is @samp{pie} the code generation is configured to produce
13009 @option{-fpie} executable. This result in similar optimizations as @samp{exec}
13010 except that @option{-fpie} is not disabled if specified at compilation time.
13011
13012 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
13013 done. The sections containing intermediate code for link-time optimization are
13014 merged, pre-optimized, and output to the resulting object file. In addition, if
13015 @option{-ffat-lto-objects} is specified the binary code is produced for future
13016 non-lto linking. The object file produced by incremental linking will be smaller
13017 than a static library produced from the same object files. At link-time the
13018 result of incremental linking will also load faster to compiler than a static
13019 library assuming that majority of objects in the library are used.
13020
13021 Finally @samp{nolto-rel} configure compiler to for incremental linking where
13022 code generation is forced, final binary is produced and the intermediate code
13023 for later link-time optimization is stripped. When multiple object files are
13024 linked together the resulting code will be optimized better than with link time
13025 optimizations disabled (for example, the cross-module inlining will happen),
13026 most of benefits of whole program optimizations are however lost.
13027
13028 During the incremental link (by @option{-r}) the linker plugin will default to
13029 @option{rel}. With current interfaces to GNU Binutils it is however not
13030 possible to link incrementally LTO objects and non-LTO objects into a single
13031 mixed object file. In the case any of object files in incremental link can not
13032 be used for link-time optimization the linker plugin will output warning and
13033 use @samp{nolto-rel}. To maintain the whole program optimization it is
13034 recommended to link such objects into static library instead. Alternatively it
13035 is possible to use H.J. Lu's binutils with support for mixed objects.
13036
13037 @item -fuse-ld=bfd
13038 @opindex fuse-ld=bfd
13039 Use the @command{bfd} linker instead of the default linker.
13040
13041 @item -fuse-ld=gold
13042 @opindex fuse-ld=gold
13043 Use the @command{gold} linker instead of the default linker.
13044
13045 @item -fuse-ld=lld
13046 @opindex fuse-ld=lld
13047 Use the LLVM @command{lld} linker instead of the default linker.
13048
13049 @cindex Libraries
13050 @item -l@var{library}
13051 @itemx -l @var{library}
13052 @opindex l
13053 Search the library named @var{library} when linking. (The second
13054 alternative with the library as a separate argument is only for
13055 POSIX compliance and is not recommended.)
13056
13057 The @option{-l} option is passed directly to the linker by GCC. Refer
13058 to your linker documentation for exact details. The general
13059 description below applies to the GNU linker.
13060
13061 The linker searches a standard list of directories for the library.
13062 The directories searched include several standard system directories
13063 plus any that you specify with @option{-L}.
13064
13065 Static libraries are archives of object files, and have file names
13066 like @file{lib@var{library}.a}. Some targets also support shared
13067 libraries, which typically have names like @file{lib@var{library}.so}.
13068 If both static and shared libraries are found, the linker gives
13069 preference to linking with the shared library unless the
13070 @option{-static} option is used.
13071
13072 It makes a difference where in the command you write this option; the
13073 linker searches and processes libraries and object files in the order they
13074 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13075 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13076 to functions in @samp{z}, those functions may not be loaded.
13077
13078 @item -lobjc
13079 @opindex lobjc
13080 You need this special case of the @option{-l} option in order to
13081 link an Objective-C or Objective-C++ program.
13082
13083 @item -nostartfiles
13084 @opindex nostartfiles
13085 Do not use the standard system startup files when linking.
13086 The standard system libraries are used normally, unless @option{-nostdlib},
13087 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13088
13089 @item -nodefaultlibs
13090 @opindex nodefaultlibs
13091 Do not use the standard system libraries when linking.
13092 Only the libraries you specify are passed to the linker, and options
13093 specifying linkage of the system libraries, such as @option{-static-libgcc}
13094 or @option{-shared-libgcc}, are ignored.
13095 The standard startup files are used normally, unless @option{-nostartfiles}
13096 is used.
13097
13098 The compiler may generate calls to @code{memcmp},
13099 @code{memset}, @code{memcpy} and @code{memmove}.
13100 These entries are usually resolved by entries in
13101 libc. These entry points should be supplied through some other
13102 mechanism when this option is specified.
13103
13104 @item -nolibc
13105 @opindex nolibc
13106 Do not use the C library or system libraries tightly coupled with it when
13107 linking. Still link with the startup files, @file{libgcc} or toolchain
13108 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13109 or @file{libstdc++} unless options preventing their inclusion are used as
13110 well. This typically removes @option{-lc} from the link command line, as well
13111 as system libraries that normally go with it and become meaningless when
13112 absence of a C library is assumed, for example @option{-lpthread} or
13113 @option{-lm} in some configurations. This is intended for bare-board
13114 targets when there is indeed no C library available.
13115
13116 @item -nostdlib
13117 @opindex nostdlib
13118 Do not use the standard system startup files or libraries when linking.
13119 No startup files and only the libraries you specify are passed to
13120 the linker, and options specifying linkage of the system libraries, such as
13121 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13122
13123 The compiler may generate calls to @code{memcmp}, @code{memset},
13124 @code{memcpy} and @code{memmove}.
13125 These entries are usually resolved by entries in
13126 libc. These entry points should be supplied through some other
13127 mechanism when this option is specified.
13128
13129 @cindex @option{-lgcc}, use with @option{-nostdlib}
13130 @cindex @option{-nostdlib} and unresolved references
13131 @cindex unresolved references and @option{-nostdlib}
13132 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13133 @cindex @option{-nodefaultlibs} and unresolved references
13134 @cindex unresolved references and @option{-nodefaultlibs}
13135 One of the standard libraries bypassed by @option{-nostdlib} and
13136 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13137 which GCC uses to overcome shortcomings of particular machines, or special
13138 needs for some languages.
13139 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13140 Collection (GCC) Internals},
13141 for more discussion of @file{libgcc.a}.)
13142 In most cases, you need @file{libgcc.a} even when you want to avoid
13143 other standard libraries. In other words, when you specify @option{-nostdlib}
13144 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13145 This ensures that you have no unresolved references to internal GCC
13146 library subroutines.
13147 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13148 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13149 GNU Compiler Collection (GCC) Internals}.)
13150
13151 @item -e @var{entry}
13152 @itemx --entry=@var{entry}
13153 @opindex e
13154 @opindex entry
13155
13156 Specify that the program entry point is @var{entry}. The argument is
13157 interpreted by the linker; the GNU linker accepts either a symbol name
13158 or an address.
13159
13160 @item -pie
13161 @opindex pie
13162 Produce a dynamically linked position independent executable on targets
13163 that support it. For predictable results, you must also specify the same
13164 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13165 or model suboptions) when you specify this linker option.
13166
13167 @item -no-pie
13168 @opindex no-pie
13169 Don't produce a dynamically linked position independent executable.
13170
13171 @item -static-pie
13172 @opindex static-pie
13173 Produce a static position independent executable on targets that support
13174 it. A static position independent executable is similar to a static
13175 executable, but can be loaded at any address without a dynamic linker.
13176 For predictable results, you must also specify the same set of options
13177 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13178 suboptions) when you specify this linker option.
13179
13180 @item -pthread
13181 @opindex pthread
13182 Link with the POSIX threads library. This option is supported on
13183 GNU/Linux targets, most other Unix derivatives, and also on
13184 x86 Cygwin and MinGW targets. On some targets this option also sets
13185 flags for the preprocessor, so it should be used consistently for both
13186 compilation and linking.
13187
13188 @item -r
13189 @opindex r
13190 Produce a relocatable object as output. This is also known as partial
13191 linking.
13192
13193 @item -rdynamic
13194 @opindex rdynamic
13195 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13196 that support it. This instructs the linker to add all symbols, not
13197 only used ones, to the dynamic symbol table. This option is needed
13198 for some uses of @code{dlopen} or to allow obtaining backtraces
13199 from within a program.
13200
13201 @item -s
13202 @opindex s
13203 Remove all symbol table and relocation information from the executable.
13204
13205 @item -static
13206 @opindex static
13207 On systems that support dynamic linking, this overrides @option{-pie}
13208 and prevents linking with the shared libraries. On other systems, this
13209 option has no effect.
13210
13211 @item -shared
13212 @opindex shared
13213 Produce a shared object which can then be linked with other objects to
13214 form an executable. Not all systems support this option. For predictable
13215 results, you must also specify the same set of options used for compilation
13216 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13217 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13218 needs to build supplementary stub code for constructors to work. On
13219 multi-libbed systems, @samp{gcc -shared} must select the correct support
13220 libraries to link against. Failing to supply the correct flags may lead
13221 to subtle defects. Supplying them in cases where they are not necessary
13222 is innocuous.}
13223
13224 @item -shared-libgcc
13225 @itemx -static-libgcc
13226 @opindex shared-libgcc
13227 @opindex static-libgcc
13228 On systems that provide @file{libgcc} as a shared library, these options
13229 force the use of either the shared or static version, respectively.
13230 If no shared version of @file{libgcc} was built when the compiler was
13231 configured, these options have no effect.
13232
13233 There are several situations in which an application should use the
13234 shared @file{libgcc} instead of the static version. The most common
13235 of these is when the application wishes to throw and catch exceptions
13236 across different shared libraries. In that case, each of the libraries
13237 as well as the application itself should use the shared @file{libgcc}.
13238
13239 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13240 whenever you build a shared library or a main executable, because C++
13241 programs typically use exceptions, so this is the right thing to do.
13242
13243 If, instead, you use the GCC driver to create shared libraries, you may
13244 find that they are not always linked with the shared @file{libgcc}.
13245 If GCC finds, at its configuration time, that you have a non-GNU linker
13246 or a GNU linker that does not support option @option{--eh-frame-hdr},
13247 it links the shared version of @file{libgcc} into shared libraries
13248 by default. Otherwise, it takes advantage of the linker and optimizes
13249 away the linking with the shared version of @file{libgcc}, linking with
13250 the static version of libgcc by default. This allows exceptions to
13251 propagate through such shared libraries, without incurring relocation
13252 costs at library load time.
13253
13254 However, if a library or main executable is supposed to throw or catch
13255 exceptions, you must link it using the G++ driver, or using the option
13256 @option{-shared-libgcc}, such that it is linked with the shared
13257 @file{libgcc}.
13258
13259 @item -static-libasan
13260 @opindex static-libasan
13261 When the @option{-fsanitize=address} option is used to link a program,
13262 the GCC driver automatically links against @option{libasan}. If
13263 @file{libasan} is available as a shared library, and the @option{-static}
13264 option is not used, then this links against the shared version of
13265 @file{libasan}. The @option{-static-libasan} option directs the GCC
13266 driver to link @file{libasan} statically, without necessarily linking
13267 other libraries statically.
13268
13269 @item -static-libtsan
13270 @opindex static-libtsan
13271 When the @option{-fsanitize=thread} option is used to link a program,
13272 the GCC driver automatically links against @option{libtsan}. If
13273 @file{libtsan} is available as a shared library, and the @option{-static}
13274 option is not used, then this links against the shared version of
13275 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13276 driver to link @file{libtsan} statically, without necessarily linking
13277 other libraries statically.
13278
13279 @item -static-liblsan
13280 @opindex static-liblsan
13281 When the @option{-fsanitize=leak} option is used to link a program,
13282 the GCC driver automatically links against @option{liblsan}. If
13283 @file{liblsan} is available as a shared library, and the @option{-static}
13284 option is not used, then this links against the shared version of
13285 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13286 driver to link @file{liblsan} statically, without necessarily linking
13287 other libraries statically.
13288
13289 @item -static-libubsan
13290 @opindex static-libubsan
13291 When the @option{-fsanitize=undefined} option is used to link a program,
13292 the GCC driver automatically links against @option{libubsan}. If
13293 @file{libubsan} is available as a shared library, and the @option{-static}
13294 option is not used, then this links against the shared version of
13295 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13296 driver to link @file{libubsan} statically, without necessarily linking
13297 other libraries statically.
13298
13299 @item -static-libstdc++
13300 @opindex static-libstdc++
13301 When the @command{g++} program is used to link a C++ program, it
13302 normally automatically links against @option{libstdc++}. If
13303 @file{libstdc++} is available as a shared library, and the
13304 @option{-static} option is not used, then this links against the
13305 shared version of @file{libstdc++}. That is normally fine. However, it
13306 is sometimes useful to freeze the version of @file{libstdc++} used by
13307 the program without going all the way to a fully static link. The
13308 @option{-static-libstdc++} option directs the @command{g++} driver to
13309 link @file{libstdc++} statically, without necessarily linking other
13310 libraries statically.
13311
13312 @item -symbolic
13313 @opindex symbolic
13314 Bind references to global symbols when building a shared object. Warn
13315 about any unresolved references (unless overridden by the link editor
13316 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13317 this option.
13318
13319 @item -T @var{script}
13320 @opindex T
13321 @cindex linker script
13322 Use @var{script} as the linker script. This option is supported by most
13323 systems using the GNU linker. On some targets, such as bare-board
13324 targets without an operating system, the @option{-T} option may be required
13325 when linking to avoid references to undefined symbols.
13326
13327 @item -Xlinker @var{option}
13328 @opindex Xlinker
13329 Pass @var{option} as an option to the linker. You can use this to
13330 supply system-specific linker options that GCC does not recognize.
13331
13332 If you want to pass an option that takes a separate argument, you must use
13333 @option{-Xlinker} twice, once for the option and once for the argument.
13334 For example, to pass @option{-assert definitions}, you must write
13335 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13336 @option{-Xlinker "-assert definitions"}, because this passes the entire
13337 string as a single argument, which is not what the linker expects.
13338
13339 When using the GNU linker, it is usually more convenient to pass
13340 arguments to linker options using the @option{@var{option}=@var{value}}
13341 syntax than as separate arguments. For example, you can specify
13342 @option{-Xlinker -Map=output.map} rather than
13343 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13344 this syntax for command-line options.
13345
13346 @item -Wl,@var{option}
13347 @opindex Wl
13348 Pass @var{option} as an option to the linker. If @var{option} contains
13349 commas, it is split into multiple options at the commas. You can use this
13350 syntax to pass an argument to the option.
13351 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13352 linker. When using the GNU linker, you can also get the same effect with
13353 @option{-Wl,-Map=output.map}.
13354
13355 @item -u @var{symbol}
13356 @opindex u
13357 Pretend the symbol @var{symbol} is undefined, to force linking of
13358 library modules to define it. You can use @option{-u} multiple times with
13359 different symbols to force loading of additional library modules.
13360
13361 @item -z @var{keyword}
13362 @opindex z
13363 @option{-z} is passed directly on to the linker along with the keyword
13364 @var{keyword}. See the section in the documentation of your linker for
13365 permitted values and their meanings.
13366 @end table
13367
13368 @node Directory Options
13369 @section Options for Directory Search
13370 @cindex directory options
13371 @cindex options, directory search
13372 @cindex search path
13373
13374 These options specify directories to search for header files, for
13375 libraries and for parts of the compiler:
13376
13377 @table @gcctabopt
13378 @include cppdiropts.texi
13379
13380 @item -iplugindir=@var{dir}
13381 @opindex iplugindir=
13382 Set the directory to search for plugins that are passed
13383 by @option{-fplugin=@var{name}} instead of
13384 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13385 to be used by the user, but only passed by the driver.
13386
13387 @item -L@var{dir}
13388 @opindex L
13389 Add directory @var{dir} to the list of directories to be searched
13390 for @option{-l}.
13391
13392 @item -B@var{prefix}
13393 @opindex B
13394 This option specifies where to find the executables, libraries,
13395 include files, and data files of the compiler itself.
13396
13397 The compiler driver program runs one or more of the subprograms
13398 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13399 @var{prefix} as a prefix for each program it tries to run, both with and
13400 without @samp{@var{machine}/@var{version}/} for the corresponding target
13401 machine and compiler version.
13402
13403 For each subprogram to be run, the compiler driver first tries the
13404 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13405 is not specified, the driver tries two standard prefixes,
13406 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13407 those results in a file name that is found, the unmodified program
13408 name is searched for using the directories specified in your
13409 @env{PATH} environment variable.
13410
13411 The compiler checks to see if the path provided by @option{-B}
13412 refers to a directory, and if necessary it adds a directory
13413 separator character at the end of the path.
13414
13415 @option{-B} prefixes that effectively specify directory names also apply
13416 to libraries in the linker, because the compiler translates these
13417 options into @option{-L} options for the linker. They also apply to
13418 include files in the preprocessor, because the compiler translates these
13419 options into @option{-isystem} options for the preprocessor. In this case,
13420 the compiler appends @samp{include} to the prefix.
13421
13422 The runtime support file @file{libgcc.a} can also be searched for using
13423 the @option{-B} prefix, if needed. If it is not found there, the two
13424 standard prefixes above are tried, and that is all. The file is left
13425 out of the link if it is not found by those means.
13426
13427 Another way to specify a prefix much like the @option{-B} prefix is to use
13428 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13429 Variables}.
13430
13431 As a special kludge, if the path provided by @option{-B} is
13432 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13433 9, then it is replaced by @file{[dir/]include}. This is to help
13434 with boot-strapping the compiler.
13435
13436 @item -no-canonical-prefixes
13437 @opindex no-canonical-prefixes
13438 Do not expand any symbolic links, resolve references to @samp{/../}
13439 or @samp{/./}, or make the path absolute when generating a relative
13440 prefix.
13441
13442 @item --sysroot=@var{dir}
13443 @opindex sysroot
13444 Use @var{dir} as the logical root directory for headers and libraries.
13445 For example, if the compiler normally searches for headers in
13446 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13447 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13448
13449 If you use both this option and the @option{-isysroot} option, then
13450 the @option{--sysroot} option applies to libraries, but the
13451 @option{-isysroot} option applies to header files.
13452
13453 The GNU linker (beginning with version 2.16) has the necessary support
13454 for this option. If your linker does not support this option, the
13455 header file aspect of @option{--sysroot} still works, but the
13456 library aspect does not.
13457
13458 @item --no-sysroot-suffix
13459 @opindex no-sysroot-suffix
13460 For some targets, a suffix is added to the root directory specified
13461 with @option{--sysroot}, depending on the other options used, so that
13462 headers may for example be found in
13463 @file{@var{dir}/@var{suffix}/usr/include} instead of
13464 @file{@var{dir}/usr/include}. This option disables the addition of
13465 such a suffix.
13466
13467 @end table
13468
13469 @node Code Gen Options
13470 @section Options for Code Generation Conventions
13471 @cindex code generation conventions
13472 @cindex options, code generation
13473 @cindex run-time options
13474
13475 These machine-independent options control the interface conventions
13476 used in code generation.
13477
13478 Most of them have both positive and negative forms; the negative form
13479 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13480 one of the forms is listed---the one that is not the default. You
13481 can figure out the other form by either removing @samp{no-} or adding
13482 it.
13483
13484 @table @gcctabopt
13485 @item -fstack-reuse=@var{reuse-level}
13486 @opindex fstack_reuse
13487 This option controls stack space reuse for user declared local/auto variables
13488 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13489 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13490 local variables and temporaries, @samp{named_vars} enables the reuse only for
13491 user defined local variables with names, and @samp{none} disables stack reuse
13492 completely. The default value is @samp{all}. The option is needed when the
13493 program extends the lifetime of a scoped local variable or a compiler generated
13494 temporary beyond the end point defined by the language. When a lifetime of
13495 a variable ends, and if the variable lives in memory, the optimizing compiler
13496 has the freedom to reuse its stack space with other temporaries or scoped
13497 local variables whose live range does not overlap with it. Legacy code extending
13498 local lifetime is likely to break with the stack reuse optimization.
13499
13500 For example,
13501
13502 @smallexample
13503 int *p;
13504 @{
13505 int local1;
13506
13507 p = &local1;
13508 local1 = 10;
13509 ....
13510 @}
13511 @{
13512 int local2;
13513 local2 = 20;
13514 ...
13515 @}
13516
13517 if (*p == 10) // out of scope use of local1
13518 @{
13519
13520 @}
13521 @end smallexample
13522
13523 Another example:
13524 @smallexample
13525
13526 struct A
13527 @{
13528 A(int k) : i(k), j(k) @{ @}
13529 int i;
13530 int j;
13531 @};
13532
13533 A *ap;
13534
13535 void foo(const A& ar)
13536 @{
13537 ap = &ar;
13538 @}
13539
13540 void bar()
13541 @{
13542 foo(A(10)); // temp object's lifetime ends when foo returns
13543
13544 @{
13545 A a(20);
13546 ....
13547 @}
13548 ap->i+= 10; // ap references out of scope temp whose space
13549 // is reused with a. What is the value of ap->i?
13550 @}
13551
13552 @end smallexample
13553
13554 The lifetime of a compiler generated temporary is well defined by the C++
13555 standard. When a lifetime of a temporary ends, and if the temporary lives
13556 in memory, the optimizing compiler has the freedom to reuse its stack
13557 space with other temporaries or scoped local variables whose live range
13558 does not overlap with it. However some of the legacy code relies on
13559 the behavior of older compilers in which temporaries' stack space is
13560 not reused, the aggressive stack reuse can lead to runtime errors. This
13561 option is used to control the temporary stack reuse optimization.
13562
13563 @item -ftrapv
13564 @opindex ftrapv
13565 This option generates traps for signed overflow on addition, subtraction,
13566 multiplication operations.
13567 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13568 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13569 @option{-fwrapv} being effective. Note that only active options override, so
13570 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13571 results in @option{-ftrapv} being effective.
13572
13573 @item -fwrapv
13574 @opindex fwrapv
13575 This option instructs the compiler to assume that signed arithmetic
13576 overflow of addition, subtraction and multiplication wraps around
13577 using twos-complement representation. This flag enables some optimizations
13578 and disables others.
13579 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13580 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13581 @option{-fwrapv} being effective. Note that only active options override, so
13582 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13583 results in @option{-ftrapv} being effective.
13584
13585 @item -fwrapv-pointer
13586 @opindex fwrapv-pointer
13587 This option instructs the compiler to assume that pointer arithmetic
13588 overflow on addition and subtraction wraps around using twos-complement
13589 representation. This flag disables some optimizations which assume
13590 pointer overflow is invalid.
13591
13592 @item -fstrict-overflow
13593 @opindex fstrict-overflow
13594 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13595 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13596
13597 @item -fexceptions
13598 @opindex fexceptions
13599 Enable exception handling. Generates extra code needed to propagate
13600 exceptions. For some targets, this implies GCC generates frame
13601 unwind information for all functions, which can produce significant data
13602 size overhead, although it does not affect execution. If you do not
13603 specify this option, GCC enables it by default for languages like
13604 C++ that normally require exception handling, and disables it for
13605 languages like C that do not normally require it. However, you may need
13606 to enable this option when compiling C code that needs to interoperate
13607 properly with exception handlers written in C++. You may also wish to
13608 disable this option if you are compiling older C++ programs that don't
13609 use exception handling.
13610
13611 @item -fnon-call-exceptions
13612 @opindex fnon-call-exceptions
13613 Generate code that allows trapping instructions to throw exceptions.
13614 Note that this requires platform-specific runtime support that does
13615 not exist everywhere. Moreover, it only allows @emph{trapping}
13616 instructions to throw exceptions, i.e.@: memory references or floating-point
13617 instructions. It does not allow exceptions to be thrown from
13618 arbitrary signal handlers such as @code{SIGALRM}.
13619
13620 @item -fdelete-dead-exceptions
13621 @opindex fdelete-dead-exceptions
13622 Consider that instructions that may throw exceptions but don't otherwise
13623 contribute to the execution of the program can be optimized away.
13624 This option is enabled by default for the Ada front end, as permitted by
13625 the Ada language specification.
13626 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13627
13628 @item -funwind-tables
13629 @opindex funwind-tables
13630 Similar to @option{-fexceptions}, except that it just generates any needed
13631 static data, but does not affect the generated code in any other way.
13632 You normally do not need to enable this option; instead, a language processor
13633 that needs this handling enables it on your behalf.
13634
13635 @item -fasynchronous-unwind-tables
13636 @opindex fasynchronous-unwind-tables
13637 Generate unwind table in DWARF format, if supported by target machine. The
13638 table is exact at each instruction boundary, so it can be used for stack
13639 unwinding from asynchronous events (such as debugger or garbage collector).
13640
13641 @item -fno-gnu-unique
13642 @opindex fno-gnu-unique
13643 @opindex fgnu-unique
13644 On systems with recent GNU assembler and C library, the C++ compiler
13645 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13646 of template static data members and static local variables in inline
13647 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13648 is necessary to avoid problems with a library used by two different
13649 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13650 therefore disagreeing with the other one about the binding of the
13651 symbol. But this causes @code{dlclose} to be ignored for affected
13652 DSOs; if your program relies on reinitialization of a DSO via
13653 @code{dlclose} and @code{dlopen}, you can use
13654 @option{-fno-gnu-unique}.
13655
13656 @item -fpcc-struct-return
13657 @opindex fpcc-struct-return
13658 Return ``short'' @code{struct} and @code{union} values in memory like
13659 longer ones, rather than in registers. This convention is less
13660 efficient, but it has the advantage of allowing intercallability between
13661 GCC-compiled files and files compiled with other compilers, particularly
13662 the Portable C Compiler (pcc).
13663
13664 The precise convention for returning structures in memory depends
13665 on the target configuration macros.
13666
13667 Short structures and unions are those whose size and alignment match
13668 that of some integer type.
13669
13670 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13671 switch is not binary compatible with code compiled with the
13672 @option{-freg-struct-return} switch.
13673 Use it to conform to a non-default application binary interface.
13674
13675 @item -freg-struct-return
13676 @opindex freg-struct-return
13677 Return @code{struct} and @code{union} values in registers when possible.
13678 This is more efficient for small structures than
13679 @option{-fpcc-struct-return}.
13680
13681 If you specify neither @option{-fpcc-struct-return} nor
13682 @option{-freg-struct-return}, GCC defaults to whichever convention is
13683 standard for the target. If there is no standard convention, GCC
13684 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13685 the principal compiler. In those cases, we can choose the standard, and
13686 we chose the more efficient register return alternative.
13687
13688 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13689 switch is not binary compatible with code compiled with the
13690 @option{-fpcc-struct-return} switch.
13691 Use it to conform to a non-default application binary interface.
13692
13693 @item -fshort-enums
13694 @opindex fshort-enums
13695 Allocate to an @code{enum} type only as many bytes as it needs for the
13696 declared range of possible values. Specifically, the @code{enum} type
13697 is equivalent to the smallest integer type that has enough room.
13698
13699 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13700 code that is not binary compatible with code generated without that switch.
13701 Use it to conform to a non-default application binary interface.
13702
13703 @item -fshort-wchar
13704 @opindex fshort-wchar
13705 Override the underlying type for @code{wchar_t} to be @code{short
13706 unsigned int} instead of the default for the target. This option is
13707 useful for building programs to run under WINE@.
13708
13709 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13710 code that is not binary compatible with code generated without that switch.
13711 Use it to conform to a non-default application binary interface.
13712
13713 @item -fno-common
13714 @opindex fno-common
13715 @opindex fcommon
13716 @cindex tentative definitions
13717 In C code, this option controls the placement of global variables
13718 defined without an initializer, known as @dfn{tentative definitions}
13719 in the C standard. Tentative definitions are distinct from declarations
13720 of a variable with the @code{extern} keyword, which do not allocate storage.
13721
13722 Unix C compilers have traditionally allocated storage for
13723 uninitialized global variables in a common block. This allows the
13724 linker to resolve all tentative definitions of the same variable
13725 in different compilation units to the same object, or to a non-tentative
13726 definition.
13727 This is the behavior specified by @option{-fcommon}, and is the default for
13728 GCC on most targets.
13729 On the other hand, this behavior is not required by ISO
13730 C, and on some targets may carry a speed or code size penalty on
13731 variable references.
13732
13733 The @option{-fno-common} option specifies that the compiler should instead
13734 place uninitialized global variables in the BSS section of the object file.
13735 This inhibits the merging of tentative definitions by the linker so
13736 you get a multiple-definition error if the same
13737 variable is defined in more than one compilation unit.
13738 Compiling with @option{-fno-common} is useful on targets for which
13739 it provides better performance, or if you wish to verify that the
13740 program will work on other systems that always treat uninitialized
13741 variable definitions this way.
13742
13743 @item -fno-ident
13744 @opindex fno-ident
13745 @opindex fident
13746 Ignore the @code{#ident} directive.
13747
13748 @item -finhibit-size-directive
13749 @opindex finhibit-size-directive
13750 Don't output a @code{.size} assembler directive, or anything else that
13751 would cause trouble if the function is split in the middle, and the
13752 two halves are placed at locations far apart in memory. This option is
13753 used when compiling @file{crtstuff.c}; you should not need to use it
13754 for anything else.
13755
13756 @item -fverbose-asm
13757 @opindex fverbose-asm
13758 Put extra commentary information in the generated assembly code to
13759 make it more readable. This option is generally only of use to those
13760 who actually need to read the generated assembly code (perhaps while
13761 debugging the compiler itself).
13762
13763 @option{-fno-verbose-asm}, the default, causes the
13764 extra information to be omitted and is useful when comparing two assembler
13765 files.
13766
13767 The added comments include:
13768
13769 @itemize @bullet
13770
13771 @item
13772 information on the compiler version and command-line options,
13773
13774 @item
13775 the source code lines associated with the assembly instructions,
13776 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13777
13778 @item
13779 hints on which high-level expressions correspond to
13780 the various assembly instruction operands.
13781
13782 @end itemize
13783
13784 For example, given this C source file:
13785
13786 @smallexample
13787 int test (int n)
13788 @{
13789 int i;
13790 int total = 0;
13791
13792 for (i = 0; i < n; i++)
13793 total += i * i;
13794
13795 return total;
13796 @}
13797 @end smallexample
13798
13799 compiling to (x86_64) assembly via @option{-S} and emitting the result
13800 direct to stdout via @option{-o} @option{-}
13801
13802 @smallexample
13803 gcc -S test.c -fverbose-asm -Os -o -
13804 @end smallexample
13805
13806 gives output similar to this:
13807
13808 @smallexample
13809 .file "test.c"
13810 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13811 [...snip...]
13812 # options passed:
13813 [...snip...]
13814
13815 .text
13816 .globl test
13817 .type test, @@function
13818 test:
13819 .LFB0:
13820 .cfi_startproc
13821 # test.c:4: int total = 0;
13822 xorl %eax, %eax # <retval>
13823 # test.c:6: for (i = 0; i < n; i++)
13824 xorl %edx, %edx # i
13825 .L2:
13826 # test.c:6: for (i = 0; i < n; i++)
13827 cmpl %edi, %edx # n, i
13828 jge .L5 #,
13829 # test.c:7: total += i * i;
13830 movl %edx, %ecx # i, tmp92
13831 imull %edx, %ecx # i, tmp92
13832 # test.c:6: for (i = 0; i < n; i++)
13833 incl %edx # i
13834 # test.c:7: total += i * i;
13835 addl %ecx, %eax # tmp92, <retval>
13836 jmp .L2 #
13837 .L5:
13838 # test.c:10: @}
13839 ret
13840 .cfi_endproc
13841 .LFE0:
13842 .size test, .-test
13843 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13844 .section .note.GNU-stack,"",@@progbits
13845 @end smallexample
13846
13847 The comments are intended for humans rather than machines and hence the
13848 precise format of the comments is subject to change.
13849
13850 @item -frecord-gcc-switches
13851 @opindex frecord-gcc-switches
13852 This switch causes the command line used to invoke the
13853 compiler to be recorded into the object file that is being created.
13854 This switch is only implemented on some targets and the exact format
13855 of the recording is target and binary file format dependent, but it
13856 usually takes the form of a section containing ASCII text. This
13857 switch is related to the @option{-fverbose-asm} switch, but that
13858 switch only records information in the assembler output file as
13859 comments, so it never reaches the object file.
13860 See also @option{-grecord-gcc-switches} for another
13861 way of storing compiler options into the object file.
13862
13863 @item -fpic
13864 @opindex fpic
13865 @cindex global offset table
13866 @cindex PIC
13867 Generate position-independent code (PIC) suitable for use in a shared
13868 library, if supported for the target machine. Such code accesses all
13869 constant addresses through a global offset table (GOT)@. The dynamic
13870 loader resolves the GOT entries when the program starts (the dynamic
13871 loader is not part of GCC; it is part of the operating system). If
13872 the GOT size for the linked executable exceeds a machine-specific
13873 maximum size, you get an error message from the linker indicating that
13874 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13875 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13876 on the m68k and RS/6000. The x86 has no such limit.)
13877
13878 Position-independent code requires special support, and therefore works
13879 only on certain machines. For the x86, GCC supports PIC for System V
13880 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13881 position-independent.
13882
13883 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13884 are defined to 1.
13885
13886 @item -fPIC
13887 @opindex fPIC
13888 If supported for the target machine, emit position-independent code,
13889 suitable for dynamic linking and avoiding any limit on the size of the
13890 global offset table. This option makes a difference on AArch64, m68k,
13891 PowerPC and SPARC@.
13892
13893 Position-independent code requires special support, and therefore works
13894 only on certain machines.
13895
13896 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13897 are defined to 2.
13898
13899 @item -fpie
13900 @itemx -fPIE
13901 @opindex fpie
13902 @opindex fPIE
13903 These options are similar to @option{-fpic} and @option{-fPIC}, but the
13904 generated position-independent code can be only linked into executables.
13905 Usually these options are used to compile code that will be linked using
13906 the @option{-pie} GCC option.
13907
13908 @option{-fpie} and @option{-fPIE} both define the macros
13909 @code{__pie__} and @code{__PIE__}. The macros have the value 1
13910 for @option{-fpie} and 2 for @option{-fPIE}.
13911
13912 @item -fno-plt
13913 @opindex fno-plt
13914 @opindex fplt
13915 Do not use the PLT for external function calls in position-independent code.
13916 Instead, load the callee address at call sites from the GOT and branch to it.
13917 This leads to more efficient code by eliminating PLT stubs and exposing
13918 GOT loads to optimizations. On architectures such as 32-bit x86 where
13919 PLT stubs expect the GOT pointer in a specific register, this gives more
13920 register allocation freedom to the compiler.
13921 Lazy binding requires use of the PLT;
13922 with @option{-fno-plt} all external symbols are resolved at load time.
13923
13924 Alternatively, the function attribute @code{noplt} can be used to avoid calls
13925 through the PLT for specific external functions.
13926
13927 In position-dependent code, a few targets also convert calls to
13928 functions that are marked to not use the PLT to use the GOT instead.
13929
13930 @item -fno-jump-tables
13931 @opindex fno-jump-tables
13932 @opindex fjump-tables
13933 Do not use jump tables for switch statements even where it would be
13934 more efficient than other code generation strategies. This option is
13935 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13936 building code that forms part of a dynamic linker and cannot
13937 reference the address of a jump table. On some targets, jump tables
13938 do not require a GOT and this option is not needed.
13939
13940 @item -ffixed-@var{reg}
13941 @opindex ffixed
13942 Treat the register named @var{reg} as a fixed register; generated code
13943 should never refer to it (except perhaps as a stack pointer, frame
13944 pointer or in some other fixed role).
13945
13946 @var{reg} must be the name of a register. The register names accepted
13947 are machine-specific and are defined in the @code{REGISTER_NAMES}
13948 macro in the machine description macro file.
13949
13950 This flag does not have a negative form, because it specifies a
13951 three-way choice.
13952
13953 @item -fcall-used-@var{reg}
13954 @opindex fcall-used
13955 Treat the register named @var{reg} as an allocable register that is
13956 clobbered by function calls. It may be allocated for temporaries or
13957 variables that do not live across a call. Functions compiled this way
13958 do not save and restore the register @var{reg}.
13959
13960 It is an error to use this flag with the frame pointer or stack pointer.
13961 Use of this flag for other registers that have fixed pervasive roles in
13962 the machine's execution model produces disastrous results.
13963
13964 This flag does not have a negative form, because it specifies a
13965 three-way choice.
13966
13967 @item -fcall-saved-@var{reg}
13968 @opindex fcall-saved
13969 Treat the register named @var{reg} as an allocable register saved by
13970 functions. It may be allocated even for temporaries or variables that
13971 live across a call. Functions compiled this way save and restore
13972 the register @var{reg} if they use it.
13973
13974 It is an error to use this flag with the frame pointer or stack pointer.
13975 Use of this flag for other registers that have fixed pervasive roles in
13976 the machine's execution model produces disastrous results.
13977
13978 A different sort of disaster results from the use of this flag for
13979 a register in which function values may be returned.
13980
13981 This flag does not have a negative form, because it specifies a
13982 three-way choice.
13983
13984 @item -fpack-struct[=@var{n}]
13985 @opindex fpack-struct
13986 Without a value specified, pack all structure members together without
13987 holes. When a value is specified (which must be a small power of two), pack
13988 structure members according to this value, representing the maximum
13989 alignment (that is, objects with default alignment requirements larger than
13990 this are output potentially unaligned at the next fitting location.
13991
13992 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13993 code that is not binary compatible with code generated without that switch.
13994 Additionally, it makes the code suboptimal.
13995 Use it to conform to a non-default application binary interface.
13996
13997 @item -fleading-underscore
13998 @opindex fleading-underscore
13999 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14000 change the way C symbols are represented in the object file. One use
14001 is to help link with legacy assembly code.
14002
14003 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14004 generate code that is not binary compatible with code generated without that
14005 switch. Use it to conform to a non-default application binary interface.
14006 Not all targets provide complete support for this switch.
14007
14008 @item -ftls-model=@var{model}
14009 @opindex ftls-model
14010 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14011 The @var{model} argument should be one of @samp{global-dynamic},
14012 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14013 Note that the choice is subject to optimization: the compiler may use
14014 a more efficient model for symbols not visible outside of the translation
14015 unit, or if @option{-fpic} is not given on the command line.
14016
14017 The default without @option{-fpic} is @samp{initial-exec}; with
14018 @option{-fpic} the default is @samp{global-dynamic}.
14019
14020 @item -ftrampolines
14021 @opindex ftrampolines
14022 For targets that normally need trampolines for nested functions, always
14023 generate them instead of using descriptors. Otherwise, for targets that
14024 do not need them, like for example HP-PA or IA-64, do nothing.
14025
14026 A trampoline is a small piece of code that is created at run time on the
14027 stack when the address of a nested function is taken, and is used to call
14028 the nested function indirectly. Therefore, it requires the stack to be
14029 made executable in order for the program to work properly.
14030
14031 @option{-fno-trampolines} is enabled by default on a language by language
14032 basis to let the compiler avoid generating them, if it computes that this
14033 is safe, and replace them with descriptors. Descriptors are made up of data
14034 only, but the generated code must be prepared to deal with them. As of this
14035 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14036
14037 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14038 @option{-fno-trampolines} are not binary compatible if nested functions are
14039 present. This option must therefore be used on a program-wide basis and be
14040 manipulated with extreme care.
14041
14042 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14043 @opindex fvisibility
14044 Set the default ELF image symbol visibility to the specified option---all
14045 symbols are marked with this unless overridden within the code.
14046 Using this feature can very substantially improve linking and
14047 load times of shared object libraries, produce more optimized
14048 code, provide near-perfect API export and prevent symbol clashes.
14049 It is @strong{strongly} recommended that you use this in any shared objects
14050 you distribute.
14051
14052 Despite the nomenclature, @samp{default} always means public; i.e.,
14053 available to be linked against from outside the shared object.
14054 @samp{protected} and @samp{internal} are pretty useless in real-world
14055 usage so the only other commonly used option is @samp{hidden}.
14056 The default if @option{-fvisibility} isn't specified is
14057 @samp{default}, i.e., make every symbol public.
14058
14059 A good explanation of the benefits offered by ensuring ELF
14060 symbols have the correct visibility is given by ``How To Write
14061 Shared Libraries'' by Ulrich Drepper (which can be found at
14062 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14063 solution made possible by this option to marking things hidden when
14064 the default is public is to make the default hidden and mark things
14065 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14066 and @code{__attribute__ ((visibility("default")))} instead of
14067 @code{__declspec(dllexport)} you get almost identical semantics with
14068 identical syntax. This is a great boon to those working with
14069 cross-platform projects.
14070
14071 For those adding visibility support to existing code, you may find
14072 @code{#pragma GCC visibility} of use. This works by you enclosing
14073 the declarations you wish to set visibility for with (for example)
14074 @code{#pragma GCC visibility push(hidden)} and
14075 @code{#pragma GCC visibility pop}.
14076 Bear in mind that symbol visibility should be viewed @strong{as
14077 part of the API interface contract} and thus all new code should
14078 always specify visibility when it is not the default; i.e., declarations
14079 only for use within the local DSO should @strong{always} be marked explicitly
14080 as hidden as so to avoid PLT indirection overheads---making this
14081 abundantly clear also aids readability and self-documentation of the code.
14082 Note that due to ISO C++ specification requirements, @code{operator new} and
14083 @code{operator delete} must always be of default visibility.
14084
14085 Be aware that headers from outside your project, in particular system
14086 headers and headers from any other library you use, may not be
14087 expecting to be compiled with visibility other than the default. You
14088 may need to explicitly say @code{#pragma GCC visibility push(default)}
14089 before including any such headers.
14090
14091 @code{extern} declarations are not affected by @option{-fvisibility}, so
14092 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14093 no modifications. However, this means that calls to @code{extern}
14094 functions with no explicit visibility use the PLT, so it is more
14095 effective to use @code{__attribute ((visibility))} and/or
14096 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14097 declarations should be treated as hidden.
14098
14099 Note that @option{-fvisibility} does affect C++ vague linkage
14100 entities. This means that, for instance, an exception class that is
14101 be thrown between DSOs must be explicitly marked with default
14102 visibility so that the @samp{type_info} nodes are unified between
14103 the DSOs.
14104
14105 An overview of these techniques, their benefits and how to use them
14106 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14107
14108 @item -fstrict-volatile-bitfields
14109 @opindex fstrict-volatile-bitfields
14110 This option should be used if accesses to volatile bit-fields (or other
14111 structure fields, although the compiler usually honors those types
14112 anyway) should use a single access of the width of the
14113 field's type, aligned to a natural alignment if possible. For
14114 example, targets with memory-mapped peripheral registers might require
14115 all such accesses to be 16 bits wide; with this flag you can
14116 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14117 is 16 bits on these targets) to force GCC to use 16-bit accesses
14118 instead of, perhaps, a more efficient 32-bit access.
14119
14120 If this option is disabled, the compiler uses the most efficient
14121 instruction. In the previous example, that might be a 32-bit load
14122 instruction, even though that accesses bytes that do not contain
14123 any portion of the bit-field, or memory-mapped registers unrelated to
14124 the one being updated.
14125
14126 In some cases, such as when the @code{packed} attribute is applied to a
14127 structure field, it may not be possible to access the field with a single
14128 read or write that is correctly aligned for the target machine. In this
14129 case GCC falls back to generating multiple accesses rather than code that
14130 will fault or truncate the result at run time.
14131
14132 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14133 not allowed to touch non bit-field members. It is therefore recommended
14134 to define all bits of the field's type as bit-field members.
14135
14136 The default value of this option is determined by the application binary
14137 interface for the target processor.
14138
14139 @item -fsync-libcalls
14140 @opindex fsync-libcalls
14141 This option controls whether any out-of-line instance of the @code{__sync}
14142 family of functions may be used to implement the C++11 @code{__atomic}
14143 family of functions.
14144
14145 The default value of this option is enabled, thus the only useful form
14146 of the option is @option{-fno-sync-libcalls}. This option is used in
14147 the implementation of the @file{libatomic} runtime library.
14148
14149 @end table
14150
14151 @node Developer Options
14152 @section GCC Developer Options
14153 @cindex developer options
14154 @cindex debugging GCC
14155 @cindex debug dump options
14156 @cindex dump options
14157 @cindex compilation statistics
14158
14159 This section describes command-line options that are primarily of
14160 interest to GCC developers, including options to support compiler
14161 testing and investigation of compiler bugs and compile-time
14162 performance problems. This includes options that produce debug dumps
14163 at various points in the compilation; that print statistics such as
14164 memory use and execution time; and that print information about GCC's
14165 configuration, such as where it searches for libraries. You should
14166 rarely need to use any of these options for ordinary compilation and
14167 linking tasks.
14168
14169 Many developer options that cause GCC to dump output to a file take an
14170 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14171 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14172 error.
14173
14174 If @samp{=@var{filename}} is omitted, a default dump file name is
14175 constructed by concatenating the base dump file name, a pass number,
14176 phase letter, and pass name. The base dump file name is the name of
14177 output file produced by the compiler if explicitly specified and not
14178 an executable; otherwise it is the source file name.
14179 The pass number is determined by the order passes are registered with
14180 the compiler's pass manager.
14181 This is generally the same as the order of execution, but passes
14182 registered by plugins, target-specific passes, or passes that are
14183 otherwise registered late are numbered higher than the pass named
14184 @samp{final}, even if they are executed earlier. The phase letter is
14185 one of @samp{i} (inter-procedural analysis), @samp{l}
14186 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14187 The files are created in the directory of the output file.
14188
14189 @table @gcctabopt
14190
14191 @item -d@var{letters}
14192 @itemx -fdump-rtl-@var{pass}
14193 @itemx -fdump-rtl-@var{pass}=@var{filename}
14194 @opindex d
14195 @opindex fdump-rtl-@var{pass}
14196 Says to make debugging dumps during compilation at times specified by
14197 @var{letters}. This is used for debugging the RTL-based passes of the
14198 compiler.
14199
14200 Some @option{-d@var{letters}} switches have different meaning when
14201 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14202 for information about preprocessor-specific dump options.
14203
14204 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14205 @option{-d} option @var{letters}. Here are the possible
14206 letters for use in @var{pass} and @var{letters}, and their meanings:
14207
14208 @table @gcctabopt
14209
14210 @item -fdump-rtl-alignments
14211 @opindex fdump-rtl-alignments
14212 Dump after branch alignments have been computed.
14213
14214 @item -fdump-rtl-asmcons
14215 @opindex fdump-rtl-asmcons
14216 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14217
14218 @item -fdump-rtl-auto_inc_dec
14219 @opindex fdump-rtl-auto_inc_dec
14220 Dump after auto-inc-dec discovery. This pass is only run on
14221 architectures that have auto inc or auto dec instructions.
14222
14223 @item -fdump-rtl-barriers
14224 @opindex fdump-rtl-barriers
14225 Dump after cleaning up the barrier instructions.
14226
14227 @item -fdump-rtl-bbpart
14228 @opindex fdump-rtl-bbpart
14229 Dump after partitioning hot and cold basic blocks.
14230
14231 @item -fdump-rtl-bbro
14232 @opindex fdump-rtl-bbro
14233 Dump after block reordering.
14234
14235 @item -fdump-rtl-btl1
14236 @itemx -fdump-rtl-btl2
14237 @opindex fdump-rtl-btl2
14238 @opindex fdump-rtl-btl2
14239 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14240 after the two branch
14241 target load optimization passes.
14242
14243 @item -fdump-rtl-bypass
14244 @opindex fdump-rtl-bypass
14245 Dump after jump bypassing and control flow optimizations.
14246
14247 @item -fdump-rtl-combine
14248 @opindex fdump-rtl-combine
14249 Dump after the RTL instruction combination pass.
14250
14251 @item -fdump-rtl-compgotos
14252 @opindex fdump-rtl-compgotos
14253 Dump after duplicating the computed gotos.
14254
14255 @item -fdump-rtl-ce1
14256 @itemx -fdump-rtl-ce2
14257 @itemx -fdump-rtl-ce3
14258 @opindex fdump-rtl-ce1
14259 @opindex fdump-rtl-ce2
14260 @opindex fdump-rtl-ce3
14261 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14262 @option{-fdump-rtl-ce3} enable dumping after the three
14263 if conversion passes.
14264
14265 @item -fdump-rtl-cprop_hardreg
14266 @opindex fdump-rtl-cprop_hardreg
14267 Dump after hard register copy propagation.
14268
14269 @item -fdump-rtl-csa
14270 @opindex fdump-rtl-csa
14271 Dump after combining stack adjustments.
14272
14273 @item -fdump-rtl-cse1
14274 @itemx -fdump-rtl-cse2
14275 @opindex fdump-rtl-cse1
14276 @opindex fdump-rtl-cse2
14277 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14278 the two common subexpression elimination passes.
14279
14280 @item -fdump-rtl-dce
14281 @opindex fdump-rtl-dce
14282 Dump after the standalone dead code elimination passes.
14283
14284 @item -fdump-rtl-dbr
14285 @opindex fdump-rtl-dbr
14286 Dump after delayed branch scheduling.
14287
14288 @item -fdump-rtl-dce1
14289 @itemx -fdump-rtl-dce2
14290 @opindex fdump-rtl-dce1
14291 @opindex fdump-rtl-dce2
14292 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14293 the two dead store elimination passes.
14294
14295 @item -fdump-rtl-eh
14296 @opindex fdump-rtl-eh
14297 Dump after finalization of EH handling code.
14298
14299 @item -fdump-rtl-eh_ranges
14300 @opindex fdump-rtl-eh_ranges
14301 Dump after conversion of EH handling range regions.
14302
14303 @item -fdump-rtl-expand
14304 @opindex fdump-rtl-expand
14305 Dump after RTL generation.
14306
14307 @item -fdump-rtl-fwprop1
14308 @itemx -fdump-rtl-fwprop2
14309 @opindex fdump-rtl-fwprop1
14310 @opindex fdump-rtl-fwprop2
14311 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14312 dumping after the two forward propagation passes.
14313
14314 @item -fdump-rtl-gcse1
14315 @itemx -fdump-rtl-gcse2
14316 @opindex fdump-rtl-gcse1
14317 @opindex fdump-rtl-gcse2
14318 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14319 after global common subexpression elimination.
14320
14321 @item -fdump-rtl-init-regs
14322 @opindex fdump-rtl-init-regs
14323 Dump after the initialization of the registers.
14324
14325 @item -fdump-rtl-initvals
14326 @opindex fdump-rtl-initvals
14327 Dump after the computation of the initial value sets.
14328
14329 @item -fdump-rtl-into_cfglayout
14330 @opindex fdump-rtl-into_cfglayout
14331 Dump after converting to cfglayout mode.
14332
14333 @item -fdump-rtl-ira
14334 @opindex fdump-rtl-ira
14335 Dump after iterated register allocation.
14336
14337 @item -fdump-rtl-jump
14338 @opindex fdump-rtl-jump
14339 Dump after the second jump optimization.
14340
14341 @item -fdump-rtl-loop2
14342 @opindex fdump-rtl-loop2
14343 @option{-fdump-rtl-loop2} enables dumping after the rtl
14344 loop optimization passes.
14345
14346 @item -fdump-rtl-mach
14347 @opindex fdump-rtl-mach
14348 Dump after performing the machine dependent reorganization pass, if that
14349 pass exists.
14350
14351 @item -fdump-rtl-mode_sw
14352 @opindex fdump-rtl-mode_sw
14353 Dump after removing redundant mode switches.
14354
14355 @item -fdump-rtl-rnreg
14356 @opindex fdump-rtl-rnreg
14357 Dump after register renumbering.
14358
14359 @item -fdump-rtl-outof_cfglayout
14360 @opindex fdump-rtl-outof_cfglayout
14361 Dump after converting from cfglayout mode.
14362
14363 @item -fdump-rtl-peephole2
14364 @opindex fdump-rtl-peephole2
14365 Dump after the peephole pass.
14366
14367 @item -fdump-rtl-postreload
14368 @opindex fdump-rtl-postreload
14369 Dump after post-reload optimizations.
14370
14371 @item -fdump-rtl-pro_and_epilogue
14372 @opindex fdump-rtl-pro_and_epilogue
14373 Dump after generating the function prologues and epilogues.
14374
14375 @item -fdump-rtl-sched1
14376 @itemx -fdump-rtl-sched2
14377 @opindex fdump-rtl-sched1
14378 @opindex fdump-rtl-sched2
14379 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14380 after the basic block scheduling passes.
14381
14382 @item -fdump-rtl-ree
14383 @opindex fdump-rtl-ree
14384 Dump after sign/zero extension elimination.
14385
14386 @item -fdump-rtl-seqabstr
14387 @opindex fdump-rtl-seqabstr
14388 Dump after common sequence discovery.
14389
14390 @item -fdump-rtl-shorten
14391 @opindex fdump-rtl-shorten
14392 Dump after shortening branches.
14393
14394 @item -fdump-rtl-sibling
14395 @opindex fdump-rtl-sibling
14396 Dump after sibling call optimizations.
14397
14398 @item -fdump-rtl-split1
14399 @itemx -fdump-rtl-split2
14400 @itemx -fdump-rtl-split3
14401 @itemx -fdump-rtl-split4
14402 @itemx -fdump-rtl-split5
14403 @opindex fdump-rtl-split1
14404 @opindex fdump-rtl-split2
14405 @opindex fdump-rtl-split3
14406 @opindex fdump-rtl-split4
14407 @opindex fdump-rtl-split5
14408 These options enable dumping after five rounds of
14409 instruction splitting.
14410
14411 @item -fdump-rtl-sms
14412 @opindex fdump-rtl-sms
14413 Dump after modulo scheduling. This pass is only run on some
14414 architectures.
14415
14416 @item -fdump-rtl-stack
14417 @opindex fdump-rtl-stack
14418 Dump after conversion from GCC's ``flat register file'' registers to the
14419 x87's stack-like registers. This pass is only run on x86 variants.
14420
14421 @item -fdump-rtl-subreg1
14422 @itemx -fdump-rtl-subreg2
14423 @opindex fdump-rtl-subreg1
14424 @opindex fdump-rtl-subreg2
14425 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14426 the two subreg expansion passes.
14427
14428 @item -fdump-rtl-unshare
14429 @opindex fdump-rtl-unshare
14430 Dump after all rtl has been unshared.
14431
14432 @item -fdump-rtl-vartrack
14433 @opindex fdump-rtl-vartrack
14434 Dump after variable tracking.
14435
14436 @item -fdump-rtl-vregs
14437 @opindex fdump-rtl-vregs
14438 Dump after converting virtual registers to hard registers.
14439
14440 @item -fdump-rtl-web
14441 @opindex fdump-rtl-web
14442 Dump after live range splitting.
14443
14444 @item -fdump-rtl-regclass
14445 @itemx -fdump-rtl-subregs_of_mode_init
14446 @itemx -fdump-rtl-subregs_of_mode_finish
14447 @itemx -fdump-rtl-dfinit
14448 @itemx -fdump-rtl-dfinish
14449 @opindex fdump-rtl-regclass
14450 @opindex fdump-rtl-subregs_of_mode_init
14451 @opindex fdump-rtl-subregs_of_mode_finish
14452 @opindex fdump-rtl-dfinit
14453 @opindex fdump-rtl-dfinish
14454 These dumps are defined but always produce empty files.
14455
14456 @item -da
14457 @itemx -fdump-rtl-all
14458 @opindex da
14459 @opindex fdump-rtl-all
14460 Produce all the dumps listed above.
14461
14462 @item -dA
14463 @opindex dA
14464 Annotate the assembler output with miscellaneous debugging information.
14465
14466 @item -dD
14467 @opindex dD
14468 Dump all macro definitions, at the end of preprocessing, in addition to
14469 normal output.
14470
14471 @item -dH
14472 @opindex dH
14473 Produce a core dump whenever an error occurs.
14474
14475 @item -dp
14476 @opindex dp
14477 Annotate the assembler output with a comment indicating which
14478 pattern and alternative is used. The length and cost of each instruction are
14479 also printed.
14480
14481 @item -dP
14482 @opindex dP
14483 Dump the RTL in the assembler output as a comment before each instruction.
14484 Also turns on @option{-dp} annotation.
14485
14486 @item -dx
14487 @opindex dx
14488 Just generate RTL for a function instead of compiling it. Usually used
14489 with @option{-fdump-rtl-expand}.
14490 @end table
14491
14492 @item -fdump-debug
14493 @opindex fdump-debug
14494 Dump debugging information generated during the debug
14495 generation phase.
14496
14497 @item -fdump-earlydebug
14498 @opindex fdump-earlydebug
14499 Dump debugging information generated during the early debug
14500 generation phase.
14501
14502 @item -fdump-noaddr
14503 @opindex fdump-noaddr
14504 When doing debugging dumps, suppress address output. This makes it more
14505 feasible to use diff on debugging dumps for compiler invocations with
14506 different compiler binaries and/or different
14507 text / bss / data / heap / stack / dso start locations.
14508
14509 @item -freport-bug
14510 @opindex freport-bug
14511 Collect and dump debug information into a temporary file if an
14512 internal compiler error (ICE) occurs.
14513
14514 @item -fdump-unnumbered
14515 @opindex fdump-unnumbered
14516 When doing debugging dumps, suppress instruction numbers and address output.
14517 This makes it more feasible to use diff on debugging dumps for compiler
14518 invocations with different options, in particular with and without
14519 @option{-g}.
14520
14521 @item -fdump-unnumbered-links
14522 @opindex fdump-unnumbered-links
14523 When doing debugging dumps (see @option{-d} option above), suppress
14524 instruction numbers for the links to the previous and next instructions
14525 in a sequence.
14526
14527 @item -fdump-ipa-@var{switch}
14528 @itemx -fdump-ipa-@var{switch}-@var{options}
14529 @opindex fdump-ipa
14530 Control the dumping at various stages of inter-procedural analysis
14531 language tree to a file. The file name is generated by appending a
14532 switch specific suffix to the source file name, and the file is created
14533 in the same directory as the output file. The following dumps are
14534 possible:
14535
14536 @table @samp
14537 @item all
14538 Enables all inter-procedural analysis dumps.
14539
14540 @item cgraph
14541 Dumps information about call-graph optimization, unused function removal,
14542 and inlining decisions.
14543
14544 @item inline
14545 Dump after function inlining.
14546
14547 @end table
14548
14549 Additionally, the options @option{-optimized}, @option{-missed},
14550 @option{-note}, and @option{-all} can be provided, with the same meaning
14551 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14552
14553 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14554 information on callsites that were inlined, along with callsites
14555 that were not inlined.
14556
14557 By default, the dump will contain messages about successful
14558 optimizations (equivalent to @option{-optimized}) together with
14559 low-level details about the analysis.
14560
14561 @item -fdump-lang-all
14562 @itemx -fdump-lang-@var{switch}
14563 @itemx -fdump-lang-@var{switch}-@var{options}
14564 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14565 @opindex fdump-lang-all
14566 @opindex fdump-lang
14567 Control the dumping of language-specific information. The @var{options}
14568 and @var{filename} portions behave as described in the
14569 @option{-fdump-tree} option. The following @var{switch} values are
14570 accepted:
14571
14572 @table @samp
14573 @item all
14574
14575 Enable all language-specific dumps.
14576
14577 @item class
14578 Dump class hierarchy information. Virtual table information is emitted
14579 unless '@option{slim}' is specified. This option is applicable to C++ only.
14580
14581 @item raw
14582 Dump the raw internal tree data. This option is applicable to C++ only.
14583
14584 @end table
14585
14586 @item -fdump-passes
14587 @opindex fdump-passes
14588 Print on @file{stderr} the list of optimization passes that are turned
14589 on and off by the current command-line options.
14590
14591 @item -fdump-statistics-@var{option}
14592 @opindex fdump-statistics
14593 Enable and control dumping of pass statistics in a separate file. The
14594 file name is generated by appending a suffix ending in
14595 @samp{.statistics} to the source file name, and the file is created in
14596 the same directory as the output file. If the @samp{-@var{option}}
14597 form is used, @samp{-stats} causes counters to be summed over the
14598 whole compilation unit while @samp{-details} dumps every event as
14599 the passes generate them. The default with no option is to sum
14600 counters for each function compiled.
14601
14602 @item -fdump-tree-all
14603 @itemx -fdump-tree-@var{switch}
14604 @itemx -fdump-tree-@var{switch}-@var{options}
14605 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14606 @opindex fdump-tree-all
14607 @opindex fdump-tree
14608 Control the dumping at various stages of processing the intermediate
14609 language tree to a file. If the @samp{-@var{options}}
14610 form is used, @var{options} is a list of @samp{-} separated options
14611 which control the details of the dump. Not all options are applicable
14612 to all dumps; those that are not meaningful are ignored. The
14613 following options are available
14614
14615 @table @samp
14616 @item address
14617 Print the address of each node. Usually this is not meaningful as it
14618 changes according to the environment and source file. Its primary use
14619 is for tying up a dump file with a debug environment.
14620 @item asmname
14621 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14622 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14623 use working backward from mangled names in the assembly file.
14624 @item slim
14625 When dumping front-end intermediate representations, inhibit dumping
14626 of members of a scope or body of a function merely because that scope
14627 has been reached. Only dump such items when they are directly reachable
14628 by some other path.
14629
14630 When dumping pretty-printed trees, this option inhibits dumping the
14631 bodies of control structures.
14632
14633 When dumping RTL, print the RTL in slim (condensed) form instead of
14634 the default LISP-like representation.
14635 @item raw
14636 Print a raw representation of the tree. By default, trees are
14637 pretty-printed into a C-like representation.
14638 @item details
14639 Enable more detailed dumps (not honored by every dump option). Also
14640 include information from the optimization passes.
14641 @item stats
14642 Enable dumping various statistics about the pass (not honored by every dump
14643 option).
14644 @item blocks
14645 Enable showing basic block boundaries (disabled in raw dumps).
14646 @item graph
14647 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14648 dump a representation of the control flow graph suitable for viewing with
14649 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14650 the file is pretty-printed as a subgraph, so that GraphViz can render them
14651 all in a single plot.
14652
14653 This option currently only works for RTL dumps, and the RTL is always
14654 dumped in slim form.
14655 @item vops
14656 Enable showing virtual operands for every statement.
14657 @item lineno
14658 Enable showing line numbers for statements.
14659 @item uid
14660 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14661 @item verbose
14662 Enable showing the tree dump for each statement.
14663 @item eh
14664 Enable showing the EH region number holding each statement.
14665 @item scev
14666 Enable showing scalar evolution analysis details.
14667 @item optimized
14668 Enable showing optimization information (only available in certain
14669 passes).
14670 @item missed
14671 Enable showing missed optimization information (only available in certain
14672 passes).
14673 @item note
14674 Enable other detailed optimization information (only available in
14675 certain passes).
14676 @item all
14677 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14678 and @option{lineno}.
14679 @item optall
14680 Turn on all optimization options, i.e., @option{optimized},
14681 @option{missed}, and @option{note}.
14682 @end table
14683
14684 To determine what tree dumps are available or find the dump for a pass
14685 of interest follow the steps below.
14686
14687 @enumerate
14688 @item
14689 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14690 look for a code that corresponds to the pass you are interested in.
14691 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14692 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14693 The number at the end distinguishes distinct invocations of the same pass.
14694 @item
14695 To enable the creation of the dump file, append the pass code to
14696 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14697 to enable the dump from the Early Value Range Propagation pass, invoke
14698 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14699 specify the name of the dump file. If you don't specify one, GCC
14700 creates as described below.
14701 @item
14702 Find the pass dump in a file whose name is composed of three components
14703 separated by a period: the name of the source file GCC was invoked to
14704 compile, a numeric suffix indicating the pass number followed by the
14705 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14706 and finally the pass code. For example, the Early VRP pass dump might
14707 be in a file named @file{myfile.c.038t.evrp} in the current working
14708 directory. Note that the numeric codes are not stable and may change
14709 from one version of GCC to another.
14710 @end enumerate
14711
14712 @item -fopt-info
14713 @itemx -fopt-info-@var{options}
14714 @itemx -fopt-info-@var{options}=@var{filename}
14715 @opindex fopt-info
14716 Controls optimization dumps from various optimization passes. If the
14717 @samp{-@var{options}} form is used, @var{options} is a list of
14718 @samp{-} separated option keywords to select the dump details and
14719 optimizations.
14720
14721 The @var{options} can be divided into three groups:
14722 @enumerate
14723 @item
14724 options describing what kinds of messages should be emitted,
14725 @item
14726 options describing the verbosity of the dump, and
14727 @item
14728 options describing which optimizations should be included.
14729 @end enumerate
14730 The options from each group can be freely mixed as they are
14731 non-overlapping. However, in case of any conflicts,
14732 the later options override the earlier options on the command
14733 line.
14734
14735 The following options control which kinds of messages should be emitted:
14736
14737 @table @samp
14738 @item optimized
14739 Print information when an optimization is successfully applied. It is
14740 up to a pass to decide which information is relevant. For example, the
14741 vectorizer passes print the source location of loops which are
14742 successfully vectorized.
14743 @item missed
14744 Print information about missed optimizations. Individual passes
14745 control which information to include in the output.
14746 @item note
14747 Print verbose information about optimizations, such as certain
14748 transformations, more detailed messages about decisions etc.
14749 @item all
14750 Print detailed optimization information. This includes
14751 @samp{optimized}, @samp{missed}, and @samp{note}.
14752 @end table
14753
14754 The following option controls the dump verbosity:
14755
14756 @table @samp
14757 @item internals
14758 By default, only ``high-level'' messages are emitted. This option enables
14759 additional, more detailed, messages, which are likely to only be of interest
14760 to GCC developers.
14761 @end table
14762
14763 One or more of the following option keywords can be used to describe a
14764 group of optimizations:
14765
14766 @table @samp
14767 @item ipa
14768 Enable dumps from all interprocedural optimizations.
14769 @item loop
14770 Enable dumps from all loop optimizations.
14771 @item inline
14772 Enable dumps from all inlining optimizations.
14773 @item omp
14774 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14775 @item vec
14776 Enable dumps from all vectorization optimizations.
14777 @item optall
14778 Enable dumps from all optimizations. This is a superset of
14779 the optimization groups listed above.
14780 @end table
14781
14782 If @var{options} is
14783 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
14784 about successful optimizations from all the passes, omitting messages
14785 that are treated as ``internals''.
14786
14787 If the @var{filename} is provided, then the dumps from all the
14788 applicable optimizations are concatenated into the @var{filename}.
14789 Otherwise the dump is output onto @file{stderr}. Though multiple
14790 @option{-fopt-info} options are accepted, only one of them can include
14791 a @var{filename}. If other filenames are provided then all but the
14792 first such option are ignored.
14793
14794 Note that the output @var{filename} is overwritten
14795 in case of multiple translation units. If a combined output from
14796 multiple translation units is desired, @file{stderr} should be used
14797 instead.
14798
14799 In the following example, the optimization info is output to
14800 @file{stderr}:
14801
14802 @smallexample
14803 gcc -O3 -fopt-info
14804 @end smallexample
14805
14806 This example:
14807 @smallexample
14808 gcc -O3 -fopt-info-missed=missed.all
14809 @end smallexample
14810
14811 @noindent
14812 outputs missed optimization report from all the passes into
14813 @file{missed.all}, and this one:
14814
14815 @smallexample
14816 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14817 @end smallexample
14818
14819 @noindent
14820 prints information about missed optimization opportunities from
14821 vectorization passes on @file{stderr}.
14822 Note that @option{-fopt-info-vec-missed} is equivalent to
14823 @option{-fopt-info-missed-vec}. The order of the optimization group
14824 names and message types listed after @option{-fopt-info} does not matter.
14825
14826 As another example,
14827 @smallexample
14828 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14829 @end smallexample
14830
14831 @noindent
14832 outputs information about missed optimizations as well as
14833 optimized locations from all the inlining passes into
14834 @file{inline.txt}.
14835
14836 Finally, consider:
14837
14838 @smallexample
14839 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14840 @end smallexample
14841
14842 @noindent
14843 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
14844 in conflict since only one output file is allowed. In this case, only
14845 the first option takes effect and the subsequent options are
14846 ignored. Thus only @file{vec.miss} is produced which contains
14847 dumps from the vectorizer about missed opportunities.
14848
14849 @item -fsave-optimization-record
14850 @opindex fsave-optimization-record
14851 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
14852 were performed, for those optimizations that support @option{-fopt-info}.
14853
14854 This option is experimental and the format of the data within the
14855 compressed JSON file is subject to change.
14856
14857 It is roughly equivalent to a machine-readable version of
14858 @option{-fopt-info-all}, as a collection of messages with source file,
14859 line number and column number, with the following additional data for
14860 each message:
14861
14862 @itemize @bullet
14863
14864 @item
14865 the execution count of the code being optimized, along with metadata about
14866 whether this was from actual profile data, or just an estimate, allowing
14867 consumers to prioritize messages by code hotness,
14868
14869 @item
14870 the function name of the code being optimized, where applicable,
14871
14872 @item
14873 the ``inlining chain'' for the code being optimized, so that when
14874 a function is inlined into several different places (which might
14875 themselves be inlined), the reader can distinguish between the copies,
14876
14877 @item
14878 objects identifying those parts of the message that refer to expressions,
14879 statements or symbol-table nodes, which of these categories they are, and,
14880 when available, their source code location,
14881
14882 @item
14883 the GCC pass that emitted the message, and
14884
14885 @item
14886 the location in GCC's own code from which the message was emitted
14887
14888 @end itemize
14889
14890 Additionally, some messages are logically nested within other
14891 messages, reflecting implementation details of the optimization
14892 passes.
14893
14894 @item -fsched-verbose=@var{n}
14895 @opindex fsched-verbose
14896 On targets that use instruction scheduling, this option controls the
14897 amount of debugging output the scheduler prints to the dump files.
14898
14899 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
14900 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
14901 For @var{n} greater than one, it also output basic block probabilities,
14902 detailed ready list information and unit/insn info. For @var{n} greater
14903 than two, it includes RTL at abort point, control-flow and regions info.
14904 And for @var{n} over four, @option{-fsched-verbose} also includes
14905 dependence info.
14906
14907
14908
14909 @item -fenable-@var{kind}-@var{pass}
14910 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
14911 @opindex fdisable-
14912 @opindex fenable-
14913
14914 This is a set of options that are used to explicitly disable/enable
14915 optimization passes. These options are intended for use for debugging GCC.
14916 Compiler users should use regular options for enabling/disabling
14917 passes instead.
14918
14919 @table @gcctabopt
14920
14921 @item -fdisable-ipa-@var{pass}
14922 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14923 statically invoked in the compiler multiple times, the pass name should be
14924 appended with a sequential number starting from 1.
14925
14926 @item -fdisable-rtl-@var{pass}
14927 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
14928 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
14929 statically invoked in the compiler multiple times, the pass name should be
14930 appended with a sequential number starting from 1. @var{range-list} is a
14931 comma-separated list of function ranges or assembler names. Each range is a number
14932 pair separated by a colon. The range is inclusive in both ends. If the range
14933 is trivial, the number pair can be simplified as a single number. If the
14934 function's call graph node's @var{uid} falls within one of the specified ranges,
14935 the @var{pass} is disabled for that function. The @var{uid} is shown in the
14936 function header of a dump file, and the pass names can be dumped by using
14937 option @option{-fdump-passes}.
14938
14939 @item -fdisable-tree-@var{pass}
14940 @itemx -fdisable-tree-@var{pass}=@var{range-list}
14941 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
14942 option arguments.
14943
14944 @item -fenable-ipa-@var{pass}
14945 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14946 statically invoked in the compiler multiple times, the pass name should be
14947 appended with a sequential number starting from 1.
14948
14949 @item -fenable-rtl-@var{pass}
14950 @itemx -fenable-rtl-@var{pass}=@var{range-list}
14951 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
14952 description and examples.
14953
14954 @item -fenable-tree-@var{pass}
14955 @itemx -fenable-tree-@var{pass}=@var{range-list}
14956 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
14957 of option arguments.
14958
14959 @end table
14960
14961 Here are some examples showing uses of these options.
14962
14963 @smallexample
14964
14965 # disable ccp1 for all functions
14966 -fdisable-tree-ccp1
14967 # disable complete unroll for function whose cgraph node uid is 1
14968 -fenable-tree-cunroll=1
14969 # disable gcse2 for functions at the following ranges [1,1],
14970 # [300,400], and [400,1000]
14971 # disable gcse2 for functions foo and foo2
14972 -fdisable-rtl-gcse2=foo,foo2
14973 # disable early inlining
14974 -fdisable-tree-einline
14975 # disable ipa inlining
14976 -fdisable-ipa-inline
14977 # enable tree full unroll
14978 -fenable-tree-unroll
14979
14980 @end smallexample
14981
14982 @item -fchecking
14983 @itemx -fchecking=@var{n}
14984 @opindex fchecking
14985 @opindex fno-checking
14986 Enable internal consistency checking. The default depends on
14987 the compiler configuration. @option{-fchecking=2} enables further
14988 internal consistency checking that might affect code generation.
14989
14990 @item -frandom-seed=@var{string}
14991 @opindex frandom-seed
14992 This option provides a seed that GCC uses in place of
14993 random numbers in generating certain symbol names
14994 that have to be different in every compiled file. It is also used to
14995 place unique stamps in coverage data files and the object files that
14996 produce them. You can use the @option{-frandom-seed} option to produce
14997 reproducibly identical object files.
14998
14999 The @var{string} can either be a number (decimal, octal or hex) or an
15000 arbitrary string (in which case it's converted to a number by
15001 computing CRC32).
15002
15003 The @var{string} should be different for every file you compile.
15004
15005 @item -save-temps
15006 @itemx -save-temps=cwd
15007 @opindex save-temps
15008 Store the usual ``temporary'' intermediate files permanently; place them
15009 in the current directory and name them based on the source file. Thus,
15010 compiling @file{foo.c} with @option{-c -save-temps} produces files
15011 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15012 preprocessed @file{foo.i} output file even though the compiler now
15013 normally uses an integrated preprocessor.
15014
15015 When used in combination with the @option{-x} command-line option,
15016 @option{-save-temps} is sensible enough to avoid over writing an
15017 input source file with the same extension as an intermediate file.
15018 The corresponding intermediate file may be obtained by renaming the
15019 source file before using @option{-save-temps}.
15020
15021 If you invoke GCC in parallel, compiling several different source
15022 files that share a common base name in different subdirectories or the
15023 same source file compiled for multiple output destinations, it is
15024 likely that the different parallel compilers will interfere with each
15025 other, and overwrite the temporary files. For instance:
15026
15027 @smallexample
15028 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15029 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15030 @end smallexample
15031
15032 may result in @file{foo.i} and @file{foo.o} being written to
15033 simultaneously by both compilers.
15034
15035 @item -save-temps=obj
15036 @opindex save-temps=obj
15037 Store the usual ``temporary'' intermediate files permanently. If the
15038 @option{-o} option is used, the temporary files are based on the
15039 object file. If the @option{-o} option is not used, the
15040 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15041
15042 For example:
15043
15044 @smallexample
15045 gcc -save-temps=obj -c foo.c
15046 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15047 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15048 @end smallexample
15049
15050 @noindent
15051 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15052 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15053 @file{dir2/yfoobar.o}.
15054
15055 @item -time@r{[}=@var{file}@r{]}
15056 @opindex time
15057 Report the CPU time taken by each subprocess in the compilation
15058 sequence. For C source files, this is the compiler proper and assembler
15059 (plus the linker if linking is done).
15060
15061 Without the specification of an output file, the output looks like this:
15062
15063 @smallexample
15064 # cc1 0.12 0.01
15065 # as 0.00 0.01
15066 @end smallexample
15067
15068 The first number on each line is the ``user time'', that is time spent
15069 executing the program itself. The second number is ``system time'',
15070 time spent executing operating system routines on behalf of the program.
15071 Both numbers are in seconds.
15072
15073 With the specification of an output file, the output is appended to the
15074 named file, and it looks like this:
15075
15076 @smallexample
15077 0.12 0.01 cc1 @var{options}
15078 0.00 0.01 as @var{options}
15079 @end smallexample
15080
15081 The ``user time'' and the ``system time'' are moved before the program
15082 name, and the options passed to the program are displayed, so that one
15083 can later tell what file was being compiled, and with which options.
15084
15085 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15086 @opindex fdump-final-insns
15087 Dump the final internal representation (RTL) to @var{file}. If the
15088 optional argument is omitted (or if @var{file} is @code{.}), the name
15089 of the dump file is determined by appending @code{.gkd} to the
15090 compilation output file name.
15091
15092 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15093 @opindex fcompare-debug
15094 @opindex fno-compare-debug
15095 If no error occurs during compilation, run the compiler a second time,
15096 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15097 passed to the second compilation. Dump the final internal
15098 representation in both compilations, and print an error if they differ.
15099
15100 If the equal sign is omitted, the default @option{-gtoggle} is used.
15101
15102 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15103 and nonzero, implicitly enables @option{-fcompare-debug}. If
15104 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15105 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15106 is used.
15107
15108 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15109 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15110 of the final representation and the second compilation, preventing even
15111 @env{GCC_COMPARE_DEBUG} from taking effect.
15112
15113 To verify full coverage during @option{-fcompare-debug} testing, set
15114 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15115 which GCC rejects as an invalid option in any actual compilation
15116 (rather than preprocessing, assembly or linking). To get just a
15117 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15118 not overridden} will do.
15119
15120 @item -fcompare-debug-second
15121 @opindex fcompare-debug-second
15122 This option is implicitly passed to the compiler for the second
15123 compilation requested by @option{-fcompare-debug}, along with options to
15124 silence warnings, and omitting other options that would cause the compiler
15125 to produce output to files or to standard output as a side effect. Dump
15126 files and preserved temporary files are renamed so as to contain the
15127 @code{.gk} additional extension during the second compilation, to avoid
15128 overwriting those generated by the first.
15129
15130 When this option is passed to the compiler driver, it causes the
15131 @emph{first} compilation to be skipped, which makes it useful for little
15132 other than debugging the compiler proper.
15133
15134 @item -gtoggle
15135 @opindex gtoggle
15136 Turn off generation of debug info, if leaving out this option
15137 generates it, or turn it on at level 2 otherwise. The position of this
15138 argument in the command line does not matter; it takes effect after all
15139 other options are processed, and it does so only once, no matter how
15140 many times it is given. This is mainly intended to be used with
15141 @option{-fcompare-debug}.
15142
15143 @item -fvar-tracking-assignments-toggle
15144 @opindex fvar-tracking-assignments-toggle
15145 @opindex fno-var-tracking-assignments-toggle
15146 Toggle @option{-fvar-tracking-assignments}, in the same way that
15147 @option{-gtoggle} toggles @option{-g}.
15148
15149 @item -Q
15150 @opindex Q
15151 Makes the compiler print out each function name as it is compiled, and
15152 print some statistics about each pass when it finishes.
15153
15154 @item -ftime-report
15155 @opindex ftime-report
15156 Makes the compiler print some statistics about the time consumed by each
15157 pass when it finishes.
15158
15159 @item -ftime-report-details
15160 @opindex ftime-report-details
15161 Record the time consumed by infrastructure parts separately for each pass.
15162
15163 @item -fira-verbose=@var{n}
15164 @opindex fira-verbose
15165 Control the verbosity of the dump file for the integrated register allocator.
15166 The default value is 5. If the value @var{n} is greater or equal to 10,
15167 the dump output is sent to stderr using the same format as @var{n} minus 10.
15168
15169 @item -flto-report
15170 @opindex flto-report
15171 Prints a report with internal details on the workings of the link-time
15172 optimizer. The contents of this report vary from version to version.
15173 It is meant to be useful to GCC developers when processing object
15174 files in LTO mode (via @option{-flto}).
15175
15176 Disabled by default.
15177
15178 @item -flto-report-wpa
15179 @opindex flto-report-wpa
15180 Like @option{-flto-report}, but only print for the WPA phase of Link
15181 Time Optimization.
15182
15183 @item -fmem-report
15184 @opindex fmem-report
15185 Makes the compiler print some statistics about permanent memory
15186 allocation when it finishes.
15187
15188 @item -fmem-report-wpa
15189 @opindex fmem-report-wpa
15190 Makes the compiler print some statistics about permanent memory
15191 allocation for the WPA phase only.
15192
15193 @item -fpre-ipa-mem-report
15194 @opindex fpre-ipa-mem-report
15195 @item -fpost-ipa-mem-report
15196 @opindex fpost-ipa-mem-report
15197 Makes the compiler print some statistics about permanent memory
15198 allocation before or after interprocedural optimization.
15199
15200 @item -fprofile-report
15201 @opindex fprofile-report
15202 Makes the compiler print some statistics about consistency of the
15203 (estimated) profile and effect of individual passes.
15204
15205 @item -fstack-usage
15206 @opindex fstack-usage
15207 Makes the compiler output stack usage information for the program, on a
15208 per-function basis. The filename for the dump is made by appending
15209 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15210 the output file, if explicitly specified and it is not an executable,
15211 otherwise it is the basename of the source file. An entry is made up
15212 of three fields:
15213
15214 @itemize
15215 @item
15216 The name of the function.
15217 @item
15218 A number of bytes.
15219 @item
15220 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15221 @end itemize
15222
15223 The qualifier @code{static} means that the function manipulates the stack
15224 statically: a fixed number of bytes are allocated for the frame on function
15225 entry and released on function exit; no stack adjustments are otherwise made
15226 in the function. The second field is this fixed number of bytes.
15227
15228 The qualifier @code{dynamic} means that the function manipulates the stack
15229 dynamically: in addition to the static allocation described above, stack
15230 adjustments are made in the body of the function, for example to push/pop
15231 arguments around function calls. If the qualifier @code{bounded} is also
15232 present, the amount of these adjustments is bounded at compile time and
15233 the second field is an upper bound of the total amount of stack used by
15234 the function. If it is not present, the amount of these adjustments is
15235 not bounded at compile time and the second field only represents the
15236 bounded part.
15237
15238 @item -fstats
15239 @opindex fstats
15240 Emit statistics about front-end processing at the end of the compilation.
15241 This option is supported only by the C++ front end, and
15242 the information is generally only useful to the G++ development team.
15243
15244 @item -fdbg-cnt-list
15245 @opindex fdbg-cnt-list
15246 Print the name and the counter upper bound for all debug counters.
15247
15248
15249 @item -fdbg-cnt=@var{counter-value-list}
15250 @opindex fdbg-cnt
15251 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15252 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15253 tuples which sets the lower and the upper bound of each debug
15254 counter @var{name}. The @var{lower_bound} is optional and is zero
15255 initialized if not set.
15256 All debug counters have the initial upper bound of @code{UINT_MAX};
15257 thus @code{dbg_cnt} returns true always unless the upper bound
15258 is set by this option.
15259 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15260 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15261 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15262
15263 @item -print-file-name=@var{library}
15264 @opindex print-file-name
15265 Print the full absolute name of the library file @var{library} that
15266 would be used when linking---and don't do anything else. With this
15267 option, GCC does not compile or link anything; it just prints the
15268 file name.
15269
15270 @item -print-multi-directory
15271 @opindex print-multi-directory
15272 Print the directory name corresponding to the multilib selected by any
15273 other switches present in the command line. This directory is supposed
15274 to exist in @env{GCC_EXEC_PREFIX}.
15275
15276 @item -print-multi-lib
15277 @opindex print-multi-lib
15278 Print the mapping from multilib directory names to compiler switches
15279 that enable them. The directory name is separated from the switches by
15280 @samp{;}, and each switch starts with an @samp{@@} instead of the
15281 @samp{-}, without spaces between multiple switches. This is supposed to
15282 ease shell processing.
15283
15284 @item -print-multi-os-directory
15285 @opindex print-multi-os-directory
15286 Print the path to OS libraries for the selected
15287 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15288 present in the @file{lib} subdirectory and no multilibs are used, this is
15289 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15290 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15291 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15292 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15293
15294 @item -print-multiarch
15295 @opindex print-multiarch
15296 Print the path to OS libraries for the selected multiarch,
15297 relative to some @file{lib} subdirectory.
15298
15299 @item -print-prog-name=@var{program}
15300 @opindex print-prog-name
15301 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15302
15303 @item -print-libgcc-file-name
15304 @opindex print-libgcc-file-name
15305 Same as @option{-print-file-name=libgcc.a}.
15306
15307 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15308 but you do want to link with @file{libgcc.a}. You can do:
15309
15310 @smallexample
15311 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15312 @end smallexample
15313
15314 @item -print-search-dirs
15315 @opindex print-search-dirs
15316 Print the name of the configured installation directory and a list of
15317 program and library directories @command{gcc} searches---and don't do anything else.
15318
15319 This is useful when @command{gcc} prints the error message
15320 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15321 To resolve this you either need to put @file{cpp0} and the other compiler
15322 components where @command{gcc} expects to find them, or you can set the environment
15323 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15324 Don't forget the trailing @samp{/}.
15325 @xref{Environment Variables}.
15326
15327 @item -print-sysroot
15328 @opindex print-sysroot
15329 Print the target sysroot directory that is used during
15330 compilation. This is the target sysroot specified either at configure
15331 time or using the @option{--sysroot} option, possibly with an extra
15332 suffix that depends on compilation options. If no target sysroot is
15333 specified, the option prints nothing.
15334
15335 @item -print-sysroot-headers-suffix
15336 @opindex print-sysroot-headers-suffix
15337 Print the suffix added to the target sysroot when searching for
15338 headers, or give an error if the compiler is not configured with such
15339 a suffix---and don't do anything else.
15340
15341 @item -dumpmachine
15342 @opindex dumpmachine
15343 Print the compiler's target machine (for example,
15344 @samp{i686-pc-linux-gnu})---and don't do anything else.
15345
15346 @item -dumpversion
15347 @opindex dumpversion
15348 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15349 anything else. This is the compiler version used in filesystem paths and
15350 specs. Depending on how the compiler has been configured it can be just
15351 a single number (major version), two numbers separated by a dot (major and
15352 minor version) or three numbers separated by dots (major, minor and patchlevel
15353 version).
15354
15355 @item -dumpfullversion
15356 @opindex dumpfullversion
15357 Print the full compiler version---and don't do anything else. The output is
15358 always three numbers separated by dots, major, minor and patchlevel version.
15359
15360 @item -dumpspecs
15361 @opindex dumpspecs
15362 Print the compiler's built-in specs---and don't do anything else. (This
15363 is used when GCC itself is being built.) @xref{Spec Files}.
15364 @end table
15365
15366 @node Submodel Options
15367 @section Machine-Dependent Options
15368 @cindex submodel options
15369 @cindex specifying hardware config
15370 @cindex hardware models and configurations, specifying
15371 @cindex target-dependent options
15372 @cindex machine-dependent options
15373
15374 Each target machine supported by GCC can have its own options---for
15375 example, to allow you to compile for a particular processor variant or
15376 ABI, or to control optimizations specific to that machine. By
15377 convention, the names of machine-specific options start with
15378 @samp{-m}.
15379
15380 Some configurations of the compiler also support additional target-specific
15381 options, usually for compatibility with other compilers on the same
15382 platform.
15383
15384 @c This list is ordered alphanumerically by subsection name.
15385 @c It should be the same order and spelling as these options are listed
15386 @c in Machine Dependent Options
15387
15388 @menu
15389 * AArch64 Options::
15390 * Adapteva Epiphany Options::
15391 * ARC Options::
15392 * ARM Options::
15393 * AVR Options::
15394 * Blackfin Options::
15395 * C6X Options::
15396 * CRIS Options::
15397 * CR16 Options::
15398 * C-SKY Options::
15399 * Darwin Options::
15400 * DEC Alpha Options::
15401 * FR30 Options::
15402 * FT32 Options::
15403 * FRV Options::
15404 * GNU/Linux Options::
15405 * H8/300 Options::
15406 * HPPA Options::
15407 * IA-64 Options::
15408 * LM32 Options::
15409 * M32C Options::
15410 * M32R/D Options::
15411 * M680x0 Options::
15412 * MCore Options::
15413 * MeP Options::
15414 * MicroBlaze Options::
15415 * MIPS Options::
15416 * MMIX Options::
15417 * MN10300 Options::
15418 * Moxie Options::
15419 * MSP430 Options::
15420 * NDS32 Options::
15421 * Nios II Options::
15422 * Nvidia PTX Options::
15423 * OpenRISC Options::
15424 * PDP-11 Options::
15425 * picoChip Options::
15426 * PowerPC Options::
15427 * PowerPC SPE Options::
15428 * RISC-V Options::
15429 * RL78 Options::
15430 * RS/6000 and PowerPC Options::
15431 * RX Options::
15432 * S/390 and zSeries Options::
15433 * Score Options::
15434 * SH Options::
15435 * Solaris 2 Options::
15436 * SPARC Options::
15437 * SPU Options::
15438 * System V Options::
15439 * TILE-Gx Options::
15440 * TILEPro Options::
15441 * V850 Options::
15442 * VAX Options::
15443 * Visium Options::
15444 * VMS Options::
15445 * VxWorks Options::
15446 * x86 Options::
15447 * x86 Windows Options::
15448 * Xstormy16 Options::
15449 * Xtensa Options::
15450 * zSeries Options::
15451 @end menu
15452
15453 @node AArch64 Options
15454 @subsection AArch64 Options
15455 @cindex AArch64 Options
15456
15457 These options are defined for AArch64 implementations:
15458
15459 @table @gcctabopt
15460
15461 @item -mabi=@var{name}
15462 @opindex mabi
15463 Generate code for the specified data model. Permissible values
15464 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15465 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15466 but long int and pointers are 64 bits.
15467
15468 The default depends on the specific target configuration. Note that
15469 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15470 entire program with the same ABI, and link with a compatible set of libraries.
15471
15472 @item -mbig-endian
15473 @opindex mbig-endian
15474 Generate big-endian code. This is the default when GCC is configured for an
15475 @samp{aarch64_be-*-*} target.
15476
15477 @item -mgeneral-regs-only
15478 @opindex mgeneral-regs-only
15479 Generate code which uses only the general-purpose registers. This will prevent
15480 the compiler from using floating-point and Advanced SIMD registers but will not
15481 impose any restrictions on the assembler.
15482
15483 @item -mlittle-endian
15484 @opindex mlittle-endian
15485 Generate little-endian code. This is the default when GCC is configured for an
15486 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15487
15488 @item -mcmodel=tiny
15489 @opindex mcmodel=tiny
15490 Generate code for the tiny code model. The program and its statically defined
15491 symbols must be within 1MB of each other. Programs can be statically or
15492 dynamically linked.
15493
15494 @item -mcmodel=small
15495 @opindex mcmodel=small
15496 Generate code for the small code model. The program and its statically defined
15497 symbols must be within 4GB of each other. Programs can be statically or
15498 dynamically linked. This is the default code model.
15499
15500 @item -mcmodel=large
15501 @opindex mcmodel=large
15502 Generate code for the large code model. This makes no assumptions about
15503 addresses and sizes of sections. Programs can be statically linked only.
15504
15505 @item -mstrict-align
15506 @itemx -mno-strict-align
15507 @opindex mstrict-align
15508 @opindex mno-strict-align
15509 Avoid or allow generating memory accesses that may not be aligned on a natural
15510 object boundary as described in the architecture specification.
15511
15512 @item -momit-leaf-frame-pointer
15513 @itemx -mno-omit-leaf-frame-pointer
15514 @opindex momit-leaf-frame-pointer
15515 @opindex mno-omit-leaf-frame-pointer
15516 Omit or keep the frame pointer in leaf functions. The former behavior is the
15517 default.
15518
15519 @item -mtls-dialect=desc
15520 @opindex mtls-dialect=desc
15521 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15522 of TLS variables. This is the default.
15523
15524 @item -mtls-dialect=traditional
15525 @opindex mtls-dialect=traditional
15526 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15527 of TLS variables.
15528
15529 @item -mtls-size=@var{size}
15530 @opindex mtls-size
15531 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15532 This option requires binutils 2.26 or newer.
15533
15534 @item -mfix-cortex-a53-835769
15535 @itemx -mno-fix-cortex-a53-835769
15536 @opindex mfix-cortex-a53-835769
15537 @opindex mno-fix-cortex-a53-835769
15538 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15539 This involves inserting a NOP instruction between memory instructions and
15540 64-bit integer multiply-accumulate instructions.
15541
15542 @item -mfix-cortex-a53-843419
15543 @itemx -mno-fix-cortex-a53-843419
15544 @opindex mfix-cortex-a53-843419
15545 @opindex mno-fix-cortex-a53-843419
15546 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15547 This erratum workaround is made at link time and this will only pass the
15548 corresponding flag to the linker.
15549
15550 @item -mlow-precision-recip-sqrt
15551 @itemx -mno-low-precision-recip-sqrt
15552 @opindex mlow-precision-recip-sqrt
15553 @opindex mno-low-precision-recip-sqrt
15554 Enable or disable the reciprocal square root approximation.
15555 This option only has an effect if @option{-ffast-math} or
15556 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15557 precision of reciprocal square root results to about 16 bits for
15558 single precision and to 32 bits for double precision.
15559
15560 @item -mlow-precision-sqrt
15561 @itemx -mno-low-precision-sqrt
15562 @opindex mlow-precision-sqrt
15563 @opindex mno-low-precision-sqrt
15564 Enable or disable the square root approximation.
15565 This option only has an effect if @option{-ffast-math} or
15566 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15567 precision of square root results to about 16 bits for
15568 single precision and to 32 bits for double precision.
15569 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15570
15571 @item -mlow-precision-div
15572 @itemx -mno-low-precision-div
15573 @opindex mlow-precision-div
15574 @opindex mno-low-precision-div
15575 Enable or disable the division approximation.
15576 This option only has an effect if @option{-ffast-math} or
15577 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15578 precision of division results to about 16 bits for
15579 single precision and to 32 bits for double precision.
15580
15581 @item -mtrack-speculation
15582 @itemx -mno-track-speculation
15583 Enable or disable generation of additional code to track speculative
15584 execution through conditional branches. The tracking state can then
15585 be used by the compiler when expanding calls to
15586 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15587 sequence to be generated.
15588
15589 @item -march=@var{name}
15590 @opindex march
15591 Specify the name of the target architecture and, optionally, one or
15592 more feature modifiers. This option has the form
15593 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15594
15595 The permissible values for @var{arch} are @samp{armv8-a},
15596 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
15597 or @var{native}.
15598
15599 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15600 support for the ARMv8.4-A architecture extensions.
15601
15602 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15603 support for the ARMv8.3-A architecture extensions.
15604
15605 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15606 support for the ARMv8.2-A architecture extensions.
15607
15608 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15609 support for the ARMv8.1-A architecture extension. In particular, it
15610 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15611
15612 The value @samp{native} is available on native AArch64 GNU/Linux and
15613 causes the compiler to pick the architecture of the host system. This
15614 option has no effect if the compiler is unable to recognize the
15615 architecture of the host system,
15616
15617 The permissible values for @var{feature} are listed in the sub-section
15618 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15619 Feature Modifiers}. Where conflicting feature modifiers are
15620 specified, the right-most feature is used.
15621
15622 GCC uses @var{name} to determine what kind of instructions it can emit
15623 when generating assembly code. If @option{-march} is specified
15624 without either of @option{-mtune} or @option{-mcpu} also being
15625 specified, the code is tuned to perform well across a range of target
15626 processors implementing the target architecture.
15627
15628 @item -mtune=@var{name}
15629 @opindex mtune
15630 Specify the name of the target processor for which GCC should tune the
15631 performance of the code. Permissible values for this option are:
15632 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15633 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15634 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15635 @samp{qdf24xx}, @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
15636 @samp{thunderx}, @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
15637 @samp{tsv110}, @samp{thunderxt83}, @samp{thunderx2t99},
15638 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15639 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15640 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15641 @samp{native}.
15642
15643 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15644 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15645 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15646 should tune for a big.LITTLE system.
15647
15648 Additionally on native AArch64 GNU/Linux systems the value
15649 @samp{native} tunes performance to the host system. This option has no effect
15650 if the compiler is unable to recognize the processor of the host system.
15651
15652 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15653 are specified, the code is tuned to perform well across a range
15654 of target processors.
15655
15656 This option cannot be suffixed by feature modifiers.
15657
15658 @item -mcpu=@var{name}
15659 @opindex mcpu
15660 Specify the name of the target processor, optionally suffixed by one
15661 or more feature modifiers. This option has the form
15662 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15663 the permissible values for @var{cpu} are the same as those available
15664 for @option{-mtune}. The permissible values for @var{feature} are
15665 documented in the sub-section on
15666 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15667 Feature Modifiers}. Where conflicting feature modifiers are
15668 specified, the right-most feature is used.
15669
15670 GCC uses @var{name} to determine what kind of instructions it can emit when
15671 generating assembly code (as if by @option{-march}) and to determine
15672 the target processor for which to tune for performance (as if
15673 by @option{-mtune}). Where this option is used in conjunction
15674 with @option{-march} or @option{-mtune}, those options take precedence
15675 over the appropriate part of this option.
15676
15677 @item -moverride=@var{string}
15678 @opindex moverride
15679 Override tuning decisions made by the back-end in response to a
15680 @option{-mtune=} switch. The syntax, semantics, and accepted values
15681 for @var{string} in this option are not guaranteed to be consistent
15682 across releases.
15683
15684 This option is only intended to be useful when developing GCC.
15685
15686 @item -mverbose-cost-dump
15687 @opindex mverbose-cost-dump
15688 Enable verbose cost model dumping in the debug dump files. This option is
15689 provided for use in debugging the compiler.
15690
15691 @item -mpc-relative-literal-loads
15692 @itemx -mno-pc-relative-literal-loads
15693 @opindex mpc-relative-literal-loads
15694 @opindex mno-pc-relative-literal-loads
15695 Enable or disable PC-relative literal loads. With this option literal pools are
15696 accessed using a single instruction and emitted after each function. This
15697 limits the maximum size of functions to 1MB. This is enabled by default for
15698 @option{-mcmodel=tiny}.
15699
15700 @item -msign-return-address=@var{scope}
15701 @opindex msign-return-address
15702 Select the function scope on which return address signing will be applied.
15703 Permissible values are @samp{none}, which disables return address signing,
15704 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15705 functions, and @samp{all}, which enables pointer signing for all functions. The
15706 default value is @samp{none}.
15707
15708 @item -msve-vector-bits=@var{bits}
15709 @opindex msve-vector-bits
15710 Specify the number of bits in an SVE vector register. This option only has
15711 an effect when SVE is enabled.
15712
15713 GCC supports two forms of SVE code generation: ``vector-length
15714 agnostic'' output that works with any size of vector register and
15715 ``vector-length specific'' output that only works when the vector
15716 registers are a particular size. Replacing @var{bits} with
15717 @samp{scalable} selects vector-length agnostic output while
15718 replacing it with a number selects vector-length specific output.
15719 The possible lengths in the latter case are: 128, 256, 512, 1024
15720 and 2048. @samp{scalable} is the default.
15721
15722 At present, @samp{-msve-vector-bits=128} produces the same output
15723 as @samp{-msve-vector-bits=scalable}.
15724
15725 @end table
15726
15727 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
15728 @anchor{aarch64-feature-modifiers}
15729 @cindex @option{-march} feature modifiers
15730 @cindex @option{-mcpu} feature modifiers
15731 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
15732 the following and their inverses @option{no@var{feature}}:
15733
15734 @table @samp
15735 @item crc
15736 Enable CRC extension. This is on by default for
15737 @option{-march=armv8.1-a}.
15738 @item crypto
15739 Enable Crypto extension. This also enables Advanced SIMD and floating-point
15740 instructions.
15741 @item fp
15742 Enable floating-point instructions. This is on by default for all possible
15743 values for options @option{-march} and @option{-mcpu}.
15744 @item simd
15745 Enable Advanced SIMD instructions. This also enables floating-point
15746 instructions. This is on by default for all possible values for options
15747 @option{-march} and @option{-mcpu}.
15748 @item sve
15749 Enable Scalable Vector Extension instructions. This also enables Advanced
15750 SIMD and floating-point instructions.
15751 @item lse
15752 Enable Large System Extension instructions. This is on by default for
15753 @option{-march=armv8.1-a}.
15754 @item rdma
15755 Enable Round Double Multiply Accumulate instructions. This is on by default
15756 for @option{-march=armv8.1-a}.
15757 @item fp16
15758 Enable FP16 extension. This also enables floating-point instructions.
15759 @item fp16fml
15760 Enable FP16 fmla extension. This also enables FP16 extensions and
15761 floating-point instructions. This option is enabled by default for @option{-march=armv8.4-a}. Use of this option with architectures prior to Armv8.2-A is not supported.
15762
15763 @item rcpc
15764 Enable the RcPc extension. This does not change code generation from GCC,
15765 but is passed on to the assembler, enabling inline asm statements to use
15766 instructions from the RcPc extension.
15767 @item dotprod
15768 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
15769 @item aes
15770 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
15771 SIMD instructions.
15772 @item sha2
15773 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
15774 @item sha3
15775 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
15776 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
15777 @item sm4
15778 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
15779 Use of this option with architectures prior to Armv8.2-A is not supported.
15780 @item profile
15781 Enable the Statistical Profiling extension. This option is only to enable the
15782 extension at the assembler level and does not affect code generation.
15783
15784 @end table
15785
15786 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
15787 which implies @option{fp}.
15788 Conversely, @option{nofp} implies @option{nosimd}, which implies
15789 @option{nocrypto}, @option{noaes} and @option{nosha2}.
15790
15791 @node Adapteva Epiphany Options
15792 @subsection Adapteva Epiphany Options
15793
15794 These @samp{-m} options are defined for Adapteva Epiphany:
15795
15796 @table @gcctabopt
15797 @item -mhalf-reg-file
15798 @opindex mhalf-reg-file
15799 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
15800 That allows code to run on hardware variants that lack these registers.
15801
15802 @item -mprefer-short-insn-regs
15803 @opindex mprefer-short-insn-regs
15804 Preferentially allocate registers that allow short instruction generation.
15805 This can result in increased instruction count, so this may either reduce or
15806 increase overall code size.
15807
15808 @item -mbranch-cost=@var{num}
15809 @opindex mbranch-cost
15810 Set the cost of branches to roughly @var{num} ``simple'' instructions.
15811 This cost is only a heuristic and is not guaranteed to produce
15812 consistent results across releases.
15813
15814 @item -mcmove
15815 @opindex mcmove
15816 Enable the generation of conditional moves.
15817
15818 @item -mnops=@var{num}
15819 @opindex mnops
15820 Emit @var{num} NOPs before every other generated instruction.
15821
15822 @item -mno-soft-cmpsf
15823 @opindex mno-soft-cmpsf
15824 @opindex msoft-cmpsf
15825 For single-precision floating-point comparisons, emit an @code{fsub} instruction
15826 and test the flags. This is faster than a software comparison, but can
15827 get incorrect results in the presence of NaNs, or when two different small
15828 numbers are compared such that their difference is calculated as zero.
15829 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
15830 software comparisons.
15831
15832 @item -mstack-offset=@var{num}
15833 @opindex mstack-offset
15834 Set the offset between the top of the stack and the stack pointer.
15835 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
15836 can be used by leaf functions without stack allocation.
15837 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
15838 Note also that this option changes the ABI; compiling a program with a
15839 different stack offset than the libraries have been compiled with
15840 generally does not work.
15841 This option can be useful if you want to evaluate if a different stack
15842 offset would give you better code, but to actually use a different stack
15843 offset to build working programs, it is recommended to configure the
15844 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
15845
15846 @item -mno-round-nearest
15847 @opindex mno-round-nearest
15848 @opindex mround-nearest
15849 Make the scheduler assume that the rounding mode has been set to
15850 truncating. The default is @option{-mround-nearest}.
15851
15852 @item -mlong-calls
15853 @opindex mlong-calls
15854 If not otherwise specified by an attribute, assume all calls might be beyond
15855 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
15856 function address into a register before performing a (otherwise direct) call.
15857 This is the default.
15858
15859 @item -mshort-calls
15860 @opindex short-calls
15861 If not otherwise specified by an attribute, assume all direct calls are
15862 in the range of the @code{b} / @code{bl} instructions, so use these instructions
15863 for direct calls. The default is @option{-mlong-calls}.
15864
15865 @item -msmall16
15866 @opindex msmall16
15867 Assume addresses can be loaded as 16-bit unsigned values. This does not
15868 apply to function addresses for which @option{-mlong-calls} semantics
15869 are in effect.
15870
15871 @item -mfp-mode=@var{mode}
15872 @opindex mfp-mode
15873 Set the prevailing mode of the floating-point unit.
15874 This determines the floating-point mode that is provided and expected
15875 at function call and return time. Making this mode match the mode you
15876 predominantly need at function start can make your programs smaller and
15877 faster by avoiding unnecessary mode switches.
15878
15879 @var{mode} can be set to one the following values:
15880
15881 @table @samp
15882 @item caller
15883 Any mode at function entry is valid, and retained or restored when
15884 the function returns, and when it calls other functions.
15885 This mode is useful for compiling libraries or other compilation units
15886 you might want to incorporate into different programs with different
15887 prevailing FPU modes, and the convenience of being able to use a single
15888 object file outweighs the size and speed overhead for any extra
15889 mode switching that might be needed, compared with what would be needed
15890 with a more specific choice of prevailing FPU mode.
15891
15892 @item truncate
15893 This is the mode used for floating-point calculations with
15894 truncating (i.e.@: round towards zero) rounding mode. That includes
15895 conversion from floating point to integer.
15896
15897 @item round-nearest
15898 This is the mode used for floating-point calculations with
15899 round-to-nearest-or-even rounding mode.
15900
15901 @item int
15902 This is the mode used to perform integer calculations in the FPU, e.g.@:
15903 integer multiply, or integer multiply-and-accumulate.
15904 @end table
15905
15906 The default is @option{-mfp-mode=caller}
15907
15908 @item -mno-split-lohi
15909 @itemx -mno-postinc
15910 @itemx -mno-postmodify
15911 @opindex mno-split-lohi
15912 @opindex msplit-lohi
15913 @opindex mno-postinc
15914 @opindex mpostinc
15915 @opindex mno-postmodify
15916 @opindex mpostmodify
15917 Code generation tweaks that disable, respectively, splitting of 32-bit
15918 loads, generation of post-increment addresses, and generation of
15919 post-modify addresses. The defaults are @option{msplit-lohi},
15920 @option{-mpost-inc}, and @option{-mpost-modify}.
15921
15922 @item -mnovect-double
15923 @opindex mno-vect-double
15924 @opindex mvect-double
15925 Change the preferred SIMD mode to SImode. The default is
15926 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
15927
15928 @item -max-vect-align=@var{num}
15929 @opindex max-vect-align
15930 The maximum alignment for SIMD vector mode types.
15931 @var{num} may be 4 or 8. The default is 8.
15932 Note that this is an ABI change, even though many library function
15933 interfaces are unaffected if they don't use SIMD vector modes
15934 in places that affect size and/or alignment of relevant types.
15935
15936 @item -msplit-vecmove-early
15937 @opindex msplit-vecmove-early
15938 Split vector moves into single word moves before reload. In theory this
15939 can give better register allocation, but so far the reverse seems to be
15940 generally the case.
15941
15942 @item -m1reg-@var{reg}
15943 @opindex m1reg-
15944 Specify a register to hold the constant @minus{}1, which makes loading small negative
15945 constants and certain bitmasks faster.
15946 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
15947 which specify use of that register as a fixed register,
15948 and @samp{none}, which means that no register is used for this
15949 purpose. The default is @option{-m1reg-none}.
15950
15951 @end table
15952
15953 @node ARC Options
15954 @subsection ARC Options
15955 @cindex ARC options
15956
15957 The following options control the architecture variant for which code
15958 is being compiled:
15959
15960 @c architecture variants
15961 @table @gcctabopt
15962
15963 @item -mbarrel-shifter
15964 @opindex mbarrel-shifter
15965 Generate instructions supported by barrel shifter. This is the default
15966 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
15967
15968 @item -mjli-always
15969 @opindex mjli-alawys
15970 Force to call a function using jli_s instruction. This option is
15971 valid only for ARCv2 architecture.
15972
15973 @item -mcpu=@var{cpu}
15974 @opindex mcpu
15975 Set architecture type, register usage, and instruction scheduling
15976 parameters for @var{cpu}. There are also shortcut alias options
15977 available for backward compatibility and convenience. Supported
15978 values for @var{cpu} are
15979
15980 @table @samp
15981 @opindex mA6
15982 @opindex mARC600
15983 @item arc600
15984 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
15985
15986 @item arc601
15987 @opindex mARC601
15988 Compile for ARC601. Alias: @option{-mARC601}.
15989
15990 @item arc700
15991 @opindex mA7
15992 @opindex mARC700
15993 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
15994 This is the default when configured with @option{--with-cpu=arc700}@.
15995
15996 @item arcem
15997 Compile for ARC EM.
15998
15999 @item archs
16000 Compile for ARC HS.
16001
16002 @item em
16003 Compile for ARC EM CPU with no hardware extensions.
16004
16005 @item em4
16006 Compile for ARC EM4 CPU.
16007
16008 @item em4_dmips
16009 Compile for ARC EM4 DMIPS CPU.
16010
16011 @item em4_fpus
16012 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16013 extension.
16014
16015 @item em4_fpuda
16016 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16017 double assist instructions.
16018
16019 @item hs
16020 Compile for ARC HS CPU with no hardware extensions except the atomic
16021 instructions.
16022
16023 @item hs34
16024 Compile for ARC HS34 CPU.
16025
16026 @item hs38
16027 Compile for ARC HS38 CPU.
16028
16029 @item hs38_linux
16030 Compile for ARC HS38 CPU with all hardware extensions on.
16031
16032 @item arc600_norm
16033 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16034
16035 @item arc600_mul32x16
16036 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16037 instructions enabled.
16038
16039 @item arc600_mul64
16040 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16041 instructions enabled.
16042
16043 @item arc601_norm
16044 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16045
16046 @item arc601_mul32x16
16047 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16048 instructions enabled.
16049
16050 @item arc601_mul64
16051 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16052 instructions enabled.
16053
16054 @item nps400
16055 Compile for ARC 700 on NPS400 chip.
16056
16057 @item em_mini
16058 Compile for ARC EM minimalist configuration featuring reduced register
16059 set.
16060
16061 @end table
16062
16063 @item -mdpfp
16064 @opindex mdpfp
16065 @itemx -mdpfp-compact
16066 @opindex mdpfp-compact
16067 Generate double-precision FPX instructions, tuned for the compact
16068 implementation.
16069
16070 @item -mdpfp-fast
16071 @opindex mdpfp-fast
16072 Generate double-precision FPX instructions, tuned for the fast
16073 implementation.
16074
16075 @item -mno-dpfp-lrsr
16076 @opindex mno-dpfp-lrsr
16077 Disable @code{lr} and @code{sr} instructions from using FPX extension
16078 aux registers.
16079
16080 @item -mea
16081 @opindex mea
16082 Generate extended arithmetic instructions. Currently only
16083 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16084 supported. This is always enabled for @option{-mcpu=ARC700}.
16085
16086 @item -mno-mpy
16087 @opindex mno-mpy
16088 @opindex mmpy
16089 Do not generate @code{mpy}-family instructions for ARC700. This option is
16090 deprecated.
16091
16092 @item -mmul32x16
16093 @opindex mmul32x16
16094 Generate 32x16-bit multiply and multiply-accumulate instructions.
16095
16096 @item -mmul64
16097 @opindex mmul64
16098 Generate @code{mul64} and @code{mulu64} instructions.
16099 Only valid for @option{-mcpu=ARC600}.
16100
16101 @item -mnorm
16102 @opindex mnorm
16103 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16104 is in effect.
16105
16106 @item -mspfp
16107 @opindex mspfp
16108 @itemx -mspfp-compact
16109 @opindex mspfp-compact
16110 Generate single-precision FPX instructions, tuned for the compact
16111 implementation.
16112
16113 @item -mspfp-fast
16114 @opindex mspfp-fast
16115 Generate single-precision FPX instructions, tuned for the fast
16116 implementation.
16117
16118 @item -msimd
16119 @opindex msimd
16120 Enable generation of ARC SIMD instructions via target-specific
16121 builtins. Only valid for @option{-mcpu=ARC700}.
16122
16123 @item -msoft-float
16124 @opindex msoft-float
16125 This option ignored; it is provided for compatibility purposes only.
16126 Software floating-point code is emitted by default, and this default
16127 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16128 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16129 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16130
16131 @item -mswap
16132 @opindex mswap
16133 Generate @code{swap} instructions.
16134
16135 @item -matomic
16136 @opindex matomic
16137 This enables use of the locked load/store conditional extension to implement
16138 atomic memory built-in functions. Not available for ARC 6xx or ARC
16139 EM cores.
16140
16141 @item -mdiv-rem
16142 @opindex mdiv-rem
16143 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16144
16145 @item -mcode-density
16146 @opindex mcode-density
16147 Enable code density instructions for ARC EM.
16148 This option is on by default for ARC HS.
16149
16150 @item -mll64
16151 @opindex mll64
16152 Enable double load/store operations for ARC HS cores.
16153
16154 @item -mtp-regno=@var{regno}
16155 @opindex mtp-regno
16156 Specify thread pointer register number.
16157
16158 @item -mmpy-option=@var{multo}
16159 @opindex mmpy-option
16160 Compile ARCv2 code with a multiplier design option. You can specify
16161 the option using either a string or numeric value for @var{multo}.
16162 @samp{wlh1} is the default value. The recognized values are:
16163
16164 @table @samp
16165 @item 0
16166 @itemx none
16167 No multiplier available.
16168
16169 @item 1
16170 @itemx w
16171 16x16 multiplier, fully pipelined.
16172 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16173
16174 @item 2
16175 @itemx wlh1
16176 32x32 multiplier, fully
16177 pipelined (1 stage). The following instructions are additionally
16178 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16179
16180 @item 3
16181 @itemx wlh2
16182 32x32 multiplier, fully pipelined
16183 (2 stages). The following instructions are additionally enabled: @code{mpy},
16184 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16185
16186 @item 4
16187 @itemx wlh3
16188 Two 16x16 multipliers, blocking,
16189 sequential. The following instructions are additionally enabled: @code{mpy},
16190 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16191
16192 @item 5
16193 @itemx wlh4
16194 One 16x16 multiplier, blocking,
16195 sequential. The following instructions are additionally enabled: @code{mpy},
16196 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16197
16198 @item 6
16199 @itemx wlh5
16200 One 32x4 multiplier, blocking,
16201 sequential. The following instructions are additionally enabled: @code{mpy},
16202 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16203
16204 @item 7
16205 @itemx plus_dmpy
16206 ARC HS SIMD support.
16207
16208 @item 8
16209 @itemx plus_macd
16210 ARC HS SIMD support.
16211
16212 @item 9
16213 @itemx plus_qmacw
16214 ARC HS SIMD support.
16215
16216 @end table
16217
16218 This option is only available for ARCv2 cores@.
16219
16220 @item -mfpu=@var{fpu}
16221 @opindex mfpu
16222 Enables support for specific floating-point hardware extensions for ARCv2
16223 cores. Supported values for @var{fpu} are:
16224
16225 @table @samp
16226
16227 @item fpus
16228 Enables support for single-precision floating-point hardware
16229 extensions@.
16230
16231 @item fpud
16232 Enables support for double-precision floating-point hardware
16233 extensions. The single-precision floating-point extension is also
16234 enabled. Not available for ARC EM@.
16235
16236 @item fpuda
16237 Enables support for double-precision floating-point hardware
16238 extensions using double-precision assist instructions. The single-precision
16239 floating-point extension is also enabled. This option is
16240 only available for ARC EM@.
16241
16242 @item fpuda_div
16243 Enables support for double-precision floating-point hardware
16244 extensions using double-precision assist instructions.
16245 The single-precision floating-point, square-root, and divide
16246 extensions are also enabled. This option is
16247 only available for ARC EM@.
16248
16249 @item fpuda_fma
16250 Enables support for double-precision floating-point hardware
16251 extensions using double-precision assist instructions.
16252 The single-precision floating-point and fused multiply and add
16253 hardware extensions are also enabled. This option is
16254 only available for ARC EM@.
16255
16256 @item fpuda_all
16257 Enables support for double-precision floating-point hardware
16258 extensions using double-precision assist instructions.
16259 All single-precision floating-point hardware extensions are also
16260 enabled. This option is only available for ARC EM@.
16261
16262 @item fpus_div
16263 Enables support for single-precision floating-point, square-root and divide
16264 hardware extensions@.
16265
16266 @item fpud_div
16267 Enables support for double-precision floating-point, square-root and divide
16268 hardware extensions. This option
16269 includes option @samp{fpus_div}. Not available for ARC EM@.
16270
16271 @item fpus_fma
16272 Enables support for single-precision floating-point and
16273 fused multiply and add hardware extensions@.
16274
16275 @item fpud_fma
16276 Enables support for double-precision floating-point and
16277 fused multiply and add hardware extensions. This option
16278 includes option @samp{fpus_fma}. Not available for ARC EM@.
16279
16280 @item fpus_all
16281 Enables support for all single-precision floating-point hardware
16282 extensions@.
16283
16284 @item fpud_all
16285 Enables support for all single- and double-precision floating-point
16286 hardware extensions. Not available for ARC EM@.
16287
16288 @end table
16289
16290 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16291 @opindex mirq-ctrl-saved
16292 Specifies general-purposes registers that the processor automatically
16293 saves/restores on interrupt entry and exit. @var{register-range} is
16294 specified as two registers separated by a dash. The register range
16295 always starts with @code{r0}, the upper limit is @code{fp} register.
16296 @var{blink} and @var{lp_count} are optional. This option is only
16297 valid for ARC EM and ARC HS cores.
16298
16299 @item -mrgf-banked-regs=@var{number}
16300 @opindex mrgf-banked-regs
16301 Specifies the number of registers replicated in second register bank
16302 on entry to fast interrupt. Fast interrupts are interrupts with the
16303 highest priority level P0. These interrupts save only PC and STATUS32
16304 registers to avoid memory transactions during interrupt entry and exit
16305 sequences. Use this option when you are using fast interrupts in an
16306 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16307
16308 @item -mlpc-width=@var{width}
16309 @opindex mlpc-width
16310 Specify the width of the @code{lp_count} register. Valid values for
16311 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16312 fixed to 32 bits. If the width is less than 32, the compiler does not
16313 attempt to transform loops in your program to use the zero-delay loop
16314 mechanism unless it is known that the @code{lp_count} register can
16315 hold the required loop-counter value. Depending on the width
16316 specified, the compiler and run-time library might continue to use the
16317 loop mechanism for various needs. This option defines macro
16318 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16319
16320 @item -mrf16
16321 @opindex mrf16
16322 This option instructs the compiler to generate code for a 16-entry
16323 register file. This option defines the @code{__ARC_RF16__}
16324 preprocessor macro.
16325
16326 @item -mbranch-index
16327 @opindex mbranch-index
16328 Enable use of @code{bi} or @code{bih} instructions to implement jump
16329 tables.
16330
16331 @end table
16332
16333 The following options are passed through to the assembler, and also
16334 define preprocessor macro symbols.
16335
16336 @c Flags used by the assembler, but for which we define preprocessor
16337 @c macro symbols as well.
16338 @table @gcctabopt
16339 @item -mdsp-packa
16340 @opindex mdsp-packa
16341 Passed down to the assembler to enable the DSP Pack A extensions.
16342 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16343 deprecated.
16344
16345 @item -mdvbf
16346 @opindex mdvbf
16347 Passed down to the assembler to enable the dual Viterbi butterfly
16348 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16349 option is deprecated.
16350
16351 @c ARC700 4.10 extension instruction
16352 @item -mlock
16353 @opindex mlock
16354 Passed down to the assembler to enable the locked load/store
16355 conditional extension. Also sets the preprocessor symbol
16356 @code{__Xlock}.
16357
16358 @item -mmac-d16
16359 @opindex mmac-d16
16360 Passed down to the assembler. Also sets the preprocessor symbol
16361 @code{__Xxmac_d16}. This option is deprecated.
16362
16363 @item -mmac-24
16364 @opindex mmac-24
16365 Passed down to the assembler. Also sets the preprocessor symbol
16366 @code{__Xxmac_24}. This option is deprecated.
16367
16368 @c ARC700 4.10 extension instruction
16369 @item -mrtsc
16370 @opindex mrtsc
16371 Passed down to the assembler to enable the 64-bit time-stamp counter
16372 extension instruction. Also sets the preprocessor symbol
16373 @code{__Xrtsc}. This option is deprecated.
16374
16375 @c ARC700 4.10 extension instruction
16376 @item -mswape
16377 @opindex mswape
16378 Passed down to the assembler to enable the swap byte ordering
16379 extension instruction. Also sets the preprocessor symbol
16380 @code{__Xswape}.
16381
16382 @item -mtelephony
16383 @opindex mtelephony
16384 Passed down to the assembler to enable dual- and single-operand
16385 instructions for telephony. Also sets the preprocessor symbol
16386 @code{__Xtelephony}. This option is deprecated.
16387
16388 @item -mxy
16389 @opindex mxy
16390 Passed down to the assembler to enable the XY memory extension. Also
16391 sets the preprocessor symbol @code{__Xxy}.
16392
16393 @end table
16394
16395 The following options control how the assembly code is annotated:
16396
16397 @c Assembly annotation options
16398 @table @gcctabopt
16399 @item -misize
16400 @opindex misize
16401 Annotate assembler instructions with estimated addresses.
16402
16403 @item -mannotate-align
16404 @opindex mannotate-align
16405 Explain what alignment considerations lead to the decision to make an
16406 instruction short or long.
16407
16408 @end table
16409
16410 The following options are passed through to the linker:
16411
16412 @c options passed through to the linker
16413 @table @gcctabopt
16414 @item -marclinux
16415 @opindex marclinux
16416 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16417 This option is enabled by default in tool chains built for
16418 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16419 when profiling is not requested.
16420
16421 @item -marclinux_prof
16422 @opindex marclinux_prof
16423 Passed through to the linker, to specify use of the
16424 @code{arclinux_prof} emulation. This option is enabled by default in
16425 tool chains built for @w{@code{arc-linux-uclibc}} and
16426 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16427
16428 @end table
16429
16430 The following options control the semantics of generated code:
16431
16432 @c semantically relevant code generation options
16433 @table @gcctabopt
16434 @item -mlong-calls
16435 @opindex mlong-calls
16436 Generate calls as register indirect calls, thus providing access
16437 to the full 32-bit address range.
16438
16439 @item -mmedium-calls
16440 @opindex mmedium-calls
16441 Don't use less than 25-bit addressing range for calls, which is the
16442 offset available for an unconditional branch-and-link
16443 instruction. Conditional execution of function calls is suppressed, to
16444 allow use of the 25-bit range, rather than the 21-bit range with
16445 conditional branch-and-link. This is the default for tool chains built
16446 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16447
16448 @item -G @var{num}
16449 @opindex G
16450 Put definitions of externally-visible data in a small data section if
16451 that data is no bigger than @var{num} bytes. The default value of
16452 @var{num} is 4 for any ARC configuration, or 8 when we have double
16453 load/store operations.
16454
16455 @item -mno-sdata
16456 @opindex mno-sdata
16457 @opindex msdata
16458 Do not generate sdata references. This is the default for tool chains
16459 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16460 targets.
16461
16462 @item -mvolatile-cache
16463 @opindex mvolatile-cache
16464 Use ordinarily cached memory accesses for volatile references. This is the
16465 default.
16466
16467 @item -mno-volatile-cache
16468 @opindex mno-volatile-cache
16469 @opindex mvolatile-cache
16470 Enable cache bypass for volatile references.
16471
16472 @end table
16473
16474 The following options fine tune code generation:
16475 @c code generation tuning options
16476 @table @gcctabopt
16477 @item -malign-call
16478 @opindex malign-call
16479 Do alignment optimizations for call instructions.
16480
16481 @item -mauto-modify-reg
16482 @opindex mauto-modify-reg
16483 Enable the use of pre/post modify with register displacement.
16484
16485 @item -mbbit-peephole
16486 @opindex mbbit-peephole
16487 Enable bbit peephole2.
16488
16489 @item -mno-brcc
16490 @opindex mno-brcc
16491 This option disables a target-specific pass in @file{arc_reorg} to
16492 generate compare-and-branch (@code{br@var{cc}}) instructions.
16493 It has no effect on
16494 generation of these instructions driven by the combiner pass.
16495
16496 @item -mcase-vector-pcrel
16497 @opindex mcase-vector-pcrel
16498 Use PC-relative switch case tables to enable case table shortening.
16499 This is the default for @option{-Os}.
16500
16501 @item -mcompact-casesi
16502 @opindex mcompact-casesi
16503 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16504 and only available for ARCv1 cores. This option is deprecated.
16505
16506 @item -mno-cond-exec
16507 @opindex mno-cond-exec
16508 Disable the ARCompact-specific pass to generate conditional
16509 execution instructions.
16510
16511 Due to delay slot scheduling and interactions between operand numbers,
16512 literal sizes, instruction lengths, and the support for conditional execution,
16513 the target-independent pass to generate conditional execution is often lacking,
16514 so the ARC port has kept a special pass around that tries to find more
16515 conditional execution generation opportunities after register allocation,
16516 branch shortening, and delay slot scheduling have been done. This pass
16517 generally, but not always, improves performance and code size, at the cost of
16518 extra compilation time, which is why there is an option to switch it off.
16519 If you have a problem with call instructions exceeding their allowable
16520 offset range because they are conditionalized, you should consider using
16521 @option{-mmedium-calls} instead.
16522
16523 @item -mearly-cbranchsi
16524 @opindex mearly-cbranchsi
16525 Enable pre-reload use of the @code{cbranchsi} pattern.
16526
16527 @item -mexpand-adddi
16528 @opindex mexpand-adddi
16529 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16530 @code{add.f}, @code{adc} etc. This option is deprecated.
16531
16532 @item -mindexed-loads
16533 @opindex mindexed-loads
16534 Enable the use of indexed loads. This can be problematic because some
16535 optimizers then assume that indexed stores exist, which is not
16536 the case.
16537
16538 @item -mlra
16539 @opindex mlra
16540 Enable Local Register Allocation. This is still experimental for ARC,
16541 so by default the compiler uses standard reload
16542 (i.e.@: @option{-mno-lra}).
16543
16544 @item -mlra-priority-none
16545 @opindex mlra-priority-none
16546 Don't indicate any priority for target registers.
16547
16548 @item -mlra-priority-compact
16549 @opindex mlra-priority-compact
16550 Indicate target register priority for r0..r3 / r12..r15.
16551
16552 @item -mlra-priority-noncompact
16553 @opindex mlra-priority-noncompact
16554 Reduce target register priority for r0..r3 / r12..r15.
16555
16556 @item -mmillicode
16557 @opindex mmillicode
16558 When optimizing for size (using @option{-Os}), prologues and epilogues
16559 that have to save or restore a large number of registers are often
16560 shortened by using call to a special function in libgcc; this is
16561 referred to as a @emph{millicode} call. As these calls can pose
16562 performance issues, and/or cause linking issues when linking in a
16563 nonstandard way, this option is provided to turn on or off millicode
16564 call generation.
16565
16566 @item -mcode-density-frame
16567 @opindex mcode-density-frame
16568 This option enable the compiler to emit @code{enter} and @code{leave}
16569 instructions. These instructions are only valid for CPUs with
16570 code-density feature.
16571
16572 @item -mmixed-code
16573 @opindex mmixed-code
16574 Tweak register allocation to help 16-bit instruction generation.
16575 This generally has the effect of decreasing the average instruction size
16576 while increasing the instruction count.
16577
16578 @item -mq-class
16579 @opindex mq-class
16580 Enable @samp{q} instruction alternatives.
16581 This is the default for @option{-Os}.
16582
16583 @item -mRcq
16584 @opindex mRcq
16585 Enable @samp{Rcq} constraint handling.
16586 Most short code generation depends on this.
16587 This is the default.
16588
16589 @item -mRcw
16590 @opindex mRcw
16591 Enable @samp{Rcw} constraint handling.
16592 Most ccfsm condexec mostly depends on this.
16593 This is the default.
16594
16595 @item -msize-level=@var{level}
16596 @opindex msize-level
16597 Fine-tune size optimization with regards to instruction lengths and alignment.
16598 The recognized values for @var{level} are:
16599 @table @samp
16600 @item 0
16601 No size optimization. This level is deprecated and treated like @samp{1}.
16602
16603 @item 1
16604 Short instructions are used opportunistically.
16605
16606 @item 2
16607 In addition, alignment of loops and of code after barriers are dropped.
16608
16609 @item 3
16610 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16611
16612 @end table
16613
16614 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16615 the behavior when this is not set is equivalent to level @samp{1}.
16616
16617 @item -mtune=@var{cpu}
16618 @opindex mtune
16619 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16620 by @option{-mcpu=}.
16621
16622 Supported values for @var{cpu} are
16623
16624 @table @samp
16625 @item ARC600
16626 Tune for ARC600 CPU.
16627
16628 @item ARC601
16629 Tune for ARC601 CPU.
16630
16631 @item ARC700
16632 Tune for ARC700 CPU with standard multiplier block.
16633
16634 @item ARC700-xmac
16635 Tune for ARC700 CPU with XMAC block.
16636
16637 @item ARC725D
16638 Tune for ARC725D CPU.
16639
16640 @item ARC750D
16641 Tune for ARC750D CPU.
16642
16643 @end table
16644
16645 @item -mmultcost=@var{num}
16646 @opindex mmultcost
16647 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16648 normal instruction.
16649
16650 @item -munalign-prob-threshold=@var{probability}
16651 @opindex munalign-prob-threshold
16652 Set probability threshold for unaligning branches.
16653 When tuning for @samp{ARC700} and optimizing for speed, branches without
16654 filled delay slot are preferably emitted unaligned and long, unless
16655 profiling indicates that the probability for the branch to be taken
16656 is below @var{probability}. @xref{Cross-profiling}.
16657 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16658
16659 @end table
16660
16661 The following options are maintained for backward compatibility, but
16662 are now deprecated and will be removed in a future release:
16663
16664 @c Deprecated options
16665 @table @gcctabopt
16666
16667 @item -margonaut
16668 @opindex margonaut
16669 Obsolete FPX.
16670
16671 @item -mbig-endian
16672 @opindex mbig-endian
16673 @itemx -EB
16674 @opindex EB
16675 Compile code for big-endian targets. Use of these options is now
16676 deprecated. Big-endian code is supported by configuring GCC to build
16677 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
16678 for which big endian is the default.
16679
16680 @item -mlittle-endian
16681 @opindex mlittle-endian
16682 @itemx -EL
16683 @opindex EL
16684 Compile code for little-endian targets. Use of these options is now
16685 deprecated. Little-endian code is supported by configuring GCC to build
16686 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
16687 for which little endian is the default.
16688
16689 @item -mbarrel_shifter
16690 @opindex mbarrel_shifter
16691 Replaced by @option{-mbarrel-shifter}.
16692
16693 @item -mdpfp_compact
16694 @opindex mdpfp_compact
16695 Replaced by @option{-mdpfp-compact}.
16696
16697 @item -mdpfp_fast
16698 @opindex mdpfp_fast
16699 Replaced by @option{-mdpfp-fast}.
16700
16701 @item -mdsp_packa
16702 @opindex mdsp_packa
16703 Replaced by @option{-mdsp-packa}.
16704
16705 @item -mEA
16706 @opindex mEA
16707 Replaced by @option{-mea}.
16708
16709 @item -mmac_24
16710 @opindex mmac_24
16711 Replaced by @option{-mmac-24}.
16712
16713 @item -mmac_d16
16714 @opindex mmac_d16
16715 Replaced by @option{-mmac-d16}.
16716
16717 @item -mspfp_compact
16718 @opindex mspfp_compact
16719 Replaced by @option{-mspfp-compact}.
16720
16721 @item -mspfp_fast
16722 @opindex mspfp_fast
16723 Replaced by @option{-mspfp-fast}.
16724
16725 @item -mtune=@var{cpu}
16726 @opindex mtune
16727 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
16728 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
16729 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
16730
16731 @item -multcost=@var{num}
16732 @opindex multcost
16733 Replaced by @option{-mmultcost}.
16734
16735 @end table
16736
16737 @node ARM Options
16738 @subsection ARM Options
16739 @cindex ARM options
16740
16741 These @samp{-m} options are defined for the ARM port:
16742
16743 @table @gcctabopt
16744 @item -mabi=@var{name}
16745 @opindex mabi
16746 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
16747 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
16748
16749 @item -mapcs-frame
16750 @opindex mapcs-frame
16751 Generate a stack frame that is compliant with the ARM Procedure Call
16752 Standard for all functions, even if this is not strictly necessary for
16753 correct execution of the code. Specifying @option{-fomit-frame-pointer}
16754 with this option causes the stack frames not to be generated for
16755 leaf functions. The default is @option{-mno-apcs-frame}.
16756 This option is deprecated.
16757
16758 @item -mapcs
16759 @opindex mapcs
16760 This is a synonym for @option{-mapcs-frame} and is deprecated.
16761
16762 @ignore
16763 @c not currently implemented
16764 @item -mapcs-stack-check
16765 @opindex mapcs-stack-check
16766 Generate code to check the amount of stack space available upon entry to
16767 every function (that actually uses some stack space). If there is
16768 insufficient space available then either the function
16769 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
16770 called, depending upon the amount of stack space required. The runtime
16771 system is required to provide these functions. The default is
16772 @option{-mno-apcs-stack-check}, since this produces smaller code.
16773
16774 @c not currently implemented
16775 @item -mapcs-reentrant
16776 @opindex mapcs-reentrant
16777 Generate reentrant, position-independent code. The default is
16778 @option{-mno-apcs-reentrant}.
16779 @end ignore
16780
16781 @item -mthumb-interwork
16782 @opindex mthumb-interwork
16783 Generate code that supports calling between the ARM and Thumb
16784 instruction sets. Without this option, on pre-v5 architectures, the
16785 two instruction sets cannot be reliably used inside one program. The
16786 default is @option{-mno-thumb-interwork}, since slightly larger code
16787 is generated when @option{-mthumb-interwork} is specified. In AAPCS
16788 configurations this option is meaningless.
16789
16790 @item -mno-sched-prolog
16791 @opindex mno-sched-prolog
16792 @opindex msched-prolog
16793 Prevent the reordering of instructions in the function prologue, or the
16794 merging of those instruction with the instructions in the function's
16795 body. This means that all functions start with a recognizable set
16796 of instructions (or in fact one of a choice from a small set of
16797 different function prologues), and this information can be used to
16798 locate the start of functions inside an executable piece of code. The
16799 default is @option{-msched-prolog}.
16800
16801 @item -mfloat-abi=@var{name}
16802 @opindex mfloat-abi
16803 Specifies which floating-point ABI to use. Permissible values
16804 are: @samp{soft}, @samp{softfp} and @samp{hard}.
16805
16806 Specifying @samp{soft} causes GCC to generate output containing
16807 library calls for floating-point operations.
16808 @samp{softfp} allows the generation of code using hardware floating-point
16809 instructions, but still uses the soft-float calling conventions.
16810 @samp{hard} allows generation of floating-point instructions
16811 and uses FPU-specific calling conventions.
16812
16813 The default depends on the specific target configuration. Note that
16814 the hard-float and soft-float ABIs are not link-compatible; you must
16815 compile your entire program with the same ABI, and link with a
16816 compatible set of libraries.
16817
16818 @item -mlittle-endian
16819 @opindex mlittle-endian
16820 Generate code for a processor running in little-endian mode. This is
16821 the default for all standard configurations.
16822
16823 @item -mbig-endian
16824 @opindex mbig-endian
16825 Generate code for a processor running in big-endian mode; the default is
16826 to compile code for a little-endian processor.
16827
16828 @item -mbe8
16829 @itemx -mbe32
16830 @opindex mbe8
16831 When linking a big-endian image select between BE8 and BE32 formats.
16832 The option has no effect for little-endian images and is ignored. The
16833 default is dependent on the selected target architecture. For ARMv6
16834 and later architectures the default is BE8, for older architectures
16835 the default is BE32. BE32 format has been deprecated by ARM.
16836
16837 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
16838 @opindex march
16839 This specifies the name of the target ARM architecture. GCC uses this
16840 name to determine what kind of instructions it can emit when generating
16841 assembly code. This option can be used in conjunction with or instead
16842 of the @option{-mcpu=} option.
16843
16844 Permissible names are:
16845 @samp{armv4t},
16846 @samp{armv5t}, @samp{armv5te},
16847 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
16848 @samp{armv6z}, @samp{armv6zk},
16849 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
16850 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
16851 @samp{armv8.4-a},
16852 @samp{armv8.5-a},
16853 @samp{armv7-r},
16854 @samp{armv8-r},
16855 @samp{armv6-m}, @samp{armv6s-m},
16856 @samp{armv7-m}, @samp{armv7e-m},
16857 @samp{armv8-m.base}, @samp{armv8-m.main},
16858 @samp{iwmmxt} and @samp{iwmmxt2}.
16859
16860 Additionally, the following architectures, which lack support for the
16861 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
16862
16863 Many of the architectures support extensions. These can be added by
16864 appending @samp{+@var{extension}} to the architecture name. Extension
16865 options are processed in order and capabilities accumulate. An extension
16866 will also enable any necessary base extensions
16867 upon which it depends. For example, the @samp{+crypto} extension
16868 will always enable the @samp{+simd} extension. The exception to the
16869 additive construction is for extensions that are prefixed with
16870 @samp{+no@dots{}}: these extensions disable the specified option and
16871 any other extensions that may depend on the presence of that
16872 extension.
16873
16874 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
16875 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
16876 entirely disabled by the @samp{+nofp} option that follows it.
16877
16878 Most extension names are generically named, but have an effect that is
16879 dependent upon the architecture to which it is applied. For example,
16880 the @samp{+simd} option can be applied to both @samp{armv7-a} and
16881 @samp{armv8-a} architectures, but will enable the original ARMv7-A
16882 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
16883 variant for @samp{armv8-a}.
16884
16885 The table below lists the supported extensions for each architecture.
16886 Architectures not mentioned do not support any extensions.
16887
16888 @table @samp
16889 @item armv5te
16890 @itemx armv6
16891 @itemx armv6j
16892 @itemx armv6k
16893 @itemx armv6kz
16894 @itemx armv6t2
16895 @itemx armv6z
16896 @itemx armv6zk
16897 @table @samp
16898 @item +fp
16899 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
16900 used as an alias for this extension.
16901
16902 @item +nofp
16903 Disable the floating-point instructions.
16904 @end table
16905
16906 @item armv7
16907 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
16908 @table @samp
16909 @item +fp
16910 The VFPv3 floating-point instructions, with 16 double-precision
16911 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16912 for this extension. Note that floating-point is not supported by the
16913 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
16914 ARMv7-R architectures.
16915
16916 @item +nofp
16917 Disable the floating-point instructions.
16918 @end table
16919
16920 @item armv7-a
16921 @table @samp
16922 @item +fp
16923 The VFPv3 floating-point instructions, with 16 double-precision
16924 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16925 for this extension.
16926
16927 @item +simd
16928 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16929 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
16930 for this extension.
16931
16932 @item +vfpv3
16933 The VFPv3 floating-point instructions, with 32 double-precision
16934 registers.
16935
16936 @item +vfpv3-d16-fp16
16937 The VFPv3 floating-point instructions, with 16 double-precision
16938 registers and the half-precision floating-point conversion operations.
16939
16940 @item +vfpv3-fp16
16941 The VFPv3 floating-point instructions, with 32 double-precision
16942 registers and the half-precision floating-point conversion operations.
16943
16944 @item +vfpv4-d16
16945 The VFPv4 floating-point instructions, with 16 double-precision
16946 registers.
16947
16948 @item +vfpv4
16949 The VFPv4 floating-point instructions, with 32 double-precision
16950 registers.
16951
16952 @item +neon-fp16
16953 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16954 the half-precision floating-point conversion operations.
16955
16956 @item +neon-vfpv4
16957 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
16958
16959 @item +nosimd
16960 Disable the Advanced SIMD instructions (does not disable floating point).
16961
16962 @item +nofp
16963 Disable the floating-point and Advanced SIMD instructions.
16964 @end table
16965
16966 @item armv7ve
16967 The extended version of the ARMv7-A architecture with support for
16968 virtualization.
16969 @table @samp
16970 @item +fp
16971 The VFPv4 floating-point instructions, with 16 double-precision registers.
16972 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
16973
16974 @item +simd
16975 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
16976 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
16977
16978 @item +vfpv3-d16
16979 The VFPv3 floating-point instructions, with 16 double-precision
16980 registers.
16981
16982 @item +vfpv3
16983 The VFPv3 floating-point instructions, with 32 double-precision
16984 registers.
16985
16986 @item +vfpv3-d16-fp16
16987 The VFPv3 floating-point instructions, with 16 double-precision
16988 registers and the half-precision floating-point conversion operations.
16989
16990 @item +vfpv3-fp16
16991 The VFPv3 floating-point instructions, with 32 double-precision
16992 registers and the half-precision floating-point conversion operations.
16993
16994 @item +vfpv4-d16
16995 The VFPv4 floating-point instructions, with 16 double-precision
16996 registers.
16997
16998 @item +vfpv4
16999 The VFPv4 floating-point instructions, with 32 double-precision
17000 registers.
17001
17002 @item +neon
17003 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17004 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17005
17006 @item +neon-fp16
17007 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17008 the half-precision floating-point conversion operations.
17009
17010 @item +nosimd
17011 Disable the Advanced SIMD instructions (does not disable floating point).
17012
17013 @item +nofp
17014 Disable the floating-point and Advanced SIMD instructions.
17015 @end table
17016
17017 @item armv8-a
17018 @table @samp
17019 @item +crc
17020 The Cyclic Redundancy Check (CRC) instructions.
17021 @item +simd
17022 The ARMv8-A Advanced SIMD and floating-point instructions.
17023 @item +crypto
17024 The cryptographic instructions.
17025 @item +nocrypto
17026 Disable the cryptographic instructions.
17027 @item +nofp
17028 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17029 @item +sb
17030 Speculation Barrier Instruction.
17031 @item +predres
17032 Execution and Data Prediction Restriction Instructions.
17033 @end table
17034
17035 @item armv8.1-a
17036 @table @samp
17037 @item +simd
17038 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17039
17040 @item +crypto
17041 The cryptographic instructions. This also enables the Advanced SIMD and
17042 floating-point instructions.
17043
17044 @item +nocrypto
17045 Disable the cryptographic instructions.
17046
17047 @item +nofp
17048 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17049
17050 @item +sb
17051 Speculation Barrier Instruction.
17052
17053 @item +predres
17054 Execution and Data Prediction Restriction Instructions.
17055 @end table
17056
17057 @item armv8.2-a
17058 @itemx armv8.3-a
17059 @table @samp
17060 @item +fp16
17061 The half-precision floating-point data processing instructions.
17062 This also enables the Advanced SIMD and floating-point instructions.
17063
17064 @item +fp16fml
17065 The half-precision floating-point fmla extension. This also enables
17066 the half-precision floating-point extension and Advanced SIMD and
17067 floating-point instructions.
17068
17069 @item +simd
17070 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17071
17072 @item +crypto
17073 The cryptographic instructions. This also enables the Advanced SIMD and
17074 floating-point instructions.
17075
17076 @item +dotprod
17077 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17078
17079 @item +nocrypto
17080 Disable the cryptographic extension.
17081
17082 @item +nofp
17083 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17084
17085 @item +sb
17086 Speculation Barrier Instruction.
17087
17088 @item +predres
17089 Execution and Data Prediction Restriction Instructions.
17090 @end table
17091
17092 @item armv8.4-a
17093 @table @samp
17094 @item +fp16
17095 The half-precision floating-point data processing instructions.
17096 This also enables the Advanced SIMD and floating-point instructions as well
17097 as the Dot Product extension and the half-precision floating-point fmla
17098 extension.
17099
17100 @item +simd
17101 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17102 Dot Product extension.
17103
17104 @item +crypto
17105 The cryptographic instructions. This also enables the Advanced SIMD and
17106 floating-point instructions as well as the Dot Product extension.
17107
17108 @item +nocrypto
17109 Disable the cryptographic extension.
17110
17111 @item +nofp
17112 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17113
17114 @item +sb
17115 Speculation Barrier Instruction.
17116
17117 @item +predres
17118 Execution and Data Prediction Restriction Instructions.
17119 @end table
17120
17121 @item armv8.5-a
17122 @table @samp
17123 @item +fp16
17124 The half-precision floating-point data processing instructions.
17125 This also enables the Advanced SIMD and floating-point instructions as well
17126 as the Dot Product extension and the half-precision floating-point fmla
17127 extension.
17128
17129 @item +simd
17130 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17131 Dot Product extension.
17132
17133 @item +crypto
17134 The cryptographic instructions. This also enables the Advanced SIMD and
17135 floating-point instructions as well as the Dot Product extension.
17136
17137 @item +nocrypto
17138 Disable the cryptographic extension.
17139
17140 @item +nofp
17141 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17142 @end table
17143
17144 @item armv7-r
17145 @table @samp
17146 @item +fp.sp
17147 The single-precision VFPv3 floating-point instructions. The extension
17148 @samp{+vfpv3xd} can be used as an alias for this extension.
17149
17150 @item +fp
17151 The VFPv3 floating-point instructions with 16 double-precision registers.
17152 The extension +vfpv3-d16 can be used as an alias for this extension.
17153
17154 @item +vfpv3xd-d16-fp16
17155 The single-precision VFPv3 floating-point instructions with 16 double-precision
17156 registers and the half-precision floating-point conversion operations.
17157
17158 @item +vfpv3-d16-fp16
17159 The VFPv3 floating-point instructions with 16 double-precision
17160 registers and the half-precision floating-point conversion operations.
17161
17162 @item +nofp
17163 Disable the floating-point extension.
17164
17165 @item +idiv
17166 The ARM-state integer division instructions.
17167
17168 @item +noidiv
17169 Disable the ARM-state integer division extension.
17170 @end table
17171
17172 @item armv7e-m
17173 @table @samp
17174 @item +fp
17175 The single-precision VFPv4 floating-point instructions.
17176
17177 @item +fpv5
17178 The single-precision FPv5 floating-point instructions.
17179
17180 @item +fp.dp
17181 The single- and double-precision FPv5 floating-point instructions.
17182
17183 @item +nofp
17184 Disable the floating-point extensions.
17185 @end table
17186
17187 @item armv8-m.main
17188 @table @samp
17189 @item +dsp
17190 The DSP instructions.
17191
17192 @item +nodsp
17193 Disable the DSP extension.
17194
17195 @item +fp
17196 The single-precision floating-point instructions.
17197
17198 @item +fp.dp
17199 The single- and double-precision floating-point instructions.
17200
17201 @item +nofp
17202 Disable the floating-point extension.
17203 @end table
17204
17205 @item armv8-r
17206 @table @samp
17207 @item +crc
17208 The Cyclic Redundancy Check (CRC) instructions.
17209 @item +fp.sp
17210 The single-precision FPv5 floating-point instructions.
17211 @item +simd
17212 The ARMv8-A Advanced SIMD and floating-point instructions.
17213 @item +crypto
17214 The cryptographic instructions.
17215 @item +nocrypto
17216 Disable the cryptographic instructions.
17217 @item +nofp
17218 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17219 @end table
17220
17221 @end table
17222
17223 @option{-march=native} causes the compiler to auto-detect the architecture
17224 of the build computer. At present, this feature is only supported on
17225 GNU/Linux, and not all architectures are recognized. If the auto-detect
17226 is unsuccessful the option has no effect.
17227
17228 @item -mtune=@var{name}
17229 @opindex mtune
17230 This option specifies the name of the target ARM processor for
17231 which GCC should tune the performance of the code.
17232 For some ARM implementations better performance can be obtained by using
17233 this option.
17234 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17235 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17236 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17237 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17238 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17239 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17240 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17241 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17242 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17243 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17244 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17245 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17246 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17247 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17248 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17249 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17250 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17251 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17252 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17253 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526},
17254 @samp{fa626}, @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
17255 @samp{xgene1}.
17256
17257 Additionally, this option can specify that GCC should tune the performance
17258 of the code for a big.LITTLE system. Permissible names are:
17259 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17260 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17261 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17262 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17263
17264 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17265 performance for a blend of processors within architecture @var{arch}.
17266 The aim is to generate code that run well on the current most popular
17267 processors, balancing between optimizations that benefit some CPUs in the
17268 range, and avoiding performance pitfalls of other CPUs. The effects of
17269 this option may change in future GCC versions as CPU models come and go.
17270
17271 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17272 the extension options do not affect the tuning of the generated code.
17273
17274 @option{-mtune=native} causes the compiler to auto-detect the CPU
17275 of the build computer. At present, this feature is only supported on
17276 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17277 unsuccessful the option has no effect.
17278
17279 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17280 @opindex mcpu
17281 This specifies the name of the target ARM processor. GCC uses this name
17282 to derive the name of the target ARM architecture (as if specified
17283 by @option{-march}) and the ARM processor type for which to tune for
17284 performance (as if specified by @option{-mtune}). Where this option
17285 is used in conjunction with @option{-march} or @option{-mtune},
17286 those options take precedence over the appropriate part of this option.
17287
17288 Many of the supported CPUs implement optional architectural
17289 extensions. Where this is so the architectural extensions are
17290 normally enabled by default. If implementations that lack the
17291 extension exist, then the extension syntax can be used to disable
17292 those extensions that have been omitted. For floating-point and
17293 Advanced SIMD (Neon) instructions, the settings of the options
17294 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17295 floating-point and Advanced SIMD instructions will only be used if
17296 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17297 @option{-mfpu} other than @samp{auto} will override the available
17298 floating-point and SIMD extension instructions.
17299
17300 For example, @samp{cortex-a9} can be found in three major
17301 configurations: integer only, with just a floating-point unit or with
17302 floating-point and Advanced SIMD. The default is to enable all the
17303 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17304 be used to disable just the SIMD or both the SIMD and floating-point
17305 instructions respectively.
17306
17307 Permissible names for this option are the same as those for
17308 @option{-mtune}.
17309
17310 The following extension options are common to the listed CPUs:
17311
17312 @table @samp
17313 @item +nodsp
17314 Disable the DSP instructions on @samp{cortex-m33}.
17315
17316 @item +nofp
17317 Disables the floating-point instructions on @samp{arm9e},
17318 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17319 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17320 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17321 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17322 Disables the floating-point and SIMD instructions on
17323 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17324 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17325 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17326 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17327 @samp{cortex-a53} and @samp{cortex-a55}.
17328
17329 @item +nofp.dp
17330 Disables the double-precision component of the floating-point instructions
17331 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17332 @samp{cortex-m7}.
17333
17334 @item +nosimd
17335 Disables the SIMD (but not floating-point) instructions on
17336 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17337 and @samp{cortex-a9}.
17338
17339 @item +crypto
17340 Enables the cryptographic instructions on @samp{cortex-a32},
17341 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17342 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17343 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17344 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17345 @samp{cortex-a75.cortex-a55}.
17346 @end table
17347
17348 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17349 VFPv3 with 16 double-precision registers. It supports the following
17350 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
17351 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
17352 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
17353 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
17354 @option{-march=armv7-a}.
17355
17356 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17357 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17358 See @option{-mtune} for more information.
17359
17360 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17361 of the build computer. At present, this feature is only supported on
17362 GNU/Linux, and not all architectures are recognized. If the auto-detect
17363 is unsuccessful the option has no effect.
17364
17365 @item -mfpu=@var{name}
17366 @opindex mfpu
17367 This specifies what floating-point hardware (or hardware emulation) is
17368 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17369 @samp{vfpv3},
17370 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17371 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17372 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17373 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17374 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17375 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17376 is an alias for @samp{vfpv2}.
17377
17378 The setting @samp{auto} is the default and is special. It causes the
17379 compiler to select the floating-point and Advanced SIMD instructions
17380 based on the settings of @option{-mcpu} and @option{-march}.
17381
17382 If the selected floating-point hardware includes the NEON extension
17383 (e.g.@: @option{-mfpu=neon}), note that floating-point
17384 operations are not generated by GCC's auto-vectorization pass unless
17385 @option{-funsafe-math-optimizations} is also specified. This is
17386 because NEON hardware does not fully implement the IEEE 754 standard for
17387 floating-point arithmetic (in particular denormal values are treated as
17388 zero), so the use of NEON instructions may lead to a loss of precision.
17389
17390 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}).
17391
17392 @item -mfp16-format=@var{name}
17393 @opindex mfp16-format
17394 Specify the format of the @code{__fp16} half-precision floating-point type.
17395 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17396 the default is @samp{none}, in which case the @code{__fp16} type is not
17397 defined. @xref{Half-Precision}, for more information.
17398
17399 @item -mstructure-size-boundary=@var{n}
17400 @opindex mstructure-size-boundary
17401 The sizes of all structures and unions are rounded up to a multiple
17402 of the number of bits set by this option. Permissible values are 8, 32
17403 and 64. The default value varies for different toolchains. For the COFF
17404 targeted toolchain the default value is 8. A value of 64 is only allowed
17405 if the underlying ABI supports it.
17406
17407 Specifying a larger number can produce faster, more efficient code, but
17408 can also increase the size of the program. Different values are potentially
17409 incompatible. Code compiled with one value cannot necessarily expect to
17410 work with code or libraries compiled with another value, if they exchange
17411 information using structures or unions.
17412
17413 This option is deprecated.
17414
17415 @item -mabort-on-noreturn
17416 @opindex mabort-on-noreturn
17417 Generate a call to the function @code{abort} at the end of a
17418 @code{noreturn} function. It is executed if the function tries to
17419 return.
17420
17421 @item -mlong-calls
17422 @itemx -mno-long-calls
17423 @opindex mlong-calls
17424 @opindex mno-long-calls
17425 Tells the compiler to perform function calls by first loading the
17426 address of the function into a register and then performing a subroutine
17427 call on this register. This switch is needed if the target function
17428 lies outside of the 64-megabyte addressing range of the offset-based
17429 version of subroutine call instruction.
17430
17431 Even if this switch is enabled, not all function calls are turned
17432 into long calls. The heuristic is that static functions, functions
17433 that have the @code{short_call} attribute, functions that are inside
17434 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17435 definitions have already been compiled within the current compilation
17436 unit are not turned into long calls. The exceptions to this rule are
17437 that weak function definitions, functions with the @code{long_call}
17438 attribute or the @code{section} attribute, and functions that are within
17439 the scope of a @code{#pragma long_calls} directive are always
17440 turned into long calls.
17441
17442 This feature is not enabled by default. Specifying
17443 @option{-mno-long-calls} restores the default behavior, as does
17444 placing the function calls within the scope of a @code{#pragma
17445 long_calls_off} directive. Note these switches have no effect on how
17446 the compiler generates code to handle function calls via function
17447 pointers.
17448
17449 @item -msingle-pic-base
17450 @opindex msingle-pic-base
17451 Treat the register used for PIC addressing as read-only, rather than
17452 loading it in the prologue for each function. The runtime system is
17453 responsible for initializing this register with an appropriate value
17454 before execution begins.
17455
17456 @item -mpic-register=@var{reg}
17457 @opindex mpic-register
17458 Specify the register to be used for PIC addressing.
17459 For standard PIC base case, the default is any suitable register
17460 determined by compiler. For single PIC base case, the default is
17461 @samp{R9} if target is EABI based or stack-checking is enabled,
17462 otherwise the default is @samp{R10}.
17463
17464 @item -mpic-data-is-text-relative
17465 @opindex mpic-data-is-text-relative
17466 Assume that the displacement between the text and data segments is fixed
17467 at static link time. This permits using PC-relative addressing
17468 operations to access data known to be in the data segment. For
17469 non-VxWorks RTP targets, this option is enabled by default. When
17470 disabled on such targets, it will enable @option{-msingle-pic-base} by
17471 default.
17472
17473 @item -mpoke-function-name
17474 @opindex mpoke-function-name
17475 Write the name of each function into the text section, directly
17476 preceding the function prologue. The generated code is similar to this:
17477
17478 @smallexample
17479 t0
17480 .ascii "arm_poke_function_name", 0
17481 .align
17482 t1
17483 .word 0xff000000 + (t1 - t0)
17484 arm_poke_function_name
17485 mov ip, sp
17486 stmfd sp!, @{fp, ip, lr, pc@}
17487 sub fp, ip, #4
17488 @end smallexample
17489
17490 When performing a stack backtrace, code can inspect the value of
17491 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17492 location @code{pc - 12} and the top 8 bits are set, then we know that
17493 there is a function name embedded immediately preceding this location
17494 and has length @code{((pc[-3]) & 0xff000000)}.
17495
17496 @item -mthumb
17497 @itemx -marm
17498 @opindex marm
17499 @opindex mthumb
17500
17501 Select between generating code that executes in ARM and Thumb
17502 states. The default for most configurations is to generate code
17503 that executes in ARM state, but the default can be changed by
17504 configuring GCC with the @option{--with-mode=}@var{state}
17505 configure option.
17506
17507 You can also override the ARM and Thumb mode for each function
17508 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17509 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17510
17511 @item -mflip-thumb
17512 @opindex mflip-thumb
17513 Switch ARM/Thumb modes on alternating functions.
17514 This option is provided for regression testing of mixed Thumb/ARM code
17515 generation, and is not intended for ordinary use in compiling code.
17516
17517 @item -mtpcs-frame
17518 @opindex mtpcs-frame
17519 Generate a stack frame that is compliant with the Thumb Procedure Call
17520 Standard for all non-leaf functions. (A leaf function is one that does
17521 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17522
17523 @item -mtpcs-leaf-frame
17524 @opindex mtpcs-leaf-frame
17525 Generate a stack frame that is compliant with the Thumb Procedure Call
17526 Standard for all leaf functions. (A leaf function is one that does
17527 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17528
17529 @item -mcallee-super-interworking
17530 @opindex mcallee-super-interworking
17531 Gives all externally visible functions in the file being compiled an ARM
17532 instruction set header which switches to Thumb mode before executing the
17533 rest of the function. This allows these functions to be called from
17534 non-interworking code. This option is not valid in AAPCS configurations
17535 because interworking is enabled by default.
17536
17537 @item -mcaller-super-interworking
17538 @opindex mcaller-super-interworking
17539 Allows calls via function pointers (including virtual functions) to
17540 execute correctly regardless of whether the target code has been
17541 compiled for interworking or not. There is a small overhead in the cost
17542 of executing a function pointer if this option is enabled. This option
17543 is not valid in AAPCS configurations because interworking is enabled
17544 by default.
17545
17546 @item -mtp=@var{name}
17547 @opindex mtp
17548 Specify the access model for the thread local storage pointer. The valid
17549 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17550 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17551 (supported in the arm6k architecture), and @samp{auto}, which uses the
17552 best available method for the selected processor. The default setting is
17553 @samp{auto}.
17554
17555 @item -mtls-dialect=@var{dialect}
17556 @opindex mtls-dialect
17557 Specify the dialect to use for accessing thread local storage. Two
17558 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17559 @samp{gnu} dialect selects the original GNU scheme for supporting
17560 local and global dynamic TLS models. The @samp{gnu2} dialect
17561 selects the GNU descriptor scheme, which provides better performance
17562 for shared libraries. The GNU descriptor scheme is compatible with
17563 the original scheme, but does require new assembler, linker and
17564 library support. Initial and local exec TLS models are unaffected by
17565 this option and always use the original scheme.
17566
17567 @item -mword-relocations
17568 @opindex mword-relocations
17569 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17570 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17571 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17572 is specified. This option conflicts with @option{-mslow-flash-data}.
17573
17574 @item -mfix-cortex-m3-ldrd
17575 @opindex mfix-cortex-m3-ldrd
17576 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17577 with overlapping destination and base registers are used. This option avoids
17578 generating these instructions. This option is enabled by default when
17579 @option{-mcpu=cortex-m3} is specified.
17580
17581 @item -munaligned-access
17582 @itemx -mno-unaligned-access
17583 @opindex munaligned-access
17584 @opindex mno-unaligned-access
17585 Enables (or disables) reading and writing of 16- and 32- bit values
17586 from addresses that are not 16- or 32- bit aligned. By default
17587 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17588 ARMv8-M Baseline architectures, and enabled for all other
17589 architectures. If unaligned access is not enabled then words in packed
17590 data structures are accessed a byte at a time.
17591
17592 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17593 generated object file to either true or false, depending upon the
17594 setting of this option. If unaligned access is enabled then the
17595 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17596 defined.
17597
17598 @item -mneon-for-64bits
17599 @opindex mneon-for-64bits
17600 Enables using Neon to handle scalar 64-bits operations. This is
17601 disabled by default since the cost of moving data from core registers
17602 to Neon is high.
17603
17604 @item -mslow-flash-data
17605 @opindex mslow-flash-data
17606 Assume loading data from flash is slower than fetching instruction.
17607 Therefore literal load is minimized for better performance.
17608 This option is only supported when compiling for ARMv7 M-profile and
17609 off by default. It conflicts with @option{-mword-relocations}.
17610
17611 @item -masm-syntax-unified
17612 @opindex masm-syntax-unified
17613 Assume inline assembler is using unified asm syntax. The default is
17614 currently off which implies divided syntax. This option has no impact
17615 on Thumb2. However, this may change in future releases of GCC.
17616 Divided syntax should be considered deprecated.
17617
17618 @item -mrestrict-it
17619 @opindex mrestrict-it
17620 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17621 IT blocks can only contain a single 16-bit instruction from a select
17622 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17623
17624 @item -mprint-tune-info
17625 @opindex mprint-tune-info
17626 Print CPU tuning information as comment in assembler file. This is
17627 an option used only for regression testing of the compiler and not
17628 intended for ordinary use in compiling code. This option is disabled
17629 by default.
17630
17631 @item -mverbose-cost-dump
17632 @opindex mverbose-cost-dump
17633 Enable verbose cost model dumping in the debug dump files. This option is
17634 provided for use in debugging the compiler.
17635
17636 @item -mpure-code
17637 @opindex mpure-code
17638 Do not allow constant data to be placed in code sections.
17639 Additionally, when compiling for ELF object format give all text sections the
17640 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
17641 is only available when generating non-pic code for M-profile targets with the
17642 MOVT instruction.
17643
17644 @item -mcmse
17645 @opindex mcmse
17646 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
17647 Development Tools Engineering Specification", which can be found on
17648 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
17649 @end table
17650
17651 @node AVR Options
17652 @subsection AVR Options
17653 @cindex AVR Options
17654
17655 These options are defined for AVR implementations:
17656
17657 @table @gcctabopt
17658 @item -mmcu=@var{mcu}
17659 @opindex mmcu
17660 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17661
17662 The default for this option is@tie{}@samp{avr2}.
17663
17664 GCC supports the following AVR devices and ISAs:
17665
17666 @include avr-mmcu.texi
17667
17668 @item -mabsdata
17669 @opindex mabsdata
17670
17671 Assume that all data in static storage can be accessed by LDS / STS
17672 instructions. This option has only an effect on reduced Tiny devices like
17673 ATtiny40. See also the @code{absdata}
17674 @ref{AVR Variable Attributes,variable attribute}.
17675
17676 @item -maccumulate-args
17677 @opindex maccumulate-args
17678 Accumulate outgoing function arguments and acquire/release the needed
17679 stack space for outgoing function arguments once in function
17680 prologue/epilogue. Without this option, outgoing arguments are pushed
17681 before calling a function and popped afterwards.
17682
17683 Popping the arguments after the function call can be expensive on
17684 AVR so that accumulating the stack space might lead to smaller
17685 executables because arguments need not be removed from the
17686 stack after such a function call.
17687
17688 This option can lead to reduced code size for functions that perform
17689 several calls to functions that get their arguments on the stack like
17690 calls to printf-like functions.
17691
17692 @item -mbranch-cost=@var{cost}
17693 @opindex mbranch-cost
17694 Set the branch costs for conditional branch instructions to
17695 @var{cost}. Reasonable values for @var{cost} are small, non-negative
17696 integers. The default branch cost is 0.
17697
17698 @item -mcall-prologues
17699 @opindex mcall-prologues
17700 Functions prologues/epilogues are expanded as calls to appropriate
17701 subroutines. Code size is smaller.
17702
17703 @item -mgas-isr-prologues
17704 @opindex mgas-isr-prologues
17705 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
17706 instruction supported by GNU Binutils.
17707 If this option is on, the feature can still be disabled for individual
17708 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
17709 function attribute. This feature is activated per default
17710 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
17711 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
17712
17713 @item -mint8
17714 @opindex mint8
17715 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
17716 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
17717 and @code{long long} is 4 bytes. Please note that this option does not
17718 conform to the C standards, but it results in smaller code
17719 size.
17720
17721 @item -mmain-is-OS_task
17722 @opindex mmain-is-OS_task
17723 Do not save registers in @code{main}. The effect is the same like
17724 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
17725 to @code{main}. It is activated per default if optimization is on.
17726
17727 @item -mn-flash=@var{num}
17728 @opindex mn-flash
17729 Assume that the flash memory has a size of
17730 @var{num} times 64@tie{}KiB.
17731
17732 @item -mno-interrupts
17733 @opindex mno-interrupts
17734 Generated code is not compatible with hardware interrupts.
17735 Code size is smaller.
17736
17737 @item -mrelax
17738 @opindex mrelax
17739 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
17740 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
17741 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
17742 the assembler's command line and the @option{--relax} option to the
17743 linker's command line.
17744
17745 Jump relaxing is performed by the linker because jump offsets are not
17746 known before code is located. Therefore, the assembler code generated by the
17747 compiler is the same, but the instructions in the executable may
17748 differ from instructions in the assembler code.
17749
17750 Relaxing must be turned on if linker stubs are needed, see the
17751 section on @code{EIND} and linker stubs below.
17752
17753 @item -mrmw
17754 @opindex mrmw
17755 Assume that the device supports the Read-Modify-Write
17756 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
17757
17758 @item -mshort-calls
17759 @opindex mshort-calls
17760
17761 Assume that @code{RJMP} and @code{RCALL} can target the whole
17762 program memory.
17763
17764 This option is used internally for multilib selection. It is
17765 not an optimization option, and you don't need to set it by hand.
17766
17767 @item -msp8
17768 @opindex msp8
17769 Treat the stack pointer register as an 8-bit register,
17770 i.e.@: assume the high byte of the stack pointer is zero.
17771 In general, you don't need to set this option by hand.
17772
17773 This option is used internally by the compiler to select and
17774 build multilibs for architectures @code{avr2} and @code{avr25}.
17775 These architectures mix devices with and without @code{SPH}.
17776 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
17777 the compiler driver adds or removes this option from the compiler
17778 proper's command line, because the compiler then knows if the device
17779 or architecture has an 8-bit stack pointer and thus no @code{SPH}
17780 register or not.
17781
17782 @item -mstrict-X
17783 @opindex mstrict-X
17784 Use address register @code{X} in a way proposed by the hardware. This means
17785 that @code{X} is only used in indirect, post-increment or
17786 pre-decrement addressing.
17787
17788 Without this option, the @code{X} register may be used in the same way
17789 as @code{Y} or @code{Z} which then is emulated by additional
17790 instructions.
17791 For example, loading a value with @code{X+const} addressing with a
17792 small non-negative @code{const < 64} to a register @var{Rn} is
17793 performed as
17794
17795 @example
17796 adiw r26, const ; X += const
17797 ld @var{Rn}, X ; @var{Rn} = *X
17798 sbiw r26, const ; X -= const
17799 @end example
17800
17801 @item -mtiny-stack
17802 @opindex mtiny-stack
17803 Only change the lower 8@tie{}bits of the stack pointer.
17804
17805 @item -mfract-convert-truncate
17806 @opindex mfract-convert-truncate
17807 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
17808
17809 @item -nodevicelib
17810 @opindex nodevicelib
17811 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
17812
17813 @item -Waddr-space-convert
17814 @opindex Waddr-space-convert
17815 @opindex Wno-addr-space-convert
17816 Warn about conversions between address spaces in the case where the
17817 resulting address space is not contained in the incoming address space.
17818
17819 @item -Wmisspelled-isr
17820 @opindex Wmisspelled-isr
17821 @opindex Wno-misspelled-isr
17822 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
17823 Enabled by default.
17824 @end table
17825
17826 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
17827 @cindex @code{EIND}
17828 Pointers in the implementation are 16@tie{}bits wide.
17829 The address of a function or label is represented as word address so
17830 that indirect jumps and calls can target any code address in the
17831 range of 64@tie{}Ki words.
17832
17833 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
17834 bytes of program memory space, there is a special function register called
17835 @code{EIND} that serves as most significant part of the target address
17836 when @code{EICALL} or @code{EIJMP} instructions are used.
17837
17838 Indirect jumps and calls on these devices are handled as follows by
17839 the compiler and are subject to some limitations:
17840
17841 @itemize @bullet
17842
17843 @item
17844 The compiler never sets @code{EIND}.
17845
17846 @item
17847 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
17848 instructions or might read @code{EIND} directly in order to emulate an
17849 indirect call/jump by means of a @code{RET} instruction.
17850
17851 @item
17852 The compiler assumes that @code{EIND} never changes during the startup
17853 code or during the application. In particular, @code{EIND} is not
17854 saved/restored in function or interrupt service routine
17855 prologue/epilogue.
17856
17857 @item
17858 For indirect calls to functions and computed goto, the linker
17859 generates @emph{stubs}. Stubs are jump pads sometimes also called
17860 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
17861 The stub contains a direct jump to the desired address.
17862
17863 @item
17864 Linker relaxation must be turned on so that the linker generates
17865 the stubs correctly in all situations. See the compiler option
17866 @option{-mrelax} and the linker option @option{--relax}.
17867 There are corner cases where the linker is supposed to generate stubs
17868 but aborts without relaxation and without a helpful error message.
17869
17870 @item
17871 The default linker script is arranged for code with @code{EIND = 0}.
17872 If code is supposed to work for a setup with @code{EIND != 0}, a custom
17873 linker script has to be used in order to place the sections whose
17874 name start with @code{.trampolines} into the segment where @code{EIND}
17875 points to.
17876
17877 @item
17878 The startup code from libgcc never sets @code{EIND}.
17879 Notice that startup code is a blend of code from libgcc and AVR-LibC.
17880 For the impact of AVR-LibC on @code{EIND}, see the
17881 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
17882
17883 @item
17884 It is legitimate for user-specific startup code to set up @code{EIND}
17885 early, for example by means of initialization code located in
17886 section @code{.init3}. Such code runs prior to general startup code
17887 that initializes RAM and calls constructors, but after the bit
17888 of startup code from AVR-LibC that sets @code{EIND} to the segment
17889 where the vector table is located.
17890 @example
17891 #include <avr/io.h>
17892
17893 static void
17894 __attribute__((section(".init3"),naked,used,no_instrument_function))
17895 init3_set_eind (void)
17896 @{
17897 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
17898 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
17899 @}
17900 @end example
17901
17902 @noindent
17903 The @code{__trampolines_start} symbol is defined in the linker script.
17904
17905 @item
17906 Stubs are generated automatically by the linker if
17907 the following two conditions are met:
17908 @itemize @minus
17909
17910 @item The address of a label is taken by means of the @code{gs} modifier
17911 (short for @emph{generate stubs}) like so:
17912 @example
17913 LDI r24, lo8(gs(@var{func}))
17914 LDI r25, hi8(gs(@var{func}))
17915 @end example
17916 @item The final location of that label is in a code segment
17917 @emph{outside} the segment where the stubs are located.
17918 @end itemize
17919
17920 @item
17921 The compiler emits such @code{gs} modifiers for code labels in the
17922 following situations:
17923 @itemize @minus
17924 @item Taking address of a function or code label.
17925 @item Computed goto.
17926 @item If prologue-save function is used, see @option{-mcall-prologues}
17927 command-line option.
17928 @item Switch/case dispatch tables. If you do not want such dispatch
17929 tables you can specify the @option{-fno-jump-tables} command-line option.
17930 @item C and C++ constructors/destructors called during startup/shutdown.
17931 @item If the tools hit a @code{gs()} modifier explained above.
17932 @end itemize
17933
17934 @item
17935 Jumping to non-symbolic addresses like so is @emph{not} supported:
17936
17937 @example
17938 int main (void)
17939 @{
17940 /* Call function at word address 0x2 */
17941 return ((int(*)(void)) 0x2)();
17942 @}
17943 @end example
17944
17945 Instead, a stub has to be set up, i.e.@: the function has to be called
17946 through a symbol (@code{func_4} in the example):
17947
17948 @example
17949 int main (void)
17950 @{
17951 extern int func_4 (void);
17952
17953 /* Call function at byte address 0x4 */
17954 return func_4();
17955 @}
17956 @end example
17957
17958 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
17959 Alternatively, @code{func_4} can be defined in the linker script.
17960 @end itemize
17961
17962 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
17963 @cindex @code{RAMPD}
17964 @cindex @code{RAMPX}
17965 @cindex @code{RAMPY}
17966 @cindex @code{RAMPZ}
17967 Some AVR devices support memories larger than the 64@tie{}KiB range
17968 that can be accessed with 16-bit pointers. To access memory locations
17969 outside this 64@tie{}KiB range, the content of a @code{RAMP}
17970 register is used as high part of the address:
17971 The @code{X}, @code{Y}, @code{Z} address register is concatenated
17972 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
17973 register, respectively, to get a wide address. Similarly,
17974 @code{RAMPD} is used together with direct addressing.
17975
17976 @itemize
17977 @item
17978 The startup code initializes the @code{RAMP} special function
17979 registers with zero.
17980
17981 @item
17982 If a @ref{AVR Named Address Spaces,named address space} other than
17983 generic or @code{__flash} is used, then @code{RAMPZ} is set
17984 as needed before the operation.
17985
17986 @item
17987 If the device supports RAM larger than 64@tie{}KiB and the compiler
17988 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
17989 is reset to zero after the operation.
17990
17991 @item
17992 If the device comes with a specific @code{RAMP} register, the ISR
17993 prologue/epilogue saves/restores that SFR and initializes it with
17994 zero in case the ISR code might (implicitly) use it.
17995
17996 @item
17997 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
17998 If you use inline assembler to read from locations outside the
17999 16-bit address range and change one of the @code{RAMP} registers,
18000 you must reset it to zero after the access.
18001
18002 @end itemize
18003
18004 @subsubsection AVR Built-in Macros
18005
18006 GCC defines several built-in macros so that the user code can test
18007 for the presence or absence of features. Almost any of the following
18008 built-in macros are deduced from device capabilities and thus
18009 triggered by the @option{-mmcu=} command-line option.
18010
18011 For even more AVR-specific built-in macros see
18012 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18013
18014 @table @code
18015
18016 @item __AVR_ARCH__
18017 Build-in macro that resolves to a decimal number that identifies the
18018 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18019 Possible values are:
18020
18021 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18022 @code{4}, @code{5}, @code{51}, @code{6}
18023
18024 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18025 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18026
18027 respectively and
18028
18029 @code{100},
18030 @code{102}, @code{103}, @code{104},
18031 @code{105}, @code{106}, @code{107}
18032
18033 for @var{mcu}=@code{avrtiny},
18034 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18035 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18036 If @var{mcu} specifies a device, this built-in macro is set
18037 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18038 defined to @code{4}.
18039
18040 @item __AVR_@var{Device}__
18041 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18042 the device's name. For example, @option{-mmcu=atmega8} defines the
18043 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18044 @code{__AVR_ATtiny261A__}, etc.
18045
18046 The built-in macros' names follow
18047 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18048 the device name as from the AVR user manual. The difference between
18049 @var{Device} in the built-in macro and @var{device} in
18050 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18051
18052 If @var{device} is not a device but only a core architecture like
18053 @samp{avr51}, this macro is not defined.
18054
18055 @item __AVR_DEVICE_NAME__
18056 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18057 the device's name. For example, with @option{-mmcu=atmega8} the macro
18058 is defined to @code{atmega8}.
18059
18060 If @var{device} is not a device but only a core architecture like
18061 @samp{avr51}, this macro is not defined.
18062
18063 @item __AVR_XMEGA__
18064 The device / architecture belongs to the XMEGA family of devices.
18065
18066 @item __AVR_HAVE_ELPM__
18067 The device has the @code{ELPM} instruction.
18068
18069 @item __AVR_HAVE_ELPMX__
18070 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18071 R@var{n},Z+} instructions.
18072
18073 @item __AVR_HAVE_MOVW__
18074 The device has the @code{MOVW} instruction to perform 16-bit
18075 register-register moves.
18076
18077 @item __AVR_HAVE_LPMX__
18078 The device has the @code{LPM R@var{n},Z} and
18079 @code{LPM R@var{n},Z+} instructions.
18080
18081 @item __AVR_HAVE_MUL__
18082 The device has a hardware multiplier.
18083
18084 @item __AVR_HAVE_JMP_CALL__
18085 The device has the @code{JMP} and @code{CALL} instructions.
18086 This is the case for devices with more than 8@tie{}KiB of program
18087 memory.
18088
18089 @item __AVR_HAVE_EIJMP_EICALL__
18090 @itemx __AVR_3_BYTE_PC__
18091 The device has the @code{EIJMP} and @code{EICALL} instructions.
18092 This is the case for devices with more than 128@tie{}KiB of program memory.
18093 This also means that the program counter
18094 (PC) is 3@tie{}bytes wide.
18095
18096 @item __AVR_2_BYTE_PC__
18097 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18098 with up to 128@tie{}KiB of program memory.
18099
18100 @item __AVR_HAVE_8BIT_SP__
18101 @itemx __AVR_HAVE_16BIT_SP__
18102 The stack pointer (SP) register is treated as 8-bit respectively
18103 16-bit register by the compiler.
18104 The definition of these macros is affected by @option{-mtiny-stack}.
18105
18106 @item __AVR_HAVE_SPH__
18107 @itemx __AVR_SP8__
18108 The device has the SPH (high part of stack pointer) special function
18109 register or has an 8-bit stack pointer, respectively.
18110 The definition of these macros is affected by @option{-mmcu=} and
18111 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18112 by @option{-msp8}.
18113
18114 @item __AVR_HAVE_RAMPD__
18115 @itemx __AVR_HAVE_RAMPX__
18116 @itemx __AVR_HAVE_RAMPY__
18117 @itemx __AVR_HAVE_RAMPZ__
18118 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18119 @code{RAMPZ} special function register, respectively.
18120
18121 @item __NO_INTERRUPTS__
18122 This macro reflects the @option{-mno-interrupts} command-line option.
18123
18124 @item __AVR_ERRATA_SKIP__
18125 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18126 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18127 instructions because of a hardware erratum. Skip instructions are
18128 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18129 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18130 set.
18131
18132 @item __AVR_ISA_RMW__
18133 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18134
18135 @item __AVR_SFR_OFFSET__=@var{offset}
18136 Instructions that can address I/O special function registers directly
18137 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18138 address as if addressed by an instruction to access RAM like @code{LD}
18139 or @code{STS}. This offset depends on the device architecture and has
18140 to be subtracted from the RAM address in order to get the
18141 respective I/O@tie{}address.
18142
18143 @item __AVR_SHORT_CALLS__
18144 The @option{-mshort-calls} command line option is set.
18145
18146 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18147 Some devices support reading from flash memory by means of @code{LD*}
18148 instructions. The flash memory is seen in the data address space
18149 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18150 is not defined, this feature is not available. If defined,
18151 the address space is linear and there is no need to put
18152 @code{.rodata} into RAM. This is handled by the default linker
18153 description file, and is currently available for
18154 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18155 there is no need to use address spaces like @code{__flash} or
18156 features like attribute @code{progmem} and @code{pgm_read_*}.
18157
18158 @item __WITH_AVRLIBC__
18159 The compiler is configured to be used together with AVR-Libc.
18160 See the @option{--with-avrlibc} configure option.
18161
18162 @end table
18163
18164 @node Blackfin Options
18165 @subsection Blackfin Options
18166 @cindex Blackfin Options
18167
18168 @table @gcctabopt
18169 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18170 @opindex mcpu=
18171 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18172 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18173 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18174 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18175 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18176 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18177 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18178 @samp{bf561}, @samp{bf592}.
18179
18180 The optional @var{sirevision} specifies the silicon revision of the target
18181 Blackfin processor. Any workarounds available for the targeted silicon revision
18182 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18183 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18184 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18185 hexadecimal digits representing the major and minor numbers in the silicon
18186 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18187 is not defined. If @var{sirevision} is @samp{any}, the
18188 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18189 If this optional @var{sirevision} is not used, GCC assumes the latest known
18190 silicon revision of the targeted Blackfin processor.
18191
18192 GCC defines a preprocessor macro for the specified @var{cpu}.
18193 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18194 provided by libgloss to be linked in if @option{-msim} is not given.
18195
18196 Without this option, @samp{bf532} is used as the processor by default.
18197
18198 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18199 only the preprocessor macro is defined.
18200
18201 @item -msim
18202 @opindex msim
18203 Specifies that the program will be run on the simulator. This causes
18204 the simulator BSP provided by libgloss to be linked in. This option
18205 has effect only for @samp{bfin-elf} toolchain.
18206 Certain other options, such as @option{-mid-shared-library} and
18207 @option{-mfdpic}, imply @option{-msim}.
18208
18209 @item -momit-leaf-frame-pointer
18210 @opindex momit-leaf-frame-pointer
18211 Don't keep the frame pointer in a register for leaf functions. This
18212 avoids the instructions to save, set up and restore frame pointers and
18213 makes an extra register available in leaf functions.
18214
18215 @item -mspecld-anomaly
18216 @opindex mspecld-anomaly
18217 When enabled, the compiler ensures that the generated code does not
18218 contain speculative loads after jump instructions. If this option is used,
18219 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18220
18221 @item -mno-specld-anomaly
18222 @opindex mno-specld-anomaly
18223 @opindex mspecld-anomaly
18224 Don't generate extra code to prevent speculative loads from occurring.
18225
18226 @item -mcsync-anomaly
18227 @opindex mcsync-anomaly
18228 When enabled, the compiler ensures that the generated code does not
18229 contain CSYNC or SSYNC instructions too soon after conditional branches.
18230 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18231
18232 @item -mno-csync-anomaly
18233 @opindex mno-csync-anomaly
18234 @opindex mcsync-anomaly
18235 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18236 occurring too soon after a conditional branch.
18237
18238 @item -mlow64k
18239 @opindex mlow64k
18240 When enabled, the compiler is free to take advantage of the knowledge that
18241 the entire program fits into the low 64k of memory.
18242
18243 @item -mno-low64k
18244 @opindex mno-low64k
18245 Assume that the program is arbitrarily large. This is the default.
18246
18247 @item -mstack-check-l1
18248 @opindex mstack-check-l1
18249 Do stack checking using information placed into L1 scratchpad memory by the
18250 uClinux kernel.
18251
18252 @item -mid-shared-library
18253 @opindex mid-shared-library
18254 Generate code that supports shared libraries via the library ID method.
18255 This allows for execute in place and shared libraries in an environment
18256 without virtual memory management. This option implies @option{-fPIC}.
18257 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18258
18259 @item -mno-id-shared-library
18260 @opindex mno-id-shared-library
18261 @opindex mid-shared-library
18262 Generate code that doesn't assume ID-based shared libraries are being used.
18263 This is the default.
18264
18265 @item -mleaf-id-shared-library
18266 @opindex mleaf-id-shared-library
18267 Generate code that supports shared libraries via the library ID method,
18268 but assumes that this library or executable won't link against any other
18269 ID shared libraries. That allows the compiler to use faster code for jumps
18270 and calls.
18271
18272 @item -mno-leaf-id-shared-library
18273 @opindex mno-leaf-id-shared-library
18274 @opindex mleaf-id-shared-library
18275 Do not assume that the code being compiled won't link against any ID shared
18276 libraries. Slower code is generated for jump and call insns.
18277
18278 @item -mshared-library-id=n
18279 @opindex mshared-library-id
18280 Specifies the identification number of the ID-based shared library being
18281 compiled. Specifying a value of 0 generates more compact code; specifying
18282 other values forces the allocation of that number to the current
18283 library but is no more space- or time-efficient than omitting this option.
18284
18285 @item -msep-data
18286 @opindex msep-data
18287 Generate code that allows the data segment to be located in a different
18288 area of memory from the text segment. This allows for execute in place in
18289 an environment without virtual memory management by eliminating relocations
18290 against the text section.
18291
18292 @item -mno-sep-data
18293 @opindex mno-sep-data
18294 @opindex msep-data
18295 Generate code that assumes that the data segment follows the text segment.
18296 This is the default.
18297
18298 @item -mlong-calls
18299 @itemx -mno-long-calls
18300 @opindex mlong-calls
18301 @opindex mno-long-calls
18302 Tells the compiler to perform function calls by first loading the
18303 address of the function into a register and then performing a subroutine
18304 call on this register. This switch is needed if the target function
18305 lies outside of the 24-bit addressing range of the offset-based
18306 version of subroutine call instruction.
18307
18308 This feature is not enabled by default. Specifying
18309 @option{-mno-long-calls} restores the default behavior. Note these
18310 switches have no effect on how the compiler generates code to handle
18311 function calls via function pointers.
18312
18313 @item -mfast-fp
18314 @opindex mfast-fp
18315 Link with the fast floating-point library. This library relaxes some of
18316 the IEEE floating-point standard's rules for checking inputs against
18317 Not-a-Number (NAN), in the interest of performance.
18318
18319 @item -minline-plt
18320 @opindex minline-plt
18321 Enable inlining of PLT entries in function calls to functions that are
18322 not known to bind locally. It has no effect without @option{-mfdpic}.
18323
18324 @item -mmulticore
18325 @opindex mmulticore
18326 Build a standalone application for multicore Blackfin processors.
18327 This option causes proper start files and link scripts supporting
18328 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18329 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18330
18331 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18332 selects the one-application-per-core programming model. Without
18333 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18334 programming model is used. In this model, the main function of Core B
18335 should be named as @code{coreb_main}.
18336
18337 If this option is not used, the single-core application programming
18338 model is used.
18339
18340 @item -mcorea
18341 @opindex mcorea
18342 Build a standalone application for Core A of BF561 when using
18343 the one-application-per-core programming model. Proper start files
18344 and link scripts are used to support Core A, and the macro
18345 @code{__BFIN_COREA} is defined.
18346 This option can only be used in conjunction with @option{-mmulticore}.
18347
18348 @item -mcoreb
18349 @opindex mcoreb
18350 Build a standalone application for Core B of BF561 when using
18351 the one-application-per-core programming model. Proper start files
18352 and link scripts are used to support Core B, and the macro
18353 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18354 should be used instead of @code{main}.
18355 This option can only be used in conjunction with @option{-mmulticore}.
18356
18357 @item -msdram
18358 @opindex msdram
18359 Build a standalone application for SDRAM. Proper start files and
18360 link scripts are used to put the application into SDRAM, and the macro
18361 @code{__BFIN_SDRAM} is defined.
18362 The loader should initialize SDRAM before loading the application.
18363
18364 @item -micplb
18365 @opindex micplb
18366 Assume that ICPLBs are enabled at run time. This has an effect on certain
18367 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18368 are enabled; for standalone applications the default is off.
18369 @end table
18370
18371 @node C6X Options
18372 @subsection C6X Options
18373 @cindex C6X Options
18374
18375 @table @gcctabopt
18376 @item -march=@var{name}
18377 @opindex march
18378 This specifies the name of the target architecture. GCC uses this
18379 name to determine what kind of instructions it can emit when generating
18380 assembly code. Permissible names are: @samp{c62x},
18381 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18382
18383 @item -mbig-endian
18384 @opindex mbig-endian
18385 Generate code for a big-endian target.
18386
18387 @item -mlittle-endian
18388 @opindex mlittle-endian
18389 Generate code for a little-endian target. This is the default.
18390
18391 @item -msim
18392 @opindex msim
18393 Choose startup files and linker script suitable for the simulator.
18394
18395 @item -msdata=default
18396 @opindex msdata=default
18397 Put small global and static data in the @code{.neardata} section,
18398 which is pointed to by register @code{B14}. Put small uninitialized
18399 global and static data in the @code{.bss} section, which is adjacent
18400 to the @code{.neardata} section. Put small read-only data into the
18401 @code{.rodata} section. The corresponding sections used for large
18402 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18403
18404 @item -msdata=all
18405 @opindex msdata=all
18406 Put all data, not just small objects, into the sections reserved for
18407 small data, and use addressing relative to the @code{B14} register to
18408 access them.
18409
18410 @item -msdata=none
18411 @opindex msdata=none
18412 Make no use of the sections reserved for small data, and use absolute
18413 addresses to access all data. Put all initialized global and static
18414 data in the @code{.fardata} section, and all uninitialized data in the
18415 @code{.far} section. Put all constant data into the @code{.const}
18416 section.
18417 @end table
18418
18419 @node CRIS Options
18420 @subsection CRIS Options
18421 @cindex CRIS Options
18422
18423 These options are defined specifically for the CRIS ports.
18424
18425 @table @gcctabopt
18426 @item -march=@var{architecture-type}
18427 @itemx -mcpu=@var{architecture-type}
18428 @opindex march
18429 @opindex mcpu
18430 Generate code for the specified architecture. The choices for
18431 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18432 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18433 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18434 @samp{v10}.
18435
18436 @item -mtune=@var{architecture-type}
18437 @opindex mtune
18438 Tune to @var{architecture-type} everything applicable about the generated
18439 code, except for the ABI and the set of available instructions. The
18440 choices for @var{architecture-type} are the same as for
18441 @option{-march=@var{architecture-type}}.
18442
18443 @item -mmax-stack-frame=@var{n}
18444 @opindex mmax-stack-frame
18445 Warn when the stack frame of a function exceeds @var{n} bytes.
18446
18447 @item -metrax4
18448 @itemx -metrax100
18449 @opindex metrax4
18450 @opindex metrax100
18451 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18452 @option{-march=v3} and @option{-march=v8} respectively.
18453
18454 @item -mmul-bug-workaround
18455 @itemx -mno-mul-bug-workaround
18456 @opindex mmul-bug-workaround
18457 @opindex mno-mul-bug-workaround
18458 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18459 models where it applies. This option is active by default.
18460
18461 @item -mpdebug
18462 @opindex mpdebug
18463 Enable CRIS-specific verbose debug-related information in the assembly
18464 code. This option also has the effect of turning off the @samp{#NO_APP}
18465 formatted-code indicator to the assembler at the beginning of the
18466 assembly file.
18467
18468 @item -mcc-init
18469 @opindex mcc-init
18470 Do not use condition-code results from previous instruction; always emit
18471 compare and test instructions before use of condition codes.
18472
18473 @item -mno-side-effects
18474 @opindex mno-side-effects
18475 @opindex mside-effects
18476 Do not emit instructions with side effects in addressing modes other than
18477 post-increment.
18478
18479 @item -mstack-align
18480 @itemx -mno-stack-align
18481 @itemx -mdata-align
18482 @itemx -mno-data-align
18483 @itemx -mconst-align
18484 @itemx -mno-const-align
18485 @opindex mstack-align
18486 @opindex mno-stack-align
18487 @opindex mdata-align
18488 @opindex mno-data-align
18489 @opindex mconst-align
18490 @opindex mno-const-align
18491 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18492 stack frame, individual data and constants to be aligned for the maximum
18493 single data access size for the chosen CPU model. The default is to
18494 arrange for 32-bit alignment. ABI details such as structure layout are
18495 not affected by these options.
18496
18497 @item -m32-bit
18498 @itemx -m16-bit
18499 @itemx -m8-bit
18500 @opindex m32-bit
18501 @opindex m16-bit
18502 @opindex m8-bit
18503 Similar to the stack- data- and const-align options above, these options
18504 arrange for stack frame, writable data and constants to all be 32-bit,
18505 16-bit or 8-bit aligned. The default is 32-bit alignment.
18506
18507 @item -mno-prologue-epilogue
18508 @itemx -mprologue-epilogue
18509 @opindex mno-prologue-epilogue
18510 @opindex mprologue-epilogue
18511 With @option{-mno-prologue-epilogue}, the normal function prologue and
18512 epilogue which set up the stack frame are omitted and no return
18513 instructions or return sequences are generated in the code. Use this
18514 option only together with visual inspection of the compiled code: no
18515 warnings or errors are generated when call-saved registers must be saved,
18516 or storage for local variables needs to be allocated.
18517
18518 @item -mno-gotplt
18519 @itemx -mgotplt
18520 @opindex mno-gotplt
18521 @opindex mgotplt
18522 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18523 instruction sequences that load addresses for functions from the PLT part
18524 of the GOT rather than (traditional on other architectures) calls to the
18525 PLT@. The default is @option{-mgotplt}.
18526
18527 @item -melf
18528 @opindex melf
18529 Legacy no-op option only recognized with the cris-axis-elf and
18530 cris-axis-linux-gnu targets.
18531
18532 @item -mlinux
18533 @opindex mlinux
18534 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18535
18536 @item -sim
18537 @opindex sim
18538 This option, recognized for the cris-axis-elf, arranges
18539 to link with input-output functions from a simulator library. Code,
18540 initialized data and zero-initialized data are allocated consecutively.
18541
18542 @item -sim2
18543 @opindex sim2
18544 Like @option{-sim}, but pass linker options to locate initialized data at
18545 0x40000000 and zero-initialized data at 0x80000000.
18546 @end table
18547
18548 @node CR16 Options
18549 @subsection CR16 Options
18550 @cindex CR16 Options
18551
18552 These options are defined specifically for the CR16 ports.
18553
18554 @table @gcctabopt
18555
18556 @item -mmac
18557 @opindex mmac
18558 Enable the use of multiply-accumulate instructions. Disabled by default.
18559
18560 @item -mcr16cplus
18561 @itemx -mcr16c
18562 @opindex mcr16cplus
18563 @opindex mcr16c
18564 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18565 is default.
18566
18567 @item -msim
18568 @opindex msim
18569 Links the library libsim.a which is in compatible with simulator. Applicable
18570 to ELF compiler only.
18571
18572 @item -mint32
18573 @opindex mint32
18574 Choose integer type as 32-bit wide.
18575
18576 @item -mbit-ops
18577 @opindex mbit-ops
18578 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18579
18580 @item -mdata-model=@var{model}
18581 @opindex mdata-model
18582 Choose a data model. The choices for @var{model} are @samp{near},
18583 @samp{far} or @samp{medium}. @samp{medium} is default.
18584 However, @samp{far} is not valid with @option{-mcr16c}, as the
18585 CR16C architecture does not support the far data model.
18586 @end table
18587
18588 @node C-SKY Options
18589 @subsection C-SKY Options
18590 @cindex C-SKY Options
18591
18592 GCC supports these options when compiling for C-SKY V2 processors.
18593
18594 @table @gcctabopt
18595
18596 @item -march=@var{arch}
18597 @opindex march=
18598 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18599 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18600 The default is @samp{ck810}.
18601
18602 @item -mcpu=@var{cpu}
18603 @opindex mcpu=
18604 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18605 @samp{ck801}, @samp{ck801t},
18606 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18607 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18608 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18609 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18610 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18611 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18612 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18613 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18614 @samp{ck803eftr1}, @samp{ck803efhtr1},
18615 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18616 @samp{ck803sef}, @samp{ck803seft},
18617 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18618 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18619 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18620 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18621
18622 @item -mbig-endian
18623 @opindex mbig-endian
18624 @itemx -EB
18625 @opindex EB
18626 @itemx -mlittle-endian
18627 @opindex mlittle-endian
18628 @itemx -EL
18629 @opindex EL
18630
18631 Select big- or little-endian code. The default is little-endian.
18632
18633 @item -mhard-float
18634 @opindex mhard-float
18635 @itemx -msoft-float
18636 @opindex msoft-float
18637
18638 Select hardware or software floating-point implementations.
18639 The default is soft float.
18640
18641 @item -mdouble-float
18642 @itemx -mno-double-float
18643 @opindex mdouble-float
18644 When @option{-mhard-float} is in effect, enable generation of
18645 double-precision float instructions. This is the default except
18646 when compiling for CK803.
18647
18648 @item -mfdivdu
18649 @itemx -mno-fdivdu
18650 @opindex mfdivdu
18651 When @option{-mhard-float} is in effect, enable generation of
18652 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
18653 This is the default except when compiling for CK803.
18654
18655 @item -mfpu=@var{fpu}
18656 @opindex mfpu=
18657 Select the floating-point processor. This option can only be used with
18658 @option{-mhard-float}.
18659 Values for @var{fpu} are
18660 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
18661 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
18662 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
18663
18664 @item -melrw
18665 @itemx -mno-elrw
18666 @opindex melrw
18667 Enable the extended @code{lrw} instruction. This option defaults to on
18668 for CK801 and off otherwise.
18669
18670 @item -mistack
18671 @itemx -mno-istack
18672 @opindex mistack
18673 Enable interrupt stack instructions; the default is off.
18674
18675 The @option{-mistack} option is required to handle the
18676 @code{interrupt} and @code{isr} function attributes
18677 (@pxref{C-SKY Function Attributes}).
18678
18679 @item -mmp
18680 @opindex mmp
18681 Enable multiprocessor instructions; the default is off.
18682
18683 @item -mcp
18684 @opindex mcp
18685 Enable coprocessor instructions; the default is off.
18686
18687 @item -mcache
18688 @opindex mcache
18689 Enable coprocessor instructions; the default is off.
18690
18691 @item -msecurity
18692 @opindex msecurity
18693 Enable C-SKY security instructions; the default is off.
18694
18695 @item -mtrust
18696 @opindex mtrust
18697 Enable C-SKY trust instructions; the default is off.
18698
18699 @item -mdsp
18700 @opindex mdsp
18701 @itemx -medsp
18702 @opindex medsp
18703 @itemx -mvdsp
18704 @opindex mvdsp
18705 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
18706 All of these options default to off.
18707
18708 @item -mdiv
18709 @itemx -mno-div
18710 @opindex mdiv
18711 Generate divide instructions. Default is off.
18712
18713 @item -msmart
18714 @itemx -mno-smart
18715 @opindex msmart
18716 Generate code for Smart Mode, using only registers numbered 0-7 to allow
18717 use of 16-bit instructions. This option is ignored for CK801 where this
18718 is the required behavior, and it defaults to on for CK802.
18719 For other targets, the default is off.
18720
18721 @item -mhigh-registers
18722 @itemx -mno-high-registers
18723 @opindex mhigh-registers
18724 Generate code using the high registers numbered 16-31. This option
18725 is not supported on CK801, CK802, or CK803, and is enabled by default
18726 for other processors.
18727
18728 @item -manchor
18729 @itemx -mno-anchor
18730 @opindex manchor
18731 Generate code using global anchor symbol addresses.
18732
18733 @item -mpushpop
18734 @itemx -mno-pushpop
18735 @opindex mpushpop
18736 Generate code using @code{push} and @code{pop} instructions. This option
18737 defaults to on.
18738
18739 @item -mmultiple-stld
18740 @itemx -mstm
18741 @itemx -mno-multiple-stld
18742 @itemx -mno-stm
18743 @opindex mmultiple-stld
18744 Generate code using @code{stm} and @code{ldm} instructions. This option
18745 isn't supported on CK801 but is enabled by default on other processors.
18746
18747 @item -mconstpool
18748 @itemx -mno-constpool
18749 @opindex mconstpool
18750 Create constant pools in the compiler instead of deferring it to the
18751 assembler. This option is the default and required for correct code
18752 generation on CK801 and CK802, and is optional on other processors.
18753
18754 @item -mstack-size
18755 @item -mno-stack-size
18756 @opindex mstack-size
18757 Emit @code{.stack_size} directives for each function in the assembly
18758 output. This option defaults to off.
18759
18760 @item -mccrt
18761 @itemx -mno-ccrt
18762 @opindex mccrt
18763 Generate code for the C-SKY compiler runtime instead of libgcc. This
18764 option defaults to off.
18765
18766 @item -mbranch-cost=@var{n}
18767 @opindex mbranch-cost=
18768 Set the branch costs to roughly @code{n} instructions. The default is 1.
18769
18770 @item -msched-prolog
18771 @itemx -mno-sched-prolog
18772 @opindex msched-prolog
18773 Permit scheduling of function prologue and epilogue sequences. Using
18774 this option can result in code that is not compliant with the C-SKY V2 ABI
18775 prologue requirements and that cannot be debugged or backtraced.
18776 It is disabled by default.
18777
18778 @end table
18779
18780 @node Darwin Options
18781 @subsection Darwin Options
18782 @cindex Darwin options
18783
18784 These options are defined for all architectures running the Darwin operating
18785 system.
18786
18787 FSF GCC on Darwin does not create ``fat'' object files; it creates
18788 an object file for the single architecture that GCC was built to
18789 target. Apple's GCC on Darwin does create ``fat'' files if multiple
18790 @option{-arch} options are used; it does so by running the compiler or
18791 linker multiple times and joining the results together with
18792 @file{lipo}.
18793
18794 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
18795 @samp{i686}) is determined by the flags that specify the ISA
18796 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
18797 @option{-force_cpusubtype_ALL} option can be used to override this.
18798
18799 The Darwin tools vary in their behavior when presented with an ISA
18800 mismatch. The assembler, @file{as}, only permits instructions to
18801 be used that are valid for the subtype of the file it is generating,
18802 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
18803 The linker for shared libraries, @file{/usr/bin/libtool}, fails
18804 and prints an error if asked to create a shared library with a less
18805 restrictive subtype than its input files (for instance, trying to put
18806 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
18807 for executables, @command{ld}, quietly gives the executable the most
18808 restrictive subtype of any of its input files.
18809
18810 @table @gcctabopt
18811 @item -F@var{dir}
18812 @opindex F
18813 Add the framework directory @var{dir} to the head of the list of
18814 directories to be searched for header files. These directories are
18815 interleaved with those specified by @option{-I} options and are
18816 scanned in a left-to-right order.
18817
18818 A framework directory is a directory with frameworks in it. A
18819 framework is a directory with a @file{Headers} and/or
18820 @file{PrivateHeaders} directory contained directly in it that ends
18821 in @file{.framework}. The name of a framework is the name of this
18822 directory excluding the @file{.framework}. Headers associated with
18823 the framework are found in one of those two directories, with
18824 @file{Headers} being searched first. A subframework is a framework
18825 directory that is in a framework's @file{Frameworks} directory.
18826 Includes of subframework headers can only appear in a header of a
18827 framework that contains the subframework, or in a sibling subframework
18828 header. Two subframeworks are siblings if they occur in the same
18829 framework. A subframework should not have the same name as a
18830 framework; a warning is issued if this is violated. Currently a
18831 subframework cannot have subframeworks; in the future, the mechanism
18832 may be extended to support this. The standard frameworks can be found
18833 in @file{/System/Library/Frameworks} and
18834 @file{/Library/Frameworks}. An example include looks like
18835 @code{#include <Framework/header.h>}, where @file{Framework} denotes
18836 the name of the framework and @file{header.h} is found in the
18837 @file{PrivateHeaders} or @file{Headers} directory.
18838
18839 @item -iframework@var{dir}
18840 @opindex iframework
18841 Like @option{-F} except the directory is a treated as a system
18842 directory. The main difference between this @option{-iframework} and
18843 @option{-F} is that with @option{-iframework} the compiler does not
18844 warn about constructs contained within header files found via
18845 @var{dir}. This option is valid only for the C family of languages.
18846
18847 @item -gused
18848 @opindex gused
18849 Emit debugging information for symbols that are used. For stabs
18850 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
18851 This is by default ON@.
18852
18853 @item -gfull
18854 @opindex gfull
18855 Emit debugging information for all symbols and types.
18856
18857 @item -mmacosx-version-min=@var{version}
18858 The earliest version of MacOS X that this executable will run on
18859 is @var{version}. Typical values of @var{version} include @code{10.1},
18860 @code{10.2}, and @code{10.3.9}.
18861
18862 If the compiler was built to use the system's headers by default,
18863 then the default for this option is the system version on which the
18864 compiler is running, otherwise the default is to make choices that
18865 are compatible with as many systems and code bases as possible.
18866
18867 @item -mkernel
18868 @opindex mkernel
18869 Enable kernel development mode. The @option{-mkernel} option sets
18870 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
18871 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
18872 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
18873 applicable. This mode also sets @option{-mno-altivec},
18874 @option{-msoft-float}, @option{-fno-builtin} and
18875 @option{-mlong-branch} for PowerPC targets.
18876
18877 @item -mone-byte-bool
18878 @opindex mone-byte-bool
18879 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
18880 By default @code{sizeof(bool)} is @code{4} when compiling for
18881 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
18882 option has no effect on x86.
18883
18884 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
18885 to generate code that is not binary compatible with code generated
18886 without that switch. Using this switch may require recompiling all
18887 other modules in a program, including system libraries. Use this
18888 switch to conform to a non-default data model.
18889
18890 @item -mfix-and-continue
18891 @itemx -ffix-and-continue
18892 @itemx -findirect-data
18893 @opindex mfix-and-continue
18894 @opindex ffix-and-continue
18895 @opindex findirect-data
18896 Generate code suitable for fast turnaround development, such as to
18897 allow GDB to dynamically load @file{.o} files into already-running
18898 programs. @option{-findirect-data} and @option{-ffix-and-continue}
18899 are provided for backwards compatibility.
18900
18901 @item -all_load
18902 @opindex all_load
18903 Loads all members of static archive libraries.
18904 See man ld(1) for more information.
18905
18906 @item -arch_errors_fatal
18907 @opindex arch_errors_fatal
18908 Cause the errors having to do with files that have the wrong architecture
18909 to be fatal.
18910
18911 @item -bind_at_load
18912 @opindex bind_at_load
18913 Causes the output file to be marked such that the dynamic linker will
18914 bind all undefined references when the file is loaded or launched.
18915
18916 @item -bundle
18917 @opindex bundle
18918 Produce a Mach-o bundle format file.
18919 See man ld(1) for more information.
18920
18921 @item -bundle_loader @var{executable}
18922 @opindex bundle_loader
18923 This option specifies the @var{executable} that will load the build
18924 output file being linked. See man ld(1) for more information.
18925
18926 @item -dynamiclib
18927 @opindex dynamiclib
18928 When passed this option, GCC produces a dynamic library instead of
18929 an executable when linking, using the Darwin @file{libtool} command.
18930
18931 @item -force_cpusubtype_ALL
18932 @opindex force_cpusubtype_ALL
18933 This causes GCC's output file to have the @samp{ALL} subtype, instead of
18934 one controlled by the @option{-mcpu} or @option{-march} option.
18935
18936 @item -allowable_client @var{client_name}
18937 @itemx -client_name
18938 @itemx -compatibility_version
18939 @itemx -current_version
18940 @itemx -dead_strip
18941 @itemx -dependency-file
18942 @itemx -dylib_file
18943 @itemx -dylinker_install_name
18944 @itemx -dynamic
18945 @itemx -exported_symbols_list
18946 @itemx -filelist
18947 @need 800
18948 @itemx -flat_namespace
18949 @itemx -force_flat_namespace
18950 @itemx -headerpad_max_install_names
18951 @itemx -image_base
18952 @itemx -init
18953 @itemx -install_name
18954 @itemx -keep_private_externs
18955 @itemx -multi_module
18956 @itemx -multiply_defined
18957 @itemx -multiply_defined_unused
18958 @need 800
18959 @itemx -noall_load
18960 @itemx -no_dead_strip_inits_and_terms
18961 @itemx -nofixprebinding
18962 @itemx -nomultidefs
18963 @itemx -noprebind
18964 @itemx -noseglinkedit
18965 @itemx -pagezero_size
18966 @itemx -prebind
18967 @itemx -prebind_all_twolevel_modules
18968 @itemx -private_bundle
18969 @need 800
18970 @itemx -read_only_relocs
18971 @itemx -sectalign
18972 @itemx -sectobjectsymbols
18973 @itemx -whyload
18974 @itemx -seg1addr
18975 @itemx -sectcreate
18976 @itemx -sectobjectsymbols
18977 @itemx -sectorder
18978 @itemx -segaddr
18979 @itemx -segs_read_only_addr
18980 @need 800
18981 @itemx -segs_read_write_addr
18982 @itemx -seg_addr_table
18983 @itemx -seg_addr_table_filename
18984 @itemx -seglinkedit
18985 @itemx -segprot
18986 @itemx -segs_read_only_addr
18987 @itemx -segs_read_write_addr
18988 @itemx -single_module
18989 @itemx -static
18990 @itemx -sub_library
18991 @need 800
18992 @itemx -sub_umbrella
18993 @itemx -twolevel_namespace
18994 @itemx -umbrella
18995 @itemx -undefined
18996 @itemx -unexported_symbols_list
18997 @itemx -weak_reference_mismatches
18998 @itemx -whatsloaded
18999 @opindex allowable_client
19000 @opindex client_name
19001 @opindex compatibility_version
19002 @opindex current_version
19003 @opindex dead_strip
19004 @opindex dependency-file
19005 @opindex dylib_file
19006 @opindex dylinker_install_name
19007 @opindex dynamic
19008 @opindex exported_symbols_list
19009 @opindex filelist
19010 @opindex flat_namespace
19011 @opindex force_flat_namespace
19012 @opindex headerpad_max_install_names
19013 @opindex image_base
19014 @opindex init
19015 @opindex install_name
19016 @opindex keep_private_externs
19017 @opindex multi_module
19018 @opindex multiply_defined
19019 @opindex multiply_defined_unused
19020 @opindex noall_load
19021 @opindex no_dead_strip_inits_and_terms
19022 @opindex nofixprebinding
19023 @opindex nomultidefs
19024 @opindex noprebind
19025 @opindex noseglinkedit
19026 @opindex pagezero_size
19027 @opindex prebind
19028 @opindex prebind_all_twolevel_modules
19029 @opindex private_bundle
19030 @opindex read_only_relocs
19031 @opindex sectalign
19032 @opindex sectobjectsymbols
19033 @opindex whyload
19034 @opindex seg1addr
19035 @opindex sectcreate
19036 @opindex sectobjectsymbols
19037 @opindex sectorder
19038 @opindex segaddr
19039 @opindex segs_read_only_addr
19040 @opindex segs_read_write_addr
19041 @opindex seg_addr_table
19042 @opindex seg_addr_table_filename
19043 @opindex seglinkedit
19044 @opindex segprot
19045 @opindex segs_read_only_addr
19046 @opindex segs_read_write_addr
19047 @opindex single_module
19048 @opindex static
19049 @opindex sub_library
19050 @opindex sub_umbrella
19051 @opindex twolevel_namespace
19052 @opindex umbrella
19053 @opindex undefined
19054 @opindex unexported_symbols_list
19055 @opindex weak_reference_mismatches
19056 @opindex whatsloaded
19057 These options are passed to the Darwin linker. The Darwin linker man page
19058 describes them in detail.
19059 @end table
19060
19061 @node DEC Alpha Options
19062 @subsection DEC Alpha Options
19063
19064 These @samp{-m} options are defined for the DEC Alpha implementations:
19065
19066 @table @gcctabopt
19067 @item -mno-soft-float
19068 @itemx -msoft-float
19069 @opindex mno-soft-float
19070 @opindex msoft-float
19071 Use (do not use) the hardware floating-point instructions for
19072 floating-point operations. When @option{-msoft-float} is specified,
19073 functions in @file{libgcc.a} are used to perform floating-point
19074 operations. Unless they are replaced by routines that emulate the
19075 floating-point operations, or compiled in such a way as to call such
19076 emulations routines, these routines issue floating-point
19077 operations. If you are compiling for an Alpha without floating-point
19078 operations, you must ensure that the library is built so as not to call
19079 them.
19080
19081 Note that Alpha implementations without floating-point operations are
19082 required to have floating-point registers.
19083
19084 @item -mfp-reg
19085 @itemx -mno-fp-regs
19086 @opindex mfp-reg
19087 @opindex mno-fp-regs
19088 Generate code that uses (does not use) the floating-point register set.
19089 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19090 register set is not used, floating-point operands are passed in integer
19091 registers as if they were integers and floating-point results are passed
19092 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19093 so any function with a floating-point argument or return value called by code
19094 compiled with @option{-mno-fp-regs} must also be compiled with that
19095 option.
19096
19097 A typical use of this option is building a kernel that does not use,
19098 and hence need not save and restore, any floating-point registers.
19099
19100 @item -mieee
19101 @opindex mieee
19102 The Alpha architecture implements floating-point hardware optimized for
19103 maximum performance. It is mostly compliant with the IEEE floating-point
19104 standard. However, for full compliance, software assistance is
19105 required. This option generates code fully IEEE-compliant code
19106 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19107 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19108 defined during compilation. The resulting code is less efficient but is
19109 able to correctly support denormalized numbers and exceptional IEEE
19110 values such as not-a-number and plus/minus infinity. Other Alpha
19111 compilers call this option @option{-ieee_with_no_inexact}.
19112
19113 @item -mieee-with-inexact
19114 @opindex mieee-with-inexact
19115 This is like @option{-mieee} except the generated code also maintains
19116 the IEEE @var{inexact-flag}. Turning on this option causes the
19117 generated code to implement fully-compliant IEEE math. In addition to
19118 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19119 macro. On some Alpha implementations the resulting code may execute
19120 significantly slower than the code generated by default. Since there is
19121 very little code that depends on the @var{inexact-flag}, you should
19122 normally not specify this option. Other Alpha compilers call this
19123 option @option{-ieee_with_inexact}.
19124
19125 @item -mfp-trap-mode=@var{trap-mode}
19126 @opindex mfp-trap-mode
19127 This option controls what floating-point related traps are enabled.
19128 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19129 The trap mode can be set to one of four values:
19130
19131 @table @samp
19132 @item n
19133 This is the default (normal) setting. The only traps that are enabled
19134 are the ones that cannot be disabled in software (e.g., division by zero
19135 trap).
19136
19137 @item u
19138 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19139 as well.
19140
19141 @item su
19142 Like @samp{u}, but the instructions are marked to be safe for software
19143 completion (see Alpha architecture manual for details).
19144
19145 @item sui
19146 Like @samp{su}, but inexact traps are enabled as well.
19147 @end table
19148
19149 @item -mfp-rounding-mode=@var{rounding-mode}
19150 @opindex mfp-rounding-mode
19151 Selects the IEEE rounding mode. Other Alpha compilers call this option
19152 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19153 of:
19154
19155 @table @samp
19156 @item n
19157 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19158 the nearest machine number or towards the even machine number in case
19159 of a tie.
19160
19161 @item m
19162 Round towards minus infinity.
19163
19164 @item c
19165 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19166
19167 @item d
19168 Dynamic rounding mode. A field in the floating-point control register
19169 (@var{fpcr}, see Alpha architecture reference manual) controls the
19170 rounding mode in effect. The C library initializes this register for
19171 rounding towards plus infinity. Thus, unless your program modifies the
19172 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19173 @end table
19174
19175 @item -mtrap-precision=@var{trap-precision}
19176 @opindex mtrap-precision
19177 In the Alpha architecture, floating-point traps are imprecise. This
19178 means without software assistance it is impossible to recover from a
19179 floating trap and program execution normally needs to be terminated.
19180 GCC can generate code that can assist operating system trap handlers
19181 in determining the exact location that caused a floating-point trap.
19182 Depending on the requirements of an application, different levels of
19183 precisions can be selected:
19184
19185 @table @samp
19186 @item p
19187 Program precision. This option is the default and means a trap handler
19188 can only identify which program caused a floating-point exception.
19189
19190 @item f
19191 Function precision. The trap handler can determine the function that
19192 caused a floating-point exception.
19193
19194 @item i
19195 Instruction precision. The trap handler can determine the exact
19196 instruction that caused a floating-point exception.
19197 @end table
19198
19199 Other Alpha compilers provide the equivalent options called
19200 @option{-scope_safe} and @option{-resumption_safe}.
19201
19202 @item -mieee-conformant
19203 @opindex mieee-conformant
19204 This option marks the generated code as IEEE conformant. You must not
19205 use this option unless you also specify @option{-mtrap-precision=i} and either
19206 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19207 is to emit the line @samp{.eflag 48} in the function prologue of the
19208 generated assembly file.
19209
19210 @item -mbuild-constants
19211 @opindex mbuild-constants
19212 Normally GCC examines a 32- or 64-bit integer constant to
19213 see if it can construct it from smaller constants in two or three
19214 instructions. If it cannot, it outputs the constant as a literal and
19215 generates code to load it from the data segment at run time.
19216
19217 Use this option to require GCC to construct @emph{all} integer constants
19218 using code, even if it takes more instructions (the maximum is six).
19219
19220 You typically use this option to build a shared library dynamic
19221 loader. Itself a shared library, it must relocate itself in memory
19222 before it can find the variables and constants in its own data segment.
19223
19224 @item -mbwx
19225 @itemx -mno-bwx
19226 @itemx -mcix
19227 @itemx -mno-cix
19228 @itemx -mfix
19229 @itemx -mno-fix
19230 @itemx -mmax
19231 @itemx -mno-max
19232 @opindex mbwx
19233 @opindex mno-bwx
19234 @opindex mcix
19235 @opindex mno-cix
19236 @opindex mfix
19237 @opindex mno-fix
19238 @opindex mmax
19239 @opindex mno-max
19240 Indicate whether GCC should generate code to use the optional BWX,
19241 CIX, FIX and MAX instruction sets. The default is to use the instruction
19242 sets supported by the CPU type specified via @option{-mcpu=} option or that
19243 of the CPU on which GCC was built if none is specified.
19244
19245 @item -mfloat-vax
19246 @itemx -mfloat-ieee
19247 @opindex mfloat-vax
19248 @opindex mfloat-ieee
19249 Generate code that uses (does not use) VAX F and G floating-point
19250 arithmetic instead of IEEE single and double precision.
19251
19252 @item -mexplicit-relocs
19253 @itemx -mno-explicit-relocs
19254 @opindex mexplicit-relocs
19255 @opindex mno-explicit-relocs
19256 Older Alpha assemblers provided no way to generate symbol relocations
19257 except via assembler macros. Use of these macros does not allow
19258 optimal instruction scheduling. GNU binutils as of version 2.12
19259 supports a new syntax that allows the compiler to explicitly mark
19260 which relocations should apply to which instructions. This option
19261 is mostly useful for debugging, as GCC detects the capabilities of
19262 the assembler when it is built and sets the default accordingly.
19263
19264 @item -msmall-data
19265 @itemx -mlarge-data
19266 @opindex msmall-data
19267 @opindex mlarge-data
19268 When @option{-mexplicit-relocs} is in effect, static data is
19269 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19270 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19271 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19272 16-bit relocations off of the @code{$gp} register. This limits the
19273 size of the small data area to 64KB, but allows the variables to be
19274 directly accessed via a single instruction.
19275
19276 The default is @option{-mlarge-data}. With this option the data area
19277 is limited to just below 2GB@. Programs that require more than 2GB of
19278 data must use @code{malloc} or @code{mmap} to allocate the data in the
19279 heap instead of in the program's data segment.
19280
19281 When generating code for shared libraries, @option{-fpic} implies
19282 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19283
19284 @item -msmall-text
19285 @itemx -mlarge-text
19286 @opindex msmall-text
19287 @opindex mlarge-text
19288 When @option{-msmall-text} is used, the compiler assumes that the
19289 code of the entire program (or shared library) fits in 4MB, and is
19290 thus reachable with a branch instruction. When @option{-msmall-data}
19291 is used, the compiler can assume that all local symbols share the
19292 same @code{$gp} value, and thus reduce the number of instructions
19293 required for a function call from 4 to 1.
19294
19295 The default is @option{-mlarge-text}.
19296
19297 @item -mcpu=@var{cpu_type}
19298 @opindex mcpu
19299 Set the instruction set and instruction scheduling parameters for
19300 machine type @var{cpu_type}. You can specify either the @samp{EV}
19301 style name or the corresponding chip number. GCC supports scheduling
19302 parameters for the EV4, EV5 and EV6 family of processors and
19303 chooses the default values for the instruction set from the processor
19304 you specify. If you do not specify a processor type, GCC defaults
19305 to the processor on which the compiler was built.
19306
19307 Supported values for @var{cpu_type} are
19308
19309 @table @samp
19310 @item ev4
19311 @itemx ev45
19312 @itemx 21064
19313 Schedules as an EV4 and has no instruction set extensions.
19314
19315 @item ev5
19316 @itemx 21164
19317 Schedules as an EV5 and has no instruction set extensions.
19318
19319 @item ev56
19320 @itemx 21164a
19321 Schedules as an EV5 and supports the BWX extension.
19322
19323 @item pca56
19324 @itemx 21164pc
19325 @itemx 21164PC
19326 Schedules as an EV5 and supports the BWX and MAX extensions.
19327
19328 @item ev6
19329 @itemx 21264
19330 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19331
19332 @item ev67
19333 @itemx 21264a
19334 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19335 @end table
19336
19337 Native toolchains also support the value @samp{native},
19338 which selects the best architecture option for the host processor.
19339 @option{-mcpu=native} has no effect if GCC does not recognize
19340 the processor.
19341
19342 @item -mtune=@var{cpu_type}
19343 @opindex mtune
19344 Set only the instruction scheduling parameters for machine type
19345 @var{cpu_type}. The instruction set is not changed.
19346
19347 Native toolchains also support the value @samp{native},
19348 which selects the best architecture option for the host processor.
19349 @option{-mtune=native} has no effect if GCC does not recognize
19350 the processor.
19351
19352 @item -mmemory-latency=@var{time}
19353 @opindex mmemory-latency
19354 Sets the latency the scheduler should assume for typical memory
19355 references as seen by the application. This number is highly
19356 dependent on the memory access patterns used by the application
19357 and the size of the external cache on the machine.
19358
19359 Valid options for @var{time} are
19360
19361 @table @samp
19362 @item @var{number}
19363 A decimal number representing clock cycles.
19364
19365 @item L1
19366 @itemx L2
19367 @itemx L3
19368 @itemx main
19369 The compiler contains estimates of the number of clock cycles for
19370 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19371 (also called Dcache, Scache, and Bcache), as well as to main memory.
19372 Note that L3 is only valid for EV5.
19373
19374 @end table
19375 @end table
19376
19377 @node FR30 Options
19378 @subsection FR30 Options
19379 @cindex FR30 Options
19380
19381 These options are defined specifically for the FR30 port.
19382
19383 @table @gcctabopt
19384
19385 @item -msmall-model
19386 @opindex msmall-model
19387 Use the small address space model. This can produce smaller code, but
19388 it does assume that all symbolic values and addresses fit into a
19389 20-bit range.
19390
19391 @item -mno-lsim
19392 @opindex mno-lsim
19393 Assume that runtime support has been provided and so there is no need
19394 to include the simulator library (@file{libsim.a}) on the linker
19395 command line.
19396
19397 @end table
19398
19399 @node FT32 Options
19400 @subsection FT32 Options
19401 @cindex FT32 Options
19402
19403 These options are defined specifically for the FT32 port.
19404
19405 @table @gcctabopt
19406
19407 @item -msim
19408 @opindex msim
19409 Specifies that the program will be run on the simulator. This causes
19410 an alternate runtime startup and library to be linked.
19411 You must not use this option when generating programs that will run on
19412 real hardware; you must provide your own runtime library for whatever
19413 I/O functions are needed.
19414
19415 @item -mlra
19416 @opindex mlra
19417 Enable Local Register Allocation. This is still experimental for FT32,
19418 so by default the compiler uses standard reload.
19419
19420 @item -mnodiv
19421 @opindex mnodiv
19422 Do not use div and mod instructions.
19423
19424 @item -mft32b
19425 @opindex mft32b
19426 Enable use of the extended instructions of the FT32B processor.
19427
19428 @item -mcompress
19429 @opindex mcompress
19430 Compress all code using the Ft32B code compression scheme.
19431
19432 @item -mnopm
19433 @opindex mnopm
19434 Do not generate code that reads program memory.
19435
19436 @end table
19437
19438 @node FRV Options
19439 @subsection FRV Options
19440 @cindex FRV Options
19441
19442 @table @gcctabopt
19443 @item -mgpr-32
19444 @opindex mgpr-32
19445
19446 Only use the first 32 general-purpose registers.
19447
19448 @item -mgpr-64
19449 @opindex mgpr-64
19450
19451 Use all 64 general-purpose registers.
19452
19453 @item -mfpr-32
19454 @opindex mfpr-32
19455
19456 Use only the first 32 floating-point registers.
19457
19458 @item -mfpr-64
19459 @opindex mfpr-64
19460
19461 Use all 64 floating-point registers.
19462
19463 @item -mhard-float
19464 @opindex mhard-float
19465
19466 Use hardware instructions for floating-point operations.
19467
19468 @item -msoft-float
19469 @opindex msoft-float
19470
19471 Use library routines for floating-point operations.
19472
19473 @item -malloc-cc
19474 @opindex malloc-cc
19475
19476 Dynamically allocate condition code registers.
19477
19478 @item -mfixed-cc
19479 @opindex mfixed-cc
19480
19481 Do not try to dynamically allocate condition code registers, only
19482 use @code{icc0} and @code{fcc0}.
19483
19484 @item -mdword
19485 @opindex mdword
19486
19487 Change ABI to use double word insns.
19488
19489 @item -mno-dword
19490 @opindex mno-dword
19491 @opindex mdword
19492
19493 Do not use double word instructions.
19494
19495 @item -mdouble
19496 @opindex mdouble
19497
19498 Use floating-point double instructions.
19499
19500 @item -mno-double
19501 @opindex mno-double
19502
19503 Do not use floating-point double instructions.
19504
19505 @item -mmedia
19506 @opindex mmedia
19507
19508 Use media instructions.
19509
19510 @item -mno-media
19511 @opindex mno-media
19512
19513 Do not use media instructions.
19514
19515 @item -mmuladd
19516 @opindex mmuladd
19517
19518 Use multiply and add/subtract instructions.
19519
19520 @item -mno-muladd
19521 @opindex mno-muladd
19522
19523 Do not use multiply and add/subtract instructions.
19524
19525 @item -mfdpic
19526 @opindex mfdpic
19527
19528 Select the FDPIC ABI, which uses function descriptors to represent
19529 pointers to functions. Without any PIC/PIE-related options, it
19530 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19531 assumes GOT entries and small data are within a 12-bit range from the
19532 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19533 are computed with 32 bits.
19534 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19535
19536 @item -minline-plt
19537 @opindex minline-plt
19538
19539 Enable inlining of PLT entries in function calls to functions that are
19540 not known to bind locally. It has no effect without @option{-mfdpic}.
19541 It's enabled by default if optimizing for speed and compiling for
19542 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19543 optimization option such as @option{-O3} or above is present in the
19544 command line.
19545
19546 @item -mTLS
19547 @opindex mTLS
19548
19549 Assume a large TLS segment when generating thread-local code.
19550
19551 @item -mtls
19552 @opindex mtls
19553
19554 Do not assume a large TLS segment when generating thread-local code.
19555
19556 @item -mgprel-ro
19557 @opindex mgprel-ro
19558
19559 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19560 that is known to be in read-only sections. It's enabled by default,
19561 except for @option{-fpic} or @option{-fpie}: even though it may help
19562 make the global offset table smaller, it trades 1 instruction for 4.
19563 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19564 one of which may be shared by multiple symbols, and it avoids the need
19565 for a GOT entry for the referenced symbol, so it's more likely to be a
19566 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19567
19568 @item -multilib-library-pic
19569 @opindex multilib-library-pic
19570
19571 Link with the (library, not FD) pic libraries. It's implied by
19572 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19573 @option{-fpic} without @option{-mfdpic}. You should never have to use
19574 it explicitly.
19575
19576 @item -mlinked-fp
19577 @opindex mlinked-fp
19578
19579 Follow the EABI requirement of always creating a frame pointer whenever
19580 a stack frame is allocated. This option is enabled by default and can
19581 be disabled with @option{-mno-linked-fp}.
19582
19583 @item -mlong-calls
19584 @opindex mlong-calls
19585
19586 Use indirect addressing to call functions outside the current
19587 compilation unit. This allows the functions to be placed anywhere
19588 within the 32-bit address space.
19589
19590 @item -malign-labels
19591 @opindex malign-labels
19592
19593 Try to align labels to an 8-byte boundary by inserting NOPs into the
19594 previous packet. This option only has an effect when VLIW packing
19595 is enabled. It doesn't create new packets; it merely adds NOPs to
19596 existing ones.
19597
19598 @item -mlibrary-pic
19599 @opindex mlibrary-pic
19600
19601 Generate position-independent EABI code.
19602
19603 @item -macc-4
19604 @opindex macc-4
19605
19606 Use only the first four media accumulator registers.
19607
19608 @item -macc-8
19609 @opindex macc-8
19610
19611 Use all eight media accumulator registers.
19612
19613 @item -mpack
19614 @opindex mpack
19615
19616 Pack VLIW instructions.
19617
19618 @item -mno-pack
19619 @opindex mno-pack
19620
19621 Do not pack VLIW instructions.
19622
19623 @item -mno-eflags
19624 @opindex mno-eflags
19625
19626 Do not mark ABI switches in e_flags.
19627
19628 @item -mcond-move
19629 @opindex mcond-move
19630
19631 Enable the use of conditional-move instructions (default).
19632
19633 This switch is mainly for debugging the compiler and will likely be removed
19634 in a future version.
19635
19636 @item -mno-cond-move
19637 @opindex mno-cond-move
19638
19639 Disable the use of conditional-move instructions.
19640
19641 This switch is mainly for debugging the compiler and will likely be removed
19642 in a future version.
19643
19644 @item -mscc
19645 @opindex mscc
19646
19647 Enable the use of conditional set instructions (default).
19648
19649 This switch is mainly for debugging the compiler and will likely be removed
19650 in a future version.
19651
19652 @item -mno-scc
19653 @opindex mno-scc
19654
19655 Disable the use of conditional set instructions.
19656
19657 This switch is mainly for debugging the compiler and will likely be removed
19658 in a future version.
19659
19660 @item -mcond-exec
19661 @opindex mcond-exec
19662
19663 Enable the use of conditional execution (default).
19664
19665 This switch is mainly for debugging the compiler and will likely be removed
19666 in a future version.
19667
19668 @item -mno-cond-exec
19669 @opindex mno-cond-exec
19670
19671 Disable the use of conditional execution.
19672
19673 This switch is mainly for debugging the compiler and will likely be removed
19674 in a future version.
19675
19676 @item -mvliw-branch
19677 @opindex mvliw-branch
19678
19679 Run a pass to pack branches into VLIW instructions (default).
19680
19681 This switch is mainly for debugging the compiler and will likely be removed
19682 in a future version.
19683
19684 @item -mno-vliw-branch
19685 @opindex mno-vliw-branch
19686
19687 Do not run a pass to pack branches into VLIW instructions.
19688
19689 This switch is mainly for debugging the compiler and will likely be removed
19690 in a future version.
19691
19692 @item -mmulti-cond-exec
19693 @opindex mmulti-cond-exec
19694
19695 Enable optimization of @code{&&} and @code{||} in conditional execution
19696 (default).
19697
19698 This switch is mainly for debugging the compiler and will likely be removed
19699 in a future version.
19700
19701 @item -mno-multi-cond-exec
19702 @opindex mno-multi-cond-exec
19703
19704 Disable optimization of @code{&&} and @code{||} in conditional execution.
19705
19706 This switch is mainly for debugging the compiler and will likely be removed
19707 in a future version.
19708
19709 @item -mnested-cond-exec
19710 @opindex mnested-cond-exec
19711
19712 Enable nested conditional execution optimizations (default).
19713
19714 This switch is mainly for debugging the compiler and will likely be removed
19715 in a future version.
19716
19717 @item -mno-nested-cond-exec
19718 @opindex mno-nested-cond-exec
19719
19720 Disable nested conditional execution optimizations.
19721
19722 This switch is mainly for debugging the compiler and will likely be removed
19723 in a future version.
19724
19725 @item -moptimize-membar
19726 @opindex moptimize-membar
19727
19728 This switch removes redundant @code{membar} instructions from the
19729 compiler-generated code. It is enabled by default.
19730
19731 @item -mno-optimize-membar
19732 @opindex mno-optimize-membar
19733 @opindex moptimize-membar
19734
19735 This switch disables the automatic removal of redundant @code{membar}
19736 instructions from the generated code.
19737
19738 @item -mtomcat-stats
19739 @opindex mtomcat-stats
19740
19741 Cause gas to print out tomcat statistics.
19742
19743 @item -mcpu=@var{cpu}
19744 @opindex mcpu
19745
19746 Select the processor type for which to generate code. Possible values are
19747 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
19748 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
19749
19750 @end table
19751
19752 @node GNU/Linux Options
19753 @subsection GNU/Linux Options
19754
19755 These @samp{-m} options are defined for GNU/Linux targets:
19756
19757 @table @gcctabopt
19758 @item -mglibc
19759 @opindex mglibc
19760 Use the GNU C library. This is the default except
19761 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
19762 @samp{*-*-linux-*android*} targets.
19763
19764 @item -muclibc
19765 @opindex muclibc
19766 Use uClibc C library. This is the default on
19767 @samp{*-*-linux-*uclibc*} targets.
19768
19769 @item -mmusl
19770 @opindex mmusl
19771 Use the musl C library. This is the default on
19772 @samp{*-*-linux-*musl*} targets.
19773
19774 @item -mbionic
19775 @opindex mbionic
19776 Use Bionic C library. This is the default on
19777 @samp{*-*-linux-*android*} targets.
19778
19779 @item -mandroid
19780 @opindex mandroid
19781 Compile code compatible with Android platform. This is the default on
19782 @samp{*-*-linux-*android*} targets.
19783
19784 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
19785 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
19786 this option makes the GCC driver pass Android-specific options to the linker.
19787 Finally, this option causes the preprocessor macro @code{__ANDROID__}
19788 to be defined.
19789
19790 @item -tno-android-cc
19791 @opindex tno-android-cc
19792 Disable compilation effects of @option{-mandroid}, i.e., do not enable
19793 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
19794 @option{-fno-rtti} by default.
19795
19796 @item -tno-android-ld
19797 @opindex tno-android-ld
19798 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
19799 linking options to the linker.
19800
19801 @end table
19802
19803 @node H8/300 Options
19804 @subsection H8/300 Options
19805
19806 These @samp{-m} options are defined for the H8/300 implementations:
19807
19808 @table @gcctabopt
19809 @item -mrelax
19810 @opindex mrelax
19811 Shorten some address references at link time, when possible; uses the
19812 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
19813 ld, Using ld}, for a fuller description.
19814
19815 @item -mh
19816 @opindex mh
19817 Generate code for the H8/300H@.
19818
19819 @item -ms
19820 @opindex ms
19821 Generate code for the H8S@.
19822
19823 @item -mn
19824 @opindex mn
19825 Generate code for the H8S and H8/300H in the normal mode. This switch
19826 must be used either with @option{-mh} or @option{-ms}.
19827
19828 @item -ms2600
19829 @opindex ms2600
19830 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
19831
19832 @item -mexr
19833 @opindex mexr
19834 Extended registers are stored on stack before execution of function
19835 with monitor attribute. Default option is @option{-mexr}.
19836 This option is valid only for H8S targets.
19837
19838 @item -mno-exr
19839 @opindex mno-exr
19840 @opindex mexr
19841 Extended registers are not stored on stack before execution of function
19842 with monitor attribute. Default option is @option{-mno-exr}.
19843 This option is valid only for H8S targets.
19844
19845 @item -mint32
19846 @opindex mint32
19847 Make @code{int} data 32 bits by default.
19848
19849 @item -malign-300
19850 @opindex malign-300
19851 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
19852 The default for the H8/300H and H8S is to align longs and floats on
19853 4-byte boundaries.
19854 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
19855 This option has no effect on the H8/300.
19856 @end table
19857
19858 @node HPPA Options
19859 @subsection HPPA Options
19860 @cindex HPPA Options
19861
19862 These @samp{-m} options are defined for the HPPA family of computers:
19863
19864 @table @gcctabopt
19865 @item -march=@var{architecture-type}
19866 @opindex march
19867 Generate code for the specified architecture. The choices for
19868 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
19869 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
19870 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
19871 architecture option for your machine. Code compiled for lower numbered
19872 architectures runs on higher numbered architectures, but not the
19873 other way around.
19874
19875 @item -mpa-risc-1-0
19876 @itemx -mpa-risc-1-1
19877 @itemx -mpa-risc-2-0
19878 @opindex mpa-risc-1-0
19879 @opindex mpa-risc-1-1
19880 @opindex mpa-risc-2-0
19881 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
19882
19883 @item -mcaller-copies
19884 @opindex mcaller-copies
19885 The caller copies function arguments passed by hidden reference. This
19886 option should be used with care as it is not compatible with the default
19887 32-bit runtime. However, only aggregates larger than eight bytes are
19888 passed by hidden reference and the option provides better compatibility
19889 with OpenMP.
19890
19891 @item -mjump-in-delay
19892 @opindex mjump-in-delay
19893 This option is ignored and provided for compatibility purposes only.
19894
19895 @item -mdisable-fpregs
19896 @opindex mdisable-fpregs
19897 Prevent floating-point registers from being used in any manner. This is
19898 necessary for compiling kernels that perform lazy context switching of
19899 floating-point registers. If you use this option and attempt to perform
19900 floating-point operations, the compiler aborts.
19901
19902 @item -mdisable-indexing
19903 @opindex mdisable-indexing
19904 Prevent the compiler from using indexing address modes. This avoids some
19905 rather obscure problems when compiling MIG generated code under MACH@.
19906
19907 @item -mno-space-regs
19908 @opindex mno-space-regs
19909 @opindex mspace-regs
19910 Generate code that assumes the target has no space registers. This allows
19911 GCC to generate faster indirect calls and use unscaled index address modes.
19912
19913 Such code is suitable for level 0 PA systems and kernels.
19914
19915 @item -mfast-indirect-calls
19916 @opindex mfast-indirect-calls
19917 Generate code that assumes calls never cross space boundaries. This
19918 allows GCC to emit code that performs faster indirect calls.
19919
19920 This option does not work in the presence of shared libraries or nested
19921 functions.
19922
19923 @item -mfixed-range=@var{register-range}
19924 @opindex mfixed-range
19925 Generate code treating the given register range as fixed registers.
19926 A fixed register is one that the register allocator cannot use. This is
19927 useful when compiling kernel code. A register range is specified as
19928 two registers separated by a dash. Multiple register ranges can be
19929 specified separated by a comma.
19930
19931 @item -mlong-load-store
19932 @opindex mlong-load-store
19933 Generate 3-instruction load and store sequences as sometimes required by
19934 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
19935 the HP compilers.
19936
19937 @item -mportable-runtime
19938 @opindex mportable-runtime
19939 Use the portable calling conventions proposed by HP for ELF systems.
19940
19941 @item -mgas
19942 @opindex mgas
19943 Enable the use of assembler directives only GAS understands.
19944
19945 @item -mschedule=@var{cpu-type}
19946 @opindex mschedule
19947 Schedule code according to the constraints for the machine type
19948 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
19949 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
19950 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
19951 proper scheduling option for your machine. The default scheduling is
19952 @samp{8000}.
19953
19954 @item -mlinker-opt
19955 @opindex mlinker-opt
19956 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
19957 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
19958 linkers in which they give bogus error messages when linking some programs.
19959
19960 @item -msoft-float
19961 @opindex msoft-float
19962 Generate output containing library calls for floating point.
19963 @strong{Warning:} the requisite libraries are not available for all HPPA
19964 targets. Normally the facilities of the machine's usual C compiler are
19965 used, but this cannot be done directly in cross-compilation. You must make
19966 your own arrangements to provide suitable library functions for
19967 cross-compilation.
19968
19969 @option{-msoft-float} changes the calling convention in the output file;
19970 therefore, it is only useful if you compile @emph{all} of a program with
19971 this option. In particular, you need to compile @file{libgcc.a}, the
19972 library that comes with GCC, with @option{-msoft-float} in order for
19973 this to work.
19974
19975 @item -msio
19976 @opindex msio
19977 Generate the predefine, @code{_SIO}, for server IO@. The default is
19978 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
19979 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
19980 options are available under HP-UX and HI-UX@.
19981
19982 @item -mgnu-ld
19983 @opindex mgnu-ld
19984 Use options specific to GNU @command{ld}.
19985 This passes @option{-shared} to @command{ld} when
19986 building a shared library. It is the default when GCC is configured,
19987 explicitly or implicitly, with the GNU linker. This option does not
19988 affect which @command{ld} is called; it only changes what parameters
19989 are passed to that @command{ld}.
19990 The @command{ld} that is called is determined by the
19991 @option{--with-ld} configure option, GCC's program search path, and
19992 finally by the user's @env{PATH}. The linker used by GCC can be printed
19993 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
19994 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
19995
19996 @item -mhp-ld
19997 @opindex mhp-ld
19998 Use options specific to HP @command{ld}.
19999 This passes @option{-b} to @command{ld} when building
20000 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20001 links. It is the default when GCC is configured, explicitly or
20002 implicitly, with the HP linker. This option does not affect
20003 which @command{ld} is called; it only changes what parameters are passed to that
20004 @command{ld}.
20005 The @command{ld} that is called is determined by the @option{--with-ld}
20006 configure option, GCC's program search path, and finally by the user's
20007 @env{PATH}. The linker used by GCC can be printed using @samp{which
20008 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20009 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20010
20011 @item -mlong-calls
20012 @opindex mno-long-calls
20013 @opindex mlong-calls
20014 Generate code that uses long call sequences. This ensures that a call
20015 is always able to reach linker generated stubs. The default is to generate
20016 long calls only when the distance from the call site to the beginning
20017 of the function or translation unit, as the case may be, exceeds a
20018 predefined limit set by the branch type being used. The limits for
20019 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20020 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20021 240,000 bytes.
20022
20023 Distances are measured from the beginning of functions when using the
20024 @option{-ffunction-sections} option, or when using the @option{-mgas}
20025 and @option{-mno-portable-runtime} options together under HP-UX with
20026 the SOM linker.
20027
20028 It is normally not desirable to use this option as it degrades
20029 performance. However, it may be useful in large applications,
20030 particularly when partial linking is used to build the application.
20031
20032 The types of long calls used depends on the capabilities of the
20033 assembler and linker, and the type of code being generated. The
20034 impact on systems that support long absolute calls, and long pic
20035 symbol-difference or pc-relative calls should be relatively small.
20036 However, an indirect call is used on 32-bit ELF systems in pic code
20037 and it is quite long.
20038
20039 @item -munix=@var{unix-std}
20040 @opindex march
20041 Generate compiler predefines and select a startfile for the specified
20042 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20043 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20044 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20045 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20046 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20047 and later.
20048
20049 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20050 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20051 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20052 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20053 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20054 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20055
20056 It is @emph{important} to note that this option changes the interfaces
20057 for various library routines. It also affects the operational behavior
20058 of the C library. Thus, @emph{extreme} care is needed in using this
20059 option.
20060
20061 Library code that is intended to operate with more than one UNIX
20062 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20063 as appropriate. Most GNU software doesn't provide this capability.
20064
20065 @item -nolibdld
20066 @opindex nolibdld
20067 Suppress the generation of link options to search libdld.sl when the
20068 @option{-static} option is specified on HP-UX 10 and later.
20069
20070 @item -static
20071 @opindex static
20072 The HP-UX implementation of setlocale in libc has a dependency on
20073 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20074 when the @option{-static} option is specified, special link options
20075 are needed to resolve this dependency.
20076
20077 On HP-UX 10 and later, the GCC driver adds the necessary options to
20078 link with libdld.sl when the @option{-static} option is specified.
20079 This causes the resulting binary to be dynamic. On the 64-bit port,
20080 the linkers generate dynamic binaries by default in any case. The
20081 @option{-nolibdld} option can be used to prevent the GCC driver from
20082 adding these link options.
20083
20084 @item -threads
20085 @opindex threads
20086 Add support for multithreading with the @dfn{dce thread} library
20087 under HP-UX@. This option sets flags for both the preprocessor and
20088 linker.
20089 @end table
20090
20091 @node IA-64 Options
20092 @subsection IA-64 Options
20093 @cindex IA-64 Options
20094
20095 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20096
20097 @table @gcctabopt
20098 @item -mbig-endian
20099 @opindex mbig-endian
20100 Generate code for a big-endian target. This is the default for HP-UX@.
20101
20102 @item -mlittle-endian
20103 @opindex mlittle-endian
20104 Generate code for a little-endian target. This is the default for AIX5
20105 and GNU/Linux.
20106
20107 @item -mgnu-as
20108 @itemx -mno-gnu-as
20109 @opindex mgnu-as
20110 @opindex mno-gnu-as
20111 Generate (or don't) code for the GNU assembler. This is the default.
20112 @c Also, this is the default if the configure option @option{--with-gnu-as}
20113 @c is used.
20114
20115 @item -mgnu-ld
20116 @itemx -mno-gnu-ld
20117 @opindex mgnu-ld
20118 @opindex mno-gnu-ld
20119 Generate (or don't) code for the GNU linker. This is the default.
20120 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20121 @c is used.
20122
20123 @item -mno-pic
20124 @opindex mno-pic
20125 Generate code that does not use a global pointer register. The result
20126 is not position independent code, and violates the IA-64 ABI@.
20127
20128 @item -mvolatile-asm-stop
20129 @itemx -mno-volatile-asm-stop
20130 @opindex mvolatile-asm-stop
20131 @opindex mno-volatile-asm-stop
20132 Generate (or don't) a stop bit immediately before and after volatile asm
20133 statements.
20134
20135 @item -mregister-names
20136 @itemx -mno-register-names
20137 @opindex mregister-names
20138 @opindex mno-register-names
20139 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20140 the stacked registers. This may make assembler output more readable.
20141
20142 @item -mno-sdata
20143 @itemx -msdata
20144 @opindex mno-sdata
20145 @opindex msdata
20146 Disable (or enable) optimizations that use the small data section. This may
20147 be useful for working around optimizer bugs.
20148
20149 @item -mconstant-gp
20150 @opindex mconstant-gp
20151 Generate code that uses a single constant global pointer value. This is
20152 useful when compiling kernel code.
20153
20154 @item -mauto-pic
20155 @opindex mauto-pic
20156 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20157 This is useful when compiling firmware code.
20158
20159 @item -minline-float-divide-min-latency
20160 @opindex minline-float-divide-min-latency
20161 Generate code for inline divides of floating-point values
20162 using the minimum latency algorithm.
20163
20164 @item -minline-float-divide-max-throughput
20165 @opindex minline-float-divide-max-throughput
20166 Generate code for inline divides of floating-point values
20167 using the maximum throughput algorithm.
20168
20169 @item -mno-inline-float-divide
20170 @opindex mno-inline-float-divide
20171 Do not generate inline code for divides of floating-point values.
20172
20173 @item -minline-int-divide-min-latency
20174 @opindex minline-int-divide-min-latency
20175 Generate code for inline divides of integer values
20176 using the minimum latency algorithm.
20177
20178 @item -minline-int-divide-max-throughput
20179 @opindex minline-int-divide-max-throughput
20180 Generate code for inline divides of integer values
20181 using the maximum throughput algorithm.
20182
20183 @item -mno-inline-int-divide
20184 @opindex mno-inline-int-divide
20185 @opindex minline-int-divide
20186 Do not generate inline code for divides of integer values.
20187
20188 @item -minline-sqrt-min-latency
20189 @opindex minline-sqrt-min-latency
20190 Generate code for inline square roots
20191 using the minimum latency algorithm.
20192
20193 @item -minline-sqrt-max-throughput
20194 @opindex minline-sqrt-max-throughput
20195 Generate code for inline square roots
20196 using the maximum throughput algorithm.
20197
20198 @item -mno-inline-sqrt
20199 @opindex mno-inline-sqrt
20200 Do not generate inline code for @code{sqrt}.
20201
20202 @item -mfused-madd
20203 @itemx -mno-fused-madd
20204 @opindex mfused-madd
20205 @opindex mno-fused-madd
20206 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20207 instructions. The default is to use these instructions.
20208
20209 @item -mno-dwarf2-asm
20210 @itemx -mdwarf2-asm
20211 @opindex mno-dwarf2-asm
20212 @opindex mdwarf2-asm
20213 Don't (or do) generate assembler code for the DWARF line number debugging
20214 info. This may be useful when not using the GNU assembler.
20215
20216 @item -mearly-stop-bits
20217 @itemx -mno-early-stop-bits
20218 @opindex mearly-stop-bits
20219 @opindex mno-early-stop-bits
20220 Allow stop bits to be placed earlier than immediately preceding the
20221 instruction that triggered the stop bit. This can improve instruction
20222 scheduling, but does not always do so.
20223
20224 @item -mfixed-range=@var{register-range}
20225 @opindex mfixed-range
20226 Generate code treating the given register range as fixed registers.
20227 A fixed register is one that the register allocator cannot use. This is
20228 useful when compiling kernel code. A register range is specified as
20229 two registers separated by a dash. Multiple register ranges can be
20230 specified separated by a comma.
20231
20232 @item -mtls-size=@var{tls-size}
20233 @opindex mtls-size
20234 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20235 64.
20236
20237 @item -mtune=@var{cpu-type}
20238 @opindex mtune
20239 Tune the instruction scheduling for a particular CPU, Valid values are
20240 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20241 and @samp{mckinley}.
20242
20243 @item -milp32
20244 @itemx -mlp64
20245 @opindex milp32
20246 @opindex mlp64
20247 Generate code for a 32-bit or 64-bit environment.
20248 The 32-bit environment sets int, long and pointer to 32 bits.
20249 The 64-bit environment sets int to 32 bits and long and pointer
20250 to 64 bits. These are HP-UX specific flags.
20251
20252 @item -mno-sched-br-data-spec
20253 @itemx -msched-br-data-spec
20254 @opindex mno-sched-br-data-spec
20255 @opindex msched-br-data-spec
20256 (Dis/En)able data speculative scheduling before reload.
20257 This results in generation of @code{ld.a} instructions and
20258 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20259 The default setting is disabled.
20260
20261 @item -msched-ar-data-spec
20262 @itemx -mno-sched-ar-data-spec
20263 @opindex msched-ar-data-spec
20264 @opindex mno-sched-ar-data-spec
20265 (En/Dis)able data speculative scheduling after reload.
20266 This results in generation of @code{ld.a} instructions and
20267 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20268 The default setting is enabled.
20269
20270 @item -mno-sched-control-spec
20271 @itemx -msched-control-spec
20272 @opindex mno-sched-control-spec
20273 @opindex msched-control-spec
20274 (Dis/En)able control speculative scheduling. This feature is
20275 available only during region scheduling (i.e.@: before reload).
20276 This results in generation of the @code{ld.s} instructions and
20277 the corresponding check instructions @code{chk.s}.
20278 The default setting is disabled.
20279
20280 @item -msched-br-in-data-spec
20281 @itemx -mno-sched-br-in-data-spec
20282 @opindex msched-br-in-data-spec
20283 @opindex mno-sched-br-in-data-spec
20284 (En/Dis)able speculative scheduling of the instructions that
20285 are dependent on the data speculative loads before reload.
20286 This is effective only with @option{-msched-br-data-spec} enabled.
20287 The default setting is enabled.
20288
20289 @item -msched-ar-in-data-spec
20290 @itemx -mno-sched-ar-in-data-spec
20291 @opindex msched-ar-in-data-spec
20292 @opindex mno-sched-ar-in-data-spec
20293 (En/Dis)able speculative scheduling of the instructions that
20294 are dependent on the data speculative loads after reload.
20295 This is effective only with @option{-msched-ar-data-spec} enabled.
20296 The default setting is enabled.
20297
20298 @item -msched-in-control-spec
20299 @itemx -mno-sched-in-control-spec
20300 @opindex msched-in-control-spec
20301 @opindex mno-sched-in-control-spec
20302 (En/Dis)able speculative scheduling of the instructions that
20303 are dependent on the control speculative loads.
20304 This is effective only with @option{-msched-control-spec} enabled.
20305 The default setting is enabled.
20306
20307 @item -mno-sched-prefer-non-data-spec-insns
20308 @itemx -msched-prefer-non-data-spec-insns
20309 @opindex mno-sched-prefer-non-data-spec-insns
20310 @opindex msched-prefer-non-data-spec-insns
20311 If enabled, data-speculative instructions are chosen for schedule
20312 only if there are no other choices at the moment. This makes
20313 the use of the data speculation much more conservative.
20314 The default setting is disabled.
20315
20316 @item -mno-sched-prefer-non-control-spec-insns
20317 @itemx -msched-prefer-non-control-spec-insns
20318 @opindex mno-sched-prefer-non-control-spec-insns
20319 @opindex msched-prefer-non-control-spec-insns
20320 If enabled, control-speculative instructions are chosen for schedule
20321 only if there are no other choices at the moment. This makes
20322 the use of the control speculation much more conservative.
20323 The default setting is disabled.
20324
20325 @item -mno-sched-count-spec-in-critical-path
20326 @itemx -msched-count-spec-in-critical-path
20327 @opindex mno-sched-count-spec-in-critical-path
20328 @opindex msched-count-spec-in-critical-path
20329 If enabled, speculative dependencies are considered during
20330 computation of the instructions priorities. This makes the use of the
20331 speculation a bit more conservative.
20332 The default setting is disabled.
20333
20334 @item -msched-spec-ldc
20335 @opindex msched-spec-ldc
20336 Use a simple data speculation check. This option is on by default.
20337
20338 @item -msched-control-spec-ldc
20339 @opindex msched-spec-ldc
20340 Use a simple check for control speculation. This option is on by default.
20341
20342 @item -msched-stop-bits-after-every-cycle
20343 @opindex msched-stop-bits-after-every-cycle
20344 Place a stop bit after every cycle when scheduling. This option is on
20345 by default.
20346
20347 @item -msched-fp-mem-deps-zero-cost
20348 @opindex msched-fp-mem-deps-zero-cost
20349 Assume that floating-point stores and loads are not likely to cause a conflict
20350 when placed into the same instruction group. This option is disabled by
20351 default.
20352
20353 @item -msel-sched-dont-check-control-spec
20354 @opindex msel-sched-dont-check-control-spec
20355 Generate checks for control speculation in selective scheduling.
20356 This flag is disabled by default.
20357
20358 @item -msched-max-memory-insns=@var{max-insns}
20359 @opindex msched-max-memory-insns
20360 Limit on the number of memory insns per instruction group, giving lower
20361 priority to subsequent memory insns attempting to schedule in the same
20362 instruction group. Frequently useful to prevent cache bank conflicts.
20363 The default value is 1.
20364
20365 @item -msched-max-memory-insns-hard-limit
20366 @opindex msched-max-memory-insns-hard-limit
20367 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20368 disallowing more than that number in an instruction group.
20369 Otherwise, the limit is ``soft'', meaning that non-memory operations
20370 are preferred when the limit is reached, but memory operations may still
20371 be scheduled.
20372
20373 @end table
20374
20375 @node LM32 Options
20376 @subsection LM32 Options
20377 @cindex LM32 options
20378
20379 These @option{-m} options are defined for the LatticeMico32 architecture:
20380
20381 @table @gcctabopt
20382 @item -mbarrel-shift-enabled
20383 @opindex mbarrel-shift-enabled
20384 Enable barrel-shift instructions.
20385
20386 @item -mdivide-enabled
20387 @opindex mdivide-enabled
20388 Enable divide and modulus instructions.
20389
20390 @item -mmultiply-enabled
20391 @opindex multiply-enabled
20392 Enable multiply instructions.
20393
20394 @item -msign-extend-enabled
20395 @opindex msign-extend-enabled
20396 Enable sign extend instructions.
20397
20398 @item -muser-enabled
20399 @opindex muser-enabled
20400 Enable user-defined instructions.
20401
20402 @end table
20403
20404 @node M32C Options
20405 @subsection M32C Options
20406 @cindex M32C options
20407
20408 @table @gcctabopt
20409 @item -mcpu=@var{name}
20410 @opindex mcpu=
20411 Select the CPU for which code is generated. @var{name} may be one of
20412 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20413 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20414 the M32C/80 series.
20415
20416 @item -msim
20417 @opindex msim
20418 Specifies that the program will be run on the simulator. This causes
20419 an alternate runtime library to be linked in which supports, for
20420 example, file I/O@. You must not use this option when generating
20421 programs that will run on real hardware; you must provide your own
20422 runtime library for whatever I/O functions are needed.
20423
20424 @item -memregs=@var{number}
20425 @opindex memregs=
20426 Specifies the number of memory-based pseudo-registers GCC uses
20427 during code generation. These pseudo-registers are used like real
20428 registers, so there is a tradeoff between GCC's ability to fit the
20429 code into available registers, and the performance penalty of using
20430 memory instead of registers. Note that all modules in a program must
20431 be compiled with the same value for this option. Because of that, you
20432 must not use this option with GCC's default runtime libraries.
20433
20434 @end table
20435
20436 @node M32R/D Options
20437 @subsection M32R/D Options
20438 @cindex M32R/D options
20439
20440 These @option{-m} options are defined for Renesas M32R/D architectures:
20441
20442 @table @gcctabopt
20443 @item -m32r2
20444 @opindex m32r2
20445 Generate code for the M32R/2@.
20446
20447 @item -m32rx
20448 @opindex m32rx
20449 Generate code for the M32R/X@.
20450
20451 @item -m32r
20452 @opindex m32r
20453 Generate code for the M32R@. This is the default.
20454
20455 @item -mmodel=small
20456 @opindex mmodel=small
20457 Assume all objects live in the lower 16MB of memory (so that their addresses
20458 can be loaded with the @code{ld24} instruction), and assume all subroutines
20459 are reachable with the @code{bl} instruction.
20460 This is the default.
20461
20462 The addressability of a particular object can be set with the
20463 @code{model} attribute.
20464
20465 @item -mmodel=medium
20466 @opindex mmodel=medium
20467 Assume objects may be anywhere in the 32-bit address space (the compiler
20468 generates @code{seth/add3} instructions to load their addresses), and
20469 assume all subroutines are reachable with the @code{bl} instruction.
20470
20471 @item -mmodel=large
20472 @opindex mmodel=large
20473 Assume objects may be anywhere in the 32-bit address space (the compiler
20474 generates @code{seth/add3} instructions to load their addresses), and
20475 assume subroutines may not be reachable with the @code{bl} instruction
20476 (the compiler generates the much slower @code{seth/add3/jl}
20477 instruction sequence).
20478
20479 @item -msdata=none
20480 @opindex msdata=none
20481 Disable use of the small data area. Variables are put into
20482 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20483 @code{section} attribute has been specified).
20484 This is the default.
20485
20486 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20487 Objects may be explicitly put in the small data area with the
20488 @code{section} attribute using one of these sections.
20489
20490 @item -msdata=sdata
20491 @opindex msdata=sdata
20492 Put small global and static data in the small data area, but do not
20493 generate special code to reference them.
20494
20495 @item -msdata=use
20496 @opindex msdata=use
20497 Put small global and static data in the small data area, and generate
20498 special instructions to reference them.
20499
20500 @item -G @var{num}
20501 @opindex G
20502 @cindex smaller data references
20503 Put global and static objects less than or equal to @var{num} bytes
20504 into the small data or BSS sections instead of the normal data or BSS
20505 sections. The default value of @var{num} is 8.
20506 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20507 for this option to have any effect.
20508
20509 All modules should be compiled with the same @option{-G @var{num}} value.
20510 Compiling with different values of @var{num} may or may not work; if it
20511 doesn't the linker gives an error message---incorrect code is not
20512 generated.
20513
20514 @item -mdebug
20515 @opindex mdebug
20516 Makes the M32R-specific code in the compiler display some statistics
20517 that might help in debugging programs.
20518
20519 @item -malign-loops
20520 @opindex malign-loops
20521 Align all loops to a 32-byte boundary.
20522
20523 @item -mno-align-loops
20524 @opindex mno-align-loops
20525 Do not enforce a 32-byte alignment for loops. This is the default.
20526
20527 @item -missue-rate=@var{number}
20528 @opindex missue-rate=@var{number}
20529 Issue @var{number} instructions per cycle. @var{number} can only be 1
20530 or 2.
20531
20532 @item -mbranch-cost=@var{number}
20533 @opindex mbranch-cost=@var{number}
20534 @var{number} can only be 1 or 2. If it is 1 then branches are
20535 preferred over conditional code, if it is 2, then the opposite applies.
20536
20537 @item -mflush-trap=@var{number}
20538 @opindex mflush-trap=@var{number}
20539 Specifies the trap number to use to flush the cache. The default is
20540 12. Valid numbers are between 0 and 15 inclusive.
20541
20542 @item -mno-flush-trap
20543 @opindex mno-flush-trap
20544 Specifies that the cache cannot be flushed by using a trap.
20545
20546 @item -mflush-func=@var{name}
20547 @opindex mflush-func=@var{name}
20548 Specifies the name of the operating system function to call to flush
20549 the cache. The default is @samp{_flush_cache}, but a function call
20550 is only used if a trap is not available.
20551
20552 @item -mno-flush-func
20553 @opindex mno-flush-func
20554 Indicates that there is no OS function for flushing the cache.
20555
20556 @end table
20557
20558 @node M680x0 Options
20559 @subsection M680x0 Options
20560 @cindex M680x0 options
20561
20562 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20563 The default settings depend on which architecture was selected when
20564 the compiler was configured; the defaults for the most common choices
20565 are given below.
20566
20567 @table @gcctabopt
20568 @item -march=@var{arch}
20569 @opindex march
20570 Generate code for a specific M680x0 or ColdFire instruction set
20571 architecture. Permissible values of @var{arch} for M680x0
20572 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20573 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20574 architectures are selected according to Freescale's ISA classification
20575 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20576 @samp{isab} and @samp{isac}.
20577
20578 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20579 code for a ColdFire target. The @var{arch} in this macro is one of the
20580 @option{-march} arguments given above.
20581
20582 When used together, @option{-march} and @option{-mtune} select code
20583 that runs on a family of similar processors but that is optimized
20584 for a particular microarchitecture.
20585
20586 @item -mcpu=@var{cpu}
20587 @opindex mcpu
20588 Generate code for a specific M680x0 or ColdFire processor.
20589 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20590 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20591 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20592 below, which also classifies the CPUs into families:
20593
20594 @multitable @columnfractions 0.20 0.80
20595 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20596 @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}
20597 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20598 @item @samp{5206e} @tab @samp{5206e}
20599 @item @samp{5208} @tab @samp{5207} @samp{5208}
20600 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20601 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20602 @item @samp{5216} @tab @samp{5214} @samp{5216}
20603 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20604 @item @samp{5225} @tab @samp{5224} @samp{5225}
20605 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20606 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20607 @item @samp{5249} @tab @samp{5249}
20608 @item @samp{5250} @tab @samp{5250}
20609 @item @samp{5271} @tab @samp{5270} @samp{5271}
20610 @item @samp{5272} @tab @samp{5272}
20611 @item @samp{5275} @tab @samp{5274} @samp{5275}
20612 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20613 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20614 @item @samp{5307} @tab @samp{5307}
20615 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20616 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20617 @item @samp{5407} @tab @samp{5407}
20618 @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}
20619 @end multitable
20620
20621 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20622 @var{arch} is compatible with @var{cpu}. Other combinations of
20623 @option{-mcpu} and @option{-march} are rejected.
20624
20625 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20626 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20627 where the value of @var{family} is given by the table above.
20628
20629 @item -mtune=@var{tune}
20630 @opindex mtune
20631 Tune the code for a particular microarchitecture within the
20632 constraints set by @option{-march} and @option{-mcpu}.
20633 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20634 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20635 and @samp{cpu32}. The ColdFire microarchitectures
20636 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20637
20638 You can also use @option{-mtune=68020-40} for code that needs
20639 to run relatively well on 68020, 68030 and 68040 targets.
20640 @option{-mtune=68020-60} is similar but includes 68060 targets
20641 as well. These two options select the same tuning decisions as
20642 @option{-m68020-40} and @option{-m68020-60} respectively.
20643
20644 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
20645 when tuning for 680x0 architecture @var{arch}. It also defines
20646 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
20647 option is used. If GCC is tuning for a range of architectures,
20648 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
20649 it defines the macros for every architecture in the range.
20650
20651 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
20652 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
20653 of the arguments given above.
20654
20655 @item -m68000
20656 @itemx -mc68000
20657 @opindex m68000
20658 @opindex mc68000
20659 Generate output for a 68000. This is the default
20660 when the compiler is configured for 68000-based systems.
20661 It is equivalent to @option{-march=68000}.
20662
20663 Use this option for microcontrollers with a 68000 or EC000 core,
20664 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20665
20666 @item -m68010
20667 @opindex m68010
20668 Generate output for a 68010. This is the default
20669 when the compiler is configured for 68010-based systems.
20670 It is equivalent to @option{-march=68010}.
20671
20672 @item -m68020
20673 @itemx -mc68020
20674 @opindex m68020
20675 @opindex mc68020
20676 Generate output for a 68020. This is the default
20677 when the compiler is configured for 68020-based systems.
20678 It is equivalent to @option{-march=68020}.
20679
20680 @item -m68030
20681 @opindex m68030
20682 Generate output for a 68030. This is the default when the compiler is
20683 configured for 68030-based systems. It is equivalent to
20684 @option{-march=68030}.
20685
20686 @item -m68040
20687 @opindex m68040
20688 Generate output for a 68040. This is the default when the compiler is
20689 configured for 68040-based systems. It is equivalent to
20690 @option{-march=68040}.
20691
20692 This option inhibits the use of 68881/68882 instructions that have to be
20693 emulated by software on the 68040. Use this option if your 68040 does not
20694 have code to emulate those instructions.
20695
20696 @item -m68060
20697 @opindex m68060
20698 Generate output for a 68060. This is the default when the compiler is
20699 configured for 68060-based systems. It is equivalent to
20700 @option{-march=68060}.
20701
20702 This option inhibits the use of 68020 and 68881/68882 instructions that
20703 have to be emulated by software on the 68060. Use this option if your 68060
20704 does not have code to emulate those instructions.
20705
20706 @item -mcpu32
20707 @opindex mcpu32
20708 Generate output for a CPU32. This is the default
20709 when the compiler is configured for CPU32-based systems.
20710 It is equivalent to @option{-march=cpu32}.
20711
20712 Use this option for microcontrollers with a
20713 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
20714 68336, 68340, 68341, 68349 and 68360.
20715
20716 @item -m5200
20717 @opindex m5200
20718 Generate output for a 520X ColdFire CPU@. This is the default
20719 when the compiler is configured for 520X-based systems.
20720 It is equivalent to @option{-mcpu=5206}, and is now deprecated
20721 in favor of that option.
20722
20723 Use this option for microcontroller with a 5200 core, including
20724 the MCF5202, MCF5203, MCF5204 and MCF5206.
20725
20726 @item -m5206e
20727 @opindex m5206e
20728 Generate output for a 5206e ColdFire CPU@. The option is now
20729 deprecated in favor of the equivalent @option{-mcpu=5206e}.
20730
20731 @item -m528x
20732 @opindex m528x
20733 Generate output for a member of the ColdFire 528X family.
20734 The option is now deprecated in favor of the equivalent
20735 @option{-mcpu=528x}.
20736
20737 @item -m5307
20738 @opindex m5307
20739 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
20740 in favor of the equivalent @option{-mcpu=5307}.
20741
20742 @item -m5407
20743 @opindex m5407
20744 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
20745 in favor of the equivalent @option{-mcpu=5407}.
20746
20747 @item -mcfv4e
20748 @opindex mcfv4e
20749 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
20750 This includes use of hardware floating-point instructions.
20751 The option is equivalent to @option{-mcpu=547x}, and is now
20752 deprecated in favor of that option.
20753
20754 @item -m68020-40
20755 @opindex m68020-40
20756 Generate output for a 68040, without using any of the new instructions.
20757 This results in code that can run relatively efficiently on either a
20758 68020/68881 or a 68030 or a 68040. The generated code does use the
20759 68881 instructions that are emulated on the 68040.
20760
20761 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
20762
20763 @item -m68020-60
20764 @opindex m68020-60
20765 Generate output for a 68060, without using any of the new instructions.
20766 This results in code that can run relatively efficiently on either a
20767 68020/68881 or a 68030 or a 68040. The generated code does use the
20768 68881 instructions that are emulated on the 68060.
20769
20770 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
20771
20772 @item -mhard-float
20773 @itemx -m68881
20774 @opindex mhard-float
20775 @opindex m68881
20776 Generate floating-point instructions. This is the default for 68020
20777 and above, and for ColdFire devices that have an FPU@. It defines the
20778 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
20779 on ColdFire targets.
20780
20781 @item -msoft-float
20782 @opindex msoft-float
20783 Do not generate floating-point instructions; use library calls instead.
20784 This is the default for 68000, 68010, and 68832 targets. It is also
20785 the default for ColdFire devices that have no FPU.
20786
20787 @item -mdiv
20788 @itemx -mno-div
20789 @opindex mdiv
20790 @opindex mno-div
20791 Generate (do not generate) ColdFire hardware divide and remainder
20792 instructions. If @option{-march} is used without @option{-mcpu},
20793 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
20794 architectures. Otherwise, the default is taken from the target CPU
20795 (either the default CPU, or the one specified by @option{-mcpu}). For
20796 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
20797 @option{-mcpu=5206e}.
20798
20799 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
20800
20801 @item -mshort
20802 @opindex mshort
20803 Consider type @code{int} to be 16 bits wide, like @code{short int}.
20804 Additionally, parameters passed on the stack are also aligned to a
20805 16-bit boundary even on targets whose API mandates promotion to 32-bit.
20806
20807 @item -mno-short
20808 @opindex mno-short
20809 Do not consider type @code{int} to be 16 bits wide. This is the default.
20810
20811 @item -mnobitfield
20812 @itemx -mno-bitfield
20813 @opindex mnobitfield
20814 @opindex mno-bitfield
20815 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
20816 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
20817
20818 @item -mbitfield
20819 @opindex mbitfield
20820 Do use the bit-field instructions. The @option{-m68020} option implies
20821 @option{-mbitfield}. This is the default if you use a configuration
20822 designed for a 68020.
20823
20824 @item -mrtd
20825 @opindex mrtd
20826 Use a different function-calling convention, in which functions
20827 that take a fixed number of arguments return with the @code{rtd}
20828 instruction, which pops their arguments while returning. This
20829 saves one instruction in the caller since there is no need to pop
20830 the arguments there.
20831
20832 This calling convention is incompatible with the one normally
20833 used on Unix, so you cannot use it if you need to call libraries
20834 compiled with the Unix compiler.
20835
20836 Also, you must provide function prototypes for all functions that
20837 take variable numbers of arguments (including @code{printf});
20838 otherwise incorrect code is generated for calls to those
20839 functions.
20840
20841 In addition, seriously incorrect code results if you call a
20842 function with too many arguments. (Normally, extra arguments are
20843 harmlessly ignored.)
20844
20845 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
20846 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
20847
20848 The default is @option{-mno-rtd}.
20849
20850 @item -malign-int
20851 @itemx -mno-align-int
20852 @opindex malign-int
20853 @opindex mno-align-int
20854 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
20855 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
20856 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
20857 Aligning variables on 32-bit boundaries produces code that runs somewhat
20858 faster on processors with 32-bit busses at the expense of more memory.
20859
20860 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
20861 aligns structures containing the above types differently than
20862 most published application binary interface specifications for the m68k.
20863
20864 @item -mpcrel
20865 @opindex mpcrel
20866 Use the pc-relative addressing mode of the 68000 directly, instead of
20867 using a global offset table. At present, this option implies @option{-fpic},
20868 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
20869 not presently supported with @option{-mpcrel}, though this could be supported for
20870 68020 and higher processors.
20871
20872 @item -mno-strict-align
20873 @itemx -mstrict-align
20874 @opindex mno-strict-align
20875 @opindex mstrict-align
20876 Do not (do) assume that unaligned memory references are handled by
20877 the system.
20878
20879 @item -msep-data
20880 Generate code that allows the data segment to be located in a different
20881 area of memory from the text segment. This allows for execute-in-place in
20882 an environment without virtual memory management. This option implies
20883 @option{-fPIC}.
20884
20885 @item -mno-sep-data
20886 Generate code that assumes that the data segment follows the text segment.
20887 This is the default.
20888
20889 @item -mid-shared-library
20890 Generate code that supports shared libraries via the library ID method.
20891 This allows for execute-in-place and shared libraries in an environment
20892 without virtual memory management. This option implies @option{-fPIC}.
20893
20894 @item -mno-id-shared-library
20895 Generate code that doesn't assume ID-based shared libraries are being used.
20896 This is the default.
20897
20898 @item -mshared-library-id=n
20899 Specifies the identification number of the ID-based shared library being
20900 compiled. Specifying a value of 0 generates more compact code; specifying
20901 other values forces the allocation of that number to the current
20902 library, but is no more space- or time-efficient than omitting this option.
20903
20904 @item -mxgot
20905 @itemx -mno-xgot
20906 @opindex mxgot
20907 @opindex mno-xgot
20908 When generating position-independent code for ColdFire, generate code
20909 that works if the GOT has more than 8192 entries. This code is
20910 larger and slower than code generated without this option. On M680x0
20911 processors, this option is not needed; @option{-fPIC} suffices.
20912
20913 GCC normally uses a single instruction to load values from the GOT@.
20914 While this is relatively efficient, it only works if the GOT
20915 is smaller than about 64k. Anything larger causes the linker
20916 to report an error such as:
20917
20918 @cindex relocation truncated to fit (ColdFire)
20919 @smallexample
20920 relocation truncated to fit: R_68K_GOT16O foobar
20921 @end smallexample
20922
20923 If this happens, you should recompile your code with @option{-mxgot}.
20924 It should then work with very large GOTs. However, code generated with
20925 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
20926 the value of a global symbol.
20927
20928 Note that some linkers, including newer versions of the GNU linker,
20929 can create multiple GOTs and sort GOT entries. If you have such a linker,
20930 you should only need to use @option{-mxgot} when compiling a single
20931 object file that accesses more than 8192 GOT entries. Very few do.
20932
20933 These options have no effect unless GCC is generating
20934 position-independent code.
20935
20936 @item -mlong-jump-table-offsets
20937 @opindex mlong-jump-table-offsets
20938 Use 32-bit offsets in @code{switch} tables. The default is to use
20939 16-bit offsets.
20940
20941 @end table
20942
20943 @node MCore Options
20944 @subsection MCore Options
20945 @cindex MCore options
20946
20947 These are the @samp{-m} options defined for the Motorola M*Core
20948 processors.
20949
20950 @table @gcctabopt
20951
20952 @item -mhardlit
20953 @itemx -mno-hardlit
20954 @opindex mhardlit
20955 @opindex mno-hardlit
20956 Inline constants into the code stream if it can be done in two
20957 instructions or less.
20958
20959 @item -mdiv
20960 @itemx -mno-div
20961 @opindex mdiv
20962 @opindex mno-div
20963 Use the divide instruction. (Enabled by default).
20964
20965 @item -mrelax-immediate
20966 @itemx -mno-relax-immediate
20967 @opindex mrelax-immediate
20968 @opindex mno-relax-immediate
20969 Allow arbitrary-sized immediates in bit operations.
20970
20971 @item -mwide-bitfields
20972 @itemx -mno-wide-bitfields
20973 @opindex mwide-bitfields
20974 @opindex mno-wide-bitfields
20975 Always treat bit-fields as @code{int}-sized.
20976
20977 @item -m4byte-functions
20978 @itemx -mno-4byte-functions
20979 @opindex m4byte-functions
20980 @opindex mno-4byte-functions
20981 Force all functions to be aligned to a 4-byte boundary.
20982
20983 @item -mcallgraph-data
20984 @itemx -mno-callgraph-data
20985 @opindex mcallgraph-data
20986 @opindex mno-callgraph-data
20987 Emit callgraph information.
20988
20989 @item -mslow-bytes
20990 @itemx -mno-slow-bytes
20991 @opindex mslow-bytes
20992 @opindex mno-slow-bytes
20993 Prefer word access when reading byte quantities.
20994
20995 @item -mlittle-endian
20996 @itemx -mbig-endian
20997 @opindex mlittle-endian
20998 @opindex mbig-endian
20999 Generate code for a little-endian target.
21000
21001 @item -m210
21002 @itemx -m340
21003 @opindex m210
21004 @opindex m340
21005 Generate code for the 210 processor.
21006
21007 @item -mno-lsim
21008 @opindex mno-lsim
21009 Assume that runtime support has been provided and so omit the
21010 simulator library (@file{libsim.a)} from the linker command line.
21011
21012 @item -mstack-increment=@var{size}
21013 @opindex mstack-increment
21014 Set the maximum amount for a single stack increment operation. Large
21015 values can increase the speed of programs that contain functions
21016 that need a large amount of stack space, but they can also trigger a
21017 segmentation fault if the stack is extended too much. The default
21018 value is 0x1000.
21019
21020 @end table
21021
21022 @node MeP Options
21023 @subsection MeP Options
21024 @cindex MeP options
21025
21026 @table @gcctabopt
21027
21028 @item -mabsdiff
21029 @opindex mabsdiff
21030 Enables the @code{abs} instruction, which is the absolute difference
21031 between two registers.
21032
21033 @item -mall-opts
21034 @opindex mall-opts
21035 Enables all the optional instructions---average, multiply, divide, bit
21036 operations, leading zero, absolute difference, min/max, clip, and
21037 saturation.
21038
21039
21040 @item -maverage
21041 @opindex maverage
21042 Enables the @code{ave} instruction, which computes the average of two
21043 registers.
21044
21045 @item -mbased=@var{n}
21046 @opindex mbased=
21047 Variables of size @var{n} bytes or smaller are placed in the
21048 @code{.based} section by default. Based variables use the @code{$tp}
21049 register as a base register, and there is a 128-byte limit to the
21050 @code{.based} section.
21051
21052 @item -mbitops
21053 @opindex mbitops
21054 Enables the bit operation instructions---bit test (@code{btstm}), set
21055 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21056 test-and-set (@code{tas}).
21057
21058 @item -mc=@var{name}
21059 @opindex mc=
21060 Selects which section constant data is placed in. @var{name} may
21061 be @samp{tiny}, @samp{near}, or @samp{far}.
21062
21063 @item -mclip
21064 @opindex mclip
21065 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21066 useful unless you also provide @option{-mminmax}.
21067
21068 @item -mconfig=@var{name}
21069 @opindex mconfig=
21070 Selects one of the built-in core configurations. Each MeP chip has
21071 one or more modules in it; each module has a core CPU and a variety of
21072 coprocessors, optional instructions, and peripherals. The
21073 @code{MeP-Integrator} tool, not part of GCC, provides these
21074 configurations through this option; using this option is the same as
21075 using all the corresponding command-line options. The default
21076 configuration is @samp{default}.
21077
21078 @item -mcop
21079 @opindex mcop
21080 Enables the coprocessor instructions. By default, this is a 32-bit
21081 coprocessor. Note that the coprocessor is normally enabled via the
21082 @option{-mconfig=} option.
21083
21084 @item -mcop32
21085 @opindex mcop32
21086 Enables the 32-bit coprocessor's instructions.
21087
21088 @item -mcop64
21089 @opindex mcop64
21090 Enables the 64-bit coprocessor's instructions.
21091
21092 @item -mivc2
21093 @opindex mivc2
21094 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21095
21096 @item -mdc
21097 @opindex mdc
21098 Causes constant variables to be placed in the @code{.near} section.
21099
21100 @item -mdiv
21101 @opindex mdiv
21102 Enables the @code{div} and @code{divu} instructions.
21103
21104 @item -meb
21105 @opindex meb
21106 Generate big-endian code.
21107
21108 @item -mel
21109 @opindex mel
21110 Generate little-endian code.
21111
21112 @item -mio-volatile
21113 @opindex mio-volatile
21114 Tells the compiler that any variable marked with the @code{io}
21115 attribute is to be considered volatile.
21116
21117 @item -ml
21118 @opindex ml
21119 Causes variables to be assigned to the @code{.far} section by default.
21120
21121 @item -mleadz
21122 @opindex mleadz
21123 Enables the @code{leadz} (leading zero) instruction.
21124
21125 @item -mm
21126 @opindex mm
21127 Causes variables to be assigned to the @code{.near} section by default.
21128
21129 @item -mminmax
21130 @opindex mminmax
21131 Enables the @code{min} and @code{max} instructions.
21132
21133 @item -mmult
21134 @opindex mmult
21135 Enables the multiplication and multiply-accumulate instructions.
21136
21137 @item -mno-opts
21138 @opindex mno-opts
21139 Disables all the optional instructions enabled by @option{-mall-opts}.
21140
21141 @item -mrepeat
21142 @opindex mrepeat
21143 Enables the @code{repeat} and @code{erepeat} instructions, used for
21144 low-overhead looping.
21145
21146 @item -ms
21147 @opindex ms
21148 Causes all variables to default to the @code{.tiny} section. Note
21149 that there is a 65536-byte limit to this section. Accesses to these
21150 variables use the @code{%gp} base register.
21151
21152 @item -msatur
21153 @opindex msatur
21154 Enables the saturation instructions. Note that the compiler does not
21155 currently generate these itself, but this option is included for
21156 compatibility with other tools, like @code{as}.
21157
21158 @item -msdram
21159 @opindex msdram
21160 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21161
21162 @item -msim
21163 @opindex msim
21164 Link the simulator run-time libraries.
21165
21166 @item -msimnovec
21167 @opindex msimnovec
21168 Link the simulator runtime libraries, excluding built-in support
21169 for reset and exception vectors and tables.
21170
21171 @item -mtf
21172 @opindex mtf
21173 Causes all functions to default to the @code{.far} section. Without
21174 this option, functions default to the @code{.near} section.
21175
21176 @item -mtiny=@var{n}
21177 @opindex mtiny=
21178 Variables that are @var{n} bytes or smaller are allocated to the
21179 @code{.tiny} section. These variables use the @code{$gp} base
21180 register. The default for this option is 4, but note that there's a
21181 65536-byte limit to the @code{.tiny} section.
21182
21183 @end table
21184
21185 @node MicroBlaze Options
21186 @subsection MicroBlaze Options
21187 @cindex MicroBlaze Options
21188
21189 @table @gcctabopt
21190
21191 @item -msoft-float
21192 @opindex msoft-float
21193 Use software emulation for floating point (default).
21194
21195 @item -mhard-float
21196 @opindex mhard-float
21197 Use hardware floating-point instructions.
21198
21199 @item -mmemcpy
21200 @opindex mmemcpy
21201 Do not optimize block moves, use @code{memcpy}.
21202
21203 @item -mno-clearbss
21204 @opindex mno-clearbss
21205 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21206
21207 @item -mcpu=@var{cpu-type}
21208 @opindex mcpu=
21209 Use features of, and schedule code for, the given CPU.
21210 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21211 where @var{X} is a major version, @var{YY} is the minor version, and
21212 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21213 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21214
21215 @item -mxl-soft-mul
21216 @opindex mxl-soft-mul
21217 Use software multiply emulation (default).
21218
21219 @item -mxl-soft-div
21220 @opindex mxl-soft-div
21221 Use software emulation for divides (default).
21222
21223 @item -mxl-barrel-shift
21224 @opindex mxl-barrel-shift
21225 Use the hardware barrel shifter.
21226
21227 @item -mxl-pattern-compare
21228 @opindex mxl-pattern-compare
21229 Use pattern compare instructions.
21230
21231 @item -msmall-divides
21232 @opindex msmall-divides
21233 Use table lookup optimization for small signed integer divisions.
21234
21235 @item -mxl-stack-check
21236 @opindex mxl-stack-check
21237 This option is deprecated. Use @option{-fstack-check} instead.
21238
21239 @item -mxl-gp-opt
21240 @opindex mxl-gp-opt
21241 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21242
21243 @item -mxl-multiply-high
21244 @opindex mxl-multiply-high
21245 Use multiply high instructions for high part of 32x32 multiply.
21246
21247 @item -mxl-float-convert
21248 @opindex mxl-float-convert
21249 Use hardware floating-point conversion instructions.
21250
21251 @item -mxl-float-sqrt
21252 @opindex mxl-float-sqrt
21253 Use hardware floating-point square root instruction.
21254
21255 @item -mbig-endian
21256 @opindex mbig-endian
21257 Generate code for a big-endian target.
21258
21259 @item -mlittle-endian
21260 @opindex mlittle-endian
21261 Generate code for a little-endian target.
21262
21263 @item -mxl-reorder
21264 @opindex mxl-reorder
21265 Use reorder instructions (swap and byte reversed load/store).
21266
21267 @item -mxl-mode-@var{app-model}
21268 Select application model @var{app-model}. Valid models are
21269 @table @samp
21270 @item executable
21271 normal executable (default), uses startup code @file{crt0.o}.
21272
21273 @item -mpic-data-is-text-relative
21274 @opindex mpic-data-is-text-relative
21275 Assume that the displacement between the text and data segments is fixed
21276 at static link time. This allows data to be referenced by offset from start of
21277 text address instead of GOT since PC-relative addressing is not supported.
21278
21279 @item xmdstub
21280 for use with Xilinx Microprocessor Debugger (XMD) based
21281 software intrusive debug agent called xmdstub. This uses startup file
21282 @file{crt1.o} and sets the start address of the program to 0x800.
21283
21284 @item bootstrap
21285 for applications that are loaded using a bootloader.
21286 This model uses startup file @file{crt2.o} which does not contain a processor
21287 reset vector handler. This is suitable for transferring control on a
21288 processor reset to the bootloader rather than the application.
21289
21290 @item novectors
21291 for applications that do not require any of the
21292 MicroBlaze vectors. This option may be useful for applications running
21293 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21294 @end table
21295
21296 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21297 @option{-mxl-mode-@var{app-model}}.
21298
21299 @end table
21300
21301 @node MIPS Options
21302 @subsection MIPS Options
21303 @cindex MIPS options
21304
21305 @table @gcctabopt
21306
21307 @item -EB
21308 @opindex EB
21309 Generate big-endian code.
21310
21311 @item -EL
21312 @opindex EL
21313 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21314 configurations.
21315
21316 @item -march=@var{arch}
21317 @opindex march
21318 Generate code that runs on @var{arch}, which can be the name of a
21319 generic MIPS ISA, or the name of a particular processor.
21320 The ISA names are:
21321 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21322 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21323 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21324 @samp{mips64r5} and @samp{mips64r6}.
21325 The processor names are:
21326 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21327 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21328 @samp{5kc}, @samp{5kf},
21329 @samp{20kc},
21330 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21331 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21332 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21333 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21334 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21335 @samp{i6400}, @samp{i6500},
21336 @samp{interaptiv},
21337 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21338 @samp{gs464e}, @samp{gs264e},
21339 @samp{m4k},
21340 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21341 @samp{m5100}, @samp{m5101},
21342 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21343 @samp{orion},
21344 @samp{p5600}, @samp{p6600},
21345 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21346 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21347 @samp{r6000}, @samp{r8000},
21348 @samp{rm7000}, @samp{rm9000},
21349 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21350 @samp{sb1},
21351 @samp{sr71000},
21352 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21353 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21354 @samp{xlr} and @samp{xlp}.
21355 The special value @samp{from-abi} selects the
21356 most compatible architecture for the selected ABI (that is,
21357 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21358
21359 The native Linux/GNU toolchain also supports the value @samp{native},
21360 which selects the best architecture option for the host processor.
21361 @option{-march=native} has no effect if GCC does not recognize
21362 the processor.
21363
21364 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21365 (for example, @option{-march=r2k}). Prefixes are optional, and
21366 @samp{vr} may be written @samp{r}.
21367
21368 Names of the form @samp{@var{n}f2_1} refer to processors with
21369 FPUs clocked at half the rate of the core, names of the form
21370 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21371 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21372 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21373 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21374 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21375 accepted as synonyms for @samp{@var{n}f1_1}.
21376
21377 GCC defines two macros based on the value of this option. The first
21378 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21379 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21380 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21381 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21382 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21383
21384 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21385 above. In other words, it has the full prefix and does not
21386 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21387 the macro names the resolved architecture (either @code{"mips1"} or
21388 @code{"mips3"}). It names the default architecture when no
21389 @option{-march} option is given.
21390
21391 @item -mtune=@var{arch}
21392 @opindex mtune
21393 Optimize for @var{arch}. Among other things, this option controls
21394 the way instructions are scheduled, and the perceived cost of arithmetic
21395 operations. The list of @var{arch} values is the same as for
21396 @option{-march}.
21397
21398 When this option is not used, GCC optimizes for the processor
21399 specified by @option{-march}. By using @option{-march} and
21400 @option{-mtune} together, it is possible to generate code that
21401 runs on a family of processors, but optimize the code for one
21402 particular member of that family.
21403
21404 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21405 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21406 @option{-march} ones described above.
21407
21408 @item -mips1
21409 @opindex mips1
21410 Equivalent to @option{-march=mips1}.
21411
21412 @item -mips2
21413 @opindex mips2
21414 Equivalent to @option{-march=mips2}.
21415
21416 @item -mips3
21417 @opindex mips3
21418 Equivalent to @option{-march=mips3}.
21419
21420 @item -mips4
21421 @opindex mips4
21422 Equivalent to @option{-march=mips4}.
21423
21424 @item -mips32
21425 @opindex mips32
21426 Equivalent to @option{-march=mips32}.
21427
21428 @item -mips32r3
21429 @opindex mips32r3
21430 Equivalent to @option{-march=mips32r3}.
21431
21432 @item -mips32r5
21433 @opindex mips32r5
21434 Equivalent to @option{-march=mips32r5}.
21435
21436 @item -mips32r6
21437 @opindex mips32r6
21438 Equivalent to @option{-march=mips32r6}.
21439
21440 @item -mips64
21441 @opindex mips64
21442 Equivalent to @option{-march=mips64}.
21443
21444 @item -mips64r2
21445 @opindex mips64r2
21446 Equivalent to @option{-march=mips64r2}.
21447
21448 @item -mips64r3
21449 @opindex mips64r3
21450 Equivalent to @option{-march=mips64r3}.
21451
21452 @item -mips64r5
21453 @opindex mips64r5
21454 Equivalent to @option{-march=mips64r5}.
21455
21456 @item -mips64r6
21457 @opindex mips64r6
21458 Equivalent to @option{-march=mips64r6}.
21459
21460 @item -mips16
21461 @itemx -mno-mips16
21462 @opindex mips16
21463 @opindex mno-mips16
21464 Generate (do not generate) MIPS16 code. If GCC is targeting a
21465 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21466
21467 MIPS16 code generation can also be controlled on a per-function basis
21468 by means of @code{mips16} and @code{nomips16} attributes.
21469 @xref{Function Attributes}, for more information.
21470
21471 @item -mflip-mips16
21472 @opindex mflip-mips16
21473 Generate MIPS16 code on alternating functions. This option is provided
21474 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21475 not intended for ordinary use in compiling user code.
21476
21477 @item -minterlink-compressed
21478 @itemx -mno-interlink-compressed
21479 @opindex minterlink-compressed
21480 @opindex mno-interlink-compressed
21481 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21482 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21483
21484 For example, code using the standard ISA encoding cannot jump directly
21485 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21486 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21487 knows that the target of the jump is not compressed.
21488
21489 @item -minterlink-mips16
21490 @itemx -mno-interlink-mips16
21491 @opindex minterlink-mips16
21492 @opindex mno-interlink-mips16
21493 Aliases of @option{-minterlink-compressed} and
21494 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21495 and are retained for backwards compatibility.
21496
21497 @item -mabi=32
21498 @itemx -mabi=o64
21499 @itemx -mabi=n32
21500 @itemx -mabi=64
21501 @itemx -mabi=eabi
21502 @opindex mabi=32
21503 @opindex mabi=o64
21504 @opindex mabi=n32
21505 @opindex mabi=64
21506 @opindex mabi=eabi
21507 Generate code for the given ABI@.
21508
21509 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21510 generates 64-bit code when you select a 64-bit architecture, but you
21511 can use @option{-mgp32} to get 32-bit code instead.
21512
21513 For information about the O64 ABI, see
21514 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21515
21516 GCC supports a variant of the o32 ABI in which floating-point registers
21517 are 64 rather than 32 bits wide. You can select this combination with
21518 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21519 and @code{mfhc1} instructions and is therefore only supported for
21520 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21521
21522 The register assignments for arguments and return values remain the
21523 same, but each scalar value is passed in a single 64-bit register
21524 rather than a pair of 32-bit registers. For example, scalar
21525 floating-point values are returned in @samp{$f0} only, not a
21526 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21527 remains the same in that the even-numbered double-precision registers
21528 are saved.
21529
21530 Two additional variants of the o32 ABI are supported to enable
21531 a transition from 32-bit to 64-bit registers. These are FPXX
21532 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21533 The FPXX extension mandates that all code must execute correctly
21534 when run using 32-bit or 64-bit registers. The code can be interlinked
21535 with either FP32 or FP64, but not both.
21536 The FP64A extension is similar to the FP64 extension but forbids the
21537 use of odd-numbered single-precision registers. This can be used
21538 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21539 processors and allows both FP32 and FP64A code to interlink and
21540 run in the same process without changing FPU modes.
21541
21542 @item -mabicalls
21543 @itemx -mno-abicalls
21544 @opindex mabicalls
21545 @opindex mno-abicalls
21546 Generate (do not generate) code that is suitable for SVR4-style
21547 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21548 systems.
21549
21550 @item -mshared
21551 @itemx -mno-shared
21552 Generate (do not generate) code that is fully position-independent,
21553 and that can therefore be linked into shared libraries. This option
21554 only affects @option{-mabicalls}.
21555
21556 All @option{-mabicalls} code has traditionally been position-independent,
21557 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21558 as an extension, the GNU toolchain allows executables to use absolute
21559 accesses for locally-binding symbols. It can also use shorter GP
21560 initialization sequences and generate direct calls to locally-defined
21561 functions. This mode is selected by @option{-mno-shared}.
21562
21563 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21564 objects that can only be linked by the GNU linker. However, the option
21565 does not affect the ABI of the final executable; it only affects the ABI
21566 of relocatable objects. Using @option{-mno-shared} generally makes
21567 executables both smaller and quicker.
21568
21569 @option{-mshared} is the default.
21570
21571 @item -mplt
21572 @itemx -mno-plt
21573 @opindex mplt
21574 @opindex mno-plt
21575 Assume (do not assume) that the static and dynamic linkers
21576 support PLTs and copy relocations. This option only affects
21577 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21578 has no effect without @option{-msym32}.
21579
21580 You can make @option{-mplt} the default by configuring
21581 GCC with @option{--with-mips-plt}. The default is
21582 @option{-mno-plt} otherwise.
21583
21584 @item -mxgot
21585 @itemx -mno-xgot
21586 @opindex mxgot
21587 @opindex mno-xgot
21588 Lift (do not lift) the usual restrictions on the size of the global
21589 offset table.
21590
21591 GCC normally uses a single instruction to load values from the GOT@.
21592 While this is relatively efficient, it only works if the GOT
21593 is smaller than about 64k. Anything larger causes the linker
21594 to report an error such as:
21595
21596 @cindex relocation truncated to fit (MIPS)
21597 @smallexample
21598 relocation truncated to fit: R_MIPS_GOT16 foobar
21599 @end smallexample
21600
21601 If this happens, you should recompile your code with @option{-mxgot}.
21602 This works with very large GOTs, although the code is also
21603 less efficient, since it takes three instructions to fetch the
21604 value of a global symbol.
21605
21606 Note that some linkers can create multiple GOTs. If you have such a
21607 linker, you should only need to use @option{-mxgot} when a single object
21608 file accesses more than 64k's worth of GOT entries. Very few do.
21609
21610 These options have no effect unless GCC is generating position
21611 independent code.
21612
21613 @item -mgp32
21614 @opindex mgp32
21615 Assume that general-purpose registers are 32 bits wide.
21616
21617 @item -mgp64
21618 @opindex mgp64
21619 Assume that general-purpose registers are 64 bits wide.
21620
21621 @item -mfp32
21622 @opindex mfp32
21623 Assume that floating-point registers are 32 bits wide.
21624
21625 @item -mfp64
21626 @opindex mfp64
21627 Assume that floating-point registers are 64 bits wide.
21628
21629 @item -mfpxx
21630 @opindex mfpxx
21631 Do not assume the width of floating-point registers.
21632
21633 @item -mhard-float
21634 @opindex mhard-float
21635 Use floating-point coprocessor instructions.
21636
21637 @item -msoft-float
21638 @opindex msoft-float
21639 Do not use floating-point coprocessor instructions. Implement
21640 floating-point calculations using library calls instead.
21641
21642 @item -mno-float
21643 @opindex mno-float
21644 Equivalent to @option{-msoft-float}, but additionally asserts that the
21645 program being compiled does not perform any floating-point operations.
21646 This option is presently supported only by some bare-metal MIPS
21647 configurations, where it may select a special set of libraries
21648 that lack all floating-point support (including, for example, the
21649 floating-point @code{printf} formats).
21650 If code compiled with @option{-mno-float} accidentally contains
21651 floating-point operations, it is likely to suffer a link-time
21652 or run-time failure.
21653
21654 @item -msingle-float
21655 @opindex msingle-float
21656 Assume that the floating-point coprocessor only supports single-precision
21657 operations.
21658
21659 @item -mdouble-float
21660 @opindex mdouble-float
21661 Assume that the floating-point coprocessor supports double-precision
21662 operations. This is the default.
21663
21664 @item -modd-spreg
21665 @itemx -mno-odd-spreg
21666 @opindex modd-spreg
21667 @opindex mno-odd-spreg
21668 Enable the use of odd-numbered single-precision floating-point registers
21669 for the o32 ABI. This is the default for processors that are known to
21670 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
21671 is set by default.
21672
21673 @item -mabs=2008
21674 @itemx -mabs=legacy
21675 @opindex mabs=2008
21676 @opindex mabs=legacy
21677 These options control the treatment of the special not-a-number (NaN)
21678 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
21679 @code{neg.@i{fmt}} machine instructions.
21680
21681 By default or when @option{-mabs=legacy} is used the legacy
21682 treatment is selected. In this case these instructions are considered
21683 arithmetic and avoided where correct operation is required and the
21684 input operand might be a NaN. A longer sequence of instructions that
21685 manipulate the sign bit of floating-point datum manually is used
21686 instead unless the @option{-ffinite-math-only} option has also been
21687 specified.
21688
21689 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
21690 this case these instructions are considered non-arithmetic and therefore
21691 operating correctly in all cases, including in particular where the
21692 input operand is a NaN. These instructions are therefore always used
21693 for the respective operations.
21694
21695 @item -mnan=2008
21696 @itemx -mnan=legacy
21697 @opindex mnan=2008
21698 @opindex mnan=legacy
21699 These options control the encoding of the special not-a-number (NaN)
21700 IEEE 754 floating-point data.
21701
21702 The @option{-mnan=legacy} option selects the legacy encoding. In this
21703 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21704 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
21705 by the first bit of their trailing significand field being 1.
21706
21707 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
21708 this case qNaNs are denoted by the first bit of their trailing
21709 significand field being 1, whereas sNaNs are denoted by the first bit of
21710 their trailing significand field being 0.
21711
21712 The default is @option{-mnan=legacy} unless GCC has been configured with
21713 @option{--with-nan=2008}.
21714
21715 @item -mllsc
21716 @itemx -mno-llsc
21717 @opindex mllsc
21718 @opindex mno-llsc
21719 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
21720 implement atomic memory built-in functions. When neither option is
21721 specified, GCC uses the instructions if the target architecture
21722 supports them.
21723
21724 @option{-mllsc} is useful if the runtime environment can emulate the
21725 instructions and @option{-mno-llsc} can be useful when compiling for
21726 nonstandard ISAs. You can make either option the default by
21727 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
21728 respectively. @option{--with-llsc} is the default for some
21729 configurations; see the installation documentation for details.
21730
21731 @item -mdsp
21732 @itemx -mno-dsp
21733 @opindex mdsp
21734 @opindex mno-dsp
21735 Use (do not use) revision 1 of the MIPS DSP ASE@.
21736 @xref{MIPS DSP Built-in Functions}. This option defines the
21737 preprocessor macro @code{__mips_dsp}. It also defines
21738 @code{__mips_dsp_rev} to 1.
21739
21740 @item -mdspr2
21741 @itemx -mno-dspr2
21742 @opindex mdspr2
21743 @opindex mno-dspr2
21744 Use (do not use) revision 2 of the MIPS DSP ASE@.
21745 @xref{MIPS DSP Built-in Functions}. This option defines the
21746 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
21747 It also defines @code{__mips_dsp_rev} to 2.
21748
21749 @item -msmartmips
21750 @itemx -mno-smartmips
21751 @opindex msmartmips
21752 @opindex mno-smartmips
21753 Use (do not use) the MIPS SmartMIPS ASE.
21754
21755 @item -mpaired-single
21756 @itemx -mno-paired-single
21757 @opindex mpaired-single
21758 @opindex mno-paired-single
21759 Use (do not use) paired-single floating-point instructions.
21760 @xref{MIPS Paired-Single Support}. This option requires
21761 hardware floating-point support to be enabled.
21762
21763 @item -mdmx
21764 @itemx -mno-mdmx
21765 @opindex mdmx
21766 @opindex mno-mdmx
21767 Use (do not use) MIPS Digital Media Extension instructions.
21768 This option can only be used when generating 64-bit code and requires
21769 hardware floating-point support to be enabled.
21770
21771 @item -mips3d
21772 @itemx -mno-mips3d
21773 @opindex mips3d
21774 @opindex mno-mips3d
21775 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
21776 The option @option{-mips3d} implies @option{-mpaired-single}.
21777
21778 @item -mmicromips
21779 @itemx -mno-micromips
21780 @opindex mmicromips
21781 @opindex mno-mmicromips
21782 Generate (do not generate) microMIPS code.
21783
21784 MicroMIPS code generation can also be controlled on a per-function basis
21785 by means of @code{micromips} and @code{nomicromips} attributes.
21786 @xref{Function Attributes}, for more information.
21787
21788 @item -mmt
21789 @itemx -mno-mt
21790 @opindex mmt
21791 @opindex mno-mt
21792 Use (do not use) MT Multithreading instructions.
21793
21794 @item -mmcu
21795 @itemx -mno-mcu
21796 @opindex mmcu
21797 @opindex mno-mcu
21798 Use (do not use) the MIPS MCU ASE instructions.
21799
21800 @item -meva
21801 @itemx -mno-eva
21802 @opindex meva
21803 @opindex mno-eva
21804 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
21805
21806 @item -mvirt
21807 @itemx -mno-virt
21808 @opindex mvirt
21809 @opindex mno-virt
21810 Use (do not use) the MIPS Virtualization (VZ) instructions.
21811
21812 @item -mxpa
21813 @itemx -mno-xpa
21814 @opindex mxpa
21815 @opindex mno-xpa
21816 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
21817
21818 @item -mcrc
21819 @itemx -mno-crc
21820 @opindex mcrc
21821 @opindex mno-crc
21822 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
21823
21824 @item -mginv
21825 @itemx -mno-ginv
21826 @opindex mginv
21827 @opindex mno-ginv
21828 Use (do not use) the MIPS Global INValidate (GINV) instructions.
21829
21830 @item -mloongson-mmi
21831 @itemx -mno-loongson-mmi
21832 @opindex mloongson-mmi
21833 @opindex mno-loongson-mmi
21834 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
21835
21836 @item -mloongson-ext
21837 @itemx -mno-loongson-ext
21838 @opindex mloongson-ext
21839 @opindex mno-loongson-ext
21840 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
21841
21842 @item -mloongson-ext2
21843 @itemx -mno-loongson-ext2
21844 @opindex mloongson-ext2
21845 @opindex mno-loongson-ext2
21846 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
21847
21848 @item -mlong64
21849 @opindex mlong64
21850 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
21851 an explanation of the default and the way that the pointer size is
21852 determined.
21853
21854 @item -mlong32
21855 @opindex mlong32
21856 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
21857
21858 The default size of @code{int}s, @code{long}s and pointers depends on
21859 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
21860 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
21861 32-bit @code{long}s. Pointers are the same size as @code{long}s,
21862 or the same size as integer registers, whichever is smaller.
21863
21864 @item -msym32
21865 @itemx -mno-sym32
21866 @opindex msym32
21867 @opindex mno-sym32
21868 Assume (do not assume) that all symbols have 32-bit values, regardless
21869 of the selected ABI@. This option is useful in combination with
21870 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
21871 to generate shorter and faster references to symbolic addresses.
21872
21873 @item -G @var{num}
21874 @opindex G
21875 Put definitions of externally-visible data in a small data section
21876 if that data is no bigger than @var{num} bytes. GCC can then generate
21877 more efficient accesses to the data; see @option{-mgpopt} for details.
21878
21879 The default @option{-G} option depends on the configuration.
21880
21881 @item -mlocal-sdata
21882 @itemx -mno-local-sdata
21883 @opindex mlocal-sdata
21884 @opindex mno-local-sdata
21885 Extend (do not extend) the @option{-G} behavior to local data too,
21886 such as to static variables in C@. @option{-mlocal-sdata} is the
21887 default for all configurations.
21888
21889 If the linker complains that an application is using too much small data,
21890 you might want to try rebuilding the less performance-critical parts with
21891 @option{-mno-local-sdata}. You might also want to build large
21892 libraries with @option{-mno-local-sdata}, so that the libraries leave
21893 more room for the main program.
21894
21895 @item -mextern-sdata
21896 @itemx -mno-extern-sdata
21897 @opindex mextern-sdata
21898 @opindex mno-extern-sdata
21899 Assume (do not assume) that externally-defined data is in
21900 a small data section if the size of that data is within the @option{-G} limit.
21901 @option{-mextern-sdata} is the default for all configurations.
21902
21903 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
21904 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
21905 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
21906 is placed in a small data section. If @var{Var} is defined by another
21907 module, you must either compile that module with a high-enough
21908 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
21909 definition. If @var{Var} is common, you must link the application
21910 with a high-enough @option{-G} setting.
21911
21912 The easiest way of satisfying these restrictions is to compile
21913 and link every module with the same @option{-G} option. However,
21914 you may wish to build a library that supports several different
21915 small data limits. You can do this by compiling the library with
21916 the highest supported @option{-G} setting and additionally using
21917 @option{-mno-extern-sdata} to stop the library from making assumptions
21918 about externally-defined data.
21919
21920 @item -mgpopt
21921 @itemx -mno-gpopt
21922 @opindex mgpopt
21923 @opindex mno-gpopt
21924 Use (do not use) GP-relative accesses for symbols that are known to be
21925 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
21926 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
21927 configurations.
21928
21929 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
21930 might not hold the value of @code{_gp}. For example, if the code is
21931 part of a library that might be used in a boot monitor, programs that
21932 call boot monitor routines pass an unknown value in @code{$gp}.
21933 (In such situations, the boot monitor itself is usually compiled
21934 with @option{-G0}.)
21935
21936 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
21937 @option{-mno-extern-sdata}.
21938
21939 @item -membedded-data
21940 @itemx -mno-embedded-data
21941 @opindex membedded-data
21942 @opindex mno-embedded-data
21943 Allocate variables to the read-only data section first if possible, then
21944 next in the small data section if possible, otherwise in data. This gives
21945 slightly slower code than the default, but reduces the amount of RAM required
21946 when executing, and thus may be preferred for some embedded systems.
21947
21948 @item -muninit-const-in-rodata
21949 @itemx -mno-uninit-const-in-rodata
21950 @opindex muninit-const-in-rodata
21951 @opindex mno-uninit-const-in-rodata
21952 Put uninitialized @code{const} variables in the read-only data section.
21953 This option is only meaningful in conjunction with @option{-membedded-data}.
21954
21955 @item -mcode-readable=@var{setting}
21956 @opindex mcode-readable
21957 Specify whether GCC may generate code that reads from executable sections.
21958 There are three possible settings:
21959
21960 @table @gcctabopt
21961 @item -mcode-readable=yes
21962 Instructions may freely access executable sections. This is the
21963 default setting.
21964
21965 @item -mcode-readable=pcrel
21966 MIPS16 PC-relative load instructions can access executable sections,
21967 but other instructions must not do so. This option is useful on 4KSc
21968 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
21969 It is also useful on processors that can be configured to have a dual
21970 instruction/data SRAM interface and that, like the M4K, automatically
21971 redirect PC-relative loads to the instruction RAM.
21972
21973 @item -mcode-readable=no
21974 Instructions must not access executable sections. This option can be
21975 useful on targets that are configured to have a dual instruction/data
21976 SRAM interface but that (unlike the M4K) do not automatically redirect
21977 PC-relative loads to the instruction RAM.
21978 @end table
21979
21980 @item -msplit-addresses
21981 @itemx -mno-split-addresses
21982 @opindex msplit-addresses
21983 @opindex mno-split-addresses
21984 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
21985 relocation operators. This option has been superseded by
21986 @option{-mexplicit-relocs} but is retained for backwards compatibility.
21987
21988 @item -mexplicit-relocs
21989 @itemx -mno-explicit-relocs
21990 @opindex mexplicit-relocs
21991 @opindex mno-explicit-relocs
21992 Use (do not use) assembler relocation operators when dealing with symbolic
21993 addresses. The alternative, selected by @option{-mno-explicit-relocs},
21994 is to use assembler macros instead.
21995
21996 @option{-mexplicit-relocs} is the default if GCC was configured
21997 to use an assembler that supports relocation operators.
21998
21999 @item -mcheck-zero-division
22000 @itemx -mno-check-zero-division
22001 @opindex mcheck-zero-division
22002 @opindex mno-check-zero-division
22003 Trap (do not trap) on integer division by zero.
22004
22005 The default is @option{-mcheck-zero-division}.
22006
22007 @item -mdivide-traps
22008 @itemx -mdivide-breaks
22009 @opindex mdivide-traps
22010 @opindex mdivide-breaks
22011 MIPS systems check for division by zero by generating either a
22012 conditional trap or a break instruction. Using traps results in
22013 smaller code, but is only supported on MIPS II and later. Also, some
22014 versions of the Linux kernel have a bug that prevents trap from
22015 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22016 allow conditional traps on architectures that support them and
22017 @option{-mdivide-breaks} to force the use of breaks.
22018
22019 The default is usually @option{-mdivide-traps}, but this can be
22020 overridden at configure time using @option{--with-divide=breaks}.
22021 Divide-by-zero checks can be completely disabled using
22022 @option{-mno-check-zero-division}.
22023
22024 @item -mload-store-pairs
22025 @itemx -mno-load-store-pairs
22026 @opindex mload-store-pairs
22027 @opindex mno-load-store-pairs
22028 Enable (disable) an optimization that pairs consecutive load or store
22029 instructions to enable load/store bonding. This option is enabled by
22030 default but only takes effect when the selected architecture is known
22031 to support bonding.
22032
22033 @item -mmemcpy
22034 @itemx -mno-memcpy
22035 @opindex mmemcpy
22036 @opindex mno-memcpy
22037 Force (do not force) the use of @code{memcpy} for non-trivial block
22038 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22039 most constant-sized copies.
22040
22041 @item -mlong-calls
22042 @itemx -mno-long-calls
22043 @opindex mlong-calls
22044 @opindex mno-long-calls
22045 Disable (do not disable) use of the @code{jal} instruction. Calling
22046 functions using @code{jal} is more efficient but requires the caller
22047 and callee to be in the same 256 megabyte segment.
22048
22049 This option has no effect on abicalls code. The default is
22050 @option{-mno-long-calls}.
22051
22052 @item -mmad
22053 @itemx -mno-mad
22054 @opindex mmad
22055 @opindex mno-mad
22056 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22057 instructions, as provided by the R4650 ISA@.
22058
22059 @item -mimadd
22060 @itemx -mno-imadd
22061 @opindex mimadd
22062 @opindex mno-imadd
22063 Enable (disable) use of the @code{madd} and @code{msub} integer
22064 instructions. The default is @option{-mimadd} on architectures
22065 that support @code{madd} and @code{msub} except for the 74k
22066 architecture where it was found to generate slower code.
22067
22068 @item -mfused-madd
22069 @itemx -mno-fused-madd
22070 @opindex mfused-madd
22071 @opindex mno-fused-madd
22072 Enable (disable) use of the floating-point multiply-accumulate
22073 instructions, when they are available. The default is
22074 @option{-mfused-madd}.
22075
22076 On the R8000 CPU when multiply-accumulate instructions are used,
22077 the intermediate product is calculated to infinite precision
22078 and is not subject to the FCSR Flush to Zero bit. This may be
22079 undesirable in some circumstances. On other processors the result
22080 is numerically identical to the equivalent computation using
22081 separate multiply, add, subtract and negate instructions.
22082
22083 @item -nocpp
22084 @opindex nocpp
22085 Tell the MIPS assembler to not run its preprocessor over user
22086 assembler files (with a @samp{.s} suffix) when assembling them.
22087
22088 @item -mfix-24k
22089 @itemx -mno-fix-24k
22090 @opindex mfix-24k
22091 @opindex mno-fix-24k
22092 Work around the 24K E48 (lost data on stores during refill) errata.
22093 The workarounds are implemented by the assembler rather than by GCC@.
22094
22095 @item -mfix-r4000
22096 @itemx -mno-fix-r4000
22097 @opindex mfix-r4000
22098 @opindex mno-fix-r4000
22099 Work around certain R4000 CPU errata:
22100 @itemize @minus
22101 @item
22102 A double-word or a variable shift may give an incorrect result if executed
22103 immediately after starting an integer division.
22104 @item
22105 A double-word or a variable shift may give an incorrect result if executed
22106 while an integer multiplication is in progress.
22107 @item
22108 An integer division may give an incorrect result if started in a delay slot
22109 of a taken branch or a jump.
22110 @end itemize
22111
22112 @item -mfix-r4400
22113 @itemx -mno-fix-r4400
22114 @opindex mfix-r4400
22115 @opindex mno-fix-r4400
22116 Work around certain R4400 CPU errata:
22117 @itemize @minus
22118 @item
22119 A double-word or a variable shift may give an incorrect result if executed
22120 immediately after starting an integer division.
22121 @end itemize
22122
22123 @item -mfix-r10000
22124 @itemx -mno-fix-r10000
22125 @opindex mfix-r10000
22126 @opindex mno-fix-r10000
22127 Work around certain R10000 errata:
22128 @itemize @minus
22129 @item
22130 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22131 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22132 @end itemize
22133
22134 This option can only be used if the target architecture supports
22135 branch-likely instructions. @option{-mfix-r10000} is the default when
22136 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22137 otherwise.
22138
22139 @item -mfix-r5900
22140 @itemx -mno-fix-r5900
22141 @opindex mfix-r5900
22142 Do not attempt to schedule the preceding instruction into the delay slot
22143 of a branch instruction placed at the end of a short loop of six
22144 instructions or fewer and always schedule a @code{nop} instruction there
22145 instead. The short loop bug under certain conditions causes loops to
22146 execute only once or twice, due to a hardware bug in the R5900 chip. The
22147 workaround is implemented by the assembler rather than by GCC@.
22148
22149 @item -mfix-rm7000
22150 @itemx -mno-fix-rm7000
22151 @opindex mfix-rm7000
22152 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22153 workarounds are implemented by the assembler rather than by GCC@.
22154
22155 @item -mfix-vr4120
22156 @itemx -mno-fix-vr4120
22157 @opindex mfix-vr4120
22158 Work around certain VR4120 errata:
22159 @itemize @minus
22160 @item
22161 @code{dmultu} does not always produce the correct result.
22162 @item
22163 @code{div} and @code{ddiv} do not always produce the correct result if one
22164 of the operands is negative.
22165 @end itemize
22166 The workarounds for the division errata rely on special functions in
22167 @file{libgcc.a}. At present, these functions are only provided by
22168 the @code{mips64vr*-elf} configurations.
22169
22170 Other VR4120 errata require a NOP to be inserted between certain pairs of
22171 instructions. These errata are handled by the assembler, not by GCC itself.
22172
22173 @item -mfix-vr4130
22174 @opindex mfix-vr4130
22175 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22176 workarounds are implemented by the assembler rather than by GCC,
22177 although GCC avoids using @code{mflo} and @code{mfhi} if the
22178 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22179 instructions are available instead.
22180
22181 @item -mfix-sb1
22182 @itemx -mno-fix-sb1
22183 @opindex mfix-sb1
22184 Work around certain SB-1 CPU core errata.
22185 (This flag currently works around the SB-1 revision 2
22186 ``F1'' and ``F2'' floating-point errata.)
22187
22188 @item -mr10k-cache-barrier=@var{setting}
22189 @opindex mr10k-cache-barrier
22190 Specify whether GCC should insert cache barriers to avoid the
22191 side effects of speculation on R10K processors.
22192
22193 In common with many processors, the R10K tries to predict the outcome
22194 of a conditional branch and speculatively executes instructions from
22195 the ``taken'' branch. It later aborts these instructions if the
22196 predicted outcome is wrong. However, on the R10K, even aborted
22197 instructions can have side effects.
22198
22199 This problem only affects kernel stores and, depending on the system,
22200 kernel loads. As an example, a speculatively-executed store may load
22201 the target memory into cache and mark the cache line as dirty, even if
22202 the store itself is later aborted. If a DMA operation writes to the
22203 same area of memory before the ``dirty'' line is flushed, the cached
22204 data overwrites the DMA-ed data. See the R10K processor manual
22205 for a full description, including other potential problems.
22206
22207 One workaround is to insert cache barrier instructions before every memory
22208 access that might be speculatively executed and that might have side
22209 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22210 controls GCC's implementation of this workaround. It assumes that
22211 aborted accesses to any byte in the following regions does not have
22212 side effects:
22213
22214 @enumerate
22215 @item
22216 the memory occupied by the current function's stack frame;
22217
22218 @item
22219 the memory occupied by an incoming stack argument;
22220
22221 @item
22222 the memory occupied by an object with a link-time-constant address.
22223 @end enumerate
22224
22225 It is the kernel's responsibility to ensure that speculative
22226 accesses to these regions are indeed safe.
22227
22228 If the input program contains a function declaration such as:
22229
22230 @smallexample
22231 void foo (void);
22232 @end smallexample
22233
22234 then the implementation of @code{foo} must allow @code{j foo} and
22235 @code{jal foo} to be executed speculatively. GCC honors this
22236 restriction for functions it compiles itself. It expects non-GCC
22237 functions (such as hand-written assembly code) to do the same.
22238
22239 The option has three forms:
22240
22241 @table @gcctabopt
22242 @item -mr10k-cache-barrier=load-store
22243 Insert a cache barrier before a load or store that might be
22244 speculatively executed and that might have side effects even
22245 if aborted.
22246
22247 @item -mr10k-cache-barrier=store
22248 Insert a cache barrier before a store that might be speculatively
22249 executed and that might have side effects even if aborted.
22250
22251 @item -mr10k-cache-barrier=none
22252 Disable the insertion of cache barriers. This is the default setting.
22253 @end table
22254
22255 @item -mflush-func=@var{func}
22256 @itemx -mno-flush-func
22257 @opindex mflush-func
22258 Specifies the function to call to flush the I and D caches, or to not
22259 call any such function. If called, the function must take the same
22260 arguments as the common @code{_flush_func}, that is, the address of the
22261 memory range for which the cache is being flushed, the size of the
22262 memory range, and the number 3 (to flush both caches). The default
22263 depends on the target GCC was configured for, but commonly is either
22264 @code{_flush_func} or @code{__cpu_flush}.
22265
22266 @item mbranch-cost=@var{num}
22267 @opindex mbranch-cost
22268 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22269 This cost is only a heuristic and is not guaranteed to produce
22270 consistent results across releases. A zero cost redundantly selects
22271 the default, which is based on the @option{-mtune} setting.
22272
22273 @item -mbranch-likely
22274 @itemx -mno-branch-likely
22275 @opindex mbranch-likely
22276 @opindex mno-branch-likely
22277 Enable or disable use of Branch Likely instructions, regardless of the
22278 default for the selected architecture. By default, Branch Likely
22279 instructions may be generated if they are supported by the selected
22280 architecture. An exception is for the MIPS32 and MIPS64 architectures
22281 and processors that implement those architectures; for those, Branch
22282 Likely instructions are not be generated by default because the MIPS32
22283 and MIPS64 architectures specifically deprecate their use.
22284
22285 @item -mcompact-branches=never
22286 @itemx -mcompact-branches=optimal
22287 @itemx -mcompact-branches=always
22288 @opindex mcompact-branches=never
22289 @opindex mcompact-branches=optimal
22290 @opindex mcompact-branches=always
22291 These options control which form of branches will be generated. The
22292 default is @option{-mcompact-branches=optimal}.
22293
22294 The @option{-mcompact-branches=never} option ensures that compact branch
22295 instructions will never be generated.
22296
22297 The @option{-mcompact-branches=always} option ensures that a compact
22298 branch instruction will be generated if available. If a compact branch
22299 instruction is not available, a delay slot form of the branch will be
22300 used instead.
22301
22302 This option is supported from MIPS Release 6 onwards.
22303
22304 The @option{-mcompact-branches=optimal} option will cause a delay slot
22305 branch to be used if one is available in the current ISA and the delay
22306 slot is successfully filled. If the delay slot is not filled, a compact
22307 branch will be chosen if one is available.
22308
22309 @item -mfp-exceptions
22310 @itemx -mno-fp-exceptions
22311 @opindex mfp-exceptions
22312 Specifies whether FP exceptions are enabled. This affects how
22313 FP instructions are scheduled for some processors.
22314 The default is that FP exceptions are
22315 enabled.
22316
22317 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22318 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22319 FP pipe.
22320
22321 @item -mvr4130-align
22322 @itemx -mno-vr4130-align
22323 @opindex mvr4130-align
22324 The VR4130 pipeline is two-way superscalar, but can only issue two
22325 instructions together if the first one is 8-byte aligned. When this
22326 option is enabled, GCC aligns pairs of instructions that it
22327 thinks should execute in parallel.
22328
22329 This option only has an effect when optimizing for the VR4130.
22330 It normally makes code faster, but at the expense of making it bigger.
22331 It is enabled by default at optimization level @option{-O3}.
22332
22333 @item -msynci
22334 @itemx -mno-synci
22335 @opindex msynci
22336 Enable (disable) generation of @code{synci} instructions on
22337 architectures that support it. The @code{synci} instructions (if
22338 enabled) are generated when @code{__builtin___clear_cache} is
22339 compiled.
22340
22341 This option defaults to @option{-mno-synci}, but the default can be
22342 overridden by configuring GCC with @option{--with-synci}.
22343
22344 When compiling code for single processor systems, it is generally safe
22345 to use @code{synci}. However, on many multi-core (SMP) systems, it
22346 does not invalidate the instruction caches on all cores and may lead
22347 to undefined behavior.
22348
22349 @item -mrelax-pic-calls
22350 @itemx -mno-relax-pic-calls
22351 @opindex mrelax-pic-calls
22352 Try to turn PIC calls that are normally dispatched via register
22353 @code{$25} into direct calls. This is only possible if the linker can
22354 resolve the destination at link time and if the destination is within
22355 range for a direct call.
22356
22357 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22358 an assembler and a linker that support the @code{.reloc} assembly
22359 directive and @option{-mexplicit-relocs} is in effect. With
22360 @option{-mno-explicit-relocs}, this optimization can be performed by the
22361 assembler and the linker alone without help from the compiler.
22362
22363 @item -mmcount-ra-address
22364 @itemx -mno-mcount-ra-address
22365 @opindex mmcount-ra-address
22366 @opindex mno-mcount-ra-address
22367 Emit (do not emit) code that allows @code{_mcount} to modify the
22368 calling function's return address. When enabled, this option extends
22369 the usual @code{_mcount} interface with a new @var{ra-address}
22370 parameter, which has type @code{intptr_t *} and is passed in register
22371 @code{$12}. @code{_mcount} can then modify the return address by
22372 doing both of the following:
22373 @itemize
22374 @item
22375 Returning the new address in register @code{$31}.
22376 @item
22377 Storing the new address in @code{*@var{ra-address}},
22378 if @var{ra-address} is nonnull.
22379 @end itemize
22380
22381 The default is @option{-mno-mcount-ra-address}.
22382
22383 @item -mframe-header-opt
22384 @itemx -mno-frame-header-opt
22385 @opindex mframe-header-opt
22386 Enable (disable) frame header optimization in the o32 ABI. When using the
22387 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22388 function to write out register arguments. When enabled, this optimization
22389 will suppress the allocation of the frame header if it can be determined that
22390 it is unused.
22391
22392 This optimization is off by default at all optimization levels.
22393
22394 @item -mlxc1-sxc1
22395 @itemx -mno-lxc1-sxc1
22396 @opindex mlxc1-sxc1
22397 When applicable, enable (disable) the generation of @code{lwxc1},
22398 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22399
22400 @item -mmadd4
22401 @itemx -mno-madd4
22402 @opindex mmadd4
22403 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22404 @code{madd.d} and related instructions. Enabled by default.
22405
22406 @end table
22407
22408 @node MMIX Options
22409 @subsection MMIX Options
22410 @cindex MMIX Options
22411
22412 These options are defined for the MMIX:
22413
22414 @table @gcctabopt
22415 @item -mlibfuncs
22416 @itemx -mno-libfuncs
22417 @opindex mlibfuncs
22418 @opindex mno-libfuncs
22419 Specify that intrinsic library functions are being compiled, passing all
22420 values in registers, no matter the size.
22421
22422 @item -mepsilon
22423 @itemx -mno-epsilon
22424 @opindex mepsilon
22425 @opindex mno-epsilon
22426 Generate floating-point comparison instructions that compare with respect
22427 to the @code{rE} epsilon register.
22428
22429 @item -mabi=mmixware
22430 @itemx -mabi=gnu
22431 @opindex mabi=mmixware
22432 @opindex mabi=gnu
22433 Generate code that passes function parameters and return values that (in
22434 the called function) are seen as registers @code{$0} and up, as opposed to
22435 the GNU ABI which uses global registers @code{$231} and up.
22436
22437 @item -mzero-extend
22438 @itemx -mno-zero-extend
22439 @opindex mzero-extend
22440 @opindex mno-zero-extend
22441 When reading data from memory in sizes shorter than 64 bits, use (do not
22442 use) zero-extending load instructions by default, rather than
22443 sign-extending ones.
22444
22445 @item -mknuthdiv
22446 @itemx -mno-knuthdiv
22447 @opindex mknuthdiv
22448 @opindex mno-knuthdiv
22449 Make the result of a division yielding a remainder have the same sign as
22450 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22451 remainder follows the sign of the dividend. Both methods are
22452 arithmetically valid, the latter being almost exclusively used.
22453
22454 @item -mtoplevel-symbols
22455 @itemx -mno-toplevel-symbols
22456 @opindex mtoplevel-symbols
22457 @opindex mno-toplevel-symbols
22458 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22459 code can be used with the @code{PREFIX} assembly directive.
22460
22461 @item -melf
22462 @opindex melf
22463 Generate an executable in the ELF format, rather than the default
22464 @samp{mmo} format used by the @command{mmix} simulator.
22465
22466 @item -mbranch-predict
22467 @itemx -mno-branch-predict
22468 @opindex mbranch-predict
22469 @opindex mno-branch-predict
22470 Use (do not use) the probable-branch instructions, when static branch
22471 prediction indicates a probable branch.
22472
22473 @item -mbase-addresses
22474 @itemx -mno-base-addresses
22475 @opindex mbase-addresses
22476 @opindex mno-base-addresses
22477 Generate (do not generate) code that uses @emph{base addresses}. Using a
22478 base address automatically generates a request (handled by the assembler
22479 and the linker) for a constant to be set up in a global register. The
22480 register is used for one or more base address requests within the range 0
22481 to 255 from the value held in the register. The generally leads to short
22482 and fast code, but the number of different data items that can be
22483 addressed is limited. This means that a program that uses lots of static
22484 data may require @option{-mno-base-addresses}.
22485
22486 @item -msingle-exit
22487 @itemx -mno-single-exit
22488 @opindex msingle-exit
22489 @opindex mno-single-exit
22490 Force (do not force) generated code to have a single exit point in each
22491 function.
22492 @end table
22493
22494 @node MN10300 Options
22495 @subsection MN10300 Options
22496 @cindex MN10300 options
22497
22498 These @option{-m} options are defined for Matsushita MN10300 architectures:
22499
22500 @table @gcctabopt
22501 @item -mmult-bug
22502 @opindex mmult-bug
22503 Generate code to avoid bugs in the multiply instructions for the MN10300
22504 processors. This is the default.
22505
22506 @item -mno-mult-bug
22507 @opindex mno-mult-bug
22508 Do not generate code to avoid bugs in the multiply instructions for the
22509 MN10300 processors.
22510
22511 @item -mam33
22512 @opindex mam33
22513 Generate code using features specific to the AM33 processor.
22514
22515 @item -mno-am33
22516 @opindex mno-am33
22517 Do not generate code using features specific to the AM33 processor. This
22518 is the default.
22519
22520 @item -mam33-2
22521 @opindex mam33-2
22522 Generate code using features specific to the AM33/2.0 processor.
22523
22524 @item -mam34
22525 @opindex mam34
22526 Generate code using features specific to the AM34 processor.
22527
22528 @item -mtune=@var{cpu-type}
22529 @opindex mtune
22530 Use the timing characteristics of the indicated CPU type when
22531 scheduling instructions. This does not change the targeted processor
22532 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22533 @samp{am33-2} or @samp{am34}.
22534
22535 @item -mreturn-pointer-on-d0
22536 @opindex mreturn-pointer-on-d0
22537 When generating a function that returns a pointer, return the pointer
22538 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22539 only in @code{a0}, and attempts to call such functions without a prototype
22540 result in errors. Note that this option is on by default; use
22541 @option{-mno-return-pointer-on-d0} to disable it.
22542
22543 @item -mno-crt0
22544 @opindex mno-crt0
22545 Do not link in the C run-time initialization object file.
22546
22547 @item -mrelax
22548 @opindex mrelax
22549 Indicate to the linker that it should perform a relaxation optimization pass
22550 to shorten branches, calls and absolute memory addresses. This option only
22551 has an effect when used on the command line for the final link step.
22552
22553 This option makes symbolic debugging impossible.
22554
22555 @item -mliw
22556 @opindex mliw
22557 Allow the compiler to generate @emph{Long Instruction Word}
22558 instructions if the target is the @samp{AM33} or later. This is the
22559 default. This option defines the preprocessor macro @code{__LIW__}.
22560
22561 @item -mno-liw
22562 @opindex mno-liw
22563 Do not allow the compiler to generate @emph{Long Instruction Word}
22564 instructions. This option defines the preprocessor macro
22565 @code{__NO_LIW__}.
22566
22567 @item -msetlb
22568 @opindex msetlb
22569 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22570 instructions if the target is the @samp{AM33} or later. This is the
22571 default. This option defines the preprocessor macro @code{__SETLB__}.
22572
22573 @item -mno-setlb
22574 @opindex mno-setlb
22575 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22576 instructions. This option defines the preprocessor macro
22577 @code{__NO_SETLB__}.
22578
22579 @end table
22580
22581 @node Moxie Options
22582 @subsection Moxie Options
22583 @cindex Moxie Options
22584
22585 @table @gcctabopt
22586
22587 @item -meb
22588 @opindex meb
22589 Generate big-endian code. This is the default for @samp{moxie-*-*}
22590 configurations.
22591
22592 @item -mel
22593 @opindex mel
22594 Generate little-endian code.
22595
22596 @item -mmul.x
22597 @opindex mmul.x
22598 Generate mul.x and umul.x instructions. This is the default for
22599 @samp{moxiebox-*-*} configurations.
22600
22601 @item -mno-crt0
22602 @opindex mno-crt0
22603 Do not link in the C run-time initialization object file.
22604
22605 @end table
22606
22607 @node MSP430 Options
22608 @subsection MSP430 Options
22609 @cindex MSP430 Options
22610
22611 These options are defined for the MSP430:
22612
22613 @table @gcctabopt
22614
22615 @item -masm-hex
22616 @opindex masm-hex
22617 Force assembly output to always use hex constants. Normally such
22618 constants are signed decimals, but this option is available for
22619 testsuite and/or aesthetic purposes.
22620
22621 @item -mmcu=
22622 @opindex mmcu=
22623 Select the MCU to target. This is used to create a C preprocessor
22624 symbol based upon the MCU name, converted to upper case and pre- and
22625 post-fixed with @samp{__}. This in turn is used by the
22626 @file{msp430.h} header file to select an MCU-specific supplementary
22627 header file.
22628
22629 The option also sets the ISA to use. If the MCU name is one that is
22630 known to only support the 430 ISA then that is selected, otherwise the
22631 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22632 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22633 name selects the 430X ISA.
22634
22635 In addition an MCU-specific linker script is added to the linker
22636 command line. The script's name is the name of the MCU with
22637 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
22638 command line defines the C preprocessor symbol @code{__XXX__} and
22639 cause the linker to search for a script called @file{xxx.ld}.
22640
22641 This option is also passed on to the assembler.
22642
22643 @item -mwarn-mcu
22644 @itemx -mno-warn-mcu
22645 @opindex mwarn-mcu
22646 @opindex mno-warn-mcu
22647 This option enables or disables warnings about conflicts between the
22648 MCU name specified by the @option{-mmcu} option and the ISA set by the
22649 @option{-mcpu} option and/or the hardware multiply support set by the
22650 @option{-mhwmult} option. It also toggles warnings about unrecognized
22651 MCU names. This option is on by default.
22652
22653 @item -mcpu=
22654 @opindex mcpu=
22655 Specifies the ISA to use. Accepted values are @samp{msp430},
22656 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
22657 @option{-mmcu=} option should be used to select the ISA.
22658
22659 @item -msim
22660 @opindex msim
22661 Link to the simulator runtime libraries and linker script. Overrides
22662 any scripts that would be selected by the @option{-mmcu=} option.
22663
22664 @item -mlarge
22665 @opindex mlarge
22666 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
22667
22668 @item -msmall
22669 @opindex msmall
22670 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
22671
22672 @item -mrelax
22673 @opindex mrelax
22674 This option is passed to the assembler and linker, and allows the
22675 linker to perform certain optimizations that cannot be done until
22676 the final link.
22677
22678 @item mhwmult=
22679 @opindex mhwmult=
22680 Describes the type of hardware multiply supported by the target.
22681 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
22682 for the original 16-bit-only multiply supported by early MCUs.
22683 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
22684 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
22685 A value of @samp{auto} can also be given. This tells GCC to deduce
22686 the hardware multiply support based upon the MCU name provided by the
22687 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
22688 the MCU name is not recognized then no hardware multiply support is
22689 assumed. @code{auto} is the default setting.
22690
22691 Hardware multiplies are normally performed by calling a library
22692 routine. This saves space in the generated code. When compiling at
22693 @option{-O3} or higher however the hardware multiplier is invoked
22694 inline. This makes for bigger, but faster code.
22695
22696 The hardware multiply routines disable interrupts whilst running and
22697 restore the previous interrupt state when they finish. This makes
22698 them safe to use inside interrupt handlers as well as in normal code.
22699
22700 @item -minrt
22701 @opindex minrt
22702 Enable the use of a minimum runtime environment - no static
22703 initializers or constructors. This is intended for memory-constrained
22704 devices. The compiler includes special symbols in some objects
22705 that tell the linker and runtime which code fragments are required.
22706
22707 @item -mcode-region=
22708 @itemx -mdata-region=
22709 @opindex mcode-region
22710 @opindex mdata-region
22711 These options tell the compiler where to place functions and data that
22712 do not have one of the @code{lower}, @code{upper}, @code{either} or
22713 @code{section} attributes. Possible values are @code{lower},
22714 @code{upper}, @code{either} or @code{any}. The first three behave
22715 like the corresponding attribute. The fourth possible value -
22716 @code{any} - is the default. It leaves placement entirely up to the
22717 linker script and how it assigns the standard sections
22718 (@code{.text}, @code{.data}, etc) to the memory regions.
22719
22720 @item -msilicon-errata=
22721 @opindex msilicon-errata
22722 This option passes on a request to assembler to enable the fixes for
22723 the named silicon errata.
22724
22725 @item -msilicon-errata-warn=
22726 @opindex msilicon-errata-warn
22727 This option passes on a request to the assembler to enable warning
22728 messages when a silicon errata might need to be applied.
22729
22730 @end table
22731
22732 @node NDS32 Options
22733 @subsection NDS32 Options
22734 @cindex NDS32 Options
22735
22736 These options are defined for NDS32 implementations:
22737
22738 @table @gcctabopt
22739
22740 @item -mbig-endian
22741 @opindex mbig-endian
22742 Generate code in big-endian mode.
22743
22744 @item -mlittle-endian
22745 @opindex mlittle-endian
22746 Generate code in little-endian mode.
22747
22748 @item -mreduced-regs
22749 @opindex mreduced-regs
22750 Use reduced-set registers for register allocation.
22751
22752 @item -mfull-regs
22753 @opindex mfull-regs
22754 Use full-set registers for register allocation.
22755
22756 @item -mcmov
22757 @opindex mcmov
22758 Generate conditional move instructions.
22759
22760 @item -mno-cmov
22761 @opindex mno-cmov
22762 Do not generate conditional move instructions.
22763
22764 @item -mext-perf
22765 @opindex mext-perf
22766 Generate performance extension instructions.
22767
22768 @item -mno-ext-perf
22769 @opindex mno-ext-perf
22770 Do not generate performance extension instructions.
22771
22772 @item -mext-perf2
22773 @opindex mext-perf2
22774 Generate performance extension 2 instructions.
22775
22776 @item -mno-ext-perf2
22777 @opindex mno-ext-perf2
22778 Do not generate performance extension 2 instructions.
22779
22780 @item -mext-string
22781 @opindex mext-string
22782 Generate string extension instructions.
22783
22784 @item -mno-ext-string
22785 @opindex mno-ext-string
22786 Do not generate string extension instructions.
22787
22788 @item -mv3push
22789 @opindex mv3push
22790 Generate v3 push25/pop25 instructions.
22791
22792 @item -mno-v3push
22793 @opindex mno-v3push
22794 Do not generate v3 push25/pop25 instructions.
22795
22796 @item -m16-bit
22797 @opindex m16-bit
22798 Generate 16-bit instructions.
22799
22800 @item -mno-16-bit
22801 @opindex mno-16-bit
22802 Do not generate 16-bit instructions.
22803
22804 @item -misr-vector-size=@var{num}
22805 @opindex misr-vector-size
22806 Specify the size of each interrupt vector, which must be 4 or 16.
22807
22808 @item -mcache-block-size=@var{num}
22809 @opindex mcache-block-size
22810 Specify the size of each cache block,
22811 which must be a power of 2 between 4 and 512.
22812
22813 @item -march=@var{arch}
22814 @opindex march
22815 Specify the name of the target architecture.
22816
22817 @item -mcmodel=@var{code-model}
22818 @opindex mcmodel
22819 Set the code model to one of
22820 @table @asis
22821 @item @samp{small}
22822 All the data and read-only data segments must be within 512KB addressing space.
22823 The text segment must be within 16MB addressing space.
22824 @item @samp{medium}
22825 The data segment must be within 512KB while the read-only data segment can be
22826 within 4GB addressing space. The text segment should be still within 16MB
22827 addressing space.
22828 @item @samp{large}
22829 All the text and data segments can be within 4GB addressing space.
22830 @end table
22831
22832 @item -mctor-dtor
22833 @opindex mctor-dtor
22834 Enable constructor/destructor feature.
22835
22836 @item -mrelax
22837 @opindex mrelax
22838 Guide linker to relax instructions.
22839
22840 @end table
22841
22842 @node Nios II Options
22843 @subsection Nios II Options
22844 @cindex Nios II options
22845 @cindex Altera Nios II options
22846
22847 These are the options defined for the Altera Nios II processor.
22848
22849 @table @gcctabopt
22850
22851 @item -G @var{num}
22852 @opindex G
22853 @cindex smaller data references
22854 Put global and static objects less than or equal to @var{num} bytes
22855 into the small data or BSS sections instead of the normal data or BSS
22856 sections. The default value of @var{num} is 8.
22857
22858 @item -mgpopt=@var{option}
22859 @itemx -mgpopt
22860 @itemx -mno-gpopt
22861 @opindex mgpopt
22862 @opindex mno-gpopt
22863 Generate (do not generate) GP-relative accesses. The following
22864 @var{option} names are recognized:
22865
22866 @table @samp
22867
22868 @item none
22869 Do not generate GP-relative accesses.
22870
22871 @item local
22872 Generate GP-relative accesses for small data objects that are not
22873 external, weak, or uninitialized common symbols.
22874 Also use GP-relative addressing for objects that
22875 have been explicitly placed in a small data section via a @code{section}
22876 attribute.
22877
22878 @item global
22879 As for @samp{local}, but also generate GP-relative accesses for
22880 small data objects that are external, weak, or common. If you use this option,
22881 you must ensure that all parts of your program (including libraries) are
22882 compiled with the same @option{-G} setting.
22883
22884 @item data
22885 Generate GP-relative accesses for all data objects in the program. If you
22886 use this option, the entire data and BSS segments
22887 of your program must fit in 64K of memory and you must use an appropriate
22888 linker script to allocate them within the addressable range of the
22889 global pointer.
22890
22891 @item all
22892 Generate GP-relative addresses for function pointers as well as data
22893 pointers. If you use this option, the entire text, data, and BSS segments
22894 of your program must fit in 64K of memory and you must use an appropriate
22895 linker script to allocate them within the addressable range of the
22896 global pointer.
22897
22898 @end table
22899
22900 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
22901 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
22902
22903 The default is @option{-mgpopt} except when @option{-fpic} or
22904 @option{-fPIC} is specified to generate position-independent code.
22905 Note that the Nios II ABI does not permit GP-relative accesses from
22906 shared libraries.
22907
22908 You may need to specify @option{-mno-gpopt} explicitly when building
22909 programs that include large amounts of small data, including large
22910 GOT data sections. In this case, the 16-bit offset for GP-relative
22911 addressing may not be large enough to allow access to the entire
22912 small data section.
22913
22914 @item -mgprel-sec=@var{regexp}
22915 @opindex mgprel-sec
22916 This option specifies additional section names that can be accessed via
22917 GP-relative addressing. It is most useful in conjunction with
22918 @code{section} attributes on variable declarations
22919 (@pxref{Common Variable Attributes}) and a custom linker script.
22920 The @var{regexp} is a POSIX Extended Regular Expression.
22921
22922 This option does not affect the behavior of the @option{-G} option, and
22923 the specified sections are in addition to the standard @code{.sdata}
22924 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
22925
22926 @item -mr0rel-sec=@var{regexp}
22927 @opindex mr0rel-sec
22928 This option specifies names of sections that can be accessed via a
22929 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
22930 of the 32-bit address space. It is most useful in conjunction with
22931 @code{section} attributes on variable declarations
22932 (@pxref{Common Variable Attributes}) and a custom linker script.
22933 The @var{regexp} is a POSIX Extended Regular Expression.
22934
22935 In contrast to the use of GP-relative addressing for small data,
22936 zero-based addressing is never generated by default and there are no
22937 conventional section names used in standard linker scripts for sections
22938 in the low or high areas of memory.
22939
22940 @item -mel
22941 @itemx -meb
22942 @opindex mel
22943 @opindex meb
22944 Generate little-endian (default) or big-endian (experimental) code,
22945 respectively.
22946
22947 @item -march=@var{arch}
22948 @opindex march
22949 This specifies the name of the target Nios II architecture. GCC uses this
22950 name to determine what kind of instructions it can emit when generating
22951 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
22952
22953 The preprocessor macro @code{__nios2_arch__} is available to programs,
22954 with value 1 or 2, indicating the targeted ISA level.
22955
22956 @item -mbypass-cache
22957 @itemx -mno-bypass-cache
22958 @opindex mno-bypass-cache
22959 @opindex mbypass-cache
22960 Force all load and store instructions to always bypass cache by
22961 using I/O variants of the instructions. The default is not to
22962 bypass the cache.
22963
22964 @item -mno-cache-volatile
22965 @itemx -mcache-volatile
22966 @opindex mcache-volatile
22967 @opindex mno-cache-volatile
22968 Volatile memory access bypass the cache using the I/O variants of
22969 the load and store instructions. The default is not to bypass the cache.
22970
22971 @item -mno-fast-sw-div
22972 @itemx -mfast-sw-div
22973 @opindex mno-fast-sw-div
22974 @opindex mfast-sw-div
22975 Do not use table-based fast divide for small numbers. The default
22976 is to use the fast divide at @option{-O3} and above.
22977
22978 @item -mno-hw-mul
22979 @itemx -mhw-mul
22980 @itemx -mno-hw-mulx
22981 @itemx -mhw-mulx
22982 @itemx -mno-hw-div
22983 @itemx -mhw-div
22984 @opindex mno-hw-mul
22985 @opindex mhw-mul
22986 @opindex mno-hw-mulx
22987 @opindex mhw-mulx
22988 @opindex mno-hw-div
22989 @opindex mhw-div
22990 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
22991 instructions by the compiler. The default is to emit @code{mul}
22992 and not emit @code{div} and @code{mulx}.
22993
22994 @item -mbmx
22995 @itemx -mno-bmx
22996 @itemx -mcdx
22997 @itemx -mno-cdx
22998 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
22999 CDX (code density) instructions. Enabling these instructions also
23000 requires @option{-march=r2}. Since these instructions are optional
23001 extensions to the R2 architecture, the default is not to emit them.
23002
23003 @item -mcustom-@var{insn}=@var{N}
23004 @itemx -mno-custom-@var{insn}
23005 @opindex mcustom-@var{insn}
23006 @opindex mno-custom-@var{insn}
23007 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23008 custom instruction with encoding @var{N} when generating code that uses
23009 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23010 instruction 253 for single-precision floating-point add operations instead
23011 of the default behavior of using a library call.
23012
23013 The following values of @var{insn} are supported. Except as otherwise
23014 noted, floating-point operations are expected to be implemented with
23015 normal IEEE 754 semantics and correspond directly to the C operators or the
23016 equivalent GCC built-in functions (@pxref{Other Builtins}).
23017
23018 Single-precision floating point:
23019 @table @asis
23020
23021 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23022 Binary arithmetic operations.
23023
23024 @item @samp{fnegs}
23025 Unary negation.
23026
23027 @item @samp{fabss}
23028 Unary absolute value.
23029
23030 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23031 Comparison operations.
23032
23033 @item @samp{fmins}, @samp{fmaxs}
23034 Floating-point minimum and maximum. These instructions are only
23035 generated if @option{-ffinite-math-only} is specified.
23036
23037 @item @samp{fsqrts}
23038 Unary square root operation.
23039
23040 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23041 Floating-point trigonometric and exponential functions. These instructions
23042 are only generated if @option{-funsafe-math-optimizations} is also specified.
23043
23044 @end table
23045
23046 Double-precision floating point:
23047 @table @asis
23048
23049 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23050 Binary arithmetic operations.
23051
23052 @item @samp{fnegd}
23053 Unary negation.
23054
23055 @item @samp{fabsd}
23056 Unary absolute value.
23057
23058 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23059 Comparison operations.
23060
23061 @item @samp{fmind}, @samp{fmaxd}
23062 Double-precision minimum and maximum. These instructions are only
23063 generated if @option{-ffinite-math-only} is specified.
23064
23065 @item @samp{fsqrtd}
23066 Unary square root operation.
23067
23068 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23069 Double-precision trigonometric and exponential functions. These instructions
23070 are only generated if @option{-funsafe-math-optimizations} is also specified.
23071
23072 @end table
23073
23074 Conversions:
23075 @table @asis
23076 @item @samp{fextsd}
23077 Conversion from single precision to double precision.
23078
23079 @item @samp{ftruncds}
23080 Conversion from double precision to single precision.
23081
23082 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23083 Conversion from floating point to signed or unsigned integer types, with
23084 truncation towards zero.
23085
23086 @item @samp{round}
23087 Conversion from single-precision floating point to signed integer,
23088 rounding to the nearest integer and ties away from zero.
23089 This corresponds to the @code{__builtin_lroundf} function when
23090 @option{-fno-math-errno} is used.
23091
23092 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23093 Conversion from signed or unsigned integer types to floating-point types.
23094
23095 @end table
23096
23097 In addition, all of the following transfer instructions for internal
23098 registers X and Y must be provided to use any of the double-precision
23099 floating-point instructions. Custom instructions taking two
23100 double-precision source operands expect the first operand in the
23101 64-bit register X. The other operand (or only operand of a unary
23102 operation) is given to the custom arithmetic instruction with the
23103 least significant half in source register @var{src1} and the most
23104 significant half in @var{src2}. A custom instruction that returns a
23105 double-precision result returns the most significant 32 bits in the
23106 destination register and the other half in 32-bit register Y.
23107 GCC automatically generates the necessary code sequences to write
23108 register X and/or read register Y when double-precision floating-point
23109 instructions are used.
23110
23111 @table @asis
23112
23113 @item @samp{fwrx}
23114 Write @var{src1} into the least significant half of X and @var{src2} into
23115 the most significant half of X.
23116
23117 @item @samp{fwry}
23118 Write @var{src1} into Y.
23119
23120 @item @samp{frdxhi}, @samp{frdxlo}
23121 Read the most or least (respectively) significant half of X and store it in
23122 @var{dest}.
23123
23124 @item @samp{frdy}
23125 Read the value of Y and store it into @var{dest}.
23126 @end table
23127
23128 Note that you can gain more local control over generation of Nios II custom
23129 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23130 and @code{target("no-custom-@var{insn}")} function attributes
23131 (@pxref{Function Attributes})
23132 or pragmas (@pxref{Function Specific Option Pragmas}).
23133
23134 @item -mcustom-fpu-cfg=@var{name}
23135 @opindex mcustom-fpu-cfg
23136
23137 This option enables a predefined, named set of custom instruction encodings
23138 (see @option{-mcustom-@var{insn}} above).
23139 Currently, the following sets are defined:
23140
23141 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23142 @gccoptlist{-mcustom-fmuls=252 @gol
23143 -mcustom-fadds=253 @gol
23144 -mcustom-fsubs=254 @gol
23145 -fsingle-precision-constant}
23146
23147 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23148 @gccoptlist{-mcustom-fmuls=252 @gol
23149 -mcustom-fadds=253 @gol
23150 -mcustom-fsubs=254 @gol
23151 -mcustom-fdivs=255 @gol
23152 -fsingle-precision-constant}
23153
23154 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23155 @gccoptlist{-mcustom-floatus=243 @gol
23156 -mcustom-fixsi=244 @gol
23157 -mcustom-floatis=245 @gol
23158 -mcustom-fcmpgts=246 @gol
23159 -mcustom-fcmples=249 @gol
23160 -mcustom-fcmpeqs=250 @gol
23161 -mcustom-fcmpnes=251 @gol
23162 -mcustom-fmuls=252 @gol
23163 -mcustom-fadds=253 @gol
23164 -mcustom-fsubs=254 @gol
23165 -mcustom-fdivs=255 @gol
23166 -fsingle-precision-constant}
23167
23168 Custom instruction assignments given by individual
23169 @option{-mcustom-@var{insn}=} options override those given by
23170 @option{-mcustom-fpu-cfg=}, regardless of the
23171 order of the options on the command line.
23172
23173 Note that you can gain more local control over selection of a FPU
23174 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23175 function attribute (@pxref{Function Attributes})
23176 or pragma (@pxref{Function Specific Option Pragmas}).
23177
23178 @end table
23179
23180 These additional @samp{-m} options are available for the Altera Nios II
23181 ELF (bare-metal) target:
23182
23183 @table @gcctabopt
23184
23185 @item -mhal
23186 @opindex mhal
23187 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23188 startup and termination code, and is typically used in conjunction with
23189 @option{-msys-crt0=} to specify the location of the alternate startup code
23190 provided by the HAL BSP.
23191
23192 @item -msmallc
23193 @opindex msmallc
23194 Link with a limited version of the C library, @option{-lsmallc}, rather than
23195 Newlib.
23196
23197 @item -msys-crt0=@var{startfile}
23198 @opindex msys-crt0
23199 @var{startfile} is the file name of the startfile (crt0) to use
23200 when linking. This option is only useful in conjunction with @option{-mhal}.
23201
23202 @item -msys-lib=@var{systemlib}
23203 @opindex msys-lib
23204 @var{systemlib} is the library name of the library that provides
23205 low-level system calls required by the C library,
23206 e.g.@: @code{read} and @code{write}.
23207 This option is typically used to link with a library provided by a HAL BSP.
23208
23209 @end table
23210
23211 @node Nvidia PTX Options
23212 @subsection Nvidia PTX Options
23213 @cindex Nvidia PTX options
23214 @cindex nvptx options
23215
23216 These options are defined for Nvidia PTX:
23217
23218 @table @gcctabopt
23219
23220 @item -m32
23221 @itemx -m64
23222 @opindex m32
23223 @opindex m64
23224 Generate code for 32-bit or 64-bit ABI.
23225
23226 @item -misa=@var{ISA-string}
23227 @opindex march
23228 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23229 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23230 @samp{sm_35}. The default ISA is sm_30.
23231
23232 @item -mmainkernel
23233 @opindex mmainkernel
23234 Link in code for a __main kernel. This is for stand-alone instead of
23235 offloading execution.
23236
23237 @item -moptimize
23238 @opindex moptimize
23239 Apply partitioned execution optimizations. This is the default when any
23240 level of optimization is selected.
23241
23242 @item -msoft-stack
23243 @opindex msoft-stack
23244 Generate code that does not use @code{.local} memory
23245 directly for stack storage. Instead, a per-warp stack pointer is
23246 maintained explicitly. This enables variable-length stack allocation (with
23247 variable-length arrays or @code{alloca}), and when global memory is used for
23248 underlying storage, makes it possible to access automatic variables from other
23249 threads, or with atomic instructions. This code generation variant is used
23250 for OpenMP offloading, but the option is exposed on its own for the purpose
23251 of testing the compiler; to generate code suitable for linking into programs
23252 using OpenMP offloading, use option @option{-mgomp}.
23253
23254 @item -muniform-simt
23255 @opindex muniform-simt
23256 Switch to code generation variant that allows to execute all threads in each
23257 warp, while maintaining memory state and side effects as if only one thread
23258 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23259 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23260 current lane index equals the master lane index), and the register being
23261 assigned is copied via a shuffle instruction from the master lane. Outside of
23262 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23263 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23264 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23265 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23266 with current lane index to compute the master lane index.
23267
23268 @item -mgomp
23269 @opindex mgomp
23270 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23271 @option{-muniform-simt} options, and selects corresponding multilib variant.
23272
23273 @end table
23274
23275 @node OpenRISC Options
23276 @subsection OpenRISC Options
23277 @cindex OpenRISC Options
23278
23279 These options are defined for OpenRISC:
23280
23281 @table @gcctabopt
23282
23283 @item -mboard=@var{name}
23284 @opindex mboard
23285 Configure a board specific runtime. This will be passed to the linker for
23286 newlib board library linking. The default is @code{or1ksim}.
23287
23288 @item -mnewlib
23289 @opindex mnewlib
23290 For compatibility, it's always newlib for elf now.
23291
23292 @item -mhard-div
23293 @opindex mhard-div
23294 Generate code for hardware which supports divide instructions. This is the
23295 default.
23296
23297 @item -mhard-mul
23298 @opindex mhard-mul
23299 Generate code for hardware which supports multiply instructions. This is the
23300 default.
23301
23302 @item -mcmov
23303 @opindex mcmov
23304 Generate code for hardware which supports the conditional move (@code{l.cmov})
23305 instruction.
23306
23307 @item -mror
23308 @opindex mror
23309 Generate code for hardware which supports rotate right instructions.
23310
23311 @item -msext
23312 @opindex msext
23313 Generate code for hardware which supports sign-extension instructions.
23314
23315 @item -msfimm
23316 @opindex msfimm
23317 Generate code for hardware which supports set flag immediate (@code{l.sf*i})
23318 instructions.
23319
23320 @item -mshftimm
23321 @opindex mshftimm
23322 Generate code for hardware which supports shift immediate related instructions
23323 (i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to
23324 enable generation of the @code{l.rori} instruction the @option{-mror} flag must
23325 also be specified.
23326
23327 @item -msoft-div
23328 @opindex msoft-div
23329 Generate code for hardware which requires divide instruction emulation.
23330
23331 @item -msoft-mul
23332 @opindex msoft-mul
23333 Generate code for hardware which requires multiply instruction emulation.
23334
23335 @end table
23336
23337 @node PDP-11 Options
23338 @subsection PDP-11 Options
23339 @cindex PDP-11 Options
23340
23341 These options are defined for the PDP-11:
23342
23343 @table @gcctabopt
23344 @item -mfpu
23345 @opindex mfpu
23346 Use hardware FPP floating point. This is the default. (FIS floating
23347 point on the PDP-11/40 is not supported.) Implies -m45.
23348
23349 @item -msoft-float
23350 @opindex msoft-float
23351 Do not use hardware floating point.
23352
23353 @item -mac0
23354 @opindex mac0
23355 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23356
23357 @item -mno-ac0
23358 @opindex mno-ac0
23359 Return floating-point results in memory. This is the default.
23360
23361 @item -m40
23362 @opindex m40
23363 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23364
23365 @item -m45
23366 @opindex m45
23367 Generate code for a PDP-11/45. This is the default.
23368
23369 @item -m10
23370 @opindex m10
23371 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23372
23373 @item -mint16
23374 @itemx -mno-int32
23375 @opindex mint16
23376 @opindex mno-int32
23377 Use 16-bit @code{int}. This is the default.
23378
23379 @item -mint32
23380 @itemx -mno-int16
23381 @opindex mint32
23382 @opindex mno-int16
23383 Use 32-bit @code{int}.
23384
23385 @item -msplit
23386 @opindex msplit
23387 Target has split instruction and data space. Implies -m45.
23388
23389 @item -munix-asm
23390 @opindex munix-asm
23391 Use Unix assembler syntax.
23392
23393 @item -mdec-asm
23394 @opindex mdec-asm
23395 Use DEC assembler syntax.
23396
23397 @item -mgnu-asm
23398 @opindex mgnu-asm
23399 Use GNU assembler syntax. This is the default.
23400
23401 @item -mlra
23402 @opindex mlra
23403 Use the new LRA register allocator. By default, the old ``reload''
23404 allocator is used.
23405 @end table
23406
23407 @node picoChip Options
23408 @subsection picoChip Options
23409 @cindex picoChip options
23410
23411 These @samp{-m} options are defined for picoChip implementations:
23412
23413 @table @gcctabopt
23414
23415 @item -mae=@var{ae_type}
23416 @opindex mcpu
23417 Set the instruction set, register set, and instruction scheduling
23418 parameters for array element type @var{ae_type}. Supported values
23419 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23420
23421 @option{-mae=ANY} selects a completely generic AE type. Code
23422 generated with this option runs on any of the other AE types. The
23423 code is not as efficient as it would be if compiled for a specific
23424 AE type, and some types of operation (e.g., multiplication) do not
23425 work properly on all types of AE.
23426
23427 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23428 for compiled code, and is the default.
23429
23430 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23431 option may suffer from poor performance of byte (char) manipulation,
23432 since the DSP AE does not provide hardware support for byte load/stores.
23433
23434 @item -msymbol-as-address
23435 Enable the compiler to directly use a symbol name as an address in a
23436 load/store instruction, without first loading it into a
23437 register. Typically, the use of this option generates larger
23438 programs, which run faster than when the option isn't used. However, the
23439 results vary from program to program, so it is left as a user option,
23440 rather than being permanently enabled.
23441
23442 @item -mno-inefficient-warnings
23443 Disables warnings about the generation of inefficient code. These
23444 warnings can be generated, for example, when compiling code that
23445 performs byte-level memory operations on the MAC AE type. The MAC AE has
23446 no hardware support for byte-level memory operations, so all byte
23447 load/stores must be synthesized from word load/store operations. This is
23448 inefficient and a warning is generated to indicate
23449 that you should rewrite the code to avoid byte operations, or to target
23450 an AE type that has the necessary hardware support. This option disables
23451 these warnings.
23452
23453 @end table
23454
23455 @node PowerPC Options
23456 @subsection PowerPC Options
23457 @cindex PowerPC options
23458
23459 These are listed under @xref{RS/6000 and PowerPC Options}.
23460
23461 @node PowerPC SPE Options
23462 @subsection PowerPC SPE Options
23463 @cindex PowerPC SPE options
23464
23465 These @samp{-m} options are defined for PowerPC SPE:
23466 @table @gcctabopt
23467 @item -mmfcrf
23468 @itemx -mno-mfcrf
23469 @itemx -mpopcntb
23470 @itemx -mno-popcntb
23471 @opindex mmfcrf
23472 @opindex mno-mfcrf
23473 @opindex mpopcntb
23474 @opindex mno-popcntb
23475 You use these options to specify which instructions are available on the
23476 processor you are using. The default value of these options is
23477 determined when configuring GCC@. Specifying the
23478 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23479 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23480 rather than the options listed above.
23481
23482 The @option{-mmfcrf} option allows GCC to generate the move from
23483 condition register field instruction implemented on the POWER4
23484 processor and other processors that support the PowerPC V2.01
23485 architecture.
23486 The @option{-mpopcntb} option allows GCC to generate the popcount and
23487 double-precision FP reciprocal estimate instruction implemented on the
23488 POWER5 processor and other processors that support the PowerPC V2.02
23489 architecture.
23490
23491 @item -mcpu=@var{cpu_type}
23492 @opindex mcpu
23493 Set architecture type, register usage, and
23494 instruction scheduling parameters for machine type @var{cpu_type}.
23495 Supported values for @var{cpu_type} are @samp{8540}, @samp{8548},
23496 and @samp{native}.
23497
23498 @option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either
23499 endian), with an appropriate, generic processor model assumed for
23500 scheduling purposes.
23501
23502 Specifying @samp{native} as cpu type detects and selects the
23503 architecture option that corresponds to the host processor of the
23504 system performing the compilation.
23505 @option{-mcpu=native} has no effect if GCC does not recognize the
23506 processor.
23507
23508 The other options specify a specific processor. Code generated under
23509 those options runs best on that processor, and may not run at all on
23510 others.
23511
23512 The @option{-mcpu} options automatically enable or disable the
23513 following options:
23514
23515 @gccoptlist{-mhard-float -mmfcrf -mmultiple @gol
23516 -mpopcntb -mpopcntd @gol
23517 -msingle-float -mdouble-float @gol
23518 -mfloat128}
23519
23520 The particular options set for any particular CPU varies between
23521 compiler versions, depending on what setting seems to produce optimal
23522 code for that CPU; it doesn't necessarily reflect the actual hardware's
23523 capabilities. If you wish to set an individual option to a particular
23524 value, you may specify it after the @option{-mcpu} option, like
23525 @option{-mcpu=8548}.
23526
23527 @item -mtune=@var{cpu_type}
23528 @opindex mtune
23529 Set the instruction scheduling parameters for machine type
23530 @var{cpu_type}, but do not set the architecture type or register usage,
23531 as @option{-mcpu=@var{cpu_type}} does. The same
23532 values for @var{cpu_type} are used for @option{-mtune} as for
23533 @option{-mcpu}. If both are specified, the code generated uses the
23534 architecture and registers set by @option{-mcpu}, but the
23535 scheduling parameters set by @option{-mtune}.
23536
23537 @item -msecure-plt
23538 @opindex msecure-plt
23539 Generate code that allows @command{ld} and @command{ld.so}
23540 to build executables and shared
23541 libraries with non-executable @code{.plt} and @code{.got} sections.
23542 This is a PowerPC
23543 32-bit SYSV ABI option.
23544
23545 @item -mbss-plt
23546 @opindex mbss-plt
23547 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
23548 fills in, and
23549 requires @code{.plt} and @code{.got}
23550 sections that are both writable and executable.
23551 This is a PowerPC 32-bit SYSV ABI option.
23552
23553 @item -misel
23554 @itemx -mno-isel
23555 @opindex misel
23556 @opindex mno-isel
23557 This switch enables or disables the generation of ISEL instructions.
23558
23559 @item -misel=@var{yes/no}
23560 This switch has been deprecated. Use @option{-misel} and
23561 @option{-mno-isel} instead.
23562
23563 @item -mspe
23564 @itemx -mno-spe
23565 @opindex mspe
23566 @opindex mno-spe
23567 This switch enables or disables the generation of SPE simd
23568 instructions.
23569
23570 @item -mspe=@var{yes/no}
23571 This option has been deprecated. Use @option{-mspe} and
23572 @option{-mno-spe} instead.
23573
23574 @item -mfloat128
23575 @itemx -mno-float128
23576 @opindex mfloat128
23577 @opindex mno-float128
23578 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
23579 and use either software emulation for IEEE 128-bit floating point or
23580 hardware instructions.
23581
23582 @item -mfloat-gprs=@var{yes/single/double/no}
23583 @itemx -mfloat-gprs
23584 @opindex mfloat-gprs
23585 This switch enables or disables the generation of floating-point
23586 operations on the general-purpose registers for architectures that
23587 support it.
23588
23589 The argument @samp{yes} or @samp{single} enables the use of
23590 single-precision floating-point operations.
23591
23592 The argument @samp{double} enables the use of single and
23593 double-precision floating-point operations.
23594
23595 The argument @samp{no} disables floating-point operations on the
23596 general-purpose registers.
23597
23598 This option is currently only available on the MPC854x.
23599
23600 @item -mfull-toc
23601 @itemx -mno-fp-in-toc
23602 @itemx -mno-sum-in-toc
23603 @itemx -mminimal-toc
23604 @opindex mfull-toc
23605 @opindex mno-fp-in-toc
23606 @opindex mno-sum-in-toc
23607 @opindex mminimal-toc
23608 Modify generation of the TOC (Table Of Contents), which is created for
23609 every executable file. The @option{-mfull-toc} option is selected by
23610 default. In that case, GCC allocates at least one TOC entry for
23611 each unique non-automatic variable reference in your program. GCC
23612 also places floating-point constants in the TOC@. However, only
23613 16,384 entries are available in the TOC@.
23614
23615 If you receive a linker error message that saying you have overflowed
23616 the available TOC space, you can reduce the amount of TOC space used
23617 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
23618 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
23619 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
23620 generate code to calculate the sum of an address and a constant at
23621 run time instead of putting that sum into the TOC@. You may specify one
23622 or both of these options. Each causes GCC to produce very slightly
23623 slower and larger code at the expense of conserving TOC space.
23624
23625 If you still run out of space in the TOC even when you specify both of
23626 these options, specify @option{-mminimal-toc} instead. This option causes
23627 GCC to make only one TOC entry for every file. When you specify this
23628 option, GCC produces code that is slower and larger but which
23629 uses extremely little TOC space. You may wish to use this option
23630 only on files that contain less frequently-executed code.
23631
23632 @item -maix32
23633 @opindex maix32
23634 Disables the 64-bit ABI. GCC defaults to @option{-maix32}.
23635
23636 @item -mxl-compat
23637 @itemx -mno-xl-compat
23638 @opindex mxl-compat
23639 @opindex mno-xl-compat
23640 Produce code that conforms more closely to IBM XL compiler semantics
23641 when using AIX-compatible ABI@. Pass floating-point arguments to
23642 prototyped functions beyond the register save area (RSA) on the stack
23643 in addition to argument FPRs. Do not assume that most significant
23644 double in 128-bit long double value is properly rounded when comparing
23645 values and converting to double. Use XL symbol names for long double
23646 support routines.
23647
23648 The AIX calling convention was extended but not initially documented to
23649 handle an obscure K&R C case of calling a function that takes the
23650 address of its arguments with fewer arguments than declared. IBM XL
23651 compilers access floating-point arguments that do not fit in the
23652 RSA from the stack when a subroutine is compiled without
23653 optimization. Because always storing floating-point arguments on the
23654 stack is inefficient and rarely needed, this option is not enabled by
23655 default and only is necessary when calling subroutines compiled by IBM
23656 XL compilers without optimization.
23657
23658 @item -malign-natural
23659 @itemx -malign-power
23660 @opindex malign-natural
23661 @opindex malign-power
23662 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23663 @option{-malign-natural} overrides the ABI-defined alignment of larger
23664 types, such as floating-point doubles, on their natural size-based boundary.
23665 The option @option{-malign-power} instructs GCC to follow the ABI-specified
23666 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
23667
23668 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
23669 is not supported.
23670
23671 @item -msoft-float
23672 @itemx -mhard-float
23673 @opindex msoft-float
23674 @opindex mhard-float
23675 Generate code that does not use (uses) the floating-point register set.
23676 Software floating-point emulation is provided if you use the
23677 @option{-msoft-float} option, and pass the option to GCC when linking.
23678
23679 @item -msingle-float
23680 @itemx -mdouble-float
23681 @opindex msingle-float
23682 @opindex mdouble-float
23683 Generate code for single- or double-precision floating-point operations.
23684 @option{-mdouble-float} implies @option{-msingle-float}.
23685
23686 @item -mmultiple
23687 @itemx -mno-multiple
23688 @opindex mmultiple
23689 @opindex mno-multiple
23690 Generate code that uses (does not use) the load multiple word
23691 instructions and the store multiple word instructions. These
23692 instructions are generated by default on POWER systems, and not
23693 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
23694 PowerPC systems, since those instructions do not work when the
23695 processor is in little-endian mode. The exceptions are PPC740 and
23696 PPC750 which permit these instructions in little-endian mode.
23697
23698 @item -mupdate
23699 @itemx -mno-update
23700 @opindex mupdate
23701 @opindex mno-update
23702 Generate code that uses (does not use) the load or store instructions
23703 that update the base register to the address of the calculated memory
23704 location. These instructions are generated by default. If you use
23705 @option{-mno-update}, there is a small window between the time that the
23706 stack pointer is updated and the address of the previous frame is
23707 stored, which means code that walks the stack frame across interrupts or
23708 signals may get corrupted data.
23709
23710 @item -mavoid-indexed-addresses
23711 @itemx -mno-avoid-indexed-addresses
23712 @opindex mavoid-indexed-addresses
23713 @opindex mno-avoid-indexed-addresses
23714 Generate code that tries to avoid (not avoid) the use of indexed load
23715 or store instructions. These instructions can incur a performance
23716 penalty on Power6 processors in certain situations, such as when
23717 stepping through large arrays that cross a 16M boundary. This option
23718 is enabled by default when targeting Power6 and disabled otherwise.
23719
23720 @item -mfused-madd
23721 @itemx -mno-fused-madd
23722 @opindex mfused-madd
23723 @opindex mno-fused-madd
23724 Generate code that uses (does not use) the floating-point multiply and
23725 accumulate instructions. These instructions are generated by default
23726 if hardware floating point is used. The machine-dependent
23727 @option{-mfused-madd} option is now mapped to the machine-independent
23728 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23729 mapped to @option{-ffp-contract=off}.
23730
23731 @item -mno-strict-align
23732 @itemx -mstrict-align
23733 @opindex mno-strict-align
23734 @opindex mstrict-align
23735 On System V.4 and embedded PowerPC systems do not (do) assume that
23736 unaligned memory references are handled by the system.
23737
23738 @item -mrelocatable
23739 @itemx -mno-relocatable
23740 @opindex mrelocatable
23741 @opindex mno-relocatable
23742 Generate code that allows (does not allow) a static executable to be
23743 relocated to a different address at run time. A simple embedded
23744 PowerPC system loader should relocate the entire contents of
23745 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
23746 a table of 32-bit addresses generated by this option. For this to
23747 work, all objects linked together must be compiled with
23748 @option{-mrelocatable} or @option{-mrelocatable-lib}.
23749 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
23750
23751 @item -mrelocatable-lib
23752 @itemx -mno-relocatable-lib
23753 @opindex mrelocatable-lib
23754 @opindex mno-relocatable-lib
23755 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
23756 @code{.fixup} section to allow static executables to be relocated at
23757 run time, but @option{-mrelocatable-lib} does not use the smaller stack
23758 alignment of @option{-mrelocatable}. Objects compiled with
23759 @option{-mrelocatable-lib} may be linked with objects compiled with
23760 any combination of the @option{-mrelocatable} options.
23761
23762 @item -mno-toc
23763 @itemx -mtoc
23764 @opindex mno-toc
23765 @opindex mtoc
23766 On System V.4 and embedded PowerPC systems do not (do) assume that
23767 register 2 contains a pointer to a global area pointing to the addresses
23768 used in the program.
23769
23770 @item -mlittle
23771 @itemx -mlittle-endian
23772 @opindex mlittle
23773 @opindex mlittle-endian
23774 On System V.4 and embedded PowerPC systems compile code for the
23775 processor in little-endian mode. The @option{-mlittle-endian} option is
23776 the same as @option{-mlittle}.
23777
23778 @item -mbig
23779 @itemx -mbig-endian
23780 @opindex mbig
23781 @opindex mbig-endian
23782 On System V.4 and embedded PowerPC systems compile code for the
23783 processor in big-endian mode. The @option{-mbig-endian} option is
23784 the same as @option{-mbig}.
23785
23786 @item -mdynamic-no-pic
23787 @opindex mdynamic-no-pic
23788 On Darwin and Mac OS X systems, compile code so that it is not
23789 relocatable, but that its external references are relocatable. The
23790 resulting code is suitable for applications, but not shared
23791 libraries.
23792
23793 @item -msingle-pic-base
23794 @opindex msingle-pic-base
23795 Treat the register used for PIC addressing as read-only, rather than
23796 loading it in the prologue for each function. The runtime system is
23797 responsible for initializing this register with an appropriate value
23798 before execution begins.
23799
23800 @item -mprioritize-restricted-insns=@var{priority}
23801 @opindex mprioritize-restricted-insns
23802 This option controls the priority that is assigned to
23803 dispatch-slot restricted instructions during the second scheduling
23804 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
23805 or @samp{2} to assign no, highest, or second-highest (respectively)
23806 priority to dispatch-slot restricted
23807 instructions.
23808
23809 @item -msched-costly-dep=@var{dependence_type}
23810 @opindex msched-costly-dep
23811 This option controls which dependences are considered costly
23812 by the target during instruction scheduling. The argument
23813 @var{dependence_type} takes one of the following values:
23814
23815 @table @asis
23816 @item @samp{no}
23817 No dependence is costly.
23818
23819 @item @samp{all}
23820 All dependences are costly.
23821
23822 @item @samp{true_store_to_load}
23823 A true dependence from store to load is costly.
23824
23825 @item @samp{store_to_load}
23826 Any dependence from store to load is costly.
23827
23828 @item @var{number}
23829 Any dependence for which the latency is greater than or equal to
23830 @var{number} is costly.
23831 @end table
23832
23833 @item -minsert-sched-nops=@var{scheme}
23834 @opindex minsert-sched-nops
23835 This option controls which NOP insertion scheme is used during
23836 the second scheduling pass. The argument @var{scheme} takes one of the
23837 following values:
23838
23839 @table @asis
23840 @item @samp{no}
23841 Don't insert NOPs.
23842
23843 @item @samp{pad}
23844 Pad with NOPs any dispatch group that has vacant issue slots,
23845 according to the scheduler's grouping.
23846
23847 @item @samp{regroup_exact}
23848 Insert NOPs to force costly dependent insns into
23849 separate groups. Insert exactly as many NOPs as needed to force an insn
23850 to a new group, according to the estimated processor grouping.
23851
23852 @item @var{number}
23853 Insert NOPs to force costly dependent insns into
23854 separate groups. Insert @var{number} NOPs to force an insn to a new group.
23855 @end table
23856
23857 @item -mcall-sysv
23858 @opindex mcall-sysv
23859 On System V.4 and embedded PowerPC systems compile code using calling
23860 conventions that adhere to the March 1995 draft of the System V
23861 Application Binary Interface, PowerPC processor supplement. This is the
23862 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
23863
23864 @item -mcall-sysv-eabi
23865 @itemx -mcall-eabi
23866 @opindex mcall-sysv-eabi
23867 @opindex mcall-eabi
23868 Specify both @option{-mcall-sysv} and @option{-meabi} options.
23869
23870 @item -mcall-sysv-noeabi
23871 @opindex mcall-sysv-noeabi
23872 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
23873
23874 @item -mcall-aixdesc
23875 @opindex m
23876 On System V.4 and embedded PowerPC systems compile code for the AIX
23877 operating system.
23878
23879 @item -mcall-linux
23880 @opindex mcall-linux
23881 On System V.4 and embedded PowerPC systems compile code for the
23882 Linux-based GNU system.
23883
23884 @item -mcall-freebsd
23885 @opindex mcall-freebsd
23886 On System V.4 and embedded PowerPC systems compile code for the
23887 FreeBSD operating system.
23888
23889 @item -mcall-netbsd
23890 @opindex mcall-netbsd
23891 On System V.4 and embedded PowerPC systems compile code for the
23892 NetBSD operating system.
23893
23894 @item -mcall-openbsd
23895 @opindex mcall-netbsd
23896 On System V.4 and embedded PowerPC systems compile code for the
23897 OpenBSD operating system.
23898
23899 @item -maix-struct-return
23900 @opindex maix-struct-return
23901 Return all structures in memory (as specified by the AIX ABI)@.
23902
23903 @item -msvr4-struct-return
23904 @opindex msvr4-struct-return
23905 Return structures smaller than 8 bytes in registers (as specified by the
23906 SVR4 ABI)@.
23907
23908 @item -mabi=@var{abi-type}
23909 @opindex mabi
23910 Extend the current ABI with a particular extension, or remove such extension.
23911 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
23912 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
23913 @samp{elfv1}, @samp{elfv2}@.
23914
23915 @item -mabi=spe
23916 @opindex mabi=spe
23917 Extend the current ABI with SPE ABI extensions. This does not change
23918 the default ABI, instead it adds the SPE ABI extensions to the current
23919 ABI@.
23920
23921 @item -mabi=no-spe
23922 @opindex mabi=no-spe
23923 Disable Book-E SPE ABI extensions for the current ABI@.
23924
23925 @item -mabi=ibmlongdouble
23926 @opindex mabi=ibmlongdouble
23927 Change the current ABI to use IBM extended-precision long double.
23928 This is not likely to work if your system defaults to using IEEE
23929 extended-precision long double. If you change the long double type
23930 from IEEE extended-precision, the compiler will issue a warning unless
23931 you use the @option{-Wno-psabi} option.
23932
23933 @item -mabi=ieeelongdouble
23934 @opindex mabi=ieeelongdouble
23935 Change the current ABI to use IEEE extended-precision long double.
23936 This is not likely to work if your system defaults to using IBM
23937 extended-precision long double. If you change the long double type
23938 from IBM extended-precision, the compiler will issue a warning unless
23939 you use the @option{-Wno-psabi} option.
23940
23941 @item -mabi=elfv1
23942 @opindex mabi=elfv1
23943 Change the current ABI to use the ELFv1 ABI.
23944 This is the default ABI for big-endian PowerPC 64-bit Linux.
23945 Overriding the default ABI requires special system support and is
23946 likely to fail in spectacular ways.
23947
23948 @item -mabi=elfv2
23949 @opindex mabi=elfv2
23950 Change the current ABI to use the ELFv2 ABI.
23951 This is the default ABI for little-endian PowerPC 64-bit Linux.
23952 Overriding the default ABI requires special system support and is
23953 likely to fail in spectacular ways.
23954
23955 @item -mgnu-attribute
23956 @itemx -mno-gnu-attribute
23957 @opindex mgnu-attribute
23958 @opindex mno-gnu-attribute
23959 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23960 .gnu.attributes section that specify ABI variations in function
23961 parameters or return values.
23962
23963 @item -mprototype
23964 @itemx -mno-prototype
23965 @opindex mprototype
23966 @opindex mno-prototype
23967 On System V.4 and embedded PowerPC systems assume that all calls to
23968 variable argument functions are properly prototyped. Otherwise, the
23969 compiler must insert an instruction before every non-prototyped call to
23970 set or clear bit 6 of the condition code register (@code{CR}) to
23971 indicate whether floating-point values are passed in the floating-point
23972 registers in case the function takes variable arguments. With
23973 @option{-mprototype}, only calls to prototyped variable argument functions
23974 set or clear the bit.
23975
23976 @item -msim
23977 @opindex msim
23978 On embedded PowerPC systems, assume that the startup module is called
23979 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
23980 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
23981 configurations.
23982
23983 @item -mmvme
23984 @opindex mmvme
23985 On embedded PowerPC systems, assume that the startup module is called
23986 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
23987 @file{libc.a}.
23988
23989 @item -mads
23990 @opindex mads
23991 On embedded PowerPC systems, assume that the startup module is called
23992 @file{crt0.o} and the standard C libraries are @file{libads.a} and
23993 @file{libc.a}.
23994
23995 @item -myellowknife
23996 @opindex myellowknife
23997 On embedded PowerPC systems, assume that the startup module is called
23998 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
23999 @file{libc.a}.
24000
24001 @item -mvxworks
24002 @opindex mvxworks
24003 On System V.4 and embedded PowerPC systems, specify that you are
24004 compiling for a VxWorks system.
24005
24006 @item -memb
24007 @opindex memb
24008 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24009 header to indicate that @samp{eabi} extended relocations are used.
24010
24011 @item -meabi
24012 @itemx -mno-eabi
24013 @opindex meabi
24014 @opindex mno-eabi
24015 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24016 Embedded Applications Binary Interface (EABI), which is a set of
24017 modifications to the System V.4 specifications. Selecting @option{-meabi}
24018 means that the stack is aligned to an 8-byte boundary, a function
24019 @code{__eabi} is called from @code{main} to set up the EABI
24020 environment, and the @option{-msdata} option can use both @code{r2} and
24021 @code{r13} to point to two separate small data areas. Selecting
24022 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24023 no EABI initialization function is called from @code{main}, and the
24024 @option{-msdata} option only uses @code{r13} to point to a single
24025 small data area. The @option{-meabi} option is on by default if you
24026 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24027
24028 @item -msdata=eabi
24029 @opindex msdata=eabi
24030 On System V.4 and embedded PowerPC systems, put small initialized
24031 @code{const} global and static data in the @code{.sdata2} section, which
24032 is pointed to by register @code{r2}. Put small initialized
24033 non-@code{const} global and static data in the @code{.sdata} section,
24034 which is pointed to by register @code{r13}. Put small uninitialized
24035 global and static data in the @code{.sbss} section, which is adjacent to
24036 the @code{.sdata} section. The @option{-msdata=eabi} option is
24037 incompatible with the @option{-mrelocatable} option. The
24038 @option{-msdata=eabi} option also sets the @option{-memb} option.
24039
24040 @item -msdata=sysv
24041 @opindex msdata=sysv
24042 On System V.4 and embedded PowerPC systems, put small global and static
24043 data in the @code{.sdata} section, which is pointed to by register
24044 @code{r13}. Put small uninitialized global and static data in the
24045 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24046 The @option{-msdata=sysv} option is incompatible with the
24047 @option{-mrelocatable} option.
24048
24049 @item -msdata=default
24050 @itemx -msdata
24051 @opindex msdata=default
24052 @opindex msdata
24053 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24054 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24055 same as @option{-msdata=sysv}.
24056
24057 @item -msdata=data
24058 @opindex msdata=data
24059 On System V.4 and embedded PowerPC systems, put small global
24060 data in the @code{.sdata} section. Put small uninitialized global
24061 data in the @code{.sbss} section. Do not use register @code{r13}
24062 to address small data however. This is the default behavior unless
24063 other @option{-msdata} options are used.
24064
24065 @item -msdata=none
24066 @itemx -mno-sdata
24067 @opindex msdata=none
24068 @opindex mno-sdata
24069 On embedded PowerPC systems, put all initialized global and static data
24070 in the @code{.data} section, and all uninitialized data in the
24071 @code{.bss} section.
24072
24073 @item -mblock-move-inline-limit=@var{num}
24074 @opindex mblock-move-inline-limit
24075 Inline all block moves (such as calls to @code{memcpy} or structure
24076 copies) less than or equal to @var{num} bytes. The minimum value for
24077 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24078 targets. The default value is target-specific.
24079
24080 @item -G @var{num}
24081 @opindex G
24082 @cindex smaller data references (PowerPC)
24083 @cindex .sdata/.sdata2 references (PowerPC)
24084 On embedded PowerPC systems, put global and static items less than or
24085 equal to @var{num} bytes into the small data or BSS sections instead of
24086 the normal data or BSS section. By default, @var{num} is 8. The
24087 @option{-G @var{num}} switch is also passed to the linker.
24088 All modules should be compiled with the same @option{-G @var{num}} value.
24089
24090 @item -mregnames
24091 @itemx -mno-regnames
24092 @opindex mregnames
24093 @opindex mno-regnames
24094 On System V.4 and embedded PowerPC systems do (do not) emit register
24095 names in the assembly language output using symbolic forms.
24096
24097 @item -mlongcall
24098 @itemx -mno-longcall
24099 @opindex mlongcall
24100 @opindex mno-longcall
24101 By default assume that all calls are far away so that a longer and more
24102 expensive calling sequence is required. This is required for calls
24103 farther than 32 megabytes (33,554,432 bytes) from the current location.
24104 A short call is generated if the compiler knows
24105 the call cannot be that far away. This setting can be overridden by
24106 the @code{shortcall} function attribute, or by @code{#pragma
24107 longcall(0)}.
24108
24109 Some linkers are capable of detecting out-of-range calls and generating
24110 glue code on the fly. On these systems, long calls are unnecessary and
24111 generate slower code. As of this writing, the AIX linker can do this,
24112 as can the GNU linker for PowerPC/64. It is planned to add this feature
24113 to the GNU linker for 32-bit PowerPC systems as well.
24114
24115 In the future, GCC may ignore all longcall specifications
24116 when the linker is known to generate glue.
24117
24118 @item -mtls-markers
24119 @itemx -mno-tls-markers
24120 @opindex mtls-markers
24121 @opindex mno-tls-markers
24122 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24123 specifying the function argument. The relocation allows the linker to
24124 reliably associate function call with argument setup instructions for
24125 TLS optimization, which in turn allows GCC to better schedule the
24126 sequence.
24127
24128 @item -mrecip
24129 @itemx -mno-recip
24130 @opindex mrecip
24131 This option enables use of the reciprocal estimate and
24132 reciprocal square root estimate instructions with additional
24133 Newton-Raphson steps to increase precision instead of doing a divide or
24134 square root and divide for floating-point arguments. You should use
24135 the @option{-ffast-math} option when using @option{-mrecip} (or at
24136 least @option{-funsafe-math-optimizations},
24137 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24138 @option{-fno-trapping-math}). Note that while the throughput of the
24139 sequence is generally higher than the throughput of the non-reciprocal
24140 instruction, the precision of the sequence can be decreased by up to 2
24141 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24142 roots.
24143
24144 @item -mrecip=@var{opt}
24145 @opindex mrecip=opt
24146 This option controls which reciprocal estimate instructions
24147 may be used. @var{opt} is a comma-separated list of options, which may
24148 be preceded by a @code{!} to invert the option:
24149
24150 @table @samp
24151
24152 @item all
24153 Enable all estimate instructions.
24154
24155 @item default
24156 Enable the default instructions, equivalent to @option{-mrecip}.
24157
24158 @item none
24159 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24160
24161 @item div
24162 Enable the reciprocal approximation instructions for both
24163 single and double precision.
24164
24165 @item divf
24166 Enable the single-precision reciprocal approximation instructions.
24167
24168 @item divd
24169 Enable the double-precision reciprocal approximation instructions.
24170
24171 @item rsqrt
24172 Enable the reciprocal square root approximation instructions for both
24173 single and double precision.
24174
24175 @item rsqrtf
24176 Enable the single-precision reciprocal square root approximation instructions.
24177
24178 @item rsqrtd
24179 Enable the double-precision reciprocal square root approximation instructions.
24180
24181 @end table
24182
24183 So, for example, @option{-mrecip=all,!rsqrtd} enables
24184 all of the reciprocal estimate instructions, except for the
24185 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24186 which handle the double-precision reciprocal square root calculations.
24187
24188 @item -mrecip-precision
24189 @itemx -mno-recip-precision
24190 @opindex mrecip-precision
24191 Assume (do not assume) that the reciprocal estimate instructions
24192 provide higher-precision estimates than is mandated by the PowerPC
24193 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24194 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24195 The double-precision square root estimate instructions are not generated by
24196 default on low-precision machines, since they do not provide an
24197 estimate that converges after three steps.
24198
24199 @item -mpointers-to-nested-functions
24200 @itemx -mno-pointers-to-nested-functions
24201 @opindex mpointers-to-nested-functions
24202 Generate (do not generate) code to load up the static chain register
24203 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
24204 systems where a function pointer points to a 3-word descriptor giving
24205 the function address, TOC value to be loaded in register @code{r2}, and
24206 static chain value to be loaded in register @code{r11}. The
24207 @option{-mpointers-to-nested-functions} is on by default. You cannot
24208 call through pointers to nested functions or pointers
24209 to functions compiled in other languages that use the static chain if
24210 you use @option{-mno-pointers-to-nested-functions}.
24211
24212 @item -msave-toc-indirect
24213 @itemx -mno-save-toc-indirect
24214 @opindex msave-toc-indirect
24215 Generate (do not generate) code to save the TOC value in the reserved
24216 stack location in the function prologue if the function calls through
24217 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
24218 saved in the prologue, it is saved just before the call through the
24219 pointer. The @option{-mno-save-toc-indirect} option is the default.
24220
24221 @item -mcompat-align-parm
24222 @itemx -mno-compat-align-parm
24223 @opindex mcompat-align-parm
24224 Generate (do not generate) code to pass structure parameters with a
24225 maximum alignment of 64 bits, for compatibility with older versions
24226 of GCC.
24227
24228 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
24229 structure parameter on a 128-bit boundary when that structure contained
24230 a member requiring 128-bit alignment. This is corrected in more
24231 recent versions of GCC. This option may be used to generate code
24232 that is compatible with functions compiled with older versions of
24233 GCC.
24234
24235 The @option{-mno-compat-align-parm} option is the default.
24236
24237 @item -mstack-protector-guard=@var{guard}
24238 @itemx -mstack-protector-guard-reg=@var{reg}
24239 @itemx -mstack-protector-guard-offset=@var{offset}
24240 @itemx -mstack-protector-guard-symbol=@var{symbol}
24241 @opindex mstack-protector-guard
24242 @opindex mstack-protector-guard-reg
24243 @opindex mstack-protector-guard-offset
24244 @opindex mstack-protector-guard-symbol
24245 Generate stack protection code using canary at @var{guard}. Supported
24246 locations are @samp{global} for global canary or @samp{tls} for per-thread
24247 canary in the TLS block (the default with GNU libc version 2.4 or later).
24248
24249 With the latter choice the options
24250 @option{-mstack-protector-guard-reg=@var{reg}} and
24251 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
24252 which register to use as base register for reading the canary, and from what
24253 offset from that base register. The default for those is as specified in the
24254 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
24255 the offset with a symbol reference to a canary in the TLS block.
24256 @end table
24257
24258
24259 @node RISC-V Options
24260 @subsection RISC-V Options
24261 @cindex RISC-V Options
24262
24263 These command-line options are defined for RISC-V targets:
24264
24265 @table @gcctabopt
24266 @item -mbranch-cost=@var{n}
24267 @opindex mbranch-cost
24268 Set the cost of branches to roughly @var{n} instructions.
24269
24270 @item -mplt
24271 @itemx -mno-plt
24272 @opindex plt
24273 When generating PIC code, do or don't allow the use of PLTs. Ignored for
24274 non-PIC. The default is @option{-mplt}.
24275
24276 @item -mabi=@var{ABI-string}
24277 @opindex mabi
24278 Specify integer and floating-point calling convention. @var{ABI-string}
24279 contains two parts: the size of integer types and the registers used for
24280 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
24281 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
24282 32-bit), and that floating-point values up to 64 bits wide are passed in F
24283 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
24284 allows the compiler to generate code that uses the F and D extensions but only
24285 allows floating-point values up to 32 bits long to be passed in registers; or
24286 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
24287 passed in registers.
24288
24289 The default for this argument is system dependent, users who want a specific
24290 calling convention should specify one explicitly. The valid calling
24291 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
24292 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
24293 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
24294 invalid because the ABI requires 64-bit values be passed in F registers, but F
24295 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
24296 only be used with the @samp{rv32e} architecture. This ABI is not well
24297 specified at present, and is subject to change.
24298
24299 @item -mfdiv
24300 @itemx -mno-fdiv
24301 @opindex mfdiv
24302 Do or don't use hardware floating-point divide and square root instructions.
24303 This requires the F or D extensions for floating-point registers. The default
24304 is to use them if the specified architecture has these instructions.
24305
24306 @item -mdiv
24307 @itemx -mno-div
24308 @opindex mdiv
24309 Do or don't use hardware instructions for integer division. This requires the
24310 M extension. The default is to use them if the specified architecture has
24311 these instructions.
24312
24313 @item -march=@var{ISA-string}
24314 @opindex march
24315 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
24316 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
24317 @samp{rv32imaf}.
24318
24319 @item -mtune=@var{processor-string}
24320 @opindex mtune
24321 Optimize the output for the given processor, specified by microarchitecture
24322 name.
24323
24324 @item -mpreferred-stack-boundary=@var{num}
24325 @opindex mpreferred-stack-boundary
24326 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24327 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24328 the default is 4 (16 bytes or 128-bits).
24329
24330 @strong{Warning:} If you use this switch, then you must build all modules with
24331 the same value, including any libraries. This includes the system libraries
24332 and startup modules.
24333
24334 @item -msmall-data-limit=@var{n}
24335 @opindex msmall-data-limit
24336 Put global and static data smaller than @var{n} bytes into a special section
24337 (on some targets).
24338
24339 @item -msave-restore
24340 @itemx -mno-save-restore
24341 @opindex msave-restore
24342 Do or don't use smaller but slower prologue and epilogue code that uses
24343 library function calls. The default is to use fast inline prologues and
24344 epilogues.
24345
24346 @item -mstrict-align
24347 @itemx -mno-strict-align
24348 @opindex mstrict-align
24349 Do not or do generate unaligned memory accesses. The default is set depending
24350 on whether the processor we are optimizing for supports fast unaligned access
24351 or not.
24352
24353 @item -mcmodel=medlow
24354 @opindex mcmodel=medlow
24355 Generate code for the medium-low code model. The program and its statically
24356 defined symbols must lie within a single 2 GiB address range and must lie
24357 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24358 statically or dynamically linked. This is the default code model.
24359
24360 @item -mcmodel=medany
24361 @opindex mcmodel=medany
24362 Generate code for the medium-any code model. The program and its statically
24363 defined symbols must be within any single 2 GiB address range. Programs can be
24364 statically or dynamically linked.
24365
24366 @item -mexplicit-relocs
24367 @itemx -mno-exlicit-relocs
24368 Use or do not use assembler relocation operators when dealing with symbolic
24369 addresses. The alternative is to use assembler macros instead, which may
24370 limit optimization.
24371
24372 @item -mrelax
24373 @itemx -mno-relax
24374 Take advantage of linker relaxations to reduce the number of instructions
24375 required to materialize symbol addresses. The default is to take advantage of
24376 linker relaxations.
24377
24378 @end table
24379
24380 @node RL78 Options
24381 @subsection RL78 Options
24382 @cindex RL78 Options
24383
24384 @table @gcctabopt
24385
24386 @item -msim
24387 @opindex msim
24388 Links in additional target libraries to support operation within a
24389 simulator.
24390
24391 @item -mmul=none
24392 @itemx -mmul=g10
24393 @itemx -mmul=g13
24394 @itemx -mmul=g14
24395 @itemx -mmul=rl78
24396 @opindex mmul
24397 Specifies the type of hardware multiplication and division support to
24398 be used. The simplest is @code{none}, which uses software for both
24399 multiplication and division. This is the default. The @code{g13}
24400 value is for the hardware multiply/divide peripheral found on the
24401 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24402 the multiplication and division instructions supported by the RL78/G14
24403 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24404 the value @code{mg10} is an alias for @code{none}.
24405
24406 In addition a C preprocessor macro is defined, based upon the setting
24407 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24408 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24409
24410 @item -mcpu=g10
24411 @itemx -mcpu=g13
24412 @itemx -mcpu=g14
24413 @itemx -mcpu=rl78
24414 @opindex mcpu
24415 Specifies the RL78 core to target. The default is the G14 core, also
24416 known as an S3 core or just RL78. The G13 or S2 core does not have
24417 multiply or divide instructions, instead it uses a hardware peripheral
24418 for these operations. The G10 or S1 core does not have register
24419 banks, so it uses a different calling convention.
24420
24421 If this option is set it also selects the type of hardware multiply
24422 support to use, unless this is overridden by an explicit
24423 @option{-mmul=none} option on the command line. Thus specifying
24424 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24425 peripheral and specifying @option{-mcpu=g10} disables the use of
24426 hardware multiplications altogether.
24427
24428 Note, although the RL78/G14 core is the default target, specifying
24429 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24430 change the behavior of the toolchain since it also enables G14
24431 hardware multiply support. If these options are not specified on the
24432 command line then software multiplication routines will be used even
24433 though the code targets the RL78 core. This is for backwards
24434 compatibility with older toolchains which did not have hardware
24435 multiply and divide support.
24436
24437 In addition a C preprocessor macro is defined, based upon the setting
24438 of this option. Possible values are: @code{__RL78_G10__},
24439 @code{__RL78_G13__} or @code{__RL78_G14__}.
24440
24441 @item -mg10
24442 @itemx -mg13
24443 @itemx -mg14
24444 @itemx -mrl78
24445 @opindex mg10
24446 @opindex mg13
24447 @opindex mg14
24448 @opindex mrl78
24449 These are aliases for the corresponding @option{-mcpu=} option. They
24450 are provided for backwards compatibility.
24451
24452 @item -mallregs
24453 @opindex mallregs
24454 Allow the compiler to use all of the available registers. By default
24455 registers @code{r24..r31} are reserved for use in interrupt handlers.
24456 With this option enabled these registers can be used in ordinary
24457 functions as well.
24458
24459 @item -m64bit-doubles
24460 @itemx -m32bit-doubles
24461 @opindex m64bit-doubles
24462 @opindex m32bit-doubles
24463 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24464 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24465 @option{-m32bit-doubles}.
24466
24467 @item -msave-mduc-in-interrupts
24468 @itemx -mno-save-mduc-in-interrupts
24469 @opindex msave-mduc-in-interrupts
24470 @opindex mno-save-mduc-in-interrupts
24471 Specifies that interrupt handler functions should preserve the
24472 MDUC registers. This is only necessary if normal code might use
24473 the MDUC registers, for example because it performs multiplication
24474 and division operations. The default is to ignore the MDUC registers
24475 as this makes the interrupt handlers faster. The target option -mg13
24476 needs to be passed for this to work as this feature is only available
24477 on the G13 target (S2 core). The MDUC registers will only be saved
24478 if the interrupt handler performs a multiplication or division
24479 operation or it calls another function.
24480
24481 @end table
24482
24483 @node RS/6000 and PowerPC Options
24484 @subsection IBM RS/6000 and PowerPC Options
24485 @cindex RS/6000 and PowerPC Options
24486 @cindex IBM RS/6000 and PowerPC Options
24487
24488 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24489 @table @gcctabopt
24490 @item -mpowerpc-gpopt
24491 @itemx -mno-powerpc-gpopt
24492 @itemx -mpowerpc-gfxopt
24493 @itemx -mno-powerpc-gfxopt
24494 @need 800
24495 @itemx -mpowerpc64
24496 @itemx -mno-powerpc64
24497 @itemx -mmfcrf
24498 @itemx -mno-mfcrf
24499 @itemx -mpopcntb
24500 @itemx -mno-popcntb
24501 @itemx -mpopcntd
24502 @itemx -mno-popcntd
24503 @itemx -mfprnd
24504 @itemx -mno-fprnd
24505 @need 800
24506 @itemx -mcmpb
24507 @itemx -mno-cmpb
24508 @itemx -mmfpgpr
24509 @itemx -mno-mfpgpr
24510 @itemx -mhard-dfp
24511 @itemx -mno-hard-dfp
24512 @opindex mpowerpc-gpopt
24513 @opindex mno-powerpc-gpopt
24514 @opindex mpowerpc-gfxopt
24515 @opindex mno-powerpc-gfxopt
24516 @opindex mpowerpc64
24517 @opindex mno-powerpc64
24518 @opindex mmfcrf
24519 @opindex mno-mfcrf
24520 @opindex mpopcntb
24521 @opindex mno-popcntb
24522 @opindex mpopcntd
24523 @opindex mno-popcntd
24524 @opindex mfprnd
24525 @opindex mno-fprnd
24526 @opindex mcmpb
24527 @opindex mno-cmpb
24528 @opindex mmfpgpr
24529 @opindex mno-mfpgpr
24530 @opindex mhard-dfp
24531 @opindex mno-hard-dfp
24532 You use these options to specify which instructions are available on the
24533 processor you are using. The default value of these options is
24534 determined when configuring GCC@. Specifying the
24535 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24536 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24537 rather than the options listed above.
24538
24539 Specifying @option{-mpowerpc-gpopt} allows
24540 GCC to use the optional PowerPC architecture instructions in the
24541 General Purpose group, including floating-point square root. Specifying
24542 @option{-mpowerpc-gfxopt} allows GCC to
24543 use the optional PowerPC architecture instructions in the Graphics
24544 group, including floating-point select.
24545
24546 The @option{-mmfcrf} option allows GCC to generate the move from
24547 condition register field instruction implemented on the POWER4
24548 processor and other processors that support the PowerPC V2.01
24549 architecture.
24550 The @option{-mpopcntb} option allows GCC to generate the popcount and
24551 double-precision FP reciprocal estimate instruction implemented on the
24552 POWER5 processor and other processors that support the PowerPC V2.02
24553 architecture.
24554 The @option{-mpopcntd} option allows GCC to generate the popcount
24555 instruction implemented on the POWER7 processor and other processors
24556 that support the PowerPC V2.06 architecture.
24557 The @option{-mfprnd} option allows GCC to generate the FP round to
24558 integer instructions implemented on the POWER5+ processor and other
24559 processors that support the PowerPC V2.03 architecture.
24560 The @option{-mcmpb} option allows GCC to generate the compare bytes
24561 instruction implemented on the POWER6 processor and other processors
24562 that support the PowerPC V2.05 architecture.
24563 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
24564 general-purpose register instructions implemented on the POWER6X
24565 processor and other processors that support the extended PowerPC V2.05
24566 architecture.
24567 The @option{-mhard-dfp} option allows GCC to generate the decimal
24568 floating-point instructions implemented on some POWER processors.
24569
24570 The @option{-mpowerpc64} option allows GCC to generate the additional
24571 64-bit instructions that are found in the full PowerPC64 architecture
24572 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24573 @option{-mno-powerpc64}.
24574
24575 @item -mcpu=@var{cpu_type}
24576 @opindex mcpu
24577 Set architecture type, register usage, and
24578 instruction scheduling parameters for machine type @var{cpu_type}.
24579 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24580 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24581 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24582 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24583 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24584 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24585 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24586 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24587 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24588 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24589 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
24590 @samp{rs64}, and @samp{native}.
24591
24592 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24593 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24594 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24595 architecture machine types, with an appropriate, generic processor
24596 model assumed for scheduling purposes.
24597
24598 Specifying @samp{native} as cpu type detects and selects the
24599 architecture option that corresponds to the host processor of the
24600 system performing the compilation.
24601 @option{-mcpu=native} has no effect if GCC does not recognize the
24602 processor.
24603
24604 The other options specify a specific processor. Code generated under
24605 those options runs best on that processor, and may not run at all on
24606 others.
24607
24608 The @option{-mcpu} options automatically enable or disable the
24609 following options:
24610
24611 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24612 -mpopcntb -mpopcntd -mpowerpc64 @gol
24613 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24614 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24615 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24616 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24617
24618 The particular options set for any particular CPU varies between
24619 compiler versions, depending on what setting seems to produce optimal
24620 code for that CPU; it doesn't necessarily reflect the actual hardware's
24621 capabilities. If you wish to set an individual option to a particular
24622 value, you may specify it after the @option{-mcpu} option, like
24623 @option{-mcpu=970 -mno-altivec}.
24624
24625 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24626 not enabled or disabled by the @option{-mcpu} option at present because
24627 AIX does not have full support for these options. You may still
24628 enable or disable them individually if you're sure it'll work in your
24629 environment.
24630
24631 @item -mtune=@var{cpu_type}
24632 @opindex mtune
24633 Set the instruction scheduling parameters for machine type
24634 @var{cpu_type}, but do not set the architecture type or register usage,
24635 as @option{-mcpu=@var{cpu_type}} does. The same
24636 values for @var{cpu_type} are used for @option{-mtune} as for
24637 @option{-mcpu}. If both are specified, the code generated uses the
24638 architecture and registers set by @option{-mcpu}, but the
24639 scheduling parameters set by @option{-mtune}.
24640
24641 @item -mcmodel=small
24642 @opindex mcmodel=small
24643 Generate PowerPC64 code for the small model: The TOC is limited to
24644 64k.
24645
24646 @item -mcmodel=medium
24647 @opindex mcmodel=medium
24648 Generate PowerPC64 code for the medium model: The TOC and other static
24649 data may be up to a total of 4G in size. This is the default for 64-bit
24650 Linux.
24651
24652 @item -mcmodel=large
24653 @opindex mcmodel=large
24654 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24655 in size. Other data and code is only limited by the 64-bit address
24656 space.
24657
24658 @item -maltivec
24659 @itemx -mno-altivec
24660 @opindex maltivec
24661 @opindex mno-altivec
24662 Generate code that uses (does not use) AltiVec instructions, and also
24663 enable the use of built-in functions that allow more direct access to
24664 the AltiVec instruction set. You may also need to set
24665 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24666 enhancements.
24667
24668 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
24669 @option{-maltivec=be}, the element order for AltiVec intrinsics such
24670 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24671 match array element order corresponding to the endianness of the
24672 target. That is, element zero identifies the leftmost element in a
24673 vector register when targeting a big-endian platform, and identifies
24674 the rightmost element in a vector register when targeting a
24675 little-endian platform.
24676
24677 @item -maltivec=be
24678 @opindex maltivec=be
24679 Generate AltiVec instructions using big-endian element order,
24680 regardless of whether the target is big- or little-endian. This is
24681 the default when targeting a big-endian platform. Using this option
24682 is currently deprecated. Support for this feature will be removed in
24683 GCC 9.
24684
24685 The element order is used to interpret element numbers in AltiVec
24686 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
24687 @code{vec_insert}. By default, these match array element order
24688 corresponding to the endianness for the target.
24689
24690 @item -maltivec=le
24691 @opindex maltivec=le
24692 Generate AltiVec instructions using little-endian element order,
24693 regardless of whether the target is big- or little-endian. This is
24694 the default when targeting a little-endian platform. This option is
24695 currently ignored when targeting a big-endian platform.
24696
24697 The element order is used to interpret element numbers in AltiVec
24698 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
24699 @code{vec_insert}. By default, these match array element order
24700 corresponding to the endianness for the target.
24701
24702 @item -mvrsave
24703 @itemx -mno-vrsave
24704 @opindex mvrsave
24705 @opindex mno-vrsave
24706 Generate VRSAVE instructions when generating AltiVec code.
24707
24708 @item -msecure-plt
24709 @opindex msecure-plt
24710 Generate code that allows @command{ld} and @command{ld.so}
24711 to build executables and shared
24712 libraries with non-executable @code{.plt} and @code{.got} sections.
24713 This is a PowerPC
24714 32-bit SYSV ABI option.
24715
24716 @item -mbss-plt
24717 @opindex mbss-plt
24718 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24719 fills in, and
24720 requires @code{.plt} and @code{.got}
24721 sections that are both writable and executable.
24722 This is a PowerPC 32-bit SYSV ABI option.
24723
24724 @item -misel
24725 @itemx -mno-isel
24726 @opindex misel
24727 @opindex mno-isel
24728 This switch enables or disables the generation of ISEL instructions.
24729
24730 @item -mvsx
24731 @itemx -mno-vsx
24732 @opindex mvsx
24733 @opindex mno-vsx
24734 Generate code that uses (does not use) vector/scalar (VSX)
24735 instructions, and also enable the use of built-in functions that allow
24736 more direct access to the VSX instruction set.
24737
24738 @item -mcrypto
24739 @itemx -mno-crypto
24740 @opindex mcrypto
24741 @opindex mno-crypto
24742 Enable the use (disable) of the built-in functions that allow direct
24743 access to the cryptographic instructions that were added in version
24744 2.07 of the PowerPC ISA.
24745
24746 @item -mhtm
24747 @itemx -mno-htm
24748 @opindex mhtm
24749 @opindex mno-htm
24750 Enable (disable) the use of the built-in functions that allow direct
24751 access to the Hardware Transactional Memory (HTM) instructions that
24752 were added in version 2.07 of the PowerPC ISA.
24753
24754 @item -mpower8-fusion
24755 @itemx -mno-power8-fusion
24756 @opindex mpower8-fusion
24757 @opindex mno-power8-fusion
24758 Generate code that keeps (does not keeps) some integer operations
24759 adjacent so that the instructions can be fused together on power8 and
24760 later processors.
24761
24762 @item -mpower8-vector
24763 @itemx -mno-power8-vector
24764 @opindex mpower8-vector
24765 @opindex mno-power8-vector
24766 Generate code that uses (does not use) the vector and scalar
24767 instructions that were added in version 2.07 of the PowerPC ISA. Also
24768 enable the use of built-in functions that allow more direct access to
24769 the vector instructions.
24770
24771 @item -mquad-memory
24772 @itemx -mno-quad-memory
24773 @opindex mquad-memory
24774 @opindex mno-quad-memory
24775 Generate code that uses (does not use) the non-atomic quad word memory
24776 instructions. The @option{-mquad-memory} option requires use of
24777 64-bit mode.
24778
24779 @item -mquad-memory-atomic
24780 @itemx -mno-quad-memory-atomic
24781 @opindex mquad-memory-atomic
24782 @opindex mno-quad-memory-atomic
24783 Generate code that uses (does not use) the atomic quad word memory
24784 instructions. The @option{-mquad-memory-atomic} option requires use of
24785 64-bit mode.
24786
24787 @item -mfloat128
24788 @itemx -mno-float128
24789 @opindex mfloat128
24790 @opindex mno-float128
24791 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24792 and use either software emulation for IEEE 128-bit floating point or
24793 hardware instructions.
24794
24795 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24796 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24797 use the IEEE 128-bit floating point support. The IEEE 128-bit
24798 floating point support only works on PowerPC Linux systems.
24799
24800 The default for @option{-mfloat128} is enabled on PowerPC Linux
24801 systems using the VSX instruction set, and disabled on other systems.
24802
24803 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24804 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24805 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24806 floating point instructions. Otherwise, if you do not specify to
24807 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24808 system, IEEE 128-bit floating point will be done with software
24809 emulation.
24810
24811 @item -mfloat128-hardware
24812 @itemx -mno-float128-hardware
24813 @opindex mfloat128-hardware
24814 @opindex mno-float128-hardware
24815 Enable/disable using ISA 3.0 hardware instructions to support the
24816 @var{__float128} data type.
24817
24818 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24819 Linux systems using the ISA 3.0 instruction set, and disabled on other
24820 systems.
24821
24822 @item -m32
24823 @itemx -m64
24824 @opindex m32
24825 @opindex m64
24826 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24827 targets (including GNU/Linux). The 32-bit environment sets int, long
24828 and pointer to 32 bits and generates code that runs on any PowerPC
24829 variant. The 64-bit environment sets int to 32 bits and long and
24830 pointer to 64 bits, and generates code for PowerPC64, as for
24831 @option{-mpowerpc64}.
24832
24833 @item -mfull-toc
24834 @itemx -mno-fp-in-toc
24835 @itemx -mno-sum-in-toc
24836 @itemx -mminimal-toc
24837 @opindex mfull-toc
24838 @opindex mno-fp-in-toc
24839 @opindex mno-sum-in-toc
24840 @opindex mminimal-toc
24841 Modify generation of the TOC (Table Of Contents), which is created for
24842 every executable file. The @option{-mfull-toc} option is selected by
24843 default. In that case, GCC allocates at least one TOC entry for
24844 each unique non-automatic variable reference in your program. GCC
24845 also places floating-point constants in the TOC@. However, only
24846 16,384 entries are available in the TOC@.
24847
24848 If you receive a linker error message that saying you have overflowed
24849 the available TOC space, you can reduce the amount of TOC space used
24850 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24851 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24852 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24853 generate code to calculate the sum of an address and a constant at
24854 run time instead of putting that sum into the TOC@. You may specify one
24855 or both of these options. Each causes GCC to produce very slightly
24856 slower and larger code at the expense of conserving TOC space.
24857
24858 If you still run out of space in the TOC even when you specify both of
24859 these options, specify @option{-mminimal-toc} instead. This option causes
24860 GCC to make only one TOC entry for every file. When you specify this
24861 option, GCC produces code that is slower and larger but which
24862 uses extremely little TOC space. You may wish to use this option
24863 only on files that contain less frequently-executed code.
24864
24865 @item -maix64
24866 @itemx -maix32
24867 @opindex maix64
24868 @opindex maix32
24869 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24870 @code{long} type, and the infrastructure needed to support them.
24871 Specifying @option{-maix64} implies @option{-mpowerpc64},
24872 while @option{-maix32} disables the 64-bit ABI and
24873 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24874
24875 @item -mxl-compat
24876 @itemx -mno-xl-compat
24877 @opindex mxl-compat
24878 @opindex mno-xl-compat
24879 Produce code that conforms more closely to IBM XL compiler semantics
24880 when using AIX-compatible ABI@. Pass floating-point arguments to
24881 prototyped functions beyond the register save area (RSA) on the stack
24882 in addition to argument FPRs. Do not assume that most significant
24883 double in 128-bit long double value is properly rounded when comparing
24884 values and converting to double. Use XL symbol names for long double
24885 support routines.
24886
24887 The AIX calling convention was extended but not initially documented to
24888 handle an obscure K&R C case of calling a function that takes the
24889 address of its arguments with fewer arguments than declared. IBM XL
24890 compilers access floating-point arguments that do not fit in the
24891 RSA from the stack when a subroutine is compiled without
24892 optimization. Because always storing floating-point arguments on the
24893 stack is inefficient and rarely needed, this option is not enabled by
24894 default and only is necessary when calling subroutines compiled by IBM
24895 XL compilers without optimization.
24896
24897 @item -mpe
24898 @opindex mpe
24899 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24900 application written to use message passing with special startup code to
24901 enable the application to run. The system must have PE installed in the
24902 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24903 must be overridden with the @option{-specs=} option to specify the
24904 appropriate directory location. The Parallel Environment does not
24905 support threads, so the @option{-mpe} option and the @option{-pthread}
24906 option are incompatible.
24907
24908 @item -malign-natural
24909 @itemx -malign-power
24910 @opindex malign-natural
24911 @opindex malign-power
24912 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24913 @option{-malign-natural} overrides the ABI-defined alignment of larger
24914 types, such as floating-point doubles, on their natural size-based boundary.
24915 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24916 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24917
24918 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24919 is not supported.
24920
24921 @item -msoft-float
24922 @itemx -mhard-float
24923 @opindex msoft-float
24924 @opindex mhard-float
24925 Generate code that does not use (uses) the floating-point register set.
24926 Software floating-point emulation is provided if you use the
24927 @option{-msoft-float} option, and pass the option to GCC when linking.
24928
24929 @item -mmultiple
24930 @itemx -mno-multiple
24931 @opindex mmultiple
24932 @opindex mno-multiple
24933 Generate code that uses (does not use) the load multiple word
24934 instructions and the store multiple word instructions. These
24935 instructions are generated by default on POWER systems, and not
24936 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24937 PowerPC systems, since those instructions do not work when the
24938 processor is in little-endian mode. The exceptions are PPC740 and
24939 PPC750 which permit these instructions in little-endian mode.
24940
24941 @item -mupdate
24942 @itemx -mno-update
24943 @opindex mupdate
24944 @opindex mno-update
24945 Generate code that uses (does not use) the load or store instructions
24946 that update the base register to the address of the calculated memory
24947 location. These instructions are generated by default. If you use
24948 @option{-mno-update}, there is a small window between the time that the
24949 stack pointer is updated and the address of the previous frame is
24950 stored, which means code that walks the stack frame across interrupts or
24951 signals may get corrupted data.
24952
24953 @item -mavoid-indexed-addresses
24954 @itemx -mno-avoid-indexed-addresses
24955 @opindex mavoid-indexed-addresses
24956 @opindex mno-avoid-indexed-addresses
24957 Generate code that tries to avoid (not avoid) the use of indexed load
24958 or store instructions. These instructions can incur a performance
24959 penalty on Power6 processors in certain situations, such as when
24960 stepping through large arrays that cross a 16M boundary. This option
24961 is enabled by default when targeting Power6 and disabled otherwise.
24962
24963 @item -mfused-madd
24964 @itemx -mno-fused-madd
24965 @opindex mfused-madd
24966 @opindex mno-fused-madd
24967 Generate code that uses (does not use) the floating-point multiply and
24968 accumulate instructions. These instructions are generated by default
24969 if hardware floating point is used. The machine-dependent
24970 @option{-mfused-madd} option is now mapped to the machine-independent
24971 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24972 mapped to @option{-ffp-contract=off}.
24973
24974 @item -mmulhw
24975 @itemx -mno-mulhw
24976 @opindex mmulhw
24977 @opindex mno-mulhw
24978 Generate code that uses (does not use) the half-word multiply and
24979 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24980 These instructions are generated by default when targeting those
24981 processors.
24982
24983 @item -mdlmzb
24984 @itemx -mno-dlmzb
24985 @opindex mdlmzb
24986 @opindex mno-dlmzb
24987 Generate code that uses (does not use) the string-search @samp{dlmzb}
24988 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24989 generated by default when targeting those processors.
24990
24991 @item -mno-bit-align
24992 @itemx -mbit-align
24993 @opindex mno-bit-align
24994 @opindex mbit-align
24995 On System V.4 and embedded PowerPC systems do not (do) force structures
24996 and unions that contain bit-fields to be aligned to the base type of the
24997 bit-field.
24998
24999 For example, by default a structure containing nothing but 8
25000 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
25001 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
25002 the structure is aligned to a 1-byte boundary and is 1 byte in
25003 size.
25004
25005 @item -mno-strict-align
25006 @itemx -mstrict-align
25007 @opindex mno-strict-align
25008 @opindex mstrict-align
25009 On System V.4 and embedded PowerPC systems do not (do) assume that
25010 unaligned memory references are handled by the system.
25011
25012 @item -mrelocatable
25013 @itemx -mno-relocatable
25014 @opindex mrelocatable
25015 @opindex mno-relocatable
25016 Generate code that allows (does not allow) a static executable to be
25017 relocated to a different address at run time. A simple embedded
25018 PowerPC system loader should relocate the entire contents of
25019 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
25020 a table of 32-bit addresses generated by this option. For this to
25021 work, all objects linked together must be compiled with
25022 @option{-mrelocatable} or @option{-mrelocatable-lib}.
25023 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
25024
25025 @item -mrelocatable-lib
25026 @itemx -mno-relocatable-lib
25027 @opindex mrelocatable-lib
25028 @opindex mno-relocatable-lib
25029 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
25030 @code{.fixup} section to allow static executables to be relocated at
25031 run time, but @option{-mrelocatable-lib} does not use the smaller stack
25032 alignment of @option{-mrelocatable}. Objects compiled with
25033 @option{-mrelocatable-lib} may be linked with objects compiled with
25034 any combination of the @option{-mrelocatable} options.
25035
25036 @item -mno-toc
25037 @itemx -mtoc
25038 @opindex mno-toc
25039 @opindex mtoc
25040 On System V.4 and embedded PowerPC systems do not (do) assume that
25041 register 2 contains a pointer to a global area pointing to the addresses
25042 used in the program.
25043
25044 @item -mlittle
25045 @itemx -mlittle-endian
25046 @opindex mlittle
25047 @opindex mlittle-endian
25048 On System V.4 and embedded PowerPC systems compile code for the
25049 processor in little-endian mode. The @option{-mlittle-endian} option is
25050 the same as @option{-mlittle}.
25051
25052 @item -mbig
25053 @itemx -mbig-endian
25054 @opindex mbig
25055 @opindex mbig-endian
25056 On System V.4 and embedded PowerPC systems compile code for the
25057 processor in big-endian mode. The @option{-mbig-endian} option is
25058 the same as @option{-mbig}.
25059
25060 @item -mdynamic-no-pic
25061 @opindex mdynamic-no-pic
25062 On Darwin and Mac OS X systems, compile code so that it is not
25063 relocatable, but that its external references are relocatable. The
25064 resulting code is suitable for applications, but not shared
25065 libraries.
25066
25067 @item -msingle-pic-base
25068 @opindex msingle-pic-base
25069 Treat the register used for PIC addressing as read-only, rather than
25070 loading it in the prologue for each function. The runtime system is
25071 responsible for initializing this register with an appropriate value
25072 before execution begins.
25073
25074 @item -mprioritize-restricted-insns=@var{priority}
25075 @opindex mprioritize-restricted-insns
25076 This option controls the priority that is assigned to
25077 dispatch-slot restricted instructions during the second scheduling
25078 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
25079 or @samp{2} to assign no, highest, or second-highest (respectively)
25080 priority to dispatch-slot restricted
25081 instructions.
25082
25083 @item -msched-costly-dep=@var{dependence_type}
25084 @opindex msched-costly-dep
25085 This option controls which dependences are considered costly
25086 by the target during instruction scheduling. The argument
25087 @var{dependence_type} takes one of the following values:
25088
25089 @table @asis
25090 @item @samp{no}
25091 No dependence is costly.
25092
25093 @item @samp{all}
25094 All dependences are costly.
25095
25096 @item @samp{true_store_to_load}
25097 A true dependence from store to load is costly.
25098
25099 @item @samp{store_to_load}
25100 Any dependence from store to load is costly.
25101
25102 @item @var{number}
25103 Any dependence for which the latency is greater than or equal to
25104 @var{number} is costly.
25105 @end table
25106
25107 @item -minsert-sched-nops=@var{scheme}
25108 @opindex minsert-sched-nops
25109 This option controls which NOP insertion scheme is used during
25110 the second scheduling pass. The argument @var{scheme} takes one of the
25111 following values:
25112
25113 @table @asis
25114 @item @samp{no}
25115 Don't insert NOPs.
25116
25117 @item @samp{pad}
25118 Pad with NOPs any dispatch group that has vacant issue slots,
25119 according to the scheduler's grouping.
25120
25121 @item @samp{regroup_exact}
25122 Insert NOPs to force costly dependent insns into
25123 separate groups. Insert exactly as many NOPs as needed to force an insn
25124 to a new group, according to the estimated processor grouping.
25125
25126 @item @var{number}
25127 Insert NOPs to force costly dependent insns into
25128 separate groups. Insert @var{number} NOPs to force an insn to a new group.
25129 @end table
25130
25131 @item -mcall-sysv
25132 @opindex mcall-sysv
25133 On System V.4 and embedded PowerPC systems compile code using calling
25134 conventions that adhere to the March 1995 draft of the System V
25135 Application Binary Interface, PowerPC processor supplement. This is the
25136 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
25137
25138 @item -mcall-sysv-eabi
25139 @itemx -mcall-eabi
25140 @opindex mcall-sysv-eabi
25141 @opindex mcall-eabi
25142 Specify both @option{-mcall-sysv} and @option{-meabi} options.
25143
25144 @item -mcall-sysv-noeabi
25145 @opindex mcall-sysv-noeabi
25146 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
25147
25148 @item -mcall-aixdesc
25149 @opindex m
25150 On System V.4 and embedded PowerPC systems compile code for the AIX
25151 operating system.
25152
25153 @item -mcall-linux
25154 @opindex mcall-linux
25155 On System V.4 and embedded PowerPC systems compile code for the
25156 Linux-based GNU system.
25157
25158 @item -mcall-freebsd
25159 @opindex mcall-freebsd
25160 On System V.4 and embedded PowerPC systems compile code for the
25161 FreeBSD operating system.
25162
25163 @item -mcall-netbsd
25164 @opindex mcall-netbsd
25165 On System V.4 and embedded PowerPC systems compile code for the
25166 NetBSD operating system.
25167
25168 @item -mcall-openbsd
25169 @opindex mcall-netbsd
25170 On System V.4 and embedded PowerPC systems compile code for the
25171 OpenBSD operating system.
25172
25173 @item -mtraceback=@var{traceback_type}
25174 @opindex mtraceback
25175 Select the type of traceback table. Valid values for @var{traceback_type}
25176 are @samp{full}, @samp{part}, and @samp{no}.
25177
25178 @item -maix-struct-return
25179 @opindex maix-struct-return
25180 Return all structures in memory (as specified by the AIX ABI)@.
25181
25182 @item -msvr4-struct-return
25183 @opindex msvr4-struct-return
25184 Return structures smaller than 8 bytes in registers (as specified by the
25185 SVR4 ABI)@.
25186
25187 @item -mabi=@var{abi-type}
25188 @opindex mabi
25189 Extend the current ABI with a particular extension, or remove such extension.
25190 Valid values are @samp{altivec}, @samp{no-altivec},
25191 @samp{ibmlongdouble}, @samp{ieeelongdouble},
25192 @samp{elfv1}, @samp{elfv2}@.
25193
25194 @item -mabi=ibmlongdouble
25195 @opindex mabi=ibmlongdouble
25196 Change the current ABI to use IBM extended-precision long double.
25197 This is not likely to work if your system defaults to using IEEE
25198 extended-precision long double. If you change the long double type
25199 from IEEE extended-precision, the compiler will issue a warning unless
25200 you use the @option{-Wno-psabi} option.
25201
25202 @item -mabi=ieeelongdouble
25203 @opindex mabi=ieeelongdouble
25204 Change the current ABI to use IEEE extended-precision long double.
25205 This is not likely to work if your system defaults to using IBM
25206 extended-precision long double. If you change the long double type
25207 from IBM extended-precision, the compiler will issue a warning unless
25208 you use the @option{-Wno-psabi} option.
25209
25210 @item -mabi=elfv1
25211 @opindex mabi=elfv1
25212 Change the current ABI to use the ELFv1 ABI.
25213 This is the default ABI for big-endian PowerPC 64-bit Linux.
25214 Overriding the default ABI requires special system support and is
25215 likely to fail in spectacular ways.
25216
25217 @item -mabi=elfv2
25218 @opindex mabi=elfv2
25219 Change the current ABI to use the ELFv2 ABI.
25220 This is the default ABI for little-endian PowerPC 64-bit Linux.
25221 Overriding the default ABI requires special system support and is
25222 likely to fail in spectacular ways.
25223
25224 @item -mgnu-attribute
25225 @itemx -mno-gnu-attribute
25226 @opindex mgnu-attribute
25227 @opindex mno-gnu-attribute
25228 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25229 .gnu.attributes section that specify ABI variations in function
25230 parameters or return values.
25231
25232 @item -mprototype
25233 @itemx -mno-prototype
25234 @opindex mprototype
25235 @opindex mno-prototype
25236 On System V.4 and embedded PowerPC systems assume that all calls to
25237 variable argument functions are properly prototyped. Otherwise, the
25238 compiler must insert an instruction before every non-prototyped call to
25239 set or clear bit 6 of the condition code register (@code{CR}) to
25240 indicate whether floating-point values are passed in the floating-point
25241 registers in case the function takes variable arguments. With
25242 @option{-mprototype}, only calls to prototyped variable argument functions
25243 set or clear the bit.
25244
25245 @item -msim
25246 @opindex msim
25247 On embedded PowerPC systems, assume that the startup module is called
25248 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
25249 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
25250 configurations.
25251
25252 @item -mmvme
25253 @opindex mmvme
25254 On embedded PowerPC systems, assume that the startup module is called
25255 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
25256 @file{libc.a}.
25257
25258 @item -mads
25259 @opindex mads
25260 On embedded PowerPC systems, assume that the startup module is called
25261 @file{crt0.o} and the standard C libraries are @file{libads.a} and
25262 @file{libc.a}.
25263
25264 @item -myellowknife
25265 @opindex myellowknife
25266 On embedded PowerPC systems, assume that the startup module is called
25267 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
25268 @file{libc.a}.
25269
25270 @item -mvxworks
25271 @opindex mvxworks
25272 On System V.4 and embedded PowerPC systems, specify that you are
25273 compiling for a VxWorks system.
25274
25275 @item -memb
25276 @opindex memb
25277 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
25278 header to indicate that @samp{eabi} extended relocations are used.
25279
25280 @item -meabi
25281 @itemx -mno-eabi
25282 @opindex meabi
25283 @opindex mno-eabi
25284 On System V.4 and embedded PowerPC systems do (do not) adhere to the
25285 Embedded Applications Binary Interface (EABI), which is a set of
25286 modifications to the System V.4 specifications. Selecting @option{-meabi}
25287 means that the stack is aligned to an 8-byte boundary, a function
25288 @code{__eabi} is called from @code{main} to set up the EABI
25289 environment, and the @option{-msdata} option can use both @code{r2} and
25290 @code{r13} to point to two separate small data areas. Selecting
25291 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
25292 no EABI initialization function is called from @code{main}, and the
25293 @option{-msdata} option only uses @code{r13} to point to a single
25294 small data area. The @option{-meabi} option is on by default if you
25295 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
25296
25297 @item -msdata=eabi
25298 @opindex msdata=eabi
25299 On System V.4 and embedded PowerPC systems, put small initialized
25300 @code{const} global and static data in the @code{.sdata2} section, which
25301 is pointed to by register @code{r2}. Put small initialized
25302 non-@code{const} global and static data in the @code{.sdata} section,
25303 which is pointed to by register @code{r13}. Put small uninitialized
25304 global and static data in the @code{.sbss} section, which is adjacent to
25305 the @code{.sdata} section. The @option{-msdata=eabi} option is
25306 incompatible with the @option{-mrelocatable} option. The
25307 @option{-msdata=eabi} option also sets the @option{-memb} option.
25308
25309 @item -msdata=sysv
25310 @opindex msdata=sysv
25311 On System V.4 and embedded PowerPC systems, put small global and static
25312 data in the @code{.sdata} section, which is pointed to by register
25313 @code{r13}. Put small uninitialized global and static data in the
25314 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
25315 The @option{-msdata=sysv} option is incompatible with the
25316 @option{-mrelocatable} option.
25317
25318 @item -msdata=default
25319 @itemx -msdata
25320 @opindex msdata=default
25321 @opindex msdata
25322 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
25323 compile code the same as @option{-msdata=eabi}, otherwise compile code the
25324 same as @option{-msdata=sysv}.
25325
25326 @item -msdata=data
25327 @opindex msdata=data
25328 On System V.4 and embedded PowerPC systems, put small global
25329 data in the @code{.sdata} section. Put small uninitialized global
25330 data in the @code{.sbss} section. Do not use register @code{r13}
25331 to address small data however. This is the default behavior unless
25332 other @option{-msdata} options are used.
25333
25334 @item -msdata=none
25335 @itemx -mno-sdata
25336 @opindex msdata=none
25337 @opindex mno-sdata
25338 On embedded PowerPC systems, put all initialized global and static data
25339 in the @code{.data} section, and all uninitialized data in the
25340 @code{.bss} section.
25341
25342 @item -mreadonly-in-sdata
25343 @opindex mreadonly-in-sdata
25344 @opindex mno-readonly-in-sdata
25345 Put read-only objects in the @code{.sdata} section as well. This is the
25346 default.
25347
25348 @item -mblock-move-inline-limit=@var{num}
25349 @opindex mblock-move-inline-limit
25350 Inline all block moves (such as calls to @code{memcpy} or structure
25351 copies) less than or equal to @var{num} bytes. The minimum value for
25352 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25353 targets. The default value is target-specific.
25354
25355 @item -mblock-compare-inline-limit=@var{num}
25356 @opindex mblock-compare-inline-limit
25357 Generate non-looping inline code for all block compares (such as calls
25358 to @code{memcmp} or structure compares) less than or equal to @var{num}
25359 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25360 block compare is disabled. The default value is target-specific.
25361
25362 @item -mblock-compare-inline-loop-limit=@var{num}
25363 @opindex mblock-compare-inline-loop-limit
25364 Generate an inline expansion using loop code for all block compares that
25365 are less than or equal to @var{num} bytes, but greater than the limit
25366 for non-loop inline block compare expansion. If the block length is not
25367 constant, at most @var{num} bytes will be compared before @code{memcmp}
25368 is called to compare the remainder of the block. The default value is
25369 target-specific.
25370
25371 @item -mstring-compare-inline-limit=@var{num}
25372 @opindex mstring-compare-inline-limit
25373 Compare at most @var{num} string bytes with inline code.
25374 If the difference or end of string is not found at the
25375 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25376 take care of the rest of the comparison. The default is 64 bytes.
25377
25378 @item -G @var{num}
25379 @opindex G
25380 @cindex smaller data references (PowerPC)
25381 @cindex .sdata/.sdata2 references (PowerPC)
25382 On embedded PowerPC systems, put global and static items less than or
25383 equal to @var{num} bytes into the small data or BSS sections instead of
25384 the normal data or BSS section. By default, @var{num} is 8. The
25385 @option{-G @var{num}} switch is also passed to the linker.
25386 All modules should be compiled with the same @option{-G @var{num}} value.
25387
25388 @item -mregnames
25389 @itemx -mno-regnames
25390 @opindex mregnames
25391 @opindex mno-regnames
25392 On System V.4 and embedded PowerPC systems do (do not) emit register
25393 names in the assembly language output using symbolic forms.
25394
25395 @item -mlongcall
25396 @itemx -mno-longcall
25397 @opindex mlongcall
25398 @opindex mno-longcall
25399 By default assume that all calls are far away so that a longer and more
25400 expensive calling sequence is required. This is required for calls
25401 farther than 32 megabytes (33,554,432 bytes) from the current location.
25402 A short call is generated if the compiler knows
25403 the call cannot be that far away. This setting can be overridden by
25404 the @code{shortcall} function attribute, or by @code{#pragma
25405 longcall(0)}.
25406
25407 Some linkers are capable of detecting out-of-range calls and generating
25408 glue code on the fly. On these systems, long calls are unnecessary and
25409 generate slower code. As of this writing, the AIX linker can do this,
25410 as can the GNU linker for PowerPC/64. It is planned to add this feature
25411 to the GNU linker for 32-bit PowerPC systems as well.
25412
25413 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25414 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25415 addresses represent the callee and the branch island. The
25416 Darwin/PPC linker prefers the first address and generates a @code{bl
25417 callee} if the PPC @code{bl} instruction reaches the callee directly;
25418 otherwise, the linker generates @code{bl L42} to call the branch
25419 island. The branch island is appended to the body of the
25420 calling function; it computes the full 32-bit address of the callee
25421 and jumps to it.
25422
25423 On Mach-O (Darwin) systems, this option directs the compiler emit to
25424 the glue for every direct call, and the Darwin linker decides whether
25425 to use or discard it.
25426
25427 In the future, GCC may ignore all longcall specifications
25428 when the linker is known to generate glue.
25429
25430 @item -mtls-markers
25431 @itemx -mno-tls-markers
25432 @opindex mtls-markers
25433 @opindex mno-tls-markers
25434 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25435 specifying the function argument. The relocation allows the linker to
25436 reliably associate function call with argument setup instructions for
25437 TLS optimization, which in turn allows GCC to better schedule the
25438 sequence.
25439
25440 @item -mrecip
25441 @itemx -mno-recip
25442 @opindex mrecip
25443 This option enables use of the reciprocal estimate and
25444 reciprocal square root estimate instructions with additional
25445 Newton-Raphson steps to increase precision instead of doing a divide or
25446 square root and divide for floating-point arguments. You should use
25447 the @option{-ffast-math} option when using @option{-mrecip} (or at
25448 least @option{-funsafe-math-optimizations},
25449 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25450 @option{-fno-trapping-math}). Note that while the throughput of the
25451 sequence is generally higher than the throughput of the non-reciprocal
25452 instruction, the precision of the sequence can be decreased by up to 2
25453 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25454 roots.
25455
25456 @item -mrecip=@var{opt}
25457 @opindex mrecip=opt
25458 This option controls which reciprocal estimate instructions
25459 may be used. @var{opt} is a comma-separated list of options, which may
25460 be preceded by a @code{!} to invert the option:
25461
25462 @table @samp
25463
25464 @item all
25465 Enable all estimate instructions.
25466
25467 @item default
25468 Enable the default instructions, equivalent to @option{-mrecip}.
25469
25470 @item none
25471 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25472
25473 @item div
25474 Enable the reciprocal approximation instructions for both
25475 single and double precision.
25476
25477 @item divf
25478 Enable the single-precision reciprocal approximation instructions.
25479
25480 @item divd
25481 Enable the double-precision reciprocal approximation instructions.
25482
25483 @item rsqrt
25484 Enable the reciprocal square root approximation instructions for both
25485 single and double precision.
25486
25487 @item rsqrtf
25488 Enable the single-precision reciprocal square root approximation instructions.
25489
25490 @item rsqrtd
25491 Enable the double-precision reciprocal square root approximation instructions.
25492
25493 @end table
25494
25495 So, for example, @option{-mrecip=all,!rsqrtd} enables
25496 all of the reciprocal estimate instructions, except for the
25497 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25498 which handle the double-precision reciprocal square root calculations.
25499
25500 @item -mrecip-precision
25501 @itemx -mno-recip-precision
25502 @opindex mrecip-precision
25503 Assume (do not assume) that the reciprocal estimate instructions
25504 provide higher-precision estimates than is mandated by the PowerPC
25505 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25506 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25507 The double-precision square root estimate instructions are not generated by
25508 default on low-precision machines, since they do not provide an
25509 estimate that converges after three steps.
25510
25511 @item -mveclibabi=@var{type}
25512 @opindex mveclibabi
25513 Specifies the ABI type to use for vectorizing intrinsics using an
25514 external library. The only type supported at present is @samp{mass},
25515 which specifies to use IBM's Mathematical Acceleration Subsystem
25516 (MASS) libraries for vectorizing intrinsics using external libraries.
25517 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25518 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25519 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25520 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25521 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25522 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25523 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25524 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25525 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25526 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25527 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25528 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25529 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25530 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25531 for power7. Both @option{-ftree-vectorize} and
25532 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25533 libraries must be specified at link time.
25534
25535 @item -mfriz
25536 @itemx -mno-friz
25537 @opindex mfriz
25538 Generate (do not generate) the @code{friz} instruction when the
25539 @option{-funsafe-math-optimizations} option is used to optimize
25540 rounding of floating-point values to 64-bit integer and back to floating
25541 point. The @code{friz} instruction does not return the same value if
25542 the floating-point number is too large to fit in an integer.
25543
25544 @item -mpointers-to-nested-functions
25545 @itemx -mno-pointers-to-nested-functions
25546 @opindex mpointers-to-nested-functions
25547 Generate (do not generate) code to load up the static chain register
25548 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25549 systems where a function pointer points to a 3-word descriptor giving
25550 the function address, TOC value to be loaded in register @code{r2}, and
25551 static chain value to be loaded in register @code{r11}. The
25552 @option{-mpointers-to-nested-functions} is on by default. You cannot
25553 call through pointers to nested functions or pointers
25554 to functions compiled in other languages that use the static chain if
25555 you use @option{-mno-pointers-to-nested-functions}.
25556
25557 @item -msave-toc-indirect
25558 @itemx -mno-save-toc-indirect
25559 @opindex msave-toc-indirect
25560 Generate (do not generate) code to save the TOC value in the reserved
25561 stack location in the function prologue if the function calls through
25562 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25563 saved in the prologue, it is saved just before the call through the
25564 pointer. The @option{-mno-save-toc-indirect} option is the default.
25565
25566 @item -mcompat-align-parm
25567 @itemx -mno-compat-align-parm
25568 @opindex mcompat-align-parm
25569 Generate (do not generate) code to pass structure parameters with a
25570 maximum alignment of 64 bits, for compatibility with older versions
25571 of GCC.
25572
25573 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25574 structure parameter on a 128-bit boundary when that structure contained
25575 a member requiring 128-bit alignment. This is corrected in more
25576 recent versions of GCC. This option may be used to generate code
25577 that is compatible with functions compiled with older versions of
25578 GCC.
25579
25580 The @option{-mno-compat-align-parm} option is the default.
25581
25582 @item -mstack-protector-guard=@var{guard}
25583 @itemx -mstack-protector-guard-reg=@var{reg}
25584 @itemx -mstack-protector-guard-offset=@var{offset}
25585 @itemx -mstack-protector-guard-symbol=@var{symbol}
25586 @opindex mstack-protector-guard
25587 @opindex mstack-protector-guard-reg
25588 @opindex mstack-protector-guard-offset
25589 @opindex mstack-protector-guard-symbol
25590 Generate stack protection code using canary at @var{guard}. Supported
25591 locations are @samp{global} for global canary or @samp{tls} for per-thread
25592 canary in the TLS block (the default with GNU libc version 2.4 or later).
25593
25594 With the latter choice the options
25595 @option{-mstack-protector-guard-reg=@var{reg}} and
25596 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25597 which register to use as base register for reading the canary, and from what
25598 offset from that base register. The default for those is as specified in the
25599 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25600 the offset with a symbol reference to a canary in the TLS block.
25601 @end table
25602
25603 @node RX Options
25604 @subsection RX Options
25605 @cindex RX Options
25606
25607 These command-line options are defined for RX targets:
25608
25609 @table @gcctabopt
25610 @item -m64bit-doubles
25611 @itemx -m32bit-doubles
25612 @opindex m64bit-doubles
25613 @opindex m32bit-doubles
25614 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25615 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25616 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25617 works on 32-bit values, which is why the default is
25618 @option{-m32bit-doubles}.
25619
25620 @item -fpu
25621 @itemx -nofpu
25622 @opindex fpu
25623 @opindex nofpu
25624 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25625 floating-point hardware. The default is enabled for the RX600
25626 series and disabled for the RX200 series.
25627
25628 Floating-point instructions are only generated for 32-bit floating-point
25629 values, however, so the FPU hardware is not used for doubles if the
25630 @option{-m64bit-doubles} option is used.
25631
25632 @emph{Note} If the @option{-fpu} option is enabled then
25633 @option{-funsafe-math-optimizations} is also enabled automatically.
25634 This is because the RX FPU instructions are themselves unsafe.
25635
25636 @item -mcpu=@var{name}
25637 @opindex mcpu
25638 Selects the type of RX CPU to be targeted. Currently three types are
25639 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25640 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25641
25642 The only difference between @samp{RX600} and @samp{RX610} is that the
25643 @samp{RX610} does not support the @code{MVTIPL} instruction.
25644
25645 The @samp{RX200} series does not have a hardware floating-point unit
25646 and so @option{-nofpu} is enabled by default when this type is
25647 selected.
25648
25649 @item -mbig-endian-data
25650 @itemx -mlittle-endian-data
25651 @opindex mbig-endian-data
25652 @opindex mlittle-endian-data
25653 Store data (but not code) in the big-endian format. The default is
25654 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25655 format.
25656
25657 @item -msmall-data-limit=@var{N}
25658 @opindex msmall-data-limit
25659 Specifies the maximum size in bytes of global and static variables
25660 which can be placed into the small data area. Using the small data
25661 area can lead to smaller and faster code, but the size of area is
25662 limited and it is up to the programmer to ensure that the area does
25663 not overflow. Also when the small data area is used one of the RX's
25664 registers (usually @code{r13}) is reserved for use pointing to this
25665 area, so it is no longer available for use by the compiler. This
25666 could result in slower and/or larger code if variables are pushed onto
25667 the stack instead of being held in this register.
25668
25669 Note, common variables (variables that have not been initialized) and
25670 constants are not placed into the small data area as they are assigned
25671 to other sections in the output executable.
25672
25673 The default value is zero, which disables this feature. Note, this
25674 feature is not enabled by default with higher optimization levels
25675 (@option{-O2} etc) because of the potentially detrimental effects of
25676 reserving a register. It is up to the programmer to experiment and
25677 discover whether this feature is of benefit to their program. See the
25678 description of the @option{-mpid} option for a description of how the
25679 actual register to hold the small data area pointer is chosen.
25680
25681 @item -msim
25682 @itemx -mno-sim
25683 @opindex msim
25684 @opindex mno-sim
25685 Use the simulator runtime. The default is to use the libgloss
25686 board-specific runtime.
25687
25688 @item -mas100-syntax
25689 @itemx -mno-as100-syntax
25690 @opindex mas100-syntax
25691 @opindex mno-as100-syntax
25692 When generating assembler output use a syntax that is compatible with
25693 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25694 assembler, but it has some restrictions so it is not generated by default.
25695
25696 @item -mmax-constant-size=@var{N}
25697 @opindex mmax-constant-size
25698 Specifies the maximum size, in bytes, of a constant that can be used as
25699 an operand in a RX instruction. Although the RX instruction set does
25700 allow constants of up to 4 bytes in length to be used in instructions,
25701 a longer value equates to a longer instruction. Thus in some
25702 circumstances it can be beneficial to restrict the size of constants
25703 that are used in instructions. Constants that are too big are instead
25704 placed into a constant pool and referenced via register indirection.
25705
25706 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25707 or 4 means that constants of any size are allowed.
25708
25709 @item -mrelax
25710 @opindex mrelax
25711 Enable linker relaxation. Linker relaxation is a process whereby the
25712 linker attempts to reduce the size of a program by finding shorter
25713 versions of various instructions. Disabled by default.
25714
25715 @item -mint-register=@var{N}
25716 @opindex mint-register
25717 Specify the number of registers to reserve for fast interrupt handler
25718 functions. The value @var{N} can be between 0 and 4. A value of 1
25719 means that register @code{r13} is reserved for the exclusive use
25720 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25721 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25722 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25723 A value of 0, the default, does not reserve any registers.
25724
25725 @item -msave-acc-in-interrupts
25726 @opindex msave-acc-in-interrupts
25727 Specifies that interrupt handler functions should preserve the
25728 accumulator register. This is only necessary if normal code might use
25729 the accumulator register, for example because it performs 64-bit
25730 multiplications. The default is to ignore the accumulator as this
25731 makes the interrupt handlers faster.
25732
25733 @item -mpid
25734 @itemx -mno-pid
25735 @opindex mpid
25736 @opindex mno-pid
25737 Enables the generation of position independent data. When enabled any
25738 access to constant data is done via an offset from a base address
25739 held in a register. This allows the location of constant data to be
25740 determined at run time without requiring the executable to be
25741 relocated, which is a benefit to embedded applications with tight
25742 memory constraints. Data that can be modified is not affected by this
25743 option.
25744
25745 Note, using this feature reserves a register, usually @code{r13}, for
25746 the constant data base address. This can result in slower and/or
25747 larger code, especially in complicated functions.
25748
25749 The actual register chosen to hold the constant data base address
25750 depends upon whether the @option{-msmall-data-limit} and/or the
25751 @option{-mint-register} command-line options are enabled. Starting
25752 with register @code{r13} and proceeding downwards, registers are
25753 allocated first to satisfy the requirements of @option{-mint-register},
25754 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25755 is possible for the small data area register to be @code{r8} if both
25756 @option{-mint-register=4} and @option{-mpid} are specified on the
25757 command line.
25758
25759 By default this feature is not enabled. The default can be restored
25760 via the @option{-mno-pid} command-line option.
25761
25762 @item -mno-warn-multiple-fast-interrupts
25763 @itemx -mwarn-multiple-fast-interrupts
25764 @opindex mno-warn-multiple-fast-interrupts
25765 @opindex mwarn-multiple-fast-interrupts
25766 Prevents GCC from issuing a warning message if it finds more than one
25767 fast interrupt handler when it is compiling a file. The default is to
25768 issue a warning for each extra fast interrupt handler found, as the RX
25769 only supports one such interrupt.
25770
25771 @item -mallow-string-insns
25772 @itemx -mno-allow-string-insns
25773 @opindex mallow-string-insns
25774 @opindex mno-allow-string-insns
25775 Enables or disables the use of the string manipulation instructions
25776 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25777 @code{SWHILE} and also the @code{RMPA} instruction. These
25778 instructions may prefetch data, which is not safe to do if accessing
25779 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25780 for more information).
25781
25782 The default is to allow these instructions, but it is not possible for
25783 GCC to reliably detect all circumstances where a string instruction
25784 might be used to access an I/O register, so their use cannot be
25785 disabled automatically. Instead it is reliant upon the programmer to
25786 use the @option{-mno-allow-string-insns} option if their program
25787 accesses I/O space.
25788
25789 When the instructions are enabled GCC defines the C preprocessor
25790 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25791 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25792
25793 @item -mjsr
25794 @itemx -mno-jsr
25795 @opindex mjsr
25796 @opindex mno-jsr
25797 Use only (or not only) @code{JSR} instructions to access functions.
25798 This option can be used when code size exceeds the range of @code{BSR}
25799 instructions. Note that @option{-mno-jsr} does not mean to not use
25800 @code{JSR} but instead means that any type of branch may be used.
25801 @end table
25802
25803 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25804 has special significance to the RX port when used with the
25805 @code{interrupt} function attribute. This attribute indicates a
25806 function intended to process fast interrupts. GCC ensures
25807 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25808 and/or @code{r13} and only provided that the normal use of the
25809 corresponding registers have been restricted via the
25810 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25811 options.
25812
25813 @node S/390 and zSeries Options
25814 @subsection S/390 and zSeries Options
25815 @cindex S/390 and zSeries Options
25816
25817 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25818
25819 @table @gcctabopt
25820 @item -mhard-float
25821 @itemx -msoft-float
25822 @opindex mhard-float
25823 @opindex msoft-float
25824 Use (do not use) the hardware floating-point instructions and registers
25825 for floating-point operations. When @option{-msoft-float} is specified,
25826 functions in @file{libgcc.a} are used to perform floating-point
25827 operations. When @option{-mhard-float} is specified, the compiler
25828 generates IEEE floating-point instructions. This is the default.
25829
25830 @item -mhard-dfp
25831 @itemx -mno-hard-dfp
25832 @opindex mhard-dfp
25833 @opindex mno-hard-dfp
25834 Use (do not use) the hardware decimal-floating-point instructions for
25835 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25836 specified, functions in @file{libgcc.a} are used to perform
25837 decimal-floating-point operations. When @option{-mhard-dfp} is
25838 specified, the compiler generates decimal-floating-point hardware
25839 instructions. This is the default for @option{-march=z9-ec} or higher.
25840
25841 @item -mlong-double-64
25842 @itemx -mlong-double-128
25843 @opindex mlong-double-64
25844 @opindex mlong-double-128
25845 These switches control the size of @code{long double} type. A size
25846 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25847 type. This is the default.
25848
25849 @item -mbackchain
25850 @itemx -mno-backchain
25851 @opindex mbackchain
25852 @opindex mno-backchain
25853 Store (do not store) the address of the caller's frame as backchain pointer
25854 into the callee's stack frame.
25855 A backchain may be needed to allow debugging using tools that do not understand
25856 DWARF call frame information.
25857 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25858 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25859 the backchain is placed into the topmost word of the 96/160 byte register
25860 save area.
25861
25862 In general, code compiled with @option{-mbackchain} is call-compatible with
25863 code compiled with @option{-mmo-backchain}; however, use of the backchain
25864 for debugging purposes usually requires that the whole binary is built with
25865 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25866 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25867 to build a linux kernel use @option{-msoft-float}.
25868
25869 The default is to not maintain the backchain.
25870
25871 @item -mpacked-stack
25872 @itemx -mno-packed-stack
25873 @opindex mpacked-stack
25874 @opindex mno-packed-stack
25875 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25876 specified, the compiler uses the all fields of the 96/160 byte register save
25877 area only for their default purpose; unused fields still take up stack space.
25878 When @option{-mpacked-stack} is specified, register save slots are densely
25879 packed at the top of the register save area; unused space is reused for other
25880 purposes, allowing for more efficient use of the available stack space.
25881 However, when @option{-mbackchain} is also in effect, the topmost word of
25882 the save area is always used to store the backchain, and the return address
25883 register is always saved two words below the backchain.
25884
25885 As long as the stack frame backchain is not used, code generated with
25886 @option{-mpacked-stack} is call-compatible with code generated with
25887 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25888 S/390 or zSeries generated code that uses the stack frame backchain at run
25889 time, not just for debugging purposes. Such code is not call-compatible
25890 with code compiled with @option{-mpacked-stack}. Also, note that the
25891 combination of @option{-mbackchain},
25892 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25893 to build a linux kernel use @option{-msoft-float}.
25894
25895 The default is to not use the packed stack layout.
25896
25897 @item -msmall-exec
25898 @itemx -mno-small-exec
25899 @opindex msmall-exec
25900 @opindex mno-small-exec
25901 Generate (or do not generate) code using the @code{bras} instruction
25902 to do subroutine calls.
25903 This only works reliably if the total executable size does not
25904 exceed 64k. The default is to use the @code{basr} instruction instead,
25905 which does not have this limitation.
25906
25907 @item -m64
25908 @itemx -m31
25909 @opindex m64
25910 @opindex m31
25911 When @option{-m31} is specified, generate code compliant to the
25912 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25913 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25914 particular to generate 64-bit instructions. For the @samp{s390}
25915 targets, the default is @option{-m31}, while the @samp{s390x}
25916 targets default to @option{-m64}.
25917
25918 @item -mzarch
25919 @itemx -mesa
25920 @opindex mzarch
25921 @opindex mesa
25922 When @option{-mzarch} is specified, generate code using the
25923 instructions available on z/Architecture.
25924 When @option{-mesa} is specified, generate code using the
25925 instructions available on ESA/390. Note that @option{-mesa} is
25926 not possible with @option{-m64}.
25927 When generating code compliant to the GNU/Linux for S/390 ABI,
25928 the default is @option{-mesa}. When generating code compliant
25929 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25930
25931 @item -mhtm
25932 @itemx -mno-htm
25933 @opindex mhtm
25934 @opindex mno-htm
25935 The @option{-mhtm} option enables a set of builtins making use of
25936 instructions available with the transactional execution facility
25937 introduced with the IBM zEnterprise EC12 machine generation
25938 @ref{S/390 System z Built-in Functions}.
25939 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25940
25941 @item -mvx
25942 @itemx -mno-vx
25943 @opindex mvx
25944 @opindex mno-vx
25945 When @option{-mvx} is specified, generate code using the instructions
25946 available with the vector extension facility introduced with the IBM
25947 z13 machine generation.
25948 This option changes the ABI for some vector type values with regard to
25949 alignment and calling conventions. In case vector type values are
25950 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25951 command will be added to mark the resulting binary with the ABI used.
25952 @option{-mvx} is enabled by default when using @option{-march=z13}.
25953
25954 @item -mzvector
25955 @itemx -mno-zvector
25956 @opindex mzvector
25957 @opindex mno-zvector
25958 The @option{-mzvector} option enables vector language extensions and
25959 builtins using instructions available with the vector extension
25960 facility introduced with the IBM z13 machine generation.
25961 This option adds support for @samp{vector} to be used as a keyword to
25962 define vector type variables and arguments. @samp{vector} is only
25963 available when GNU extensions are enabled. It will not be expanded
25964 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25965 In addition to the GCC low-level builtins @option{-mzvector} enables
25966 a set of builtins added for compatibility with AltiVec-style
25967 implementations like Power and Cell. In order to make use of these
25968 builtins the header file @file{vecintrin.h} needs to be included.
25969 @option{-mzvector} is disabled by default.
25970
25971 @item -mmvcle
25972 @itemx -mno-mvcle
25973 @opindex mmvcle
25974 @opindex mno-mvcle
25975 Generate (or do not generate) code using the @code{mvcle} instruction
25976 to perform block moves. When @option{-mno-mvcle} is specified,
25977 use a @code{mvc} loop instead. This is the default unless optimizing for
25978 size.
25979
25980 @item -mdebug
25981 @itemx -mno-debug
25982 @opindex mdebug
25983 @opindex mno-debug
25984 Print (or do not print) additional debug information when compiling.
25985 The default is to not print debug information.
25986
25987 @item -march=@var{cpu-type}
25988 @opindex march
25989 Generate code that runs on @var{cpu-type}, which is the name of a
25990 system representing a certain processor type. Possible values for
25991 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25992 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25993 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25994 @samp{z14}/@samp{arch12}, and @samp{native}.
25995
25996 The default is @option{-march=z900}.
25997
25998 Specifying @samp{native} as cpu type can be used to select the best
25999 architecture option for the host processor.
26000 @option{-march=native} has no effect if GCC does not recognize the
26001 processor.
26002
26003 @item -mtune=@var{cpu-type}
26004 @opindex mtune
26005 Tune to @var{cpu-type} everything applicable about the generated code,
26006 except for the ABI and the set of available instructions.
26007 The list of @var{cpu-type} values is the same as for @option{-march}.
26008 The default is the value used for @option{-march}.
26009
26010 @item -mtpf-trace
26011 @itemx -mno-tpf-trace
26012 @opindex mtpf-trace
26013 @opindex mno-tpf-trace
26014 Generate code that adds (does not add) in TPF OS specific branches to trace
26015 routines in the operating system. This option is off by default, even
26016 when compiling for the TPF OS@.
26017
26018 @item -mfused-madd
26019 @itemx -mno-fused-madd
26020 @opindex mfused-madd
26021 @opindex mno-fused-madd
26022 Generate code that uses (does not use) the floating-point multiply and
26023 accumulate instructions. These instructions are generated by default if
26024 hardware floating point is used.
26025
26026 @item -mwarn-framesize=@var{framesize}
26027 @opindex mwarn-framesize
26028 Emit a warning if the current function exceeds the given frame size. Because
26029 this is a compile-time check it doesn't need to be a real problem when the program
26030 runs. It is intended to identify functions that most probably cause
26031 a stack overflow. It is useful to be used in an environment with limited stack
26032 size e.g.@: the linux kernel.
26033
26034 @item -mwarn-dynamicstack
26035 @opindex mwarn-dynamicstack
26036 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
26037 arrays. This is generally a bad idea with a limited stack size.
26038
26039 @item -mstack-guard=@var{stack-guard}
26040 @itemx -mstack-size=@var{stack-size}
26041 @opindex mstack-guard
26042 @opindex mstack-size
26043 If these options are provided the S/390 back end emits additional instructions in
26044 the function prologue that trigger a trap if the stack size is @var{stack-guard}
26045 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
26046 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
26047 the frame size of the compiled function is chosen.
26048 These options are intended to be used to help debugging stack overflow problems.
26049 The additionally emitted code causes only little overhead and hence can also be
26050 used in production-like systems without greater performance degradation. The given
26051 values have to be exact powers of 2 and @var{stack-size} has to be greater than
26052 @var{stack-guard} without exceeding 64k.
26053 In order to be efficient the extra code makes the assumption that the stack starts
26054 at an address aligned to the value given by @var{stack-size}.
26055 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
26056
26057 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
26058 @opindex mhotpatch
26059 If the hotpatch option is enabled, a ``hot-patching'' function
26060 prologue is generated for all functions in the compilation unit.
26061 The funtion label is prepended with the given number of two-byte
26062 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
26063 the label, 2 * @var{post-halfwords} bytes are appended, using the
26064 largest NOP like instructions the architecture allows (maximum
26065 1000000).
26066
26067 If both arguments are zero, hotpatching is disabled.
26068
26069 This option can be overridden for individual functions with the
26070 @code{hotpatch} attribute.
26071 @end table
26072
26073 @node Score Options
26074 @subsection Score Options
26075 @cindex Score Options
26076
26077 These options are defined for Score implementations:
26078
26079 @table @gcctabopt
26080 @item -meb
26081 @opindex meb
26082 Compile code for big-endian mode. This is the default.
26083
26084 @item -mel
26085 @opindex mel
26086 Compile code for little-endian mode.
26087
26088 @item -mnhwloop
26089 @opindex mnhwloop
26090 Disable generation of @code{bcnz} instructions.
26091
26092 @item -muls
26093 @opindex muls
26094 Enable generation of unaligned load and store instructions.
26095
26096 @item -mmac
26097 @opindex mmac
26098 Enable the use of multiply-accumulate instructions. Disabled by default.
26099
26100 @item -mscore5
26101 @opindex mscore5
26102 Specify the SCORE5 as the target architecture.
26103
26104 @item -mscore5u
26105 @opindex mscore5u
26106 Specify the SCORE5U of the target architecture.
26107
26108 @item -mscore7
26109 @opindex mscore7
26110 Specify the SCORE7 as the target architecture. This is the default.
26111
26112 @item -mscore7d
26113 @opindex mscore7d
26114 Specify the SCORE7D as the target architecture.
26115 @end table
26116
26117 @node SH Options
26118 @subsection SH Options
26119
26120 These @samp{-m} options are defined for the SH implementations:
26121
26122 @table @gcctabopt
26123 @item -m1
26124 @opindex m1
26125 Generate code for the SH1.
26126
26127 @item -m2
26128 @opindex m2
26129 Generate code for the SH2.
26130
26131 @item -m2e
26132 Generate code for the SH2e.
26133
26134 @item -m2a-nofpu
26135 @opindex m2a-nofpu
26136 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
26137 that the floating-point unit is not used.
26138
26139 @item -m2a-single-only
26140 @opindex m2a-single-only
26141 Generate code for the SH2a-FPU, in such a way that no double-precision
26142 floating-point operations are used.
26143
26144 @item -m2a-single
26145 @opindex m2a-single
26146 Generate code for the SH2a-FPU assuming the floating-point unit is in
26147 single-precision mode by default.
26148
26149 @item -m2a
26150 @opindex m2a
26151 Generate code for the SH2a-FPU assuming the floating-point unit is in
26152 double-precision mode by default.
26153
26154 @item -m3
26155 @opindex m3
26156 Generate code for the SH3.
26157
26158 @item -m3e
26159 @opindex m3e
26160 Generate code for the SH3e.
26161
26162 @item -m4-nofpu
26163 @opindex m4-nofpu
26164 Generate code for the SH4 without a floating-point unit.
26165
26166 @item -m4-single-only
26167 @opindex m4-single-only
26168 Generate code for the SH4 with a floating-point unit that only
26169 supports single-precision arithmetic.
26170
26171 @item -m4-single
26172 @opindex m4-single
26173 Generate code for the SH4 assuming the floating-point unit is in
26174 single-precision mode by default.
26175
26176 @item -m4
26177 @opindex m4
26178 Generate code for the SH4.
26179
26180 @item -m4-100
26181 @opindex m4-100
26182 Generate code for SH4-100.
26183
26184 @item -m4-100-nofpu
26185 @opindex m4-100-nofpu
26186 Generate code for SH4-100 in such a way that the
26187 floating-point unit is not used.
26188
26189 @item -m4-100-single
26190 @opindex m4-100-single
26191 Generate code for SH4-100 assuming the floating-point unit is in
26192 single-precision mode by default.
26193
26194 @item -m4-100-single-only
26195 @opindex m4-100-single-only
26196 Generate code for SH4-100 in such a way that no double-precision
26197 floating-point operations are used.
26198
26199 @item -m4-200
26200 @opindex m4-200
26201 Generate code for SH4-200.
26202
26203 @item -m4-200-nofpu
26204 @opindex m4-200-nofpu
26205 Generate code for SH4-200 without in such a way that the
26206 floating-point unit is not used.
26207
26208 @item -m4-200-single
26209 @opindex m4-200-single
26210 Generate code for SH4-200 assuming the floating-point unit is in
26211 single-precision mode by default.
26212
26213 @item -m4-200-single-only
26214 @opindex m4-200-single-only
26215 Generate code for SH4-200 in such a way that no double-precision
26216 floating-point operations are used.
26217
26218 @item -m4-300
26219 @opindex m4-300
26220 Generate code for SH4-300.
26221
26222 @item -m4-300-nofpu
26223 @opindex m4-300-nofpu
26224 Generate code for SH4-300 without in such a way that the
26225 floating-point unit is not used.
26226
26227 @item -m4-300-single
26228 @opindex m4-300-single
26229 Generate code for SH4-300 in such a way that no double-precision
26230 floating-point operations are used.
26231
26232 @item -m4-300-single-only
26233 @opindex m4-300-single-only
26234 Generate code for SH4-300 in such a way that no double-precision
26235 floating-point operations are used.
26236
26237 @item -m4-340
26238 @opindex m4-340
26239 Generate code for SH4-340 (no MMU, no FPU).
26240
26241 @item -m4-500
26242 @opindex m4-500
26243 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
26244 assembler.
26245
26246 @item -m4a-nofpu
26247 @opindex m4a-nofpu
26248 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
26249 floating-point unit is not used.
26250
26251 @item -m4a-single-only
26252 @opindex m4a-single-only
26253 Generate code for the SH4a, in such a way that no double-precision
26254 floating-point operations are used.
26255
26256 @item -m4a-single
26257 @opindex m4a-single
26258 Generate code for the SH4a assuming the floating-point unit is in
26259 single-precision mode by default.
26260
26261 @item -m4a
26262 @opindex m4a
26263 Generate code for the SH4a.
26264
26265 @item -m4al
26266 @opindex m4al
26267 Same as @option{-m4a-nofpu}, except that it implicitly passes
26268 @option{-dsp} to the assembler. GCC doesn't generate any DSP
26269 instructions at the moment.
26270
26271 @item -mb
26272 @opindex mb
26273 Compile code for the processor in big-endian mode.
26274
26275 @item -ml
26276 @opindex ml
26277 Compile code for the processor in little-endian mode.
26278
26279 @item -mdalign
26280 @opindex mdalign
26281 Align doubles at 64-bit boundaries. Note that this changes the calling
26282 conventions, and thus some functions from the standard C library do
26283 not work unless you recompile it first with @option{-mdalign}.
26284
26285 @item -mrelax
26286 @opindex mrelax
26287 Shorten some address references at link time, when possible; uses the
26288 linker option @option{-relax}.
26289
26290 @item -mbigtable
26291 @opindex mbigtable
26292 Use 32-bit offsets in @code{switch} tables. The default is to use
26293 16-bit offsets.
26294
26295 @item -mbitops
26296 @opindex mbitops
26297 Enable the use of bit manipulation instructions on SH2A.
26298
26299 @item -mfmovd
26300 @opindex mfmovd
26301 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
26302 alignment constraints.
26303
26304 @item -mrenesas
26305 @opindex mrenesas
26306 Comply with the calling conventions defined by Renesas.
26307
26308 @item -mno-renesas
26309 @opindex mno-renesas
26310 Comply with the calling conventions defined for GCC before the Renesas
26311 conventions were available. This option is the default for all
26312 targets of the SH toolchain.
26313
26314 @item -mnomacsave
26315 @opindex mnomacsave
26316 Mark the @code{MAC} register as call-clobbered, even if
26317 @option{-mrenesas} is given.
26318
26319 @item -mieee
26320 @itemx -mno-ieee
26321 @opindex mieee
26322 @opindex mno-ieee
26323 Control the IEEE compliance of floating-point comparisons, which affects the
26324 handling of cases where the result of a comparison is unordered. By default
26325 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
26326 enabled @option{-mno-ieee} is implicitly set, which results in faster
26327 floating-point greater-equal and less-equal comparisons. The implicit settings
26328 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
26329
26330 @item -minline-ic_invalidate
26331 @opindex minline-ic_invalidate
26332 Inline code to invalidate instruction cache entries after setting up
26333 nested function trampolines.
26334 This option has no effect if @option{-musermode} is in effect and the selected
26335 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26336 instruction.
26337 If the selected code generation option does not allow the use of the @code{icbi}
26338 instruction, and @option{-musermode} is not in effect, the inlined code
26339 manipulates the instruction cache address array directly with an associative
26340 write. This not only requires privileged mode at run time, but it also
26341 fails if the cache line had been mapped via the TLB and has become unmapped.
26342
26343 @item -misize
26344 @opindex misize
26345 Dump instruction size and location in the assembly code.
26346
26347 @item -mpadstruct
26348 @opindex mpadstruct
26349 This option is deprecated. It pads structures to multiple of 4 bytes,
26350 which is incompatible with the SH ABI@.
26351
26352 @item -matomic-model=@var{model}
26353 @opindex matomic-model=@var{model}
26354 Sets the model of atomic operations and additional parameters as a comma
26355 separated list. For details on the atomic built-in functions see
26356 @ref{__atomic Builtins}. The following models and parameters are supported:
26357
26358 @table @samp
26359
26360 @item none
26361 Disable compiler generated atomic sequences and emit library calls for atomic
26362 operations. This is the default if the target is not @code{sh*-*-linux*}.
26363
26364 @item soft-gusa
26365 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26366 built-in functions. The generated atomic sequences require additional support
26367 from the interrupt/exception handling code of the system and are only suitable
26368 for SH3* and SH4* single-core systems. This option is enabled by default when
26369 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26370 this option also partially utilizes the hardware atomic instructions
26371 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26372 @samp{strict} is specified.
26373
26374 @item soft-tcb
26375 Generate software atomic sequences that use a variable in the thread control
26376 block. This is a variation of the gUSA sequences which can also be used on
26377 SH1* and SH2* targets. The generated atomic sequences require additional
26378 support from the interrupt/exception handling code of the system and are only
26379 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26380 parameter has to be specified as well.
26381
26382 @item soft-imask
26383 Generate software atomic sequences that temporarily disable interrupts by
26384 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26385 in privileged mode and is only suitable for single-core systems. Additional
26386 support from the interrupt/exception handling code of the system is not
26387 required. This model is enabled by default when the target is
26388 @code{sh*-*-linux*} and SH1* or SH2*.
26389
26390 @item hard-llcs
26391 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26392 instructions only. This is only available on SH4A and is suitable for
26393 multi-core systems. Since the hardware instructions support only 32 bit atomic
26394 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26395 Code compiled with this option is also compatible with other software
26396 atomic model interrupt/exception handling systems if executed on an SH4A
26397 system. Additional support from the interrupt/exception handling code of the
26398 system is not required for this model.
26399
26400 @item gbr-offset=
26401 This parameter specifies the offset in bytes of the variable in the thread
26402 control block structure that should be used by the generated atomic sequences
26403 when the @samp{soft-tcb} model has been selected. For other models this
26404 parameter is ignored. The specified value must be an integer multiple of four
26405 and in the range 0-1020.
26406
26407 @item strict
26408 This parameter prevents mixed usage of multiple atomic models, even if they
26409 are compatible, and makes the compiler generate atomic sequences of the
26410 specified model only.
26411
26412 @end table
26413
26414 @item -mtas
26415 @opindex mtas
26416 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26417 Notice that depending on the particular hardware and software configuration
26418 this can degrade overall performance due to the operand cache line flushes
26419 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26420 processors the @code{tas.b} instruction must be used with caution since it
26421 can result in data corruption for certain cache configurations.
26422
26423 @item -mprefergot
26424 @opindex mprefergot
26425 When generating position-independent code, emit function calls using
26426 the Global Offset Table instead of the Procedure Linkage Table.
26427
26428 @item -musermode
26429 @itemx -mno-usermode
26430 @opindex musermode
26431 @opindex mno-usermode
26432 Don't allow (allow) the compiler generating privileged mode code. Specifying
26433 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26434 inlined code would not work in user mode. @option{-musermode} is the default
26435 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26436 @option{-musermode} has no effect, since there is no user mode.
26437
26438 @item -multcost=@var{number}
26439 @opindex multcost=@var{number}
26440 Set the cost to assume for a multiply insn.
26441
26442 @item -mdiv=@var{strategy}
26443 @opindex mdiv=@var{strategy}
26444 Set the division strategy to be used for integer division operations.
26445 @var{strategy} can be one of:
26446
26447 @table @samp
26448
26449 @item call-div1
26450 Calls a library function that uses the single-step division instruction
26451 @code{div1} to perform the operation. Division by zero calculates an
26452 unspecified result and does not trap. This is the default except for SH4,
26453 SH2A and SHcompact.
26454
26455 @item call-fp
26456 Calls a library function that performs the operation in double precision
26457 floating point. Division by zero causes a floating-point exception. This is
26458 the default for SHcompact with FPU. Specifying this for targets that do not
26459 have a double precision FPU defaults to @code{call-div1}.
26460
26461 @item call-table
26462 Calls a library function that uses a lookup table for small divisors and
26463 the @code{div1} instruction with case distinction for larger divisors. Division
26464 by zero calculates an unspecified result and does not trap. This is the default
26465 for SH4. Specifying this for targets that do not have dynamic shift
26466 instructions defaults to @code{call-div1}.
26467
26468 @end table
26469
26470 When a division strategy has not been specified the default strategy is
26471 selected based on the current target. For SH2A the default strategy is to
26472 use the @code{divs} and @code{divu} instructions instead of library function
26473 calls.
26474
26475 @item -maccumulate-outgoing-args
26476 @opindex maccumulate-outgoing-args
26477 Reserve space once for outgoing arguments in the function prologue rather
26478 than around each call. Generally beneficial for performance and size. Also
26479 needed for unwinding to avoid changing the stack frame around conditional code.
26480
26481 @item -mdivsi3_libfunc=@var{name}
26482 @opindex mdivsi3_libfunc=@var{name}
26483 Set the name of the library function used for 32-bit signed division to
26484 @var{name}.
26485 This only affects the name used in the @samp{call} division strategies, and
26486 the compiler still expects the same sets of input/output/clobbered registers as
26487 if this option were not present.
26488
26489 @item -mfixed-range=@var{register-range}
26490 @opindex mfixed-range
26491 Generate code treating the given register range as fixed registers.
26492 A fixed register is one that the register allocator can not use. This is
26493 useful when compiling kernel code. A register range is specified as
26494 two registers separated by a dash. Multiple register ranges can be
26495 specified separated by a comma.
26496
26497 @item -mbranch-cost=@var{num}
26498 @opindex mbranch-cost=@var{num}
26499 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26500 make the compiler try to generate more branch-free code if possible.
26501 If not specified the value is selected depending on the processor type that
26502 is being compiled for.
26503
26504 @item -mzdcbranch
26505 @itemx -mno-zdcbranch
26506 @opindex mzdcbranch
26507 @opindex mno-zdcbranch
26508 Assume (do not assume) that zero displacement conditional branch instructions
26509 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26510 compiler prefers zero displacement branch code sequences. This is
26511 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26512 disabled by specifying @option{-mno-zdcbranch}.
26513
26514 @item -mcbranch-force-delay-slot
26515 @opindex mcbranch-force-delay-slot
26516 Force the usage of delay slots for conditional branches, which stuffs the delay
26517 slot with a @code{nop} if a suitable instruction cannot be found. By default
26518 this option is disabled. It can be enabled to work around hardware bugs as
26519 found in the original SH7055.
26520
26521 @item -mfused-madd
26522 @itemx -mno-fused-madd
26523 @opindex mfused-madd
26524 @opindex mno-fused-madd
26525 Generate code that uses (does not use) the floating-point multiply and
26526 accumulate instructions. These instructions are generated by default
26527 if hardware floating point is used. The machine-dependent
26528 @option{-mfused-madd} option is now mapped to the machine-independent
26529 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26530 mapped to @option{-ffp-contract=off}.
26531
26532 @item -mfsca
26533 @itemx -mno-fsca
26534 @opindex mfsca
26535 @opindex mno-fsca
26536 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26537 and cosine approximations. The option @option{-mfsca} must be used in
26538 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26539 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26540 approximations even if @option{-funsafe-math-optimizations} is in effect.
26541
26542 @item -mfsrra
26543 @itemx -mno-fsrra
26544 @opindex mfsrra
26545 @opindex mno-fsrra
26546 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26547 reciprocal square root approximations. The option @option{-mfsrra} must be used
26548 in combination with @option{-funsafe-math-optimizations} and
26549 @option{-ffinite-math-only}. It is enabled by default when generating code for
26550 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26551 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26552 in effect.
26553
26554 @item -mpretend-cmove
26555 @opindex mpretend-cmove
26556 Prefer zero-displacement conditional branches for conditional move instruction
26557 patterns. This can result in faster code on the SH4 processor.
26558
26559 @item -mfdpic
26560 @opindex fdpic
26561 Generate code using the FDPIC ABI.
26562
26563 @end table
26564
26565 @node Solaris 2 Options
26566 @subsection Solaris 2 Options
26567 @cindex Solaris 2 options
26568
26569 These @samp{-m} options are supported on Solaris 2:
26570
26571 @table @gcctabopt
26572 @item -mclear-hwcap
26573 @opindex mclear-hwcap
26574 @option{-mclear-hwcap} tells the compiler to remove the hardware
26575 capabilities generated by the Solaris assembler. This is only necessary
26576 when object files use ISA extensions not supported by the current
26577 machine, but check at runtime whether or not to use them.
26578
26579 @item -mimpure-text
26580 @opindex mimpure-text
26581 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26582 the compiler to not pass @option{-z text} to the linker when linking a
26583 shared object. Using this option, you can link position-dependent
26584 code into a shared object.
26585
26586 @option{-mimpure-text} suppresses the ``relocations remain against
26587 allocatable but non-writable sections'' linker error message.
26588 However, the necessary relocations trigger copy-on-write, and the
26589 shared object is not actually shared across processes. Instead of
26590 using @option{-mimpure-text}, you should compile all source code with
26591 @option{-fpic} or @option{-fPIC}.
26592
26593 @end table
26594
26595 These switches are supported in addition to the above on Solaris 2:
26596
26597 @table @gcctabopt
26598 @item -pthreads
26599 @opindex pthreads
26600 This is a synonym for @option{-pthread}.
26601 @end table
26602
26603 @node SPARC Options
26604 @subsection SPARC Options
26605 @cindex SPARC options
26606
26607 These @samp{-m} options are supported on the SPARC:
26608
26609 @table @gcctabopt
26610 @item -mno-app-regs
26611 @itemx -mapp-regs
26612 @opindex mno-app-regs
26613 @opindex mapp-regs
26614 Specify @option{-mapp-regs} to generate output using the global registers
26615 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26616 global register 1, each global register 2 through 4 is then treated as an
26617 allocable register that is clobbered by function calls. This is the default.
26618
26619 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26620 specify @option{-mno-app-regs}. You should compile libraries and system
26621 software with this option.
26622
26623 @item -mflat
26624 @itemx -mno-flat
26625 @opindex mflat
26626 @opindex mno-flat
26627 With @option{-mflat}, the compiler does not generate save/restore instructions
26628 and uses a ``flat'' or single register window model. This model is compatible
26629 with the regular register window model. The local registers and the input
26630 registers (0--5) are still treated as ``call-saved'' registers and are
26631 saved on the stack as needed.
26632
26633 With @option{-mno-flat} (the default), the compiler generates save/restore
26634 instructions (except for leaf functions). This is the normal operating mode.
26635
26636 @item -mfpu
26637 @itemx -mhard-float
26638 @opindex mfpu
26639 @opindex mhard-float
26640 Generate output containing floating-point instructions. This is the
26641 default.
26642
26643 @item -mno-fpu
26644 @itemx -msoft-float
26645 @opindex mno-fpu
26646 @opindex msoft-float
26647 Generate output containing library calls for floating point.
26648 @strong{Warning:} the requisite libraries are not available for all SPARC
26649 targets. Normally the facilities of the machine's usual C compiler are
26650 used, but this cannot be done directly in cross-compilation. You must make
26651 your own arrangements to provide suitable library functions for
26652 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26653 @samp{sparclite-*-*} do provide software floating-point support.
26654
26655 @option{-msoft-float} changes the calling convention in the output file;
26656 therefore, it is only useful if you compile @emph{all} of a program with
26657 this option. In particular, you need to compile @file{libgcc.a}, the
26658 library that comes with GCC, with @option{-msoft-float} in order for
26659 this to work.
26660
26661 @item -mhard-quad-float
26662 @opindex mhard-quad-float
26663 Generate output containing quad-word (long double) floating-point
26664 instructions.
26665
26666 @item -msoft-quad-float
26667 @opindex msoft-quad-float
26668 Generate output containing library calls for quad-word (long double)
26669 floating-point instructions. The functions called are those specified
26670 in the SPARC ABI@. This is the default.
26671
26672 As of this writing, there are no SPARC implementations that have hardware
26673 support for the quad-word floating-point instructions. They all invoke
26674 a trap handler for one of these instructions, and then the trap handler
26675 emulates the effect of the instruction. Because of the trap handler overhead,
26676 this is much slower than calling the ABI library routines. Thus the
26677 @option{-msoft-quad-float} option is the default.
26678
26679 @item -mno-unaligned-doubles
26680 @itemx -munaligned-doubles
26681 @opindex mno-unaligned-doubles
26682 @opindex munaligned-doubles
26683 Assume that doubles have 8-byte alignment. This is the default.
26684
26685 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26686 alignment only if they are contained in another type, or if they have an
26687 absolute address. Otherwise, it assumes they have 4-byte alignment.
26688 Specifying this option avoids some rare compatibility problems with code
26689 generated by other compilers. It is not the default because it results
26690 in a performance loss, especially for floating-point code.
26691
26692 @item -muser-mode
26693 @itemx -mno-user-mode
26694 @opindex muser-mode
26695 @opindex mno-user-mode
26696 Do not generate code that can only run in supervisor mode. This is relevant
26697 only for the @code{casa} instruction emitted for the LEON3 processor. This
26698 is the default.
26699
26700 @item -mfaster-structs
26701 @itemx -mno-faster-structs
26702 @opindex mfaster-structs
26703 @opindex mno-faster-structs
26704 With @option{-mfaster-structs}, the compiler assumes that structures
26705 should have 8-byte alignment. This enables the use of pairs of
26706 @code{ldd} and @code{std} instructions for copies in structure
26707 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26708 However, the use of this changed alignment directly violates the SPARC
26709 ABI@. Thus, it's intended only for use on targets where the developer
26710 acknowledges that their resulting code is not directly in line with
26711 the rules of the ABI@.
26712
26713 @item -mstd-struct-return
26714 @itemx -mno-std-struct-return
26715 @opindex mstd-struct-return
26716 @opindex mno-std-struct-return
26717 With @option{-mstd-struct-return}, the compiler generates checking code
26718 in functions returning structures or unions to detect size mismatches
26719 between the two sides of function calls, as per the 32-bit ABI@.
26720
26721 The default is @option{-mno-std-struct-return}. This option has no effect
26722 in 64-bit mode.
26723
26724 @item -mlra
26725 @itemx -mno-lra
26726 @opindex mlra
26727 @opindex mno-lra
26728 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26729 so @option{-mno-lra} needs to be passed to get old Reload.
26730
26731 @item -mcpu=@var{cpu_type}
26732 @opindex mcpu
26733 Set the instruction set, register set, and instruction scheduling parameters
26734 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26735 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26736 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26737 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26738 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26739 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26740
26741 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26742 which selects the best architecture option for the host processor.
26743 @option{-mcpu=native} has no effect if GCC does not recognize
26744 the processor.
26745
26746 Default instruction scheduling parameters are used for values that select
26747 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26748 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26749
26750 Here is a list of each supported architecture and their supported
26751 implementations.
26752
26753 @table @asis
26754 @item v7
26755 cypress, leon3v7
26756
26757 @item v8
26758 supersparc, hypersparc, leon, leon3
26759
26760 @item sparclite
26761 f930, f934, sparclite86x
26762
26763 @item sparclet
26764 tsc701
26765
26766 @item v9
26767 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26768 niagara7, m8
26769 @end table
26770
26771 By default (unless configured otherwise), GCC generates code for the V7
26772 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26773 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26774 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26775 SPARCStation 1, 2, IPX etc.
26776
26777 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26778 architecture. The only difference from V7 code is that the compiler emits
26779 the integer multiply and integer divide instructions which exist in SPARC-V8
26780 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26781 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26782 2000 series.
26783
26784 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26785 the SPARC architecture. This adds the integer multiply, integer divide step
26786 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26787 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26788 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26789 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26790 MB86934 chip, which is the more recent SPARClite with FPU@.
26791
26792 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26793 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26794 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26795 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26796 optimizes it for the TEMIC SPARClet chip.
26797
26798 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26799 architecture. This adds 64-bit integer and floating-point move instructions,
26800 3 additional floating-point condition code registers and conditional move
26801 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26802 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26803 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26804 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26805 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26806 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26807 additionally optimizes it for Sun UltraSPARC T2 chips. With
26808 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26809 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26810 additionally optimizes it for Sun UltraSPARC T4 chips. With
26811 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26812 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26813 additionally optimizes it for Oracle M8 chips.
26814
26815 @item -mtune=@var{cpu_type}
26816 @opindex mtune
26817 Set the instruction scheduling parameters for machine type
26818 @var{cpu_type}, but do not set the instruction set or register set that the
26819 option @option{-mcpu=@var{cpu_type}} does.
26820
26821 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26822 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26823 that select a particular CPU implementation. Those are
26824 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26825 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26826 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26827 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26828 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26829 and GNU/Linux toolchains, @samp{native} can also be used.
26830
26831 @item -mv8plus
26832 @itemx -mno-v8plus
26833 @opindex mv8plus
26834 @opindex mno-v8plus
26835 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26836 difference from the V8 ABI is that the global and out registers are
26837 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26838 mode for all SPARC-V9 processors.
26839
26840 @item -mvis
26841 @itemx -mno-vis
26842 @opindex mvis
26843 @opindex mno-vis
26844 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26845 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26846
26847 @item -mvis2
26848 @itemx -mno-vis2
26849 @opindex mvis2
26850 @opindex mno-vis2
26851 With @option{-mvis2}, GCC generates code that takes advantage of
26852 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26853 default is @option{-mvis2} when targeting a cpu that supports such
26854 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26855 also sets @option{-mvis}.
26856
26857 @item -mvis3
26858 @itemx -mno-vis3
26859 @opindex mvis3
26860 @opindex mno-vis3
26861 With @option{-mvis3}, GCC generates code that takes advantage of
26862 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26863 default is @option{-mvis3} when targeting a cpu that supports such
26864 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26865 also sets @option{-mvis2} and @option{-mvis}.
26866
26867 @item -mvis4
26868 @itemx -mno-vis4
26869 @opindex mvis4
26870 @opindex mno-vis4
26871 With @option{-mvis4}, GCC generates code that takes advantage of
26872 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26873 default is @option{-mvis4} when targeting a cpu that supports such
26874 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26875 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26876
26877 @item -mvis4b
26878 @itemx -mno-vis4b
26879 @opindex mvis4b
26880 @opindex mno-vis4b
26881 With @option{-mvis4b}, GCC generates code that takes advantage of
26882 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26883 the additional VIS instructions introduced in the Oracle SPARC
26884 Architecture 2017. The default is @option{-mvis4b} when targeting a
26885 cpu that supports such instructions, such as m8 and later. Setting
26886 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26887 @option{-mvis2} and @option{-mvis}.
26888
26889 @item -mcbcond
26890 @itemx -mno-cbcond
26891 @opindex mcbcond
26892 @opindex mno-cbcond
26893 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26894 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26895 when targeting a CPU that supports such instructions, such as Niagara-4 and
26896 later.
26897
26898 @item -mfmaf
26899 @itemx -mno-fmaf
26900 @opindex mfmaf
26901 @opindex mno-fmaf
26902 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26903 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26904 when targeting a CPU that supports such instructions, such as Niagara-3 and
26905 later.
26906
26907 @item -mfsmuld
26908 @itemx -mno-fsmuld
26909 @opindex mfsmuld
26910 @opindex mno-fsmuld
26911 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26912 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26913 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26914 or V9 with FPU except @option{-mcpu=leon}.
26915
26916 @item -mpopc
26917 @itemx -mno-popc
26918 @opindex mpopc
26919 @opindex mno-popc
26920 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26921 Population Count instruction. The default is @option{-mpopc}
26922 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26923 later.
26924
26925 @item -msubxc
26926 @itemx -mno-subxc
26927 @opindex msubxc
26928 @opindex mno-subxc
26929 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26930 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26931 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26932 later.
26933
26934 @item -mfix-at697f
26935 @opindex mfix-at697f
26936 Enable the documented workaround for the single erratum of the Atmel AT697F
26937 processor (which corresponds to erratum #13 of the AT697E processor).
26938
26939 @item -mfix-ut699
26940 @opindex mfix-ut699
26941 Enable the documented workarounds for the floating-point errata and the data
26942 cache nullify errata of the UT699 processor.
26943
26944 @item -mfix-ut700
26945 @opindex mfix-ut700
26946 Enable the documented workaround for the back-to-back store errata of
26947 the UT699E/UT700 processor.
26948
26949 @item -mfix-gr712rc
26950 @opindex mfix-gr712rc
26951 Enable the documented workaround for the back-to-back store errata of
26952 the GR712RC processor.
26953 @end table
26954
26955 These @samp{-m} options are supported in addition to the above
26956 on SPARC-V9 processors in 64-bit environments:
26957
26958 @table @gcctabopt
26959 @item -m32
26960 @itemx -m64
26961 @opindex m32
26962 @opindex m64
26963 Generate code for a 32-bit or 64-bit environment.
26964 The 32-bit environment sets int, long and pointer to 32 bits.
26965 The 64-bit environment sets int to 32 bits and long and pointer
26966 to 64 bits.
26967
26968 @item -mcmodel=@var{which}
26969 @opindex mcmodel
26970 Set the code model to one of
26971
26972 @table @samp
26973 @item medlow
26974 The Medium/Low code model: 64-bit addresses, programs
26975 must be linked in the low 32 bits of memory. Programs can be statically
26976 or dynamically linked.
26977
26978 @item medmid
26979 The Medium/Middle code model: 64-bit addresses, programs
26980 must be linked in the low 44 bits of memory, the text and data segments must
26981 be less than 2GB in size and the data segment must be located within 2GB of
26982 the text segment.
26983
26984 @item medany
26985 The Medium/Anywhere code model: 64-bit addresses, programs
26986 may be linked anywhere in memory, the text and data segments must be less
26987 than 2GB in size and the data segment must be located within 2GB of the
26988 text segment.
26989
26990 @item embmedany
26991 The Medium/Anywhere code model for embedded systems:
26992 64-bit addresses, the text and data segments must be less than 2GB in
26993 size, both starting anywhere in memory (determined at link time). The
26994 global register %g4 points to the base of the data segment. Programs
26995 are statically linked and PIC is not supported.
26996 @end table
26997
26998 @item -mmemory-model=@var{mem-model}
26999 @opindex mmemory-model
27000 Set the memory model in force on the processor to one of
27001
27002 @table @samp
27003 @item default
27004 The default memory model for the processor and operating system.
27005
27006 @item rmo
27007 Relaxed Memory Order
27008
27009 @item pso
27010 Partial Store Order
27011
27012 @item tso
27013 Total Store Order
27014
27015 @item sc
27016 Sequential Consistency
27017 @end table
27018
27019 These memory models are formally defined in Appendix D of the SPARC-V9
27020 architecture manual, as set in the processor's @code{PSTATE.MM} field.
27021
27022 @item -mstack-bias
27023 @itemx -mno-stack-bias
27024 @opindex mstack-bias
27025 @opindex mno-stack-bias
27026 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
27027 frame pointer if present, are offset by @minus{}2047 which must be added back
27028 when making stack frame references. This is the default in 64-bit mode.
27029 Otherwise, assume no such offset is present.
27030 @end table
27031
27032 @node SPU Options
27033 @subsection SPU Options
27034 @cindex SPU options
27035
27036 These @samp{-m} options are supported on the SPU:
27037
27038 @table @gcctabopt
27039 @item -mwarn-reloc
27040 @itemx -merror-reloc
27041 @opindex mwarn-reloc
27042 @opindex merror-reloc
27043
27044 The loader for SPU does not handle dynamic relocations. By default, GCC
27045 gives an error when it generates code that requires a dynamic
27046 relocation. @option{-mno-error-reloc} disables the error,
27047 @option{-mwarn-reloc} generates a warning instead.
27048
27049 @item -msafe-dma
27050 @itemx -munsafe-dma
27051 @opindex msafe-dma
27052 @opindex munsafe-dma
27053
27054 Instructions that initiate or test completion of DMA must not be
27055 reordered with respect to loads and stores of the memory that is being
27056 accessed.
27057 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
27058 memory accesses, but that can lead to inefficient code in places where the
27059 memory is known to not change. Rather than mark the memory as volatile,
27060 you can use @option{-msafe-dma} to tell the compiler to treat
27061 the DMA instructions as potentially affecting all memory.
27062
27063 @item -mbranch-hints
27064 @opindex mbranch-hints
27065
27066 By default, GCC generates a branch hint instruction to avoid
27067 pipeline stalls for always-taken or probably-taken branches. A hint
27068 is not generated closer than 8 instructions away from its branch.
27069 There is little reason to disable them, except for debugging purposes,
27070 or to make an object a little bit smaller.
27071
27072 @item -msmall-mem
27073 @itemx -mlarge-mem
27074 @opindex msmall-mem
27075 @opindex mlarge-mem
27076
27077 By default, GCC generates code assuming that addresses are never larger
27078 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
27079 a full 32-bit address.
27080
27081 @item -mstdmain
27082 @opindex mstdmain
27083
27084 By default, GCC links against startup code that assumes the SPU-style
27085 main function interface (which has an unconventional parameter list).
27086 With @option{-mstdmain}, GCC links your program against startup
27087 code that assumes a C99-style interface to @code{main}, including a
27088 local copy of @code{argv} strings.
27089
27090 @item -mfixed-range=@var{register-range}
27091 @opindex mfixed-range
27092 Generate code treating the given register range as fixed registers.
27093 A fixed register is one that the register allocator cannot use. This is
27094 useful when compiling kernel code. A register range is specified as
27095 two registers separated by a dash. Multiple register ranges can be
27096 specified separated by a comma.
27097
27098 @item -mea32
27099 @itemx -mea64
27100 @opindex mea32
27101 @opindex mea64
27102 Compile code assuming that pointers to the PPU address space accessed
27103 via the @code{__ea} named address space qualifier are either 32 or 64
27104 bits wide. The default is 32 bits. As this is an ABI-changing option,
27105 all object code in an executable must be compiled with the same setting.
27106
27107 @item -maddress-space-conversion
27108 @itemx -mno-address-space-conversion
27109 @opindex maddress-space-conversion
27110 @opindex mno-address-space-conversion
27111 Allow/disallow treating the @code{__ea} address space as superset
27112 of the generic address space. This enables explicit type casts
27113 between @code{__ea} and generic pointer as well as implicit
27114 conversions of generic pointers to @code{__ea} pointers. The
27115 default is to allow address space pointer conversions.
27116
27117 @item -mcache-size=@var{cache-size}
27118 @opindex mcache-size
27119 This option controls the version of libgcc that the compiler links to an
27120 executable and selects a software-managed cache for accessing variables
27121 in the @code{__ea} address space with a particular cache size. Possible
27122 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
27123 and @samp{128}. The default cache size is 64KB.
27124
27125 @item -matomic-updates
27126 @itemx -mno-atomic-updates
27127 @opindex matomic-updates
27128 @opindex mno-atomic-updates
27129 This option controls the version of libgcc that the compiler links to an
27130 executable and selects whether atomic updates to the software-managed
27131 cache of PPU-side variables are used. If you use atomic updates, changes
27132 to a PPU variable from SPU code using the @code{__ea} named address space
27133 qualifier do not interfere with changes to other PPU variables residing
27134 in the same cache line from PPU code. If you do not use atomic updates,
27135 such interference may occur; however, writing back cache lines is
27136 more efficient. The default behavior is to use atomic updates.
27137
27138 @item -mdual-nops
27139 @itemx -mdual-nops=@var{n}
27140 @opindex mdual-nops
27141 By default, GCC inserts NOPs to increase dual issue when it expects
27142 it to increase performance. @var{n} can be a value from 0 to 10. A
27143 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
27144 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
27145
27146 @item -mhint-max-nops=@var{n}
27147 @opindex mhint-max-nops
27148 Maximum number of NOPs to insert for a branch hint. A branch hint must
27149 be at least 8 instructions away from the branch it is affecting. GCC
27150 inserts up to @var{n} NOPs to enforce this, otherwise it does not
27151 generate the branch hint.
27152
27153 @item -mhint-max-distance=@var{n}
27154 @opindex mhint-max-distance
27155 The encoding of the branch hint instruction limits the hint to be within
27156 256 instructions of the branch it is affecting. By default, GCC makes
27157 sure it is within 125.
27158
27159 @item -msafe-hints
27160 @opindex msafe-hints
27161 Work around a hardware bug that causes the SPU to stall indefinitely.
27162 By default, GCC inserts the @code{hbrp} instruction to make sure
27163 this stall won't happen.
27164
27165 @end table
27166
27167 @node System V Options
27168 @subsection Options for System V
27169
27170 These additional options are available on System V Release 4 for
27171 compatibility with other compilers on those systems:
27172
27173 @table @gcctabopt
27174 @item -G
27175 @opindex G
27176 Create a shared object.
27177 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
27178
27179 @item -Qy
27180 @opindex Qy
27181 Identify the versions of each tool used by the compiler, in a
27182 @code{.ident} assembler directive in the output.
27183
27184 @item -Qn
27185 @opindex Qn
27186 Refrain from adding @code{.ident} directives to the output file (this is
27187 the default).
27188
27189 @item -YP,@var{dirs}
27190 @opindex YP
27191 Search the directories @var{dirs}, and no others, for libraries
27192 specified with @option{-l}.
27193
27194 @item -Ym,@var{dir}
27195 @opindex Ym
27196 Look in the directory @var{dir} to find the M4 preprocessor.
27197 The assembler uses this option.
27198 @c This is supposed to go with a -Yd for predefined M4 macro files, but
27199 @c the generic assembler that comes with Solaris takes just -Ym.
27200 @end table
27201
27202 @node TILE-Gx Options
27203 @subsection TILE-Gx Options
27204 @cindex TILE-Gx options
27205
27206 These @samp{-m} options are supported on the TILE-Gx:
27207
27208 @table @gcctabopt
27209 @item -mcmodel=small
27210 @opindex mcmodel=small
27211 Generate code for the small model. The distance for direct calls is
27212 limited to 500M in either direction. PC-relative addresses are 32
27213 bits. Absolute addresses support the full address range.
27214
27215 @item -mcmodel=large
27216 @opindex mcmodel=large
27217 Generate code for the large model. There is no limitation on call
27218 distance, pc-relative addresses, or absolute addresses.
27219
27220 @item -mcpu=@var{name}
27221 @opindex mcpu
27222 Selects the type of CPU to be targeted. Currently the only supported
27223 type is @samp{tilegx}.
27224
27225 @item -m32
27226 @itemx -m64
27227 @opindex m32
27228 @opindex m64
27229 Generate code for a 32-bit or 64-bit environment. The 32-bit
27230 environment sets int, long, and pointer to 32 bits. The 64-bit
27231 environment sets int to 32 bits and long and pointer to 64 bits.
27232
27233 @item -mbig-endian
27234 @itemx -mlittle-endian
27235 @opindex mbig-endian
27236 @opindex mlittle-endian
27237 Generate code in big/little endian mode, respectively.
27238 @end table
27239
27240 @node TILEPro Options
27241 @subsection TILEPro Options
27242 @cindex TILEPro options
27243
27244 These @samp{-m} options are supported on the TILEPro:
27245
27246 @table @gcctabopt
27247 @item -mcpu=@var{name}
27248 @opindex mcpu
27249 Selects the type of CPU to be targeted. Currently the only supported
27250 type is @samp{tilepro}.
27251
27252 @item -m32
27253 @opindex m32
27254 Generate code for a 32-bit environment, which sets int, long, and
27255 pointer to 32 bits. This is the only supported behavior so the flag
27256 is essentially ignored.
27257 @end table
27258
27259 @node V850 Options
27260 @subsection V850 Options
27261 @cindex V850 Options
27262
27263 These @samp{-m} options are defined for V850 implementations:
27264
27265 @table @gcctabopt
27266 @item -mlong-calls
27267 @itemx -mno-long-calls
27268 @opindex mlong-calls
27269 @opindex mno-long-calls
27270 Treat all calls as being far away (near). If calls are assumed to be
27271 far away, the compiler always loads the function's address into a
27272 register, and calls indirect through the pointer.
27273
27274 @item -mno-ep
27275 @itemx -mep
27276 @opindex mno-ep
27277 @opindex mep
27278 Do not optimize (do optimize) basic blocks that use the same index
27279 pointer 4 or more times to copy pointer into the @code{ep} register, and
27280 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
27281 option is on by default if you optimize.
27282
27283 @item -mno-prolog-function
27284 @itemx -mprolog-function
27285 @opindex mno-prolog-function
27286 @opindex mprolog-function
27287 Do not use (do use) external functions to save and restore registers
27288 at the prologue and epilogue of a function. The external functions
27289 are slower, but use less code space if more than one function saves
27290 the same number of registers. The @option{-mprolog-function} option
27291 is on by default if you optimize.
27292
27293 @item -mspace
27294 @opindex mspace
27295 Try to make the code as small as possible. At present, this just turns
27296 on the @option{-mep} and @option{-mprolog-function} options.
27297
27298 @item -mtda=@var{n}
27299 @opindex mtda
27300 Put static or global variables whose size is @var{n} bytes or less into
27301 the tiny data area that register @code{ep} points to. The tiny data
27302 area can hold up to 256 bytes in total (128 bytes for byte references).
27303
27304 @item -msda=@var{n}
27305 @opindex msda
27306 Put static or global variables whose size is @var{n} bytes or less into
27307 the small data area that register @code{gp} points to. The small data
27308 area can hold up to 64 kilobytes.
27309
27310 @item -mzda=@var{n}
27311 @opindex mzda
27312 Put static or global variables whose size is @var{n} bytes or less into
27313 the first 32 kilobytes of memory.
27314
27315 @item -mv850
27316 @opindex mv850
27317 Specify that the target processor is the V850.
27318
27319 @item -mv850e3v5
27320 @opindex mv850e3v5
27321 Specify that the target processor is the V850E3V5. The preprocessor
27322 constant @code{__v850e3v5__} is defined if this option is used.
27323
27324 @item -mv850e2v4
27325 @opindex mv850e2v4
27326 Specify that the target processor is the V850E3V5. This is an alias for
27327 the @option{-mv850e3v5} option.
27328
27329 @item -mv850e2v3
27330 @opindex mv850e2v3
27331 Specify that the target processor is the V850E2V3. The preprocessor
27332 constant @code{__v850e2v3__} is defined if this option is used.
27333
27334 @item -mv850e2
27335 @opindex mv850e2
27336 Specify that the target processor is the V850E2. The preprocessor
27337 constant @code{__v850e2__} is defined if this option is used.
27338
27339 @item -mv850e1
27340 @opindex mv850e1
27341 Specify that the target processor is the V850E1. The preprocessor
27342 constants @code{__v850e1__} and @code{__v850e__} are defined if
27343 this option is used.
27344
27345 @item -mv850es
27346 @opindex mv850es
27347 Specify that the target processor is the V850ES. This is an alias for
27348 the @option{-mv850e1} option.
27349
27350 @item -mv850e
27351 @opindex mv850e
27352 Specify that the target processor is the V850E@. The preprocessor
27353 constant @code{__v850e__} is defined if this option is used.
27354
27355 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27356 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27357 are defined then a default target processor is chosen and the
27358 relevant @samp{__v850*__} preprocessor constant is defined.
27359
27360 The preprocessor constants @code{__v850} and @code{__v851__} are always
27361 defined, regardless of which processor variant is the target.
27362
27363 @item -mdisable-callt
27364 @itemx -mno-disable-callt
27365 @opindex mdisable-callt
27366 @opindex mno-disable-callt
27367 This option suppresses generation of the @code{CALLT} instruction for the
27368 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27369 architecture.
27370
27371 This option is enabled by default when the RH850 ABI is
27372 in use (see @option{-mrh850-abi}), and disabled by default when the
27373 GCC ABI is in use. If @code{CALLT} instructions are being generated
27374 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27375
27376 @item -mrelax
27377 @itemx -mno-relax
27378 @opindex mrelax
27379 @opindex mno-relax
27380 Pass on (or do not pass on) the @option{-mrelax} command-line option
27381 to the assembler.
27382
27383 @item -mlong-jumps
27384 @itemx -mno-long-jumps
27385 @opindex mlong-jumps
27386 @opindex mno-long-jumps
27387 Disable (or re-enable) the generation of PC-relative jump instructions.
27388
27389 @item -msoft-float
27390 @itemx -mhard-float
27391 @opindex msoft-float
27392 @opindex mhard-float
27393 Disable (or re-enable) the generation of hardware floating point
27394 instructions. This option is only significant when the target
27395 architecture is @samp{V850E2V3} or higher. If hardware floating point
27396 instructions are being generated then the C preprocessor symbol
27397 @code{__FPU_OK__} is defined, otherwise the symbol
27398 @code{__NO_FPU__} is defined.
27399
27400 @item -mloop
27401 @opindex mloop
27402 Enables the use of the e3v5 LOOP instruction. The use of this
27403 instruction is not enabled by default when the e3v5 architecture is
27404 selected because its use is still experimental.
27405
27406 @item -mrh850-abi
27407 @itemx -mghs
27408 @opindex mrh850-abi
27409 @opindex mghs
27410 Enables support for the RH850 version of the V850 ABI. This is the
27411 default. With this version of the ABI the following rules apply:
27412
27413 @itemize
27414 @item
27415 Integer sized structures and unions are returned via a memory pointer
27416 rather than a register.
27417
27418 @item
27419 Large structures and unions (more than 8 bytes in size) are passed by
27420 value.
27421
27422 @item
27423 Functions are aligned to 16-bit boundaries.
27424
27425 @item
27426 The @option{-m8byte-align} command-line option is supported.
27427
27428 @item
27429 The @option{-mdisable-callt} command-line option is enabled by
27430 default. The @option{-mno-disable-callt} command-line option is not
27431 supported.
27432 @end itemize
27433
27434 When this version of the ABI is enabled the C preprocessor symbol
27435 @code{__V850_RH850_ABI__} is defined.
27436
27437 @item -mgcc-abi
27438 @opindex mgcc-abi
27439 Enables support for the old GCC version of the V850 ABI. With this
27440 version of the ABI the following rules apply:
27441
27442 @itemize
27443 @item
27444 Integer sized structures and unions are returned in register @code{r10}.
27445
27446 @item
27447 Large structures and unions (more than 8 bytes in size) are passed by
27448 reference.
27449
27450 @item
27451 Functions are aligned to 32-bit boundaries, unless optimizing for
27452 size.
27453
27454 @item
27455 The @option{-m8byte-align} command-line option is not supported.
27456
27457 @item
27458 The @option{-mdisable-callt} command-line option is supported but not
27459 enabled by default.
27460 @end itemize
27461
27462 When this version of the ABI is enabled the C preprocessor symbol
27463 @code{__V850_GCC_ABI__} is defined.
27464
27465 @item -m8byte-align
27466 @itemx -mno-8byte-align
27467 @opindex m8byte-align
27468 @opindex mno-8byte-align
27469 Enables support for @code{double} and @code{long long} types to be
27470 aligned on 8-byte boundaries. The default is to restrict the
27471 alignment of all objects to at most 4-bytes. When
27472 @option{-m8byte-align} is in effect the C preprocessor symbol
27473 @code{__V850_8BYTE_ALIGN__} is defined.
27474
27475 @item -mbig-switch
27476 @opindex mbig-switch
27477 Generate code suitable for big switch tables. Use this option only if
27478 the assembler/linker complain about out of range branches within a switch
27479 table.
27480
27481 @item -mapp-regs
27482 @opindex mapp-regs
27483 This option causes r2 and r5 to be used in the code generated by
27484 the compiler. This setting is the default.
27485
27486 @item -mno-app-regs
27487 @opindex mno-app-regs
27488 This option causes r2 and r5 to be treated as fixed registers.
27489
27490 @end table
27491
27492 @node VAX Options
27493 @subsection VAX Options
27494 @cindex VAX options
27495
27496 These @samp{-m} options are defined for the VAX:
27497
27498 @table @gcctabopt
27499 @item -munix
27500 @opindex munix
27501 Do not output certain jump instructions (@code{aobleq} and so on)
27502 that the Unix assembler for the VAX cannot handle across long
27503 ranges.
27504
27505 @item -mgnu
27506 @opindex mgnu
27507 Do output those jump instructions, on the assumption that the
27508 GNU assembler is being used.
27509
27510 @item -mg
27511 @opindex mg
27512 Output code for G-format floating-point numbers instead of D-format.
27513 @end table
27514
27515 @node Visium Options
27516 @subsection Visium Options
27517 @cindex Visium options
27518
27519 @table @gcctabopt
27520
27521 @item -mdebug
27522 @opindex mdebug
27523 A program which performs file I/O and is destined to run on an MCM target
27524 should be linked with this option. It causes the libraries libc.a and
27525 libdebug.a to be linked. The program should be run on the target under
27526 the control of the GDB remote debugging stub.
27527
27528 @item -msim
27529 @opindex msim
27530 A program which performs file I/O and is destined to run on the simulator
27531 should be linked with option. This causes libraries libc.a and libsim.a to
27532 be linked.
27533
27534 @item -mfpu
27535 @itemx -mhard-float
27536 @opindex mfpu
27537 @opindex mhard-float
27538 Generate code containing floating-point instructions. This is the
27539 default.
27540
27541 @item -mno-fpu
27542 @itemx -msoft-float
27543 @opindex mno-fpu
27544 @opindex msoft-float
27545 Generate code containing library calls for floating-point.
27546
27547 @option{-msoft-float} changes the calling convention in the output file;
27548 therefore, it is only useful if you compile @emph{all} of a program with
27549 this option. In particular, you need to compile @file{libgcc.a}, the
27550 library that comes with GCC, with @option{-msoft-float} in order for
27551 this to work.
27552
27553 @item -mcpu=@var{cpu_type}
27554 @opindex mcpu
27555 Set the instruction set, register set, and instruction scheduling parameters
27556 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27557 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27558
27559 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27560
27561 By default (unless configured otherwise), GCC generates code for the GR5
27562 variant of the Visium architecture.
27563
27564 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27565 architecture. The only difference from GR5 code is that the compiler will
27566 generate block move instructions.
27567
27568 @item -mtune=@var{cpu_type}
27569 @opindex mtune
27570 Set the instruction scheduling parameters for machine type @var{cpu_type},
27571 but do not set the instruction set or register set that the option
27572 @option{-mcpu=@var{cpu_type}} would.
27573
27574 @item -msv-mode
27575 @opindex msv-mode
27576 Generate code for the supervisor mode, where there are no restrictions on
27577 the access to general registers. This is the default.
27578
27579 @item -muser-mode
27580 @opindex muser-mode
27581 Generate code for the user mode, where the access to some general registers
27582 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27583 mode; on the GR6, only registers r29 to r31 are affected.
27584 @end table
27585
27586 @node VMS Options
27587 @subsection VMS Options
27588
27589 These @samp{-m} options are defined for the VMS implementations:
27590
27591 @table @gcctabopt
27592 @item -mvms-return-codes
27593 @opindex mvms-return-codes
27594 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27595 condition (e.g.@: error) codes.
27596
27597 @item -mdebug-main=@var{prefix}
27598 @opindex mdebug-main=@var{prefix}
27599 Flag the first routine whose name starts with @var{prefix} as the main
27600 routine for the debugger.
27601
27602 @item -mmalloc64
27603 @opindex mmalloc64
27604 Default to 64-bit memory allocation routines.
27605
27606 @item -mpointer-size=@var{size}
27607 @opindex mpointer-size=@var{size}
27608 Set the default size of pointers. Possible options for @var{size} are
27609 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27610 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27611 The later option disables @code{pragma pointer_size}.
27612 @end table
27613
27614 @node VxWorks Options
27615 @subsection VxWorks Options
27616 @cindex VxWorks Options
27617
27618 The options in this section are defined for all VxWorks targets.
27619 Options specific to the target hardware are listed with the other
27620 options for that target.
27621
27622 @table @gcctabopt
27623 @item -mrtp
27624 @opindex mrtp
27625 GCC can generate code for both VxWorks kernels and real time processes
27626 (RTPs). This option switches from the former to the latter. It also
27627 defines the preprocessor macro @code{__RTP__}.
27628
27629 @item -non-static
27630 @opindex non-static
27631 Link an RTP executable against shared libraries rather than static
27632 libraries. The options @option{-static} and @option{-shared} can
27633 also be used for RTPs (@pxref{Link Options}); @option{-static}
27634 is the default.
27635
27636 @item -Bstatic
27637 @itemx -Bdynamic
27638 @opindex Bstatic
27639 @opindex Bdynamic
27640 These options are passed down to the linker. They are defined for
27641 compatibility with Diab.
27642
27643 @item -Xbind-lazy
27644 @opindex Xbind-lazy
27645 Enable lazy binding of function calls. This option is equivalent to
27646 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27647
27648 @item -Xbind-now
27649 @opindex Xbind-now
27650 Disable lazy binding of function calls. This option is the default and
27651 is defined for compatibility with Diab.
27652 @end table
27653
27654 @node x86 Options
27655 @subsection x86 Options
27656 @cindex x86 Options
27657
27658 These @samp{-m} options are defined for the x86 family of computers.
27659
27660 @table @gcctabopt
27661
27662 @item -march=@var{cpu-type}
27663 @opindex march
27664 Generate instructions for the machine type @var{cpu-type}. In contrast to
27665 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27666 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27667 to generate code that may not run at all on processors other than the one
27668 indicated. Specifying @option{-march=@var{cpu-type}} implies
27669 @option{-mtune=@var{cpu-type}}.
27670
27671 The choices for @var{cpu-type} are:
27672
27673 @table @samp
27674 @item native
27675 This selects the CPU to generate code for at compilation time by determining
27676 the processor type of the compiling machine. Using @option{-march=native}
27677 enables all instruction subsets supported by the local machine (hence
27678 the result might not run on different machines). Using @option{-mtune=native}
27679 produces code optimized for the local machine under the constraints
27680 of the selected instruction set.
27681
27682 @item x86-64
27683 A generic CPU with 64-bit extensions.
27684
27685 @item i386
27686 Original Intel i386 CPU@.
27687
27688 @item i486
27689 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27690
27691 @item i586
27692 @itemx pentium
27693 Intel Pentium CPU with no MMX support.
27694
27695 @item lakemont
27696 Intel Lakemont MCU, based on Intel Pentium CPU.
27697
27698 @item pentium-mmx
27699 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27700
27701 @item pentiumpro
27702 Intel Pentium Pro CPU@.
27703
27704 @item i686
27705 When used with @option{-march}, the Pentium Pro
27706 instruction set is used, so the code runs on all i686 family chips.
27707 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27708
27709 @item pentium2
27710 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27711 support.
27712
27713 @item pentium3
27714 @itemx pentium3m
27715 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27716 set support.
27717
27718 @item pentium-m
27719 Intel Pentium M; low-power version of Intel Pentium III CPU
27720 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27721
27722 @item pentium4
27723 @itemx pentium4m
27724 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27725
27726 @item prescott
27727 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27728 set support.
27729
27730 @item nocona
27731 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27732 SSE2 and SSE3 instruction set support.
27733
27734 @item core2
27735 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27736 instruction set support.
27737
27738 @item nehalem
27739 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27740 SSE4.1, SSE4.2 and POPCNT instruction set support.
27741
27742 @item westmere
27743 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27744 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27745
27746 @item sandybridge
27747 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27748 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27749
27750 @item ivybridge
27751 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27752 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27753 instruction set support.
27754
27755 @item haswell
27756 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27757 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27758 BMI, BMI2 and F16C instruction set support.
27759
27760 @item broadwell
27761 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27762 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27763 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27764
27765 @item skylake
27766 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27767 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27768 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27769 XSAVES instruction set support.
27770
27771 @item bonnell
27772 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27773 instruction set support.
27774
27775 @item silvermont
27776 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27777 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27778
27779 @item goldmont
27780 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27781 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27782 instruction set support.
27783
27784 @item goldmont-plus
27785 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27786 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27787 PTWRITE, RDPID, SGX and UMIP instruction set support.
27788
27789 @item tremont
27790 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27791 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27792 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27793
27794 @item knl
27795 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27796 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27797 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27798 AVX512CD instruction set support.
27799
27800 @item knm
27801 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27802 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27803 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27804 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27805
27806 @item skylake-avx512
27807 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27808 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27809 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27810 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27811
27812 @item cannonlake
27813 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27814 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27815 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27816 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27817 AVX512IFMA, SHA and UMIP instruction set support.
27818
27819 @item icelake-client
27820 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27821 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27822 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27823 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27824 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27825 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27826
27827 @item icelake-server
27828 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27829 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27830 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27831 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27832 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27833 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27834 set support.
27835
27836 @item k6
27837 AMD K6 CPU with MMX instruction set support.
27838
27839 @item k6-2
27840 @itemx k6-3
27841 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27842
27843 @item athlon
27844 @itemx athlon-tbird
27845 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27846 support.
27847
27848 @item athlon-4
27849 @itemx athlon-xp
27850 @itemx athlon-mp
27851 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27852 instruction set support.
27853
27854 @item k8
27855 @itemx opteron
27856 @itemx athlon64
27857 @itemx athlon-fx
27858 Processors based on the AMD K8 core with x86-64 instruction set support,
27859 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27860 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27861 instruction set extensions.)
27862
27863 @item k8-sse3
27864 @itemx opteron-sse3
27865 @itemx athlon64-sse3
27866 Improved versions of AMD K8 cores with SSE3 instruction set support.
27867
27868 @item amdfam10
27869 @itemx barcelona
27870 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27871 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27872 instruction set extensions.)
27873
27874 @item bdver1
27875 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27876 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27877 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27878 @item bdver2
27879 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27880 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
27881 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27882 extensions.)
27883 @item bdver3
27884 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27885 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27886 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27887 64-bit instruction set extensions.
27888 @item bdver4
27889 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27890 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27891 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27892 SSE4.2, ABM and 64-bit instruction set extensions.
27893
27894 @item znver1
27895 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27896 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27897 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27898 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27899 instruction set extensions.
27900 @item znver2
27901 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27902 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27903 MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27904 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27905 instruction set extensions.)
27906
27907
27908 @item btver1
27909 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27910 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27911 instruction set extensions.)
27912
27913 @item btver2
27914 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27915 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27916 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27917
27918 @item winchip-c6
27919 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27920 set support.
27921
27922 @item winchip2
27923 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27924 instruction set support.
27925
27926 @item c3
27927 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27928 (No scheduling is implemented for this chip.)
27929
27930 @item c3-2
27931 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27932 (No scheduling is implemented for this chip.)
27933
27934 @item c7
27935 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27936 (No scheduling is implemented for this chip.)
27937
27938 @item samuel-2
27939 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27940 (No scheduling is implemented for this chip.)
27941
27942 @item nehemiah
27943 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27944 (No scheduling is implemented for this chip.)
27945
27946 @item esther
27947 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27948 (No scheduling is implemented for this chip.)
27949
27950 @item eden-x2
27951 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27952 (No scheduling is implemented for this chip.)
27953
27954 @item eden-x4
27955 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27956 AVX and AVX2 instruction set support.
27957 (No scheduling is implemented for this chip.)
27958
27959 @item nano
27960 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27961 instruction set support.
27962 (No scheduling is implemented for this chip.)
27963
27964 @item nano-1000
27965 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27966 instruction set support.
27967 (No scheduling is implemented for this chip.)
27968
27969 @item nano-2000
27970 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27971 instruction set support.
27972 (No scheduling is implemented for this chip.)
27973
27974 @item nano-3000
27975 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27976 instruction set support.
27977 (No scheduling is implemented for this chip.)
27978
27979 @item nano-x2
27980 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27981 instruction set support.
27982 (No scheduling is implemented for this chip.)
27983
27984 @item nano-x4
27985 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27986 instruction set support.
27987 (No scheduling is implemented for this chip.)
27988
27989 @item geode
27990 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27991 @end table
27992
27993 @item -mtune=@var{cpu-type}
27994 @opindex mtune
27995 Tune to @var{cpu-type} everything applicable about the generated code, except
27996 for the ABI and the set of available instructions.
27997 While picking a specific @var{cpu-type} schedules things appropriately
27998 for that particular chip, the compiler does not generate any code that
27999 cannot run on the default machine type unless you use a
28000 @option{-march=@var{cpu-type}} option.
28001 For example, if GCC is configured for i686-pc-linux-gnu
28002 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
28003 but still runs on i686 machines.
28004
28005 The choices for @var{cpu-type} are the same as for @option{-march}.
28006 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
28007
28008 @table @samp
28009 @item generic
28010 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
28011 If you know the CPU on which your code will run, then you should use
28012 the corresponding @option{-mtune} or @option{-march} option instead of
28013 @option{-mtune=generic}. But, if you do not know exactly what CPU users
28014 of your application will have, then you should use this option.
28015
28016 As new processors are deployed in the marketplace, the behavior of this
28017 option will change. Therefore, if you upgrade to a newer version of
28018 GCC, code generation controlled by this option will change to reflect
28019 the processors
28020 that are most common at the time that version of GCC is released.
28021
28022 There is no @option{-march=generic} option because @option{-march}
28023 indicates the instruction set the compiler can use, and there is no
28024 generic instruction set applicable to all processors. In contrast,
28025 @option{-mtune} indicates the processor (or, in this case, collection of
28026 processors) for which the code is optimized.
28027
28028 @item intel
28029 Produce code optimized for the most current Intel processors, which are
28030 Haswell and Silvermont for this version of GCC. If you know the CPU
28031 on which your code will run, then you should use the corresponding
28032 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
28033 But, if you want your application performs better on both Haswell and
28034 Silvermont, then you should use this option.
28035
28036 As new Intel processors are deployed in the marketplace, the behavior of
28037 this option will change. Therefore, if you upgrade to a newer version of
28038 GCC, code generation controlled by this option will change to reflect
28039 the most current Intel processors at the time that version of GCC is
28040 released.
28041
28042 There is no @option{-march=intel} option because @option{-march} indicates
28043 the instruction set the compiler can use, and there is no common
28044 instruction set applicable to all processors. In contrast,
28045 @option{-mtune} indicates the processor (or, in this case, collection of
28046 processors) for which the code is optimized.
28047 @end table
28048
28049 @item -mcpu=@var{cpu-type}
28050 @opindex mcpu
28051 A deprecated synonym for @option{-mtune}.
28052
28053 @item -mfpmath=@var{unit}
28054 @opindex mfpmath
28055 Generate floating-point arithmetic for selected unit @var{unit}. The choices
28056 for @var{unit} are:
28057
28058 @table @samp
28059 @item 387
28060 Use the standard 387 floating-point coprocessor present on the majority of chips and
28061 emulated otherwise. Code compiled with this option runs almost everywhere.
28062 The temporary results are computed in 80-bit precision instead of the precision
28063 specified by the type, resulting in slightly different results compared to most
28064 of other chips. See @option{-ffloat-store} for more detailed description.
28065
28066 This is the default choice for non-Darwin x86-32 targets.
28067
28068 @item sse
28069 Use scalar floating-point instructions present in the SSE instruction set.
28070 This instruction set is supported by Pentium III and newer chips,
28071 and in the AMD line
28072 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
28073 instruction set supports only single-precision arithmetic, thus the double and
28074 extended-precision arithmetic are still done using 387. A later version, present
28075 only in Pentium 4 and AMD x86-64 chips, supports double-precision
28076 arithmetic too.
28077
28078 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
28079 or @option{-msse2} switches to enable SSE extensions and make this option
28080 effective. For the x86-64 compiler, these extensions are enabled by default.
28081
28082 The resulting code should be considerably faster in the majority of cases and avoid
28083 the numerical instability problems of 387 code, but may break some existing
28084 code that expects temporaries to be 80 bits.
28085
28086 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
28087 and the default choice for x86-32 targets with the SSE2 instruction set
28088 when @option{-ffast-math} is enabled.
28089
28090 @item sse,387
28091 @itemx sse+387
28092 @itemx both
28093 Attempt to utilize both instruction sets at once. This effectively doubles the
28094 amount of available registers, and on chips with separate execution units for
28095 387 and SSE the execution resources too. Use this option with care, as it is
28096 still experimental, because the GCC register allocator does not model separate
28097 functional units well, resulting in unstable performance.
28098 @end table
28099
28100 @item -masm=@var{dialect}
28101 @opindex masm=@var{dialect}
28102 Output assembly instructions using selected @var{dialect}. Also affects
28103 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
28104 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
28105 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
28106 not support @samp{intel}.
28107
28108 @item -mieee-fp
28109 @itemx -mno-ieee-fp
28110 @opindex mieee-fp
28111 @opindex mno-ieee-fp
28112 Control whether or not the compiler uses IEEE floating-point
28113 comparisons. These correctly handle the case where the result of a
28114 comparison is unordered.
28115
28116 @item -m80387
28117 @itemx -mhard-float
28118 @opindex 80387
28119 @opindex mhard-float
28120 Generate output containing 80387 instructions for floating point.
28121
28122 @item -mno-80387
28123 @itemx -msoft-float
28124 @opindex no-80387
28125 @opindex msoft-float
28126 Generate output containing library calls for floating point.
28127
28128 @strong{Warning:} the requisite libraries are not part of GCC@.
28129 Normally the facilities of the machine's usual C compiler are used, but
28130 this cannot be done directly in cross-compilation. You must make your
28131 own arrangements to provide suitable library functions for
28132 cross-compilation.
28133
28134 On machines where a function returns floating-point results in the 80387
28135 register stack, some floating-point opcodes may be emitted even if
28136 @option{-msoft-float} is used.
28137
28138 @item -mno-fp-ret-in-387
28139 @opindex mno-fp-ret-in-387
28140 @opindex mfp-ret-in-387
28141 Do not use the FPU registers for return values of functions.
28142
28143 The usual calling convention has functions return values of types
28144 @code{float} and @code{double} in an FPU register, even if there
28145 is no FPU@. The idea is that the operating system should emulate
28146 an FPU@.
28147
28148 The option @option{-mno-fp-ret-in-387} causes such values to be returned
28149 in ordinary CPU registers instead.
28150
28151 @item -mno-fancy-math-387
28152 @opindex mno-fancy-math-387
28153 @opindex mfancy-math-387
28154 Some 387 emulators do not support the @code{sin}, @code{cos} and
28155 @code{sqrt} instructions for the 387. Specify this option to avoid
28156 generating those instructions.
28157 This option is overridden when @option{-march}
28158 indicates that the target CPU always has an FPU and so the
28159 instruction does not need emulation. These
28160 instructions are not generated unless you also use the
28161 @option{-funsafe-math-optimizations} switch.
28162
28163 @item -malign-double
28164 @itemx -mno-align-double
28165 @opindex malign-double
28166 @opindex mno-align-double
28167 Control whether GCC aligns @code{double}, @code{long double}, and
28168 @code{long long} variables on a two-word boundary or a one-word
28169 boundary. Aligning @code{double} variables on a two-word boundary
28170 produces code that runs somewhat faster on a Pentium at the
28171 expense of more memory.
28172
28173 On x86-64, @option{-malign-double} is enabled by default.
28174
28175 @strong{Warning:} if you use the @option{-malign-double} switch,
28176 structures containing the above types are aligned differently than
28177 the published application binary interface specifications for the x86-32
28178 and are not binary compatible with structures in code compiled
28179 without that switch.
28180
28181 @item -m96bit-long-double
28182 @itemx -m128bit-long-double
28183 @opindex m96bit-long-double
28184 @opindex m128bit-long-double
28185 These switches control the size of @code{long double} type. The x86-32
28186 application binary interface specifies the size to be 96 bits,
28187 so @option{-m96bit-long-double} is the default in 32-bit mode.
28188
28189 Modern architectures (Pentium and newer) prefer @code{long double}
28190 to be aligned to an 8- or 16-byte boundary. In arrays or structures
28191 conforming to the ABI, this is not possible. So specifying
28192 @option{-m128bit-long-double} aligns @code{long double}
28193 to a 16-byte boundary by padding the @code{long double} with an additional
28194 32-bit zero.
28195
28196 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
28197 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
28198
28199 Notice that neither of these options enable any extra precision over the x87
28200 standard of 80 bits for a @code{long double}.
28201
28202 @strong{Warning:} if you override the default value for your target ABI, this
28203 changes the size of
28204 structures and arrays containing @code{long double} variables,
28205 as well as modifying the function calling convention for functions taking
28206 @code{long double}. Hence they are not binary-compatible
28207 with code compiled without that switch.
28208
28209 @item -mlong-double-64
28210 @itemx -mlong-double-80
28211 @itemx -mlong-double-128
28212 @opindex mlong-double-64
28213 @opindex mlong-double-80
28214 @opindex mlong-double-128
28215 These switches control the size of @code{long double} type. A size
28216 of 64 bits makes the @code{long double} type equivalent to the @code{double}
28217 type. This is the default for 32-bit Bionic C library. A size
28218 of 128 bits makes the @code{long double} type equivalent to the
28219 @code{__float128} type. This is the default for 64-bit Bionic C library.
28220
28221 @strong{Warning:} if you override the default value for your target ABI, this
28222 changes the size of
28223 structures and arrays containing @code{long double} variables,
28224 as well as modifying the function calling convention for functions taking
28225 @code{long double}. Hence they are not binary-compatible
28226 with code compiled without that switch.
28227
28228 @item -malign-data=@var{type}
28229 @opindex malign-data
28230 Control how GCC aligns variables. Supported values for @var{type} are
28231 @samp{compat} uses increased alignment value compatible uses GCC 4.8
28232 and earlier, @samp{abi} uses alignment value as specified by the
28233 psABI, and @samp{cacheline} uses increased alignment value to match
28234 the cache line size. @samp{compat} is the default.
28235
28236 @item -mlarge-data-threshold=@var{threshold}
28237 @opindex mlarge-data-threshold
28238 When @option{-mcmodel=medium} is specified, data objects larger than
28239 @var{threshold} are placed in the large data section. This value must be the
28240 same across all objects linked into the binary, and defaults to 65535.
28241
28242 @item -mrtd
28243 @opindex mrtd
28244 Use a different function-calling convention, in which functions that
28245 take a fixed number of arguments return with the @code{ret @var{num}}
28246 instruction, which pops their arguments while returning. This saves one
28247 instruction in the caller since there is no need to pop the arguments
28248 there.
28249
28250 You can specify that an individual function is called with this calling
28251 sequence with the function attribute @code{stdcall}. You can also
28252 override the @option{-mrtd} option by using the function attribute
28253 @code{cdecl}. @xref{Function Attributes}.
28254
28255 @strong{Warning:} this calling convention is incompatible with the one
28256 normally used on Unix, so you cannot use it if you need to call
28257 libraries compiled with the Unix compiler.
28258
28259 Also, you must provide function prototypes for all functions that
28260 take variable numbers of arguments (including @code{printf});
28261 otherwise incorrect code is generated for calls to those
28262 functions.
28263
28264 In addition, seriously incorrect code results if you call a
28265 function with too many arguments. (Normally, extra arguments are
28266 harmlessly ignored.)
28267
28268 @item -mregparm=@var{num}
28269 @opindex mregparm
28270 Control how many registers are used to pass integer arguments. By
28271 default, no registers are used to pass arguments, and at most 3
28272 registers can be used. You can control this behavior for a specific
28273 function by using the function attribute @code{regparm}.
28274 @xref{Function Attributes}.
28275
28276 @strong{Warning:} if you use this switch, and
28277 @var{num} is nonzero, then you must build all modules with the same
28278 value, including any libraries. This includes the system libraries and
28279 startup modules.
28280
28281 @item -msseregparm
28282 @opindex msseregparm
28283 Use SSE register passing conventions for float and double arguments
28284 and return values. You can control this behavior for a specific
28285 function by using the function attribute @code{sseregparm}.
28286 @xref{Function Attributes}.
28287
28288 @strong{Warning:} if you use this switch then you must build all
28289 modules with the same value, including any libraries. This includes
28290 the system libraries and startup modules.
28291
28292 @item -mvect8-ret-in-mem
28293 @opindex mvect8-ret-in-mem
28294 Return 8-byte vectors in memory instead of MMX registers. This is the
28295 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
28296 Studio compilers until version 12. Later compiler versions (starting
28297 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
28298 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
28299 you need to remain compatible with existing code produced by those
28300 previous compiler versions or older versions of GCC@.
28301
28302 @item -mpc32
28303 @itemx -mpc64
28304 @itemx -mpc80
28305 @opindex mpc32
28306 @opindex mpc64
28307 @opindex mpc80
28308
28309 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
28310 is specified, the significands of results of floating-point operations are
28311 rounded to 24 bits (single precision); @option{-mpc64} rounds the
28312 significands of results of floating-point operations to 53 bits (double
28313 precision) and @option{-mpc80} rounds the significands of results of
28314 floating-point operations to 64 bits (extended double precision), which is
28315 the default. When this option is used, floating-point operations in higher
28316 precisions are not available to the programmer without setting the FPU
28317 control word explicitly.
28318
28319 Setting the rounding of floating-point operations to less than the default
28320 80 bits can speed some programs by 2% or more. Note that some mathematical
28321 libraries assume that extended-precision (80-bit) floating-point operations
28322 are enabled by default; routines in such libraries could suffer significant
28323 loss of accuracy, typically through so-called ``catastrophic cancellation'',
28324 when this option is used to set the precision to less than extended precision.
28325
28326 @item -mstackrealign
28327 @opindex mstackrealign
28328 Realign the stack at entry. On the x86, the @option{-mstackrealign}
28329 option generates an alternate prologue and epilogue that realigns the
28330 run-time stack if necessary. This supports mixing legacy codes that keep
28331 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
28332 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
28333 applicable to individual functions.
28334
28335 @item -mpreferred-stack-boundary=@var{num}
28336 @opindex mpreferred-stack-boundary
28337 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28338 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28339 the default is 4 (16 bytes or 128 bits).
28340
28341 @strong{Warning:} When generating code for the x86-64 architecture with
28342 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28343 used to keep the stack boundary aligned to 8 byte boundary. Since
28344 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28345 intended to be used in controlled environment where stack space is
28346 important limitation. This option leads to wrong code when functions
28347 compiled with 16 byte stack alignment (such as functions from a standard
28348 library) are called with misaligned stack. In this case, SSE
28349 instructions may lead to misaligned memory access traps. In addition,
28350 variable arguments are handled incorrectly for 16 byte aligned
28351 objects (including x87 long double and __int128), leading to wrong
28352 results. You must build all modules with
28353 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28354 includes the system libraries and startup modules.
28355
28356 @item -mincoming-stack-boundary=@var{num}
28357 @opindex mincoming-stack-boundary
28358 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28359 boundary. If @option{-mincoming-stack-boundary} is not specified,
28360 the one specified by @option{-mpreferred-stack-boundary} is used.
28361
28362 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28363 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28364 suffer significant run time performance penalties. On Pentium III, the
28365 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28366 properly if it is not 16-byte aligned.
28367
28368 To ensure proper alignment of this values on the stack, the stack boundary
28369 must be as aligned as that required by any value stored on the stack.
28370 Further, every function must be generated such that it keeps the stack
28371 aligned. Thus calling a function compiled with a higher preferred
28372 stack boundary from a function compiled with a lower preferred stack
28373 boundary most likely misaligns the stack. It is recommended that
28374 libraries that use callbacks always use the default setting.
28375
28376 This extra alignment does consume extra stack space, and generally
28377 increases code size. Code that is sensitive to stack space usage, such
28378 as embedded systems and operating system kernels, may want to reduce the
28379 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28380
28381 @need 200
28382 @item -mmmx
28383 @opindex mmmx
28384 @need 200
28385 @itemx -msse
28386 @opindex msse
28387 @need 200
28388 @itemx -msse2
28389 @opindex msse2
28390 @need 200
28391 @itemx -msse3
28392 @opindex msse3
28393 @need 200
28394 @itemx -mssse3
28395 @opindex mssse3
28396 @need 200
28397 @itemx -msse4
28398 @opindex msse4
28399 @need 200
28400 @itemx -msse4a
28401 @opindex msse4a
28402 @need 200
28403 @itemx -msse4.1
28404 @opindex msse4.1
28405 @need 200
28406 @itemx -msse4.2
28407 @opindex msse4.2
28408 @need 200
28409 @itemx -mavx
28410 @opindex mavx
28411 @need 200
28412 @itemx -mavx2
28413 @opindex mavx2
28414 @need 200
28415 @itemx -mavx512f
28416 @opindex mavx512f
28417 @need 200
28418 @itemx -mavx512pf
28419 @opindex mavx512pf
28420 @need 200
28421 @itemx -mavx512er
28422 @opindex mavx512er
28423 @need 200
28424 @itemx -mavx512cd
28425 @opindex mavx512cd
28426 @need 200
28427 @itemx -mavx512vl
28428 @opindex mavx512vl
28429 @need 200
28430 @itemx -mavx512bw
28431 @opindex mavx512bw
28432 @need 200
28433 @itemx -mavx512dq
28434 @opindex mavx512dq
28435 @need 200
28436 @itemx -mavx512ifma
28437 @opindex mavx512ifma
28438 @need 200
28439 @itemx -mavx512vbmi
28440 @opindex mavx512vbmi
28441 @need 200
28442 @itemx -msha
28443 @opindex msha
28444 @need 200
28445 @itemx -maes
28446 @opindex maes
28447 @need 200
28448 @itemx -mpclmul
28449 @opindex mpclmul
28450 @need 200
28451 @itemx -mclflushopt
28452 @opindex mclflushopt
28453 @need 200
28454 @itemx -mfsgsbase
28455 @opindex mfsgsbase
28456 @need 200
28457 @itemx -mptwrite
28458 @opindex mptwrite
28459 @need 200
28460 @itemx -mrdrnd
28461 @opindex mrdrnd
28462 @need 200
28463 @itemx -mf16c
28464 @opindex mf16c
28465 @need 200
28466 @itemx -mfma
28467 @opindex mfma
28468 @need 200
28469 @itemx -mpconfig
28470 @opindex mpconfig
28471 @need 200
28472 @itemx -mwbnoinvd
28473 @opindex mwbnoinvd
28474 @need 200
28475 @itemx -mfma4
28476 @opindex mfma4
28477 @need 200
28478 @itemx -mprefetchwt1
28479 @opindex mprefetchwt1
28480 @need 200
28481 @itemx -mxop
28482 @opindex mxop
28483 @need 200
28484 @itemx -mlwp
28485 @opindex mlwp
28486 @need 200
28487 @itemx -m3dnow
28488 @opindex m3dnow
28489 @need 200
28490 @itemx -m3dnowa
28491 @opindex m3dnowa
28492 @need 200
28493 @itemx -mpopcnt
28494 @opindex mpopcnt
28495 @need 200
28496 @itemx -mabm
28497 @opindex mabm
28498 @need 200
28499 @itemx -mbmi
28500 @opindex mbmi
28501 @need 200
28502 @itemx -mbmi2
28503 @need 200
28504 @itemx -mlzcnt
28505 @opindex mlzcnt
28506 @need 200
28507 @itemx -mfxsr
28508 @opindex mfxsr
28509 @need 200
28510 @itemx -mxsave
28511 @opindex mxsave
28512 @need 200
28513 @itemx -mxsaveopt
28514 @opindex mxsaveopt
28515 @need 200
28516 @itemx -mxsavec
28517 @opindex mxsavec
28518 @need 200
28519 @itemx -mxsaves
28520 @opindex mxsaves
28521 @need 200
28522 @itemx -mrtm
28523 @opindex mrtm
28524 @need 200
28525 @itemx -mtbm
28526 @opindex mtbm
28527 @need 200
28528 @itemx -mmwaitx
28529 @opindex mmwaitx
28530 @need 200
28531 @itemx -mclzero
28532 @opindex mclzero
28533 @need 200
28534 @itemx -mpku
28535 @opindex mpku
28536 @need 200
28537 @itemx -mavx512vbmi2
28538 @opindex mavx512vbmi2
28539 @need 200
28540 @itemx -mgfni
28541 @opindex mgfni
28542 @need 200
28543 @itemx -mvaes
28544 @opindex mvaes
28545 @need 200
28546 @itemx -mwaitpkg
28547 @opindex mwaitpkg
28548 @need 200
28549 @itemx -mvpclmulqdq
28550 @opindex mvpclmulqdq
28551 @need 200
28552 @itemx -mavx512bitalg
28553 @opindex mavx512bitalg
28554 @need 200
28555 @itemx -mmovdiri
28556 @opindex mmovdiri
28557 @need 200
28558 @itemx -mmovdir64b
28559 @opindex mmovdir64b
28560 @need 200
28561 @itemx -mavx512vpopcntdq
28562 @opindex mavx512vpopcntdq
28563 @need 200
28564 @itemx -mcldemote
28565 @opindex mcldemote
28566 These switches enable the use of instructions in the MMX, SSE,
28567 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
28568 SHA, AES, PCLMUL, FSGSBASE, PTWRITE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
28569 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES, WAITPKG,
28570 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
28571 GFNI, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
28572 AVX512VPOPCNTDQ, CLDEMOTE, 3DNow!@: or enhanced 3DNow!@: extended instruction
28573 sets. Each has a corresponding @option{-mno-} option to disable use of these
28574 instructions.
28575
28576 These extensions are also available as built-in functions: see
28577 @ref{x86 Built-in Functions}, for details of the functions enabled and
28578 disabled by these switches.
28579
28580 To generate SSE/SSE2 instructions automatically from floating-point
28581 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28582
28583 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28584 generates new AVX instructions or AVX equivalence for all SSEx instructions
28585 when needed.
28586
28587 These options enable GCC to use these extended instructions in
28588 generated code, even without @option{-mfpmath=sse}. Applications that
28589 perform run-time CPU detection must compile separate files for each
28590 supported architecture, using the appropriate flags. In particular,
28591 the file containing the CPU detection code should be compiled without
28592 these options.
28593
28594 @item -mdump-tune-features
28595 @opindex mdump-tune-features
28596 This option instructs GCC to dump the names of the x86 performance
28597 tuning features and default settings. The names can be used in
28598 @option{-mtune-ctrl=@var{feature-list}}.
28599
28600 @item -mtune-ctrl=@var{feature-list}
28601 @opindex mtune-ctrl=@var{feature-list}
28602 This option is used to do fine grain control of x86 code generation features.
28603 @var{feature-list} is a comma separated list of @var{feature} names. See also
28604 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28605 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28606 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28607 developers. Using it may lead to code paths not covered by testing and can
28608 potentially result in compiler ICEs or runtime errors.
28609
28610 @item -mno-default
28611 @opindex mno-default
28612 This option instructs GCC to turn off all tunable features. See also
28613 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28614
28615 @item -mcld
28616 @opindex mcld
28617 This option instructs GCC to emit a @code{cld} instruction in the prologue
28618 of functions that use string instructions. String instructions depend on
28619 the DF flag to select between autoincrement or autodecrement mode. While the
28620 ABI specifies the DF flag to be cleared on function entry, some operating
28621 systems violate this specification by not clearing the DF flag in their
28622 exception dispatchers. The exception handler can be invoked with the DF flag
28623 set, which leads to wrong direction mode when string instructions are used.
28624 This option can be enabled by default on 32-bit x86 targets by configuring
28625 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28626 instructions can be suppressed with the @option{-mno-cld} compiler option
28627 in this case.
28628
28629 @item -mvzeroupper
28630 @opindex mvzeroupper
28631 This option instructs GCC to emit a @code{vzeroupper} instruction
28632 before a transfer of control flow out of the function to minimize
28633 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28634 intrinsics.
28635
28636 @item -mprefer-avx128
28637 @opindex mprefer-avx128
28638 This option instructs GCC to use 128-bit AVX instructions instead of
28639 256-bit AVX instructions in the auto-vectorizer.
28640
28641 @item -mprefer-vector-width=@var{opt}
28642 @opindex mprefer-vector-width
28643 This option instructs GCC to use @var{opt}-bit vector width in instructions
28644 instead of default on the selected platform.
28645
28646 @table @samp
28647 @item none
28648 No extra limitations applied to GCC other than defined by the selected platform.
28649
28650 @item 128
28651 Prefer 128-bit vector width for instructions.
28652
28653 @item 256
28654 Prefer 256-bit vector width for instructions.
28655
28656 @item 512
28657 Prefer 512-bit vector width for instructions.
28658 @end table
28659
28660 @item -mcx16
28661 @opindex mcx16
28662 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28663 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28664 objects. This is useful for atomic updates of data structures exceeding one
28665 machine word in size. The compiler uses this instruction to implement
28666 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28667 128-bit integers, a library call is always used.
28668
28669 @item -msahf
28670 @opindex msahf
28671 This option enables generation of @code{SAHF} instructions in 64-bit code.
28672 Early Intel Pentium 4 CPUs with Intel 64 support,
28673 prior to the introduction of Pentium 4 G1 step in December 2005,
28674 lacked the @code{LAHF} and @code{SAHF} instructions
28675 which are supported by AMD64.
28676 These are load and store instructions, respectively, for certain status flags.
28677 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28678 @code{drem}, and @code{remainder} built-in functions;
28679 see @ref{Other Builtins} for details.
28680
28681 @item -mmovbe
28682 @opindex mmovbe
28683 This option enables use of the @code{movbe} instruction to implement
28684 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28685
28686 @item -mshstk
28687 @opindex mshstk
28688 The @option{-mshstk} option enables shadow stack built-in functions
28689 from x86 Control-flow Enforcement Technology (CET).
28690
28691 @item -mcrc32
28692 @opindex mcrc32
28693 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28694 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28695 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28696
28697 @item -mrecip
28698 @opindex mrecip
28699 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28700 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28701 with an additional Newton-Raphson step
28702 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28703 (and their vectorized
28704 variants) for single-precision floating-point arguments. These instructions
28705 are generated only when @option{-funsafe-math-optimizations} is enabled
28706 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28707 Note that while the throughput of the sequence is higher than the throughput
28708 of the non-reciprocal instruction, the precision of the sequence can be
28709 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28710
28711 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28712 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28713 combination), and doesn't need @option{-mrecip}.
28714
28715 Also note that GCC emits the above sequence with additional Newton-Raphson step
28716 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28717 already with @option{-ffast-math} (or the above option combination), and
28718 doesn't need @option{-mrecip}.
28719
28720 @item -mrecip=@var{opt}
28721 @opindex mrecip=opt
28722 This option controls which reciprocal estimate instructions
28723 may be used. @var{opt} is a comma-separated list of options, which may
28724 be preceded by a @samp{!} to invert the option:
28725
28726 @table @samp
28727 @item all
28728 Enable all estimate instructions.
28729
28730 @item default
28731 Enable the default instructions, equivalent to @option{-mrecip}.
28732
28733 @item none
28734 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28735
28736 @item div
28737 Enable the approximation for scalar division.
28738
28739 @item vec-div
28740 Enable the approximation for vectorized division.
28741
28742 @item sqrt
28743 Enable the approximation for scalar square root.
28744
28745 @item vec-sqrt
28746 Enable the approximation for vectorized square root.
28747 @end table
28748
28749 So, for example, @option{-mrecip=all,!sqrt} enables
28750 all of the reciprocal approximations, except for square root.
28751
28752 @item -mveclibabi=@var{type}
28753 @opindex mveclibabi
28754 Specifies the ABI type to use for vectorizing intrinsics using an
28755 external library. Supported values for @var{type} are @samp{svml}
28756 for the Intel short
28757 vector math library and @samp{acml} for the AMD math core library.
28758 To use this option, both @option{-ftree-vectorize} and
28759 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28760 ABI-compatible library must be specified at link time.
28761
28762 GCC currently emits calls to @code{vmldExp2},
28763 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28764 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28765 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28766 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28767 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28768 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28769 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28770 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28771 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28772 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28773 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28774 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28775 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28776 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28777 when @option{-mveclibabi=acml} is used.
28778
28779 @item -mabi=@var{name}
28780 @opindex mabi
28781 Generate code for the specified calling convention. Permissible values
28782 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28783 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28784 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28785 You can control this behavior for specific functions by
28786 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28787 @xref{Function Attributes}.
28788
28789 @item -mforce-indirect-call
28790 @opindex mforce-indirect-call
28791 Force all calls to functions to be indirect. This is useful
28792 when using Intel Processor Trace where it generates more precise timing
28793 information for function calls.
28794
28795 @item -mcall-ms2sysv-xlogues
28796 @opindex mcall-ms2sysv-xlogues
28797 @opindex mno-call-ms2sysv-xlogues
28798 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28799 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28800 default, the code for saving and restoring these registers is emitted inline,
28801 resulting in fairly lengthy prologues and epilogues. Using
28802 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28803 use stubs in the static portion of libgcc to perform these saves and restores,
28804 thus reducing function size at the cost of a few extra instructions.
28805
28806 @item -mtls-dialect=@var{type}
28807 @opindex mtls-dialect
28808 Generate code to access thread-local storage using the @samp{gnu} or
28809 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28810 @samp{gnu2} is more efficient, but it may add compile- and run-time
28811 requirements that cannot be satisfied on all systems.
28812
28813 @item -mpush-args
28814 @itemx -mno-push-args
28815 @opindex mpush-args
28816 @opindex mno-push-args
28817 Use PUSH operations to store outgoing parameters. This method is shorter
28818 and usually equally fast as method using SUB/MOV operations and is enabled
28819 by default. In some cases disabling it may improve performance because of
28820 improved scheduling and reduced dependencies.
28821
28822 @item -maccumulate-outgoing-args
28823 @opindex maccumulate-outgoing-args
28824 If enabled, the maximum amount of space required for outgoing arguments is
28825 computed in the function prologue. This is faster on most modern CPUs
28826 because of reduced dependencies, improved scheduling and reduced stack usage
28827 when the preferred stack boundary is not equal to 2. The drawback is a notable
28828 increase in code size. This switch implies @option{-mno-push-args}.
28829
28830 @item -mthreads
28831 @opindex mthreads
28832 Support thread-safe exception handling on MinGW. Programs that rely
28833 on thread-safe exception handling must compile and link all code with the
28834 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28835 @option{-D_MT}; when linking, it links in a special thread helper library
28836 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28837
28838 @item -mms-bitfields
28839 @itemx -mno-ms-bitfields
28840 @opindex mms-bitfields
28841 @opindex mno-ms-bitfields
28842
28843 Enable/disable bit-field layout compatible with the native Microsoft
28844 Windows compiler.
28845
28846 If @code{packed} is used on a structure, or if bit-fields are used,
28847 it may be that the Microsoft ABI lays out the structure differently
28848 than the way GCC normally does. Particularly when moving packed
28849 data between functions compiled with GCC and the native Microsoft compiler
28850 (either via function call or as data in a file), it may be necessary to access
28851 either format.
28852
28853 This option is enabled by default for Microsoft Windows
28854 targets. This behavior can also be controlled locally by use of variable
28855 or type attributes. For more information, see @ref{x86 Variable Attributes}
28856 and @ref{x86 Type Attributes}.
28857
28858 The Microsoft structure layout algorithm is fairly simple with the exception
28859 of the bit-field packing.
28860 The padding and alignment of members of structures and whether a bit-field
28861 can straddle a storage-unit boundary are determine by these rules:
28862
28863 @enumerate
28864 @item Structure members are stored sequentially in the order in which they are
28865 declared: the first member has the lowest memory address and the last member
28866 the highest.
28867
28868 @item Every data object has an alignment requirement. The alignment requirement
28869 for all data except structures, unions, and arrays is either the size of the
28870 object or the current packing size (specified with either the
28871 @code{aligned} attribute or the @code{pack} pragma),
28872 whichever is less. For structures, unions, and arrays,
28873 the alignment requirement is the largest alignment requirement of its members.
28874 Every object is allocated an offset so that:
28875
28876 @smallexample
28877 offset % alignment_requirement == 0
28878 @end smallexample
28879
28880 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28881 unit if the integral types are the same size and if the next bit-field fits
28882 into the current allocation unit without crossing the boundary imposed by the
28883 common alignment requirements of the bit-fields.
28884 @end enumerate
28885
28886 MSVC interprets zero-length bit-fields in the following ways:
28887
28888 @enumerate
28889 @item If a zero-length bit-field is inserted between two bit-fields that
28890 are normally coalesced, the bit-fields are not coalesced.
28891
28892 For example:
28893
28894 @smallexample
28895 struct
28896 @{
28897 unsigned long bf_1 : 12;
28898 unsigned long : 0;
28899 unsigned long bf_2 : 12;
28900 @} t1;
28901 @end smallexample
28902
28903 @noindent
28904 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28905 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28906
28907 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28908 alignment of the zero-length bit-field is greater than the member that follows it,
28909 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28910
28911 For example:
28912
28913 @smallexample
28914 struct
28915 @{
28916 char foo : 4;
28917 short : 0;
28918 char bar;
28919 @} t2;
28920
28921 struct
28922 @{
28923 char foo : 4;
28924 short : 0;
28925 double bar;
28926 @} t3;
28927 @end smallexample
28928
28929 @noindent
28930 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28931 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28932 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28933 of the structure.
28934
28935 Taking this into account, it is important to note the following:
28936
28937 @enumerate
28938 @item If a zero-length bit-field follows a normal bit-field, the type of the
28939 zero-length bit-field may affect the alignment of the structure as whole. For
28940 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28941 normal bit-field, and is of type short.
28942
28943 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28944 still affect the alignment of the structure:
28945
28946 @smallexample
28947 struct
28948 @{
28949 char foo : 6;
28950 long : 0;
28951 @} t4;
28952 @end smallexample
28953
28954 @noindent
28955 Here, @code{t4} takes up 4 bytes.
28956 @end enumerate
28957
28958 @item Zero-length bit-fields following non-bit-field members are ignored:
28959
28960 @smallexample
28961 struct
28962 @{
28963 char foo;
28964 long : 0;
28965 char bar;
28966 @} t5;
28967 @end smallexample
28968
28969 @noindent
28970 Here, @code{t5} takes up 2 bytes.
28971 @end enumerate
28972
28973
28974 @item -mno-align-stringops
28975 @opindex mno-align-stringops
28976 @opindex malign-stringops
28977 Do not align the destination of inlined string operations. This switch reduces
28978 code size and improves performance in case the destination is already aligned,
28979 but GCC doesn't know about it.
28980
28981 @item -minline-all-stringops
28982 @opindex minline-all-stringops
28983 By default GCC inlines string operations only when the destination is
28984 known to be aligned to least a 4-byte boundary.
28985 This enables more inlining and increases code
28986 size, but may improve performance of code that depends on fast
28987 @code{memcpy}, @code{strlen},
28988 and @code{memset} for short lengths.
28989
28990 @item -minline-stringops-dynamically
28991 @opindex minline-stringops-dynamically
28992 For string operations of unknown size, use run-time checks with
28993 inline code for small blocks and a library call for large blocks.
28994
28995 @item -mstringop-strategy=@var{alg}
28996 @opindex mstringop-strategy=@var{alg}
28997 Override the internal decision heuristic for the particular algorithm to use
28998 for inlining string operations. The allowed values for @var{alg} are:
28999
29000 @table @samp
29001 @item rep_byte
29002 @itemx rep_4byte
29003 @itemx rep_8byte
29004 Expand using i386 @code{rep} prefix of the specified size.
29005
29006 @item byte_loop
29007 @itemx loop
29008 @itemx unrolled_loop
29009 Expand into an inline loop.
29010
29011 @item libcall
29012 Always use a library call.
29013 @end table
29014
29015 @item -mmemcpy-strategy=@var{strategy}
29016 @opindex mmemcpy-strategy=@var{strategy}
29017 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
29018 should be inlined and what inline algorithm to use when the expected size
29019 of the copy operation is known. @var{strategy}
29020 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
29021 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
29022 the max byte size with which inline algorithm @var{alg} is allowed. For the last
29023 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
29024 in the list must be specified in increasing order. The minimal byte size for
29025 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
29026 preceding range.
29027
29028 @item -mmemset-strategy=@var{strategy}
29029 @opindex mmemset-strategy=@var{strategy}
29030 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
29031 @code{__builtin_memset} expansion.
29032
29033 @item -momit-leaf-frame-pointer
29034 @opindex momit-leaf-frame-pointer
29035 Don't keep the frame pointer in a register for leaf functions. This
29036 avoids the instructions to save, set up, and restore frame pointers and
29037 makes an extra register available in leaf functions. The option
29038 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
29039 which might make debugging harder.
29040
29041 @item -mtls-direct-seg-refs
29042 @itemx -mno-tls-direct-seg-refs
29043 @opindex mtls-direct-seg-refs
29044 Controls whether TLS variables may be accessed with offsets from the
29045 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
29046 or whether the thread base pointer must be added. Whether or not this
29047 is valid depends on the operating system, and whether it maps the
29048 segment to cover the entire TLS area.
29049
29050 For systems that use the GNU C Library, the default is on.
29051
29052 @item -msse2avx
29053 @itemx -mno-sse2avx
29054 @opindex msse2avx
29055 Specify that the assembler should encode SSE instructions with VEX
29056 prefix. The option @option{-mavx} turns this on by default.
29057
29058 @item -mfentry
29059 @itemx -mno-fentry
29060 @opindex mfentry
29061 If profiling is active (@option{-pg}), put the profiling
29062 counter call before the prologue.
29063 Note: On x86 architectures the attribute @code{ms_hook_prologue}
29064 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
29065
29066 @item -mrecord-mcount
29067 @itemx -mno-record-mcount
29068 @opindex mrecord-mcount
29069 If profiling is active (@option{-pg}), generate a __mcount_loc section
29070 that contains pointers to each profiling call. This is useful for
29071 automatically patching and out calls.
29072
29073 @item -mnop-mcount
29074 @itemx -mno-nop-mcount
29075 @opindex mnop-mcount
29076 If profiling is active (@option{-pg}), generate the calls to
29077 the profiling functions as NOPs. This is useful when they
29078 should be patched in later dynamically. This is likely only
29079 useful together with @option{-mrecord-mcount}.
29080
29081 @item -minstrument-return=@var{type}
29082 @opindex minstrument-return
29083 Instrument function exit in -pg -mfentry instrumented functions with
29084 call to specified function. This only instruments true returns ending
29085 with ret, but not sibling calls ending with jump. Valid types
29086 are @var{none} to not instrument, @var{call} to generate a call to __return__,
29087 or @var{nop5} to generate a 5 byte nop.
29088
29089 @item -mrecord-return
29090 @itemx -mno-record-return
29091 @opindex mrecord-return
29092 Generate a __return_loc section pointing to all return instrumentation code.
29093
29094 @item -mfentry-name=@var{name}
29095 @opindex mfentry-name
29096 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
29097
29098 @item -mskip-rax-setup
29099 @itemx -mno-skip-rax-setup
29100 @opindex mskip-rax-setup
29101 When generating code for the x86-64 architecture with SSE extensions
29102 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
29103 register when there are no variable arguments passed in vector registers.
29104
29105 @strong{Warning:} Since RAX register is used to avoid unnecessarily
29106 saving vector registers on stack when passing variable arguments, the
29107 impacts of this option are callees may waste some stack space,
29108 misbehave or jump to a random location. GCC 4.4 or newer don't have
29109 those issues, regardless the RAX register value.
29110
29111 @item -m8bit-idiv
29112 @itemx -mno-8bit-idiv
29113 @opindex m8bit-idiv
29114 On some processors, like Intel Atom, 8-bit unsigned integer divide is
29115 much faster than 32-bit/64-bit integer divide. This option generates a
29116 run-time check. If both dividend and divisor are within range of 0
29117 to 255, 8-bit unsigned integer divide is used instead of
29118 32-bit/64-bit integer divide.
29119
29120 @item -mavx256-split-unaligned-load
29121 @itemx -mavx256-split-unaligned-store
29122 @opindex mavx256-split-unaligned-load
29123 @opindex mavx256-split-unaligned-store
29124 Split 32-byte AVX unaligned load and store.
29125
29126 @item -mstack-protector-guard=@var{guard}
29127 @itemx -mstack-protector-guard-reg=@var{reg}
29128 @itemx -mstack-protector-guard-offset=@var{offset}
29129 @opindex mstack-protector-guard
29130 @opindex mstack-protector-guard-reg
29131 @opindex mstack-protector-guard-offset
29132 Generate stack protection code using canary at @var{guard}. Supported
29133 locations are @samp{global} for global canary or @samp{tls} for per-thread
29134 canary in the TLS block (the default). This option has effect only when
29135 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
29136
29137 With the latter choice the options
29138 @option{-mstack-protector-guard-reg=@var{reg}} and
29139 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29140 which segment register (@code{%fs} or @code{%gs}) to use as base register
29141 for reading the canary, and from what offset from that base register.
29142 The default for those is as specified in the relevant ABI.
29143
29144 @item -mgeneral-regs-only
29145 @opindex mgeneral-regs-only
29146 Generate code that uses only the general-purpose registers. This
29147 prevents the compiler from using floating-point, vector, mask and bound
29148 registers.
29149
29150 @item -mindirect-branch=@var{choice}
29151 @opindex mindirect-branch
29152 Convert indirect call and jump with @var{choice}. The default is
29153 @samp{keep}, which keeps indirect call and jump unmodified.
29154 @samp{thunk} converts indirect call and jump to call and return thunk.
29155 @samp{thunk-inline} converts indirect call and jump to inlined call
29156 and return thunk. @samp{thunk-extern} converts indirect call and jump
29157 to external call and return thunk provided in a separate object file.
29158 You can control this behavior for a specific function by using the
29159 function attribute @code{indirect_branch}. @xref{Function Attributes}.
29160
29161 Note that @option{-mcmodel=large} is incompatible with
29162 @option{-mindirect-branch=thunk} and
29163 @option{-mindirect-branch=thunk-extern} since the thunk function may
29164 not be reachable in the large code model.
29165
29166 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
29167 @option{-fcf-protection=branch} since the external thunk can not be modified
29168 to disable control-flow check.
29169
29170 @item -mfunction-return=@var{choice}
29171 @opindex mfunction-return
29172 Convert function return with @var{choice}. The default is @samp{keep},
29173 which keeps function return unmodified. @samp{thunk} converts function
29174 return to call and return thunk. @samp{thunk-inline} converts function
29175 return to inlined call and return thunk. @samp{thunk-extern} converts
29176 function return to external call and return thunk provided in a separate
29177 object file. You can control this behavior for a specific function by
29178 using the function attribute @code{function_return}.
29179 @xref{Function Attributes}.
29180
29181 Note that @option{-mcmodel=large} is incompatible with
29182 @option{-mfunction-return=thunk} and
29183 @option{-mfunction-return=thunk-extern} since the thunk function may
29184 not be reachable in the large code model.
29185
29186
29187 @item -mindirect-branch-register
29188 @opindex mindirect-branch-register
29189 Force indirect call and jump via register.
29190
29191 @end table
29192
29193 These @samp{-m} switches are supported in addition to the above
29194 on x86-64 processors in 64-bit environments.
29195
29196 @table @gcctabopt
29197 @item -m32
29198 @itemx -m64
29199 @itemx -mx32
29200 @itemx -m16
29201 @itemx -miamcu
29202 @opindex m32
29203 @opindex m64
29204 @opindex mx32
29205 @opindex m16
29206 @opindex miamcu
29207 Generate code for a 16-bit, 32-bit or 64-bit environment.
29208 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
29209 to 32 bits, and
29210 generates code that runs on any i386 system.
29211
29212 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
29213 types to 64 bits, and generates code for the x86-64 architecture.
29214 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
29215 and @option{-mdynamic-no-pic} options.
29216
29217 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
29218 to 32 bits, and
29219 generates code for the x86-64 architecture.
29220
29221 The @option{-m16} option is the same as @option{-m32}, except for that
29222 it outputs the @code{.code16gcc} assembly directive at the beginning of
29223 the assembly output so that the binary can run in 16-bit mode.
29224
29225 The @option{-miamcu} option generates code which conforms to Intel MCU
29226 psABI. It requires the @option{-m32} option to be turned on.
29227
29228 @item -mno-red-zone
29229 @opindex mno-red-zone
29230 @opindex mred-zone
29231 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
29232 by the x86-64 ABI; it is a 128-byte area beyond the location of the
29233 stack pointer that is not modified by signal or interrupt handlers
29234 and therefore can be used for temporary data without adjusting the stack
29235 pointer. The flag @option{-mno-red-zone} disables this red zone.
29236
29237 @item -mcmodel=small
29238 @opindex mcmodel=small
29239 Generate code for the small code model: the program and its symbols must
29240 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
29241 Programs can be statically or dynamically linked. This is the default
29242 code model.
29243
29244 @item -mcmodel=kernel
29245 @opindex mcmodel=kernel
29246 Generate code for the kernel code model. The kernel runs in the
29247 negative 2 GB of the address space.
29248 This model has to be used for Linux kernel code.
29249
29250 @item -mcmodel=medium
29251 @opindex mcmodel=medium
29252 Generate code for the medium model: the program is linked in the lower 2
29253 GB of the address space. Small symbols are also placed there. Symbols
29254 with sizes larger than @option{-mlarge-data-threshold} are put into
29255 large data or BSS sections and can be located above 2GB. Programs can
29256 be statically or dynamically linked.
29257
29258 @item -mcmodel=large
29259 @opindex mcmodel=large
29260 Generate code for the large model. This model makes no assumptions
29261 about addresses and sizes of sections.
29262
29263 @item -maddress-mode=long
29264 @opindex maddress-mode=long
29265 Generate code for long address mode. This is only supported for 64-bit
29266 and x32 environments. It is the default address mode for 64-bit
29267 environments.
29268
29269 @item -maddress-mode=short
29270 @opindex maddress-mode=short
29271 Generate code for short address mode. This is only supported for 32-bit
29272 and x32 environments. It is the default address mode for 32-bit and
29273 x32 environments.
29274 @end table
29275
29276 @node x86 Windows Options
29277 @subsection x86 Windows Options
29278 @cindex x86 Windows Options
29279 @cindex Windows Options for x86
29280
29281 These additional options are available for Microsoft Windows targets:
29282
29283 @table @gcctabopt
29284 @item -mconsole
29285 @opindex mconsole
29286 This option
29287 specifies that a console application is to be generated, by
29288 instructing the linker to set the PE header subsystem type
29289 required for console applications.
29290 This option is available for Cygwin and MinGW targets and is
29291 enabled by default on those targets.
29292
29293 @item -mdll
29294 @opindex mdll
29295 This option is available for Cygwin and MinGW targets. It
29296 specifies that a DLL---a dynamic link library---is to be
29297 generated, enabling the selection of the required runtime
29298 startup object and entry point.
29299
29300 @item -mnop-fun-dllimport
29301 @opindex mnop-fun-dllimport
29302 This option is available for Cygwin and MinGW targets. It
29303 specifies that the @code{dllimport} attribute should be ignored.
29304
29305 @item -mthread
29306 @opindex mthread
29307 This option is available for MinGW targets. It specifies
29308 that MinGW-specific thread support is to be used.
29309
29310 @item -municode
29311 @opindex municode
29312 This option is available for MinGW-w64 targets. It causes
29313 the @code{UNICODE} preprocessor macro to be predefined, and
29314 chooses Unicode-capable runtime startup code.
29315
29316 @item -mwin32
29317 @opindex mwin32
29318 This option is available for Cygwin and MinGW targets. It
29319 specifies that the typical Microsoft Windows predefined macros are to
29320 be set in the pre-processor, but does not influence the choice
29321 of runtime library/startup code.
29322
29323 @item -mwindows
29324 @opindex mwindows
29325 This option is available for Cygwin and MinGW targets. It
29326 specifies that a GUI application is to be generated by
29327 instructing the linker to set the PE header subsystem type
29328 appropriately.
29329
29330 @item -fno-set-stack-executable
29331 @opindex fno-set-stack-executable
29332 @opindex fset-stack-executable
29333 This option is available for MinGW targets. It specifies that
29334 the executable flag for the stack used by nested functions isn't
29335 set. This is necessary for binaries running in kernel mode of
29336 Microsoft Windows, as there the User32 API, which is used to set executable
29337 privileges, isn't available.
29338
29339 @item -fwritable-relocated-rdata
29340 @opindex fno-writable-relocated-rdata
29341 @opindex fwritable-relocated-rdata
29342 This option is available for MinGW and Cygwin targets. It specifies
29343 that relocated-data in read-only section is put into the @code{.data}
29344 section. This is a necessary for older runtimes not supporting
29345 modification of @code{.rdata} sections for pseudo-relocation.
29346
29347 @item -mpe-aligned-commons
29348 @opindex mpe-aligned-commons
29349 This option is available for Cygwin and MinGW targets. It
29350 specifies that the GNU extension to the PE file format that
29351 permits the correct alignment of COMMON variables should be
29352 used when generating code. It is enabled by default if
29353 GCC detects that the target assembler found during configuration
29354 supports the feature.
29355 @end table
29356
29357 See also under @ref{x86 Options} for standard options.
29358
29359 @node Xstormy16 Options
29360 @subsection Xstormy16 Options
29361 @cindex Xstormy16 Options
29362
29363 These options are defined for Xstormy16:
29364
29365 @table @gcctabopt
29366 @item -msim
29367 @opindex msim
29368 Choose startup files and linker script suitable for the simulator.
29369 @end table
29370
29371 @node Xtensa Options
29372 @subsection Xtensa Options
29373 @cindex Xtensa Options
29374
29375 These options are supported for Xtensa targets:
29376
29377 @table @gcctabopt
29378 @item -mconst16
29379 @itemx -mno-const16
29380 @opindex mconst16
29381 @opindex mno-const16
29382 Enable or disable use of @code{CONST16} instructions for loading
29383 constant values. The @code{CONST16} instruction is currently not a
29384 standard option from Tensilica. When enabled, @code{CONST16}
29385 instructions are always used in place of the standard @code{L32R}
29386 instructions. The use of @code{CONST16} is enabled by default only if
29387 the @code{L32R} instruction is not available.
29388
29389 @item -mfused-madd
29390 @itemx -mno-fused-madd
29391 @opindex mfused-madd
29392 @opindex mno-fused-madd
29393 Enable or disable use of fused multiply/add and multiply/subtract
29394 instructions in the floating-point option. This has no effect if the
29395 floating-point option is not also enabled. Disabling fused multiply/add
29396 and multiply/subtract instructions forces the compiler to use separate
29397 instructions for the multiply and add/subtract operations. This may be
29398 desirable in some cases where strict IEEE 754-compliant results are
29399 required: the fused multiply add/subtract instructions do not round the
29400 intermediate result, thereby producing results with @emph{more} bits of
29401 precision than specified by the IEEE standard. Disabling fused multiply
29402 add/subtract instructions also ensures that the program output is not
29403 sensitive to the compiler's ability to combine multiply and add/subtract
29404 operations.
29405
29406 @item -mserialize-volatile
29407 @itemx -mno-serialize-volatile
29408 @opindex mserialize-volatile
29409 @opindex mno-serialize-volatile
29410 When this option is enabled, GCC inserts @code{MEMW} instructions before
29411 @code{volatile} memory references to guarantee sequential consistency.
29412 The default is @option{-mserialize-volatile}. Use
29413 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29414
29415 @item -mforce-no-pic
29416 @opindex mforce-no-pic
29417 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29418 position-independent code (PIC), this option disables PIC for compiling
29419 kernel code.
29420
29421 @item -mtext-section-literals
29422 @itemx -mno-text-section-literals
29423 @opindex mtext-section-literals
29424 @opindex mno-text-section-literals
29425 These options control the treatment of literal pools. The default is
29426 @option{-mno-text-section-literals}, which places literals in a separate
29427 section in the output file. This allows the literal pool to be placed
29428 in a data RAM/ROM, and it also allows the linker to combine literal
29429 pools from separate object files to remove redundant literals and
29430 improve code size. With @option{-mtext-section-literals}, the literals
29431 are interspersed in the text section in order to keep them as close as
29432 possible to their references. This may be necessary for large assembly
29433 files. Literals for each function are placed right before that function.
29434
29435 @item -mauto-litpools
29436 @itemx -mno-auto-litpools
29437 @opindex mauto-litpools
29438 @opindex mno-auto-litpools
29439 These options control the treatment of literal pools. The default is
29440 @option{-mno-auto-litpools}, which places literals in a separate
29441 section in the output file unless @option{-mtext-section-literals} is
29442 used. With @option{-mauto-litpools} the literals are interspersed in
29443 the text section by the assembler. Compiler does not produce explicit
29444 @code{.literal} directives and loads literals into registers with
29445 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29446 do relaxation and place literals as necessary. This option allows
29447 assembler to create several literal pools per function and assemble
29448 very big functions, which may not be possible with
29449 @option{-mtext-section-literals}.
29450
29451 @item -mtarget-align
29452 @itemx -mno-target-align
29453 @opindex mtarget-align
29454 @opindex mno-target-align
29455 When this option is enabled, GCC instructs the assembler to
29456 automatically align instructions to reduce branch penalties at the
29457 expense of some code density. The assembler attempts to widen density
29458 instructions to align branch targets and the instructions following call
29459 instructions. If there are not enough preceding safe density
29460 instructions to align a target, no widening is performed. The
29461 default is @option{-mtarget-align}. These options do not affect the
29462 treatment of auto-aligned instructions like @code{LOOP}, which the
29463 assembler always aligns, either by widening density instructions or
29464 by inserting NOP instructions.
29465
29466 @item -mlongcalls
29467 @itemx -mno-longcalls
29468 @opindex mlongcalls
29469 @opindex mno-longcalls
29470 When this option is enabled, GCC instructs the assembler to translate
29471 direct calls to indirect calls unless it can determine that the target
29472 of a direct call is in the range allowed by the call instruction. This
29473 translation typically occurs for calls to functions in other source
29474 files. Specifically, the assembler translates a direct @code{CALL}
29475 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29476 The default is @option{-mno-longcalls}. This option should be used in
29477 programs where the call target can potentially be out of range. This
29478 option is implemented in the assembler, not the compiler, so the
29479 assembly code generated by GCC still shows direct call
29480 instructions---look at the disassembled object code to see the actual
29481 instructions. Note that the assembler uses an indirect call for
29482 every cross-file call, not just those that really are out of range.
29483 @end table
29484
29485 @node zSeries Options
29486 @subsection zSeries Options
29487 @cindex zSeries options
29488
29489 These are listed under @xref{S/390 and zSeries Options}.
29490
29491
29492 @c man end
29493
29494 @node Spec Files
29495 @section Specifying Subprocesses and the Switches to Pass to Them
29496 @cindex Spec Files
29497
29498 @command{gcc} is a driver program. It performs its job by invoking a
29499 sequence of other programs to do the work of compiling, assembling and
29500 linking. GCC interprets its command-line parameters and uses these to
29501 deduce which programs it should invoke, and which command-line options
29502 it ought to place on their command lines. This behavior is controlled
29503 by @dfn{spec strings}. In most cases there is one spec string for each
29504 program that GCC can invoke, but a few programs have multiple spec
29505 strings to control their behavior. The spec strings built into GCC can
29506 be overridden by using the @option{-specs=} command-line switch to specify
29507 a spec file.
29508
29509 @dfn{Spec files} are plain-text files that are used to construct spec
29510 strings. They consist of a sequence of directives separated by blank
29511 lines. The type of directive is determined by the first non-whitespace
29512 character on the line, which can be one of the following:
29513
29514 @table @code
29515 @item %@var{command}
29516 Issues a @var{command} to the spec file processor. The commands that can
29517 appear here are:
29518
29519 @table @code
29520 @item %include <@var{file}>
29521 @cindex @code{%include}
29522 Search for @var{file} and insert its text at the current point in the
29523 specs file.
29524
29525 @item %include_noerr <@var{file}>
29526 @cindex @code{%include_noerr}
29527 Just like @samp{%include}, but do not generate an error message if the include
29528 file cannot be found.
29529
29530 @item %rename @var{old_name} @var{new_name}
29531 @cindex @code{%rename}
29532 Rename the spec string @var{old_name} to @var{new_name}.
29533
29534 @end table
29535
29536 @item *[@var{spec_name}]:
29537 This tells the compiler to create, override or delete the named spec
29538 string. All lines after this directive up to the next directive or
29539 blank line are considered to be the text for the spec string. If this
29540 results in an empty string then the spec is deleted. (Or, if the
29541 spec did not exist, then nothing happens.) Otherwise, if the spec
29542 does not currently exist a new spec is created. If the spec does
29543 exist then its contents are overridden by the text of this
29544 directive, unless the first character of that text is the @samp{+}
29545 character, in which case the text is appended to the spec.
29546
29547 @item [@var{suffix}]:
29548 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29549 and up to the next directive or blank line are considered to make up the
29550 spec string for the indicated suffix. When the compiler encounters an
29551 input file with the named suffix, it processes the spec string in
29552 order to work out how to compile that file. For example:
29553
29554 @smallexample
29555 .ZZ:
29556 z-compile -input %i
29557 @end smallexample
29558
29559 This says that any input file whose name ends in @samp{.ZZ} should be
29560 passed to the program @samp{z-compile}, which should be invoked with the
29561 command-line switch @option{-input} and with the result of performing the
29562 @samp{%i} substitution. (See below.)
29563
29564 As an alternative to providing a spec string, the text following a
29565 suffix directive can be one of the following:
29566
29567 @table @code
29568 @item @@@var{language}
29569 This says that the suffix is an alias for a known @var{language}. This is
29570 similar to using the @option{-x} command-line switch to GCC to specify a
29571 language explicitly. For example:
29572
29573 @smallexample
29574 .ZZ:
29575 @@c++
29576 @end smallexample
29577
29578 Says that .ZZ files are, in fact, C++ source files.
29579
29580 @item #@var{name}
29581 This causes an error messages saying:
29582
29583 @smallexample
29584 @var{name} compiler not installed on this system.
29585 @end smallexample
29586 @end table
29587
29588 GCC already has an extensive list of suffixes built into it.
29589 This directive adds an entry to the end of the list of suffixes, but
29590 since the list is searched from the end backwards, it is effectively
29591 possible to override earlier entries using this technique.
29592
29593 @end table
29594
29595 GCC has the following spec strings built into it. Spec files can
29596 override these strings or create their own. Note that individual
29597 targets can also add their own spec strings to this list.
29598
29599 @smallexample
29600 asm Options to pass to the assembler
29601 asm_final Options to pass to the assembler post-processor
29602 cpp Options to pass to the C preprocessor
29603 cc1 Options to pass to the C compiler
29604 cc1plus Options to pass to the C++ compiler
29605 endfile Object files to include at the end of the link
29606 link Options to pass to the linker
29607 lib Libraries to include on the command line to the linker
29608 libgcc Decides which GCC support library to pass to the linker
29609 linker Sets the name of the linker
29610 predefines Defines to be passed to the C preprocessor
29611 signed_char Defines to pass to CPP to say whether @code{char} is signed
29612 by default
29613 startfile Object files to include at the start of the link
29614 @end smallexample
29615
29616 Here is a small example of a spec file:
29617
29618 @smallexample
29619 %rename lib old_lib
29620
29621 *lib:
29622 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29623 @end smallexample
29624
29625 This example renames the spec called @samp{lib} to @samp{old_lib} and
29626 then overrides the previous definition of @samp{lib} with a new one.
29627 The new definition adds in some extra command-line options before
29628 including the text of the old definition.
29629
29630 @dfn{Spec strings} are a list of command-line options to be passed to their
29631 corresponding program. In addition, the spec strings can contain
29632 @samp{%}-prefixed sequences to substitute variable text or to
29633 conditionally insert text into the command line. Using these constructs
29634 it is possible to generate quite complex command lines.
29635
29636 Here is a table of all defined @samp{%}-sequences for spec
29637 strings. Note that spaces are not generated automatically around the
29638 results of expanding these sequences. Therefore you can concatenate them
29639 together or combine them with constant text in a single argument.
29640
29641 @table @code
29642 @item %%
29643 Substitute one @samp{%} into the program name or argument.
29644
29645 @item %i
29646 Substitute the name of the input file being processed.
29647
29648 @item %b
29649 Substitute the basename of the input file being processed.
29650 This is the substring up to (and not including) the last period
29651 and not including the directory.
29652
29653 @item %B
29654 This is the same as @samp{%b}, but include the file suffix (text after
29655 the last period).
29656
29657 @item %d
29658 Marks the argument containing or following the @samp{%d} as a
29659 temporary file name, so that that file is deleted if GCC exits
29660 successfully. Unlike @samp{%g}, this contributes no text to the
29661 argument.
29662
29663 @item %g@var{suffix}
29664 Substitute a file name that has suffix @var{suffix} and is chosen
29665 once per compilation, and mark the argument in the same way as
29666 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29667 name is now chosen in a way that is hard to predict even when previously
29668 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29669 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29670 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29671 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29672 was simply substituted with a file name chosen once per compilation,
29673 without regard to any appended suffix (which was therefore treated
29674 just like ordinary text), making such attacks more likely to succeed.
29675
29676 @item %u@var{suffix}
29677 Like @samp{%g}, but generates a new temporary file name
29678 each time it appears instead of once per compilation.
29679
29680 @item %U@var{suffix}
29681 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29682 new one if there is no such last file name. In the absence of any
29683 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29684 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29685 involves the generation of two distinct file names, one
29686 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29687 simply substituted with a file name chosen for the previous @samp{%u},
29688 without regard to any appended suffix.
29689
29690 @item %j@var{suffix}
29691 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29692 writable, and if @option{-save-temps} is not used;
29693 otherwise, substitute the name
29694 of a temporary file, just like @samp{%u}. This temporary file is not
29695 meant for communication between processes, but rather as a junk
29696 disposal mechanism.
29697
29698 @item %|@var{suffix}
29699 @itemx %m@var{suffix}
29700 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29701 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29702 all. These are the two most common ways to instruct a program that it
29703 should read from standard input or write to standard output. If you
29704 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29705 construct: see for example @file{f/lang-specs.h}.
29706
29707 @item %.@var{SUFFIX}
29708 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29709 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29710 terminated by the next space or %.
29711
29712 @item %w
29713 Marks the argument containing or following the @samp{%w} as the
29714 designated output file of this compilation. This puts the argument
29715 into the sequence of arguments that @samp{%o} substitutes.
29716
29717 @item %o
29718 Substitutes the names of all the output files, with spaces
29719 automatically placed around them. You should write spaces
29720 around the @samp{%o} as well or the results are undefined.
29721 @samp{%o} is for use in the specs for running the linker.
29722 Input files whose names have no recognized suffix are not compiled
29723 at all, but they are included among the output files, so they are
29724 linked.
29725
29726 @item %O
29727 Substitutes the suffix for object files. Note that this is
29728 handled specially when it immediately follows @samp{%g, %u, or %U},
29729 because of the need for those to form complete file names. The
29730 handling is such that @samp{%O} is treated exactly as if it had already
29731 been substituted, except that @samp{%g, %u, and %U} do not currently
29732 support additional @var{suffix} characters following @samp{%O} as they do
29733 following, for example, @samp{.o}.
29734
29735 @item %p
29736 Substitutes the standard macro predefinitions for the
29737 current target machine. Use this when running @command{cpp}.
29738
29739 @item %P
29740 Like @samp{%p}, but puts @samp{__} before and after the name of each
29741 predefined macro, except for macros that start with @samp{__} or with
29742 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29743 C@.
29744
29745 @item %I
29746 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29747 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29748 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29749 and @option{-imultilib} as necessary.
29750
29751 @item %s
29752 Current argument is the name of a library or startup file of some sort.
29753 Search for that file in a standard list of directories and substitute
29754 the full name found. The current working directory is included in the
29755 list of directories scanned.
29756
29757 @item %T
29758 Current argument is the name of a linker script. Search for that file
29759 in the current list of directories to scan for libraries. If the file
29760 is located insert a @option{--script} option into the command line
29761 followed by the full path name found. If the file is not found then
29762 generate an error message. Note: the current working directory is not
29763 searched.
29764
29765 @item %e@var{str}
29766 Print @var{str} as an error message. @var{str} is terminated by a newline.
29767 Use this when inconsistent options are detected.
29768
29769 @item %(@var{name})
29770 Substitute the contents of spec string @var{name} at this point.
29771
29772 @item %x@{@var{option}@}
29773 Accumulate an option for @samp{%X}.
29774
29775 @item %X
29776 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29777 spec string.
29778
29779 @item %Y
29780 Output the accumulated assembler options specified by @option{-Wa}.
29781
29782 @item %Z
29783 Output the accumulated preprocessor options specified by @option{-Wp}.
29784
29785 @item %a
29786 Process the @code{asm} spec. This is used to compute the
29787 switches to be passed to the assembler.
29788
29789 @item %A
29790 Process the @code{asm_final} spec. This is a spec string for
29791 passing switches to an assembler post-processor, if such a program is
29792 needed.
29793
29794 @item %l
29795 Process the @code{link} spec. This is the spec for computing the
29796 command line passed to the linker. Typically it makes use of the
29797 @samp{%L %G %S %D and %E} sequences.
29798
29799 @item %D
29800 Dump out a @option{-L} option for each directory that GCC believes might
29801 contain startup files. If the target supports multilibs then the
29802 current multilib directory is prepended to each of these paths.
29803
29804 @item %L
29805 Process the @code{lib} spec. This is a spec string for deciding which
29806 libraries are included on the command line to the linker.
29807
29808 @item %G
29809 Process the @code{libgcc} spec. This is a spec string for deciding
29810 which GCC support library is included on the command line to the linker.
29811
29812 @item %S
29813 Process the @code{startfile} spec. This is a spec for deciding which
29814 object files are the first ones passed to the linker. Typically
29815 this might be a file named @file{crt0.o}.
29816
29817 @item %E
29818 Process the @code{endfile} spec. This is a spec string that specifies
29819 the last object files that are passed to the linker.
29820
29821 @item %C
29822 Process the @code{cpp} spec. This is used to construct the arguments
29823 to be passed to the C preprocessor.
29824
29825 @item %1
29826 Process the @code{cc1} spec. This is used to construct the options to be
29827 passed to the actual C compiler (@command{cc1}).
29828
29829 @item %2
29830 Process the @code{cc1plus} spec. This is used to construct the options to be
29831 passed to the actual C++ compiler (@command{cc1plus}).
29832
29833 @item %*
29834 Substitute the variable part of a matched option. See below.
29835 Note that each comma in the substituted string is replaced by
29836 a single space.
29837
29838 @item %<S
29839 Remove all occurrences of @code{-S} from the command line. Note---this
29840 command is position dependent. @samp{%} commands in the spec string
29841 before this one see @code{-S}, @samp{%} commands in the spec string
29842 after this one do not.
29843
29844 @item %:@var{function}(@var{args})
29845 Call the named function @var{function}, passing it @var{args}.
29846 @var{args} is first processed as a nested spec string, then split
29847 into an argument vector in the usual fashion. The function returns
29848 a string which is processed as if it had appeared literally as part
29849 of the current spec.
29850
29851 The following built-in spec functions are provided:
29852
29853 @table @code
29854 @item @code{getenv}
29855 The @code{getenv} spec function takes two arguments: an environment
29856 variable name and a string. If the environment variable is not
29857 defined, a fatal error is issued. Otherwise, the return value is the
29858 value of the environment variable concatenated with the string. For
29859 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29860
29861 @smallexample
29862 %:getenv(TOPDIR /include)
29863 @end smallexample
29864
29865 expands to @file{/path/to/top/include}.
29866
29867 @item @code{if-exists}
29868 The @code{if-exists} spec function takes one argument, an absolute
29869 pathname to a file. If the file exists, @code{if-exists} returns the
29870 pathname. Here is a small example of its usage:
29871
29872 @smallexample
29873 *startfile:
29874 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29875 @end smallexample
29876
29877 @item @code{if-exists-else}
29878 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29879 spec function, except that it takes two arguments. The first argument is
29880 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29881 returns the pathname. If it does not exist, it returns the second argument.
29882 This way, @code{if-exists-else} can be used to select one file or another,
29883 based on the existence of the first. Here is a small example of its usage:
29884
29885 @smallexample
29886 *startfile:
29887 crt0%O%s %:if-exists(crti%O%s) \
29888 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29889 @end smallexample
29890
29891 @item @code{replace-outfile}
29892 The @code{replace-outfile} spec function takes two arguments. It looks for the
29893 first argument in the outfiles array and replaces it with the second argument. Here
29894 is a small example of its usage:
29895
29896 @smallexample
29897 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29898 @end smallexample
29899
29900 @item @code{remove-outfile}
29901 The @code{remove-outfile} spec function takes one argument. It looks for the
29902 first argument in the outfiles array and removes it. Here is a small example
29903 its usage:
29904
29905 @smallexample
29906 %:remove-outfile(-lm)
29907 @end smallexample
29908
29909 @item @code{pass-through-libs}
29910 The @code{pass-through-libs} spec function takes any number of arguments. It
29911 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29912 assumes are the names of linker input library archive files) and returns a
29913 result containing all the found arguments each prepended by
29914 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29915 intended to be passed to the LTO linker plugin.
29916
29917 @smallexample
29918 %:pass-through-libs(%G %L %G)
29919 @end smallexample
29920
29921 @item @code{print-asm-header}
29922 The @code{print-asm-header} function takes no arguments and simply
29923 prints a banner like:
29924
29925 @smallexample
29926 Assembler options
29927 =================
29928
29929 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29930 @end smallexample
29931
29932 It is used to separate compiler options from assembler options
29933 in the @option{--target-help} output.
29934 @end table
29935
29936 @item %@{S@}
29937 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29938 If that switch is not specified, this substitutes nothing. Note that
29939 the leading dash is omitted when specifying this option, and it is
29940 automatically inserted if the substitution is performed. Thus the spec
29941 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29942 and outputs the command-line option @option{-foo}.
29943
29944 @item %W@{S@}
29945 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29946 deleted on failure.
29947
29948 @item %@{S*@}
29949 Substitutes all the switches specified to GCC whose names start
29950 with @code{-S}, but which also take an argument. This is used for
29951 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29952 GCC considers @option{-o foo} as being
29953 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29954 text, including the space. Thus two arguments are generated.
29955
29956 @item %@{S*&T*@}
29957 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29958 (the order of @code{S} and @code{T} in the spec is not significant).
29959 There can be any number of ampersand-separated variables; for each the
29960 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29961
29962 @item %@{S:X@}
29963 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29964
29965 @item %@{!S:X@}
29966 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29967
29968 @item %@{S*:X@}
29969 Substitutes @code{X} if one or more switches whose names start with
29970 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29971 once, no matter how many such switches appeared. However, if @code{%*}
29972 appears somewhere in @code{X}, then @code{X} is substituted once
29973 for each matching switch, with the @code{%*} replaced by the part of
29974 that switch matching the @code{*}.
29975
29976 If @code{%*} appears as the last part of a spec sequence then a space
29977 is added after the end of the last substitution. If there is more
29978 text in the sequence, however, then a space is not generated. This
29979 allows the @code{%*} substitution to be used as part of a larger
29980 string. For example, a spec string like this:
29981
29982 @smallexample
29983 %@{mcu=*:--script=%*/memory.ld@}
29984 @end smallexample
29985
29986 @noindent
29987 when matching an option like @option{-mcu=newchip} produces:
29988
29989 @smallexample
29990 --script=newchip/memory.ld
29991 @end smallexample
29992
29993 @item %@{.S:X@}
29994 Substitutes @code{X}, if processing a file with suffix @code{S}.
29995
29996 @item %@{!.S:X@}
29997 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29998
29999 @item %@{,S:X@}
30000 Substitutes @code{X}, if processing a file for language @code{S}.
30001
30002 @item %@{!,S:X@}
30003 Substitutes @code{X}, if not processing a file for language @code{S}.
30004
30005 @item %@{S|P:X@}
30006 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
30007 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
30008 @code{*} sequences as well, although they have a stronger binding than
30009 the @samp{|}. If @code{%*} appears in @code{X}, all of the
30010 alternatives must be starred, and only the first matching alternative
30011 is substituted.
30012
30013 For example, a spec string like this:
30014
30015 @smallexample
30016 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
30017 @end smallexample
30018
30019 @noindent
30020 outputs the following command-line options from the following input
30021 command-line options:
30022
30023 @smallexample
30024 fred.c -foo -baz
30025 jim.d -bar -boggle
30026 -d fred.c -foo -baz -boggle
30027 -d jim.d -bar -baz -boggle
30028 @end smallexample
30029
30030 @item %@{S:X; T:Y; :D@}
30031
30032 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
30033 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
30034 be as many clauses as you need. This may be combined with @code{.},
30035 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
30036
30037
30038 @end table
30039
30040 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
30041 or similar construct can use a backslash to ignore the special meaning
30042 of the character following it, thus allowing literal matching of a
30043 character that is otherwise specially treated. For example,
30044 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
30045 @option{-std=iso9899:1999} option is given.
30046
30047 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
30048 construct may contain other nested @samp{%} constructs or spaces, or
30049 even newlines. They are processed as usual, as described above.
30050 Trailing white space in @code{X} is ignored. White space may also
30051 appear anywhere on the left side of the colon in these constructs,
30052 except between @code{.} or @code{*} and the corresponding word.
30053
30054 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
30055 handled specifically in these constructs. If another value of
30056 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
30057 @option{-W} switch is found later in the command line, the earlier
30058 switch value is ignored, except with @{@code{S}*@} where @code{S} is
30059 just one letter, which passes all matching options.
30060
30061 The character @samp{|} at the beginning of the predicate text is used to
30062 indicate that a command should be piped to the following command, but
30063 only if @option{-pipe} is specified.
30064
30065 It is built into GCC which switches take arguments and which do not.
30066 (You might think it would be useful to generalize this to allow each
30067 compiler's spec to say which switches take arguments. But this cannot
30068 be done in a consistent fashion. GCC cannot even decide which input
30069 files have been specified without knowing which switches take arguments,
30070 and it must know which input files to compile in order to tell which
30071 compilers to run).
30072
30073 GCC also knows implicitly that arguments starting in @option{-l} are to be
30074 treated as compiler output files, and passed to the linker in their
30075 proper position among the other output files.
30076
30077 @node Environment Variables
30078 @section Environment Variables Affecting GCC
30079 @cindex environment variables
30080
30081 @c man begin ENVIRONMENT
30082 This section describes several environment variables that affect how GCC
30083 operates. Some of them work by specifying directories or prefixes to use
30084 when searching for various kinds of files. Some are used to specify other
30085 aspects of the compilation environment.
30086
30087 Note that you can also specify places to search using options such as
30088 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
30089 take precedence over places specified using environment variables, which
30090 in turn take precedence over those specified by the configuration of GCC@.
30091 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
30092 GNU Compiler Collection (GCC) Internals}.
30093
30094 @table @env
30095 @item LANG
30096 @itemx LC_CTYPE
30097 @c @itemx LC_COLLATE
30098 @itemx LC_MESSAGES
30099 @c @itemx LC_MONETARY
30100 @c @itemx LC_NUMERIC
30101 @c @itemx LC_TIME
30102 @itemx LC_ALL
30103 @findex LANG
30104 @findex LC_CTYPE
30105 @c @findex LC_COLLATE
30106 @findex LC_MESSAGES
30107 @c @findex LC_MONETARY
30108 @c @findex LC_NUMERIC
30109 @c @findex LC_TIME
30110 @findex LC_ALL
30111 @cindex locale
30112 These environment variables control the way that GCC uses
30113 localization information which allows GCC to work with different
30114 national conventions. GCC inspects the locale categories
30115 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
30116 so. These locale categories can be set to any value supported by your
30117 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
30118 Kingdom encoded in UTF-8.
30119
30120 The @env{LC_CTYPE} environment variable specifies character
30121 classification. GCC uses it to determine the character boundaries in
30122 a string; this is needed for some multibyte encodings that contain quote
30123 and escape characters that are otherwise interpreted as a string
30124 end or escape.
30125
30126 The @env{LC_MESSAGES} environment variable specifies the language to
30127 use in diagnostic messages.
30128
30129 If the @env{LC_ALL} environment variable is set, it overrides the value
30130 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
30131 and @env{LC_MESSAGES} default to the value of the @env{LANG}
30132 environment variable. If none of these variables are set, GCC
30133 defaults to traditional C English behavior.
30134
30135 @item TMPDIR
30136 @findex TMPDIR
30137 If @env{TMPDIR} is set, it specifies the directory to use for temporary
30138 files. GCC uses temporary files to hold the output of one stage of
30139 compilation which is to be used as input to the next stage: for example,
30140 the output of the preprocessor, which is the input to the compiler
30141 proper.
30142
30143 @item GCC_COMPARE_DEBUG
30144 @findex GCC_COMPARE_DEBUG
30145 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
30146 @option{-fcompare-debug} to the compiler driver. See the documentation
30147 of this option for more details.
30148
30149 @item GCC_EXEC_PREFIX
30150 @findex GCC_EXEC_PREFIX
30151 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
30152 names of the subprograms executed by the compiler. No slash is added
30153 when this prefix is combined with the name of a subprogram, but you can
30154 specify a prefix that ends with a slash if you wish.
30155
30156 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
30157 an appropriate prefix to use based on the pathname it is invoked with.
30158
30159 If GCC cannot find the subprogram using the specified prefix, it
30160 tries looking in the usual places for the subprogram.
30161
30162 The default value of @env{GCC_EXEC_PREFIX} is
30163 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
30164 the installed compiler. In many cases @var{prefix} is the value
30165 of @code{prefix} when you ran the @file{configure} script.
30166
30167 Other prefixes specified with @option{-B} take precedence over this prefix.
30168
30169 This prefix is also used for finding files such as @file{crt0.o} that are
30170 used for linking.
30171
30172 In addition, the prefix is used in an unusual way in finding the
30173 directories to search for header files. For each of the standard
30174 directories whose name normally begins with @samp{/usr/local/lib/gcc}
30175 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
30176 replacing that beginning with the specified prefix to produce an
30177 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
30178 @file{foo/bar} just before it searches the standard directory
30179 @file{/usr/local/lib/bar}.
30180 If a standard directory begins with the configured
30181 @var{prefix} then the value of @var{prefix} is replaced by
30182 @env{GCC_EXEC_PREFIX} when looking for header files.
30183
30184 @item COMPILER_PATH
30185 @findex COMPILER_PATH
30186 The value of @env{COMPILER_PATH} is a colon-separated list of
30187 directories, much like @env{PATH}. GCC tries the directories thus
30188 specified when searching for subprograms, if it cannot find the
30189 subprograms using @env{GCC_EXEC_PREFIX}.
30190
30191 @item LIBRARY_PATH
30192 @findex LIBRARY_PATH
30193 The value of @env{LIBRARY_PATH} is a colon-separated list of
30194 directories, much like @env{PATH}. When configured as a native compiler,
30195 GCC tries the directories thus specified when searching for special
30196 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
30197 using GCC also uses these directories when searching for ordinary
30198 libraries for the @option{-l} option (but directories specified with
30199 @option{-L} come first).
30200
30201 @item LANG
30202 @findex LANG
30203 @cindex locale definition
30204 This variable is used to pass locale information to the compiler. One way in
30205 which this information is used is to determine the character set to be used
30206 when character literals, string literals and comments are parsed in C and C++.
30207 When the compiler is configured to allow multibyte characters,
30208 the following values for @env{LANG} are recognized:
30209
30210 @table @samp
30211 @item C-JIS
30212 Recognize JIS characters.
30213 @item C-SJIS
30214 Recognize SJIS characters.
30215 @item C-EUCJP
30216 Recognize EUCJP characters.
30217 @end table
30218
30219 If @env{LANG} is not defined, or if it has some other value, then the
30220 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
30221 recognize and translate multibyte characters.
30222 @end table
30223
30224 @noindent
30225 Some additional environment variables affect the behavior of the
30226 preprocessor.
30227
30228 @include cppenv.texi
30229
30230 @c man end
30231
30232 @node Precompiled Headers
30233 @section Using Precompiled Headers
30234 @cindex precompiled headers
30235 @cindex speed of compilation
30236
30237 Often large projects have many header files that are included in every
30238 source file. The time the compiler takes to process these header files
30239 over and over again can account for nearly all of the time required to
30240 build the project. To make builds faster, GCC allows you to
30241 @dfn{precompile} a header file.
30242
30243 To create a precompiled header file, simply compile it as you would any
30244 other file, if necessary using the @option{-x} option to make the driver
30245 treat it as a C or C++ header file. You may want to use a
30246 tool like @command{make} to keep the precompiled header up-to-date when
30247 the headers it contains change.
30248
30249 A precompiled header file is searched for when @code{#include} is
30250 seen in the compilation. As it searches for the included file
30251 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
30252 compiler looks for a precompiled header in each directory just before it
30253 looks for the include file in that directory. The name searched for is
30254 the name specified in the @code{#include} with @samp{.gch} appended. If
30255 the precompiled header file cannot be used, it is ignored.
30256
30257 For instance, if you have @code{#include "all.h"}, and you have
30258 @file{all.h.gch} in the same directory as @file{all.h}, then the
30259 precompiled header file is used if possible, and the original
30260 header is used otherwise.
30261
30262 Alternatively, you might decide to put the precompiled header file in a
30263 directory and use @option{-I} to ensure that directory is searched
30264 before (or instead of) the directory containing the original header.
30265 Then, if you want to check that the precompiled header file is always
30266 used, you can put a file of the same name as the original header in this
30267 directory containing an @code{#error} command.
30268
30269 This also works with @option{-include}. So yet another way to use
30270 precompiled headers, good for projects not designed with precompiled
30271 header files in mind, is to simply take most of the header files used by
30272 a project, include them from another header file, precompile that header
30273 file, and @option{-include} the precompiled header. If the header files
30274 have guards against multiple inclusion, they are skipped because
30275 they've already been included (in the precompiled header).
30276
30277 If you need to precompile the same header file for different
30278 languages, targets, or compiler options, you can instead make a
30279 @emph{directory} named like @file{all.h.gch}, and put each precompiled
30280 header in the directory, perhaps using @option{-o}. It doesn't matter
30281 what you call the files in the directory; every precompiled header in
30282 the directory is considered. The first precompiled header
30283 encountered in the directory that is valid for this compilation is
30284 used; they're searched in no particular order.
30285
30286 There are many other possibilities, limited only by your imagination,
30287 good sense, and the constraints of your build system.
30288
30289 A precompiled header file can be used only when these conditions apply:
30290
30291 @itemize
30292 @item
30293 Only one precompiled header can be used in a particular compilation.
30294
30295 @item
30296 A precompiled header cannot be used once the first C token is seen. You
30297 can have preprocessor directives before a precompiled header; you cannot
30298 include a precompiled header from inside another header.
30299
30300 @item
30301 The precompiled header file must be produced for the same language as
30302 the current compilation. You cannot use a C precompiled header for a C++
30303 compilation.
30304
30305 @item
30306 The precompiled header file must have been produced by the same compiler
30307 binary as the current compilation is using.
30308
30309 @item
30310 Any macros defined before the precompiled header is included must
30311 either be defined in the same way as when the precompiled header was
30312 generated, or must not affect the precompiled header, which usually
30313 means that they don't appear in the precompiled header at all.
30314
30315 The @option{-D} option is one way to define a macro before a
30316 precompiled header is included; using a @code{#define} can also do it.
30317 There are also some options that define macros implicitly, like
30318 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30319 defined this way.
30320
30321 @item If debugging information is output when using the precompiled
30322 header, using @option{-g} or similar, the same kind of debugging information
30323 must have been output when building the precompiled header. However,
30324 a precompiled header built using @option{-g} can be used in a compilation
30325 when no debugging information is being output.
30326
30327 @item The same @option{-m} options must generally be used when building
30328 and using the precompiled header. @xref{Submodel Options},
30329 for any cases where this rule is relaxed.
30330
30331 @item Each of the following options must be the same when building and using
30332 the precompiled header:
30333
30334 @gccoptlist{-fexceptions}
30335
30336 @item
30337 Some other command-line options starting with @option{-f},
30338 @option{-p}, or @option{-O} must be defined in the same way as when
30339 the precompiled header was generated. At present, it's not clear
30340 which options are safe to change and which are not; the safest choice
30341 is to use exactly the same options when generating and using the
30342 precompiled header. The following are known to be safe:
30343
30344 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30345 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30346 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30347 -pedantic-errors}
30348
30349 @end itemize
30350
30351 For all of these except the last, the compiler automatically
30352 ignores the precompiled header if the conditions aren't met. If you
30353 find an option combination that doesn't work and doesn't cause the
30354 precompiled header to be ignored, please consider filing a bug report,
30355 see @ref{Bugs}.
30356
30357 If you do use differing options when generating and using the
30358 precompiled header, the actual behavior is a mixture of the
30359 behavior for the options. For instance, if you use @option{-g} to
30360 generate the precompiled header but not when using it, you may or may
30361 not get debugging information for routines in the precompiled header.