]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
Documentation hyperlinks for [-Wname-of-option] (PR 87488)
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2019 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-2019 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 @gol
201 -fopenacc -fopenacc-dim=@var{geom} @gol
202 -fopenmp -fopenmp-simd @gol
203 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
204 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
205 -fsigned-bitfields -fsigned-char @gol
206 -funsigned-bitfields -funsigned-char}
207
208 @item C++ Language Options
209 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
210 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
211 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol
212 -fconstexpr-depth=@var{n} -fconstexpr-cache-depth=@var{n} @gol
213 -fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n} @gol
214 -fno-elide-constructors @gol
215 -fno-enforce-eh-specs @gol
216 -fno-gnu-keywords @gol
217 -fno-implicit-templates @gol
218 -fno-implicit-inline-templates @gol
219 -fno-implement-inlines -fms-extensions @gol
220 -fnew-inheriting-ctors @gol
221 -fnew-ttp-matching @gol
222 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
223 -fno-optional-diags -fpermissive @gol
224 -fno-pretty-templates @gol
225 -fno-rtti -fsized-deallocation @gol
226 -ftemplate-backtrace-limit=@var{n} @gol
227 -ftemplate-depth=@var{n} @gol
228 -fno-threadsafe-statics -fuse-cxa-atexit @gol
229 -fno-weak -nostdinc++ @gol
230 -fvisibility-inlines-hidden @gol
231 -fvisibility-ms-compat @gol
232 -fext-numeric-literals @gol
233 -Wabi=@var{n} -Wabi-tag -Wcomma-subscript -Wconversion-null @gol
234 -Wctor-dtor-privacy @gol
235 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
236 -Wliteral-suffix @gol
237 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
238 -Wnamespaces -Wnarrowing @gol
239 -Wpessimizing-move -Wredundant-move @gol
240 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
241 -Wnon-virtual-dtor -Wreorder -Wregister @gol
242 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
243 -Wno-non-template-friend -Wold-style-cast @gol
244 -Woverloaded-virtual -Wno-pmf-conversions @gol
245 -Wno-class-conversion -Wno-terminate @gol
246 -Wsign-promo -Wvirtual-inheritance -Wvolatile}
247
248 @item Objective-C and Objective-C++ Language Options
249 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
250 Objective-C and Objective-C++ Dialects}.
251 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
252 -fgnu-runtime -fnext-runtime @gol
253 -fno-nil-receivers @gol
254 -fobjc-abi-version=@var{n} @gol
255 -fobjc-call-cxx-cdtors @gol
256 -fobjc-direct-dispatch @gol
257 -fobjc-exceptions @gol
258 -fobjc-gc @gol
259 -fobjc-nilcheck @gol
260 -fobjc-std=objc1 @gol
261 -fno-local-ivars @gol
262 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
263 -freplace-objc-classes @gol
264 -fzero-link @gol
265 -gen-decls @gol
266 -Wassign-intercept @gol
267 -Wno-protocol -Wselector @gol
268 -Wstrict-selector-match @gol
269 -Wundeclared-selector}
270
271 @item Diagnostic Message Formatting Options
272 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
273 @gccoptlist{-fmessage-length=@var{n} @gol
274 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
275 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
276 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol
277 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
278 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
279 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
280 -fdiagnostics-minimum-margin-width=@var{width} @gol
281 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
282 -fdiagnostics-show-template-tree -fno-elide-type @gol
283 -fno-show-column}
284
285 @item Warning Options
286 @xref{Warning Options,,Options to Request or Suppress Warnings}.
287 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
288 -pedantic-errors @gol
289 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
290 -Waggregate-return -Waligned-new @gol
291 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
292 -Walloca -Walloca-larger-than=@var{byte-size} @gol
293 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
294 -Wno-attributes -Wattribute-alias=@var{n} @gol
295 -Wbool-compare -Wbool-operation @gol
296 -Wno-builtin-declaration-mismatch @gol
297 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
298 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
299 -Wc++20-compat @gol
300 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
301 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
302 -Wclobbered -Wcomment -Wconditionally-supported @gol
303 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
304 -Wdelete-incomplete @gol
305 -Wno-attribute-warning @gol
306 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
307 -Wdisabled-optimization @gol
308 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
309 -Wno-div-by-zero -Wdouble-promotion @gol
310 -Wduplicated-branches -Wduplicated-cond @gol
311 -Wempty-body -Wenum-compare -Wenum-conversion @gol
312 -Wno-endif-labels -Wexpansion-to-defined @gol
313 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
314 -Wfloat-equal -Wformat -Wformat=2 @gol
315 -Wno-format-contains-nul -Wno-format-extra-args @gol
316 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
317 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
318 -Wformat-y2k -Wframe-address @gol
319 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
320 -Wjump-misses-init @gol
321 -Whsa -Wif-not-aligned @gol
322 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
323 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
324 -Wimplicit-function-declaration -Wimplicit-int @gol
325 -Winaccessible-base @gol
326 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
327 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
328 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
329 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
330 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
331 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
332 -Wmissing-field-initializers -Wmissing-format-attribute @gol
333 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
334 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
335 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
336 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
337 -Woverride-init-side-effects -Woverlength-strings @gol
338 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
339 -Wparentheses -Wno-pedantic-ms-format @gol
340 -Wplacement-new -Wplacement-new=@var{n} @gol
341 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
342 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
343 -Wrestrict -Wno-return-local-addr @gol
344 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
345 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
346 -Wshift-overflow -Wshift-overflow=@var{n} @gol
347 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
348 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
349 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
350 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
351 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
352 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
353 -Wstring-compare @gol
354 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
355 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
356 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
357 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
358 -Wswitch-unreachable -Wsync-nand @gol
359 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
360 -Wtype-limits -Wundef @gol
361 -Wuninitialized -Wunknown-pragmas @gol
362 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
363 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
364 -Wunused-parameter -Wno-unused-result @gol
365 -Wunused-value -Wunused-variable @gol
366 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
367 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
368 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
369 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
370 -Wwrite-strings @gol
371 -Wzero-as-null-pointer-constant}
372
373 @item C and Objective-C-only Warning Options
374 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
375 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
376 -Wold-style-declaration -Wold-style-definition @gol
377 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
378 -Wdeclaration-after-statement -Wpointer-sign}
379
380 @item Debugging Options
381 @xref{Debugging Options,,Options for Debugging Your Program}.
382 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
383 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
384 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
385 -gas-loc-support -gno-as-loc-support @gol
386 -gas-locview-support -gno-as-locview-support @gol
387 -gcolumn-info -gno-column-info @gol
388 -gstatement-frontiers -gno-statement-frontiers @gol
389 -gvariable-location-views -gno-variable-location-views @gol
390 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
391 -ginline-points -gno-inline-points @gol
392 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
393 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
394 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
395 -fno-eliminate-unused-debug-types @gol
396 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
397 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
398 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
399 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
400 -fvar-tracking -fvar-tracking-assignments}
401
402 @item Optimization Options
403 @xref{Optimize Options,,Options that Control Optimization}.
404 @gccoptlist{-faggressive-loop-optimizations @gol
405 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
406 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
407 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
408 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
409 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
410 -fauto-inc-dec -fbranch-probabilities @gol
411 -fcaller-saves @gol
412 -fcombine-stack-adjustments -fconserve-stack @gol
413 -fcompare-elim -fcprop-registers -fcrossjumping @gol
414 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
415 -fcx-limited-range @gol
416 -fdata-sections -fdce -fdelayed-branch @gol
417 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
418 -fdevirtualize-at-ltrans -fdse @gol
419 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
420 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
421 -ffinite-loops @gol
422 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
423 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
424 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
425 -fif-conversion2 -findirect-inlining @gol
426 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
427 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
428 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
429 -fipa-reference -fipa-reference-addressable @gol
430 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
431 -flive-patching=@var{level} @gol
432 -fira-region=@var{region} -fira-hoist-pressure @gol
433 -fira-loop-pressure -fno-ira-share-save-slots @gol
434 -fno-ira-share-spill-slots @gol
435 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
436 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
437 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
438 -floop-block -floop-interchange -floop-strip-mine @gol
439 -floop-unroll-and-jam -floop-nest-optimize @gol
440 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
441 -flto-partition=@var{alg} -fmerge-all-constants @gol
442 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
443 -fmove-loop-invariants -fno-branch-count-reg @gol
444 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
445 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
446 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
447 -fno-sched-spec -fno-signed-zeros @gol
448 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
449 -fomit-frame-pointer -foptimize-sibling-calls @gol
450 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
451 -fprefetch-loop-arrays @gol
452 -fprofile-correction @gol
453 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
454 -fprofile-reorder-functions @gol
455 -freciprocal-math -free -frename-registers -freorder-blocks @gol
456 -freorder-blocks-algorithm=@var{algorithm} @gol
457 -freorder-blocks-and-partition -freorder-functions @gol
458 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
459 -frounding-math -fsave-optimization-record @gol
460 -fsched2-use-superblocks -fsched-pressure @gol
461 -fsched-spec-load -fsched-spec-load-dangerous @gol
462 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
463 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
464 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
465 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
466 -fschedule-fusion @gol
467 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
468 -fselective-scheduling -fselective-scheduling2 @gol
469 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
470 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
471 -fsignaling-nans @gol
472 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
473 -fsplit-paths @gol
474 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
475 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
476 -fthread-jumps -ftracer -ftree-bit-ccp @gol
477 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
478 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
479 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
480 -ftree-loop-if-convert -ftree-loop-im @gol
481 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
482 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
483 -ftree-loop-vectorize @gol
484 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
485 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
486 -ftree-switch-conversion -ftree-tail-merge @gol
487 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
488 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
489 -funsafe-math-optimizations -funswitch-loops @gol
490 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
491 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
492 --param @var{name}=@var{value}
493 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
494
495 @item Program Instrumentation Options
496 @xref{Instrumentation Options,,Program Instrumentation Options}.
497 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
498 -fprofile-abs-path @gol
499 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
500 -fprofile-note=@var{path} -fprofile-update=@var{method} @gol
501 -fprofile-filter-files=@var{regex} -fprofile-exclude-files=@var{regex} @gol
502 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
503 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
504 -fsanitize-undefined-trap-on-error -fbounds-check @gol
505 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
506 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
507 -fstack-protector-explicit -fstack-check @gol
508 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
509 -fno-stack-limit -fsplit-stack @gol
510 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
511 -fvtv-counts -fvtv-debug @gol
512 -finstrument-functions @gol
513 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
514 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
515
516 @item Preprocessor Options
517 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
518 @gccoptlist{-A@var{question}=@var{answer} @gol
519 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
520 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
521 -dD -dI -dM -dN -dU @gol
522 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
523 -fexec-charset=@var{charset} -fextended-identifiers @gol
524 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
525 -fmax-include-depth=@var{depth} @gol
526 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
527 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
528 -fwide-exec-charset=@var{charset} -fworking-directory @gol
529 -H -imacros @var{file} -include @var{file} @gol
530 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
531 -no-integrated-cpp -P -pthread -remap @gol
532 -traditional -traditional-cpp -trigraphs @gol
533 -U@var{macro} -undef @gol
534 -Wp,@var{option} -Xpreprocessor @var{option}}
535
536 @item Assembler Options
537 @xref{Assembler Options,,Passing Options to the Assembler}.
538 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
539
540 @item Linker Options
541 @xref{Link Options,,Options for Linking}.
542 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
543 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
544 -e @var{entry} --entry=@var{entry} @gol
545 -pie -pthread -r -rdynamic @gol
546 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
547 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
548 -shared -shared-libgcc -symbolic @gol
549 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
550 -u @var{symbol} -z @var{keyword}}
551
552 @item Directory Options
553 @xref{Directory Options,,Options for Directory Search}.
554 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
555 -idirafter @var{dir} @gol
556 -imacros @var{file} -imultilib @var{dir} @gol
557 -iplugindir=@var{dir} -iprefix @var{file} @gol
558 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
559 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
560 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
561 -nostdinc -nostdinc++ --sysroot=@var{dir}}
562
563 @item Code Generation Options
564 @xref{Code Gen Options,,Options for Code Generation Conventions}.
565 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
566 -ffixed-@var{reg} -fexceptions @gol
567 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
568 -fasynchronous-unwind-tables @gol
569 -fno-gnu-unique @gol
570 -finhibit-size-directive -fno-common -fno-ident @gol
571 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
572 -fno-jump-tables @gol
573 -frecord-gcc-switches @gol
574 -freg-struct-return -fshort-enums -fshort-wchar @gol
575 -fverbose-asm -fpack-struct[=@var{n}] @gol
576 -fleading-underscore -ftls-model=@var{model} @gol
577 -fstack-reuse=@var{reuse_level} @gol
578 -ftrampolines -ftrapv -fwrapv @gol
579 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
580 -fstrict-volatile-bitfields -fsync-libcalls}
581
582 @item Developer Options
583 @xref{Developer Options,,GCC Developer Options}.
584 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
585 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
586 -fdbg-cnt=@var{counter-value-list} @gol
587 -fdisable-ipa-@var{pass_name} @gol
588 -fdisable-rtl-@var{pass_name} @gol
589 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
590 -fdisable-tree-@var{pass_name} @gol
591 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
592 -fdump-debug -fdump-earlydebug @gol
593 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
594 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
595 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
596 -fdump-lang-all @gol
597 -fdump-lang-@var{switch} @gol
598 -fdump-lang-@var{switch}-@var{options} @gol
599 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
600 -fdump-passes @gol
601 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
602 -fdump-statistics @gol
603 -fdump-tree-all @gol
604 -fdump-tree-@var{switch} @gol
605 -fdump-tree-@var{switch}-@var{options} @gol
606 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
607 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
608 -fenable-@var{kind}-@var{pass} @gol
609 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
610 -fira-verbose=@var{n} @gol
611 -flto-report -flto-report-wpa -fmem-report-wpa @gol
612 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
613 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
614 -fprofile-report @gol
615 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
616 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
617 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
618 -fvar-tracking-assignments-toggle -gtoggle @gol
619 -print-file-name=@var{library} -print-libgcc-file-name @gol
620 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
621 -print-prog-name=@var{program} -print-search-dirs -Q @gol
622 -print-sysroot -print-sysroot-headers-suffix @gol
623 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
624
625 @item Machine-Dependent Options
626 @xref{Submodel Options,,Machine-Dependent Options}.
627 @c This list is ordered alphanumerically by subsection name.
628 @c Try and put the significant identifier (CPU or system) first,
629 @c so users have a clue at guessing where the ones they want will be.
630
631 @emph{AArch64 Options}
632 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
633 -mgeneral-regs-only @gol
634 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
635 -mstrict-align -mno-strict-align @gol
636 -momit-leaf-frame-pointer @gol
637 -mtls-dialect=desc -mtls-dialect=traditional @gol
638 -mtls-size=@var{size} @gol
639 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
640 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
641 -mpc-relative-literal-loads @gol
642 -msign-return-address=@var{scope} @gol
643 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
644 +@var{b-key}]|@var{bti} @gol
645 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
646 -moverride=@var{string} -mverbose-cost-dump @gol
647 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
648 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
649 -moutline-atomics }
650
651 @emph{Adapteva Epiphany Options}
652 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
653 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
654 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
655 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
656 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
657 -msplit-vecmove-early -m1reg-@var{reg}}
658
659 @emph{AMD GCN Options}
660 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
661
662 @emph{ARC Options}
663 @gccoptlist{-mbarrel-shifter -mjli-always @gol
664 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
665 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
666 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
667 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
668 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
669 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
670 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
671 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
672 -mvolatile-cache -mtp-regno=@var{regno} @gol
673 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
674 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
675 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
676 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
677 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
678 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
679 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
680 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
681
682 @emph{ARM Options}
683 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
684 -mabi=@var{name} @gol
685 -mapcs-stack-check -mno-apcs-stack-check @gol
686 -mapcs-reentrant -mno-apcs-reentrant @gol
687 -mgeneral-regs-only @gol
688 -msched-prolog -mno-sched-prolog @gol
689 -mlittle-endian -mbig-endian @gol
690 -mbe8 -mbe32 @gol
691 -mfloat-abi=@var{name} @gol
692 -mfp16-format=@var{name}
693 -mthumb-interwork -mno-thumb-interwork @gol
694 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
695 -mtune=@var{name} -mprint-tune-info @gol
696 -mstructure-size-boundary=@var{n} @gol
697 -mabort-on-noreturn @gol
698 -mlong-calls -mno-long-calls @gol
699 -msingle-pic-base -mno-single-pic-base @gol
700 -mpic-register=@var{reg} @gol
701 -mnop-fun-dllimport @gol
702 -mpoke-function-name @gol
703 -mthumb -marm -mflip-thumb @gol
704 -mtpcs-frame -mtpcs-leaf-frame @gol
705 -mcaller-super-interworking -mcallee-super-interworking @gol
706 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
707 -mword-relocations @gol
708 -mfix-cortex-m3-ldrd @gol
709 -munaligned-access @gol
710 -mneon-for-64bits @gol
711 -mslow-flash-data @gol
712 -masm-syntax-unified @gol
713 -mrestrict-it @gol
714 -mverbose-cost-dump @gol
715 -mpure-code @gol
716 -mcmse @gol
717 -mfdpic}
718
719 @emph{AVR Options}
720 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
721 -mbranch-cost=@var{cost} @gol
722 -mcall-prologues -mgas-isr-prologues -mint8 @gol
723 -mn_flash=@var{size} -mno-interrupts @gol
724 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
725 -mfract-convert-truncate @gol
726 -mshort-calls -nodevicelib @gol
727 -Waddr-space-convert -Wmisspelled-isr}
728
729 @emph{Blackfin Options}
730 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
731 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
732 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
733 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
734 -mno-id-shared-library -mshared-library-id=@var{n} @gol
735 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
736 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
737 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
738 -micplb}
739
740 @emph{C6X Options}
741 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
742 -msim -msdata=@var{sdata-type}}
743
744 @emph{CRIS Options}
745 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
746 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
747 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
748 -mstack-align -mdata-align -mconst-align @gol
749 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
750 -melf -maout -melinux -mlinux -sim -sim2 @gol
751 -mmul-bug-workaround -mno-mul-bug-workaround}
752
753 @emph{CR16 Options}
754 @gccoptlist{-mmac @gol
755 -mcr16cplus -mcr16c @gol
756 -msim -mint32 -mbit-ops
757 -mdata-model=@var{model}}
758
759 @emph{C-SKY Options}
760 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
761 -mbig-endian -EB -mlittle-endian -EL @gol
762 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
763 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
764 -mdsp -medsp -mvdsp @gol
765 -mdiv -msmart -mhigh-registers -manchor @gol
766 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
767 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
768
769 @emph{Darwin Options}
770 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
771 -arch_only -bind_at_load -bundle -bundle_loader @gol
772 -client_name -compatibility_version -current_version @gol
773 -dead_strip @gol
774 -dependency-file -dylib_file -dylinker_install_name @gol
775 -dynamic -dynamiclib -exported_symbols_list @gol
776 -filelist -flat_namespace -force_cpusubtype_ALL @gol
777 -force_flat_namespace -headerpad_max_install_names @gol
778 -iframework @gol
779 -image_base -init -install_name -keep_private_externs @gol
780 -multi_module -multiply_defined -multiply_defined_unused @gol
781 -noall_load -no_dead_strip_inits_and_terms @gol
782 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
783 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
784 -private_bundle -read_only_relocs -sectalign @gol
785 -sectobjectsymbols -whyload -seg1addr @gol
786 -sectcreate -sectobjectsymbols -sectorder @gol
787 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
788 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
789 -segprot -segs_read_only_addr -segs_read_write_addr @gol
790 -single_module -static -sub_library -sub_umbrella @gol
791 -twolevel_namespace -umbrella -undefined @gol
792 -unexported_symbols_list -weak_reference_mismatches @gol
793 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
794 -mkernel -mone-byte-bool}
795
796 @emph{DEC Alpha Options}
797 @gccoptlist{-mno-fp-regs -msoft-float @gol
798 -mieee -mieee-with-inexact -mieee-conformant @gol
799 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
800 -mtrap-precision=@var{mode} -mbuild-constants @gol
801 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
802 -mbwx -mmax -mfix -mcix @gol
803 -mfloat-vax -mfloat-ieee @gol
804 -mexplicit-relocs -msmall-data -mlarge-data @gol
805 -msmall-text -mlarge-text @gol
806 -mmemory-latency=@var{time}}
807
808 @emph{eBPF Options}
809 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
810 -mframe-limit=@var{bytes}}
811
812 @emph{FR30 Options}
813 @gccoptlist{-msmall-model -mno-lsim}
814
815 @emph{FT32 Options}
816 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
817
818 @emph{FRV Options}
819 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
820 -mhard-float -msoft-float @gol
821 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
822 -mdouble -mno-double @gol
823 -mmedia -mno-media -mmuladd -mno-muladd @gol
824 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
825 -mlinked-fp -mlong-calls -malign-labels @gol
826 -mlibrary-pic -macc-4 -macc-8 @gol
827 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
828 -moptimize-membar -mno-optimize-membar @gol
829 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
830 -mvliw-branch -mno-vliw-branch @gol
831 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
832 -mno-nested-cond-exec -mtomcat-stats @gol
833 -mTLS -mtls @gol
834 -mcpu=@var{cpu}}
835
836 @emph{GNU/Linux Options}
837 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
838 -tno-android-cc -tno-android-ld}
839
840 @emph{H8/300 Options}
841 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
842
843 @emph{HPPA Options}
844 @gccoptlist{-march=@var{architecture-type} @gol
845 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
846 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
847 -mfixed-range=@var{register-range} @gol
848 -mjump-in-delay -mlinker-opt -mlong-calls @gol
849 -mlong-load-store -mno-disable-fpregs @gol
850 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
851 -mno-jump-in-delay -mno-long-load-store @gol
852 -mno-portable-runtime -mno-soft-float @gol
853 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
854 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
855 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
856 -munix=@var{unix-std} -nolibdld -static -threads}
857
858 @emph{IA-64 Options}
859 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
860 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
861 -mconstant-gp -mauto-pic -mfused-madd @gol
862 -minline-float-divide-min-latency @gol
863 -minline-float-divide-max-throughput @gol
864 -mno-inline-float-divide @gol
865 -minline-int-divide-min-latency @gol
866 -minline-int-divide-max-throughput @gol
867 -mno-inline-int-divide @gol
868 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
869 -mno-inline-sqrt @gol
870 -mdwarf2-asm -mearly-stop-bits @gol
871 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
872 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
873 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
874 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
875 -msched-spec-ldc -msched-spec-control-ldc @gol
876 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
877 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
878 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
879 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
880
881 @emph{LM32 Options}
882 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
883 -msign-extend-enabled -muser-enabled}
884
885 @emph{M32R/D Options}
886 @gccoptlist{-m32r2 -m32rx -m32r @gol
887 -mdebug @gol
888 -malign-loops -mno-align-loops @gol
889 -missue-rate=@var{number} @gol
890 -mbranch-cost=@var{number} @gol
891 -mmodel=@var{code-size-model-type} @gol
892 -msdata=@var{sdata-type} @gol
893 -mno-flush-func -mflush-func=@var{name} @gol
894 -mno-flush-trap -mflush-trap=@var{number} @gol
895 -G @var{num}}
896
897 @emph{M32C Options}
898 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
899
900 @emph{M680x0 Options}
901 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
902 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
903 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
904 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
905 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
906 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
907 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
908 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
909 -mxgot -mno-xgot -mlong-jump-table-offsets}
910
911 @emph{MCore Options}
912 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
913 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
914 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
915 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
916 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
917
918 @emph{MeP Options}
919 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
920 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
921 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
922 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
923 -mtiny=@var{n}}
924
925 @emph{MicroBlaze Options}
926 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
927 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
928 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
929 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
930 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
931 -mpic-data-is-text-relative}
932
933 @emph{MIPS Options}
934 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
935 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
936 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
937 -mips16 -mno-mips16 -mflip-mips16 @gol
938 -minterlink-compressed -mno-interlink-compressed @gol
939 -minterlink-mips16 -mno-interlink-mips16 @gol
940 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
941 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
942 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
943 -mno-float -msingle-float -mdouble-float @gol
944 -modd-spreg -mno-odd-spreg @gol
945 -mabs=@var{mode} -mnan=@var{encoding} @gol
946 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
947 -mmcu -mmno-mcu @gol
948 -meva -mno-eva @gol
949 -mvirt -mno-virt @gol
950 -mxpa -mno-xpa @gol
951 -mcrc -mno-crc @gol
952 -mginv -mno-ginv @gol
953 -mmicromips -mno-micromips @gol
954 -mmsa -mno-msa @gol
955 -mloongson-mmi -mno-loongson-mmi @gol
956 -mloongson-ext -mno-loongson-ext @gol
957 -mloongson-ext2 -mno-loongson-ext2 @gol
958 -mfpu=@var{fpu-type} @gol
959 -msmartmips -mno-smartmips @gol
960 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
961 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
962 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
963 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
964 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
965 -membedded-data -mno-embedded-data @gol
966 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
967 -mcode-readable=@var{setting} @gol
968 -msplit-addresses -mno-split-addresses @gol
969 -mexplicit-relocs -mno-explicit-relocs @gol
970 -mcheck-zero-division -mno-check-zero-division @gol
971 -mdivide-traps -mdivide-breaks @gol
972 -mload-store-pairs -mno-load-store-pairs @gol
973 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
974 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
975 -mfix-24k -mno-fix-24k @gol
976 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
977 -mfix-r5900 -mno-fix-r5900 @gol
978 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
979 -mfix-vr4120 -mno-fix-vr4120 @gol
980 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
981 -mflush-func=@var{func} -mno-flush-func @gol
982 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
983 -mcompact-branches=@var{policy} @gol
984 -mfp-exceptions -mno-fp-exceptions @gol
985 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
986 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
987 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
988 -mframe-header-opt -mno-frame-header-opt}
989
990 @emph{MMIX Options}
991 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
992 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
993 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
994 -mno-base-addresses -msingle-exit -mno-single-exit}
995
996 @emph{MN10300 Options}
997 @gccoptlist{-mmult-bug -mno-mult-bug @gol
998 -mno-am33 -mam33 -mam33-2 -mam34 @gol
999 -mtune=@var{cpu-type} @gol
1000 -mreturn-pointer-on-d0 @gol
1001 -mno-crt0 -mrelax -mliw -msetlb}
1002
1003 @emph{Moxie Options}
1004 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1005
1006 @emph{MSP430 Options}
1007 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1008 -mwarn-mcu @gol
1009 -mcode-region= -mdata-region= @gol
1010 -msilicon-errata= -msilicon-errata-warn= @gol
1011 -mhwmult= -minrt}
1012
1013 @emph{NDS32 Options}
1014 @gccoptlist{-mbig-endian -mlittle-endian @gol
1015 -mreduced-regs -mfull-regs @gol
1016 -mcmov -mno-cmov @gol
1017 -mext-perf -mno-ext-perf @gol
1018 -mext-perf2 -mno-ext-perf2 @gol
1019 -mext-string -mno-ext-string @gol
1020 -mv3push -mno-v3push @gol
1021 -m16bit -mno-16bit @gol
1022 -misr-vector-size=@var{num} @gol
1023 -mcache-block-size=@var{num} @gol
1024 -march=@var{arch} @gol
1025 -mcmodel=@var{code-model} @gol
1026 -mctor-dtor -mrelax}
1027
1028 @emph{Nios II Options}
1029 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1030 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1031 -mel -meb @gol
1032 -mno-bypass-cache -mbypass-cache @gol
1033 -mno-cache-volatile -mcache-volatile @gol
1034 -mno-fast-sw-div -mfast-sw-div @gol
1035 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1036 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1037 -mcustom-fpu-cfg=@var{name} @gol
1038 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1039 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1040
1041 @emph{Nvidia PTX Options}
1042 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1043
1044 @emph{OpenRISC Options}
1045 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1046 -msoft-mul -msoft-div @gol
1047 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1048 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1049
1050 @emph{PDP-11 Options}
1051 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1052 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1053 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1054
1055 @emph{picoChip Options}
1056 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1057 -msymbol-as-address -mno-inefficient-warnings}
1058
1059 @emph{PowerPC Options}
1060 See RS/6000 and PowerPC Options.
1061
1062 @emph{PRU Options}
1063 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1064 -mabi=@var{variant} @gol}
1065
1066 @emph{RISC-V Options}
1067 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1068 -mplt -mno-plt @gol
1069 -mabi=@var{ABI-string} @gol
1070 -mfdiv -mno-fdiv @gol
1071 -mdiv -mno-div @gol
1072 -march=@var{ISA-string} @gol
1073 -mtune=@var{processor-string} @gol
1074 -mpreferred-stack-boundary=@var{num} @gol
1075 -msmall-data-limit=@var{N-bytes} @gol
1076 -msave-restore -mno-save-restore @gol
1077 -mstrict-align -mno-strict-align @gol
1078 -mcmodel=medlow -mcmodel=medany @gol
1079 -mexplicit-relocs -mno-explicit-relocs @gol
1080 -mrelax -mno-relax @gol
1081 -mriscv-attribute -mmo-riscv-attribute @gol
1082 -malign-data=@var{type}}
1083
1084 @emph{RL78 Options}
1085 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1086 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1087 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1088
1089 @emph{RS/6000 and PowerPC Options}
1090 @gccoptlist{-mcpu=@var{cpu-type} @gol
1091 -mtune=@var{cpu-type} @gol
1092 -mcmodel=@var{code-model} @gol
1093 -mpowerpc64 @gol
1094 -maltivec -mno-altivec @gol
1095 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1096 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1097 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1098 -mfprnd -mno-fprnd @gol
1099 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1100 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1101 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1102 -malign-power -malign-natural @gol
1103 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1104 -mupdate -mno-update @gol
1105 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1106 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1107 -mstrict-align -mno-strict-align -mrelocatable @gol
1108 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1109 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1110 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1111 -mprioritize-restricted-insns=@var{priority} @gol
1112 -msched-costly-dep=@var{dependence_type} @gol
1113 -minsert-sched-nops=@var{scheme} @gol
1114 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1115 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1116 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1117 -mtraceback=@var{traceback_type} @gol
1118 -maix-struct-return -msvr4-struct-return @gol
1119 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1120 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1121 -mblock-move-inline-limit=@var{num} @gol
1122 -mblock-compare-inline-limit=@var{num} @gol
1123 -mblock-compare-inline-loop-limit=@var{num} @gol
1124 -mstring-compare-inline-limit=@var{num} @gol
1125 -misel -mno-isel @gol
1126 -mvrsave -mno-vrsave @gol
1127 -mmulhw -mno-mulhw @gol
1128 -mdlmzb -mno-dlmzb @gol
1129 -mprototype -mno-prototype @gol
1130 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1131 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1132 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1133 -mno-recip-precision @gol
1134 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1135 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1136 -msave-toc-indirect -mno-save-toc-indirect @gol
1137 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1138 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1139 -mquad-memory -mno-quad-memory @gol
1140 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1141 -mcompat-align-parm -mno-compat-align-parm @gol
1142 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1143 -mgnu-attribute -mno-gnu-attribute @gol
1144 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1145 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1146
1147 @emph{RX Options}
1148 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1149 -mcpu=@gol
1150 -mbig-endian-data -mlittle-endian-data @gol
1151 -msmall-data @gol
1152 -msim -mno-sim@gol
1153 -mas100-syntax -mno-as100-syntax@gol
1154 -mrelax@gol
1155 -mmax-constant-size=@gol
1156 -mint-register=@gol
1157 -mpid@gol
1158 -mallow-string-insns -mno-allow-string-insns@gol
1159 -mjsr@gol
1160 -mno-warn-multiple-fast-interrupts@gol
1161 -msave-acc-in-interrupts}
1162
1163 @emph{S/390 and zSeries Options}
1164 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1165 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1166 -mlong-double-64 -mlong-double-128 @gol
1167 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1168 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1169 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1170 -mhtm -mvx -mzvector @gol
1171 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1172 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1173 -mhotpatch=@var{halfwords},@var{halfwords}}
1174
1175 @emph{Score Options}
1176 @gccoptlist{-meb -mel @gol
1177 -mnhwloop @gol
1178 -muls @gol
1179 -mmac @gol
1180 -mscore5 -mscore5u -mscore7 -mscore7d}
1181
1182 @emph{SH Options}
1183 @gccoptlist{-m1 -m2 -m2e @gol
1184 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1185 -m3 -m3e @gol
1186 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1187 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1188 -mb -ml -mdalign -mrelax @gol
1189 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1190 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1191 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1192 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1193 -maccumulate-outgoing-args @gol
1194 -matomic-model=@var{atomic-model} @gol
1195 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1196 -mcbranch-force-delay-slot @gol
1197 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1198 -mpretend-cmove -mtas}
1199
1200 @emph{Solaris 2 Options}
1201 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1202 -pthreads}
1203
1204 @emph{SPARC Options}
1205 @gccoptlist{-mcpu=@var{cpu-type} @gol
1206 -mtune=@var{cpu-type} @gol
1207 -mcmodel=@var{code-model} @gol
1208 -mmemory-model=@var{mem-model} @gol
1209 -m32 -m64 -mapp-regs -mno-app-regs @gol
1210 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1211 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1212 -mhard-quad-float -msoft-quad-float @gol
1213 -mstack-bias -mno-stack-bias @gol
1214 -mstd-struct-return -mno-std-struct-return @gol
1215 -munaligned-doubles -mno-unaligned-doubles @gol
1216 -muser-mode -mno-user-mode @gol
1217 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1218 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1219 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1220 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1221 -mpopc -mno-popc -msubxc -mno-subxc @gol
1222 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1223 -mlra -mno-lra}
1224
1225 @emph{System V Options}
1226 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1227
1228 @emph{TILE-Gx Options}
1229 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1230 -mcmodel=@var{code-model}}
1231
1232 @emph{TILEPro Options}
1233 @gccoptlist{-mcpu=@var{cpu} -m32}
1234
1235 @emph{V850 Options}
1236 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1237 -mprolog-function -mno-prolog-function -mspace @gol
1238 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1239 -mapp-regs -mno-app-regs @gol
1240 -mdisable-callt -mno-disable-callt @gol
1241 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1242 -mv850e -mv850 -mv850e3v5 @gol
1243 -mloop @gol
1244 -mrelax @gol
1245 -mlong-jumps @gol
1246 -msoft-float @gol
1247 -mhard-float @gol
1248 -mgcc-abi @gol
1249 -mrh850-abi @gol
1250 -mbig-switch}
1251
1252 @emph{VAX Options}
1253 @gccoptlist{-mg -mgnu -munix}
1254
1255 @emph{Visium Options}
1256 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1257 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1258
1259 @emph{VMS Options}
1260 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1261 -mpointer-size=@var{size}}
1262
1263 @emph{VxWorks Options}
1264 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1265 -Xbind-lazy -Xbind-now}
1266
1267 @emph{x86 Options}
1268 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1269 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1270 -mfpmath=@var{unit} @gol
1271 -masm=@var{dialect} -mno-fancy-math-387 @gol
1272 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1273 -mno-wide-multiply -mrtd -malign-double @gol
1274 -mpreferred-stack-boundary=@var{num} @gol
1275 -mincoming-stack-boundary=@var{num} @gol
1276 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1277 -mrecip -mrecip=@var{opt} @gol
1278 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1279 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1280 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1281 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1282 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1283 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1284 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1285 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1286 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1287 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1288 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1289 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1290 -mrdseed -msgx -mavx512vp2intersect@gol
1291 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1292 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1293 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1294 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1295 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1296 -mregparm=@var{num} -msseregparm @gol
1297 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1298 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1299 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1300 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1301 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1302 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1303 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1304 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1305 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1306 -mstack-protector-guard-reg=@var{reg} @gol
1307 -mstack-protector-guard-offset=@var{offset} @gol
1308 -mstack-protector-guard-symbol=@var{symbol} @gol
1309 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1310 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1311 -mindirect-branch-register}
1312
1313 @emph{x86 Windows Options}
1314 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1315 -mnop-fun-dllimport -mthread @gol
1316 -municode -mwin32 -mwindows -fno-set-stack-executable}
1317
1318 @emph{Xstormy16 Options}
1319 @gccoptlist{-msim}
1320
1321 @emph{Xtensa Options}
1322 @gccoptlist{-mconst16 -mno-const16 @gol
1323 -mfused-madd -mno-fused-madd @gol
1324 -mforce-no-pic @gol
1325 -mserialize-volatile -mno-serialize-volatile @gol
1326 -mtext-section-literals -mno-text-section-literals @gol
1327 -mauto-litpools -mno-auto-litpools @gol
1328 -mtarget-align -mno-target-align @gol
1329 -mlongcalls -mno-longcalls}
1330
1331 @emph{zSeries Options}
1332 See S/390 and zSeries Options.
1333 @end table
1334
1335
1336 @node Overall Options
1337 @section Options Controlling the Kind of Output
1338
1339 Compilation can involve up to four stages: preprocessing, compilation
1340 proper, assembly and linking, always in that order. GCC is capable of
1341 preprocessing and compiling several files either into several
1342 assembler input files, or into one assembler input file; then each
1343 assembler input file produces an object file, and linking combines all
1344 the object files (those newly compiled, and those specified as input)
1345 into an executable file.
1346
1347 @cindex file name suffix
1348 For any given input file, the file name suffix determines what kind of
1349 compilation is done:
1350
1351 @table @gcctabopt
1352 @item @var{file}.c
1353 C source code that must be preprocessed.
1354
1355 @item @var{file}.i
1356 C source code that should not be preprocessed.
1357
1358 @item @var{file}.ii
1359 C++ source code that should not be preprocessed.
1360
1361 @item @var{file}.m
1362 Objective-C source code. Note that you must link with the @file{libobjc}
1363 library to make an Objective-C program work.
1364
1365 @item @var{file}.mi
1366 Objective-C source code that should not be preprocessed.
1367
1368 @item @var{file}.mm
1369 @itemx @var{file}.M
1370 Objective-C++ source code. Note that you must link with the @file{libobjc}
1371 library to make an Objective-C++ program work. Note that @samp{.M} refers
1372 to a literal capital M@.
1373
1374 @item @var{file}.mii
1375 Objective-C++ source code that should not be preprocessed.
1376
1377 @item @var{file}.h
1378 C, C++, Objective-C or Objective-C++ header file to be turned into a
1379 precompiled header (default), or C, C++ header file to be turned into an
1380 Ada spec (via the @option{-fdump-ada-spec} switch).
1381
1382 @item @var{file}.cc
1383 @itemx @var{file}.cp
1384 @itemx @var{file}.cxx
1385 @itemx @var{file}.cpp
1386 @itemx @var{file}.CPP
1387 @itemx @var{file}.c++
1388 @itemx @var{file}.C
1389 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1390 the last two letters must both be literally @samp{x}. Likewise,
1391 @samp{.C} refers to a literal capital C@.
1392
1393 @item @var{file}.mm
1394 @itemx @var{file}.M
1395 Objective-C++ source code that must be preprocessed.
1396
1397 @item @var{file}.mii
1398 Objective-C++ source code that should not be preprocessed.
1399
1400 @item @var{file}.hh
1401 @itemx @var{file}.H
1402 @itemx @var{file}.hp
1403 @itemx @var{file}.hxx
1404 @itemx @var{file}.hpp
1405 @itemx @var{file}.HPP
1406 @itemx @var{file}.h++
1407 @itemx @var{file}.tcc
1408 C++ header file to be turned into a precompiled header or Ada spec.
1409
1410 @item @var{file}.f
1411 @itemx @var{file}.for
1412 @itemx @var{file}.ftn
1413 Fixed form Fortran source code that should not be preprocessed.
1414
1415 @item @var{file}.F
1416 @itemx @var{file}.FOR
1417 @itemx @var{file}.fpp
1418 @itemx @var{file}.FPP
1419 @itemx @var{file}.FTN
1420 Fixed form Fortran source code that must be preprocessed (with the traditional
1421 preprocessor).
1422
1423 @item @var{file}.f90
1424 @itemx @var{file}.f95
1425 @itemx @var{file}.f03
1426 @itemx @var{file}.f08
1427 Free form Fortran source code that should not be preprocessed.
1428
1429 @item @var{file}.F90
1430 @itemx @var{file}.F95
1431 @itemx @var{file}.F03
1432 @itemx @var{file}.F08
1433 Free form Fortran source code that must be preprocessed (with the
1434 traditional preprocessor).
1435
1436 @item @var{file}.go
1437 Go source code.
1438
1439 @item @var{file}.brig
1440 BRIG files (binary representation of HSAIL).
1441
1442 @item @var{file}.d
1443 D source code.
1444
1445 @item @var{file}.di
1446 D interface file.
1447
1448 @item @var{file}.dd
1449 D documentation code (Ddoc).
1450
1451 @item @var{file}.ads
1452 Ada source code file that contains a library unit declaration (a
1453 declaration of a package, subprogram, or generic, or a generic
1454 instantiation), or a library unit renaming declaration (a package,
1455 generic, or subprogram renaming declaration). Such files are also
1456 called @dfn{specs}.
1457
1458 @item @var{file}.adb
1459 Ada source code file containing a library unit body (a subprogram or
1460 package body). Such files are also called @dfn{bodies}.
1461
1462 @c GCC also knows about some suffixes for languages not yet included:
1463 @c Ratfor:
1464 @c @var{file}.r
1465
1466 @item @var{file}.s
1467 Assembler code.
1468
1469 @item @var{file}.S
1470 @itemx @var{file}.sx
1471 Assembler code that must be preprocessed.
1472
1473 @item @var{other}
1474 An object file to be fed straight into linking.
1475 Any file name with no recognized suffix is treated this way.
1476 @end table
1477
1478 @opindex x
1479 You can specify the input language explicitly with the @option{-x} option:
1480
1481 @table @gcctabopt
1482 @item -x @var{language}
1483 Specify explicitly the @var{language} for the following input files
1484 (rather than letting the compiler choose a default based on the file
1485 name suffix). This option applies to all following input files until
1486 the next @option{-x} option. Possible values for @var{language} are:
1487 @smallexample
1488 c c-header cpp-output
1489 c++ c++-header c++-cpp-output
1490 objective-c objective-c-header objective-c-cpp-output
1491 objective-c++ objective-c++-header objective-c++-cpp-output
1492 assembler assembler-with-cpp
1493 ada
1494 d
1495 f77 f77-cpp-input f95 f95-cpp-input
1496 go
1497 brig
1498 @end smallexample
1499
1500 @item -x none
1501 Turn off any specification of a language, so that subsequent files are
1502 handled according to their file name suffixes (as they are if @option{-x}
1503 has not been used at all).
1504 @end table
1505
1506 If you only want some of the stages of compilation, you can use
1507 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1508 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1509 @command{gcc} is to stop. Note that some combinations (for example,
1510 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1511
1512 @table @gcctabopt
1513 @item -c
1514 @opindex c
1515 Compile or assemble the source files, but do not link. The linking
1516 stage simply is not done. The ultimate output is in the form of an
1517 object file for each source file.
1518
1519 By default, the object file name for a source file is made by replacing
1520 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1521
1522 Unrecognized input files, not requiring compilation or assembly, are
1523 ignored.
1524
1525 @item -S
1526 @opindex S
1527 Stop after the stage of compilation proper; do not assemble. The output
1528 is in the form of an assembler code file for each non-assembler input
1529 file specified.
1530
1531 By default, the assembler file name for a source file is made by
1532 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1533
1534 Input files that don't require compilation are ignored.
1535
1536 @item -E
1537 @opindex E
1538 Stop after the preprocessing stage; do not run the compiler proper. The
1539 output is in the form of preprocessed source code, which is sent to the
1540 standard output.
1541
1542 Input files that don't require preprocessing are ignored.
1543
1544 @cindex output file option
1545 @item -o @var{file}
1546 @opindex o
1547 Place output in file @var{file}. This applies to whatever
1548 sort of output is being produced, whether it be an executable file,
1549 an object file, an assembler file or preprocessed C code.
1550
1551 If @option{-o} is not specified, the default is to put an executable
1552 file in @file{a.out}, the object file for
1553 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1554 assembler file in @file{@var{source}.s}, a precompiled header file in
1555 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1556 standard output.
1557
1558 @item -v
1559 @opindex v
1560 Print (on standard error output) the commands executed to run the stages
1561 of compilation. Also print the version number of the compiler driver
1562 program and of the preprocessor and the compiler proper.
1563
1564 @item -###
1565 @opindex ###
1566 Like @option{-v} except the commands are not executed and arguments
1567 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1568 This is useful for shell scripts to capture the driver-generated command lines.
1569
1570 @item --help
1571 @opindex help
1572 Print (on the standard output) a description of the command-line options
1573 understood by @command{gcc}. If the @option{-v} option is also specified
1574 then @option{--help} is also passed on to the various processes
1575 invoked by @command{gcc}, so that they can display the command-line options
1576 they accept. If the @option{-Wextra} option has also been specified
1577 (prior to the @option{--help} option), then command-line options that
1578 have no documentation associated with them are also displayed.
1579
1580 @item --target-help
1581 @opindex target-help
1582 Print (on the standard output) a description of target-specific command-line
1583 options for each tool. For some targets extra target-specific
1584 information may also be printed.
1585
1586 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1587 Print (on the standard output) a description of the command-line
1588 options understood by the compiler that fit into all specified classes
1589 and qualifiers. These are the supported classes:
1590
1591 @table @asis
1592 @item @samp{optimizers}
1593 Display all of the optimization options supported by the
1594 compiler.
1595
1596 @item @samp{warnings}
1597 Display all of the options controlling warning messages
1598 produced by the compiler.
1599
1600 @item @samp{target}
1601 Display target-specific options. Unlike the
1602 @option{--target-help} option however, target-specific options of the
1603 linker and assembler are not displayed. This is because those
1604 tools do not currently support the extended @option{--help=} syntax.
1605
1606 @item @samp{params}
1607 Display the values recognized by the @option{--param}
1608 option.
1609
1610 @item @var{language}
1611 Display the options supported for @var{language}, where
1612 @var{language} is the name of one of the languages supported in this
1613 version of GCC@.
1614
1615 @item @samp{common}
1616 Display the options that are common to all languages.
1617 @end table
1618
1619 These are the supported qualifiers:
1620
1621 @table @asis
1622 @item @samp{undocumented}
1623 Display only those options that are undocumented.
1624
1625 @item @samp{joined}
1626 Display options taking an argument that appears after an equal
1627 sign in the same continuous piece of text, such as:
1628 @samp{--help=target}.
1629
1630 @item @samp{separate}
1631 Display options taking an argument that appears as a separate word
1632 following the original option, such as: @samp{-o output-file}.
1633 @end table
1634
1635 Thus for example to display all the undocumented target-specific
1636 switches supported by the compiler, use:
1637
1638 @smallexample
1639 --help=target,undocumented
1640 @end smallexample
1641
1642 The sense of a qualifier can be inverted by prefixing it with the
1643 @samp{^} character, so for example to display all binary warning
1644 options (i.e., ones that are either on or off and that do not take an
1645 argument) that have a description, use:
1646
1647 @smallexample
1648 --help=warnings,^joined,^undocumented
1649 @end smallexample
1650
1651 The argument to @option{--help=} should not consist solely of inverted
1652 qualifiers.
1653
1654 Combining several classes is possible, although this usually
1655 restricts the output so much that there is nothing to display. One
1656 case where it does work, however, is when one of the classes is
1657 @var{target}. For example, to display all the target-specific
1658 optimization options, use:
1659
1660 @smallexample
1661 --help=target,optimizers
1662 @end smallexample
1663
1664 The @option{--help=} option can be repeated on the command line. Each
1665 successive use displays its requested class of options, skipping
1666 those that have already been displayed. If @option{--help} is also
1667 specified anywhere on the command line then this takes precedence
1668 over any @option{--help=} option.
1669
1670 If the @option{-Q} option appears on the command line before the
1671 @option{--help=} option, then the descriptive text displayed by
1672 @option{--help=} is changed. Instead of describing the displayed
1673 options, an indication is given as to whether the option is enabled,
1674 disabled or set to a specific value (assuming that the compiler
1675 knows this at the point where the @option{--help=} option is used).
1676
1677 Here is a truncated example from the ARM port of @command{gcc}:
1678
1679 @smallexample
1680 % gcc -Q -mabi=2 --help=target -c
1681 The following options are target specific:
1682 -mabi= 2
1683 -mabort-on-noreturn [disabled]
1684 -mapcs [disabled]
1685 @end smallexample
1686
1687 The output is sensitive to the effects of previous command-line
1688 options, so for example it is possible to find out which optimizations
1689 are enabled at @option{-O2} by using:
1690
1691 @smallexample
1692 -Q -O2 --help=optimizers
1693 @end smallexample
1694
1695 Alternatively you can discover which binary optimizations are enabled
1696 by @option{-O3} by using:
1697
1698 @smallexample
1699 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1700 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1701 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1702 @end smallexample
1703
1704 @item --version
1705 @opindex version
1706 Display the version number and copyrights of the invoked GCC@.
1707
1708 @item -pass-exit-codes
1709 @opindex pass-exit-codes
1710 Normally the @command{gcc} program exits with the code of 1 if any
1711 phase of the compiler returns a non-success return code. If you specify
1712 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1713 the numerically highest error produced by any phase returning an error
1714 indication. The C, C++, and Fortran front ends return 4 if an internal
1715 compiler error is encountered.
1716
1717 @item -pipe
1718 @opindex pipe
1719 Use pipes rather than temporary files for communication between the
1720 various stages of compilation. This fails to work on some systems where
1721 the assembler is unable to read from a pipe; but the GNU assembler has
1722 no trouble.
1723
1724 @item -specs=@var{file}
1725 @opindex specs
1726 Process @var{file} after the compiler reads in the standard @file{specs}
1727 file, in order to override the defaults which the @command{gcc} driver
1728 program uses when determining what switches to pass to @command{cc1},
1729 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1730 @option{-specs=@var{file}} can be specified on the command line, and they
1731 are processed in order, from left to right. @xref{Spec Files}, for
1732 information about the format of the @var{file}.
1733
1734 @item -wrapper
1735 @opindex wrapper
1736 Invoke all subcommands under a wrapper program. The name of the
1737 wrapper program and its parameters are passed as a comma separated
1738 list.
1739
1740 @smallexample
1741 gcc -c t.c -wrapper gdb,--args
1742 @end smallexample
1743
1744 @noindent
1745 This invokes all subprograms of @command{gcc} under
1746 @samp{gdb --args}, thus the invocation of @command{cc1} is
1747 @samp{gdb --args cc1 @dots{}}.
1748
1749 @item -ffile-prefix-map=@var{old}=@var{new}
1750 @opindex ffile-prefix-map
1751 When compiling files residing in directory @file{@var{old}}, record
1752 any references to them in the result of the compilation as if the
1753 files resided in directory @file{@var{new}} instead. Specifying this
1754 option is equivalent to specifying all the individual
1755 @option{-f*-prefix-map} options. This can be used to make reproducible
1756 builds that are location independent. See also
1757 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1758
1759 @item -fplugin=@var{name}.so
1760 @opindex fplugin
1761 Load the plugin code in file @var{name}.so, assumed to be a
1762 shared object to be dlopen'd by the compiler. The base name of
1763 the shared object file is used to identify the plugin for the
1764 purposes of argument parsing (See
1765 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1766 Each plugin should define the callback functions specified in the
1767 Plugins API.
1768
1769 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1770 @opindex fplugin-arg
1771 Define an argument called @var{key} with a value of @var{value}
1772 for the plugin called @var{name}.
1773
1774 @item -fdump-ada-spec@r{[}-slim@r{]}
1775 @opindex fdump-ada-spec
1776 For C and C++ source and include files, generate corresponding Ada specs.
1777 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1778 GNAT User's Guide}, which provides detailed documentation on this feature.
1779
1780 @item -fada-spec-parent=@var{unit}
1781 @opindex fada-spec-parent
1782 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1783 Ada specs as child units of parent @var{unit}.
1784
1785 @item -fdump-go-spec=@var{file}
1786 @opindex fdump-go-spec
1787 For input files in any language, generate corresponding Go
1788 declarations in @var{file}. This generates Go @code{const},
1789 @code{type}, @code{var}, and @code{func} declarations which may be a
1790 useful way to start writing a Go interface to code written in some
1791 other language.
1792
1793 @include @value{srcdir}/../libiberty/at-file.texi
1794 @end table
1795
1796 @node Invoking G++
1797 @section Compiling C++ Programs
1798
1799 @cindex suffixes for C++ source
1800 @cindex C++ source file suffixes
1801 C++ source files conventionally use one of the suffixes @samp{.C},
1802 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1803 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1804 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1805 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1806 files with these names and compiles them as C++ programs even if you
1807 call the compiler the same way as for compiling C programs (usually
1808 with the name @command{gcc}).
1809
1810 @findex g++
1811 @findex c++
1812 However, the use of @command{gcc} does not add the C++ library.
1813 @command{g++} is a program that calls GCC and automatically specifies linking
1814 against the C++ library. It treats @samp{.c},
1815 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1816 files unless @option{-x} is used. This program is also useful when
1817 precompiling a C header file with a @samp{.h} extension for use in C++
1818 compilations. On many systems, @command{g++} is also installed with
1819 the name @command{c++}.
1820
1821 @cindex invoking @command{g++}
1822 When you compile C++ programs, you may specify many of the same
1823 command-line options that you use for compiling programs in any
1824 language; or command-line options meaningful for C and related
1825 languages; or options that are meaningful only for C++ programs.
1826 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1827 explanations of options for languages related to C@.
1828 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1829 explanations of options that are meaningful only for C++ programs.
1830
1831 @node C Dialect Options
1832 @section Options Controlling C Dialect
1833 @cindex dialect options
1834 @cindex language dialect options
1835 @cindex options, dialect
1836
1837 The following options control the dialect of C (or languages derived
1838 from C, such as C++, Objective-C and Objective-C++) that the compiler
1839 accepts:
1840
1841 @table @gcctabopt
1842 @cindex ANSI support
1843 @cindex ISO support
1844 @item -ansi
1845 @opindex ansi
1846 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1847 equivalent to @option{-std=c++98}.
1848
1849 This turns off certain features of GCC that are incompatible with ISO
1850 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1851 such as the @code{asm} and @code{typeof} keywords, and
1852 predefined macros such as @code{unix} and @code{vax} that identify the
1853 type of system you are using. It also enables the undesirable and
1854 rarely used ISO trigraph feature. For the C compiler,
1855 it disables recognition of C++ style @samp{//} comments as well as
1856 the @code{inline} keyword.
1857
1858 The alternate keywords @code{__asm__}, @code{__extension__},
1859 @code{__inline__} and @code{__typeof__} continue to work despite
1860 @option{-ansi}. You would not want to use them in an ISO C program, of
1861 course, but it is useful to put them in header files that might be included
1862 in compilations done with @option{-ansi}. Alternate predefined macros
1863 such as @code{__unix__} and @code{__vax__} are also available, with or
1864 without @option{-ansi}.
1865
1866 The @option{-ansi} option does not cause non-ISO programs to be
1867 rejected gratuitously. For that, @option{-Wpedantic} is required in
1868 addition to @option{-ansi}. @xref{Warning Options}.
1869
1870 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1871 option is used. Some header files may notice this macro and refrain
1872 from declaring certain functions or defining certain macros that the
1873 ISO standard doesn't call for; this is to avoid interfering with any
1874 programs that might use these names for other things.
1875
1876 Functions that are normally built in but do not have semantics
1877 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1878 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1879 built-in functions provided by GCC}, for details of the functions
1880 affected.
1881
1882 @item -std=
1883 @opindex std
1884 Determine the language standard. @xref{Standards,,Language Standards
1885 Supported by GCC}, for details of these standard versions. This option
1886 is currently only supported when compiling C or C++.
1887
1888 The compiler can accept several base standards, such as @samp{c90} or
1889 @samp{c++98}, and GNU dialects of those standards, such as
1890 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1891 compiler accepts all programs following that standard plus those
1892 using GNU extensions that do not contradict it. For example,
1893 @option{-std=c90} turns off certain features of GCC that are
1894 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1895 keywords, but not other GNU extensions that do not have a meaning in
1896 ISO C90, such as omitting the middle term of a @code{?:}
1897 expression. On the other hand, when a GNU dialect of a standard is
1898 specified, all features supported by the compiler are enabled, even when
1899 those features change the meaning of the base standard. As a result, some
1900 strict-conforming programs may be rejected. The particular standard
1901 is used by @option{-Wpedantic} to identify which features are GNU
1902 extensions given that version of the standard. For example
1903 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1904 comments, while @option{-std=gnu99 -Wpedantic} does not.
1905
1906 A value for this option must be provided; possible values are
1907
1908 @table @samp
1909 @item c90
1910 @itemx c89
1911 @itemx iso9899:1990
1912 Support all ISO C90 programs (certain GNU extensions that conflict
1913 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1914
1915 @item iso9899:199409
1916 ISO C90 as modified in amendment 1.
1917
1918 @item c99
1919 @itemx c9x
1920 @itemx iso9899:1999
1921 @itemx iso9899:199x
1922 ISO C99. This standard is substantially completely supported, modulo
1923 bugs and floating-point issues
1924 (mainly but not entirely relating to optional C99 features from
1925 Annexes F and G). See
1926 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1927 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1928
1929 @item c11
1930 @itemx c1x
1931 @itemx iso9899:2011
1932 ISO C11, the 2011 revision of the ISO C standard. This standard is
1933 substantially completely supported, modulo bugs, floating-point issues
1934 (mainly but not entirely relating to optional C11 features from
1935 Annexes F and G) and the optional Annexes K (Bounds-checking
1936 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1937
1938 @item c17
1939 @itemx c18
1940 @itemx iso9899:2017
1941 @itemx iso9899:2018
1942 ISO C17, the 2017 revision of the ISO C standard
1943 (published in 2018). This standard is
1944 same as C11 except for corrections of defects (all of which are also
1945 applied with @option{-std=c11}) and a new value of
1946 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1947
1948 @item c2x
1949 The next version of the ISO C standard, still under development. The
1950 support for this version is experimental and incomplete.
1951
1952 @item gnu90
1953 @itemx gnu89
1954 GNU dialect of ISO C90 (including some C99 features).
1955
1956 @item gnu99
1957 @itemx gnu9x
1958 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1959
1960 @item gnu11
1961 @itemx gnu1x
1962 GNU dialect of ISO C11.
1963 The name @samp{gnu1x} is deprecated.
1964
1965 @item gnu17
1966 @itemx gnu18
1967 GNU dialect of ISO C17. This is the default for C code.
1968
1969 @item gnu2x
1970 The next version of the ISO C standard, still under development, plus
1971 GNU extensions. The support for this version is experimental and
1972 incomplete.
1973
1974 @item c++98
1975 @itemx c++03
1976 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1977 additional defect reports. Same as @option{-ansi} for C++ code.
1978
1979 @item gnu++98
1980 @itemx gnu++03
1981 GNU dialect of @option{-std=c++98}.
1982
1983 @item c++11
1984 @itemx c++0x
1985 The 2011 ISO C++ standard plus amendments.
1986 The name @samp{c++0x} is deprecated.
1987
1988 @item gnu++11
1989 @itemx gnu++0x
1990 GNU dialect of @option{-std=c++11}.
1991 The name @samp{gnu++0x} is deprecated.
1992
1993 @item c++14
1994 @itemx c++1y
1995 The 2014 ISO C++ standard plus amendments.
1996 The name @samp{c++1y} is deprecated.
1997
1998 @item gnu++14
1999 @itemx gnu++1y
2000 GNU dialect of @option{-std=c++14}.
2001 This is the default for C++ code.
2002 The name @samp{gnu++1y} is deprecated.
2003
2004 @item c++17
2005 @itemx c++1z
2006 The 2017 ISO C++ standard plus amendments.
2007 The name @samp{c++1z} is deprecated.
2008
2009 @item gnu++17
2010 @itemx gnu++1z
2011 GNU dialect of @option{-std=c++17}.
2012 The name @samp{gnu++1z} is deprecated.
2013
2014 @item c++2a
2015 The next revision of the ISO C++ standard, tentatively planned for
2016 2020. Support is highly experimental, and will almost certainly
2017 change in incompatible ways in future releases.
2018
2019 @item gnu++2a
2020 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2021 and will almost certainly change in incompatible ways in future
2022 releases.
2023 @end table
2024
2025 @item -fgnu89-inline
2026 @opindex fgnu89-inline
2027 The option @option{-fgnu89-inline} tells GCC to use the traditional
2028 GNU semantics for @code{inline} functions when in C99 mode.
2029 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2030 Using this option is roughly equivalent to adding the
2031 @code{gnu_inline} function attribute to all inline functions
2032 (@pxref{Function Attributes}).
2033
2034 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2035 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2036 specifies the default behavior).
2037 This option is not supported in @option{-std=c90} or
2038 @option{-std=gnu90} mode.
2039
2040 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2041 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2042 in effect for @code{inline} functions. @xref{Common Predefined
2043 Macros,,,cpp,The C Preprocessor}.
2044
2045 @item -fpermitted-flt-eval-methods=@var{style}
2046 @opindex fpermitted-flt-eval-methods
2047 @opindex fpermitted-flt-eval-methods=c11
2048 @opindex fpermitted-flt-eval-methods=ts-18661-3
2049 ISO/IEC TS 18661-3 defines new permissible values for
2050 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2051 a semantic type that is an interchange or extended format should be
2052 evaluated to the precision and range of that type. These new values are
2053 a superset of those permitted under C99/C11, which does not specify the
2054 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2055 conforming to C11 may not have been written expecting the possibility of
2056 the new values.
2057
2058 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2059 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2060 or the extended set of values specified in ISO/IEC TS 18661-3.
2061
2062 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2063
2064 The default when in a standards compliant mode (@option{-std=c11} or similar)
2065 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2066 dialect (@option{-std=gnu11} or similar) is
2067 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2068
2069 @item -aux-info @var{filename}
2070 @opindex aux-info
2071 Output to the given filename prototyped declarations for all functions
2072 declared and/or defined in a translation unit, including those in header
2073 files. This option is silently ignored in any language other than C@.
2074
2075 Besides declarations, the file indicates, in comments, the origin of
2076 each declaration (source file and line), whether the declaration was
2077 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2078 @samp{O} for old, respectively, in the first character after the line
2079 number and the colon), and whether it came from a declaration or a
2080 definition (@samp{C} or @samp{F}, respectively, in the following
2081 character). In the case of function definitions, a K&R-style list of
2082 arguments followed by their declarations is also provided, inside
2083 comments, after the declaration.
2084
2085 @item -fallow-parameterless-variadic-functions
2086 @opindex fallow-parameterless-variadic-functions
2087 Accept variadic functions without named parameters.
2088
2089 Although it is possible to define such a function, this is not very
2090 useful as it is not possible to read the arguments. This is only
2091 supported for C as this construct is allowed by C++.
2092
2093 @item -fno-asm
2094 @opindex fno-asm
2095 @opindex fasm
2096 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2097 keyword, so that code can use these words as identifiers. You can use
2098 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2099 instead. @option{-ansi} implies @option{-fno-asm}.
2100
2101 In C++, this switch only affects the @code{typeof} keyword, since
2102 @code{asm} and @code{inline} are standard keywords. You may want to
2103 use the @option{-fno-gnu-keywords} flag instead, which has the same
2104 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2105 switch only affects the @code{asm} and @code{typeof} keywords, since
2106 @code{inline} is a standard keyword in ISO C99.
2107
2108 @item -fno-builtin
2109 @itemx -fno-builtin-@var{function}
2110 @opindex fno-builtin
2111 @opindex fbuiltin
2112 @cindex built-in functions
2113 Don't recognize built-in functions that do not begin with
2114 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2115 functions provided by GCC}, for details of the functions affected,
2116 including those which are not built-in functions when @option{-ansi} or
2117 @option{-std} options for strict ISO C conformance are used because they
2118 do not have an ISO standard meaning.
2119
2120 GCC normally generates special code to handle certain built-in functions
2121 more efficiently; for instance, calls to @code{alloca} may become single
2122 instructions which adjust the stack directly, and calls to @code{memcpy}
2123 may become inline copy loops. The resulting code is often both smaller
2124 and faster, but since the function calls no longer appear as such, you
2125 cannot set a breakpoint on those calls, nor can you change the behavior
2126 of the functions by linking with a different library. In addition,
2127 when a function is recognized as a built-in function, GCC may use
2128 information about that function to warn about problems with calls to
2129 that function, or to generate more efficient code, even if the
2130 resulting code still contains calls to that function. For example,
2131 warnings are given with @option{-Wformat} for bad calls to
2132 @code{printf} when @code{printf} is built in and @code{strlen} is
2133 known not to modify global memory.
2134
2135 With the @option{-fno-builtin-@var{function}} option
2136 only the built-in function @var{function} is
2137 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2138 function is named that is not built-in in this version of GCC, this
2139 option is ignored. There is no corresponding
2140 @option{-fbuiltin-@var{function}} option; if you wish to enable
2141 built-in functions selectively when using @option{-fno-builtin} or
2142 @option{-ffreestanding}, you may define macros such as:
2143
2144 @smallexample
2145 #define abs(n) __builtin_abs ((n))
2146 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2147 @end smallexample
2148
2149 @item -fgimple
2150 @opindex fgimple
2151
2152 Enable parsing of function definitions marked with @code{__GIMPLE}.
2153 This is an experimental feature that allows unit testing of GIMPLE
2154 passes.
2155
2156 @item -fhosted
2157 @opindex fhosted
2158 @cindex hosted environment
2159
2160 Assert that compilation targets a hosted environment. This implies
2161 @option{-fbuiltin}. A hosted environment is one in which the
2162 entire standard library is available, and in which @code{main} has a return
2163 type of @code{int}. Examples are nearly everything except a kernel.
2164 This is equivalent to @option{-fno-freestanding}.
2165
2166 @item -ffreestanding
2167 @opindex ffreestanding
2168 @cindex hosted environment
2169
2170 Assert that compilation targets a freestanding environment. This
2171 implies @option{-fno-builtin}. A freestanding environment
2172 is one in which the standard library may not exist, and program startup may
2173 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2174 This is equivalent to @option{-fno-hosted}.
2175
2176 @xref{Standards,,Language Standards Supported by GCC}, for details of
2177 freestanding and hosted environments.
2178
2179 @item -fopenacc
2180 @opindex fopenacc
2181 @cindex OpenACC accelerator programming
2182 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2183 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2184 compiler generates accelerated code according to the OpenACC Application
2185 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2186 implies @option{-pthread}, and thus is only supported on targets that
2187 have support for @option{-pthread}.
2188
2189 @item -fopenacc-dim=@var{geom}
2190 @opindex fopenacc-dim
2191 @cindex OpenACC accelerator programming
2192 Specify default compute dimensions for parallel offload regions that do
2193 not explicitly specify. The @var{geom} value is a triple of
2194 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2195 can be omitted, to use a target-specific default value.
2196
2197 @item -fopenmp
2198 @opindex fopenmp
2199 @cindex OpenMP parallel
2200 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2201 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2202 compiler generates parallel code according to the OpenMP Application
2203 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2204 implies @option{-pthread}, and thus is only supported on targets that
2205 have support for @option{-pthread}. @option{-fopenmp} implies
2206 @option{-fopenmp-simd}.
2207
2208 @item -fopenmp-simd
2209 @opindex fopenmp-simd
2210 @cindex OpenMP SIMD
2211 @cindex SIMD
2212 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2213 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2214 are ignored.
2215
2216 @item -fgnu-tm
2217 @opindex fgnu-tm
2218 When the option @option{-fgnu-tm} is specified, the compiler
2219 generates code for the Linux variant of Intel's current Transactional
2220 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2221 an experimental feature whose interface may change in future versions
2222 of GCC, as the official specification changes. Please note that not
2223 all architectures are supported for this feature.
2224
2225 For more information on GCC's support for transactional memory,
2226 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2227 Transactional Memory Library}.
2228
2229 Note that the transactional memory feature is not supported with
2230 non-call exceptions (@option{-fnon-call-exceptions}).
2231
2232 @item -fms-extensions
2233 @opindex fms-extensions
2234 Accept some non-standard constructs used in Microsoft header files.
2235
2236 In C++ code, this allows member names in structures to be similar
2237 to previous types declarations.
2238
2239 @smallexample
2240 typedef int UOW;
2241 struct ABC @{
2242 UOW UOW;
2243 @};
2244 @end smallexample
2245
2246 Some cases of unnamed fields in structures and unions are only
2247 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2248 fields within structs/unions}, for details.
2249
2250 Note that this option is off for all targets except for x86
2251 targets using ms-abi.
2252
2253 @item -fplan9-extensions
2254 @opindex fplan9-extensions
2255 Accept some non-standard constructs used in Plan 9 code.
2256
2257 This enables @option{-fms-extensions}, permits passing pointers to
2258 structures with anonymous fields to functions that expect pointers to
2259 elements of the type of the field, and permits referring to anonymous
2260 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2261 struct/union fields within structs/unions}, for details. This is only
2262 supported for C, not C++.
2263
2264 @item -fcond-mismatch
2265 @opindex fcond-mismatch
2266 Allow conditional expressions with mismatched types in the second and
2267 third arguments. The value of such an expression is void. This option
2268 is not supported for C++.
2269
2270 @item -flax-vector-conversions
2271 @opindex flax-vector-conversions
2272 Allow implicit conversions between vectors with differing numbers of
2273 elements and/or incompatible element types. This option should not be
2274 used for new code.
2275
2276 @item -funsigned-char
2277 @opindex funsigned-char
2278 Let the type @code{char} be unsigned, like @code{unsigned char}.
2279
2280 Each kind of machine has a default for what @code{char} should
2281 be. It is either like @code{unsigned char} by default or like
2282 @code{signed char} by default.
2283
2284 Ideally, a portable program should always use @code{signed char} or
2285 @code{unsigned char} when it depends on the signedness of an object.
2286 But many programs have been written to use plain @code{char} and
2287 expect it to be signed, or expect it to be unsigned, depending on the
2288 machines they were written for. This option, and its inverse, let you
2289 make such a program work with the opposite default.
2290
2291 The type @code{char} is always a distinct type from each of
2292 @code{signed char} or @code{unsigned char}, even though its behavior
2293 is always just like one of those two.
2294
2295 @item -fsigned-char
2296 @opindex fsigned-char
2297 Let the type @code{char} be signed, like @code{signed char}.
2298
2299 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2300 the negative form of @option{-funsigned-char}. Likewise, the option
2301 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2302
2303 @item -fsigned-bitfields
2304 @itemx -funsigned-bitfields
2305 @itemx -fno-signed-bitfields
2306 @itemx -fno-unsigned-bitfields
2307 @opindex fsigned-bitfields
2308 @opindex funsigned-bitfields
2309 @opindex fno-signed-bitfields
2310 @opindex fno-unsigned-bitfields
2311 These options control whether a bit-field is signed or unsigned, when the
2312 declaration does not use either @code{signed} or @code{unsigned}. By
2313 default, such a bit-field is signed, because this is consistent: the
2314 basic integer types such as @code{int} are signed types.
2315
2316 @item -fsso-struct=@var{endianness}
2317 @opindex fsso-struct
2318 Set the default scalar storage order of structures and unions to the
2319 specified endianness. The accepted values are @samp{big-endian},
2320 @samp{little-endian} and @samp{native} for the native endianness of
2321 the target (the default). This option is not supported for C++.
2322
2323 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2324 code that is not binary compatible with code generated without it if the
2325 specified endianness is not the native endianness of the target.
2326 @end table
2327
2328 @node C++ Dialect Options
2329 @section Options Controlling C++ Dialect
2330
2331 @cindex compiler options, C++
2332 @cindex C++ options, command-line
2333 @cindex options, C++
2334 This section describes the command-line options that are only meaningful
2335 for C++ programs. You can also use most of the GNU compiler options
2336 regardless of what language your program is in. For example, you
2337 might compile a file @file{firstClass.C} like this:
2338
2339 @smallexample
2340 g++ -g -fstrict-enums -O -c firstClass.C
2341 @end smallexample
2342
2343 @noindent
2344 In this example, only @option{-fstrict-enums} is an option meant
2345 only for C++ programs; you can use the other options with any
2346 language supported by GCC@.
2347
2348 Some options for compiling C programs, such as @option{-std}, are also
2349 relevant for C++ programs.
2350 @xref{C Dialect Options,,Options Controlling C Dialect}.
2351
2352 Here is a list of options that are @emph{only} for compiling C++ programs:
2353
2354 @table @gcctabopt
2355
2356 @item -fabi-version=@var{n}
2357 @opindex fabi-version
2358 Use version @var{n} of the C++ ABI@. The default is version 0.
2359
2360 Version 0 refers to the version conforming most closely to
2361 the C++ ABI specification. Therefore, the ABI obtained using version 0
2362 will change in different versions of G++ as ABI bugs are fixed.
2363
2364 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2365
2366 Version 2 is the version of the C++ ABI that first appeared in G++
2367 3.4, and was the default through G++ 4.9.
2368
2369 Version 3 corrects an error in mangling a constant address as a
2370 template argument.
2371
2372 Version 4, which first appeared in G++ 4.5, implements a standard
2373 mangling for vector types.
2374
2375 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2376 attribute const/volatile on function pointer types, decltype of a
2377 plain decl, and use of a function parameter in the declaration of
2378 another parameter.
2379
2380 Version 6, which first appeared in G++ 4.7, corrects the promotion
2381 behavior of C++11 scoped enums and the mangling of template argument
2382 packs, const/static_cast, prefix ++ and --, and a class scope function
2383 used as a template argument.
2384
2385 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2386 builtin type and corrects the mangling of lambdas in default argument
2387 scope.
2388
2389 Version 8, which first appeared in G++ 4.9, corrects the substitution
2390 behavior of function types with function-cv-qualifiers.
2391
2392 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2393 @code{nullptr_t}.
2394
2395 Version 10, which first appeared in G++ 6.1, adds mangling of
2396 attributes that affect type identity, such as ia32 calling convention
2397 attributes (e.g.@: @samp{stdcall}).
2398
2399 Version 11, which first appeared in G++ 7, corrects the mangling of
2400 sizeof... expressions and operator names. For multiple entities with
2401 the same name within a function, that are declared in different scopes,
2402 the mangling now changes starting with the twelfth occurrence. It also
2403 implies @option{-fnew-inheriting-ctors}.
2404
2405 Version 12, which first appeared in G++ 8, corrects the calling
2406 conventions for empty classes on the x86_64 target and for classes
2407 with only deleted copy/move constructors. It accidentally changes the
2408 calling convention for classes with a deleted copy constructor and a
2409 trivial move constructor.
2410
2411 Version 13, which first appeared in G++ 8.2, fixes the accidental
2412 change in version 12.
2413
2414 See also @option{-Wabi}.
2415
2416 @item -fabi-compat-version=@var{n}
2417 @opindex fabi-compat-version
2418 On targets that support strong aliases, G++
2419 works around mangling changes by creating an alias with the correct
2420 mangled name when defining a symbol with an incorrect mangled name.
2421 This switch specifies which ABI version to use for the alias.
2422
2423 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2424 compatibility). If another ABI version is explicitly selected, this
2425 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2426 use @option{-fabi-compat-version=2}.
2427
2428 If this option is not provided but @option{-Wabi=@var{n}} is, that
2429 version is used for compatibility aliases. If this option is provided
2430 along with @option{-Wabi} (without the version), the version from this
2431 option is used for the warning.
2432
2433 @item -fno-access-control
2434 @opindex fno-access-control
2435 @opindex faccess-control
2436 Turn off all access checking. This switch is mainly useful for working
2437 around bugs in the access control code.
2438
2439 @item -faligned-new
2440 @opindex faligned-new
2441 Enable support for C++17 @code{new} of types that require more
2442 alignment than @code{void* ::operator new(std::size_t)} provides. A
2443 numeric argument such as @code{-faligned-new=32} can be used to
2444 specify how much alignment (in bytes) is provided by that function,
2445 but few users will need to override the default of
2446 @code{alignof(std::max_align_t)}.
2447
2448 This flag is enabled by default for @option{-std=c++17}.
2449
2450 @item -fchar8_t
2451 @itemx -fno-char8_t
2452 @opindex fchar8_t
2453 @opindex fno-char8_t
2454 Enable support for @code{char8_t} as adopted for C++2a. This includes
2455 the addition of a new @code{char8_t} fundamental type, changes to the
2456 types of UTF-8 string and character literals, new signatures for
2457 user-defined literals, associated standard library updates, and new
2458 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2459
2460 This option enables functions to be overloaded for ordinary and UTF-8
2461 strings:
2462
2463 @smallexample
2464 int f(const char *); // #1
2465 int f(const char8_t *); // #2
2466 int v1 = f("text"); // Calls #1
2467 int v2 = f(u8"text"); // Calls #2
2468 @end smallexample
2469
2470 @noindent
2471 and introduces new signatures for user-defined literals:
2472
2473 @smallexample
2474 int operator""_udl1(char8_t);
2475 int v3 = u8'x'_udl1;
2476 int operator""_udl2(const char8_t*, std::size_t);
2477 int v4 = u8"text"_udl2;
2478 template<typename T, T...> int operator""_udl3();
2479 int v5 = u8"text"_udl3;
2480 @end smallexample
2481
2482 @noindent
2483 The change to the types of UTF-8 string and character literals introduces
2484 incompatibilities with ISO C++11 and later standards. For example, the
2485 following code is well-formed under ISO C++11, but is ill-formed when
2486 @option{-fchar8_t} is specified.
2487
2488 @smallexample
2489 char ca[] = u8"xx"; // error: char-array initialized from wide
2490 // string
2491 const char *cp = u8"xx";// error: invalid conversion from
2492 // `const char8_t*' to `const char*'
2493 int f(const char*);
2494 auto v = f(u8"xx"); // error: invalid conversion from
2495 // `const char8_t*' to `const char*'
2496 std::string s@{u8"xx"@}; // error: no matching function for call to
2497 // `std::basic_string<char>::basic_string()'
2498 using namespace std::literals;
2499 s = u8"xx"s; // error: conversion from
2500 // `basic_string<char8_t>' to non-scalar
2501 // type `basic_string<char>' requested
2502 @end smallexample
2503
2504 @item -fcheck-new
2505 @opindex fcheck-new
2506 Check that the pointer returned by @code{operator new} is non-null
2507 before attempting to modify the storage allocated. This check is
2508 normally unnecessary because the C++ standard specifies that
2509 @code{operator new} only returns @code{0} if it is declared
2510 @code{throw()}, in which case the compiler always checks the
2511 return value even without this option. In all other cases, when
2512 @code{operator new} has a non-empty exception specification, memory
2513 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2514 @samp{new (nothrow)}.
2515
2516 @item -fconcepts
2517 @itemx -fconcepts-ts
2518 @opindex fconcepts
2519 @opindex fconcepts-ts
2520 Below @option{-std=c++2a}, @option{-fconcepts} enables support for the
2521 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
2522
2523 With @option{-std=c++2a} and above, Concepts are part of the language
2524 standard, so @option{-fconcepts} defaults to on. But the standard
2525 specification of Concepts differs significantly from the TS, so some
2526 constructs that were allowed in the TS but didn't make it into the
2527 standard can still be enabled by @option{-fconcepts-ts}.
2528
2529 @item -fconstexpr-depth=@var{n}
2530 @opindex fconstexpr-depth
2531 Set the maximum nested evaluation depth for C++11 constexpr functions
2532 to @var{n}. A limit is needed to detect endless recursion during
2533 constant expression evaluation. The minimum specified by the standard
2534 is 512.
2535
2536 @item -fconstexpr-cache-depth=@var{n}
2537 @opindex fconstexpr-cache-depth
2538 Set the maximum level of nested evaluation depth for C++11 constexpr
2539 functions that will be cached to @var{n}. This is a heuristic that
2540 trades off compilation speed (when the cache avoids repeated
2541 calculations) against memory consumption (when the cache grows very
2542 large from highly recursive evaluations). The default is 8. Very few
2543 users are likely to want to adjust it, but if your code does heavy
2544 constexpr calculations you might want to experiment to find which
2545 value works best for you.
2546
2547 @item -fconstexpr-loop-limit=@var{n}
2548 @opindex fconstexpr-loop-limit
2549 Set the maximum number of iterations for a loop in C++14 constexpr functions
2550 to @var{n}. A limit is needed to detect infinite loops during
2551 constant expression evaluation. The default is 262144 (1<<18).
2552
2553 @item -fconstexpr-ops-limit=@var{n}
2554 @opindex fconstexpr-ops-limit
2555 Set the maximum number of operations during a single constexpr evaluation.
2556 Even when number of iterations of a single loop is limited with the above limit,
2557 if there are several nested loops and each of them has many iterations but still
2558 smaller than the above limit, or if in a body of some loop or even outside
2559 of a loop too many expressions need to be evaluated, the resulting constexpr
2560 evaluation might take too long.
2561 The default is 33554432 (1<<25).
2562
2563 @item -fno-elide-constructors
2564 @opindex fno-elide-constructors
2565 @opindex felide-constructors
2566 The C++ standard allows an implementation to omit creating a temporary
2567 that is only used to initialize another object of the same type.
2568 Specifying this option disables that optimization, and forces G++ to
2569 call the copy constructor in all cases. This option also causes G++
2570 to call trivial member functions which otherwise would be expanded inline.
2571
2572 In C++17, the compiler is required to omit these temporaries, but this
2573 option still affects trivial member functions.
2574
2575 @item -fno-enforce-eh-specs
2576 @opindex fno-enforce-eh-specs
2577 @opindex fenforce-eh-specs
2578 Don't generate code to check for violation of exception specifications
2579 at run time. This option violates the C++ standard, but may be useful
2580 for reducing code size in production builds, much like defining
2581 @code{NDEBUG}. This does not give user code permission to throw
2582 exceptions in violation of the exception specifications; the compiler
2583 still optimizes based on the specifications, so throwing an
2584 unexpected exception results in undefined behavior at run time.
2585
2586 @item -fextern-tls-init
2587 @itemx -fno-extern-tls-init
2588 @opindex fextern-tls-init
2589 @opindex fno-extern-tls-init
2590 The C++11 and OpenMP standards allow @code{thread_local} and
2591 @code{threadprivate} variables to have dynamic (runtime)
2592 initialization. To support this, any use of such a variable goes
2593 through a wrapper function that performs any necessary initialization.
2594 When the use and definition of the variable are in the same
2595 translation unit, this overhead can be optimized away, but when the
2596 use is in a different translation unit there is significant overhead
2597 even if the variable doesn't actually need dynamic initialization. If
2598 the programmer can be sure that no use of the variable in a
2599 non-defining TU needs to trigger dynamic initialization (either
2600 because the variable is statically initialized, or a use of the
2601 variable in the defining TU will be executed before any uses in
2602 another TU), they can avoid this overhead with the
2603 @option{-fno-extern-tls-init} option.
2604
2605 On targets that support symbol aliases, the default is
2606 @option{-fextern-tls-init}. On targets that do not support symbol
2607 aliases, the default is @option{-fno-extern-tls-init}.
2608
2609 @item -fno-gnu-keywords
2610 @opindex fno-gnu-keywords
2611 @opindex fgnu-keywords
2612 Do not recognize @code{typeof} as a keyword, so that code can use this
2613 word as an identifier. You can use the keyword @code{__typeof__} instead.
2614 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2615 @option{-std=c++98}, @option{-std=c++11}, etc.
2616
2617 @item -fno-implicit-templates
2618 @opindex fno-implicit-templates
2619 @opindex fimplicit-templates
2620 Never emit code for non-inline templates that are instantiated
2621 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2622 If you use this option, you must take care to structure your code to
2623 include all the necessary explicit instantiations to avoid getting
2624 undefined symbols at link time.
2625 @xref{Template Instantiation}, for more information.
2626
2627 @item -fno-implicit-inline-templates
2628 @opindex fno-implicit-inline-templates
2629 @opindex fimplicit-inline-templates
2630 Don't emit code for implicit instantiations of inline templates, either.
2631 The default is to handle inlines differently so that compiles with and
2632 without optimization need the same set of explicit instantiations.
2633
2634 @item -fno-implement-inlines
2635 @opindex fno-implement-inlines
2636 @opindex fimplement-inlines
2637 To save space, do not emit out-of-line copies of inline functions
2638 controlled by @code{#pragma implementation}. This causes linker
2639 errors if these functions are not inlined everywhere they are called.
2640
2641 @item -fms-extensions
2642 @opindex fms-extensions
2643 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2644 int and getting a pointer to member function via non-standard syntax.
2645
2646 @item -fnew-inheriting-ctors
2647 @opindex fnew-inheriting-ctors
2648 Enable the P0136 adjustment to the semantics of C++11 constructor
2649 inheritance. This is part of C++17 but also considered to be a Defect
2650 Report against C++11 and C++14. This flag is enabled by default
2651 unless @option{-fabi-version=10} or lower is specified.
2652
2653 @item -fnew-ttp-matching
2654 @opindex fnew-ttp-matching
2655 Enable the P0522 resolution to Core issue 150, template template
2656 parameters and default arguments: this allows a template with default
2657 template arguments as an argument for a template template parameter
2658 with fewer template parameters. This flag is enabled by default for
2659 @option{-std=c++17}.
2660
2661 @item -fno-nonansi-builtins
2662 @opindex fno-nonansi-builtins
2663 @opindex fnonansi-builtins
2664 Disable built-in declarations of functions that are not mandated by
2665 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2666 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2667
2668 @item -fnothrow-opt
2669 @opindex fnothrow-opt
2670 Treat a @code{throw()} exception specification as if it were a
2671 @code{noexcept} specification to reduce or eliminate the text size
2672 overhead relative to a function with no exception specification. If
2673 the function has local variables of types with non-trivial
2674 destructors, the exception specification actually makes the
2675 function smaller because the EH cleanups for those variables can be
2676 optimized away. The semantic effect is that an exception thrown out of
2677 a function with such an exception specification results in a call
2678 to @code{terminate} rather than @code{unexpected}.
2679
2680 @item -fno-operator-names
2681 @opindex fno-operator-names
2682 @opindex foperator-names
2683 Do not treat the operator name keywords @code{and}, @code{bitand},
2684 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2685 synonyms as keywords.
2686
2687 @item -fno-optional-diags
2688 @opindex fno-optional-diags
2689 @opindex foptional-diags
2690 Disable diagnostics that the standard says a compiler does not need to
2691 issue. Currently, the only such diagnostic issued by G++ is the one for
2692 a name having multiple meanings within a class.
2693
2694 @item -fpermissive
2695 @opindex fpermissive
2696 Downgrade some diagnostics about nonconformant code from errors to
2697 warnings. Thus, using @option{-fpermissive} allows some
2698 nonconforming code to compile.
2699
2700 @item -fno-pretty-templates
2701 @opindex fno-pretty-templates
2702 @opindex fpretty-templates
2703 When an error message refers to a specialization of a function
2704 template, the compiler normally prints the signature of the
2705 template followed by the template arguments and any typedefs or
2706 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2707 rather than @code{void f(int)}) so that it's clear which template is
2708 involved. When an error message refers to a specialization of a class
2709 template, the compiler omits any template arguments that match
2710 the default template arguments for that template. If either of these
2711 behaviors make it harder to understand the error message rather than
2712 easier, you can use @option{-fno-pretty-templates} to disable them.
2713
2714 @item -fno-rtti
2715 @opindex fno-rtti
2716 @opindex frtti
2717 Disable generation of information about every class with virtual
2718 functions for use by the C++ run-time type identification features
2719 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2720 of the language, you can save some space by using this flag. Note that
2721 exception handling uses the same information, but G++ generates it as
2722 needed. The @code{dynamic_cast} operator can still be used for casts that
2723 do not require run-time type information, i.e.@: casts to @code{void *} or to
2724 unambiguous base classes.
2725
2726 Mixing code compiled with @option{-frtti} with that compiled with
2727 @option{-fno-rtti} may not work. For example, programs may
2728 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2729 for a class compiled with @option{-frtti}.
2730
2731 @item -fsized-deallocation
2732 @opindex fsized-deallocation
2733 Enable the built-in global declarations
2734 @smallexample
2735 void operator delete (void *, std::size_t) noexcept;
2736 void operator delete[] (void *, std::size_t) noexcept;
2737 @end smallexample
2738 as introduced in C++14. This is useful for user-defined replacement
2739 deallocation functions that, for example, use the size of the object
2740 to make deallocation faster. Enabled by default under
2741 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2742 warns about places that might want to add a definition.
2743
2744 @item -fstrict-enums
2745 @opindex fstrict-enums
2746 Allow the compiler to optimize using the assumption that a value of
2747 enumerated type can only be one of the values of the enumeration (as
2748 defined in the C++ standard; basically, a value that can be
2749 represented in the minimum number of bits needed to represent all the
2750 enumerators). This assumption may not be valid if the program uses a
2751 cast to convert an arbitrary integer value to the enumerated type.
2752
2753 @item -fstrong-eval-order
2754 @opindex fstrong-eval-order
2755 Evaluate member access, array subscripting, and shift expressions in
2756 left-to-right order, and evaluate assignment in right-to-left order,
2757 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2758 @option{-fstrong-eval-order=some} enables just the ordering of member
2759 access and shift expressions, and is the default without
2760 @option{-std=c++17}.
2761
2762 @item -ftemplate-backtrace-limit=@var{n}
2763 @opindex ftemplate-backtrace-limit
2764 Set the maximum number of template instantiation notes for a single
2765 warning or error to @var{n}. The default value is 10.
2766
2767 @item -ftemplate-depth=@var{n}
2768 @opindex ftemplate-depth
2769 Set the maximum instantiation depth for template classes to @var{n}.
2770 A limit on the template instantiation depth is needed to detect
2771 endless recursions during template class instantiation. ANSI/ISO C++
2772 conforming programs must not rely on a maximum depth greater than 17
2773 (changed to 1024 in C++11). The default value is 900, as the compiler
2774 can run out of stack space before hitting 1024 in some situations.
2775
2776 @item -fno-threadsafe-statics
2777 @opindex fno-threadsafe-statics
2778 @opindex fthreadsafe-statics
2779 Do not emit the extra code to use the routines specified in the C++
2780 ABI for thread-safe initialization of local statics. You can use this
2781 option to reduce code size slightly in code that doesn't need to be
2782 thread-safe.
2783
2784 @item -fuse-cxa-atexit
2785 @opindex fuse-cxa-atexit
2786 Register destructors for objects with static storage duration with the
2787 @code{__cxa_atexit} function rather than the @code{atexit} function.
2788 This option is required for fully standards-compliant handling of static
2789 destructors, but only works if your C library supports
2790 @code{__cxa_atexit}.
2791
2792 @item -fno-use-cxa-get-exception-ptr
2793 @opindex fno-use-cxa-get-exception-ptr
2794 @opindex fuse-cxa-get-exception-ptr
2795 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2796 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2797 if the runtime routine is not available.
2798
2799 @item -fvisibility-inlines-hidden
2800 @opindex fvisibility-inlines-hidden
2801 This switch declares that the user does not attempt to compare
2802 pointers to inline functions or methods where the addresses of the two functions
2803 are taken in different shared objects.
2804
2805 The effect of this is that GCC may, effectively, mark inline methods with
2806 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2807 appear in the export table of a DSO and do not require a PLT indirection
2808 when used within the DSO@. Enabling this option can have a dramatic effect
2809 on load and link times of a DSO as it massively reduces the size of the
2810 dynamic export table when the library makes heavy use of templates.
2811
2812 The behavior of this switch is not quite the same as marking the
2813 methods as hidden directly, because it does not affect static variables
2814 local to the function or cause the compiler to deduce that
2815 the function is defined in only one shared object.
2816
2817 You may mark a method as having a visibility explicitly to negate the
2818 effect of the switch for that method. For example, if you do want to
2819 compare pointers to a particular inline method, you might mark it as
2820 having default visibility. Marking the enclosing class with explicit
2821 visibility has no effect.
2822
2823 Explicitly instantiated inline methods are unaffected by this option
2824 as their linkage might otherwise cross a shared library boundary.
2825 @xref{Template Instantiation}.
2826
2827 @item -fvisibility-ms-compat
2828 @opindex fvisibility-ms-compat
2829 This flag attempts to use visibility settings to make GCC's C++
2830 linkage model compatible with that of Microsoft Visual Studio.
2831
2832 The flag makes these changes to GCC's linkage model:
2833
2834 @enumerate
2835 @item
2836 It sets the default visibility to @code{hidden}, like
2837 @option{-fvisibility=hidden}.
2838
2839 @item
2840 Types, but not their members, are not hidden by default.
2841
2842 @item
2843 The One Definition Rule is relaxed for types without explicit
2844 visibility specifications that are defined in more than one
2845 shared object: those declarations are permitted if they are
2846 permitted when this option is not used.
2847 @end enumerate
2848
2849 In new code it is better to use @option{-fvisibility=hidden} and
2850 export those classes that are intended to be externally visible.
2851 Unfortunately it is possible for code to rely, perhaps accidentally,
2852 on the Visual Studio behavior.
2853
2854 Among the consequences of these changes are that static data members
2855 of the same type with the same name but defined in different shared
2856 objects are different, so changing one does not change the other;
2857 and that pointers to function members defined in different shared
2858 objects may not compare equal. When this flag is given, it is a
2859 violation of the ODR to define types with the same name differently.
2860
2861 @item -fno-weak
2862 @opindex fno-weak
2863 @opindex fweak
2864 Do not use weak symbol support, even if it is provided by the linker.
2865 By default, G++ uses weak symbols if they are available. This
2866 option exists only for testing, and should not be used by end-users;
2867 it results in inferior code and has no benefits. This option may
2868 be removed in a future release of G++.
2869
2870 @item -nostdinc++
2871 @opindex nostdinc++
2872 Do not search for header files in the standard directories specific to
2873 C++, but do still search the other standard directories. (This option
2874 is used when building the C++ library.)
2875 @end table
2876
2877 In addition, these optimization, warning, and code generation options
2878 have meanings only for C++ programs:
2879
2880 @table @gcctabopt
2881 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2882 @opindex Wabi
2883 @opindex Wno-abi
2884 Warn when G++ it generates code that is probably not compatible with
2885 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2886 ABI with each major release, normally @option{-Wabi} will warn only if
2887 there is a check added later in a release series for an ABI issue
2888 discovered since the initial release. @option{-Wabi} will warn about
2889 more things if an older ABI version is selected (with
2890 @option{-fabi-version=@var{n}}).
2891
2892 @option{-Wabi} can also be used with an explicit version number to
2893 warn about compatibility with a particular @option{-fabi-version}
2894 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2895 @option{-fabi-version=2}.
2896
2897 If an explicit version number is provided and
2898 @option{-fabi-compat-version} is not specified, the version number
2899 from this option is used for compatibility aliases. If no explicit
2900 version number is provided with this option, but
2901 @option{-fabi-compat-version} is specified, that version number is
2902 used for ABI warnings.
2903
2904 Although an effort has been made to warn about
2905 all such cases, there are probably some cases that are not warned about,
2906 even though G++ is generating incompatible code. There may also be
2907 cases where warnings are emitted even though the code that is generated
2908 is compatible.
2909
2910 You should rewrite your code to avoid these warnings if you are
2911 concerned about the fact that code generated by G++ may not be binary
2912 compatible with code generated by other compilers.
2913
2914 Known incompatibilities in @option{-fabi-version=2} (which was the
2915 default from GCC 3.4 to 4.9) include:
2916
2917 @itemize @bullet
2918
2919 @item
2920 A template with a non-type template parameter of reference type was
2921 mangled incorrectly:
2922 @smallexample
2923 extern int N;
2924 template <int &> struct S @{@};
2925 void n (S<N>) @{2@}
2926 @end smallexample
2927
2928 This was fixed in @option{-fabi-version=3}.
2929
2930 @item
2931 SIMD vector types declared using @code{__attribute ((vector_size))} were
2932 mangled in a non-standard way that does not allow for overloading of
2933 functions taking vectors of different sizes.
2934
2935 The mangling was changed in @option{-fabi-version=4}.
2936
2937 @item
2938 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2939 qualifiers, and @code{decltype} of a plain declaration was folded away.
2940
2941 These mangling issues were fixed in @option{-fabi-version=5}.
2942
2943 @item
2944 Scoped enumerators passed as arguments to a variadic function are
2945 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2946 On most targets this does not actually affect the parameter passing
2947 ABI, as there is no way to pass an argument smaller than @code{int}.
2948
2949 Also, the ABI changed the mangling of template argument packs,
2950 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2951 a class scope function used as a template argument.
2952
2953 These issues were corrected in @option{-fabi-version=6}.
2954
2955 @item
2956 Lambdas in default argument scope were mangled incorrectly, and the
2957 ABI changed the mangling of @code{nullptr_t}.
2958
2959 These issues were corrected in @option{-fabi-version=7}.
2960
2961 @item
2962 When mangling a function type with function-cv-qualifiers, the
2963 un-qualified function type was incorrectly treated as a substitution
2964 candidate.
2965
2966 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2967
2968 @item
2969 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2970 unaligned accesses. Note that this did not affect the ABI of a
2971 function with a @code{nullptr_t} parameter, as parameters have a
2972 minimum alignment.
2973
2974 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2975
2976 @item
2977 Target-specific attributes that affect the identity of a type, such as
2978 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2979 did not affect the mangled name, leading to name collisions when
2980 function pointers were used as template arguments.
2981
2982 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2983
2984 @end itemize
2985
2986 It also warns about psABI-related changes. The known psABI changes at this
2987 point include:
2988
2989 @itemize @bullet
2990
2991 @item
2992 For SysV/x86-64, unions with @code{long double} members are
2993 passed in memory as specified in psABI. For example:
2994
2995 @smallexample
2996 union U @{
2997 long double ld;
2998 int i;
2999 @};
3000 @end smallexample
3001
3002 @noindent
3003 @code{union U} is always passed in memory.
3004
3005 @end itemize
3006
3007 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3008 @opindex Wabi-tag
3009 @opindex Wabi-tag
3010 Warn when a type with an ABI tag is used in a context that does not
3011 have that ABI tag. See @ref{C++ Attributes} for more information
3012 about ABI tags.
3013
3014 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3015 @opindex Wcomma-subscript
3016 @opindex Wno-comma-subscript
3017 Warn about uses of a comma expression within a subscripting expression.
3018 This usage was deprecated in C++2a. However, a comma expression wrapped
3019 in @code{( )} is not deprecated. Example:
3020
3021 @smallexample
3022 @group
3023 void f(int *a, int b, int c) @{
3024 a[b,c]; // deprecated
3025 a[(b,c)]; // OK
3026 @}
3027 @end group
3028 @end smallexample
3029
3030 Enabled by default with @option{-std=c++2a}.
3031
3032 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3033 @opindex Wctor-dtor-privacy
3034 @opindex Wno-ctor-dtor-privacy
3035 Warn when a class seems unusable because all the constructors or
3036 destructors in that class are private, and it has neither friends nor
3037 public static member functions. Also warn if there are no non-private
3038 methods, and there's at least one private member function that isn't
3039 a constructor or destructor.
3040
3041 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3042 @opindex Wdelete-non-virtual-dtor
3043 @opindex Wno-delete-non-virtual-dtor
3044 Warn when @code{delete} is used to destroy an instance of a class that
3045 has virtual functions and non-virtual destructor. It is unsafe to delete
3046 an instance of a derived class through a pointer to a base class if the
3047 base class does not have a virtual destructor. This warning is enabled
3048 by @option{-Wall}.
3049
3050 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3051 @opindex Wdeprecated-copy
3052 @opindex Wno-deprecated-copy
3053 Warn that the implicit declaration of a copy constructor or copy
3054 assignment operator is deprecated if the class has a user-provided
3055 copy constructor or copy assignment operator, in C++11 and up. This
3056 warning is enabled by @option{-Wextra}. With
3057 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3058 user-provided destructor.
3059
3060 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3061 @opindex Winit-list-lifetime
3062 @opindex Wno-init-list-lifetime
3063 Do not warn about uses of @code{std::initializer_list} that are likely
3064 to result in dangling pointers. Since the underlying array for an
3065 @code{initializer_list} is handled like a normal C++ temporary object,
3066 it is easy to inadvertently keep a pointer to the array past the end
3067 of the array's lifetime. For example:
3068
3069 @itemize @bullet
3070 @item
3071 If a function returns a temporary @code{initializer_list}, or a local
3072 @code{initializer_list} variable, the array's lifetime ends at the end
3073 of the return statement, so the value returned has a dangling pointer.
3074
3075 @item
3076 If a new-expression creates an @code{initializer_list}, the array only
3077 lives until the end of the enclosing full-expression, so the
3078 @code{initializer_list} in the heap has a dangling pointer.
3079
3080 @item
3081 When an @code{initializer_list} variable is assigned from a
3082 brace-enclosed initializer list, the temporary array created for the
3083 right side of the assignment only lives until the end of the
3084 full-expression, so at the next statement the @code{initializer_list}
3085 variable has a dangling pointer.
3086
3087 @smallexample
3088 // li's initial underlying array lives as long as li
3089 std::initializer_list<int> li = @{ 1,2,3 @};
3090 // assignment changes li to point to a temporary array
3091 li = @{ 4, 5 @};
3092 // now the temporary is gone and li has a dangling pointer
3093 int i = li.begin()[0] // undefined behavior
3094 @end smallexample
3095
3096 @item
3097 When a list constructor stores the @code{begin} pointer from the
3098 @code{initializer_list} argument, this doesn't extend the lifetime of
3099 the array, so if a class variable is constructed from a temporary
3100 @code{initializer_list}, the pointer is left dangling by the end of
3101 the variable declaration statement.
3102
3103 @end itemize
3104
3105 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3106 @opindex Wliteral-suffix
3107 @opindex Wno-literal-suffix
3108 Warn when a string or character literal is followed by a ud-suffix which does
3109 not begin with an underscore. As a conforming extension, GCC treats such
3110 suffixes as separate preprocessing tokens in order to maintain backwards
3111 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3112 For example:
3113
3114 @smallexample
3115 #define __STDC_FORMAT_MACROS
3116 #include <inttypes.h>
3117 #include <stdio.h>
3118
3119 int main() @{
3120 int64_t i64 = 123;
3121 printf("My int64: %" PRId64"\n", i64);
3122 @}
3123 @end smallexample
3124
3125 In this case, @code{PRId64} is treated as a separate preprocessing token.
3126
3127 Additionally, warn when a user-defined literal operator is declared with
3128 a literal suffix identifier that doesn't begin with an underscore. Literal
3129 suffix identifiers that don't begin with an underscore are reserved for
3130 future standardization.
3131
3132 This warning is enabled by default.
3133
3134 @item -Wlto-type-mismatch
3135 @opindex Wlto-type-mismatch
3136 @opindex Wno-lto-type-mismatch
3137
3138 During the link-time optimization warn about type mismatches in
3139 global declarations from different compilation units.
3140 Requires @option{-flto} to be enabled. Enabled by default.
3141
3142 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3143 @opindex Wnarrowing
3144 @opindex Wno-narrowing
3145 For C++11 and later standards, narrowing conversions are diagnosed by default,
3146 as required by the standard. A narrowing conversion from a constant produces
3147 an error, and a narrowing conversion from a non-constant produces a warning,
3148 but @option{-Wno-narrowing} suppresses the diagnostic.
3149 Note that this does not affect the meaning of well-formed code;
3150 narrowing conversions are still considered ill-formed in SFINAE contexts.
3151
3152 With @option{-Wnarrowing} in C++98, warn when a narrowing
3153 conversion prohibited by C++11 occurs within
3154 @samp{@{ @}}, e.g.
3155
3156 @smallexample
3157 int i = @{ 2.2 @}; // error: narrowing from double to int
3158 @end smallexample
3159
3160 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3161
3162 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3163 @opindex Wnoexcept
3164 @opindex Wno-noexcept
3165 Warn when a noexcept-expression evaluates to false because of a call
3166 to a function that does not have a non-throwing exception
3167 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3168 the compiler to never throw an exception.
3169
3170 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3171 @opindex Wnoexcept-type
3172 @opindex Wno-noexcept-type
3173 Warn if the C++17 feature making @code{noexcept} part of a function
3174 type changes the mangled name of a symbol relative to C++14. Enabled
3175 by @option{-Wabi} and @option{-Wc++17-compat}.
3176
3177 As an example:
3178
3179 @smallexample
3180 template <class T> void f(T t) @{ t(); @};
3181 void g() noexcept;
3182 void h() @{ f(g); @}
3183 @end smallexample
3184
3185 @noindent
3186 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3187 C++17 it calls @code{f<void(*)()noexcept>}.
3188
3189 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3190 @opindex Wclass-memaccess
3191 @opindex Wno-class-memaccess
3192 Warn when the destination of a call to a raw memory function such as
3193 @code{memset} or @code{memcpy} is an object of class type, and when writing
3194 into such an object might bypass the class non-trivial or deleted constructor
3195 or copy assignment, violate const-correctness or encapsulation, or corrupt
3196 virtual table pointers. Modifying the representation of such objects may
3197 violate invariants maintained by member functions of the class. For example,
3198 the call to @code{memset} below is undefined because it modifies a non-trivial
3199 class object and is, therefore, diagnosed. The safe way to either initialize
3200 or clear the storage of objects of such types is by using the appropriate
3201 constructor or assignment operator, if one is available.
3202 @smallexample
3203 std::string str = "abc";
3204 memset (&str, 0, sizeof str);
3205 @end smallexample
3206 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3207 Explicitly casting the pointer to the class object to @code{void *} or
3208 to a type that can be safely accessed by the raw memory function suppresses
3209 the warning.
3210
3211 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3212 @opindex Wnon-virtual-dtor
3213 @opindex Wno-non-virtual-dtor
3214 Warn when a class has virtual functions and an accessible non-virtual
3215 destructor itself or in an accessible polymorphic base class, in which
3216 case it is possible but unsafe to delete an instance of a derived
3217 class through a pointer to the class itself or base class. This
3218 warning is automatically enabled if @option{-Weffc++} is specified.
3219
3220 @item -Wregister @r{(C++ and Objective-C++ only)}
3221 @opindex Wregister
3222 @opindex Wno-register
3223 Warn on uses of the @code{register} storage class specifier, except
3224 when it is part of the GNU @ref{Explicit Register Variables} extension.
3225 The use of the @code{register} keyword as storage class specifier has
3226 been deprecated in C++11 and removed in C++17.
3227 Enabled by default with @option{-std=c++17}.
3228
3229 @item -Wreorder @r{(C++ and Objective-C++ only)}
3230 @opindex Wreorder
3231 @opindex Wno-reorder
3232 @cindex reordering, warning
3233 @cindex warning for reordering of member initializers
3234 Warn when the order of member initializers given in the code does not
3235 match the order in which they must be executed. For instance:
3236
3237 @smallexample
3238 struct A @{
3239 int i;
3240 int j;
3241 A(): j (0), i (1) @{ @}
3242 @};
3243 @end smallexample
3244
3245 @noindent
3246 The compiler rearranges the member initializers for @code{i}
3247 and @code{j} to match the declaration order of the members, emitting
3248 a warning to that effect. This warning is enabled by @option{-Wall}.
3249
3250 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3251 @opindex Wpessimizing-move
3252 @opindex Wno-pessimizing-move
3253 This warning warns when a call to @code{std::move} prevents copy
3254 elision. A typical scenario when copy elision can occur is when returning in
3255 a function with a class return type, when the expression being returned is the
3256 name of a non-volatile automatic object, and is not a function parameter, and
3257 has the same type as the function return type.
3258
3259 @smallexample
3260 struct T @{
3261 @dots{}
3262 @};
3263 T fn()
3264 @{
3265 T t;
3266 @dots{}
3267 return std::move (t);
3268 @}
3269 @end smallexample
3270
3271 But in this example, the @code{std::move} call prevents copy elision.
3272
3273 This warning is enabled by @option{-Wall}.
3274
3275 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3276 @opindex Wredundant-move
3277 @opindex Wno-redundant-move
3278 This warning warns about redundant calls to @code{std::move}; that is, when
3279 a move operation would have been performed even without the @code{std::move}
3280 call. This happens because the compiler is forced to treat the object as if
3281 it were an rvalue in certain situations such as returning a local variable,
3282 where copy elision isn't applicable. Consider:
3283
3284 @smallexample
3285 struct T @{
3286 @dots{}
3287 @};
3288 T fn(T t)
3289 @{
3290 @dots{}
3291 return std::move (t);
3292 @}
3293 @end smallexample
3294
3295 Here, the @code{std::move} call is redundant. Because G++ implements Core
3296 Issue 1579, another example is:
3297
3298 @smallexample
3299 struct T @{ // convertible to U
3300 @dots{}
3301 @};
3302 struct U @{
3303 @dots{}
3304 @};
3305 U fn()
3306 @{
3307 T t;
3308 @dots{}
3309 return std::move (t);
3310 @}
3311 @end smallexample
3312 In this example, copy elision isn't applicable because the type of the
3313 expression being returned and the function return type differ, yet G++
3314 treats the return value as if it were designated by an rvalue.
3315
3316 This warning is enabled by @option{-Wextra}.
3317
3318 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3319 @opindex fext-numeric-literals
3320 @opindex fno-ext-numeric-literals
3321 Accept imaginary, fixed-point, or machine-defined
3322 literal number suffixes as GNU extensions.
3323 When this option is turned off these suffixes are treated
3324 as C++11 user-defined literal numeric suffixes.
3325 This is on by default for all pre-C++11 dialects and all GNU dialects:
3326 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3327 @option{-std=gnu++14}.
3328 This option is off by default
3329 for ISO C++11 onwards (@option{-std=c++11}, ...).
3330 @end table
3331
3332 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3333
3334 @table @gcctabopt
3335 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3336 @opindex Weffc++
3337 @opindex Wno-effc++
3338 Warn about violations of the following style guidelines from Scott Meyers'
3339 @cite{Effective C++} series of books:
3340
3341 @itemize @bullet
3342 @item
3343 Define a copy constructor and an assignment operator for classes
3344 with dynamically-allocated memory.
3345
3346 @item
3347 Prefer initialization to assignment in constructors.
3348
3349 @item
3350 Have @code{operator=} return a reference to @code{*this}.
3351
3352 @item
3353 Don't try to return a reference when you must return an object.
3354
3355 @item
3356 Distinguish between prefix and postfix forms of increment and
3357 decrement operators.
3358
3359 @item
3360 Never overload @code{&&}, @code{||}, or @code{,}.
3361
3362 @end itemize
3363
3364 This option also enables @option{-Wnon-virtual-dtor}, which is also
3365 one of the effective C++ recommendations. However, the check is
3366 extended to warn about the lack of virtual destructor in accessible
3367 non-polymorphic bases classes too.
3368
3369 When selecting this option, be aware that the standard library
3370 headers do not obey all of these guidelines; use @samp{grep -v}
3371 to filter out those warnings.
3372
3373 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3374 @opindex Wstrict-null-sentinel
3375 @opindex Wno-strict-null-sentinel
3376 Warn about the use of an uncasted @code{NULL} as sentinel. When
3377 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3378 to @code{__null}. Although it is a null pointer constant rather than a
3379 null pointer, it is guaranteed to be of the same size as a pointer.
3380 But this use is not portable across different compilers.
3381
3382 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3383 @opindex Wno-non-template-friend
3384 @opindex Wnon-template-friend
3385 Disable warnings when non-template friend functions are declared
3386 within a template. In very old versions of GCC that predate implementation
3387 of the ISO standard, declarations such as
3388 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3389 could be interpreted as a particular specialization of a template
3390 function; the warning exists to diagnose compatibility problems,
3391 and is enabled by default.
3392
3393 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3394 @opindex Wold-style-cast
3395 @opindex Wno-old-style-cast
3396 Warn if an old-style (C-style) cast to a non-void type is used within
3397 a C++ program. The new-style casts (@code{dynamic_cast},
3398 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3399 less vulnerable to unintended effects and much easier to search for.
3400
3401 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3402 @opindex Woverloaded-virtual
3403 @opindex Wno-overloaded-virtual
3404 @cindex overloaded virtual function, warning
3405 @cindex warning for overloaded virtual function
3406 Warn when a function declaration hides virtual functions from a
3407 base class. For example, in:
3408
3409 @smallexample
3410 struct A @{
3411 virtual void f();
3412 @};
3413
3414 struct B: public A @{
3415 void f(int);
3416 @};
3417 @end smallexample
3418
3419 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3420 like:
3421
3422 @smallexample
3423 B* b;
3424 b->f();
3425 @end smallexample
3426
3427 @noindent
3428 fails to compile.
3429
3430 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3431 @opindex Wno-pmf-conversions
3432 @opindex Wpmf-conversions
3433 Disable the diagnostic for converting a bound pointer to member function
3434 to a plain pointer.
3435
3436 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3437 @opindex Wsign-promo
3438 @opindex Wno-sign-promo
3439 Warn when overload resolution chooses a promotion from unsigned or
3440 enumerated type to a signed type, over a conversion to an unsigned type of
3441 the same size. Previous versions of G++ tried to preserve
3442 unsignedness, but the standard mandates the current behavior.
3443
3444 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3445 @opindex Wtemplates
3446 @opindex Wno-templates
3447 Warn when a primary template declaration is encountered. Some coding
3448 rules disallow templates, and this may be used to enforce that rule.
3449 The warning is inactive inside a system header file, such as the STL, so
3450 one can still use the STL. One may also instantiate or specialize
3451 templates.
3452
3453 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3454 @opindex Wmultiple-inheritance
3455 @opindex Wno-multiple-inheritance
3456 Warn when a class is defined with multiple direct base classes. Some
3457 coding rules disallow multiple inheritance, and this may be used to
3458 enforce that rule. The warning is inactive inside a system header file,
3459 such as the STL, so one can still use the STL. One may also define
3460 classes that indirectly use multiple inheritance.
3461
3462 @item -Wvirtual-inheritance
3463 @opindex Wvirtual-inheritance
3464 @opindex Wno-virtual-inheritance
3465 Warn when a class is defined with a virtual direct base class. Some
3466 coding rules disallow multiple inheritance, and this may be used to
3467 enforce that rule. The warning is inactive inside a system header file,
3468 such as the STL, so one can still use the STL. One may also define
3469 classes that indirectly use virtual inheritance.
3470
3471 @item -Wnamespaces
3472 @opindex Wnamespaces
3473 @opindex Wno-namespaces
3474 Warn when a namespace definition is opened. Some coding rules disallow
3475 namespaces, and this may be used to enforce that rule. The warning is
3476 inactive inside a system header file, such as the STL, so one can still
3477 use the STL. One may also use using directives and qualified names.
3478
3479 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3480 @opindex Wterminate
3481 @opindex Wno-terminate
3482 Disable the warning about a throw-expression that will immediately
3483 result in a call to @code{terminate}.
3484
3485 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3486 @opindex Wno-class-conversion
3487 @opindex Wclass-conversion
3488 Disable the warning about the case when a conversion function converts an
3489 object to the same type, to a base class of that type, or to void; such
3490 a conversion function will never be called.
3491
3492 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3493 @opindex Wvolatile
3494 @opindex Wno-volatile
3495 Warn about deprecated uses of the @code{volatile} qualifier. This includes
3496 postfix and prefix @code{++} and @code{--} expressions of
3497 @code{volatile}-qualified types, using simple assignments where the left
3498 operand is a @code{volatile}-qualified non-class type for their value,
3499 compound assignments where the left operand is a @code{volatile}-qualified
3500 non-class type, @code{volatile}-qualified function return type,
3501 @code{volatile}-qualified parameter type, and structured bindings of a
3502 @code{volatile}-qualified type. This usage was deprecated in C++20.
3503
3504 Enabled by default with @option{-std=c++2a}.
3505 @end table
3506
3507 @node Objective-C and Objective-C++ Dialect Options
3508 @section Options Controlling Objective-C and Objective-C++ Dialects
3509
3510 @cindex compiler options, Objective-C and Objective-C++
3511 @cindex Objective-C and Objective-C++ options, command-line
3512 @cindex options, Objective-C and Objective-C++
3513 (NOTE: This manual does not describe the Objective-C and Objective-C++
3514 languages themselves. @xref{Standards,,Language Standards
3515 Supported by GCC}, for references.)
3516
3517 This section describes the command-line options that are only meaningful
3518 for Objective-C and Objective-C++ programs. You can also use most of
3519 the language-independent GNU compiler options.
3520 For example, you might compile a file @file{some_class.m} like this:
3521
3522 @smallexample
3523 gcc -g -fgnu-runtime -O -c some_class.m
3524 @end smallexample
3525
3526 @noindent
3527 In this example, @option{-fgnu-runtime} is an option meant only for
3528 Objective-C and Objective-C++ programs; you can use the other options with
3529 any language supported by GCC@.
3530
3531 Note that since Objective-C is an extension of the C language, Objective-C
3532 compilations may also use options specific to the C front-end (e.g.,
3533 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3534 C++-specific options (e.g., @option{-Wabi}).
3535
3536 Here is a list of options that are @emph{only} for compiling Objective-C
3537 and Objective-C++ programs:
3538
3539 @table @gcctabopt
3540 @item -fconstant-string-class=@var{class-name}
3541 @opindex fconstant-string-class
3542 Use @var{class-name} as the name of the class to instantiate for each
3543 literal string specified with the syntax @code{@@"@dots{}"}. The default
3544 class name is @code{NXConstantString} if the GNU runtime is being used, and
3545 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3546 @option{-fconstant-cfstrings} option, if also present, overrides the
3547 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3548 to be laid out as constant CoreFoundation strings.
3549
3550 @item -fgnu-runtime
3551 @opindex fgnu-runtime
3552 Generate object code compatible with the standard GNU Objective-C
3553 runtime. This is the default for most types of systems.
3554
3555 @item -fnext-runtime
3556 @opindex fnext-runtime
3557 Generate output compatible with the NeXT runtime. This is the default
3558 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3559 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3560 used.
3561
3562 @item -fno-nil-receivers
3563 @opindex fno-nil-receivers
3564 @opindex fnil-receivers
3565 Assume that all Objective-C message dispatches (@code{[receiver
3566 message:arg]}) in this translation unit ensure that the receiver is
3567 not @code{nil}. This allows for more efficient entry points in the
3568 runtime to be used. This option is only available in conjunction with
3569 the NeXT runtime and ABI version 0 or 1.
3570
3571 @item -fobjc-abi-version=@var{n}
3572 @opindex fobjc-abi-version
3573 Use version @var{n} of the Objective-C ABI for the selected runtime.
3574 This option is currently supported only for the NeXT runtime. In that
3575 case, Version 0 is the traditional (32-bit) ABI without support for
3576 properties and other Objective-C 2.0 additions. Version 1 is the
3577 traditional (32-bit) ABI with support for properties and other
3578 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3579 nothing is specified, the default is Version 0 on 32-bit target
3580 machines, and Version 2 on 64-bit target machines.
3581
3582 @item -fobjc-call-cxx-cdtors
3583 @opindex fobjc-call-cxx-cdtors
3584 For each Objective-C class, check if any of its instance variables is a
3585 C++ object with a non-trivial default constructor. If so, synthesize a
3586 special @code{- (id) .cxx_construct} instance method which runs
3587 non-trivial default constructors on any such instance variables, in order,
3588 and then return @code{self}. Similarly, check if any instance variable
3589 is a C++ object with a non-trivial destructor, and if so, synthesize a
3590 special @code{- (void) .cxx_destruct} method which runs
3591 all such default destructors, in reverse order.
3592
3593 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3594 methods thusly generated only operate on instance variables
3595 declared in the current Objective-C class, and not those inherited
3596 from superclasses. It is the responsibility of the Objective-C
3597 runtime to invoke all such methods in an object's inheritance
3598 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3599 by the runtime immediately after a new object instance is allocated;
3600 the @code{- (void) .cxx_destruct} methods are invoked immediately
3601 before the runtime deallocates an object instance.
3602
3603 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3604 support for invoking the @code{- (id) .cxx_construct} and
3605 @code{- (void) .cxx_destruct} methods.
3606
3607 @item -fobjc-direct-dispatch
3608 @opindex fobjc-direct-dispatch
3609 Allow fast jumps to the message dispatcher. On Darwin this is
3610 accomplished via the comm page.
3611
3612 @item -fobjc-exceptions
3613 @opindex fobjc-exceptions
3614 Enable syntactic support for structured exception handling in
3615 Objective-C, similar to what is offered by C++. This option
3616 is required to use the Objective-C keywords @code{@@try},
3617 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3618 @code{@@synchronized}. This option is available with both the GNU
3619 runtime and the NeXT runtime (but not available in conjunction with
3620 the NeXT runtime on Mac OS X 10.2 and earlier).
3621
3622 @item -fobjc-gc
3623 @opindex fobjc-gc
3624 Enable garbage collection (GC) in Objective-C and Objective-C++
3625 programs. This option is only available with the NeXT runtime; the
3626 GNU runtime has a different garbage collection implementation that
3627 does not require special compiler flags.
3628
3629 @item -fobjc-nilcheck
3630 @opindex fobjc-nilcheck
3631 For the NeXT runtime with version 2 of the ABI, check for a nil
3632 receiver in method invocations before doing the actual method call.
3633 This is the default and can be disabled using
3634 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3635 checked for nil in this way no matter what this flag is set to.
3636 Currently this flag does nothing when the GNU runtime, or an older
3637 version of the NeXT runtime ABI, is used.
3638
3639 @item -fobjc-std=objc1
3640 @opindex fobjc-std
3641 Conform to the language syntax of Objective-C 1.0, the language
3642 recognized by GCC 4.0. This only affects the Objective-C additions to
3643 the C/C++ language; it does not affect conformance to C/C++ standards,
3644 which is controlled by the separate C/C++ dialect option flags. When
3645 this option is used with the Objective-C or Objective-C++ compiler,
3646 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3647 This is useful if you need to make sure that your Objective-C code can
3648 be compiled with older versions of GCC@.
3649
3650 @item -freplace-objc-classes
3651 @opindex freplace-objc-classes
3652 Emit a special marker instructing @command{ld(1)} not to statically link in
3653 the resulting object file, and allow @command{dyld(1)} to load it in at
3654 run time instead. This is used in conjunction with the Fix-and-Continue
3655 debugging mode, where the object file in question may be recompiled and
3656 dynamically reloaded in the course of program execution, without the need
3657 to restart the program itself. Currently, Fix-and-Continue functionality
3658 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3659 and later.
3660
3661 @item -fzero-link
3662 @opindex fzero-link
3663 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3664 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3665 compile time) with static class references that get initialized at load time,
3666 which improves run-time performance. Specifying the @option{-fzero-link} flag
3667 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3668 to be retained. This is useful in Zero-Link debugging mode, since it allows
3669 for individual class implementations to be modified during program execution.
3670 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3671 regardless of command-line options.
3672
3673 @item -fno-local-ivars
3674 @opindex fno-local-ivars
3675 @opindex flocal-ivars
3676 By default instance variables in Objective-C can be accessed as if
3677 they were local variables from within the methods of the class they're
3678 declared in. This can lead to shadowing between instance variables
3679 and other variables declared either locally inside a class method or
3680 globally with the same name. Specifying the @option{-fno-local-ivars}
3681 flag disables this behavior thus avoiding variable shadowing issues.
3682
3683 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3684 @opindex fivar-visibility
3685 Set the default instance variable visibility to the specified option
3686 so that instance variables declared outside the scope of any access
3687 modifier directives default to the specified visibility.
3688
3689 @item -gen-decls
3690 @opindex gen-decls
3691 Dump interface declarations for all classes seen in the source file to a
3692 file named @file{@var{sourcename}.decl}.
3693
3694 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3695 @opindex Wassign-intercept
3696 @opindex Wno-assign-intercept
3697 Warn whenever an Objective-C assignment is being intercepted by the
3698 garbage collector.
3699
3700 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3701 @opindex Wno-protocol
3702 @opindex Wprotocol
3703 If a class is declared to implement a protocol, a warning is issued for
3704 every method in the protocol that is not implemented by the class. The
3705 default behavior is to issue a warning for every method not explicitly
3706 implemented in the class, even if a method implementation is inherited
3707 from the superclass. If you use the @option{-Wno-protocol} option, then
3708 methods inherited from the superclass are considered to be implemented,
3709 and no warning is issued for them.
3710
3711 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3712 @opindex Wselector
3713 @opindex Wno-selector
3714 Warn if multiple methods of different types for the same selector are
3715 found during compilation. The check is performed on the list of methods
3716 in the final stage of compilation. Additionally, a check is performed
3717 for each selector appearing in a @code{@@selector(@dots{})}
3718 expression, and a corresponding method for that selector has been found
3719 during compilation. Because these checks scan the method table only at
3720 the end of compilation, these warnings are not produced if the final
3721 stage of compilation is not reached, for example because an error is
3722 found during compilation, or because the @option{-fsyntax-only} option is
3723 being used.
3724
3725 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3726 @opindex Wstrict-selector-match
3727 @opindex Wno-strict-selector-match
3728 Warn if multiple methods with differing argument and/or return types are
3729 found for a given selector when attempting to send a message using this
3730 selector to a receiver of type @code{id} or @code{Class}. When this flag
3731 is off (which is the default behavior), the compiler omits such warnings
3732 if any differences found are confined to types that share the same size
3733 and alignment.
3734
3735 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3736 @opindex Wundeclared-selector
3737 @opindex Wno-undeclared-selector
3738 Warn if a @code{@@selector(@dots{})} expression referring to an
3739 undeclared selector is found. A selector is considered undeclared if no
3740 method with that name has been declared before the
3741 @code{@@selector(@dots{})} expression, either explicitly in an
3742 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3743 an @code{@@implementation} section. This option always performs its
3744 checks as soon as a @code{@@selector(@dots{})} expression is found,
3745 while @option{-Wselector} only performs its checks in the final stage of
3746 compilation. This also enforces the coding style convention
3747 that methods and selectors must be declared before being used.
3748
3749 @item -print-objc-runtime-info
3750 @opindex print-objc-runtime-info
3751 Generate C header describing the largest structure that is passed by
3752 value, if any.
3753
3754 @end table
3755
3756 @node Diagnostic Message Formatting Options
3757 @section Options to Control Diagnostic Messages Formatting
3758 @cindex options to control diagnostics formatting
3759 @cindex diagnostic messages
3760 @cindex message formatting
3761
3762 Traditionally, diagnostic messages have been formatted irrespective of
3763 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3764 options described below
3765 to control the formatting algorithm for diagnostic messages,
3766 e.g.@: how many characters per line, how often source location
3767 information should be reported. Note that some language front ends may not
3768 honor these options.
3769
3770 @table @gcctabopt
3771 @item -fmessage-length=@var{n}
3772 @opindex fmessage-length
3773 Try to format error messages so that they fit on lines of about
3774 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3775 done; each error message appears on a single line. This is the
3776 default for all front ends.
3777
3778 Note - this option also affects the display of the @samp{#error} and
3779 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3780 function/type/variable attribute. It does not however affect the
3781 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3782
3783 @item -fdiagnostics-show-location=once
3784 @opindex fdiagnostics-show-location
3785 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3786 reporter to emit source location information @emph{once}; that is, in
3787 case the message is too long to fit on a single physical line and has to
3788 be wrapped, the source location won't be emitted (as prefix) again,
3789 over and over, in subsequent continuation lines. This is the default
3790 behavior.
3791
3792 @item -fdiagnostics-show-location=every-line
3793 Only meaningful in line-wrapping mode. Instructs the diagnostic
3794 messages reporter to emit the same source location information (as
3795 prefix) for physical lines that result from the process of breaking
3796 a message which is too long to fit on a single line.
3797
3798 @item -fdiagnostics-color[=@var{WHEN}]
3799 @itemx -fno-diagnostics-color
3800 @opindex fdiagnostics-color
3801 @cindex highlight, color
3802 @vindex GCC_COLORS @r{environment variable}
3803 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3804 or @samp{auto}. The default depends on how the compiler has been configured,
3805 it can be any of the above @var{WHEN} options or also @samp{never}
3806 if @env{GCC_COLORS} environment variable isn't present in the environment,
3807 and @samp{auto} otherwise.
3808 @samp{auto} means to use color only when the standard error is a terminal.
3809 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3810 aliases for @option{-fdiagnostics-color=always} and
3811 @option{-fdiagnostics-color=never}, respectively.
3812
3813 The colors are defined by the environment variable @env{GCC_COLORS}.
3814 Its value is a colon-separated list of capabilities and Select Graphic
3815 Rendition (SGR) substrings. SGR commands are interpreted by the
3816 terminal or terminal emulator. (See the section in the documentation
3817 of your text terminal for permitted values and their meanings as
3818 character attributes.) These substring values are integers in decimal
3819 representation and can be concatenated with semicolons.
3820 Common values to concatenate include
3821 @samp{1} for bold,
3822 @samp{4} for underline,
3823 @samp{5} for blink,
3824 @samp{7} for inverse,
3825 @samp{39} for default foreground color,
3826 @samp{30} to @samp{37} for foreground colors,
3827 @samp{90} to @samp{97} for 16-color mode foreground colors,
3828 @samp{38;5;0} to @samp{38;5;255}
3829 for 88-color and 256-color modes foreground colors,
3830 @samp{49} for default background color,
3831 @samp{40} to @samp{47} for background colors,
3832 @samp{100} to @samp{107} for 16-color mode background colors,
3833 and @samp{48;5;0} to @samp{48;5;255}
3834 for 88-color and 256-color modes background colors.
3835
3836 The default @env{GCC_COLORS} is
3837 @smallexample
3838 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3839 quote=01:fixit-insert=32:fixit-delete=31:\
3840 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3841 type-diff=01;32
3842 @end smallexample
3843 @noindent
3844 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3845 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3846 @samp{01} is bold, and @samp{31} is red.
3847 Setting @env{GCC_COLORS} to the empty string disables colors.
3848 Supported capabilities are as follows.
3849
3850 @table @code
3851 @item error=
3852 @vindex error GCC_COLORS @r{capability}
3853 SGR substring for error: markers.
3854
3855 @item warning=
3856 @vindex warning GCC_COLORS @r{capability}
3857 SGR substring for warning: markers.
3858
3859 @item note=
3860 @vindex note GCC_COLORS @r{capability}
3861 SGR substring for note: markers.
3862
3863 @item range1=
3864 @vindex range1 GCC_COLORS @r{capability}
3865 SGR substring for first additional range.
3866
3867 @item range2=
3868 @vindex range2 GCC_COLORS @r{capability}
3869 SGR substring for second additional range.
3870
3871 @item locus=
3872 @vindex locus GCC_COLORS @r{capability}
3873 SGR substring for location information, @samp{file:line} or
3874 @samp{file:line:column} etc.
3875
3876 @item quote=
3877 @vindex quote GCC_COLORS @r{capability}
3878 SGR substring for information printed within quotes.
3879
3880 @item fixit-insert=
3881 @vindex fixit-insert GCC_COLORS @r{capability}
3882 SGR substring for fix-it hints suggesting text to
3883 be inserted or replaced.
3884
3885 @item fixit-delete=
3886 @vindex fixit-delete GCC_COLORS @r{capability}
3887 SGR substring for fix-it hints suggesting text to
3888 be deleted.
3889
3890 @item diff-filename=
3891 @vindex diff-filename GCC_COLORS @r{capability}
3892 SGR substring for filename headers within generated patches.
3893
3894 @item diff-hunk=
3895 @vindex diff-hunk GCC_COLORS @r{capability}
3896 SGR substring for the starts of hunks within generated patches.
3897
3898 @item diff-delete=
3899 @vindex diff-delete GCC_COLORS @r{capability}
3900 SGR substring for deleted lines within generated patches.
3901
3902 @item diff-insert=
3903 @vindex diff-insert GCC_COLORS @r{capability}
3904 SGR substring for inserted lines within generated patches.
3905
3906 @item type-diff=
3907 @vindex type-diff GCC_COLORS @r{capability}
3908 SGR substring for highlighting mismatching types within template
3909 arguments in the C++ frontend.
3910 @end table
3911
3912 @item -fdiagnostics-urls[=@var{WHEN}]
3913 @opindex fdiagnostics-urls
3914 @cindex urls
3915 Use escape sequences to embed URLs in diagnostics. For example, when
3916 @option{-fdiagnostics-show-option} emits text showing the command-line
3917 option controlling a diagnostic, embed a URL for documentation of that
3918 option.
3919
3920 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
3921 The default is @samp{auto}, which means to use URL escape sequences only
3922 when the standard error is a terminal.
3923
3924 @item -fno-diagnostics-show-option
3925 @opindex fno-diagnostics-show-option
3926 @opindex fdiagnostics-show-option
3927 By default, each diagnostic emitted includes text indicating the
3928 command-line option that directly controls the diagnostic (if such an
3929 option is known to the diagnostic machinery). Specifying the
3930 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3931
3932 @item -fno-diagnostics-show-caret
3933 @opindex fno-diagnostics-show-caret
3934 @opindex fdiagnostics-show-caret
3935 By default, each diagnostic emitted includes the original source line
3936 and a caret @samp{^} indicating the column. This option suppresses this
3937 information. The source line is truncated to @var{n} characters, if
3938 the @option{-fmessage-length=n} option is given. When the output is done
3939 to the terminal, the width is limited to the width given by the
3940 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3941
3942 @item -fno-diagnostics-show-labels
3943 @opindex fno-diagnostics-show-labels
3944 @opindex fdiagnostics-show-labels
3945 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3946 diagnostics can label ranges of source code with pertinent information, such
3947 as the types of expressions:
3948
3949 @smallexample
3950 printf ("foo %s bar", long_i + long_j);
3951 ~^ ~~~~~~~~~~~~~~~
3952 | |
3953 char * long int
3954 @end smallexample
3955
3956 This option suppresses the printing of these labels (in the example above,
3957 the vertical bars and the ``char *'' and ``long int'' text).
3958
3959 @item -fno-diagnostics-show-line-numbers
3960 @opindex fno-diagnostics-show-line-numbers
3961 @opindex fdiagnostics-show-line-numbers
3962 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3963 a left margin is printed, showing line numbers. This option suppresses this
3964 left margin.
3965
3966 @item -fdiagnostics-minimum-margin-width=@var{width}
3967 @opindex fdiagnostics-minimum-margin-width
3968 This option controls the minimum width of the left margin printed by
3969 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3970
3971 @item -fdiagnostics-parseable-fixits
3972 @opindex fdiagnostics-parseable-fixits
3973 Emit fix-it hints in a machine-parseable format, suitable for consumption
3974 by IDEs. For each fix-it, a line will be printed after the relevant
3975 diagnostic, starting with the string ``fix-it:''. For example:
3976
3977 @smallexample
3978 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3979 @end smallexample
3980
3981 The location is expressed as a half-open range, expressed as a count of
3982 bytes, starting at byte 1 for the initial column. In the above example,
3983 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3984 given string:
3985
3986 @smallexample
3987 00000000011111111112222222222
3988 12345678901234567890123456789
3989 gtk_widget_showall (dlg);
3990 ^^^^^^^^^^^^^^^^^^
3991 gtk_widget_show_all
3992 @end smallexample
3993
3994 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3995 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3996 (e.g. vertical tab as ``\013'').
3997
3998 An empty replacement string indicates that the given range is to be removed.
3999 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4000 be inserted at the given position.
4001
4002 @item -fdiagnostics-generate-patch
4003 @opindex fdiagnostics-generate-patch
4004 Print fix-it hints to stderr in unified diff format, after any diagnostics
4005 are printed. For example:
4006
4007 @smallexample
4008 --- test.c
4009 +++ test.c
4010 @@ -42,5 +42,5 @@
4011
4012 void show_cb(GtkDialog *dlg)
4013 @{
4014 - gtk_widget_showall(dlg);
4015 + gtk_widget_show_all(dlg);
4016 @}
4017
4018 @end smallexample
4019
4020 The diff may or may not be colorized, following the same rules
4021 as for diagnostics (see @option{-fdiagnostics-color}).
4022
4023 @item -fdiagnostics-show-template-tree
4024 @opindex fdiagnostics-show-template-tree
4025
4026 In the C++ frontend, when printing diagnostics showing mismatching
4027 template types, such as:
4028
4029 @smallexample
4030 could not convert 'std::map<int, std::vector<double> >()'
4031 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4032 @end smallexample
4033
4034 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4035 tree-like structure showing the common and differing parts of the types,
4036 such as:
4037
4038 @smallexample
4039 map<
4040 [...],
4041 vector<
4042 [double != float]>>
4043 @end smallexample
4044
4045 The parts that differ are highlighted with color (``double'' and
4046 ``float'' in this case).
4047
4048 @item -fno-elide-type
4049 @opindex fno-elide-type
4050 @opindex felide-type
4051 By default when the C++ frontend prints diagnostics showing mismatching
4052 template types, common parts of the types are printed as ``[...]'' to
4053 simplify the error message. For example:
4054
4055 @smallexample
4056 could not convert 'std::map<int, std::vector<double> >()'
4057 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4058 @end smallexample
4059
4060 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4061 This flag also affects the output of the
4062 @option{-fdiagnostics-show-template-tree} flag.
4063
4064 @item -fno-show-column
4065 @opindex fno-show-column
4066 @opindex fshow-column
4067 Do not print column numbers in diagnostics. This may be necessary if
4068 diagnostics are being scanned by a program that does not understand the
4069 column numbers, such as @command{dejagnu}.
4070
4071 @item -fdiagnostics-format=@var{FORMAT}
4072 @opindex fdiagnostics-format
4073 Select a different format for printing diagnostics.
4074 @var{FORMAT} is @samp{text} or @samp{json}.
4075 The default is @samp{text}.
4076
4077 The @samp{json} format consists of a top-level JSON array containing JSON
4078 objects representing the diagnostics.
4079
4080 The JSON is emitted as one line, without formatting; the examples below
4081 have been formatted for clarity.
4082
4083 Diagnostics can have child diagnostics. For example, this error and note:
4084
4085 @smallexample
4086 misleading-indentation.c:15:3: warning: this 'if' clause does not
4087 guard... [-Wmisleading-indentation]
4088 15 | if (flag)
4089 | ^~
4090 misleading-indentation.c:17:5: note: ...this statement, but the latter
4091 is misleadingly indented as if it were guarded by the 'if'
4092 17 | y = 2;
4093 | ^
4094 @end smallexample
4095
4096 @noindent
4097 might be printed in JSON form (after formatting) like this:
4098
4099 @smallexample
4100 [
4101 @{
4102 "kind": "warning",
4103 "locations": [
4104 @{
4105 "caret": @{
4106 "column": 3,
4107 "file": "misleading-indentation.c",
4108 "line": 15
4109 @},
4110 "finish": @{
4111 "column": 4,
4112 "file": "misleading-indentation.c",
4113 "line": 15
4114 @}
4115 @}
4116 ],
4117 "message": "this \u2018if\u2019 clause does not guard...",
4118 "option": "-Wmisleading-indentation",
4119 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4120 "children": [
4121 @{
4122 "kind": "note",
4123 "locations": [
4124 @{
4125 "caret": @{
4126 "column": 5,
4127 "file": "misleading-indentation.c",
4128 "line": 17
4129 @}
4130 @}
4131 ],
4132 "message": "...this statement, but the latter is @dots{}"
4133 @}
4134 ]
4135 @},
4136 @dots{}
4137 ]
4138 @end smallexample
4139
4140 @noindent
4141 where the @code{note} is a child of the @code{warning}.
4142
4143 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4144 an @code{option} key describing the command-line option controlling the
4145 warning.
4146
4147 A diagnostic can contain zero or more locations. Each location has up
4148 to three positions within it: a @code{caret} position and optional
4149 @code{start} and @code{finish} positions. A location can also have
4150 an optional @code{label} string. For example, this error:
4151
4152 @smallexample
4153 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4154 'struct s'@} and 'T' @{aka 'struct t'@})
4155 64 | return callee_4a () + callee_4b ();
4156 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4157 | | |
4158 | | T @{aka struct t@}
4159 | S @{aka struct s@}
4160 @end smallexample
4161
4162 @noindent
4163 has three locations. Its primary location is at the ``+'' token at column
4164 23. It has two secondary locations, describing the left and right-hand sides
4165 of the expression, which have labels. It might be printed in JSON form as:
4166
4167 @smallexample
4168 @{
4169 "children": [],
4170 "kind": "error",
4171 "locations": [
4172 @{
4173 "caret": @{
4174 "column": 23, "file": "bad-binary-ops.c", "line": 64
4175 @}
4176 @},
4177 @{
4178 "caret": @{
4179 "column": 10, "file": "bad-binary-ops.c", "line": 64
4180 @},
4181 "finish": @{
4182 "column": 21, "file": "bad-binary-ops.c", "line": 64
4183 @},
4184 "label": "S @{aka struct s@}"
4185 @},
4186 @{
4187 "caret": @{
4188 "column": 25, "file": "bad-binary-ops.c", "line": 64
4189 @},
4190 "finish": @{
4191 "column": 36, "file": "bad-binary-ops.c", "line": 64
4192 @},
4193 "label": "T @{aka struct t@}"
4194 @}
4195 ],
4196 "message": "invalid operands to binary + @dots{}"
4197 @}
4198 @end smallexample
4199
4200 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4201 consisting of half-open intervals, similar to the output of
4202 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4203 with a replacement fix-it hint:
4204
4205 @smallexample
4206 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4207 mean 'color'?
4208 8 | return ptr->colour;
4209 | ^~~~~~
4210 | color
4211 @end smallexample
4212
4213 @noindent
4214 might be printed in JSON form as:
4215
4216 @smallexample
4217 @{
4218 "children": [],
4219 "fixits": [
4220 @{
4221 "next": @{
4222 "column": 21,
4223 "file": "demo.c",
4224 "line": 8
4225 @},
4226 "start": @{
4227 "column": 15,
4228 "file": "demo.c",
4229 "line": 8
4230 @},
4231 "string": "color"
4232 @}
4233 ],
4234 "kind": "error",
4235 "locations": [
4236 @{
4237 "caret": @{
4238 "column": 15,
4239 "file": "demo.c",
4240 "line": 8
4241 @},
4242 "finish": @{
4243 "column": 20,
4244 "file": "demo.c",
4245 "line": 8
4246 @}
4247 @}
4248 ],
4249 "message": "\u2018struct s\u2019 has no member named @dots{}"
4250 @}
4251 @end smallexample
4252
4253 @noindent
4254 where the fix-it hint suggests replacing the text from @code{start} up
4255 to but not including @code{next} with @code{string}'s value. Deletions
4256 are expressed via an empty value for @code{string}, insertions by
4257 having @code{start} equal @code{next}.
4258
4259 @end table
4260
4261 @node Warning Options
4262 @section Options to Request or Suppress Warnings
4263 @cindex options to control warnings
4264 @cindex warning messages
4265 @cindex messages, warning
4266 @cindex suppressing warnings
4267
4268 Warnings are diagnostic messages that report constructions that
4269 are not inherently erroneous but that are risky or suggest there
4270 may have been an error.
4271
4272 The following language-independent options do not enable specific
4273 warnings but control the kinds of diagnostics produced by GCC@.
4274
4275 @table @gcctabopt
4276 @cindex syntax checking
4277 @item -fsyntax-only
4278 @opindex fsyntax-only
4279 Check the code for syntax errors, but don't do anything beyond that.
4280
4281 @item -fmax-errors=@var{n}
4282 @opindex fmax-errors
4283 Limits the maximum number of error messages to @var{n}, at which point
4284 GCC bails out rather than attempting to continue processing the source
4285 code. If @var{n} is 0 (the default), there is no limit on the number
4286 of error messages produced. If @option{-Wfatal-errors} is also
4287 specified, then @option{-Wfatal-errors} takes precedence over this
4288 option.
4289
4290 @item -w
4291 @opindex w
4292 Inhibit all warning messages.
4293
4294 @item -Werror
4295 @opindex Werror
4296 @opindex Wno-error
4297 Make all warnings into errors.
4298
4299 @item -Werror=
4300 @opindex Werror=
4301 @opindex Wno-error=
4302 Make the specified warning into an error. The specifier for a warning
4303 is appended; for example @option{-Werror=switch} turns the warnings
4304 controlled by @option{-Wswitch} into errors. This switch takes a
4305 negative form, to be used to negate @option{-Werror} for specific
4306 warnings; for example @option{-Wno-error=switch} makes
4307 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4308 is in effect.
4309
4310 The warning message for each controllable warning includes the
4311 option that controls the warning. That option can then be used with
4312 @option{-Werror=} and @option{-Wno-error=} as described above.
4313 (Printing of the option in the warning message can be disabled using the
4314 @option{-fno-diagnostics-show-option} flag.)
4315
4316 Note that specifying @option{-Werror=}@var{foo} automatically implies
4317 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4318 imply anything.
4319
4320 @item -Wfatal-errors
4321 @opindex Wfatal-errors
4322 @opindex Wno-fatal-errors
4323 This option causes the compiler to abort compilation on the first error
4324 occurred rather than trying to keep going and printing further error
4325 messages.
4326
4327 @end table
4328
4329 You can request many specific warnings with options beginning with
4330 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4331 implicit declarations. Each of these specific warning options also
4332 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4333 example, @option{-Wno-implicit}. This manual lists only one of the
4334 two forms, whichever is not the default. For further
4335 language-specific options also refer to @ref{C++ Dialect Options} and
4336 @ref{Objective-C and Objective-C++ Dialect Options}.
4337
4338 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4339 options, such as @option{-Wunused}, which may turn on further options,
4340 such as @option{-Wunused-value}. The combined effect of positive and
4341 negative forms is that more specific options have priority over less
4342 specific ones, independently of their position in the command-line. For
4343 options of the same specificity, the last one takes effect. Options
4344 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4345 as if they appeared at the end of the command-line.
4346
4347 When an unrecognized warning option is requested (e.g.,
4348 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4349 that the option is not recognized. However, if the @option{-Wno-} form
4350 is used, the behavior is slightly different: no diagnostic is
4351 produced for @option{-Wno-unknown-warning} unless other diagnostics
4352 are being produced. This allows the use of new @option{-Wno-} options
4353 with old compilers, but if something goes wrong, the compiler
4354 warns that an unrecognized option is present.
4355
4356 @table @gcctabopt
4357 @item -Wpedantic
4358 @itemx -pedantic
4359 @opindex pedantic
4360 @opindex Wpedantic
4361 @opindex Wno-pedantic
4362 Issue all the warnings demanded by strict ISO C and ISO C++;
4363 reject all programs that use forbidden extensions, and some other
4364 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4365 version of the ISO C standard specified by any @option{-std} option used.
4366
4367 Valid ISO C and ISO C++ programs should compile properly with or without
4368 this option (though a rare few require @option{-ansi} or a
4369 @option{-std} option specifying the required version of ISO C)@. However,
4370 without this option, certain GNU extensions and traditional C and C++
4371 features are supported as well. With this option, they are rejected.
4372
4373 @option{-Wpedantic} does not cause warning messages for use of the
4374 alternate keywords whose names begin and end with @samp{__}. This alternate
4375 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4376 i.e. @samp{__intN__}.
4377 Pedantic warnings are also disabled in the expression that follows
4378 @code{__extension__}. However, only system header files should use
4379 these escape routes; application programs should avoid them.
4380 @xref{Alternate Keywords}.
4381
4382 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4383 C conformance. They soon find that it does not do quite what they want:
4384 it finds some non-ISO practices, but not all---only those for which
4385 ISO C @emph{requires} a diagnostic, and some others for which
4386 diagnostics have been added.
4387
4388 A feature to report any failure to conform to ISO C might be useful in
4389 some instances, but would require considerable additional work and would
4390 be quite different from @option{-Wpedantic}. We don't have plans to
4391 support such a feature in the near future.
4392
4393 Where the standard specified with @option{-std} represents a GNU
4394 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4395 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4396 extended dialect is based. Warnings from @option{-Wpedantic} are given
4397 where they are required by the base standard. (It does not make sense
4398 for such warnings to be given only for features not in the specified GNU
4399 C dialect, since by definition the GNU dialects of C include all
4400 features the compiler supports with the given option, and there would be
4401 nothing to warn about.)
4402
4403 @item -pedantic-errors
4404 @opindex pedantic-errors
4405 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4406 requires a diagnostic, in some cases where there is undefined behavior
4407 at compile-time and in some other cases that do not prevent compilation
4408 of programs that are valid according to the standard. This is not
4409 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4410 by this option and not enabled by the latter and vice versa.
4411
4412 @item -Wall
4413 @opindex Wall
4414 @opindex Wno-all
4415 This enables all the warnings about constructions that some users
4416 consider questionable, and that are easy to avoid (or modify to
4417 prevent the warning), even in conjunction with macros. This also
4418 enables some language-specific warnings described in @ref{C++ Dialect
4419 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4420
4421 @option{-Wall} turns on the following warning flags:
4422
4423 @gccoptlist{-Waddress @gol
4424 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4425 -Wbool-compare @gol
4426 -Wbool-operation @gol
4427 -Wc++11-compat -Wc++14-compat @gol
4428 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4429 -Wchar-subscripts @gol
4430 -Wcomment @gol
4431 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4432 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4433 -Wenum-conversion @r{in C/ObjC;} @gol
4434 -Wformat @gol
4435 -Wint-in-bool-context @gol
4436 -Wimplicit @r{(C and Objective-C only)} @gol
4437 -Wimplicit-int @r{(C and Objective-C only)} @gol
4438 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4439 -Winit-self @r{(only for C++)} @gol
4440 -Wlogical-not-parentheses @gol
4441 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4442 -Wmaybe-uninitialized @gol
4443 -Wmemset-elt-size @gol
4444 -Wmemset-transposed-args @gol
4445 -Wmisleading-indentation @r{(only for C/C++)} @gol
4446 -Wmissing-attributes @gol
4447 -Wmissing-braces @r{(only for C/ObjC)} @gol
4448 -Wmultistatement-macros @gol
4449 -Wnarrowing @r{(only for C++)} @gol
4450 -Wnonnull @gol
4451 -Wnonnull-compare @gol
4452 -Wopenmp-simd @gol
4453 -Wparentheses @gol
4454 -Wpessimizing-move @r{(only for C++)} @gol
4455 -Wpointer-sign @gol
4456 -Wreorder @gol
4457 -Wrestrict @gol
4458 -Wreturn-type @gol
4459 -Wsequence-point @gol
4460 -Wsign-compare @r{(only in C++)} @gol
4461 -Wsizeof-pointer-div @gol
4462 -Wsizeof-pointer-memaccess @gol
4463 -Wstrict-aliasing @gol
4464 -Wstrict-overflow=1 @gol
4465 -Wswitch @gol
4466 -Wtautological-compare @gol
4467 -Wtrigraphs @gol
4468 -Wuninitialized @gol
4469 -Wunknown-pragmas @gol
4470 -Wunused-function @gol
4471 -Wunused-label @gol
4472 -Wunused-value @gol
4473 -Wunused-variable @gol
4474 -Wvolatile-register-var}
4475
4476 Note that some warning flags are not implied by @option{-Wall}. Some of
4477 them warn about constructions that users generally do not consider
4478 questionable, but which occasionally you might wish to check for;
4479 others warn about constructions that are necessary or hard to avoid in
4480 some cases, and there is no simple way to modify the code to suppress
4481 the warning. Some of them are enabled by @option{-Wextra} but many of
4482 them must be enabled individually.
4483
4484 @item -Wextra
4485 @opindex W
4486 @opindex Wextra
4487 @opindex Wno-extra
4488 This enables some extra warning flags that are not enabled by
4489 @option{-Wall}. (This option used to be called @option{-W}. The older
4490 name is still supported, but the newer name is more descriptive.)
4491
4492 @gccoptlist{-Wclobbered @gol
4493 -Wcast-function-type @gol
4494 -Wdeprecated-copy @r{(C++ only)} @gol
4495 -Wempty-body @gol
4496 -Wignored-qualifiers @gol
4497 -Wimplicit-fallthrough=3 @gol
4498 -Wmissing-field-initializers @gol
4499 -Wmissing-parameter-type @r{(C only)} @gol
4500 -Wold-style-declaration @r{(C only)} @gol
4501 -Woverride-init @gol
4502 -Wsign-compare @r{(C only)} @gol
4503 -Wstring-compare @gol
4504 -Wredundant-move @r{(only for C++)} @gol
4505 -Wtype-limits @gol
4506 -Wuninitialized @gol
4507 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4508 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4509 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4510
4511
4512 The option @option{-Wextra} also prints warning messages for the
4513 following cases:
4514
4515 @itemize @bullet
4516
4517 @item
4518 A pointer is compared against integer zero with @code{<}, @code{<=},
4519 @code{>}, or @code{>=}.
4520
4521 @item
4522 (C++ only) An enumerator and a non-enumerator both appear in a
4523 conditional expression.
4524
4525 @item
4526 (C++ only) Ambiguous virtual bases.
4527
4528 @item
4529 (C++ only) Subscripting an array that has been declared @code{register}.
4530
4531 @item
4532 (C++ only) Taking the address of a variable that has been declared
4533 @code{register}.
4534
4535 @item
4536 (C++ only) A base class is not initialized in the copy constructor
4537 of a derived class.
4538
4539 @end itemize
4540
4541 @item -Wchar-subscripts
4542 @opindex Wchar-subscripts
4543 @opindex Wno-char-subscripts
4544 Warn if an array subscript has type @code{char}. This is a common cause
4545 of error, as programmers often forget that this type is signed on some
4546 machines.
4547 This warning is enabled by @option{-Wall}.
4548
4549 @item -Wno-coverage-mismatch
4550 @opindex Wno-coverage-mismatch
4551 @opindex Wcoverage-mismatch
4552 Warn if feedback profiles do not match when using the
4553 @option{-fprofile-use} option.
4554 If a source file is changed between compiling with @option{-fprofile-generate}
4555 and with @option{-fprofile-use}, the files with the profile feedback can fail
4556 to match the source file and GCC cannot use the profile feedback
4557 information. By default, this warning is enabled and is treated as an
4558 error. @option{-Wno-coverage-mismatch} can be used to disable the
4559 warning or @option{-Wno-error=coverage-mismatch} can be used to
4560 disable the error. Disabling the error for this warning can result in
4561 poorly optimized code and is useful only in the
4562 case of very minor changes such as bug fixes to an existing code-base.
4563 Completely disabling the warning is not recommended.
4564
4565 @item -Wno-cpp
4566 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4567
4568 Suppress warning messages emitted by @code{#warning} directives.
4569
4570 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4571 @opindex Wdouble-promotion
4572 @opindex Wno-double-promotion
4573 Give a warning when a value of type @code{float} is implicitly
4574 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4575 floating-point unit implement @code{float} in hardware, but emulate
4576 @code{double} in software. On such a machine, doing computations
4577 using @code{double} values is much more expensive because of the
4578 overhead required for software emulation.
4579
4580 It is easy to accidentally do computations with @code{double} because
4581 floating-point literals are implicitly of type @code{double}. For
4582 example, in:
4583 @smallexample
4584 @group
4585 float area(float radius)
4586 @{
4587 return 3.14159 * radius * radius;
4588 @}
4589 @end group
4590 @end smallexample
4591 the compiler performs the entire computation with @code{double}
4592 because the floating-point literal is a @code{double}.
4593
4594 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4595 @opindex Wduplicate-decl-specifier
4596 @opindex Wno-duplicate-decl-specifier
4597 Warn if a declaration has duplicate @code{const}, @code{volatile},
4598 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4599 @option{-Wall}.
4600
4601 @item -Wformat
4602 @itemx -Wformat=@var{n}
4603 @opindex Wformat
4604 @opindex Wno-format
4605 @opindex ffreestanding
4606 @opindex fno-builtin
4607 @opindex Wformat=
4608 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4609 the arguments supplied have types appropriate to the format string
4610 specified, and that the conversions specified in the format string make
4611 sense. This includes standard functions, and others specified by format
4612 attributes (@pxref{Function Attributes}), in the @code{printf},
4613 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4614 not in the C standard) families (or other target-specific families).
4615 Which functions are checked without format attributes having been
4616 specified depends on the standard version selected, and such checks of
4617 functions without the attribute specified are disabled by
4618 @option{-ffreestanding} or @option{-fno-builtin}.
4619
4620 The formats are checked against the format features supported by GNU
4621 libc version 2.2. These include all ISO C90 and C99 features, as well
4622 as features from the Single Unix Specification and some BSD and GNU
4623 extensions. Other library implementations may not support all these
4624 features; GCC does not support warning about features that go beyond a
4625 particular library's limitations. However, if @option{-Wpedantic} is used
4626 with @option{-Wformat}, warnings are given about format features not
4627 in the selected standard version (but not for @code{strfmon} formats,
4628 since those are not in any version of the C standard). @xref{C Dialect
4629 Options,,Options Controlling C Dialect}.
4630
4631 @table @gcctabopt
4632 @item -Wformat=1
4633 @itemx -Wformat
4634 @opindex Wformat
4635 @opindex Wformat=1
4636 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4637 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4638 @option{-Wformat} also checks for null format arguments for several
4639 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4640 aspects of this level of format checking can be disabled by the
4641 options: @option{-Wno-format-contains-nul},
4642 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4643 @option{-Wformat} is enabled by @option{-Wall}.
4644
4645 @item -Wno-format-contains-nul
4646 @opindex Wno-format-contains-nul
4647 @opindex Wformat-contains-nul
4648 If @option{-Wformat} is specified, do not warn about format strings that
4649 contain NUL bytes.
4650
4651 @item -Wno-format-extra-args
4652 @opindex Wno-format-extra-args
4653 @opindex Wformat-extra-args
4654 If @option{-Wformat} is specified, do not warn about excess arguments to a
4655 @code{printf} or @code{scanf} format function. The C standard specifies
4656 that such arguments are ignored.
4657
4658 Where the unused arguments lie between used arguments that are
4659 specified with @samp{$} operand number specifications, normally
4660 warnings are still given, since the implementation could not know what
4661 type to pass to @code{va_arg} to skip the unused arguments. However,
4662 in the case of @code{scanf} formats, this option suppresses the
4663 warning if the unused arguments are all pointers, since the Single
4664 Unix Specification says that such unused arguments are allowed.
4665
4666 @item -Wformat-overflow
4667 @itemx -Wformat-overflow=@var{level}
4668 @opindex Wformat-overflow
4669 @opindex Wno-format-overflow
4670 Warn about calls to formatted input/output functions such as @code{sprintf}
4671 and @code{vsprintf} that might overflow the destination buffer. When the
4672 exact number of bytes written by a format directive cannot be determined
4673 at compile-time it is estimated based on heuristics that depend on the
4674 @var{level} argument and on optimization. While enabling optimization
4675 will in most cases improve the accuracy of the warning, it may also
4676 result in false positives.
4677
4678 @table @gcctabopt
4679 @item -Wformat-overflow
4680 @itemx -Wformat-overflow=1
4681 @opindex Wformat-overflow
4682 @opindex Wno-format-overflow
4683 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4684 employs a conservative approach that warns only about calls that most
4685 likely overflow the buffer. At this level, numeric arguments to format
4686 directives with unknown values are assumed to have the value of one, and
4687 strings of unknown length to be empty. Numeric arguments that are known
4688 to be bounded to a subrange of their type, or string arguments whose output
4689 is bounded either by their directive's precision or by a finite set of
4690 string literals, are assumed to take on the value within the range that
4691 results in the most bytes on output. For example, the call to @code{sprintf}
4692 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4693 the terminating NUL character (@code{'\0'}) appended by the function
4694 to the destination buffer will be written past its end. Increasing
4695 the size of the buffer by a single byte is sufficient to avoid the
4696 warning, though it may not be sufficient to avoid the overflow.
4697
4698 @smallexample
4699 void f (int a, int b)
4700 @{
4701 char buf [13];
4702 sprintf (buf, "a = %i, b = %i\n", a, b);
4703 @}
4704 @end smallexample
4705
4706 @item -Wformat-overflow=2
4707 Level @var{2} warns also about calls that might overflow the destination
4708 buffer given an argument of sufficient length or magnitude. At level
4709 @var{2}, unknown numeric arguments are assumed to have the minimum
4710 representable value for signed types with a precision greater than 1, and
4711 the maximum representable value otherwise. Unknown string arguments whose
4712 length cannot be assumed to be bounded either by the directive's precision,
4713 or by a finite set of string literals they may evaluate to, or the character
4714 array they may point to, are assumed to be 1 character long.
4715
4716 At level @var{2}, the call in the example above is again diagnosed, but
4717 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4718 @code{%i} directive will write some of its digits beyond the end of
4719 the destination buffer. To make the call safe regardless of the values
4720 of the two variables, the size of the destination buffer must be increased
4721 to at least 34 bytes. GCC includes the minimum size of the buffer in
4722 an informational note following the warning.
4723
4724 An alternative to increasing the size of the destination buffer is to
4725 constrain the range of formatted values. The maximum length of string
4726 arguments can be bounded by specifying the precision in the format
4727 directive. When numeric arguments of format directives can be assumed
4728 to be bounded by less than the precision of their type, choosing
4729 an appropriate length modifier to the format specifier will reduce
4730 the required buffer size. For example, if @var{a} and @var{b} in the
4731 example above can be assumed to be within the precision of
4732 the @code{short int} type then using either the @code{%hi} format
4733 directive or casting the argument to @code{short} reduces the maximum
4734 required size of the buffer to 24 bytes.
4735
4736 @smallexample
4737 void f (int a, int b)
4738 @{
4739 char buf [23];
4740 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4741 @}
4742 @end smallexample
4743 @end table
4744
4745 @item -Wno-format-zero-length
4746 @opindex Wno-format-zero-length
4747 @opindex Wformat-zero-length
4748 If @option{-Wformat} is specified, do not warn about zero-length formats.
4749 The C standard specifies that zero-length formats are allowed.
4750
4751
4752 @item -Wformat=2
4753 @opindex Wformat=2
4754 Enable @option{-Wformat} plus additional format checks. Currently
4755 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4756 -Wformat-y2k}.
4757
4758 @item -Wformat-nonliteral
4759 @opindex Wformat-nonliteral
4760 @opindex Wno-format-nonliteral
4761 If @option{-Wformat} is specified, also warn if the format string is not a
4762 string literal and so cannot be checked, unless the format function
4763 takes its format arguments as a @code{va_list}.
4764
4765 @item -Wformat-security
4766 @opindex Wformat-security
4767 @opindex Wno-format-security
4768 If @option{-Wformat} is specified, also warn about uses of format
4769 functions that represent possible security problems. At present, this
4770 warns about calls to @code{printf} and @code{scanf} functions where the
4771 format string is not a string literal and there are no format arguments,
4772 as in @code{printf (foo);}. This may be a security hole if the format
4773 string came from untrusted input and contains @samp{%n}. (This is
4774 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4775 in future warnings may be added to @option{-Wformat-security} that are not
4776 included in @option{-Wformat-nonliteral}.)
4777
4778 @item -Wformat-signedness
4779 @opindex Wformat-signedness
4780 @opindex Wno-format-signedness
4781 If @option{-Wformat} is specified, also warn if the format string
4782 requires an unsigned argument and the argument is signed and vice versa.
4783
4784 @item -Wformat-truncation
4785 @itemx -Wformat-truncation=@var{level}
4786 @opindex Wformat-truncation
4787 @opindex Wno-format-truncation
4788 Warn about calls to formatted input/output functions such as @code{snprintf}
4789 and @code{vsnprintf} that might result in output truncation. When the exact
4790 number of bytes written by a format directive cannot be determined at
4791 compile-time it is estimated based on heuristics that depend on
4792 the @var{level} argument and on optimization. While enabling optimization
4793 will in most cases improve the accuracy of the warning, it may also result
4794 in false positives. Except as noted otherwise, the option uses the same
4795 logic @option{-Wformat-overflow}.
4796
4797 @table @gcctabopt
4798 @item -Wformat-truncation
4799 @itemx -Wformat-truncation=1
4800 @opindex Wformat-truncation
4801 @opindex Wno-format-truncation
4802 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4803 employs a conservative approach that warns only about calls to bounded
4804 functions whose return value is unused and that will most likely result
4805 in output truncation.
4806
4807 @item -Wformat-truncation=2
4808 Level @var{2} warns also about calls to bounded functions whose return
4809 value is used and that might result in truncation given an argument of
4810 sufficient length or magnitude.
4811 @end table
4812
4813 @item -Wformat-y2k
4814 @opindex Wformat-y2k
4815 @opindex Wno-format-y2k
4816 If @option{-Wformat} is specified, also warn about @code{strftime}
4817 formats that may yield only a two-digit year.
4818 @end table
4819
4820 @item -Wnonnull
4821 @opindex Wnonnull
4822 @opindex Wno-nonnull
4823 Warn about passing a null pointer for arguments marked as
4824 requiring a non-null value by the @code{nonnull} function attribute.
4825
4826 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4827 can be disabled with the @option{-Wno-nonnull} option.
4828
4829 @item -Wnonnull-compare
4830 @opindex Wnonnull-compare
4831 @opindex Wno-nonnull-compare
4832 Warn when comparing an argument marked with the @code{nonnull}
4833 function attribute against null inside the function.
4834
4835 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4836 can be disabled with the @option{-Wno-nonnull-compare} option.
4837
4838 @item -Wnull-dereference
4839 @opindex Wnull-dereference
4840 @opindex Wno-null-dereference
4841 Warn if the compiler detects paths that trigger erroneous or
4842 undefined behavior due to dereferencing a null pointer. This option
4843 is only active when @option{-fdelete-null-pointer-checks} is active,
4844 which is enabled by optimizations in most targets. The precision of
4845 the warnings depends on the optimization options used.
4846
4847 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4848 @opindex Winaccessible-base
4849 @opindex Wno-inaccessible-base
4850 Warn when a base class is inaccessible in a class derived from it due to
4851 ambiguity. The warning is enabled by default. Note the warning for virtual
4852 bases is enabled by the @option{-Wextra} option.
4853 @smallexample
4854 @group
4855 struct A @{ int a; @};
4856
4857 struct B : A @{ @};
4858
4859 struct C : B, A @{ @};
4860 @end group
4861 @end smallexample
4862
4863 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4864 @opindex Winit-self
4865 @opindex Wno-init-self
4866 Warn about uninitialized variables that are initialized with themselves.
4867 Note this option can only be used with the @option{-Wuninitialized} option.
4868
4869 For example, GCC warns about @code{i} being uninitialized in the
4870 following snippet only when @option{-Winit-self} has been specified:
4871 @smallexample
4872 @group
4873 int f()
4874 @{
4875 int i = i;
4876 return i;
4877 @}
4878 @end group
4879 @end smallexample
4880
4881 This warning is enabled by @option{-Wall} in C++.
4882
4883 @item -Wimplicit-int @r{(C and Objective-C only)}
4884 @opindex Wimplicit-int
4885 @opindex Wno-implicit-int
4886 Warn when a declaration does not specify a type.
4887 This warning is enabled by @option{-Wall}.
4888
4889 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4890 @opindex Wimplicit-function-declaration
4891 @opindex Wno-implicit-function-declaration
4892 Give a warning whenever a function is used before being declared. In
4893 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4894 enabled by default and it is made into an error by
4895 @option{-pedantic-errors}. This warning is also enabled by
4896 @option{-Wall}.
4897
4898 @item -Wimplicit @r{(C and Objective-C only)}
4899 @opindex Wimplicit
4900 @opindex Wno-implicit
4901 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4902 This warning is enabled by @option{-Wall}.
4903
4904 @item -Wimplicit-fallthrough
4905 @opindex Wimplicit-fallthrough
4906 @opindex Wno-implicit-fallthrough
4907 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4908 and @option{-Wno-implicit-fallthrough} is the same as
4909 @option{-Wimplicit-fallthrough=0}.
4910
4911 @item -Wimplicit-fallthrough=@var{n}
4912 @opindex Wimplicit-fallthrough=
4913 Warn when a switch case falls through. For example:
4914
4915 @smallexample
4916 @group
4917 switch (cond)
4918 @{
4919 case 1:
4920 a = 1;
4921 break;
4922 case 2:
4923 a = 2;
4924 case 3:
4925 a = 3;
4926 break;
4927 @}
4928 @end group
4929 @end smallexample
4930
4931 This warning does not warn when the last statement of a case cannot
4932 fall through, e.g. when there is a return statement or a call to function
4933 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4934 also takes into account control flow statements, such as ifs, and only
4935 warns when appropriate. E.g.@:
4936
4937 @smallexample
4938 @group
4939 switch (cond)
4940 @{
4941 case 1:
4942 if (i > 3) @{
4943 bar (5);
4944 break;
4945 @} else if (i < 1) @{
4946 bar (0);
4947 @} else
4948 return;
4949 default:
4950 @dots{}
4951 @}
4952 @end group
4953 @end smallexample
4954
4955 Since there are occasions where a switch case fall through is desirable,
4956 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4957 to be used along with a null statement to suppress this warning that
4958 would normally occur:
4959
4960 @smallexample
4961 @group
4962 switch (cond)
4963 @{
4964 case 1:
4965 bar (0);
4966 __attribute__ ((fallthrough));
4967 default:
4968 @dots{}
4969 @}
4970 @end group
4971 @end smallexample
4972
4973 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4974 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4975 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4976 Instead of these attributes, it is also possible to add a fallthrough comment
4977 to silence the warning. The whole body of the C or C++ style comment should
4978 match the given regular expressions listed below. The option argument @var{n}
4979 specifies what kind of comments are accepted:
4980
4981 @itemize @bullet
4982
4983 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4984
4985 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4986 expression, any comment is used as fallthrough comment.
4987
4988 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4989 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4990
4991 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4992 following regular expressions:
4993
4994 @itemize @bullet
4995
4996 @item @code{-fallthrough}
4997
4998 @item @code{@@fallthrough@@}
4999
5000 @item @code{lint -fallthrough[ \t]*}
5001
5002 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5003
5004 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5005
5006 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5007
5008 @end itemize
5009
5010 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5011 following regular expressions:
5012
5013 @itemize @bullet
5014
5015 @item @code{-fallthrough}
5016
5017 @item @code{@@fallthrough@@}
5018
5019 @item @code{lint -fallthrough[ \t]*}
5020
5021 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5022
5023 @end itemize
5024
5025 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5026 fallthrough comments, only attributes disable the warning.
5027
5028 @end itemize
5029
5030 The comment needs to be followed after optional whitespace and other comments
5031 by @code{case} or @code{default} keywords or by a user label that precedes some
5032 @code{case} or @code{default} label.
5033
5034 @smallexample
5035 @group
5036 switch (cond)
5037 @{
5038 case 1:
5039 bar (0);
5040 /* FALLTHRU */
5041 default:
5042 @dots{}
5043 @}
5044 @end group
5045 @end smallexample
5046
5047 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5048
5049 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5050 @opindex Wif-not-aligned
5051 @opindex Wno-if-not-aligned
5052 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5053 should be issued. This is enabled by default.
5054 Use @option{-Wno-if-not-aligned} to disable it.
5055
5056 @item -Wignored-qualifiers @r{(C and C++ only)}
5057 @opindex Wignored-qualifiers
5058 @opindex Wno-ignored-qualifiers
5059 Warn if the return type of a function has a type qualifier
5060 such as @code{const}. For ISO C such a type qualifier has no effect,
5061 since the value returned by a function is not an lvalue.
5062 For C++, the warning is only emitted for scalar types or @code{void}.
5063 ISO C prohibits qualified @code{void} return types on function
5064 definitions, so such return types always receive a warning
5065 even without this option.
5066
5067 This warning is also enabled by @option{-Wextra}.
5068
5069 @item -Wignored-attributes @r{(C and C++ only)}
5070 @opindex Wignored-attributes
5071 @opindex Wno-ignored-attributes
5072 Warn when an attribute is ignored. This is different from the
5073 @option{-Wattributes} option in that it warns whenever the compiler decides
5074 to drop an attribute, not that the attribute is either unknown, used in a
5075 wrong place, etc. This warning is enabled by default.
5076
5077 @item -Wmain
5078 @opindex Wmain
5079 @opindex Wno-main
5080 Warn if the type of @code{main} is suspicious. @code{main} should be
5081 a function with external linkage, returning int, taking either zero
5082 arguments, two, or three arguments of appropriate types. This warning
5083 is enabled by default in C++ and is enabled by either @option{-Wall}
5084 or @option{-Wpedantic}.
5085
5086 @item -Wmisleading-indentation @r{(C and C++ only)}
5087 @opindex Wmisleading-indentation
5088 @opindex Wno-misleading-indentation
5089 Warn when the indentation of the code does not reflect the block structure.
5090 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5091 @code{for} clauses with a guarded statement that does not use braces,
5092 followed by an unguarded statement with the same indentation.
5093
5094 In the following example, the call to ``bar'' is misleadingly indented as
5095 if it were guarded by the ``if'' conditional.
5096
5097 @smallexample
5098 if (some_condition ())
5099 foo ();
5100 bar (); /* Gotcha: this is not guarded by the "if". */
5101 @end smallexample
5102
5103 In the case of mixed tabs and spaces, the warning uses the
5104 @option{-ftabstop=} option to determine if the statements line up
5105 (defaulting to 8).
5106
5107 The warning is not issued for code involving multiline preprocessor logic
5108 such as the following example.
5109
5110 @smallexample
5111 if (flagA)
5112 foo (0);
5113 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5114 if (flagB)
5115 #endif
5116 foo (1);
5117 @end smallexample
5118
5119 The warning is not issued after a @code{#line} directive, since this
5120 typically indicates autogenerated code, and no assumptions can be made
5121 about the layout of the file that the directive references.
5122
5123 This warning is enabled by @option{-Wall} in C and C++.
5124
5125 @item -Wmissing-attributes
5126 @opindex Wmissing-attributes
5127 @opindex Wno-missing-attributes
5128 Warn when a declaration of a function is missing one or more attributes
5129 that a related function is declared with and whose absence may adversely
5130 affect the correctness or efficiency of generated code. For example,
5131 the warning is issued for declarations of aliases that use attributes
5132 to specify less restrictive requirements than those of their targets.
5133 This typically represents a potential optimization opportunity.
5134 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5135 issued when the alias is more restrictive than the target, which could
5136 lead to incorrect code generation.
5137 Attributes considered include @code{alloc_align}, @code{alloc_size},
5138 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5139 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5140 @code{returns_nonnull}, and @code{returns_twice}.
5141
5142 In C++, the warning is issued when an explicit specialization of a primary
5143 template declared with attribute @code{alloc_align}, @code{alloc_size},
5144 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5145 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5146 @code{error}, and @code{warning} suppress the warning.
5147 (@pxref{Function Attributes}).
5148
5149 You can use the @code{copy} attribute to apply the same
5150 set of attributes to a declaration as that on another declaration without
5151 explicitly enumerating the attributes. This attribute can be applied
5152 to declarations of functions (@pxref{Common Function Attributes}),
5153 variables (@pxref{Common Variable Attributes}), or types
5154 (@pxref{Common Type Attributes}).
5155
5156 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5157
5158 For example, since the declaration of the primary function template
5159 below makes use of both attribute @code{malloc} and @code{alloc_size}
5160 the declaration of the explicit specialization of the template is
5161 diagnosed because it is missing one of the attributes.
5162
5163 @smallexample
5164 template <class T>
5165 T* __attribute__ ((malloc, alloc_size (1)))
5166 allocate (size_t);
5167
5168 template <>
5169 void* __attribute__ ((malloc)) // missing alloc_size
5170 allocate<void> (size_t);
5171 @end smallexample
5172
5173 @item -Wmissing-braces
5174 @opindex Wmissing-braces
5175 @opindex Wno-missing-braces
5176 Warn if an aggregate or union initializer is not fully bracketed. In
5177 the following example, the initializer for @code{a} is not fully
5178 bracketed, but that for @code{b} is fully bracketed. This warning is
5179 enabled by @option{-Wall} in C.
5180
5181 @smallexample
5182 int a[2][2] = @{ 0, 1, 2, 3 @};
5183 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5184 @end smallexample
5185
5186 This warning is enabled by @option{-Wall}.
5187
5188 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5189 @opindex Wmissing-include-dirs
5190 @opindex Wno-missing-include-dirs
5191 Warn if a user-supplied include directory does not exist.
5192
5193 @item -Wmissing-profile
5194 @opindex Wmissing-profile
5195 @opindex Wno-missing-profile
5196 Warn if feedback profiles are missing when using the
5197 @option{-fprofile-use} option.
5198 This option diagnoses those cases where a new function or a new file is added
5199 to the user code between compiling with @option{-fprofile-generate} and with
5200 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5201 profile feedback data files do not contain any profile feedback information for
5202 the newly added function or file respectively. Also, in the case when profile
5203 count data (.gcda) files are removed, GCC cannot use any profile feedback
5204 information. In all these cases, warnings are issued to inform the user that a
5205 profile generation step is due. @option{-Wno-missing-profile} can be used to
5206 disable the warning. Ignoring the warning can result in poorly optimized code.
5207 Completely disabling the warning is not recommended and should be done only
5208 when non-existent profile data is justified.
5209
5210 @item -Wmultistatement-macros
5211 @opindex Wmultistatement-macros
5212 @opindex Wno-multistatement-macros
5213 Warn about unsafe multiple statement macros that appear to be guarded
5214 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5215 @code{while}, in which only the first statement is actually guarded after
5216 the macro is expanded.
5217
5218 For example:
5219
5220 @smallexample
5221 #define DOIT x++; y++
5222 if (c)
5223 DOIT;
5224 @end smallexample
5225
5226 will increment @code{y} unconditionally, not just when @code{c} holds.
5227 The can usually be fixed by wrapping the macro in a do-while loop:
5228 @smallexample
5229 #define DOIT do @{ x++; y++; @} while (0)
5230 if (c)
5231 DOIT;
5232 @end smallexample
5233
5234 This warning is enabled by @option{-Wall} in C and C++.
5235
5236 @item -Wparentheses
5237 @opindex Wparentheses
5238 @opindex Wno-parentheses
5239 Warn if parentheses are omitted in certain contexts, such
5240 as when there is an assignment in a context where a truth value
5241 is expected, or when operators are nested whose precedence people
5242 often get confused about.
5243
5244 Also warn if a comparison like @code{x<=y<=z} appears; this is
5245 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5246 interpretation from that of ordinary mathematical notation.
5247
5248 Also warn for dangerous uses of the GNU extension to
5249 @code{?:} with omitted middle operand. When the condition
5250 in the @code{?}: operator is a boolean expression, the omitted value is
5251 always 1. Often programmers expect it to be a value computed
5252 inside the conditional expression instead.
5253
5254 For C++ this also warns for some cases of unnecessary parentheses in
5255 declarations, which can indicate an attempt at a function call instead
5256 of a declaration:
5257 @smallexample
5258 @{
5259 // Declares a local variable called mymutex.
5260 std::unique_lock<std::mutex> (mymutex);
5261 // User meant std::unique_lock<std::mutex> lock (mymutex);
5262 @}
5263 @end smallexample
5264
5265 This warning is enabled by @option{-Wall}.
5266
5267 @item -Wsequence-point
5268 @opindex Wsequence-point
5269 @opindex Wno-sequence-point
5270 Warn about code that may have undefined semantics because of violations
5271 of sequence point rules in the C and C++ standards.
5272
5273 The C and C++ standards define the order in which expressions in a C/C++
5274 program are evaluated in terms of @dfn{sequence points}, which represent
5275 a partial ordering between the execution of parts of the program: those
5276 executed before the sequence point, and those executed after it. These
5277 occur after the evaluation of a full expression (one which is not part
5278 of a larger expression), after the evaluation of the first operand of a
5279 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5280 function is called (but after the evaluation of its arguments and the
5281 expression denoting the called function), and in certain other places.
5282 Other than as expressed by the sequence point rules, the order of
5283 evaluation of subexpressions of an expression is not specified. All
5284 these rules describe only a partial order rather than a total order,
5285 since, for example, if two functions are called within one expression
5286 with no sequence point between them, the order in which the functions
5287 are called is not specified. However, the standards committee have
5288 ruled that function calls do not overlap.
5289
5290 It is not specified when between sequence points modifications to the
5291 values of objects take effect. Programs whose behavior depends on this
5292 have undefined behavior; the C and C++ standards specify that ``Between
5293 the previous and next sequence point an object shall have its stored
5294 value modified at most once by the evaluation of an expression.
5295 Furthermore, the prior value shall be read only to determine the value
5296 to be stored.''. If a program breaks these rules, the results on any
5297 particular implementation are entirely unpredictable.
5298
5299 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5300 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5301 diagnosed by this option, and it may give an occasional false positive
5302 result, but in general it has been found fairly effective at detecting
5303 this sort of problem in programs.
5304
5305 The C++17 standard will define the order of evaluation of operands in
5306 more cases: in particular it requires that the right-hand side of an
5307 assignment be evaluated before the left-hand side, so the above
5308 examples are no longer undefined. But this warning will still warn
5309 about them, to help people avoid writing code that is undefined in C
5310 and earlier revisions of C++.
5311
5312 The standard is worded confusingly, therefore there is some debate
5313 over the precise meaning of the sequence point rules in subtle cases.
5314 Links to discussions of the problem, including proposed formal
5315 definitions, may be found on the GCC readings page, at
5316 @uref{http://gcc.gnu.org/@/readings.html}.
5317
5318 This warning is enabled by @option{-Wall} for C and C++.
5319
5320 @item -Wno-return-local-addr
5321 @opindex Wno-return-local-addr
5322 @opindex Wreturn-local-addr
5323 Do not warn about returning a pointer (or in C++, a reference) to a
5324 variable that goes out of scope after the function returns.
5325
5326 @item -Wreturn-type
5327 @opindex Wreturn-type
5328 @opindex Wno-return-type
5329 Warn whenever a function is defined with a return type that defaults
5330 to @code{int}. Also warn about any @code{return} statement with no
5331 return value in a function whose return type is not @code{void}
5332 (falling off the end of the function body is considered returning
5333 without a value).
5334
5335 For C only, warn about a @code{return} statement with an expression in a
5336 function whose return type is @code{void}, unless the expression type is
5337 also @code{void}. As a GNU extension, the latter case is accepted
5338 without a warning unless @option{-Wpedantic} is used. Attempting
5339 to use the return value of a non-@code{void} function other than @code{main}
5340 that flows off the end by reaching the closing curly brace that terminates
5341 the function is undefined.
5342
5343 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5344 than @code{main} results in undefined behavior even when the value of
5345 the function is not used.
5346
5347 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5348
5349 @item -Wshift-count-negative
5350 @opindex Wshift-count-negative
5351 @opindex Wno-shift-count-negative
5352 Warn if shift count is negative. This warning is enabled by default.
5353
5354 @item -Wshift-count-overflow
5355 @opindex Wshift-count-overflow
5356 @opindex Wno-shift-count-overflow
5357 Warn if shift count >= width of type. This warning is enabled by default.
5358
5359 @item -Wshift-negative-value
5360 @opindex Wshift-negative-value
5361 @opindex Wno-shift-negative-value
5362 Warn if left shifting a negative value. This warning is enabled by
5363 @option{-Wextra} in C99 and C++11 modes (and newer).
5364
5365 @item -Wshift-overflow
5366 @itemx -Wshift-overflow=@var{n}
5367 @opindex Wshift-overflow
5368 @opindex Wno-shift-overflow
5369 Warn about left shift overflows. This warning is enabled by
5370 default in C99 and C++11 modes (and newer).
5371
5372 @table @gcctabopt
5373 @item -Wshift-overflow=1
5374 This is the warning level of @option{-Wshift-overflow} and is enabled
5375 by default in C99 and C++11 modes (and newer). This warning level does
5376 not warn about left-shifting 1 into the sign bit. (However, in C, such
5377 an overflow is still rejected in contexts where an integer constant expression
5378 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5379 shifts always wrap.
5380
5381 @item -Wshift-overflow=2
5382 This warning level also warns about left-shifting 1 into the sign bit,
5383 unless C++14 mode (or newer) is active.
5384 @end table
5385
5386 @item -Wswitch
5387 @opindex Wswitch
5388 @opindex Wno-switch
5389 Warn whenever a @code{switch} statement has an index of enumerated type
5390 and lacks a @code{case} for one or more of the named codes of that
5391 enumeration. (The presence of a @code{default} label prevents this
5392 warning.) @code{case} labels outside the enumeration range also
5393 provoke warnings when this option is used (even if there is a
5394 @code{default} label).
5395 This warning is enabled by @option{-Wall}.
5396
5397 @item -Wswitch-default
5398 @opindex Wswitch-default
5399 @opindex Wno-switch-default
5400 Warn whenever a @code{switch} statement does not have a @code{default}
5401 case.
5402
5403 @item -Wswitch-enum
5404 @opindex Wswitch-enum
5405 @opindex Wno-switch-enum
5406 Warn whenever a @code{switch} statement has an index of enumerated type
5407 and lacks a @code{case} for one or more of the named codes of that
5408 enumeration. @code{case} labels outside the enumeration range also
5409 provoke warnings when this option is used. The only difference
5410 between @option{-Wswitch} and this option is that this option gives a
5411 warning about an omitted enumeration code even if there is a
5412 @code{default} label.
5413
5414 @item -Wswitch-bool
5415 @opindex Wswitch-bool
5416 @opindex Wno-switch-bool
5417 Warn whenever a @code{switch} statement has an index of boolean type
5418 and the case values are outside the range of a boolean type.
5419 It is possible to suppress this warning by casting the controlling
5420 expression to a type other than @code{bool}. For example:
5421 @smallexample
5422 @group
5423 switch ((int) (a == 4))
5424 @{
5425 @dots{}
5426 @}
5427 @end group
5428 @end smallexample
5429 This warning is enabled by default for C and C++ programs.
5430
5431 @item -Wswitch-outside-range
5432 @opindex Wswitch-outside-range
5433 @opindex Wno-switch-outside-range
5434 Warn whenever a @code{switch} case has a value that is outside of its
5435 respective type range. This warning is enabled by default for
5436 C and C++ programs.
5437
5438 @item -Wswitch-unreachable
5439 @opindex Wswitch-unreachable
5440 @opindex Wno-switch-unreachable
5441 Warn whenever a @code{switch} statement contains statements between the
5442 controlling expression and the first case label, which will never be
5443 executed. For example:
5444 @smallexample
5445 @group
5446 switch (cond)
5447 @{
5448 i = 15;
5449 @dots{}
5450 case 5:
5451 @dots{}
5452 @}
5453 @end group
5454 @end smallexample
5455 @option{-Wswitch-unreachable} does not warn if the statement between the
5456 controlling expression and the first case label is just a declaration:
5457 @smallexample
5458 @group
5459 switch (cond)
5460 @{
5461 int i;
5462 @dots{}
5463 case 5:
5464 i = 5;
5465 @dots{}
5466 @}
5467 @end group
5468 @end smallexample
5469 This warning is enabled by default for C and C++ programs.
5470
5471 @item -Wsync-nand @r{(C and C++ only)}
5472 @opindex Wsync-nand
5473 @opindex Wno-sync-nand
5474 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5475 built-in functions are used. These functions changed semantics in GCC 4.4.
5476
5477 @item -Wunused-but-set-parameter
5478 @opindex Wunused-but-set-parameter
5479 @opindex Wno-unused-but-set-parameter
5480 Warn whenever a function parameter is assigned to, but otherwise unused
5481 (aside from its declaration).
5482
5483 To suppress this warning use the @code{unused} attribute
5484 (@pxref{Variable Attributes}).
5485
5486 This warning is also enabled by @option{-Wunused} together with
5487 @option{-Wextra}.
5488
5489 @item -Wunused-but-set-variable
5490 @opindex Wunused-but-set-variable
5491 @opindex Wno-unused-but-set-variable
5492 Warn whenever a local variable is assigned to, but otherwise unused
5493 (aside from its declaration).
5494 This warning is enabled by @option{-Wall}.
5495
5496 To suppress this warning use the @code{unused} attribute
5497 (@pxref{Variable Attributes}).
5498
5499 This warning is also enabled by @option{-Wunused}, which is enabled
5500 by @option{-Wall}.
5501
5502 @item -Wunused-function
5503 @opindex Wunused-function
5504 @opindex Wno-unused-function
5505 Warn whenever a static function is declared but not defined or a
5506 non-inline static function is unused.
5507 This warning is enabled by @option{-Wall}.
5508
5509 @item -Wunused-label
5510 @opindex Wunused-label
5511 @opindex Wno-unused-label
5512 Warn whenever a label is declared but not used.
5513 This warning is enabled by @option{-Wall}.
5514
5515 To suppress this warning use the @code{unused} attribute
5516 (@pxref{Variable Attributes}).
5517
5518 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5519 @opindex Wunused-local-typedefs
5520 @opindex Wno-unused-local-typedefs
5521 Warn when a typedef locally defined in a function is not used.
5522 This warning is enabled by @option{-Wall}.
5523
5524 @item -Wunused-parameter
5525 @opindex Wunused-parameter
5526 @opindex Wno-unused-parameter
5527 Warn whenever a function parameter is unused aside from its declaration.
5528
5529 To suppress this warning use the @code{unused} attribute
5530 (@pxref{Variable Attributes}).
5531
5532 @item -Wno-unused-result
5533 @opindex Wunused-result
5534 @opindex Wno-unused-result
5535 Do not warn if a caller of a function marked with attribute
5536 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5537 its return value. The default is @option{-Wunused-result}.
5538
5539 @item -Wunused-variable
5540 @opindex Wunused-variable
5541 @opindex Wno-unused-variable
5542 Warn whenever a local or static variable is unused aside from its
5543 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5544 but not for C++. This warning is enabled by @option{-Wall}.
5545
5546 To suppress this warning use the @code{unused} attribute
5547 (@pxref{Variable Attributes}).
5548
5549 @item -Wunused-const-variable
5550 @itemx -Wunused-const-variable=@var{n}
5551 @opindex Wunused-const-variable
5552 @opindex Wno-unused-const-variable
5553 Warn whenever a constant static variable is unused aside from its declaration.
5554 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5555 for C, but not for C++. In C this declares variable storage, but in C++ this
5556 is not an error since const variables take the place of @code{#define}s.
5557
5558 To suppress this warning use the @code{unused} attribute
5559 (@pxref{Variable Attributes}).
5560
5561 @table @gcctabopt
5562 @item -Wunused-const-variable=1
5563 This is the warning level that is enabled by @option{-Wunused-variable} for
5564 C. It warns only about unused static const variables defined in the main
5565 compilation unit, but not about static const variables declared in any
5566 header included.
5567
5568 @item -Wunused-const-variable=2
5569 This warning level also warns for unused constant static variables in
5570 headers (excluding system headers). This is the warning level of
5571 @option{-Wunused-const-variable} and must be explicitly requested since
5572 in C++ this isn't an error and in C it might be harder to clean up all
5573 headers included.
5574 @end table
5575
5576 @item -Wunused-value
5577 @opindex Wunused-value
5578 @opindex Wno-unused-value
5579 Warn whenever a statement computes a result that is explicitly not
5580 used. To suppress this warning cast the unused expression to
5581 @code{void}. This includes an expression-statement or the left-hand
5582 side of a comma expression that contains no side effects. For example,
5583 an expression such as @code{x[i,j]} causes a warning, while
5584 @code{x[(void)i,j]} does not.
5585
5586 This warning is enabled by @option{-Wall}.
5587
5588 @item -Wunused
5589 @opindex Wunused
5590 @opindex Wno-unused
5591 All the above @option{-Wunused} options combined.
5592
5593 In order to get a warning about an unused function parameter, you must
5594 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5595 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5596
5597 @item -Wuninitialized
5598 @opindex Wuninitialized
5599 @opindex Wno-uninitialized
5600 Warn if an automatic variable is used without first being initialized.
5601 In C++, warn if a non-static reference or non-static @code{const}
5602 member appears in a class without constructors.
5603
5604 If you want to warn about code that uses the uninitialized value of the
5605 variable in its own initializer, use the @option{-Winit-self} option.
5606
5607 These warnings occur for individual uninitialized elements of
5608 structure, union or array variables as well as for variables that are
5609 uninitialized as a whole. They do not occur for variables or elements
5610 declared @code{volatile}. Because these warnings depend on
5611 optimization, the exact variables or elements for which there are
5612 warnings depend on the precise optimization options and version of GCC
5613 used.
5614
5615 Note that there may be no warning about a variable that is used only
5616 to compute a value that itself is never used, because such
5617 computations may be deleted by data flow analysis before the warnings
5618 are printed.
5619
5620 @item -Winvalid-memory-model
5621 @opindex Winvalid-memory-model
5622 @opindex Wno-invalid-memory-model
5623 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5624 and the C11 atomic generic functions with a memory consistency argument
5625 that is either invalid for the operation or outside the range of values
5626 of the @code{memory_order} enumeration. For example, since the
5627 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5628 defined for the relaxed, release, and sequentially consistent memory
5629 orders the following code is diagnosed:
5630
5631 @smallexample
5632 void store (int *i)
5633 @{
5634 __atomic_store_n (i, 0, memory_order_consume);
5635 @}
5636 @end smallexample
5637
5638 @option{-Winvalid-memory-model} is enabled by default.
5639
5640 @item -Wmaybe-uninitialized
5641 @opindex Wmaybe-uninitialized
5642 @opindex Wno-maybe-uninitialized
5643 For an automatic (i.e.@: local) variable, if there exists a path from the
5644 function entry to a use of the variable that is initialized, but there exist
5645 some other paths for which the variable is not initialized, the compiler
5646 emits a warning if it cannot prove the uninitialized paths are not
5647 executed at run time.
5648
5649 These warnings are only possible in optimizing compilation, because otherwise
5650 GCC does not keep track of the state of variables.
5651
5652 These warnings are made optional because GCC may not be able to determine when
5653 the code is correct in spite of appearing to have an error. Here is one
5654 example of how this can happen:
5655
5656 @smallexample
5657 @group
5658 @{
5659 int x;
5660 switch (y)
5661 @{
5662 case 1: x = 1;
5663 break;
5664 case 2: x = 4;
5665 break;
5666 case 3: x = 5;
5667 @}
5668 foo (x);
5669 @}
5670 @end group
5671 @end smallexample
5672
5673 @noindent
5674 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5675 always initialized, but GCC doesn't know this. To suppress the
5676 warning, you need to provide a default case with assert(0) or
5677 similar code.
5678
5679 @cindex @code{longjmp} warnings
5680 This option also warns when a non-volatile automatic variable might be
5681 changed by a call to @code{longjmp}.
5682 The compiler sees only the calls to @code{setjmp}. It cannot know
5683 where @code{longjmp} will be called; in fact, a signal handler could
5684 call it at any point in the code. As a result, you may get a warning
5685 even when there is in fact no problem because @code{longjmp} cannot
5686 in fact be called at the place that would cause a problem.
5687
5688 Some spurious warnings can be avoided if you declare all the functions
5689 you use that never return as @code{noreturn}. @xref{Function
5690 Attributes}.
5691
5692 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5693
5694 @item -Wunknown-pragmas
5695 @opindex Wunknown-pragmas
5696 @opindex Wno-unknown-pragmas
5697 @cindex warning for unknown pragmas
5698 @cindex unknown pragmas, warning
5699 @cindex pragmas, warning of unknown
5700 Warn when a @code{#pragma} directive is encountered that is not understood by
5701 GCC@. If this command-line option is used, warnings are even issued
5702 for unknown pragmas in system header files. This is not the case if
5703 the warnings are only enabled by the @option{-Wall} command-line option.
5704
5705 @item -Wno-pragmas
5706 @opindex Wno-pragmas
5707 @opindex Wpragmas
5708 Do not warn about misuses of pragmas, such as incorrect parameters,
5709 invalid syntax, or conflicts between pragmas. See also
5710 @option{-Wunknown-pragmas}.
5711
5712 @item -Wno-prio-ctor-dtor
5713 @opindex Wno-prio-ctor-dtor
5714 @opindex Wprio-ctor-dtor
5715 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5716 The use of constructor and destructor attributes allow you to assign a
5717 priority to the constructor/destructor to control its order of execution
5718 before @code{main} is called or after it returns. The priority values must be
5719 greater than 100 as the compiler reserves priority values between 0--100 for
5720 the implementation.
5721
5722 @item -Wstrict-aliasing
5723 @opindex Wstrict-aliasing
5724 @opindex Wno-strict-aliasing
5725 This option is only active when @option{-fstrict-aliasing} is active.
5726 It warns about code that might break the strict aliasing rules that the
5727 compiler is using for optimization. The warning does not catch all
5728 cases, but does attempt to catch the more common pitfalls. It is
5729 included in @option{-Wall}.
5730 It is equivalent to @option{-Wstrict-aliasing=3}
5731
5732 @item -Wstrict-aliasing=n
5733 @opindex Wstrict-aliasing=n
5734 This option is only active when @option{-fstrict-aliasing} is active.
5735 It warns about code that might break the strict aliasing rules that the
5736 compiler is using for optimization.
5737 Higher levels correspond to higher accuracy (fewer false positives).
5738 Higher levels also correspond to more effort, similar to the way @option{-O}
5739 works.
5740 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5741
5742 Level 1: Most aggressive, quick, least accurate.
5743 Possibly useful when higher levels
5744 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5745 false negatives. However, it has many false positives.
5746 Warns for all pointer conversions between possibly incompatible types,
5747 even if never dereferenced. Runs in the front end only.
5748
5749 Level 2: Aggressive, quick, not too precise.
5750 May still have many false positives (not as many as level 1 though),
5751 and few false negatives (but possibly more than level 1).
5752 Unlike level 1, it only warns when an address is taken. Warns about
5753 incomplete types. Runs in the front end only.
5754
5755 Level 3 (default for @option{-Wstrict-aliasing}):
5756 Should have very few false positives and few false
5757 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5758 Takes care of the common pun+dereference pattern in the front end:
5759 @code{*(int*)&some_float}.
5760 If optimization is enabled, it also runs in the back end, where it deals
5761 with multiple statement cases using flow-sensitive points-to information.
5762 Only warns when the converted pointer is dereferenced.
5763 Does not warn about incomplete types.
5764
5765 @item -Wstrict-overflow
5766 @itemx -Wstrict-overflow=@var{n}
5767 @opindex Wstrict-overflow
5768 @opindex Wno-strict-overflow
5769 This option is only active when signed overflow is undefined.
5770 It warns about cases where the compiler optimizes based on the
5771 assumption that signed overflow does not occur. Note that it does not
5772 warn about all cases where the code might overflow: it only warns
5773 about cases where the compiler implements some optimization. Thus
5774 this warning depends on the optimization level.
5775
5776 An optimization that assumes that signed overflow does not occur is
5777 perfectly safe if the values of the variables involved are such that
5778 overflow never does, in fact, occur. Therefore this warning can
5779 easily give a false positive: a warning about code that is not
5780 actually a problem. To help focus on important issues, several
5781 warning levels are defined. No warnings are issued for the use of
5782 undefined signed overflow when estimating how many iterations a loop
5783 requires, in particular when determining whether a loop will be
5784 executed at all.
5785
5786 @table @gcctabopt
5787 @item -Wstrict-overflow=1
5788 Warn about cases that are both questionable and easy to avoid. For
5789 example the compiler simplifies
5790 @code{x + 1 > x} to @code{1}. This level of
5791 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5792 are not, and must be explicitly requested.
5793
5794 @item -Wstrict-overflow=2
5795 Also warn about other cases where a comparison is simplified to a
5796 constant. For example: @code{abs (x) >= 0}. This can only be
5797 simplified when signed integer overflow is undefined, because
5798 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5799 zero. @option{-Wstrict-overflow} (with no level) is the same as
5800 @option{-Wstrict-overflow=2}.
5801
5802 @item -Wstrict-overflow=3
5803 Also warn about other cases where a comparison is simplified. For
5804 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5805
5806 @item -Wstrict-overflow=4
5807 Also warn about other simplifications not covered by the above cases.
5808 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5809
5810 @item -Wstrict-overflow=5
5811 Also warn about cases where the compiler reduces the magnitude of a
5812 constant involved in a comparison. For example: @code{x + 2 > y} is
5813 simplified to @code{x + 1 >= y}. This is reported only at the
5814 highest warning level because this simplification applies to many
5815 comparisons, so this warning level gives a very large number of
5816 false positives.
5817 @end table
5818
5819 @item -Wstring-compare
5820 @opindex Wstring-compare
5821 @opindex Wno-string-compare
5822 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
5823 determined to be either zero or non-zero in tests for such equality
5824 owing to the length of one argument being greater than the size of
5825 the array the other argument is stored in (or the bound in the case
5826 of @code{strncmp}). Such calls could be mistakes. For example,
5827 the call to @code{strcmp} below is diagnosed because its result is
5828 necessarily non-zero irrespective of the contents of the array @code{a}.
5829
5830 @smallexample
5831 extern char a[4];
5832 void f (char *d)
5833 @{
5834 strcpy (d, "string");
5835 @dots{}
5836 if (0 == strcmp (a, d)) // cannot be true
5837 puts ("a and d are the same");
5838 @}
5839 @end smallexample
5840
5841 @option{-Wstring-compare} is enabled by @option{-Wextra}.
5842
5843 @item -Wstringop-overflow
5844 @itemx -Wstringop-overflow=@var{type}
5845 @opindex Wstringop-overflow
5846 @opindex Wno-stringop-overflow
5847 Warn for calls to string manipulation functions such as @code{memcpy} and
5848 @code{strcpy} that are determined to overflow the destination buffer. The
5849 optional argument is one greater than the type of Object Size Checking to
5850 perform to determine the size of the destination. @xref{Object Size Checking}.
5851 The argument is meaningful only for functions that operate on character arrays
5852 but not for raw memory functions like @code{memcpy} which always make use
5853 of Object Size type-0. The option also warns for calls that specify a size
5854 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5855 The option produces the best results with optimization enabled but can detect
5856 a small subset of simple buffer overflows even without optimization in
5857 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5858 correspond to the standard functions. In any case, the option warns about
5859 just a subset of buffer overflows detected by the corresponding overflow
5860 checking built-ins. For example, the option will issue a warning for
5861 the @code{strcpy} call below because it copies at least 5 characters
5862 (the string @code{"blue"} including the terminating NUL) into the buffer
5863 of size 4.
5864
5865 @smallexample
5866 enum Color @{ blue, purple, yellow @};
5867 const char* f (enum Color clr)
5868 @{
5869 static char buf [4];
5870 const char *str;
5871 switch (clr)
5872 @{
5873 case blue: str = "blue"; break;
5874 case purple: str = "purple"; break;
5875 case yellow: str = "yellow"; break;
5876 @}
5877
5878 return strcpy (buf, str); // warning here
5879 @}
5880 @end smallexample
5881
5882 Option @option{-Wstringop-overflow=2} is enabled by default.
5883
5884 @table @gcctabopt
5885 @item -Wstringop-overflow
5886 @itemx -Wstringop-overflow=1
5887 @opindex Wstringop-overflow
5888 @opindex Wno-stringop-overflow
5889 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5890 to determine the sizes of destination objects. This is the default setting
5891 of the option. At this setting the option will not warn for writes past
5892 the end of subobjects of larger objects accessed by pointers unless the
5893 size of the largest surrounding object is known. When the destination may
5894 be one of several objects it is assumed to be the largest one of them. On
5895 Linux systems, when optimization is enabled at this setting the option warns
5896 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5897 a non-zero value.
5898
5899 @item -Wstringop-overflow=2
5900 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5901 to determine the sizes of destination objects. At this setting the option
5902 will warn about overflows when writing to members of the largest complete
5903 objects whose exact size is known. It will, however, not warn for excessive
5904 writes to the same members of unknown objects referenced by pointers since
5905 they may point to arrays containing unknown numbers of elements.
5906
5907 @item -Wstringop-overflow=3
5908 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5909 to determine the sizes of destination objects. At this setting the option
5910 warns about overflowing the smallest object or data member. This is the
5911 most restrictive setting of the option that may result in warnings for safe
5912 code.
5913
5914 @item -Wstringop-overflow=4
5915 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5916 to determine the sizes of destination objects. At this setting the option
5917 will warn about overflowing any data members, and when the destination is
5918 one of several objects it uses the size of the largest of them to decide
5919 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5920 setting of the option may result in warnings for benign code.
5921 @end table
5922
5923 @item -Wstringop-truncation
5924 @opindex Wstringop-truncation
5925 @opindex Wno-stringop-truncation
5926 Warn for calls to bounded string manipulation functions such as @code{strncat},
5927 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5928 or leave the destination unchanged.
5929
5930 In the following example, the call to @code{strncat} specifies a bound that
5931 is less than the length of the source string. As a result, the copy of
5932 the source will be truncated and so the call is diagnosed. To avoid the
5933 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5934
5935 @smallexample
5936 void append (char *buf, size_t bufsize)
5937 @{
5938 strncat (buf, ".txt", 3);
5939 @}
5940 @end smallexample
5941
5942 As another example, the following call to @code{strncpy} results in copying
5943 to @code{d} just the characters preceding the terminating NUL, without
5944 appending the NUL to the end. Assuming the result of @code{strncpy} is
5945 necessarily a NUL-terminated string is a common mistake, and so the call
5946 is diagnosed. To avoid the warning when the result is not expected to be
5947 NUL-terminated, call @code{memcpy} instead.
5948
5949 @smallexample
5950 void copy (char *d, const char *s)
5951 @{
5952 strncpy (d, s, strlen (s));
5953 @}
5954 @end smallexample
5955
5956 In the following example, the call to @code{strncpy} specifies the size
5957 of the destination buffer as the bound. If the length of the source
5958 string is equal to or greater than this size the result of the copy will
5959 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5960 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5961 element of the buffer to @code{NUL}.
5962
5963 @smallexample
5964 void copy (const char *s)
5965 @{
5966 char buf[80];
5967 strncpy (buf, s, sizeof buf);
5968 @dots{}
5969 @}
5970 @end smallexample
5971
5972 In situations where a character array is intended to store a sequence
5973 of bytes with no terminating @code{NUL} such an array may be annotated
5974 with attribute @code{nonstring} to avoid this warning. Such arrays,
5975 however, are not suitable arguments to functions that expect
5976 @code{NUL}-terminated strings. To help detect accidental misuses of
5977 such arrays GCC issues warnings unless it can prove that the use is
5978 safe. @xref{Common Variable Attributes}.
5979
5980 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5981 @opindex Wsuggest-attribute=
5982 @opindex Wno-suggest-attribute=
5983 Warn for cases where adding an attribute may be beneficial. The
5984 attributes currently supported are listed below.
5985
5986 @table @gcctabopt
5987 @item -Wsuggest-attribute=pure
5988 @itemx -Wsuggest-attribute=const
5989 @itemx -Wsuggest-attribute=noreturn
5990 @itemx -Wmissing-noreturn
5991 @itemx -Wsuggest-attribute=malloc
5992 @opindex Wsuggest-attribute=pure
5993 @opindex Wno-suggest-attribute=pure
5994 @opindex Wsuggest-attribute=const
5995 @opindex Wno-suggest-attribute=const
5996 @opindex Wsuggest-attribute=noreturn
5997 @opindex Wno-suggest-attribute=noreturn
5998 @opindex Wmissing-noreturn
5999 @opindex Wno-missing-noreturn
6000 @opindex Wsuggest-attribute=malloc
6001 @opindex Wno-suggest-attribute=malloc
6002
6003 Warn about functions that might be candidates for attributes
6004 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
6005 only warns for functions visible in other compilation units or (in the case of
6006 @code{pure} and @code{const}) if it cannot prove that the function returns
6007 normally. A function returns normally if it doesn't contain an infinite loop or
6008 return abnormally by throwing, calling @code{abort} or trapping. This analysis
6009 requires option @option{-fipa-pure-const}, which is enabled by default at
6010 @option{-O} and higher. Higher optimization levels improve the accuracy
6011 of the analysis.
6012
6013 @item -Wsuggest-attribute=format
6014 @itemx -Wmissing-format-attribute
6015 @opindex Wsuggest-attribute=format
6016 @opindex Wmissing-format-attribute
6017 @opindex Wno-suggest-attribute=format
6018 @opindex Wno-missing-format-attribute
6019 @opindex Wformat
6020 @opindex Wno-format
6021
6022 Warn about function pointers that might be candidates for @code{format}
6023 attributes. Note these are only possible candidates, not absolute ones.
6024 GCC guesses that function pointers with @code{format} attributes that
6025 are used in assignment, initialization, parameter passing or return
6026 statements should have a corresponding @code{format} attribute in the
6027 resulting type. I.e.@: the left-hand side of the assignment or
6028 initialization, the type of the parameter variable, or the return type
6029 of the containing function respectively should also have a @code{format}
6030 attribute to avoid the warning.
6031
6032 GCC also warns about function definitions that might be
6033 candidates for @code{format} attributes. Again, these are only
6034 possible candidates. GCC guesses that @code{format} attributes
6035 might be appropriate for any function that calls a function like
6036 @code{vprintf} or @code{vscanf}, but this might not always be the
6037 case, and some functions for which @code{format} attributes are
6038 appropriate may not be detected.
6039
6040 @item -Wsuggest-attribute=cold
6041 @opindex Wsuggest-attribute=cold
6042 @opindex Wno-suggest-attribute=cold
6043
6044 Warn about functions that might be candidates for @code{cold} attribute. This
6045 is based on static detection and generally will only warn about functions which
6046 always leads to a call to another @code{cold} function such as wrappers of
6047 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6048 @end table
6049
6050 @item -Wsuggest-final-types
6051 @opindex Wno-suggest-final-types
6052 @opindex Wsuggest-final-types
6053 Warn about types with virtual methods where code quality would be improved
6054 if the type were declared with the C++11 @code{final} specifier,
6055 or, if possible,
6056 declared in an anonymous namespace. This allows GCC to more aggressively
6057 devirtualize the polymorphic calls. This warning is more effective with
6058 link-time optimization,
6059 where the information about the class hierarchy graph is
6060 more complete.
6061
6062 @item -Wsuggest-final-methods
6063 @opindex Wno-suggest-final-methods
6064 @opindex Wsuggest-final-methods
6065 Warn about virtual methods where code quality would be improved if the method
6066 were declared with the C++11 @code{final} specifier,
6067 or, if possible, its type were
6068 declared in an anonymous namespace or with the @code{final} specifier.
6069 This warning is
6070 more effective with link-time optimization, where the information about the
6071 class hierarchy graph is more complete. It is recommended to first consider
6072 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6073 annotations.
6074
6075 @item -Wsuggest-override
6076 Warn about overriding virtual functions that are not marked with the override
6077 keyword.
6078
6079 @item -Walloc-zero
6080 @opindex Wno-alloc-zero
6081 @opindex Walloc-zero
6082 Warn about calls to allocation functions decorated with attribute
6083 @code{alloc_size} that specify zero bytes, including those to the built-in
6084 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6085 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6086 when called with a zero size differs among implementations (and in the case
6087 of @code{realloc} has been deprecated) relying on it may result in subtle
6088 portability bugs and should be avoided.
6089
6090 @item -Walloc-size-larger-than=@var{byte-size}
6091 @opindex Walloc-size-larger-than=
6092 @opindex Wno-alloc-size-larger-than
6093 Warn about calls to functions decorated with attribute @code{alloc_size}
6094 that attempt to allocate objects larger than the specified number of bytes,
6095 or where the result of the size computation in an integer type with infinite
6096 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6097 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6098 Warnings controlled by the option can be disabled either by specifying
6099 @var{byte-size} of @samp{SIZE_MAX} or more or by
6100 @option{-Wno-alloc-size-larger-than}.
6101 @xref{Function Attributes}.
6102
6103 @item -Wno-alloc-size-larger-than
6104 @opindex Wno-alloc-size-larger-than
6105 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6106 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6107 larger.
6108
6109 @item -Walloca
6110 @opindex Wno-alloca
6111 @opindex Walloca
6112 This option warns on all uses of @code{alloca} in the source.
6113
6114 @item -Walloca-larger-than=@var{byte-size}
6115 @opindex Walloca-larger-than=
6116 @opindex Wno-alloca-larger-than
6117 This option warns on calls to @code{alloca} with an integer argument whose
6118 value is either zero, or that is not bounded by a controlling predicate
6119 that limits its value to at most @var{byte-size}. It also warns for calls
6120 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6121 types are considered unbounded even if they appear to be constrained to
6122 the expected range.
6123
6124 For example, a bounded case of @code{alloca} could be:
6125
6126 @smallexample
6127 void func (size_t n)
6128 @{
6129 void *p;
6130 if (n <= 1000)
6131 p = alloca (n);
6132 else
6133 p = malloc (n);
6134 f (p);
6135 @}
6136 @end smallexample
6137
6138 In the above example, passing @code{-Walloca-larger-than=1000} would not
6139 issue a warning because the call to @code{alloca} is known to be at most
6140 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6141 the compiler would emit a warning.
6142
6143 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6144 controlling predicate constraining its integer argument. For example:
6145
6146 @smallexample
6147 void func ()
6148 @{
6149 void *p = alloca (n);
6150 f (p);
6151 @}
6152 @end smallexample
6153
6154 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6155 a warning, but this time because of the lack of bounds checking.
6156
6157 Note, that even seemingly correct code involving signed integers could
6158 cause a warning:
6159
6160 @smallexample
6161 void func (signed int n)
6162 @{
6163 if (n < 500)
6164 @{
6165 p = alloca (n);
6166 f (p);
6167 @}
6168 @}
6169 @end smallexample
6170
6171 In the above example, @var{n} could be negative, causing a larger than
6172 expected argument to be implicitly cast into the @code{alloca} call.
6173
6174 This option also warns when @code{alloca} is used in a loop.
6175
6176 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6177 but is usually only effective when @option{-ftree-vrp} is active (default
6178 for @option{-O2} and above).
6179
6180 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6181
6182 @item -Wno-alloca-larger-than
6183 @opindex Wno-alloca-larger-than
6184 Disable @option{-Walloca-larger-than=} warnings. The option is
6185 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6186
6187 @item -Warray-bounds
6188 @itemx -Warray-bounds=@var{n}
6189 @opindex Wno-array-bounds
6190 @opindex Warray-bounds
6191 This option is only active when @option{-ftree-vrp} is active
6192 (default for @option{-O2} and above). It warns about subscripts to arrays
6193 that are always out of bounds. This warning is enabled by @option{-Wall}.
6194
6195 @table @gcctabopt
6196 @item -Warray-bounds=1
6197 This is the warning level of @option{-Warray-bounds} and is enabled
6198 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6199
6200 @item -Warray-bounds=2
6201 This warning level also warns about out of bounds access for
6202 arrays at the end of a struct and for arrays accessed through
6203 pointers. This warning level may give a larger number of
6204 false positives and is deactivated by default.
6205 @end table
6206
6207 @item -Wattribute-alias=@var{n}
6208 @itemx -Wno-attribute-alias
6209 @opindex Wattribute-alias
6210 @opindex Wno-attribute-alias
6211 Warn about declarations using the @code{alias} and similar attributes whose
6212 target is incompatible with the type of the alias.
6213 @xref{Function Attributes,,Declaring Attributes of Functions}.
6214
6215 @table @gcctabopt
6216 @item -Wattribute-alias=1
6217 The default warning level of the @option{-Wattribute-alias} option diagnoses
6218 incompatibilities between the type of the alias declaration and that of its
6219 target. Such incompatibilities are typically indicative of bugs.
6220
6221 @item -Wattribute-alias=2
6222
6223 At this level @option{-Wattribute-alias} also diagnoses cases where
6224 the attributes of the alias declaration are more restrictive than the
6225 attributes applied to its target. These mismatches can potentially
6226 result in incorrect code generation. In other cases they may be
6227 benign and could be resolved simply by adding the missing attribute to
6228 the target. For comparison, see the @option{-Wmissing-attributes}
6229 option, which controls diagnostics when the alias declaration is less
6230 restrictive than the target, rather than more restrictive.
6231
6232 Attributes considered include @code{alloc_align}, @code{alloc_size},
6233 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6234 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6235 @code{returns_nonnull}, and @code{returns_twice}.
6236 @end table
6237
6238 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6239 This is the default. You can disable these warnings with either
6240 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6241
6242 @item -Wbool-compare
6243 @opindex Wno-bool-compare
6244 @opindex Wbool-compare
6245 Warn about boolean expression compared with an integer value different from
6246 @code{true}/@code{false}. For instance, the following comparison is
6247 always false:
6248 @smallexample
6249 int n = 5;
6250 @dots{}
6251 if ((n > 1) == 2) @{ @dots{} @}
6252 @end smallexample
6253 This warning is enabled by @option{-Wall}.
6254
6255 @item -Wbool-operation
6256 @opindex Wno-bool-operation
6257 @opindex Wbool-operation
6258 Warn about suspicious operations on expressions of a boolean type. For
6259 instance, bitwise negation of a boolean is very likely a bug in the program.
6260 For C, this warning also warns about incrementing or decrementing a boolean,
6261 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6262 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6263
6264 This warning is enabled by @option{-Wall}.
6265
6266 @item -Wduplicated-branches
6267 @opindex Wno-duplicated-branches
6268 @opindex Wduplicated-branches
6269 Warn when an if-else has identical branches. This warning detects cases like
6270 @smallexample
6271 if (p != NULL)
6272 return 0;
6273 else
6274 return 0;
6275 @end smallexample
6276 It doesn't warn when both branches contain just a null statement. This warning
6277 also warn for conditional operators:
6278 @smallexample
6279 int i = x ? *p : *p;
6280 @end smallexample
6281
6282 @item -Wduplicated-cond
6283 @opindex Wno-duplicated-cond
6284 @opindex Wduplicated-cond
6285 Warn about duplicated conditions in an if-else-if chain. For instance,
6286 warn for the following code:
6287 @smallexample
6288 if (p->q != NULL) @{ @dots{} @}
6289 else if (p->q != NULL) @{ @dots{} @}
6290 @end smallexample
6291
6292 @item -Wframe-address
6293 @opindex Wno-frame-address
6294 @opindex Wframe-address
6295 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6296 is called with an argument greater than 0. Such calls may return indeterminate
6297 values or crash the program. The warning is included in @option{-Wall}.
6298
6299 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6300 @opindex Wno-discarded-qualifiers
6301 @opindex Wdiscarded-qualifiers
6302 Do not warn if type qualifiers on pointers are being discarded.
6303 Typically, the compiler warns if a @code{const char *} variable is
6304 passed to a function that takes a @code{char *} parameter. This option
6305 can be used to suppress such a warning.
6306
6307 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6308 @opindex Wno-discarded-array-qualifiers
6309 @opindex Wdiscarded-array-qualifiers
6310 Do not warn if type qualifiers on arrays which are pointer targets
6311 are being discarded. Typically, the compiler warns if a
6312 @code{const int (*)[]} variable is passed to a function that
6313 takes a @code{int (*)[]} parameter. This option can be used to
6314 suppress such a warning.
6315
6316 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6317 @opindex Wno-incompatible-pointer-types
6318 @opindex Wincompatible-pointer-types
6319 Do not warn when there is a conversion between pointers that have incompatible
6320 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6321 which warns for pointer argument passing or assignment with different
6322 signedness.
6323
6324 @item -Wno-int-conversion @r{(C and Objective-C only)}
6325 @opindex Wno-int-conversion
6326 @opindex Wint-conversion
6327 Do not warn about incompatible integer to pointer and pointer to integer
6328 conversions. This warning is about implicit conversions; for explicit
6329 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6330 @option{-Wno-pointer-to-int-cast} may be used.
6331
6332 @item -Wno-div-by-zero
6333 @opindex Wno-div-by-zero
6334 @opindex Wdiv-by-zero
6335 Do not warn about compile-time integer division by zero. Floating-point
6336 division by zero is not warned about, as it can be a legitimate way of
6337 obtaining infinities and NaNs.
6338
6339 @item -Wsystem-headers
6340 @opindex Wsystem-headers
6341 @opindex Wno-system-headers
6342 @cindex warnings from system headers
6343 @cindex system headers, warnings from
6344 Print warning messages for constructs found in system header files.
6345 Warnings from system headers are normally suppressed, on the assumption
6346 that they usually do not indicate real problems and would only make the
6347 compiler output harder to read. Using this command-line option tells
6348 GCC to emit warnings from system headers as if they occurred in user
6349 code. However, note that using @option{-Wall} in conjunction with this
6350 option does @emph{not} warn about unknown pragmas in system
6351 headers---for that, @option{-Wunknown-pragmas} must also be used.
6352
6353 @item -Wtautological-compare
6354 @opindex Wtautological-compare
6355 @opindex Wno-tautological-compare
6356 Warn if a self-comparison always evaluates to true or false. This
6357 warning detects various mistakes such as:
6358 @smallexample
6359 int i = 1;
6360 @dots{}
6361 if (i > i) @{ @dots{} @}
6362 @end smallexample
6363
6364 This warning also warns about bitwise comparisons that always evaluate
6365 to true or false, for instance:
6366 @smallexample
6367 if ((a & 16) == 10) @{ @dots{} @}
6368 @end smallexample
6369 will always be false.
6370
6371 This warning is enabled by @option{-Wall}.
6372
6373 @item -Wtrampolines
6374 @opindex Wtrampolines
6375 @opindex Wno-trampolines
6376 Warn about trampolines generated for pointers to nested functions.
6377 A trampoline is a small piece of data or code that is created at run
6378 time on the stack when the address of a nested function is taken, and is
6379 used to call the nested function indirectly. For some targets, it is
6380 made up of data only and thus requires no special treatment. But, for
6381 most targets, it is made up of code and thus requires the stack to be
6382 made executable in order for the program to work properly.
6383
6384 @item -Wfloat-equal
6385 @opindex Wfloat-equal
6386 @opindex Wno-float-equal
6387 Warn if floating-point values are used in equality comparisons.
6388
6389 The idea behind this is that sometimes it is convenient (for the
6390 programmer) to consider floating-point values as approximations to
6391 infinitely precise real numbers. If you are doing this, then you need
6392 to compute (by analyzing the code, or in some other way) the maximum or
6393 likely maximum error that the computation introduces, and allow for it
6394 when performing comparisons (and when producing output, but that's a
6395 different problem). In particular, instead of testing for equality, you
6396 should check to see whether the two values have ranges that overlap; and
6397 this is done with the relational operators, so equality comparisons are
6398 probably mistaken.
6399
6400 @item -Wtraditional @r{(C and Objective-C only)}
6401 @opindex Wtraditional
6402 @opindex Wno-traditional
6403 Warn about certain constructs that behave differently in traditional and
6404 ISO C@. Also warn about ISO C constructs that have no traditional C
6405 equivalent, and/or problematic constructs that should be avoided.
6406
6407 @itemize @bullet
6408 @item
6409 Macro parameters that appear within string literals in the macro body.
6410 In traditional C macro replacement takes place within string literals,
6411 but in ISO C it does not.
6412
6413 @item
6414 In traditional C, some preprocessor directives did not exist.
6415 Traditional preprocessors only considered a line to be a directive
6416 if the @samp{#} appeared in column 1 on the line. Therefore
6417 @option{-Wtraditional} warns about directives that traditional C
6418 understands but ignores because the @samp{#} does not appear as the
6419 first character on the line. It also suggests you hide directives like
6420 @code{#pragma} not understood by traditional C by indenting them. Some
6421 traditional implementations do not recognize @code{#elif}, so this option
6422 suggests avoiding it altogether.
6423
6424 @item
6425 A function-like macro that appears without arguments.
6426
6427 @item
6428 The unary plus operator.
6429
6430 @item
6431 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6432 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6433 constants.) Note, these suffixes appear in macros defined in the system
6434 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6435 Use of these macros in user code might normally lead to spurious
6436 warnings, however GCC's integrated preprocessor has enough context to
6437 avoid warning in these cases.
6438
6439 @item
6440 A function declared external in one block and then used after the end of
6441 the block.
6442
6443 @item
6444 A @code{switch} statement has an operand of type @code{long}.
6445
6446 @item
6447 A non-@code{static} function declaration follows a @code{static} one.
6448 This construct is not accepted by some traditional C compilers.
6449
6450 @item
6451 The ISO type of an integer constant has a different width or
6452 signedness from its traditional type. This warning is only issued if
6453 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6454 typically represent bit patterns, are not warned about.
6455
6456 @item
6457 Usage of ISO string concatenation is detected.
6458
6459 @item
6460 Initialization of automatic aggregates.
6461
6462 @item
6463 Identifier conflicts with labels. Traditional C lacks a separate
6464 namespace for labels.
6465
6466 @item
6467 Initialization of unions. If the initializer is zero, the warning is
6468 omitted. This is done under the assumption that the zero initializer in
6469 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6470 initializer warnings and relies on default initialization to zero in the
6471 traditional C case.
6472
6473 @item
6474 Conversions by prototypes between fixed/floating-point values and vice
6475 versa. The absence of these prototypes when compiling with traditional
6476 C causes serious problems. This is a subset of the possible
6477 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6478
6479 @item
6480 Use of ISO C style function definitions. This warning intentionally is
6481 @emph{not} issued for prototype declarations or variadic functions
6482 because these ISO C features appear in your code when using
6483 libiberty's traditional C compatibility macros, @code{PARAMS} and
6484 @code{VPARAMS}. This warning is also bypassed for nested functions
6485 because that feature is already a GCC extension and thus not relevant to
6486 traditional C compatibility.
6487 @end itemize
6488
6489 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6490 @opindex Wtraditional-conversion
6491 @opindex Wno-traditional-conversion
6492 Warn if a prototype causes a type conversion that is different from what
6493 would happen to the same argument in the absence of a prototype. This
6494 includes conversions of fixed point to floating and vice versa, and
6495 conversions changing the width or signedness of a fixed-point argument
6496 except when the same as the default promotion.
6497
6498 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6499 @opindex Wdeclaration-after-statement
6500 @opindex Wno-declaration-after-statement
6501 Warn when a declaration is found after a statement in a block. This
6502 construct, known from C++, was introduced with ISO C99 and is by default
6503 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6504
6505 @item -Wshadow
6506 @opindex Wshadow
6507 @opindex Wno-shadow
6508 Warn whenever a local variable or type declaration shadows another
6509 variable, parameter, type, class member (in C++), or instance variable
6510 (in Objective-C) or whenever a built-in function is shadowed. Note
6511 that in C++, the compiler warns if a local variable shadows an
6512 explicit typedef, but not if it shadows a struct/class/enum.
6513 Same as @option{-Wshadow=global}.
6514
6515 @item -Wno-shadow-ivar @r{(Objective-C only)}
6516 @opindex Wno-shadow-ivar
6517 @opindex Wshadow-ivar
6518 Do not warn whenever a local variable shadows an instance variable in an
6519 Objective-C method.
6520
6521 @item -Wshadow=global
6522 @opindex Wshadow=global
6523 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6524 This warning is enabled by @option{-Wshadow=global}.
6525
6526 @item -Wshadow=local
6527 @opindex Wshadow=local
6528 Warn when a local variable shadows another local variable or parameter.
6529 This warning is enabled by @option{-Wshadow=local}.
6530
6531 @item -Wshadow=compatible-local
6532 @opindex Wshadow=compatible-local
6533 Warn when a local variable shadows another local variable or parameter
6534 whose type is compatible with that of the shadowing variable. In C++,
6535 type compatibility here means the type of the shadowing variable can be
6536 converted to that of the shadowed variable. The creation of this flag
6537 (in addition to @option{-Wshadow=local}) is based on the idea that when
6538 a local variable shadows another one of incompatible type, it is most
6539 likely intentional, not a bug or typo, as shown in the following example:
6540
6541 @smallexample
6542 @group
6543 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6544 @{
6545 for (int i = 0; i < N; ++i)
6546 @{
6547 ...
6548 @}
6549 ...
6550 @}
6551 @end group
6552 @end smallexample
6553
6554 Since the two variable @code{i} in the example above have incompatible types,
6555 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6556 Because their types are incompatible, if a programmer accidentally uses one
6557 in place of the other, type checking will catch that and emit an error or
6558 warning. So not warning (about shadowing) in this case will not lead to
6559 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6560 possibly reduce the number of warnings triggered by intentional shadowing.
6561 Note that this does also mean that shadowing @code{const char *i} by
6562 @code{char *i} will not emit a warning.
6563
6564 This warning is enabled by @option{-Wshadow=compatible-local}.
6565
6566 @item -Wlarger-than=@var{byte-size}
6567 @opindex Wlarger-than=
6568 @opindex Wlarger-than-@var{byte-size}
6569 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6570 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6571 Warnings controlled by the option can be disabled either by specifying
6572 @var{byte-size} of @samp{SIZE_MAX} or more or by
6573 @option{-Wno-larger-than}.
6574
6575 @item -Wno-larger-than
6576 @opindex Wno-larger-than
6577 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6578 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6579
6580 @item -Wframe-larger-than=@var{byte-size}
6581 @opindex Wframe-larger-than=
6582 @opindex Wno-frame-larger-than
6583 Warn if the size of a function frame exceeds @var{byte-size}.
6584 The computation done to determine the stack frame size is approximate
6585 and not conservative.
6586 The actual requirements may be somewhat greater than @var{byte-size}
6587 even if you do not get a warning. In addition, any space allocated
6588 via @code{alloca}, variable-length arrays, or related constructs
6589 is not included by the compiler when determining
6590 whether or not to issue a warning.
6591 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6592 Warnings controlled by the option can be disabled either by specifying
6593 @var{byte-size} of @samp{SIZE_MAX} or more or by
6594 @option{-Wno-frame-larger-than}.
6595
6596 @item -Wno-frame-larger-than
6597 @opindex Wno-frame-larger-than
6598 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6599 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6600
6601 @item -Wno-free-nonheap-object
6602 @opindex Wno-free-nonheap-object
6603 @opindex Wfree-nonheap-object
6604 Do not warn when attempting to free an object that was not allocated
6605 on the heap.
6606
6607 @item -Wstack-usage=@var{byte-size}
6608 @opindex Wstack-usage
6609 @opindex Wno-stack-usage
6610 Warn if the stack usage of a function might exceed @var{byte-size}.
6611 The computation done to determine the stack usage is conservative.
6612 Any space allocated via @code{alloca}, variable-length arrays, or related
6613 constructs is included by the compiler when determining whether or not to
6614 issue a warning.
6615
6616 The message is in keeping with the output of @option{-fstack-usage}.
6617
6618 @itemize
6619 @item
6620 If the stack usage is fully static but exceeds the specified amount, it's:
6621
6622 @smallexample
6623 warning: stack usage is 1120 bytes
6624 @end smallexample
6625 @item
6626 If the stack usage is (partly) dynamic but bounded, it's:
6627
6628 @smallexample
6629 warning: stack usage might be 1648 bytes
6630 @end smallexample
6631 @item
6632 If the stack usage is (partly) dynamic and not bounded, it's:
6633
6634 @smallexample
6635 warning: stack usage might be unbounded
6636 @end smallexample
6637 @end itemize
6638
6639 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6640 Warnings controlled by the option can be disabled either by specifying
6641 @var{byte-size} of @samp{SIZE_MAX} or more or by
6642 @option{-Wno-stack-usage}.
6643
6644 @item -Wno-stack-usage
6645 @opindex Wno-stack-usage
6646 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6647 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6648
6649 @item -Wunsafe-loop-optimizations
6650 @opindex Wunsafe-loop-optimizations
6651 @opindex Wno-unsafe-loop-optimizations
6652 Warn if the loop cannot be optimized because the compiler cannot
6653 assume anything on the bounds of the loop indices. With
6654 @option{-funsafe-loop-optimizations} warn if the compiler makes
6655 such assumptions.
6656
6657 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6658 @opindex Wno-pedantic-ms-format
6659 @opindex Wpedantic-ms-format
6660 When used in combination with @option{-Wformat}
6661 and @option{-pedantic} without GNU extensions, this option
6662 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6663 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6664 which depend on the MS runtime.
6665
6666 @item -Waligned-new
6667 @opindex Waligned-new
6668 @opindex Wno-aligned-new
6669 Warn about a new-expression of a type that requires greater alignment
6670 than the @code{alignof(std::max_align_t)} but uses an allocation
6671 function without an explicit alignment parameter. This option is
6672 enabled by @option{-Wall}.
6673
6674 Normally this only warns about global allocation functions, but
6675 @option{-Waligned-new=all} also warns about class member allocation
6676 functions.
6677
6678 @item -Wplacement-new
6679 @itemx -Wplacement-new=@var{n}
6680 @opindex Wplacement-new
6681 @opindex Wno-placement-new
6682 Warn about placement new expressions with undefined behavior, such as
6683 constructing an object in a buffer that is smaller than the type of
6684 the object. For example, the placement new expression below is diagnosed
6685 because it attempts to construct an array of 64 integers in a buffer only
6686 64 bytes large.
6687 @smallexample
6688 char buf [64];
6689 new (buf) int[64];
6690 @end smallexample
6691 This warning is enabled by default.
6692
6693 @table @gcctabopt
6694 @item -Wplacement-new=1
6695 This is the default warning level of @option{-Wplacement-new}. At this
6696 level the warning is not issued for some strictly undefined constructs that
6697 GCC allows as extensions for compatibility with legacy code. For example,
6698 the following @code{new} expression is not diagnosed at this level even
6699 though it has undefined behavior according to the C++ standard because
6700 it writes past the end of the one-element array.
6701 @smallexample
6702 struct S @{ int n, a[1]; @};
6703 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6704 new (s->a)int [32]();
6705 @end smallexample
6706
6707 @item -Wplacement-new=2
6708 At this level, in addition to diagnosing all the same constructs as at level
6709 1, a diagnostic is also issued for placement new expressions that construct
6710 an object in the last member of structure whose type is an array of a single
6711 element and whose size is less than the size of the object being constructed.
6712 While the previous example would be diagnosed, the following construct makes
6713 use of the flexible member array extension to avoid the warning at level 2.
6714 @smallexample
6715 struct S @{ int n, a[]; @};
6716 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6717 new (s->a)int [32]();
6718 @end smallexample
6719
6720 @end table
6721
6722 @item -Wpointer-arith
6723 @opindex Wpointer-arith
6724 @opindex Wno-pointer-arith
6725 Warn about anything that depends on the ``size of'' a function type or
6726 of @code{void}. GNU C assigns these types a size of 1, for
6727 convenience in calculations with @code{void *} pointers and pointers
6728 to functions. In C++, warn also when an arithmetic operation involves
6729 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6730
6731 @item -Wpointer-compare
6732 @opindex Wpointer-compare
6733 @opindex Wno-pointer-compare
6734 Warn if a pointer is compared with a zero character constant. This usually
6735 means that the pointer was meant to be dereferenced. For example:
6736
6737 @smallexample
6738 const char *p = foo ();
6739 if (p == '\0')
6740 return 42;
6741 @end smallexample
6742
6743 Note that the code above is invalid in C++11.
6744
6745 This warning is enabled by default.
6746
6747 @item -Wtype-limits
6748 @opindex Wtype-limits
6749 @opindex Wno-type-limits
6750 Warn if a comparison is always true or always false due to the limited
6751 range of the data type, but do not warn for constant expressions. For
6752 example, warn if an unsigned variable is compared against zero with
6753 @code{<} or @code{>=}. This warning is also enabled by
6754 @option{-Wextra}.
6755
6756 @item -Wabsolute-value @r{(C and Objective-C only)}
6757 @opindex Wabsolute-value
6758 @opindex Wno-absolute-value
6759 Warn for calls to standard functions that compute the absolute value
6760 of an argument when a more appropriate standard function is available.
6761 For example, calling @code{abs(3.14)} triggers the warning because the
6762 appropriate function to call to compute the absolute value of a double
6763 argument is @code{fabs}. The option also triggers warnings when the
6764 argument in a call to such a function has an unsigned type. This
6765 warning can be suppressed with an explicit type cast and it is also
6766 enabled by @option{-Wextra}.
6767
6768 @include cppwarnopts.texi
6769
6770 @item -Wbad-function-cast @r{(C and Objective-C only)}
6771 @opindex Wbad-function-cast
6772 @opindex Wno-bad-function-cast
6773 Warn when a function call is cast to a non-matching type.
6774 For example, warn if a call to a function returning an integer type
6775 is cast to a pointer type.
6776
6777 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6778 @opindex Wc90-c99-compat
6779 @opindex Wno-c90-c99-compat
6780 Warn about features not present in ISO C90, but present in ISO C99.
6781 For instance, warn about use of variable length arrays, @code{long long}
6782 type, @code{bool} type, compound literals, designated initializers, and so
6783 on. This option is independent of the standards mode. Warnings are disabled
6784 in the expression that follows @code{__extension__}.
6785
6786 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6787 @opindex Wc99-c11-compat
6788 @opindex Wno-c99-c11-compat
6789 Warn about features not present in ISO C99, but present in ISO C11.
6790 For instance, warn about use of anonymous structures and unions,
6791 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6792 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6793 and so on. This option is independent of the standards mode. Warnings are
6794 disabled in the expression that follows @code{__extension__}.
6795
6796 @item -Wc++-compat @r{(C and Objective-C only)}
6797 @opindex Wc++-compat
6798 @opindex Wno-c++-compat
6799 Warn about ISO C constructs that are outside of the common subset of
6800 ISO C and ISO C++, e.g.@: request for implicit conversion from
6801 @code{void *} to a pointer to non-@code{void} type.
6802
6803 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6804 @opindex Wc++11-compat
6805 @opindex Wno-c++11-compat
6806 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6807 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6808 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6809 enabled by @option{-Wall}.
6810
6811 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6812 @opindex Wc++14-compat
6813 @opindex Wno-c++14-compat
6814 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6815 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6816
6817 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6818 @opindex Wc++17-compat
6819 @opindex Wno-c++17-compat
6820 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6821 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6822
6823 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
6824 @opindex Wc++20-compat
6825 @opindex Wno-c++20-compat
6826 Warn about C++ constructs whose meaning differs between ISO C++ 2017
6827 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
6828
6829 @item -Wcast-qual
6830 @opindex Wcast-qual
6831 @opindex Wno-cast-qual
6832 Warn whenever a pointer is cast so as to remove a type qualifier from
6833 the target type. For example, warn if a @code{const char *} is cast
6834 to an ordinary @code{char *}.
6835
6836 Also warn when making a cast that introduces a type qualifier in an
6837 unsafe way. For example, casting @code{char **} to @code{const char **}
6838 is unsafe, as in this example:
6839
6840 @smallexample
6841 /* p is char ** value. */
6842 const char **q = (const char **) p;
6843 /* Assignment of readonly string to const char * is OK. */
6844 *q = "string";
6845 /* Now char** pointer points to read-only memory. */
6846 **p = 'b';
6847 @end smallexample
6848
6849 @item -Wcast-align
6850 @opindex Wcast-align
6851 @opindex Wno-cast-align
6852 Warn whenever a pointer is cast such that the required alignment of the
6853 target is increased. For example, warn if a @code{char *} is cast to
6854 an @code{int *} on machines where integers can only be accessed at
6855 two- or four-byte boundaries.
6856
6857 @item -Wcast-align=strict
6858 @opindex Wcast-align=strict
6859 Warn whenever a pointer is cast such that the required alignment of the
6860 target is increased. For example, warn if a @code{char *} is cast to
6861 an @code{int *} regardless of the target machine.
6862
6863 @item -Wcast-function-type
6864 @opindex Wcast-function-type
6865 @opindex Wno-cast-function-type
6866 Warn when a function pointer is cast to an incompatible function pointer.
6867 In a cast involving function types with a variable argument list only
6868 the types of initial arguments that are provided are considered.
6869 Any parameter of pointer-type matches any other pointer-type. Any benign
6870 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6871 on ILP32 targets. Likewise type qualifiers are ignored. The function
6872 type @code{void (*) (void)} is special and matches everything, which can
6873 be used to suppress this warning.
6874 In a cast involving pointer to member types this warning warns whenever
6875 the type cast is changing the pointer to member type.
6876 This warning is enabled by @option{-Wextra}.
6877
6878 @item -Wwrite-strings
6879 @opindex Wwrite-strings
6880 @opindex Wno-write-strings
6881 When compiling C, give string constants the type @code{const
6882 char[@var{length}]} so that copying the address of one into a
6883 non-@code{const} @code{char *} pointer produces a warning. These
6884 warnings help you find at compile time code that can try to write
6885 into a string constant, but only if you have been very careful about
6886 using @code{const} in declarations and prototypes. Otherwise, it is
6887 just a nuisance. This is why we did not make @option{-Wall} request
6888 these warnings.
6889
6890 When compiling C++, warn about the deprecated conversion from string
6891 literals to @code{char *}. This warning is enabled by default for C++
6892 programs.
6893
6894 @item -Wcatch-value
6895 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6896 @opindex Wcatch-value
6897 @opindex Wno-catch-value
6898 Warn about catch handlers that do not catch via reference.
6899 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6900 warn about polymorphic class types that are caught by value.
6901 With @option{-Wcatch-value=2} warn about all class types that are caught
6902 by value. With @option{-Wcatch-value=3} warn about all types that are
6903 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6904
6905 @item -Wclobbered
6906 @opindex Wclobbered
6907 @opindex Wno-clobbered
6908 Warn for variables that might be changed by @code{longjmp} or
6909 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6910
6911 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6912 @opindex Wconditionally-supported
6913 @opindex Wno-conditionally-supported
6914 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6915
6916 @item -Wconversion
6917 @opindex Wconversion
6918 @opindex Wno-conversion
6919 Warn for implicit conversions that may alter a value. This includes
6920 conversions between real and integer, like @code{abs (x)} when
6921 @code{x} is @code{double}; conversions between signed and unsigned,
6922 like @code{unsigned ui = -1}; and conversions to smaller types, like
6923 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6924 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6925 changed by the conversion like in @code{abs (2.0)}. Warnings about
6926 conversions between signed and unsigned integers can be disabled by
6927 using @option{-Wno-sign-conversion}.
6928
6929 For C++, also warn for confusing overload resolution for user-defined
6930 conversions; and conversions that never use a type conversion
6931 operator: conversions to @code{void}, the same type, a base class or a
6932 reference to them. Warnings about conversions between signed and
6933 unsigned integers are disabled by default in C++ unless
6934 @option{-Wsign-conversion} is explicitly enabled.
6935
6936 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6937 @opindex Wconversion-null
6938 @opindex Wno-conversion-null
6939 Do not warn for conversions between @code{NULL} and non-pointer
6940 types. @option{-Wconversion-null} is enabled by default.
6941
6942 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6943 @opindex Wzero-as-null-pointer-constant
6944 @opindex Wno-zero-as-null-pointer-constant
6945 Warn when a literal @samp{0} is used as null pointer constant. This can
6946 be useful to facilitate the conversion to @code{nullptr} in C++11.
6947
6948 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6949 @opindex Wsubobject-linkage
6950 @opindex Wno-subobject-linkage
6951 Warn if a class type has a base or a field whose type uses the anonymous
6952 namespace or depends on a type with no linkage. If a type A depends on
6953 a type B with no or internal linkage, defining it in multiple
6954 translation units would be an ODR violation because the meaning of B
6955 is different in each translation unit. If A only appears in a single
6956 translation unit, the best way to silence the warning is to give it
6957 internal linkage by putting it in an anonymous namespace as well. The
6958 compiler doesn't give this warning for types defined in the main .C
6959 file, as those are unlikely to have multiple definitions.
6960 @option{-Wsubobject-linkage} is enabled by default.
6961
6962 @item -Wdangling-else
6963 @opindex Wdangling-else
6964 @opindex Wno-dangling-else
6965 Warn about constructions where there may be confusion to which
6966 @code{if} statement an @code{else} branch belongs. Here is an example of
6967 such a case:
6968
6969 @smallexample
6970 @group
6971 @{
6972 if (a)
6973 if (b)
6974 foo ();
6975 else
6976 bar ();
6977 @}
6978 @end group
6979 @end smallexample
6980
6981 In C/C++, every @code{else} branch belongs to the innermost possible
6982 @code{if} statement, which in this example is @code{if (b)}. This is
6983 often not what the programmer expected, as illustrated in the above
6984 example by indentation the programmer chose. When there is the
6985 potential for this confusion, GCC issues a warning when this flag
6986 is specified. To eliminate the warning, add explicit braces around
6987 the innermost @code{if} statement so there is no way the @code{else}
6988 can belong to the enclosing @code{if}. The resulting code
6989 looks like this:
6990
6991 @smallexample
6992 @group
6993 @{
6994 if (a)
6995 @{
6996 if (b)
6997 foo ();
6998 else
6999 bar ();
7000 @}
7001 @}
7002 @end group
7003 @end smallexample
7004
7005 This warning is enabled by @option{-Wparentheses}.
7006
7007 @item -Wdate-time
7008 @opindex Wdate-time
7009 @opindex Wno-date-time
7010 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
7011 are encountered as they might prevent bit-wise-identical reproducible
7012 compilations.
7013
7014 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
7015 @opindex Wdelete-incomplete
7016 @opindex Wno-delete-incomplete
7017 Warn when deleting a pointer to incomplete type, which may cause
7018 undefined behavior at runtime. This warning is enabled by default.
7019
7020 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
7021 @opindex Wuseless-cast
7022 @opindex Wno-useless-cast
7023 Warn when an expression is casted to its own type.
7024
7025 @item -Wempty-body
7026 @opindex Wempty-body
7027 @opindex Wno-empty-body
7028 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
7029 while} statement. This warning is also enabled by @option{-Wextra}.
7030
7031 @item -Wenum-compare
7032 @opindex Wenum-compare
7033 @opindex Wno-enum-compare
7034 Warn about a comparison between values of different enumerated types.
7035 In C++ enumerated type mismatches in conditional expressions are also
7036 diagnosed and the warning is enabled by default. In C this warning is
7037 enabled by @option{-Wall}.
7038
7039 @item -Wenum-conversion @r{(C, Objective-C only)}
7040 @opindex Wenum-conversion
7041 @opindex Wno-enum-conversion
7042 Warn when a value of enumerated type is implicitly converted to a
7043 different enumerated type. This warning is enabled by @option{-Wextra}.
7044
7045 @item -Wextra-semi @r{(C++, Objective-C++ only)}
7046 @opindex Wextra-semi
7047 @opindex Wno-extra-semi
7048 Warn about redundant semicolon after in-class function definition.
7049
7050 @item -Wjump-misses-init @r{(C, Objective-C only)}
7051 @opindex Wjump-misses-init
7052 @opindex Wno-jump-misses-init
7053 Warn if a @code{goto} statement or a @code{switch} statement jumps
7054 forward across the initialization of a variable, or jumps backward to a
7055 label after the variable has been initialized. This only warns about
7056 variables that are initialized when they are declared. This warning is
7057 only supported for C and Objective-C; in C++ this sort of branch is an
7058 error in any case.
7059
7060 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7061 can be disabled with the @option{-Wno-jump-misses-init} option.
7062
7063 @item -Wsign-compare
7064 @opindex Wsign-compare
7065 @opindex Wno-sign-compare
7066 @cindex warning for comparison of signed and unsigned values
7067 @cindex comparison of signed and unsigned values, warning
7068 @cindex signed and unsigned values, comparison warning
7069 Warn when a comparison between signed and unsigned values could produce
7070 an incorrect result when the signed value is converted to unsigned.
7071 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7072 also enabled by @option{-Wextra}.
7073
7074 @item -Wsign-conversion
7075 @opindex Wsign-conversion
7076 @opindex Wno-sign-conversion
7077 Warn for implicit conversions that may change the sign of an integer
7078 value, like assigning a signed integer expression to an unsigned
7079 integer variable. An explicit cast silences the warning. In C, this
7080 option is enabled also by @option{-Wconversion}.
7081
7082 @item -Wfloat-conversion
7083 @opindex Wfloat-conversion
7084 @opindex Wno-float-conversion
7085 Warn for implicit conversions that reduce the precision of a real value.
7086 This includes conversions from real to integer, and from higher precision
7087 real to lower precision real values. This option is also enabled by
7088 @option{-Wconversion}.
7089
7090 @item -Wno-scalar-storage-order
7091 @opindex Wno-scalar-storage-order
7092 @opindex Wscalar-storage-order
7093 Do not warn on suspicious constructs involving reverse scalar storage order.
7094
7095 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7096 @opindex Wsized-deallocation
7097 @opindex Wno-sized-deallocation
7098 Warn about a definition of an unsized deallocation function
7099 @smallexample
7100 void operator delete (void *) noexcept;
7101 void operator delete[] (void *) noexcept;
7102 @end smallexample
7103 without a definition of the corresponding sized deallocation function
7104 @smallexample
7105 void operator delete (void *, std::size_t) noexcept;
7106 void operator delete[] (void *, std::size_t) noexcept;
7107 @end smallexample
7108 or vice versa. Enabled by @option{-Wextra} along with
7109 @option{-fsized-deallocation}.
7110
7111 @item -Wsizeof-pointer-div
7112 @opindex Wsizeof-pointer-div
7113 @opindex Wno-sizeof-pointer-div
7114 Warn for suspicious divisions of two sizeof expressions that divide
7115 the pointer size by the element size, which is the usual way to compute
7116 the array size but won't work out correctly with pointers. This warning
7117 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7118 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7119
7120 @item -Wsizeof-pointer-memaccess
7121 @opindex Wsizeof-pointer-memaccess
7122 @opindex Wno-sizeof-pointer-memaccess
7123 Warn for suspicious length parameters to certain string and memory built-in
7124 functions if the argument uses @code{sizeof}. This warning triggers for
7125 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7126 an array, but a pointer, and suggests a possible fix, or about
7127 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7128 also warns about calls to bounded string copy functions like @code{strncat}
7129 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7130 the source array. For example, in the following function the call to
7131 @code{strncat} specifies the size of the source string as the bound. That
7132 is almost certainly a mistake and so the call is diagnosed.
7133 @smallexample
7134 void make_file (const char *name)
7135 @{
7136 char path[PATH_MAX];
7137 strncpy (path, name, sizeof path - 1);
7138 strncat (path, ".text", sizeof ".text");
7139 @dots{}
7140 @}
7141 @end smallexample
7142
7143 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7144
7145 @item -Wsizeof-array-argument
7146 @opindex Wsizeof-array-argument
7147 @opindex Wno-sizeof-array-argument
7148 Warn when the @code{sizeof} operator is applied to a parameter that is
7149 declared as an array in a function definition. This warning is enabled by
7150 default for C and C++ programs.
7151
7152 @item -Wmemset-elt-size
7153 @opindex Wmemset-elt-size
7154 @opindex Wno-memset-elt-size
7155 Warn for suspicious calls to the @code{memset} built-in function, if the
7156 first argument references an array, and the third argument is a number
7157 equal to the number of elements, but not equal to the size of the array
7158 in memory. This indicates that the user has omitted a multiplication by
7159 the element size. This warning is enabled by @option{-Wall}.
7160
7161 @item -Wmemset-transposed-args
7162 @opindex Wmemset-transposed-args
7163 @opindex Wno-memset-transposed-args
7164 Warn for suspicious calls to the @code{memset} built-in function where
7165 the second argument is not zero and the third argument is zero. For
7166 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7167 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7168 is only emitted if the third argument is a literal zero. Otherwise, if
7169 it is an expression that is folded to zero, or a cast of zero to some
7170 type, it is far less likely that the arguments have been mistakenly
7171 transposed and no warning is emitted. This warning is enabled
7172 by @option{-Wall}.
7173
7174 @item -Waddress
7175 @opindex Waddress
7176 @opindex Wno-address
7177 Warn about suspicious uses of memory addresses. These include using
7178 the address of a function in a conditional expression, such as
7179 @code{void func(void); if (func)}, and comparisons against the memory
7180 address of a string literal, such as @code{if (x == "abc")}. Such
7181 uses typically indicate a programmer error: the address of a function
7182 always evaluates to true, so their use in a conditional usually
7183 indicate that the programmer forgot the parentheses in a function
7184 call; and comparisons against string literals result in unspecified
7185 behavior and are not portable in C, so they usually indicate that the
7186 programmer intended to use @code{strcmp}. This warning is enabled by
7187 @option{-Wall}.
7188
7189 @item -Waddress-of-packed-member
7190 @opindex Waddress-of-packed-member
7191 @opindex Wno-address-of-packed-member
7192 Warn when the address of packed member of struct or union is taken,
7193 which usually results in an unaligned pointer value. This is
7194 enabled by default.
7195
7196 @item -Wlogical-op
7197 @opindex Wlogical-op
7198 @opindex Wno-logical-op
7199 Warn about suspicious uses of logical operators in expressions.
7200 This includes using logical operators in contexts where a
7201 bit-wise operator is likely to be expected. Also warns when
7202 the operands of a logical operator are the same:
7203 @smallexample
7204 extern int a;
7205 if (a < 0 && a < 0) @{ @dots{} @}
7206 @end smallexample
7207
7208 @item -Wlogical-not-parentheses
7209 @opindex Wlogical-not-parentheses
7210 @opindex Wno-logical-not-parentheses
7211 Warn about logical not used on the left hand side operand of a comparison.
7212 This option does not warn if the right operand is considered to be a boolean
7213 expression. Its purpose is to detect suspicious code like the following:
7214 @smallexample
7215 int a;
7216 @dots{}
7217 if (!a > 1) @{ @dots{} @}
7218 @end smallexample
7219
7220 It is possible to suppress the warning by wrapping the LHS into
7221 parentheses:
7222 @smallexample
7223 if ((!a) > 1) @{ @dots{} @}
7224 @end smallexample
7225
7226 This warning is enabled by @option{-Wall}.
7227
7228 @item -Waggregate-return
7229 @opindex Waggregate-return
7230 @opindex Wno-aggregate-return
7231 Warn if any functions that return structures or unions are defined or
7232 called. (In languages where you can return an array, this also elicits
7233 a warning.)
7234
7235 @item -Wno-aggressive-loop-optimizations
7236 @opindex Wno-aggressive-loop-optimizations
7237 @opindex Waggressive-loop-optimizations
7238 Warn if in a loop with constant number of iterations the compiler detects
7239 undefined behavior in some statement during one or more of the iterations.
7240
7241 @item -Wno-attributes
7242 @opindex Wno-attributes
7243 @opindex Wattributes
7244 Do not warn if an unexpected @code{__attribute__} is used, such as
7245 unrecognized attributes, function attributes applied to variables,
7246 etc. This does not stop errors for incorrect use of supported
7247 attributes.
7248
7249 @item -Wno-builtin-declaration-mismatch
7250 @opindex Wno-builtin-declaration-mismatch
7251 @opindex Wbuiltin-declaration-mismatch
7252 Warn if a built-in function is declared with an incompatible signature
7253 or as a non-function, or when a built-in function declared with a type
7254 that does not include a prototype is called with arguments whose promoted
7255 types do not match those expected by the function. When @option{-Wextra}
7256 is specified, also warn when a built-in function that takes arguments is
7257 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7258 warning is enabled by default. To avoid the warning include the appropriate
7259 header to bring the prototypes of built-in functions into scope.
7260
7261 For example, the call to @code{memset} below is diagnosed by the warning
7262 because the function expects a value of type @code{size_t} as its argument
7263 but the type of @code{32} is @code{int}. With @option{-Wextra},
7264 the declaration of the function is diagnosed as well.
7265 @smallexample
7266 extern void* memset ();
7267 void f (void *d)
7268 @{
7269 memset (d, '\0', 32);
7270 @}
7271 @end smallexample
7272
7273 @item -Wno-builtin-macro-redefined
7274 @opindex Wno-builtin-macro-redefined
7275 @opindex Wbuiltin-macro-redefined
7276 Do not warn if certain built-in macros are redefined. This suppresses
7277 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7278 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7279
7280 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7281 @opindex Wstrict-prototypes
7282 @opindex Wno-strict-prototypes
7283 Warn if a function is declared or defined without specifying the
7284 argument types. (An old-style function definition is permitted without
7285 a warning if preceded by a declaration that specifies the argument
7286 types.)
7287
7288 @item -Wold-style-declaration @r{(C and Objective-C only)}
7289 @opindex Wold-style-declaration
7290 @opindex Wno-old-style-declaration
7291 Warn for obsolescent usages, according to the C Standard, in a
7292 declaration. For example, warn if storage-class specifiers like
7293 @code{static} are not the first things in a declaration. This warning
7294 is also enabled by @option{-Wextra}.
7295
7296 @item -Wold-style-definition @r{(C and Objective-C only)}
7297 @opindex Wold-style-definition
7298 @opindex Wno-old-style-definition
7299 Warn if an old-style function definition is used. A warning is given
7300 even if there is a previous prototype.
7301
7302 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7303 @opindex Wmissing-parameter-type
7304 @opindex Wno-missing-parameter-type
7305 A function parameter is declared without a type specifier in K&R-style
7306 functions:
7307
7308 @smallexample
7309 void foo(bar) @{ @}
7310 @end smallexample
7311
7312 This warning is also enabled by @option{-Wextra}.
7313
7314 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7315 @opindex Wmissing-prototypes
7316 @opindex Wno-missing-prototypes
7317 Warn if a global function is defined without a previous prototype
7318 declaration. This warning is issued even if the definition itself
7319 provides a prototype. Use this option to detect global functions
7320 that do not have a matching prototype declaration in a header file.
7321 This option is not valid for C++ because all function declarations
7322 provide prototypes and a non-matching declaration declares an
7323 overload rather than conflict with an earlier declaration.
7324 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7325
7326 @item -Wmissing-declarations
7327 @opindex Wmissing-declarations
7328 @opindex Wno-missing-declarations
7329 Warn if a global function is defined without a previous declaration.
7330 Do so even if the definition itself provides a prototype.
7331 Use this option to detect global functions that are not declared in
7332 header files. In C, no warnings are issued for functions with previous
7333 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7334 missing prototypes. In C++, no warnings are issued for function templates,
7335 or for inline functions, or for functions in anonymous namespaces.
7336
7337 @item -Wmissing-field-initializers
7338 @opindex Wmissing-field-initializers
7339 @opindex Wno-missing-field-initializers
7340 @opindex W
7341 @opindex Wextra
7342 @opindex Wno-extra
7343 Warn if a structure's initializer has some fields missing. For
7344 example, the following code causes such a warning, because
7345 @code{x.h} is implicitly zero:
7346
7347 @smallexample
7348 struct s @{ int f, g, h; @};
7349 struct s x = @{ 3, 4 @};
7350 @end smallexample
7351
7352 This option does not warn about designated initializers, so the following
7353 modification does not trigger a warning:
7354
7355 @smallexample
7356 struct s @{ int f, g, h; @};
7357 struct s x = @{ .f = 3, .g = 4 @};
7358 @end smallexample
7359
7360 In C this option does not warn about the universal zero initializer
7361 @samp{@{ 0 @}}:
7362
7363 @smallexample
7364 struct s @{ int f, g, h; @};
7365 struct s x = @{ 0 @};
7366 @end smallexample
7367
7368 Likewise, in C++ this option does not warn about the empty @{ @}
7369 initializer, for example:
7370
7371 @smallexample
7372 struct s @{ int f, g, h; @};
7373 s x = @{ @};
7374 @end smallexample
7375
7376 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7377 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7378
7379 @item -Wno-multichar
7380 @opindex Wno-multichar
7381 @opindex Wmultichar
7382 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7383 Usually they indicate a typo in the user's code, as they have
7384 implementation-defined values, and should not be used in portable code.
7385
7386 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7387 @opindex Wnormalized=
7388 @opindex Wnormalized
7389 @opindex Wno-normalized
7390 @cindex NFC
7391 @cindex NFKC
7392 @cindex character set, input normalization
7393 In ISO C and ISO C++, two identifiers are different if they are
7394 different sequences of characters. However, sometimes when characters
7395 outside the basic ASCII character set are used, you can have two
7396 different character sequences that look the same. To avoid confusion,
7397 the ISO 10646 standard sets out some @dfn{normalization rules} which
7398 when applied ensure that two sequences that look the same are turned into
7399 the same sequence. GCC can warn you if you are using identifiers that
7400 have not been normalized; this option controls that warning.
7401
7402 There are four levels of warning supported by GCC@. The default is
7403 @option{-Wnormalized=nfc}, which warns about any identifier that is
7404 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7405 recommended form for most uses. It is equivalent to
7406 @option{-Wnormalized}.
7407
7408 Unfortunately, there are some characters allowed in identifiers by
7409 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7410 identifiers. That is, there's no way to use these symbols in portable
7411 ISO C or C++ and have all your identifiers in NFC@.
7412 @option{-Wnormalized=id} suppresses the warning for these characters.
7413 It is hoped that future versions of the standards involved will correct
7414 this, which is why this option is not the default.
7415
7416 You can switch the warning off for all characters by writing
7417 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7418 only do this if you are using some other normalization scheme (like
7419 ``D''), because otherwise you can easily create bugs that are
7420 literally impossible to see.
7421
7422 Some characters in ISO 10646 have distinct meanings but look identical
7423 in some fonts or display methodologies, especially once formatting has
7424 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7425 LETTER N'', displays just like a regular @code{n} that has been
7426 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7427 normalization scheme to convert all these into a standard form as
7428 well, and GCC warns if your code is not in NFKC if you use
7429 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7430 about every identifier that contains the letter O because it might be
7431 confused with the digit 0, and so is not the default, but may be
7432 useful as a local coding convention if the programming environment
7433 cannot be fixed to display these characters distinctly.
7434
7435 @item -Wno-attribute-warning
7436 @opindex Wno-attribute-warning
7437 @opindex Wattribute-warning
7438 Do not warn about usage of functions (@pxref{Function Attributes})
7439 declared with @code{warning} attribute. By default, this warning is
7440 enabled. @option{-Wno-attribute-warning} can be used to disable the
7441 warning or @option{-Wno-error=attribute-warning} can be used to
7442 disable the error when compiled with @option{-Werror} flag.
7443
7444 @item -Wno-deprecated
7445 @opindex Wno-deprecated
7446 @opindex Wdeprecated
7447 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7448
7449 @item -Wno-deprecated-declarations
7450 @opindex Wno-deprecated-declarations
7451 @opindex Wdeprecated-declarations
7452 Do not warn about uses of functions (@pxref{Function Attributes}),
7453 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7454 Attributes}) marked as deprecated by using the @code{deprecated}
7455 attribute.
7456
7457 @item -Wno-overflow
7458 @opindex Wno-overflow
7459 @opindex Woverflow
7460 Do not warn about compile-time overflow in constant expressions.
7461
7462 @item -Wno-odr
7463 @opindex Wno-odr
7464 @opindex Wodr
7465 Warn about One Definition Rule violations during link-time optimization.
7466 Enabled by default.
7467
7468 @item -Wopenmp-simd
7469 @opindex Wopenmp-simd
7470 @opindex Wno-openmp-simd
7471 Warn if the vectorizer cost model overrides the OpenMP
7472 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7473 option can be used to relax the cost model.
7474
7475 @item -Woverride-init @r{(C and Objective-C only)}
7476 @opindex Woverride-init
7477 @opindex Wno-override-init
7478 @opindex W
7479 @opindex Wextra
7480 @opindex Wno-extra
7481 Warn if an initialized field without side effects is overridden when
7482 using designated initializers (@pxref{Designated Inits, , Designated
7483 Initializers}).
7484
7485 This warning is included in @option{-Wextra}. To get other
7486 @option{-Wextra} warnings without this one, use @option{-Wextra
7487 -Wno-override-init}.
7488
7489 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7490 @opindex Woverride-init-side-effects
7491 @opindex Wno-override-init-side-effects
7492 Warn if an initialized field with side effects is overridden when
7493 using designated initializers (@pxref{Designated Inits, , Designated
7494 Initializers}). This warning is enabled by default.
7495
7496 @item -Wpacked
7497 @opindex Wpacked
7498 @opindex Wno-packed
7499 Warn if a structure is given the packed attribute, but the packed
7500 attribute has no effect on the layout or size of the structure.
7501 Such structures may be mis-aligned for little benefit. For
7502 instance, in this code, the variable @code{f.x} in @code{struct bar}
7503 is misaligned even though @code{struct bar} does not itself
7504 have the packed attribute:
7505
7506 @smallexample
7507 @group
7508 struct foo @{
7509 int x;
7510 char a, b, c, d;
7511 @} __attribute__((packed));
7512 struct bar @{
7513 char z;
7514 struct foo f;
7515 @};
7516 @end group
7517 @end smallexample
7518
7519 @item -Wpacked-bitfield-compat
7520 @opindex Wpacked-bitfield-compat
7521 @opindex Wno-packed-bitfield-compat
7522 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7523 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7524 the change can lead to differences in the structure layout. GCC
7525 informs you when the offset of such a field has changed in GCC 4.4.
7526 For example there is no longer a 4-bit padding between field @code{a}
7527 and @code{b} in this structure:
7528
7529 @smallexample
7530 struct foo
7531 @{
7532 char a:4;
7533 char b:8;
7534 @} __attribute__ ((packed));
7535 @end smallexample
7536
7537 This warning is enabled by default. Use
7538 @option{-Wno-packed-bitfield-compat} to disable this warning.
7539
7540 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7541 @opindex Wpacked-not-aligned
7542 @opindex Wno-packed-not-aligned
7543 Warn if a structure field with explicitly specified alignment in a
7544 packed struct or union is misaligned. For example, a warning will
7545 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7546 'struct S' is less than 8}, in this code:
7547
7548 @smallexample
7549 @group
7550 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7551 struct __attribute__ ((packed)) S @{
7552 struct S8 s8;
7553 @};
7554 @end group
7555 @end smallexample
7556
7557 This warning is enabled by @option{-Wall}.
7558
7559 @item -Wpadded
7560 @opindex Wpadded
7561 @opindex Wno-padded
7562 Warn if padding is included in a structure, either to align an element
7563 of the structure or to align the whole structure. Sometimes when this
7564 happens it is possible to rearrange the fields of the structure to
7565 reduce the padding and so make the structure smaller.
7566
7567 @item -Wredundant-decls
7568 @opindex Wredundant-decls
7569 @opindex Wno-redundant-decls
7570 Warn if anything is declared more than once in the same scope, even in
7571 cases where multiple declaration is valid and changes nothing.
7572
7573 @item -Wno-restrict
7574 @opindex Wrestrict
7575 @opindex Wno-restrict
7576 Warn when an object referenced by a @code{restrict}-qualified parameter
7577 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7578 argument, or when copies between such objects overlap. For example,
7579 the call to the @code{strcpy} function below attempts to truncate the string
7580 by replacing its initial characters with the last four. However, because
7581 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7582 the call is diagnosed.
7583
7584 @smallexample
7585 void foo (void)
7586 @{
7587 char a[] = "abcd1234";
7588 strcpy (a, a + 4);
7589 @dots{}
7590 @}
7591 @end smallexample
7592 The @option{-Wrestrict} option detects some instances of simple overlap
7593 even without optimization but works best at @option{-O2} and above. It
7594 is included in @option{-Wall}.
7595
7596 @item -Wnested-externs @r{(C and Objective-C only)}
7597 @opindex Wnested-externs
7598 @opindex Wno-nested-externs
7599 Warn if an @code{extern} declaration is encountered within a function.
7600
7601 @item -Wno-inherited-variadic-ctor
7602 @opindex Winherited-variadic-ctor
7603 @opindex Wno-inherited-variadic-ctor
7604 Suppress warnings about use of C++11 inheriting constructors when the
7605 base class inherited from has a C variadic constructor; the warning is
7606 on by default because the ellipsis is not inherited.
7607
7608 @item -Winline
7609 @opindex Winline
7610 @opindex Wno-inline
7611 Warn if a function that is declared as inline cannot be inlined.
7612 Even with this option, the compiler does not warn about failures to
7613 inline functions declared in system headers.
7614
7615 The compiler uses a variety of heuristics to determine whether or not
7616 to inline a function. For example, the compiler takes into account
7617 the size of the function being inlined and the amount of inlining
7618 that has already been done in the current function. Therefore,
7619 seemingly insignificant changes in the source program can cause the
7620 warnings produced by @option{-Winline} to appear or disappear.
7621
7622 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7623 @opindex Wno-invalid-offsetof
7624 @opindex Winvalid-offsetof
7625 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7626 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7627 to a non-standard-layout type is undefined. In existing C++ implementations,
7628 however, @code{offsetof} typically gives meaningful results.
7629 This flag is for users who are aware that they are
7630 writing nonportable code and who have deliberately chosen to ignore the
7631 warning about it.
7632
7633 The restrictions on @code{offsetof} may be relaxed in a future version
7634 of the C++ standard.
7635
7636 @item -Wint-in-bool-context
7637 @opindex Wint-in-bool-context
7638 @opindex Wno-int-in-bool-context
7639 Warn for suspicious use of integer values where boolean values are expected,
7640 such as conditional expressions (?:) using non-boolean integer constants in
7641 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7642 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7643 for all kinds of multiplications regardless of the data type.
7644 This warning is enabled by @option{-Wall}.
7645
7646 @item -Wno-int-to-pointer-cast
7647 @opindex Wno-int-to-pointer-cast
7648 @opindex Wint-to-pointer-cast
7649 Suppress warnings from casts to pointer type of an integer of a
7650 different size. In C++, casting to a pointer type of smaller size is
7651 an error. @option{Wint-to-pointer-cast} is enabled by default.
7652
7653
7654 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7655 @opindex Wno-pointer-to-int-cast
7656 @opindex Wpointer-to-int-cast
7657 Suppress warnings from casts from a pointer to an integer type of a
7658 different size.
7659
7660 @item -Winvalid-pch
7661 @opindex Winvalid-pch
7662 @opindex Wno-invalid-pch
7663 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7664 the search path but cannot be used.
7665
7666 @item -Wlong-long
7667 @opindex Wlong-long
7668 @opindex Wno-long-long
7669 Warn if @code{long long} type is used. This is enabled by either
7670 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7671 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7672
7673 @item -Wvariadic-macros
7674 @opindex Wvariadic-macros
7675 @opindex Wno-variadic-macros
7676 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7677 alternate syntax is used in ISO C99 mode. This is enabled by either
7678 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7679 messages, use @option{-Wno-variadic-macros}.
7680
7681 @item -Wvarargs
7682 @opindex Wvarargs
7683 @opindex Wno-varargs
7684 Warn upon questionable usage of the macros used to handle variable
7685 arguments like @code{va_start}. This is default. To inhibit the
7686 warning messages, use @option{-Wno-varargs}.
7687
7688 @item -Wvector-operation-performance
7689 @opindex Wvector-operation-performance
7690 @opindex Wno-vector-operation-performance
7691 Warn if vector operation is not implemented via SIMD capabilities of the
7692 architecture. Mainly useful for the performance tuning.
7693 Vector operation can be implemented @code{piecewise}, which means that the
7694 scalar operation is performed on every vector element;
7695 @code{in parallel}, which means that the vector operation is implemented
7696 using scalars of wider type, which normally is more performance efficient;
7697 and @code{as a single scalar}, which means that vector fits into a
7698 scalar type.
7699
7700 @item -Wno-virtual-move-assign
7701 @opindex Wvirtual-move-assign
7702 @opindex Wno-virtual-move-assign
7703 Suppress warnings about inheriting from a virtual base with a
7704 non-trivial C++11 move assignment operator. This is dangerous because
7705 if the virtual base is reachable along more than one path, it is
7706 moved multiple times, which can mean both objects end up in the
7707 moved-from state. If the move assignment operator is written to avoid
7708 moving from a moved-from object, this warning can be disabled.
7709
7710 @item -Wvla
7711 @opindex Wvla
7712 @opindex Wno-vla
7713 Warn if a variable-length array is used in the code.
7714 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7715 the variable-length array.
7716
7717 @item -Wvla-larger-than=@var{byte-size}
7718 @opindex Wvla-larger-than=
7719 @opindex Wno-vla-larger-than
7720 If this option is used, the compiler will warn for declarations of
7721 variable-length arrays whose size is either unbounded, or bounded
7722 by an argument that allows the array size to exceed @var{byte-size}
7723 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7724 works, but with variable-length arrays.
7725
7726 Note that GCC may optimize small variable-length arrays of a known
7727 value into plain arrays, so this warning may not get triggered for
7728 such arrays.
7729
7730 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7731 is typically only effective when @option{-ftree-vrp} is active (default
7732 for @option{-O2} and above).
7733
7734 See also @option{-Walloca-larger-than=@var{byte-size}}.
7735
7736 @item -Wno-vla-larger-than
7737 @opindex Wno-vla-larger-than
7738 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7739 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7740
7741 @item -Wvolatile-register-var
7742 @opindex Wvolatile-register-var
7743 @opindex Wno-volatile-register-var
7744 Warn if a register variable is declared volatile. The volatile
7745 modifier does not inhibit all optimizations that may eliminate reads
7746 and/or writes to register variables. This warning is enabled by
7747 @option{-Wall}.
7748
7749 @item -Wdisabled-optimization
7750 @opindex Wdisabled-optimization
7751 @opindex Wno-disabled-optimization
7752 Warn if a requested optimization pass is disabled. This warning does
7753 not generally indicate that there is anything wrong with your code; it
7754 merely indicates that GCC's optimizers are unable to handle the code
7755 effectively. Often, the problem is that your code is too big or too
7756 complex; GCC refuses to optimize programs when the optimization
7757 itself is likely to take inordinate amounts of time.
7758
7759 @item -Wpointer-sign @r{(C and Objective-C only)}
7760 @opindex Wpointer-sign
7761 @opindex Wno-pointer-sign
7762 Warn for pointer argument passing or assignment with different signedness.
7763 This option is only supported for C and Objective-C@. It is implied by
7764 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7765 @option{-Wno-pointer-sign}.
7766
7767 @item -Wstack-protector
7768 @opindex Wstack-protector
7769 @opindex Wno-stack-protector
7770 This option is only active when @option{-fstack-protector} is active. It
7771 warns about functions that are not protected against stack smashing.
7772
7773 @item -Woverlength-strings
7774 @opindex Woverlength-strings
7775 @opindex Wno-overlength-strings
7776 Warn about string constants that are longer than the ``minimum
7777 maximum'' length specified in the C standard. Modern compilers
7778 generally allow string constants that are much longer than the
7779 standard's minimum limit, but very portable programs should avoid
7780 using longer strings.
7781
7782 The limit applies @emph{after} string constant concatenation, and does
7783 not count the trailing NUL@. In C90, the limit was 509 characters; in
7784 C99, it was raised to 4095. C++98 does not specify a normative
7785 minimum maximum, so we do not diagnose overlength strings in C++@.
7786
7787 This option is implied by @option{-Wpedantic}, and can be disabled with
7788 @option{-Wno-overlength-strings}.
7789
7790 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7791 @opindex Wunsuffixed-float-constants
7792 @opindex Wno-unsuffixed-float-constants
7793
7794 Issue a warning for any floating constant that does not have
7795 a suffix. When used together with @option{-Wsystem-headers} it
7796 warns about such constants in system header files. This can be useful
7797 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7798 from the decimal floating-point extension to C99.
7799
7800 @item -Wno-designated-init @r{(C and Objective-C only)}
7801 Suppress warnings when a positional initializer is used to initialize
7802 a structure that has been marked with the @code{designated_init}
7803 attribute.
7804
7805 @item -Whsa
7806 Issue a warning when HSAIL cannot be emitted for the compiled function or
7807 OpenMP construct.
7808
7809 @end table
7810
7811 @node Debugging Options
7812 @section Options for Debugging Your Program
7813 @cindex options, debugging
7814 @cindex debugging information options
7815
7816 To tell GCC to emit extra information for use by a debugger, in almost
7817 all cases you need only to add @option{-g} to your other options.
7818
7819 GCC allows you to use @option{-g} with
7820 @option{-O}. The shortcuts taken by optimized code may occasionally
7821 be surprising: some variables you declared may not exist
7822 at all; flow of control may briefly move where you did not expect it;
7823 some statements may not be executed because they compute constant
7824 results or their values are already at hand; some statements may
7825 execute in different places because they have been moved out of loops.
7826 Nevertheless it is possible to debug optimized output. This makes
7827 it reasonable to use the optimizer for programs that might have bugs.
7828
7829 If you are not using some other optimization option, consider
7830 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7831 With no @option{-O} option at all, some compiler passes that collect
7832 information useful for debugging do not run at all, so that
7833 @option{-Og} may result in a better debugging experience.
7834
7835 @table @gcctabopt
7836 @item -g
7837 @opindex g
7838 Produce debugging information in the operating system's native format
7839 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7840 information.
7841
7842 On most systems that use stabs format, @option{-g} enables use of extra
7843 debugging information that only GDB can use; this extra information
7844 makes debugging work better in GDB but probably makes other debuggers
7845 crash or
7846 refuse to read the program. If you want to control for certain whether
7847 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7848 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7849
7850 @item -ggdb
7851 @opindex ggdb
7852 Produce debugging information for use by GDB@. This means to use the
7853 most expressive format available (DWARF, stabs, or the native format
7854 if neither of those are supported), including GDB extensions if at all
7855 possible.
7856
7857 @item -gdwarf
7858 @itemx -gdwarf-@var{version}
7859 @opindex gdwarf
7860 Produce debugging information in DWARF format (if that is supported).
7861 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7862 for most targets is 4. DWARF Version 5 is only experimental.
7863
7864 Note that with DWARF Version 2, some ports require and always
7865 use some non-conflicting DWARF 3 extensions in the unwind tables.
7866
7867 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7868 for maximum benefit.
7869
7870 GCC no longer supports DWARF Version 1, which is substantially
7871 different than Version 2 and later. For historical reasons, some
7872 other DWARF-related options such as
7873 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7874 in their names, but apply to all currently-supported versions of DWARF.
7875
7876 @item -gstabs
7877 @opindex gstabs
7878 Produce debugging information in stabs format (if that is supported),
7879 without GDB extensions. This is the format used by DBX on most BSD
7880 systems. On MIPS, Alpha and System V Release 4 systems this option
7881 produces stabs debugging output that is not understood by DBX@.
7882 On System V Release 4 systems this option requires the GNU assembler.
7883
7884 @item -gstabs+
7885 @opindex gstabs+
7886 Produce debugging information in stabs format (if that is supported),
7887 using GNU extensions understood only by the GNU debugger (GDB)@. The
7888 use of these extensions is likely to make other debuggers crash or
7889 refuse to read the program.
7890
7891 @item -gxcoff
7892 @opindex gxcoff
7893 Produce debugging information in XCOFF format (if that is supported).
7894 This is the format used by the DBX debugger on IBM RS/6000 systems.
7895
7896 @item -gxcoff+
7897 @opindex gxcoff+
7898 Produce debugging information in XCOFF format (if that is supported),
7899 using GNU extensions understood only by the GNU debugger (GDB)@. The
7900 use of these extensions is likely to make other debuggers crash or
7901 refuse to read the program, and may cause assemblers other than the GNU
7902 assembler (GAS) to fail with an error.
7903
7904 @item -gvms
7905 @opindex gvms
7906 Produce debugging information in Alpha/VMS debug format (if that is
7907 supported). This is the format used by DEBUG on Alpha/VMS systems.
7908
7909 @item -g@var{level}
7910 @itemx -ggdb@var{level}
7911 @itemx -gstabs@var{level}
7912 @itemx -gxcoff@var{level}
7913 @itemx -gvms@var{level}
7914 Request debugging information and also use @var{level} to specify how
7915 much information. The default level is 2.
7916
7917 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7918 @option{-g}.
7919
7920 Level 1 produces minimal information, enough for making backtraces in
7921 parts of the program that you don't plan to debug. This includes
7922 descriptions of functions and external variables, and line number
7923 tables, but no information about local variables.
7924
7925 Level 3 includes extra information, such as all the macro definitions
7926 present in the program. Some debuggers support macro expansion when
7927 you use @option{-g3}.
7928
7929 If you use multiple @option{-g} options, with or without level numbers,
7930 the last such option is the one that is effective.
7931
7932 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7933 confusion with @option{-gdwarf-@var{level}}.
7934 Instead use an additional @option{-g@var{level}} option to change the
7935 debug level for DWARF.
7936
7937 @item -fno-eliminate-unused-debug-symbols
7938 @opindex feliminate-unused-debug-symbols
7939 @opindex fno-eliminate-unused-debug-symbols
7940 By default, no debug information is produced for symbols that are not actually
7941 used. Use this option if you want debug information for all symbols.
7942
7943 @item -femit-class-debug-always
7944 @opindex femit-class-debug-always
7945 Instead of emitting debugging information for a C++ class in only one
7946 object file, emit it in all object files using the class. This option
7947 should be used only with debuggers that are unable to handle the way GCC
7948 normally emits debugging information for classes because using this
7949 option increases the size of debugging information by as much as a
7950 factor of two.
7951
7952 @item -fno-merge-debug-strings
7953 @opindex fmerge-debug-strings
7954 @opindex fno-merge-debug-strings
7955 Direct the linker to not merge together strings in the debugging
7956 information that are identical in different object files. Merging is
7957 not supported by all assemblers or linkers. Merging decreases the size
7958 of the debug information in the output file at the cost of increasing
7959 link processing time. Merging is enabled by default.
7960
7961 @item -fdebug-prefix-map=@var{old}=@var{new}
7962 @opindex fdebug-prefix-map
7963 When compiling files residing in directory @file{@var{old}}, record
7964 debugging information describing them as if the files resided in
7965 directory @file{@var{new}} instead. This can be used to replace a
7966 build-time path with an install-time path in the debug info. It can
7967 also be used to change an absolute path to a relative path by using
7968 @file{.} for @var{new}. This can give more reproducible builds, which
7969 are location independent, but may require an extra command to tell GDB
7970 where to find the source files. See also @option{-ffile-prefix-map}.
7971
7972 @item -fvar-tracking
7973 @opindex fvar-tracking
7974 Run variable tracking pass. It computes where variables are stored at each
7975 position in code. Better debugging information is then generated
7976 (if the debugging information format supports this information).
7977
7978 It is enabled by default when compiling with optimization (@option{-Os},
7979 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7980 the debug info format supports it.
7981
7982 @item -fvar-tracking-assignments
7983 @opindex fvar-tracking-assignments
7984 @opindex fno-var-tracking-assignments
7985 Annotate assignments to user variables early in the compilation and
7986 attempt to carry the annotations over throughout the compilation all the
7987 way to the end, in an attempt to improve debug information while
7988 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7989
7990 It can be enabled even if var-tracking is disabled, in which case
7991 annotations are created and maintained, but discarded at the end.
7992 By default, this flag is enabled together with @option{-fvar-tracking},
7993 except when selective scheduling is enabled.
7994
7995 @item -gsplit-dwarf
7996 @opindex gsplit-dwarf
7997 Separate as much DWARF debugging information as possible into a
7998 separate output file with the extension @file{.dwo}. This option allows
7999 the build system to avoid linking files with debug information. To
8000 be useful, this option requires a debugger capable of reading @file{.dwo}
8001 files.
8002
8003 @item -gdescribe-dies
8004 @opindex gdescribe-dies
8005 Add description attributes to some DWARF DIEs that have no name attribute,
8006 such as artificial variables, external references and call site
8007 parameter DIEs.
8008
8009 @item -gpubnames
8010 @opindex gpubnames
8011 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
8012
8013 @item -ggnu-pubnames
8014 @opindex ggnu-pubnames
8015 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
8016 suitable for conversion into a GDB@ index. This option is only useful
8017 with a linker that can produce GDB@ index version 7.
8018
8019 @item -fdebug-types-section
8020 @opindex fdebug-types-section
8021 @opindex fno-debug-types-section
8022 When using DWARF Version 4 or higher, type DIEs can be put into
8023 their own @code{.debug_types} section instead of making them part of the
8024 @code{.debug_info} section. It is more efficient to put them in a separate
8025 comdat section since the linker can then remove duplicates.
8026 But not all DWARF consumers support @code{.debug_types} sections yet
8027 and on some objects @code{.debug_types} produces larger instead of smaller
8028 debugging information.
8029
8030 @item -grecord-gcc-switches
8031 @itemx -gno-record-gcc-switches
8032 @opindex grecord-gcc-switches
8033 @opindex gno-record-gcc-switches
8034 This switch causes the command-line options used to invoke the
8035 compiler that may affect code generation to be appended to the
8036 DW_AT_producer attribute in DWARF debugging information. The options
8037 are concatenated with spaces separating them from each other and from
8038 the compiler version.
8039 It is enabled by default.
8040 See also @option{-frecord-gcc-switches} for another
8041 way of storing compiler options into the object file.
8042
8043 @item -gstrict-dwarf
8044 @opindex gstrict-dwarf
8045 Disallow using extensions of later DWARF standard version than selected
8046 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
8047 DWARF extensions from later standard versions is allowed.
8048
8049 @item -gno-strict-dwarf
8050 @opindex gno-strict-dwarf
8051 Allow using extensions of later DWARF standard version than selected with
8052 @option{-gdwarf-@var{version}}.
8053
8054 @item -gas-loc-support
8055 @opindex gas-loc-support
8056 Inform the compiler that the assembler supports @code{.loc} directives.
8057 It may then use them for the assembler to generate DWARF2+ line number
8058 tables.
8059
8060 This is generally desirable, because assembler-generated line-number
8061 tables are a lot more compact than those the compiler can generate
8062 itself.
8063
8064 This option will be enabled by default if, at GCC configure time, the
8065 assembler was found to support such directives.
8066
8067 @item -gno-as-loc-support
8068 @opindex gno-as-loc-support
8069 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8070 line number tables are to be generated.
8071
8072 @item -gas-locview-support
8073 @opindex gas-locview-support
8074 Inform the compiler that the assembler supports @code{view} assignment
8075 and reset assertion checking in @code{.loc} directives.
8076
8077 This option will be enabled by default if, at GCC configure time, the
8078 assembler was found to support them.
8079
8080 @item -gno-as-locview-support
8081 Force GCC to assign view numbers internally, if
8082 @option{-gvariable-location-views} are explicitly requested.
8083
8084 @item -gcolumn-info
8085 @itemx -gno-column-info
8086 @opindex gcolumn-info
8087 @opindex gno-column-info
8088 Emit location column information into DWARF debugging information, rather
8089 than just file and line.
8090 This option is enabled by default.
8091
8092 @item -gstatement-frontiers
8093 @itemx -gno-statement-frontiers
8094 @opindex gstatement-frontiers
8095 @opindex gno-statement-frontiers
8096 This option causes GCC to create markers in the internal representation
8097 at the beginning of statements, and to keep them roughly in place
8098 throughout compilation, using them to guide the output of @code{is_stmt}
8099 markers in the line number table. This is enabled by default when
8100 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8101 @dots{}), and outputting DWARF 2 debug information at the normal level.
8102
8103 @item -gvariable-location-views
8104 @itemx -gvariable-location-views=incompat5
8105 @itemx -gno-variable-location-views
8106 @opindex gvariable-location-views
8107 @opindex gvariable-location-views=incompat5
8108 @opindex gno-variable-location-views
8109 Augment variable location lists with progressive view numbers implied
8110 from the line number table. This enables debug information consumers to
8111 inspect state at certain points of the program, even if no instructions
8112 associated with the corresponding source locations are present at that
8113 point. If the assembler lacks support for view numbers in line number
8114 tables, this will cause the compiler to emit the line number table,
8115 which generally makes them somewhat less compact. The augmented line
8116 number tables and location lists are fully backward-compatible, so they
8117 can be consumed by debug information consumers that are not aware of
8118 these augmentations, but they won't derive any benefit from them either.
8119
8120 This is enabled by default when outputting DWARF 2 debug information at
8121 the normal level, as long as there is assembler support,
8122 @option{-fvar-tracking-assignments} is enabled and
8123 @option{-gstrict-dwarf} is not. When assembler support is not
8124 available, this may still be enabled, but it will force GCC to output
8125 internal line number tables, and if
8126 @option{-ginternal-reset-location-views} is not enabled, that will most
8127 certainly lead to silently mismatching location views.
8128
8129 There is a proposed representation for view numbers that is not backward
8130 compatible with the location list format introduced in DWARF 5, that can
8131 be enabled with @option{-gvariable-location-views=incompat5}. This
8132 option may be removed in the future, is only provided as a reference
8133 implementation of the proposed representation. Debug information
8134 consumers are not expected to support this extended format, and they
8135 would be rendered unable to decode location lists using it.
8136
8137 @item -ginternal-reset-location-views
8138 @itemx -gnointernal-reset-location-views
8139 @opindex ginternal-reset-location-views
8140 @opindex gno-internal-reset-location-views
8141 Attempt to determine location views that can be omitted from location
8142 view lists. This requires the compiler to have very accurate insn
8143 length estimates, which isn't always the case, and it may cause
8144 incorrect view lists to be generated silently when using an assembler
8145 that does not support location view lists. The GNU assembler will flag
8146 any such error as a @code{view number mismatch}. This is only enabled
8147 on ports that define a reliable estimation function.
8148
8149 @item -ginline-points
8150 @itemx -gno-inline-points
8151 @opindex ginline-points
8152 @opindex gno-inline-points
8153 Generate extended debug information for inlined functions. Location
8154 view tracking markers are inserted at inlined entry points, so that
8155 address and view numbers can be computed and output in debug
8156 information. This can be enabled independently of location views, in
8157 which case the view numbers won't be output, but it can only be enabled
8158 along with statement frontiers, and it is only enabled by default if
8159 location views are enabled.
8160
8161 @item -gz@r{[}=@var{type}@r{]}
8162 @opindex gz
8163 Produce compressed debug sections in DWARF format, if that is supported.
8164 If @var{type} is not given, the default type depends on the capabilities
8165 of the assembler and linker used. @var{type} may be one of
8166 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8167 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8168 compression in traditional GNU format). If the linker doesn't support
8169 writing compressed debug sections, the option is rejected. Otherwise,
8170 if the assembler does not support them, @option{-gz} is silently ignored
8171 when producing object files.
8172
8173 @item -femit-struct-debug-baseonly
8174 @opindex femit-struct-debug-baseonly
8175 Emit debug information for struct-like types
8176 only when the base name of the compilation source file
8177 matches the base name of file in which the struct is defined.
8178
8179 This option substantially reduces the size of debugging information,
8180 but at significant potential loss in type information to the debugger.
8181 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8182 See @option{-femit-struct-debug-detailed} for more detailed control.
8183
8184 This option works only with DWARF debug output.
8185
8186 @item -femit-struct-debug-reduced
8187 @opindex femit-struct-debug-reduced
8188 Emit debug information for struct-like types
8189 only when the base name of the compilation source file
8190 matches the base name of file in which the type is defined,
8191 unless the struct is a template or defined in a system header.
8192
8193 This option significantly reduces the size of debugging information,
8194 with some potential loss in type information to the debugger.
8195 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8196 See @option{-femit-struct-debug-detailed} for more detailed control.
8197
8198 This option works only with DWARF debug output.
8199
8200 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8201 @opindex femit-struct-debug-detailed
8202 Specify the struct-like types
8203 for which the compiler generates debug information.
8204 The intent is to reduce duplicate struct debug information
8205 between different object files within the same program.
8206
8207 This option is a detailed version of
8208 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8209 which serves for most needs.
8210
8211 A specification has the syntax@*
8212 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8213
8214 The optional first word limits the specification to
8215 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8216 A struct type is used directly when it is the type of a variable, member.
8217 Indirect uses arise through pointers to structs.
8218 That is, when use of an incomplete struct is valid, the use is indirect.
8219 An example is
8220 @samp{struct one direct; struct two * indirect;}.
8221
8222 The optional second word limits the specification to
8223 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8224 Generic structs are a bit complicated to explain.
8225 For C++, these are non-explicit specializations of template classes,
8226 or non-template classes within the above.
8227 Other programming languages have generics,
8228 but @option{-femit-struct-debug-detailed} does not yet implement them.
8229
8230 The third word specifies the source files for those
8231 structs for which the compiler should emit debug information.
8232 The values @samp{none} and @samp{any} have the normal meaning.
8233 The value @samp{base} means that
8234 the base of name of the file in which the type declaration appears
8235 must match the base of the name of the main compilation file.
8236 In practice, this means that when compiling @file{foo.c}, debug information
8237 is generated for types declared in that file and @file{foo.h},
8238 but not other header files.
8239 The value @samp{sys} means those types satisfying @samp{base}
8240 or declared in system or compiler headers.
8241
8242 You may need to experiment to determine the best settings for your application.
8243
8244 The default is @option{-femit-struct-debug-detailed=all}.
8245
8246 This option works only with DWARF debug output.
8247
8248 @item -fno-dwarf2-cfi-asm
8249 @opindex fdwarf2-cfi-asm
8250 @opindex fno-dwarf2-cfi-asm
8251 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8252 instead of using GAS @code{.cfi_*} directives.
8253
8254 @item -fno-eliminate-unused-debug-types
8255 @opindex feliminate-unused-debug-types
8256 @opindex fno-eliminate-unused-debug-types
8257 Normally, when producing DWARF output, GCC avoids producing debug symbol
8258 output for types that are nowhere used in the source file being compiled.
8259 Sometimes it is useful to have GCC emit debugging
8260 information for all types declared in a compilation
8261 unit, regardless of whether or not they are actually used
8262 in that compilation unit, for example
8263 if, in the debugger, you want to cast a value to a type that is
8264 not actually used in your program (but is declared). More often,
8265 however, this results in a significant amount of wasted space.
8266 @end table
8267
8268 @node Optimize Options
8269 @section Options That Control Optimization
8270 @cindex optimize options
8271 @cindex options, optimization
8272
8273 These options control various sorts of optimizations.
8274
8275 Without any optimization option, the compiler's goal is to reduce the
8276 cost of compilation and to make debugging produce the expected
8277 results. Statements are independent: if you stop the program with a
8278 breakpoint between statements, you can then assign a new value to any
8279 variable or change the program counter to any other statement in the
8280 function and get exactly the results you expect from the source
8281 code.
8282
8283 Turning on optimization flags makes the compiler attempt to improve
8284 the performance and/or code size at the expense of compilation time
8285 and possibly the ability to debug the program.
8286
8287 The compiler performs optimization based on the knowledge it has of the
8288 program. Compiling multiple files at once to a single output file mode allows
8289 the compiler to use information gained from all of the files when compiling
8290 each of them.
8291
8292 Not all optimizations are controlled directly by a flag. Only
8293 optimizations that have a flag are listed in this section.
8294
8295 Most optimizations are completely disabled at @option{-O0} or if an
8296 @option{-O} level is not set on the command line, even if individual
8297 optimization flags are specified. Similarly, @option{-Og} suppresses
8298 many optimization passes.
8299
8300 Depending on the target and how GCC was configured, a slightly different
8301 set of optimizations may be enabled at each @option{-O} level than
8302 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8303 to find out the exact set of optimizations that are enabled at each level.
8304 @xref{Overall Options}, for examples.
8305
8306 @table @gcctabopt
8307 @item -O
8308 @itemx -O1
8309 @opindex O
8310 @opindex O1
8311 Optimize. Optimizing compilation takes somewhat more time, and a lot
8312 more memory for a large function.
8313
8314 With @option{-O}, the compiler tries to reduce code size and execution
8315 time, without performing any optimizations that take a great deal of
8316 compilation time.
8317
8318 @c Note that in addition to the default_options_table list in opts.c,
8319 @c several optimization flags default to true but control optimization
8320 @c passes that are explicitly disabled at -O0.
8321
8322 @option{-O} turns on the following optimization flags:
8323
8324 @c Please keep the following list alphabetized.
8325 @gccoptlist{-fauto-inc-dec @gol
8326 -fbranch-count-reg @gol
8327 -fcombine-stack-adjustments @gol
8328 -fcompare-elim @gol
8329 -fcprop-registers @gol
8330 -fdce @gol
8331 -fdefer-pop @gol
8332 -fdelayed-branch @gol
8333 -fdse @gol
8334 -fforward-propagate @gol
8335 -fguess-branch-probability @gol
8336 -fif-conversion @gol
8337 -fif-conversion2 @gol
8338 -finline-functions-called-once @gol
8339 -fipa-profile @gol
8340 -fipa-pure-const @gol
8341 -fipa-reference @gol
8342 -fipa-reference-addressable @gol
8343 -fmerge-constants @gol
8344 -fmove-loop-invariants @gol
8345 -fomit-frame-pointer @gol
8346 -freorder-blocks @gol
8347 -fshrink-wrap @gol
8348 -fshrink-wrap-separate @gol
8349 -fsplit-wide-types @gol
8350 -fssa-backprop @gol
8351 -fssa-phiopt @gol
8352 -ftree-bit-ccp @gol
8353 -ftree-ccp @gol
8354 -ftree-ch @gol
8355 -ftree-coalesce-vars @gol
8356 -ftree-copy-prop @gol
8357 -ftree-dce @gol
8358 -ftree-dominator-opts @gol
8359 -ftree-dse @gol
8360 -ftree-forwprop @gol
8361 -ftree-fre @gol
8362 -ftree-phiprop @gol
8363 -ftree-pta @gol
8364 -ftree-scev-cprop @gol
8365 -ftree-sink @gol
8366 -ftree-slsr @gol
8367 -ftree-sra @gol
8368 -ftree-ter @gol
8369 -funit-at-a-time}
8370
8371 @item -O2
8372 @opindex O2
8373 Optimize even more. GCC performs nearly all supported optimizations
8374 that do not involve a space-speed tradeoff.
8375 As compared to @option{-O}, this option increases both compilation time
8376 and the performance of the generated code.
8377
8378 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8379 also turns on the following optimization flags:
8380
8381 @c Please keep the following list alphabetized!
8382 @gccoptlist{-falign-functions -falign-jumps @gol
8383 -falign-labels -falign-loops @gol
8384 -fcaller-saves @gol
8385 -fcode-hoisting @gol
8386 -fcrossjumping @gol
8387 -fcse-follow-jumps -fcse-skip-blocks @gol
8388 -fdelete-null-pointer-checks @gol
8389 -fdevirtualize -fdevirtualize-speculatively @gol
8390 -fexpensive-optimizations @gol
8391 -ffinite-loops @gol
8392 -fgcse -fgcse-lm @gol
8393 -fhoist-adjacent-loads @gol
8394 -finline-functions @gol
8395 -finline-small-functions @gol
8396 -findirect-inlining @gol
8397 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8398 -fipa-ra -fipa-sra -fipa-vrp @gol
8399 -fisolate-erroneous-paths-dereference @gol
8400 -flra-remat @gol
8401 -foptimize-sibling-calls @gol
8402 -foptimize-strlen @gol
8403 -fpartial-inlining @gol
8404 -fpeephole2 @gol
8405 -freorder-blocks-algorithm=stc @gol
8406 -freorder-blocks-and-partition -freorder-functions @gol
8407 -frerun-cse-after-loop @gol
8408 -fschedule-insns -fschedule-insns2 @gol
8409 -fsched-interblock -fsched-spec @gol
8410 -fstore-merging @gol
8411 -fstrict-aliasing @gol
8412 -fthread-jumps @gol
8413 -ftree-builtin-call-dce @gol
8414 -ftree-pre @gol
8415 -ftree-switch-conversion -ftree-tail-merge @gol
8416 -ftree-vrp}
8417
8418 Please note the warning under @option{-fgcse} about
8419 invoking @option{-O2} on programs that use computed gotos.
8420
8421 @item -O3
8422 @opindex O3
8423 Optimize yet more. @option{-O3} turns on all optimizations specified
8424 by @option{-O2} and also turns on the following optimization flags:
8425
8426 @c Please keep the following list alphabetized!
8427 @gccoptlist{-fgcse-after-reload @gol
8428 -fipa-cp-clone
8429 -floop-interchange @gol
8430 -floop-unroll-and-jam @gol
8431 -fpeel-loops @gol
8432 -fpredictive-commoning @gol
8433 -fsplit-paths @gol
8434 -ftree-loop-distribute-patterns @gol
8435 -ftree-loop-distribution @gol
8436 -ftree-loop-vectorize @gol
8437 -ftree-partial-pre @gol
8438 -ftree-slp-vectorize @gol
8439 -funswitch-loops @gol
8440 -fvect-cost-model @gol
8441 -fversion-loops-for-strides}
8442
8443 @item -O0
8444 @opindex O0
8445 Reduce compilation time and make debugging produce the expected
8446 results. This is the default.
8447
8448 @item -Os
8449 @opindex Os
8450 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8451 except those that often increase code size:
8452
8453 @gccoptlist{-falign-functions -falign-jumps @gol
8454 -falign-labels -falign-loops @gol
8455 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8456
8457 It also enables @option{-finline-functions}, causes the compiler to tune for
8458 code size rather than execution speed, and performs further optimizations
8459 designed to reduce code size.
8460
8461 @item -Ofast
8462 @opindex Ofast
8463 Disregard strict standards compliance. @option{-Ofast} enables all
8464 @option{-O3} optimizations. It also enables optimizations that are not
8465 valid for all standard-compliant programs.
8466 It turns on @option{-ffast-math} and the Fortran-specific
8467 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8468 specified, and @option{-fno-protect-parens}.
8469
8470 @item -Og
8471 @opindex Og
8472 Optimize debugging experience. @option{-Og} should be the optimization
8473 level of choice for the standard edit-compile-debug cycle, offering
8474 a reasonable level of optimization while maintaining fast compilation
8475 and a good debugging experience. It is a better choice than @option{-O0}
8476 for producing debuggable code because some compiler passes
8477 that collect debug information are disabled at @option{-O0}.
8478
8479 Like @option{-O0}, @option{-Og} completely disables a number of
8480 optimization passes so that individual options controlling them have
8481 no effect. Otherwise @option{-Og} enables all @option{-O1}
8482 optimization flags except for those that may interfere with debugging:
8483
8484 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8485 -fdse -fif-conversion -fif-conversion2 @gol
8486 -finline-functions-called-once @gol
8487 -fmove-loop-invariants -fssa-phiopt @gol
8488 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
8489
8490 @end table
8491
8492 If you use multiple @option{-O} options, with or without level numbers,
8493 the last such option is the one that is effective.
8494
8495 Options of the form @option{-f@var{flag}} specify machine-independent
8496 flags. Most flags have both positive and negative forms; the negative
8497 form of @option{-ffoo} is @option{-fno-foo}. In the table
8498 below, only one of the forms is listed---the one you typically
8499 use. You can figure out the other form by either removing @samp{no-}
8500 or adding it.
8501
8502 The following options control specific optimizations. They are either
8503 activated by @option{-O} options or are related to ones that are. You
8504 can use the following flags in the rare cases when ``fine-tuning'' of
8505 optimizations to be performed is desired.
8506
8507 @table @gcctabopt
8508 @item -fno-defer-pop
8509 @opindex fno-defer-pop
8510 @opindex fdefer-pop
8511 For machines that must pop arguments after a function call, always pop
8512 the arguments as soon as each function returns.
8513 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8514 this allows the compiler to let arguments accumulate on the stack for several
8515 function calls and pop them all at once.
8516
8517 @item -fforward-propagate
8518 @opindex fforward-propagate
8519 Perform a forward propagation pass on RTL@. The pass tries to combine two
8520 instructions and checks if the result can be simplified. If loop unrolling
8521 is active, two passes are performed and the second is scheduled after
8522 loop unrolling.
8523
8524 This option is enabled by default at optimization levels @option{-O},
8525 @option{-O2}, @option{-O3}, @option{-Os}.
8526
8527 @item -ffp-contract=@var{style}
8528 @opindex ffp-contract
8529 @option{-ffp-contract=off} disables floating-point expression contraction.
8530 @option{-ffp-contract=fast} enables floating-point expression contraction
8531 such as forming of fused multiply-add operations if the target has
8532 native support for them.
8533 @option{-ffp-contract=on} enables floating-point expression contraction
8534 if allowed by the language standard. This is currently not implemented
8535 and treated equal to @option{-ffp-contract=off}.
8536
8537 The default is @option{-ffp-contract=fast}.
8538
8539 @item -fomit-frame-pointer
8540 @opindex fomit-frame-pointer
8541 Omit the frame pointer in functions that don't need one. This avoids the
8542 instructions to save, set up and restore the frame pointer; on many targets
8543 it also makes an extra register available.
8544
8545 On some targets this flag has no effect because the standard calling sequence
8546 always uses a frame pointer, so it cannot be omitted.
8547
8548 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8549 is used in all functions. Several targets always omit the frame pointer in
8550 leaf functions.
8551
8552 Enabled by default at @option{-O} and higher.
8553
8554 @item -foptimize-sibling-calls
8555 @opindex foptimize-sibling-calls
8556 Optimize sibling and tail recursive calls.
8557
8558 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8559
8560 @item -foptimize-strlen
8561 @opindex foptimize-strlen
8562 Optimize various standard C string functions (e.g.@: @code{strlen},
8563 @code{strchr} or @code{strcpy}) and
8564 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8565
8566 Enabled at levels @option{-O2}, @option{-O3}.
8567
8568 @item -fno-inline
8569 @opindex fno-inline
8570 @opindex finline
8571 Do not expand any functions inline apart from those marked with
8572 the @code{always_inline} attribute. This is the default when not
8573 optimizing.
8574
8575 Single functions can be exempted from inlining by marking them
8576 with the @code{noinline} attribute.
8577
8578 @item -finline-small-functions
8579 @opindex finline-small-functions
8580 Integrate functions into their callers when their body is smaller than expected
8581 function call code (so overall size of program gets smaller). The compiler
8582 heuristically decides which functions are simple enough to be worth integrating
8583 in this way. This inlining applies to all functions, even those not declared
8584 inline.
8585
8586 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8587
8588 @item -findirect-inlining
8589 @opindex findirect-inlining
8590 Inline also indirect calls that are discovered to be known at compile
8591 time thanks to previous inlining. This option has any effect only
8592 when inlining itself is turned on by the @option{-finline-functions}
8593 or @option{-finline-small-functions} options.
8594
8595 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8596
8597 @item -finline-functions
8598 @opindex finline-functions
8599 Consider all functions for inlining, even if they are not declared inline.
8600 The compiler heuristically decides which functions are worth integrating
8601 in this way.
8602
8603 If all calls to a given function are integrated, and the function is
8604 declared @code{static}, then the function is normally not output as
8605 assembler code in its own right.
8606
8607 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
8608 by @option{-fprofile-use} and @option{-fauto-profile}.
8609
8610 @item -finline-functions-called-once
8611 @opindex finline-functions-called-once
8612 Consider all @code{static} functions called once for inlining into their
8613 caller even if they are not marked @code{inline}. If a call to a given
8614 function is integrated, then the function is not output as assembler code
8615 in its own right.
8616
8617 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8618 but not @option{-Og}.
8619
8620 @item -fearly-inlining
8621 @opindex fearly-inlining
8622 Inline functions marked by @code{always_inline} and functions whose body seems
8623 smaller than the function call overhead early before doing
8624 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8625 makes profiling significantly cheaper and usually inlining faster on programs
8626 having large chains of nested wrapper functions.
8627
8628 Enabled by default.
8629
8630 @item -fipa-sra
8631 @opindex fipa-sra
8632 Perform interprocedural scalar replacement of aggregates, removal of
8633 unused parameters and replacement of parameters passed by reference
8634 by parameters passed by value.
8635
8636 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8637
8638 @item -finline-limit=@var{n}
8639 @opindex finline-limit
8640 By default, GCC limits the size of functions that can be inlined. This flag
8641 allows coarse control of this limit. @var{n} is the size of functions that
8642 can be inlined in number of pseudo instructions.
8643
8644 Inlining is actually controlled by a number of parameters, which may be
8645 specified individually by using @option{--param @var{name}=@var{value}}.
8646 The @option{-finline-limit=@var{n}} option sets some of these parameters
8647 as follows:
8648
8649 @table @gcctabopt
8650 @item max-inline-insns-single
8651 is set to @var{n}/2.
8652 @item max-inline-insns-auto
8653 is set to @var{n}/2.
8654 @end table
8655
8656 See below for a documentation of the individual
8657 parameters controlling inlining and for the defaults of these parameters.
8658
8659 @emph{Note:} there may be no value to @option{-finline-limit} that results
8660 in default behavior.
8661
8662 @emph{Note:} pseudo instruction represents, in this particular context, an
8663 abstract measurement of function's size. In no way does it represent a count
8664 of assembly instructions and as such its exact meaning might change from one
8665 release to an another.
8666
8667 @item -fno-keep-inline-dllexport
8668 @opindex fno-keep-inline-dllexport
8669 @opindex fkeep-inline-dllexport
8670 This is a more fine-grained version of @option{-fkeep-inline-functions},
8671 which applies only to functions that are declared using the @code{dllexport}
8672 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8673 Functions}.
8674
8675 @item -fkeep-inline-functions
8676 @opindex fkeep-inline-functions
8677 In C, emit @code{static} functions that are declared @code{inline}
8678 into the object file, even if the function has been inlined into all
8679 of its callers. This switch does not affect functions using the
8680 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8681 inline functions into the object file.
8682
8683 @item -fkeep-static-functions
8684 @opindex fkeep-static-functions
8685 Emit @code{static} functions into the object file, even if the function
8686 is never used.
8687
8688 @item -fkeep-static-consts
8689 @opindex fkeep-static-consts
8690 Emit variables declared @code{static const} when optimization isn't turned
8691 on, even if the variables aren't referenced.
8692
8693 GCC enables this option by default. If you want to force the compiler to
8694 check if a variable is referenced, regardless of whether or not
8695 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8696
8697 @item -fmerge-constants
8698 @opindex fmerge-constants
8699 Attempt to merge identical constants (string constants and floating-point
8700 constants) across compilation units.
8701
8702 This option is the default for optimized compilation if the assembler and
8703 linker support it. Use @option{-fno-merge-constants} to inhibit this
8704 behavior.
8705
8706 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8707
8708 @item -fmerge-all-constants
8709 @opindex fmerge-all-constants
8710 Attempt to merge identical constants and identical variables.
8711
8712 This option implies @option{-fmerge-constants}. In addition to
8713 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8714 arrays or initialized constant variables with integral or floating-point
8715 types. Languages like C or C++ require each variable, including multiple
8716 instances of the same variable in recursive calls, to have distinct locations,
8717 so using this option results in non-conforming
8718 behavior.
8719
8720 @item -fmodulo-sched
8721 @opindex fmodulo-sched
8722 Perform swing modulo scheduling immediately before the first scheduling
8723 pass. This pass looks at innermost loops and reorders their
8724 instructions by overlapping different iterations.
8725
8726 @item -fmodulo-sched-allow-regmoves
8727 @opindex fmodulo-sched-allow-regmoves
8728 Perform more aggressive SMS-based modulo scheduling with register moves
8729 allowed. By setting this flag certain anti-dependences edges are
8730 deleted, which triggers the generation of reg-moves based on the
8731 life-range analysis. This option is effective only with
8732 @option{-fmodulo-sched} enabled.
8733
8734 @item -fno-branch-count-reg
8735 @opindex fno-branch-count-reg
8736 @opindex fbranch-count-reg
8737 Disable the optimization pass that scans for opportunities to use
8738 ``decrement and branch'' instructions on a count register instead of
8739 instruction sequences that decrement a register, compare it against zero, and
8740 then branch based upon the result. This option is only meaningful on
8741 architectures that support such instructions, which include x86, PowerPC,
8742 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8743 doesn't remove the decrement and branch instructions from the generated
8744 instruction stream introduced by other optimization passes.
8745
8746 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8747 except for @option{-Og}.
8748
8749 @item -fno-function-cse
8750 @opindex fno-function-cse
8751 @opindex ffunction-cse
8752 Do not put function addresses in registers; make each instruction that
8753 calls a constant function contain the function's address explicitly.
8754
8755 This option results in less efficient code, but some strange hacks
8756 that alter the assembler output may be confused by the optimizations
8757 performed when this option is not used.
8758
8759 The default is @option{-ffunction-cse}
8760
8761 @item -fno-zero-initialized-in-bss
8762 @opindex fno-zero-initialized-in-bss
8763 @opindex fzero-initialized-in-bss
8764 If the target supports a BSS section, GCC by default puts variables that
8765 are initialized to zero into BSS@. This can save space in the resulting
8766 code.
8767
8768 This option turns off this behavior because some programs explicitly
8769 rely on variables going to the data section---e.g., so that the
8770 resulting executable can find the beginning of that section and/or make
8771 assumptions based on that.
8772
8773 The default is @option{-fzero-initialized-in-bss}.
8774
8775 @item -fthread-jumps
8776 @opindex fthread-jumps
8777 Perform optimizations that check to see if a jump branches to a
8778 location where another comparison subsumed by the first is found. If
8779 so, the first branch is redirected to either the destination of the
8780 second branch or a point immediately following it, depending on whether
8781 the condition is known to be true or false.
8782
8783 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8784
8785 @item -fsplit-wide-types
8786 @opindex fsplit-wide-types
8787 When using a type that occupies multiple registers, such as @code{long
8788 long} on a 32-bit system, split the registers apart and allocate them
8789 independently. This normally generates better code for those types,
8790 but may make debugging more difficult.
8791
8792 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8793 @option{-Os}.
8794
8795 @item -fsplit-wide-types-early
8796 @opindex fsplit-wide-types-early
8797 Fully split wide types early, instead of very late.
8798 This option has no effect unless @option{-fsplit-wide-types} is turned on.
8799
8800 This is the default on some targets.
8801
8802 @item -fcse-follow-jumps
8803 @opindex fcse-follow-jumps
8804 In common subexpression elimination (CSE), scan through jump instructions
8805 when the target of the jump is not reached by any other path. For
8806 example, when CSE encounters an @code{if} statement with an
8807 @code{else} clause, CSE follows the jump when the condition
8808 tested is false.
8809
8810 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8811
8812 @item -fcse-skip-blocks
8813 @opindex fcse-skip-blocks
8814 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8815 follow jumps that conditionally skip over blocks. When CSE
8816 encounters a simple @code{if} statement with no else clause,
8817 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8818 body of the @code{if}.
8819
8820 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8821
8822 @item -frerun-cse-after-loop
8823 @opindex frerun-cse-after-loop
8824 Re-run common subexpression elimination after loop optimizations are
8825 performed.
8826
8827 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8828
8829 @item -fgcse
8830 @opindex fgcse
8831 Perform a global common subexpression elimination pass.
8832 This pass also performs global constant and copy propagation.
8833
8834 @emph{Note:} When compiling a program using computed gotos, a GCC
8835 extension, you may get better run-time performance if you disable
8836 the global common subexpression elimination pass by adding
8837 @option{-fno-gcse} to the command line.
8838
8839 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8840
8841 @item -fgcse-lm
8842 @opindex fgcse-lm
8843 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8844 attempts to move loads that are only killed by stores into themselves. This
8845 allows a loop containing a load/store sequence to be changed to a load outside
8846 the loop, and a copy/store within the loop.
8847
8848 Enabled by default when @option{-fgcse} is enabled.
8849
8850 @item -fgcse-sm
8851 @opindex fgcse-sm
8852 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8853 global common subexpression elimination. This pass attempts to move
8854 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8855 loops containing a load/store sequence can be changed to a load before
8856 the loop and a store after the loop.
8857
8858 Not enabled at any optimization level.
8859
8860 @item -fgcse-las
8861 @opindex fgcse-las
8862 When @option{-fgcse-las} is enabled, the global common subexpression
8863 elimination pass eliminates redundant loads that come after stores to the
8864 same memory location (both partial and full redundancies).
8865
8866 Not enabled at any optimization level.
8867
8868 @item -fgcse-after-reload
8869 @opindex fgcse-after-reload
8870 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8871 pass is performed after reload. The purpose of this pass is to clean up
8872 redundant spilling.
8873
8874 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8875
8876 @item -faggressive-loop-optimizations
8877 @opindex faggressive-loop-optimizations
8878 This option tells the loop optimizer to use language constraints to
8879 derive bounds for the number of iterations of a loop. This assumes that
8880 loop code does not invoke undefined behavior by for example causing signed
8881 integer overflows or out-of-bound array accesses. The bounds for the
8882 number of iterations of a loop are used to guide loop unrolling and peeling
8883 and loop exit test optimizations.
8884 This option is enabled by default.
8885
8886 @item -funconstrained-commons
8887 @opindex funconstrained-commons
8888 This option tells the compiler that variables declared in common blocks
8889 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8890 prevents certain optimizations that depend on knowing the array bounds.
8891
8892 @item -fcrossjumping
8893 @opindex fcrossjumping
8894 Perform cross-jumping transformation.
8895 This transformation unifies equivalent code and saves code size. The
8896 resulting code may or may not perform better than without cross-jumping.
8897
8898 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8899
8900 @item -fauto-inc-dec
8901 @opindex fauto-inc-dec
8902 Combine increments or decrements of addresses with memory accesses.
8903 This pass is always skipped on architectures that do not have
8904 instructions to support this. Enabled by default at @option{-O} and
8905 higher on architectures that support this.
8906
8907 @item -fdce
8908 @opindex fdce
8909 Perform dead code elimination (DCE) on RTL@.
8910 Enabled by default at @option{-O} and higher.
8911
8912 @item -fdse
8913 @opindex fdse
8914 Perform dead store elimination (DSE) on RTL@.
8915 Enabled by default at @option{-O} and higher.
8916
8917 @item -fif-conversion
8918 @opindex fif-conversion
8919 Attempt to transform conditional jumps into branch-less equivalents. This
8920 includes use of conditional moves, min, max, set flags and abs instructions, and
8921 some tricks doable by standard arithmetics. The use of conditional execution
8922 on chips where it is available is controlled by @option{-fif-conversion2}.
8923
8924 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8925 not with @option{-Og}.
8926
8927 @item -fif-conversion2
8928 @opindex fif-conversion2
8929 Use conditional execution (where available) to transform conditional jumps into
8930 branch-less equivalents.
8931
8932 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8933 not with @option{-Og}.
8934
8935 @item -fdeclone-ctor-dtor
8936 @opindex fdeclone-ctor-dtor
8937 The C++ ABI requires multiple entry points for constructors and
8938 destructors: one for a base subobject, one for a complete object, and
8939 one for a virtual destructor that calls operator delete afterwards.
8940 For a hierarchy with virtual bases, the base and complete variants are
8941 clones, which means two copies of the function. With this option, the
8942 base and complete variants are changed to be thunks that call a common
8943 implementation.
8944
8945 Enabled by @option{-Os}.
8946
8947 @item -fdelete-null-pointer-checks
8948 @opindex fdelete-null-pointer-checks
8949 Assume that programs cannot safely dereference null pointers, and that
8950 no code or data element resides at address zero.
8951 This option enables simple constant
8952 folding optimizations at all optimization levels. In addition, other
8953 optimization passes in GCC use this flag to control global dataflow
8954 analyses that eliminate useless checks for null pointers; these assume
8955 that a memory access to address zero always results in a trap, so
8956 that if a pointer is checked after it has already been dereferenced,
8957 it cannot be null.
8958
8959 Note however that in some environments this assumption is not true.
8960 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8961 for programs that depend on that behavior.
8962
8963 This option is enabled by default on most targets. On Nios II ELF, it
8964 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8965
8966 Passes that use the dataflow information
8967 are enabled independently at different optimization levels.
8968
8969 @item -fdevirtualize
8970 @opindex fdevirtualize
8971 Attempt to convert calls to virtual functions to direct calls. This
8972 is done both within a procedure and interprocedurally as part of
8973 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8974 propagation (@option{-fipa-cp}).
8975 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8976
8977 @item -fdevirtualize-speculatively
8978 @opindex fdevirtualize-speculatively
8979 Attempt to convert calls to virtual functions to speculative direct calls.
8980 Based on the analysis of the type inheritance graph, determine for a given call
8981 the set of likely targets. If the set is small, preferably of size 1, change
8982 the call into a conditional deciding between direct and indirect calls. The
8983 speculative calls enable more optimizations, such as inlining. When they seem
8984 useless after further optimization, they are converted back into original form.
8985
8986 @item -fdevirtualize-at-ltrans
8987 @opindex fdevirtualize-at-ltrans
8988 Stream extra information needed for aggressive devirtualization when running
8989 the link-time optimizer in local transformation mode.
8990 This option enables more devirtualization but
8991 significantly increases the size of streamed data. For this reason it is
8992 disabled by default.
8993
8994 @item -fexpensive-optimizations
8995 @opindex fexpensive-optimizations
8996 Perform a number of minor optimizations that are relatively expensive.
8997
8998 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8999
9000 @item -free
9001 @opindex free
9002 Attempt to remove redundant extension instructions. This is especially
9003 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
9004 registers after writing to their lower 32-bit half.
9005
9006 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
9007 @option{-O3}, @option{-Os}.
9008
9009 @item -fno-lifetime-dse
9010 @opindex fno-lifetime-dse
9011 @opindex flifetime-dse
9012 In C++ the value of an object is only affected by changes within its
9013 lifetime: when the constructor begins, the object has an indeterminate
9014 value, and any changes during the lifetime of the object are dead when
9015 the object is destroyed. Normally dead store elimination will take
9016 advantage of this; if your code relies on the value of the object
9017 storage persisting beyond the lifetime of the object, you can use this
9018 flag to disable this optimization. To preserve stores before the
9019 constructor starts (e.g.@: because your operator new clears the object
9020 storage) but still treat the object as dead after the destructor you,
9021 can use @option{-flifetime-dse=1}. The default behavior can be
9022 explicitly selected with @option{-flifetime-dse=2}.
9023 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
9024
9025 @item -flive-range-shrinkage
9026 @opindex flive-range-shrinkage
9027 Attempt to decrease register pressure through register live range
9028 shrinkage. This is helpful for fast processors with small or moderate
9029 size register sets.
9030
9031 @item -fira-algorithm=@var{algorithm}
9032 @opindex fira-algorithm
9033 Use the specified coloring algorithm for the integrated register
9034 allocator. The @var{algorithm} argument can be @samp{priority}, which
9035 specifies Chow's priority coloring, or @samp{CB}, which specifies
9036 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
9037 for all architectures, but for those targets that do support it, it is
9038 the default because it generates better code.
9039
9040 @item -fira-region=@var{region}
9041 @opindex fira-region
9042 Use specified regions for the integrated register allocator. The
9043 @var{region} argument should be one of the following:
9044
9045 @table @samp
9046
9047 @item all
9048 Use all loops as register allocation regions.
9049 This can give the best results for machines with a small and/or
9050 irregular register set.
9051
9052 @item mixed
9053 Use all loops except for loops with small register pressure
9054 as the regions. This value usually gives
9055 the best results in most cases and for most architectures,
9056 and is enabled by default when compiling with optimization for speed
9057 (@option{-O}, @option{-O2}, @dots{}).
9058
9059 @item one
9060 Use all functions as a single region.
9061 This typically results in the smallest code size, and is enabled by default for
9062 @option{-Os} or @option{-O0}.
9063
9064 @end table
9065
9066 @item -fira-hoist-pressure
9067 @opindex fira-hoist-pressure
9068 Use IRA to evaluate register pressure in the code hoisting pass for
9069 decisions to hoist expressions. This option usually results in smaller
9070 code, but it can slow the compiler down.
9071
9072 This option is enabled at level @option{-Os} for all targets.
9073
9074 @item -fira-loop-pressure
9075 @opindex fira-loop-pressure
9076 Use IRA to evaluate register pressure in loops for decisions to move
9077 loop invariants. This option usually results in generation
9078 of faster and smaller code on machines with large register files (>= 32
9079 registers), but it can slow the compiler down.
9080
9081 This option is enabled at level @option{-O3} for some targets.
9082
9083 @item -fno-ira-share-save-slots
9084 @opindex fno-ira-share-save-slots
9085 @opindex fira-share-save-slots
9086 Disable sharing of stack slots used for saving call-used hard
9087 registers living through a call. Each hard register gets a
9088 separate stack slot, and as a result function stack frames are
9089 larger.
9090
9091 @item -fno-ira-share-spill-slots
9092 @opindex fno-ira-share-spill-slots
9093 @opindex fira-share-spill-slots
9094 Disable sharing of stack slots allocated for pseudo-registers. Each
9095 pseudo-register that does not get a hard register gets a separate
9096 stack slot, and as a result function stack frames are larger.
9097
9098 @item -flra-remat
9099 @opindex flra-remat
9100 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9101 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9102 values if it is profitable.
9103
9104 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9105
9106 @item -fdelayed-branch
9107 @opindex fdelayed-branch
9108 If supported for the target machine, attempt to reorder instructions
9109 to exploit instruction slots available after delayed branch
9110 instructions.
9111
9112 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9113 but not at @option{-Og}.
9114
9115 @item -fschedule-insns
9116 @opindex fschedule-insns
9117 If supported for the target machine, attempt to reorder instructions to
9118 eliminate execution stalls due to required data being unavailable. This
9119 helps machines that have slow floating point or memory load instructions
9120 by allowing other instructions to be issued until the result of the load
9121 or floating-point instruction is required.
9122
9123 Enabled at levels @option{-O2}, @option{-O3}.
9124
9125 @item -fschedule-insns2
9126 @opindex fschedule-insns2
9127 Similar to @option{-fschedule-insns}, but requests an additional pass of
9128 instruction scheduling after register allocation has been done. This is
9129 especially useful on machines with a relatively small number of
9130 registers and where memory load instructions take more than one cycle.
9131
9132 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9133
9134 @item -fno-sched-interblock
9135 @opindex fno-sched-interblock
9136 @opindex fsched-interblock
9137 Disable instruction scheduling across basic blocks, which
9138 is normally enabled when scheduling before register allocation, i.e.@:
9139 with @option{-fschedule-insns} or at @option{-O2} or higher.
9140
9141 @item -fno-sched-spec
9142 @opindex fno-sched-spec
9143 @opindex fsched-spec
9144 Disable speculative motion of non-load instructions, which
9145 is normally enabled when scheduling before register allocation, i.e.@:
9146 with @option{-fschedule-insns} or at @option{-O2} or higher.
9147
9148 @item -fsched-pressure
9149 @opindex fsched-pressure
9150 Enable register pressure sensitive insn scheduling before register
9151 allocation. This only makes sense when scheduling before register
9152 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9153 @option{-O2} or higher. Usage of this option can improve the
9154 generated code and decrease its size by preventing register pressure
9155 increase above the number of available hard registers and subsequent
9156 spills in register allocation.
9157
9158 @item -fsched-spec-load
9159 @opindex fsched-spec-load
9160 Allow speculative motion of some load instructions. This only makes
9161 sense when scheduling before register allocation, i.e.@: with
9162 @option{-fschedule-insns} or at @option{-O2} or higher.
9163
9164 @item -fsched-spec-load-dangerous
9165 @opindex fsched-spec-load-dangerous
9166 Allow speculative motion of more load instructions. This only makes
9167 sense when scheduling before register allocation, i.e.@: with
9168 @option{-fschedule-insns} or at @option{-O2} or higher.
9169
9170 @item -fsched-stalled-insns
9171 @itemx -fsched-stalled-insns=@var{n}
9172 @opindex fsched-stalled-insns
9173 Define how many insns (if any) can be moved prematurely from the queue
9174 of stalled insns into the ready list during the second scheduling pass.
9175 @option{-fno-sched-stalled-insns} means that no insns are moved
9176 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9177 on how many queued insns can be moved prematurely.
9178 @option{-fsched-stalled-insns} without a value is equivalent to
9179 @option{-fsched-stalled-insns=1}.
9180
9181 @item -fsched-stalled-insns-dep
9182 @itemx -fsched-stalled-insns-dep=@var{n}
9183 @opindex fsched-stalled-insns-dep
9184 Define how many insn groups (cycles) are examined for a dependency
9185 on a stalled insn that is a candidate for premature removal from the queue
9186 of stalled insns. This has an effect only during the second scheduling pass,
9187 and only if @option{-fsched-stalled-insns} is used.
9188 @option{-fno-sched-stalled-insns-dep} is equivalent to
9189 @option{-fsched-stalled-insns-dep=0}.
9190 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9191 @option{-fsched-stalled-insns-dep=1}.
9192
9193 @item -fsched2-use-superblocks
9194 @opindex fsched2-use-superblocks
9195 When scheduling after register allocation, use superblock scheduling.
9196 This allows motion across basic block boundaries,
9197 resulting in faster schedules. This option is experimental, as not all machine
9198 descriptions used by GCC model the CPU closely enough to avoid unreliable
9199 results from the algorithm.
9200
9201 This only makes sense when scheduling after register allocation, i.e.@: with
9202 @option{-fschedule-insns2} or at @option{-O2} or higher.
9203
9204 @item -fsched-group-heuristic
9205 @opindex fsched-group-heuristic
9206 Enable the group heuristic in the scheduler. This heuristic favors
9207 the instruction that belongs to a schedule group. This is enabled
9208 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9209 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9210
9211 @item -fsched-critical-path-heuristic
9212 @opindex fsched-critical-path-heuristic
9213 Enable the critical-path heuristic in the scheduler. This heuristic favors
9214 instructions on the critical path. This is enabled by default when
9215 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9216 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9217
9218 @item -fsched-spec-insn-heuristic
9219 @opindex fsched-spec-insn-heuristic
9220 Enable the speculative instruction heuristic in the scheduler. This
9221 heuristic favors speculative instructions with greater dependency weakness.
9222 This is enabled by default when scheduling is enabled, i.e.@:
9223 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9224 or at @option{-O2} or higher.
9225
9226 @item -fsched-rank-heuristic
9227 @opindex fsched-rank-heuristic
9228 Enable the rank heuristic in the scheduler. This heuristic favors
9229 the instruction belonging to a basic block with greater size or frequency.
9230 This is enabled by default when scheduling is enabled, i.e.@:
9231 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9232 at @option{-O2} or higher.
9233
9234 @item -fsched-last-insn-heuristic
9235 @opindex fsched-last-insn-heuristic
9236 Enable the last-instruction heuristic in the scheduler. This heuristic
9237 favors the instruction that is less dependent on the last instruction
9238 scheduled. This is enabled by default when scheduling is enabled,
9239 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9240 at @option{-O2} or higher.
9241
9242 @item -fsched-dep-count-heuristic
9243 @opindex fsched-dep-count-heuristic
9244 Enable the dependent-count heuristic in the scheduler. This heuristic
9245 favors the instruction that has more instructions depending on it.
9246 This is enabled by default when scheduling is enabled, i.e.@:
9247 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9248 at @option{-O2} or higher.
9249
9250 @item -freschedule-modulo-scheduled-loops
9251 @opindex freschedule-modulo-scheduled-loops
9252 Modulo scheduling is performed before traditional scheduling. If a loop
9253 is modulo scheduled, later scheduling passes may change its schedule.
9254 Use this option to control that behavior.
9255
9256 @item -fselective-scheduling
9257 @opindex fselective-scheduling
9258 Schedule instructions using selective scheduling algorithm. Selective
9259 scheduling runs instead of the first scheduler pass.
9260
9261 @item -fselective-scheduling2
9262 @opindex fselective-scheduling2
9263 Schedule instructions using selective scheduling algorithm. Selective
9264 scheduling runs instead of the second scheduler pass.
9265
9266 @item -fsel-sched-pipelining
9267 @opindex fsel-sched-pipelining
9268 Enable software pipelining of innermost loops during selective scheduling.
9269 This option has no effect unless one of @option{-fselective-scheduling} or
9270 @option{-fselective-scheduling2} is turned on.
9271
9272 @item -fsel-sched-pipelining-outer-loops
9273 @opindex fsel-sched-pipelining-outer-loops
9274 When pipelining loops during selective scheduling, also pipeline outer loops.
9275 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9276
9277 @item -fsemantic-interposition
9278 @opindex fsemantic-interposition
9279 Some object formats, like ELF, allow interposing of symbols by the
9280 dynamic linker.
9281 This means that for symbols exported from the DSO, the compiler cannot perform
9282 interprocedural propagation, inlining and other optimizations in anticipation
9283 that the function or variable in question may change. While this feature is
9284 useful, for example, to rewrite memory allocation functions by a debugging
9285 implementation, it is expensive in the terms of code quality.
9286 With @option{-fno-semantic-interposition} the compiler assumes that
9287 if interposition happens for functions the overwriting function will have
9288 precisely the same semantics (and side effects).
9289 Similarly if interposition happens
9290 for variables, the constructor of the variable will be the same. The flag
9291 has no effect for functions explicitly declared inline
9292 (where it is never allowed for interposition to change semantics)
9293 and for symbols explicitly declared weak.
9294
9295 @item -fshrink-wrap
9296 @opindex fshrink-wrap
9297 Emit function prologues only before parts of the function that need it,
9298 rather than at the top of the function. This flag is enabled by default at
9299 @option{-O} and higher.
9300
9301 @item -fshrink-wrap-separate
9302 @opindex fshrink-wrap-separate
9303 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9304 those parts are only executed when needed.
9305 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9306 is also turned on and the target supports this.
9307
9308 @item -fcaller-saves
9309 @opindex fcaller-saves
9310 Enable allocation of values to registers that are clobbered by
9311 function calls, by emitting extra instructions to save and restore the
9312 registers around such calls. Such allocation is done only when it
9313 seems to result in better code.
9314
9315 This option is always enabled by default on certain machines, usually
9316 those which have no call-preserved registers to use instead.
9317
9318 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9319
9320 @item -fcombine-stack-adjustments
9321 @opindex fcombine-stack-adjustments
9322 Tracks stack adjustments (pushes and pops) and stack memory references
9323 and then tries to find ways to combine them.
9324
9325 Enabled by default at @option{-O1} and higher.
9326
9327 @item -fipa-ra
9328 @opindex fipa-ra
9329 Use caller save registers for allocation if those registers are not used by
9330 any called function. In that case it is not necessary to save and restore
9331 them around calls. This is only possible if called functions are part of
9332 same compilation unit as current function and they are compiled before it.
9333
9334 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9335 is disabled if generated code will be instrumented for profiling
9336 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9337 exactly (this happens on targets that do not expose prologues
9338 and epilogues in RTL).
9339
9340 @item -fconserve-stack
9341 @opindex fconserve-stack
9342 Attempt to minimize stack usage. The compiler attempts to use less
9343 stack space, even if that makes the program slower. This option
9344 implies setting the @option{large-stack-frame} parameter to 100
9345 and the @option{large-stack-frame-growth} parameter to 400.
9346
9347 @item -ftree-reassoc
9348 @opindex ftree-reassoc
9349 Perform reassociation on trees. This flag is enabled by default
9350 at @option{-O} and higher.
9351
9352 @item -fcode-hoisting
9353 @opindex fcode-hoisting
9354 Perform code hoisting. Code hoisting tries to move the
9355 evaluation of expressions executed on all paths to the function exit
9356 as early as possible. This is especially useful as a code size
9357 optimization, but it often helps for code speed as well.
9358 This flag is enabled by default at @option{-O2} and higher.
9359
9360 @item -ftree-pre
9361 @opindex ftree-pre
9362 Perform partial redundancy elimination (PRE) on trees. This flag is
9363 enabled by default at @option{-O2} and @option{-O3}.
9364
9365 @item -ftree-partial-pre
9366 @opindex ftree-partial-pre
9367 Make partial redundancy elimination (PRE) more aggressive. This flag is
9368 enabled by default at @option{-O3}.
9369
9370 @item -ftree-forwprop
9371 @opindex ftree-forwprop
9372 Perform forward propagation on trees. This flag is enabled by default
9373 at @option{-O} and higher.
9374
9375 @item -ftree-fre
9376 @opindex ftree-fre
9377 Perform full redundancy elimination (FRE) on trees. The difference
9378 between FRE and PRE is that FRE only considers expressions
9379 that are computed on all paths leading to the redundant computation.
9380 This analysis is faster than PRE, though it exposes fewer redundancies.
9381 This flag is enabled by default at @option{-O} and higher.
9382
9383 @item -ftree-phiprop
9384 @opindex ftree-phiprop
9385 Perform hoisting of loads from conditional pointers on trees. This
9386 pass is enabled by default at @option{-O} and higher.
9387
9388 @item -fhoist-adjacent-loads
9389 @opindex fhoist-adjacent-loads
9390 Speculatively hoist loads from both branches of an if-then-else if the
9391 loads are from adjacent locations in the same structure and the target
9392 architecture has a conditional move instruction. This flag is enabled
9393 by default at @option{-O2} and higher.
9394
9395 @item -ftree-copy-prop
9396 @opindex ftree-copy-prop
9397 Perform copy propagation on trees. This pass eliminates unnecessary
9398 copy operations. This flag is enabled by default at @option{-O} and
9399 higher.
9400
9401 @item -fipa-pure-const
9402 @opindex fipa-pure-const
9403 Discover which functions are pure or constant.
9404 Enabled by default at @option{-O} and higher.
9405
9406 @item -fipa-reference
9407 @opindex fipa-reference
9408 Discover which static variables do not escape the
9409 compilation unit.
9410 Enabled by default at @option{-O} and higher.
9411
9412 @item -fipa-reference-addressable
9413 @opindex fipa-reference-addressable
9414 Discover read-only, write-only and non-addressable static variables.
9415 Enabled by default at @option{-O} and higher.
9416
9417 @item -fipa-stack-alignment
9418 @opindex fipa-stack-alignment
9419 Reduce stack alignment on call sites if possible.
9420 Enabled by default.
9421
9422 @item -fipa-pta
9423 @opindex fipa-pta
9424 Perform interprocedural pointer analysis and interprocedural modification
9425 and reference analysis. This option can cause excessive memory and
9426 compile-time usage on large compilation units. It is not enabled by
9427 default at any optimization level.
9428
9429 @item -fipa-profile
9430 @opindex fipa-profile
9431 Perform interprocedural profile propagation. The functions called only from
9432 cold functions are marked as cold. Also functions executed once (such as
9433 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9434 functions and loop less parts of functions executed once are then optimized for
9435 size.
9436 Enabled by default at @option{-O} and higher.
9437
9438 @item -fipa-cp
9439 @opindex fipa-cp
9440 Perform interprocedural constant propagation.
9441 This optimization analyzes the program to determine when values passed
9442 to functions are constants and then optimizes accordingly.
9443 This optimization can substantially increase performance
9444 if the application has constants passed to functions.
9445 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9446 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9447
9448 @item -fipa-cp-clone
9449 @opindex fipa-cp-clone
9450 Perform function cloning to make interprocedural constant propagation stronger.
9451 When enabled, interprocedural constant propagation performs function cloning
9452 when externally visible function can be called with constant arguments.
9453 Because this optimization can create multiple copies of functions,
9454 it may significantly increase code size
9455 (see @option{--param ipcp-unit-growth=@var{value}}).
9456 This flag is enabled by default at @option{-O3}.
9457 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9458
9459 @item -fipa-bit-cp
9460 @opindex fipa-bit-cp
9461 When enabled, perform interprocedural bitwise constant
9462 propagation. This flag is enabled by default at @option{-O2} and
9463 by @option{-fprofile-use} and @option{-fauto-profile}.
9464 It requires that @option{-fipa-cp} is enabled.
9465
9466 @item -fipa-vrp
9467 @opindex fipa-vrp
9468 When enabled, perform interprocedural propagation of value
9469 ranges. This flag is enabled by default at @option{-O2}. It requires
9470 that @option{-fipa-cp} is enabled.
9471
9472 @item -fipa-icf
9473 @opindex fipa-icf
9474 Perform Identical Code Folding for functions and read-only variables.
9475 The optimization reduces code size and may disturb unwind stacks by replacing
9476 a function by equivalent one with a different name. The optimization works
9477 more effectively with link-time optimization enabled.
9478
9479 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9480 works on different levels and thus the optimizations are not same - there are
9481 equivalences that are found only by GCC and equivalences found only by Gold.
9482
9483 This flag is enabled by default at @option{-O2} and @option{-Os}.
9484
9485 @item -flive-patching=@var{level}
9486 @opindex flive-patching
9487 Control GCC's optimizations to produce output suitable for live-patching.
9488
9489 If the compiler's optimization uses a function's body or information extracted
9490 from its body to optimize/change another function, the latter is called an
9491 impacted function of the former. If a function is patched, its impacted
9492 functions should be patched too.
9493
9494 The impacted functions are determined by the compiler's interprocedural
9495 optimizations. For example, a caller is impacted when inlining a function
9496 into its caller,
9497 cloning a function and changing its caller to call this new clone,
9498 or extracting a function's pureness/constness information to optimize
9499 its direct or indirect callers, etc.
9500
9501 Usually, the more IPA optimizations enabled, the larger the number of
9502 impacted functions for each function. In order to control the number of
9503 impacted functions and more easily compute the list of impacted function,
9504 IPA optimizations can be partially enabled at two different levels.
9505
9506 The @var{level} argument should be one of the following:
9507
9508 @table @samp
9509
9510 @item inline-clone
9511
9512 Only enable inlining and cloning optimizations, which includes inlining,
9513 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9514 As a result, when patching a function, all its callers and its clones'
9515 callers are impacted, therefore need to be patched as well.
9516
9517 @option{-flive-patching=inline-clone} disables the following optimization flags:
9518 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9519 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9520 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9521 -fipa-stack-alignment}
9522
9523 @item inline-only-static
9524
9525 Only enable inlining of static functions.
9526 As a result, when patching a static function, all its callers are impacted
9527 and so need to be patched as well.
9528
9529 In addition to all the flags that @option{-flive-patching=inline-clone}
9530 disables,
9531 @option{-flive-patching=inline-only-static} disables the following additional
9532 optimization flags:
9533 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9534
9535 @end table
9536
9537 When @option{-flive-patching} is specified without any value, the default value
9538 is @var{inline-clone}.
9539
9540 This flag is disabled by default.
9541
9542 Note that @option{-flive-patching} is not supported with link-time optimization
9543 (@option{-flto}).
9544
9545 @item -fisolate-erroneous-paths-dereference
9546 @opindex fisolate-erroneous-paths-dereference
9547 Detect paths that trigger erroneous or undefined behavior due to
9548 dereferencing a null pointer. Isolate those paths from the main control
9549 flow and turn the statement with erroneous or undefined behavior into a trap.
9550 This flag is enabled by default at @option{-O2} and higher and depends on
9551 @option{-fdelete-null-pointer-checks} also being enabled.
9552
9553 @item -fisolate-erroneous-paths-attribute
9554 @opindex fisolate-erroneous-paths-attribute
9555 Detect paths that trigger erroneous or undefined behavior due to a null value
9556 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9557 attribute. Isolate those paths from the main control flow and turn the
9558 statement with erroneous or undefined behavior into a trap. This is not
9559 currently enabled, but may be enabled by @option{-O2} in the future.
9560
9561 @item -ftree-sink
9562 @opindex ftree-sink
9563 Perform forward store motion on trees. This flag is
9564 enabled by default at @option{-O} and higher.
9565
9566 @item -ftree-bit-ccp
9567 @opindex ftree-bit-ccp
9568 Perform sparse conditional bit constant propagation on trees and propagate
9569 pointer alignment information.
9570 This pass only operates on local scalar variables and is enabled by default
9571 at @option{-O1} and higher, except for @option{-Og}.
9572 It requires that @option{-ftree-ccp} is enabled.
9573
9574 @item -ftree-ccp
9575 @opindex ftree-ccp
9576 Perform sparse conditional constant propagation (CCP) on trees. This
9577 pass only operates on local scalar variables and is enabled by default
9578 at @option{-O} and higher.
9579
9580 @item -fssa-backprop
9581 @opindex fssa-backprop
9582 Propagate information about uses of a value up the definition chain
9583 in order to simplify the definitions. For example, this pass strips
9584 sign operations if the sign of a value never matters. The flag is
9585 enabled by default at @option{-O} and higher.
9586
9587 @item -fssa-phiopt
9588 @opindex fssa-phiopt
9589 Perform pattern matching on SSA PHI nodes to optimize conditional
9590 code. This pass is enabled by default at @option{-O1} and higher,
9591 except for @option{-Og}.
9592
9593 @item -ftree-switch-conversion
9594 @opindex ftree-switch-conversion
9595 Perform conversion of simple initializations in a switch to
9596 initializations from a scalar array. This flag is enabled by default
9597 at @option{-O2} and higher.
9598
9599 @item -ftree-tail-merge
9600 @opindex ftree-tail-merge
9601 Look for identical code sequences. When found, replace one with a jump to the
9602 other. This optimization is known as tail merging or cross jumping. This flag
9603 is enabled by default at @option{-O2} and higher. The compilation time
9604 in this pass can
9605 be limited using @option{max-tail-merge-comparisons} parameter and
9606 @option{max-tail-merge-iterations} parameter.
9607
9608 @item -ftree-dce
9609 @opindex ftree-dce
9610 Perform dead code elimination (DCE) on trees. This flag is enabled by
9611 default at @option{-O} and higher.
9612
9613 @item -ftree-builtin-call-dce
9614 @opindex ftree-builtin-call-dce
9615 Perform conditional dead code elimination (DCE) for calls to built-in functions
9616 that may set @code{errno} but are otherwise free of side effects. This flag is
9617 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9618 specified.
9619
9620 @item -ffinite-loops
9621 @opindex ffinite-loops
9622 @opindex fno-finite-loops
9623 Assume that a loop with an exit will eventually take the exit and not loop
9624 indefinitely. This allows the compiler to remove loops that otherwise have
9625 no side-effects, not considering eventual endless looping as such.
9626
9627 This option is enabled by default at @option{-O2}.
9628
9629 @item -ftree-dominator-opts
9630 @opindex ftree-dominator-opts
9631 Perform a variety of simple scalar cleanups (constant/copy
9632 propagation, redundancy elimination, range propagation and expression
9633 simplification) based on a dominator tree traversal. This also
9634 performs jump threading (to reduce jumps to jumps). This flag is
9635 enabled by default at @option{-O} and higher.
9636
9637 @item -ftree-dse
9638 @opindex ftree-dse
9639 Perform dead store elimination (DSE) on trees. A dead store is a store into
9640 a memory location that is later overwritten by another store without
9641 any intervening loads. In this case the earlier store can be deleted. This
9642 flag is enabled by default at @option{-O} and higher.
9643
9644 @item -ftree-ch
9645 @opindex ftree-ch
9646 Perform loop header copying on trees. This is beneficial since it increases
9647 effectiveness of code motion optimizations. It also saves one jump. This flag
9648 is enabled by default at @option{-O} and higher. It is not enabled
9649 for @option{-Os}, since it usually increases code size.
9650
9651 @item -ftree-loop-optimize
9652 @opindex ftree-loop-optimize
9653 Perform loop optimizations on trees. This flag is enabled by default
9654 at @option{-O} and higher.
9655
9656 @item -ftree-loop-linear
9657 @itemx -floop-strip-mine
9658 @itemx -floop-block
9659 @opindex ftree-loop-linear
9660 @opindex floop-strip-mine
9661 @opindex floop-block
9662 Perform loop nest optimizations. Same as
9663 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9664 to be configured with @option{--with-isl} to enable the Graphite loop
9665 transformation infrastructure.
9666
9667 @item -fgraphite-identity
9668 @opindex fgraphite-identity
9669 Enable the identity transformation for graphite. For every SCoP we generate
9670 the polyhedral representation and transform it back to gimple. Using
9671 @option{-fgraphite-identity} we can check the costs or benefits of the
9672 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9673 are also performed by the code generator isl, like index splitting and
9674 dead code elimination in loops.
9675
9676 @item -floop-nest-optimize
9677 @opindex floop-nest-optimize
9678 Enable the isl based loop nest optimizer. This is a generic loop nest
9679 optimizer based on the Pluto optimization algorithms. It calculates a loop
9680 structure optimized for data-locality and parallelism. This option
9681 is experimental.
9682
9683 @item -floop-parallelize-all
9684 @opindex floop-parallelize-all
9685 Use the Graphite data dependence analysis to identify loops that can
9686 be parallelized. Parallelize all the loops that can be analyzed to
9687 not contain loop carried dependences without checking that it is
9688 profitable to parallelize the loops.
9689
9690 @item -ftree-coalesce-vars
9691 @opindex ftree-coalesce-vars
9692 While transforming the program out of the SSA representation, attempt to
9693 reduce copying by coalescing versions of different user-defined
9694 variables, instead of just compiler temporaries. This may severely
9695 limit the ability to debug an optimized program compiled with
9696 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9697 prevents SSA coalescing of user variables. This option is enabled by
9698 default if optimization is enabled, and it does very little otherwise.
9699
9700 @item -ftree-loop-if-convert
9701 @opindex ftree-loop-if-convert
9702 Attempt to transform conditional jumps in the innermost loops to
9703 branch-less equivalents. The intent is to remove control-flow from
9704 the innermost loops in order to improve the ability of the
9705 vectorization pass to handle these loops. This is enabled by default
9706 if vectorization is enabled.
9707
9708 @item -ftree-loop-distribution
9709 @opindex ftree-loop-distribution
9710 Perform loop distribution. This flag can improve cache performance on
9711 big loop bodies and allow further loop optimizations, like
9712 parallelization or vectorization, to take place. For example, the loop
9713 @smallexample
9714 DO I = 1, N
9715 A(I) = B(I) + C
9716 D(I) = E(I) * F
9717 ENDDO
9718 @end smallexample
9719 is transformed to
9720 @smallexample
9721 DO I = 1, N
9722 A(I) = B(I) + C
9723 ENDDO
9724 DO I = 1, N
9725 D(I) = E(I) * F
9726 ENDDO
9727 @end smallexample
9728 This flag is enabled by default at @option{-O3}.
9729 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9730
9731 @item -ftree-loop-distribute-patterns
9732 @opindex ftree-loop-distribute-patterns
9733 Perform loop distribution of patterns that can be code generated with
9734 calls to a library. This flag is enabled by default at @option{-O3}, and
9735 by @option{-fprofile-use} and @option{-fauto-profile}.
9736
9737 This pass distributes the initialization loops and generates a call to
9738 memset zero. For example, the loop
9739 @smallexample
9740 DO I = 1, N
9741 A(I) = 0
9742 B(I) = A(I) + I
9743 ENDDO
9744 @end smallexample
9745 is transformed to
9746 @smallexample
9747 DO I = 1, N
9748 A(I) = 0
9749 ENDDO
9750 DO I = 1, N
9751 B(I) = A(I) + I
9752 ENDDO
9753 @end smallexample
9754 and the initialization loop is transformed into a call to memset zero.
9755 This flag is enabled by default at @option{-O3}.
9756 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9757
9758 @item -floop-interchange
9759 @opindex floop-interchange
9760 Perform loop interchange outside of graphite. This flag can improve cache
9761 performance on loop nest and allow further loop optimizations, like
9762 vectorization, to take place. For example, the loop
9763 @smallexample
9764 for (int i = 0; i < N; i++)
9765 for (int j = 0; j < N; j++)
9766 for (int k = 0; k < N; k++)
9767 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9768 @end smallexample
9769 is transformed to
9770 @smallexample
9771 for (int i = 0; i < N; i++)
9772 for (int k = 0; k < N; k++)
9773 for (int j = 0; j < N; j++)
9774 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9775 @end smallexample
9776 This flag is enabled by default at @option{-O3}.
9777 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9778
9779 @item -floop-unroll-and-jam
9780 @opindex floop-unroll-and-jam
9781 Apply unroll and jam transformations on feasible loops. In a loop
9782 nest this unrolls the outer loop by some factor and fuses the resulting
9783 multiple inner loops. This flag is enabled by default at @option{-O3}.
9784 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9785
9786 @item -ftree-loop-im
9787 @opindex ftree-loop-im
9788 Perform loop invariant motion on trees. This pass moves only invariants that
9789 are hard to handle at RTL level (function calls, operations that expand to
9790 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9791 operands of conditions that are invariant out of the loop, so that we can use
9792 just trivial invariantness analysis in loop unswitching. The pass also includes
9793 store motion.
9794
9795 @item -ftree-loop-ivcanon
9796 @opindex ftree-loop-ivcanon
9797 Create a canonical counter for number of iterations in loops for which
9798 determining number of iterations requires complicated analysis. Later
9799 optimizations then may determine the number easily. Useful especially
9800 in connection with unrolling.
9801
9802 @item -ftree-scev-cprop
9803 @opindex ftree-scev-cprop
9804 Perform final value replacement. If a variable is modified in a loop
9805 in such a way that its value when exiting the loop can be determined using
9806 only its initial value and the number of loop iterations, replace uses of
9807 the final value by such a computation, provided it is sufficiently cheap.
9808 This reduces data dependencies and may allow further simplifications.
9809 Enabled by default at @option{-O} and higher.
9810
9811 @item -fivopts
9812 @opindex fivopts
9813 Perform induction variable optimizations (strength reduction, induction
9814 variable merging and induction variable elimination) on trees.
9815
9816 @item -ftree-parallelize-loops=n
9817 @opindex ftree-parallelize-loops
9818 Parallelize loops, i.e., split their iteration space to run in n threads.
9819 This is only possible for loops whose iterations are independent
9820 and can be arbitrarily reordered. The optimization is only
9821 profitable on multiprocessor machines, for loops that are CPU-intensive,
9822 rather than constrained e.g.@: by memory bandwidth. This option
9823 implies @option{-pthread}, and thus is only supported on targets
9824 that have support for @option{-pthread}.
9825
9826 @item -ftree-pta
9827 @opindex ftree-pta
9828 Perform function-local points-to analysis on trees. This flag is
9829 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9830
9831 @item -ftree-sra
9832 @opindex ftree-sra
9833 Perform scalar replacement of aggregates. This pass replaces structure
9834 references with scalars to prevent committing structures to memory too
9835 early. This flag is enabled by default at @option{-O1} and higher,
9836 except for @option{-Og}.
9837
9838 @item -fstore-merging
9839 @opindex fstore-merging
9840 Perform merging of narrow stores to consecutive memory addresses. This pass
9841 merges contiguous stores of immediate values narrower than a word into fewer
9842 wider stores to reduce the number of instructions. This is enabled by default
9843 at @option{-O2} and higher as well as @option{-Os}.
9844
9845 @item -ftree-ter
9846 @opindex ftree-ter
9847 Perform temporary expression replacement during the SSA->normal phase. Single
9848 use/single def temporaries are replaced at their use location with their
9849 defining expression. This results in non-GIMPLE code, but gives the expanders
9850 much more complex trees to work on resulting in better RTL generation. This is
9851 enabled by default at @option{-O} and higher.
9852
9853 @item -ftree-slsr
9854 @opindex ftree-slsr
9855 Perform straight-line strength reduction on trees. This recognizes related
9856 expressions involving multiplications and replaces them by less expensive
9857 calculations when possible. This is enabled by default at @option{-O} and
9858 higher.
9859
9860 @item -ftree-vectorize
9861 @opindex ftree-vectorize
9862 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9863 and @option{-ftree-slp-vectorize} if not explicitly specified.
9864
9865 @item -ftree-loop-vectorize
9866 @opindex ftree-loop-vectorize
9867 Perform loop vectorization on trees. This flag is enabled by default at
9868 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9869 and @option{-fauto-profile}.
9870
9871 @item -ftree-slp-vectorize
9872 @opindex ftree-slp-vectorize
9873 Perform basic block vectorization on trees. This flag is enabled by default at
9874 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9875 and @option{-fauto-profile}.
9876
9877 @item -fvect-cost-model=@var{model}
9878 @opindex fvect-cost-model
9879 Alter the cost model used for vectorization. The @var{model} argument
9880 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9881 With the @samp{unlimited} model the vectorized code-path is assumed
9882 to be profitable while with the @samp{dynamic} model a runtime check
9883 guards the vectorized code-path to enable it only for iteration
9884 counts that will likely execute faster than when executing the original
9885 scalar loop. The @samp{cheap} model disables vectorization of
9886 loops where doing so would be cost prohibitive for example due to
9887 required runtime checks for data dependence or alignment but otherwise
9888 is equal to the @samp{dynamic} model.
9889 The default cost model depends on other optimization flags and is
9890 either @samp{dynamic} or @samp{cheap}.
9891
9892 @item -fsimd-cost-model=@var{model}
9893 @opindex fsimd-cost-model
9894 Alter the cost model used for vectorization of loops marked with the OpenMP
9895 simd directive. The @var{model} argument should be one of
9896 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9897 have the same meaning as described in @option{-fvect-cost-model} and by
9898 default a cost model defined with @option{-fvect-cost-model} is used.
9899
9900 @item -ftree-vrp
9901 @opindex ftree-vrp
9902 Perform Value Range Propagation on trees. This is similar to the
9903 constant propagation pass, but instead of values, ranges of values are
9904 propagated. This allows the optimizers to remove unnecessary range
9905 checks like array bound checks and null pointer checks. This is
9906 enabled by default at @option{-O2} and higher. Null pointer check
9907 elimination is only done if @option{-fdelete-null-pointer-checks} is
9908 enabled.
9909
9910 @item -fsplit-paths
9911 @opindex fsplit-paths
9912 Split paths leading to loop backedges. This can improve dead code
9913 elimination and common subexpression elimination. This is enabled by
9914 default at @option{-O3} and above.
9915
9916 @item -fsplit-ivs-in-unroller
9917 @opindex fsplit-ivs-in-unroller
9918 Enables expression of values of induction variables in later iterations
9919 of the unrolled loop using the value in the first iteration. This breaks
9920 long dependency chains, thus improving efficiency of the scheduling passes.
9921
9922 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9923 same effect. However, that is not reliable in cases where the loop body
9924 is more complicated than a single basic block. It also does not work at all
9925 on some architectures due to restrictions in the CSE pass.
9926
9927 This optimization is enabled by default.
9928
9929 @item -fvariable-expansion-in-unroller
9930 @opindex fvariable-expansion-in-unroller
9931 With this option, the compiler creates multiple copies of some
9932 local variables when unrolling a loop, which can result in superior code.
9933
9934 This optimization is enabled by default for PowerPC targets, but disabled
9935 by default otherwise.
9936
9937 @item -fpartial-inlining
9938 @opindex fpartial-inlining
9939 Inline parts of functions. This option has any effect only
9940 when inlining itself is turned on by the @option{-finline-functions}
9941 or @option{-finline-small-functions} options.
9942
9943 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9944
9945 @item -fpredictive-commoning
9946 @opindex fpredictive-commoning
9947 Perform predictive commoning optimization, i.e., reusing computations
9948 (especially memory loads and stores) performed in previous
9949 iterations of loops.
9950
9951 This option is enabled at level @option{-O3}.
9952 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9953
9954 @item -fprefetch-loop-arrays
9955 @opindex fprefetch-loop-arrays
9956 If supported by the target machine, generate instructions to prefetch
9957 memory to improve the performance of loops that access large arrays.
9958
9959 This option may generate better or worse code; results are highly
9960 dependent on the structure of loops within the source code.
9961
9962 Disabled at level @option{-Os}.
9963
9964 @item -fno-printf-return-value
9965 @opindex fno-printf-return-value
9966 @opindex fprintf-return-value
9967 Do not substitute constants for known return value of formatted output
9968 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9969 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9970 transformation allows GCC to optimize or even eliminate branches based
9971 on the known return value of these functions called with arguments that
9972 are either constant, or whose values are known to be in a range that
9973 makes determining the exact return value possible. For example, when
9974 @option{-fprintf-return-value} is in effect, both the branch and the
9975 body of the @code{if} statement (but not the call to @code{snprint})
9976 can be optimized away when @code{i} is a 32-bit or smaller integer
9977 because the return value is guaranteed to be at most 8.
9978
9979 @smallexample
9980 char buf[9];
9981 if (snprintf (buf, "%08x", i) >= sizeof buf)
9982 @dots{}
9983 @end smallexample
9984
9985 The @option{-fprintf-return-value} option relies on other optimizations
9986 and yields best results with @option{-O2} and above. It works in tandem
9987 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9988 options. The @option{-fprintf-return-value} option is enabled by default.
9989
9990 @item -fno-peephole
9991 @itemx -fno-peephole2
9992 @opindex fno-peephole
9993 @opindex fpeephole
9994 @opindex fno-peephole2
9995 @opindex fpeephole2
9996 Disable any machine-specific peephole optimizations. The difference
9997 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9998 are implemented in the compiler; some targets use one, some use the
9999 other, a few use both.
10000
10001 @option{-fpeephole} is enabled by default.
10002 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10003
10004 @item -fno-guess-branch-probability
10005 @opindex fno-guess-branch-probability
10006 @opindex fguess-branch-probability
10007 Do not guess branch probabilities using heuristics.
10008
10009 GCC uses heuristics to guess branch probabilities if they are
10010 not provided by profiling feedback (@option{-fprofile-arcs}). These
10011 heuristics are based on the control flow graph. If some branch probabilities
10012 are specified by @code{__builtin_expect}, then the heuristics are
10013 used to guess branch probabilities for the rest of the control flow graph,
10014 taking the @code{__builtin_expect} info into account. The interactions
10015 between the heuristics and @code{__builtin_expect} can be complex, and in
10016 some cases, it may be useful to disable the heuristics so that the effects
10017 of @code{__builtin_expect} are easier to understand.
10018
10019 It is also possible to specify expected probability of the expression
10020 with @code{__builtin_expect_with_probability} built-in function.
10021
10022 The default is @option{-fguess-branch-probability} at levels
10023 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10024
10025 @item -freorder-blocks
10026 @opindex freorder-blocks
10027 Reorder basic blocks in the compiled function in order to reduce number of
10028 taken branches and improve code locality.
10029
10030 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10031
10032 @item -freorder-blocks-algorithm=@var{algorithm}
10033 @opindex freorder-blocks-algorithm
10034 Use the specified algorithm for basic block reordering. The
10035 @var{algorithm} argument can be @samp{simple}, which does not increase
10036 code size (except sometimes due to secondary effects like alignment),
10037 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
10038 put all often executed code together, minimizing the number of branches
10039 executed by making extra copies of code.
10040
10041 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
10042 @samp{stc} at levels @option{-O2}, @option{-O3}.
10043
10044 @item -freorder-blocks-and-partition
10045 @opindex freorder-blocks-and-partition
10046 In addition to reordering basic blocks in the compiled function, in order
10047 to reduce number of taken branches, partitions hot and cold basic blocks
10048 into separate sections of the assembly and @file{.o} files, to improve
10049 paging and cache locality performance.
10050
10051 This optimization is automatically turned off in the presence of
10052 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10053 section attribute and on any architecture that does not support named
10054 sections. When @option{-fsplit-stack} is used this option is not
10055 enabled by default (to avoid linker errors), but may be enabled
10056 explicitly (if using a working linker).
10057
10058 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10059
10060 @item -freorder-functions
10061 @opindex freorder-functions
10062 Reorder functions in the object file in order to
10063 improve code locality. This is implemented by using special
10064 subsections @code{.text.hot} for most frequently executed functions and
10065 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10066 the linker so object file format must support named sections and linker must
10067 place them in a reasonable way.
10068
10069 This option isn't effective unless you either provide profile feedback
10070 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10071 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10072
10073 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10074
10075 @item -fstrict-aliasing
10076 @opindex fstrict-aliasing
10077 Allow the compiler to assume the strictest aliasing rules applicable to
10078 the language being compiled. For C (and C++), this activates
10079 optimizations based on the type of expressions. In particular, an
10080 object of one type is assumed never to reside at the same address as an
10081 object of a different type, unless the types are almost the same. For
10082 example, an @code{unsigned int} can alias an @code{int}, but not a
10083 @code{void*} or a @code{double}. A character type may alias any other
10084 type.
10085
10086 @anchor{Type-punning}Pay special attention to code like this:
10087 @smallexample
10088 union a_union @{
10089 int i;
10090 double d;
10091 @};
10092
10093 int f() @{
10094 union a_union t;
10095 t.d = 3.0;
10096 return t.i;
10097 @}
10098 @end smallexample
10099 The practice of reading from a different union member than the one most
10100 recently written to (called ``type-punning'') is common. Even with
10101 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10102 is accessed through the union type. So, the code above works as
10103 expected. @xref{Structures unions enumerations and bit-fields
10104 implementation}. However, this code might not:
10105 @smallexample
10106 int f() @{
10107 union a_union t;
10108 int* ip;
10109 t.d = 3.0;
10110 ip = &t.i;
10111 return *ip;
10112 @}
10113 @end smallexample
10114
10115 Similarly, access by taking the address, casting the resulting pointer
10116 and dereferencing the result has undefined behavior, even if the cast
10117 uses a union type, e.g.:
10118 @smallexample
10119 int f() @{
10120 double d = 3.0;
10121 return ((union a_union *) &d)->i;
10122 @}
10123 @end smallexample
10124
10125 The @option{-fstrict-aliasing} option is enabled at levels
10126 @option{-O2}, @option{-O3}, @option{-Os}.
10127
10128 @item -falign-functions
10129 @itemx -falign-functions=@var{n}
10130 @itemx -falign-functions=@var{n}:@var{m}
10131 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10132 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10133 @opindex falign-functions
10134 Align the start of functions to the next power-of-two greater than
10135 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10136 the first @var{m} bytes of the function can be fetched by the CPU
10137 without crossing an @var{n}-byte alignment boundary.
10138
10139 If @var{m} is not specified, it defaults to @var{n}.
10140
10141 Examples: @option{-falign-functions=32} aligns functions to the next
10142 32-byte boundary, @option{-falign-functions=24} aligns to the next
10143 32-byte boundary only if this can be done by skipping 23 bytes or less,
10144 @option{-falign-functions=32:7} aligns to the next
10145 32-byte boundary only if this can be done by skipping 6 bytes or less.
10146
10147 The second pair of @var{n2}:@var{m2} values allows you to specify
10148 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10149 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10150 otherwise aligns to the next 32-byte boundary if this can be done
10151 by skipping 2 bytes or less.
10152 If @var{m2} is not specified, it defaults to @var{n2}.
10153
10154 Some assemblers only support this flag when @var{n} is a power of two;
10155 in that case, it is rounded up.
10156
10157 @option{-fno-align-functions} and @option{-falign-functions=1} are
10158 equivalent and mean that functions are not aligned.
10159
10160 If @var{n} is not specified or is zero, use a machine-dependent default.
10161 The maximum allowed @var{n} option value is 65536.
10162
10163 Enabled at levels @option{-O2}, @option{-O3}.
10164
10165 @item -flimit-function-alignment
10166 If this option is enabled, the compiler tries to avoid unnecessarily
10167 overaligning functions. It attempts to instruct the assembler to align
10168 by the amount specified by @option{-falign-functions}, but not to
10169 skip more bytes than the size of the function.
10170
10171 @item -falign-labels
10172 @itemx -falign-labels=@var{n}
10173 @itemx -falign-labels=@var{n}:@var{m}
10174 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10175 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10176 @opindex falign-labels
10177 Align all branch targets to a power-of-two boundary.
10178
10179 Parameters of this option are analogous to the @option{-falign-functions} option.
10180 @option{-fno-align-labels} and @option{-falign-labels=1} are
10181 equivalent and mean that labels are not aligned.
10182
10183 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10184 are greater than this value, then their values are used instead.
10185
10186 If @var{n} is not specified or is zero, use a machine-dependent default
10187 which is very likely to be @samp{1}, meaning no alignment.
10188 The maximum allowed @var{n} option value is 65536.
10189
10190 Enabled at levels @option{-O2}, @option{-O3}.
10191
10192 @item -falign-loops
10193 @itemx -falign-loops=@var{n}
10194 @itemx -falign-loops=@var{n}:@var{m}
10195 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10196 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10197 @opindex falign-loops
10198 Align loops to a power-of-two boundary. If the loops are executed
10199 many times, this makes up for any execution of the dummy padding
10200 instructions.
10201
10202 Parameters of this option are analogous to the @option{-falign-functions} option.
10203 @option{-fno-align-loops} and @option{-falign-loops=1} are
10204 equivalent and mean that loops are not aligned.
10205 The maximum allowed @var{n} option value is 65536.
10206
10207 If @var{n} is not specified or is zero, use a machine-dependent default.
10208
10209 Enabled at levels @option{-O2}, @option{-O3}.
10210
10211 @item -falign-jumps
10212 @itemx -falign-jumps=@var{n}
10213 @itemx -falign-jumps=@var{n}:@var{m}
10214 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10215 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10216 @opindex falign-jumps
10217 Align branch targets to a power-of-two boundary, for branch targets
10218 where the targets can only be reached by jumping. In this case,
10219 no dummy operations need be executed.
10220
10221 Parameters of this option are analogous to the @option{-falign-functions} option.
10222 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10223 equivalent and mean that loops are not aligned.
10224
10225 If @var{n} is not specified or is zero, use a machine-dependent default.
10226 The maximum allowed @var{n} option value is 65536.
10227
10228 Enabled at levels @option{-O2}, @option{-O3}.
10229
10230 @item -funit-at-a-time
10231 @opindex funit-at-a-time
10232 This option is left for compatibility reasons. @option{-funit-at-a-time}
10233 has no effect, while @option{-fno-unit-at-a-time} implies
10234 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10235
10236 Enabled by default.
10237
10238 @item -fno-toplevel-reorder
10239 @opindex fno-toplevel-reorder
10240 @opindex ftoplevel-reorder
10241 Do not reorder top-level functions, variables, and @code{asm}
10242 statements. Output them in the same order that they appear in the
10243 input file. When this option is used, unreferenced static variables
10244 are not removed. This option is intended to support existing code
10245 that relies on a particular ordering. For new code, it is better to
10246 use attributes when possible.
10247
10248 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10249 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10250 Additionally @option{-fno-toplevel-reorder} implies
10251 @option{-fno-section-anchors}.
10252
10253 @item -fweb
10254 @opindex fweb
10255 Constructs webs as commonly used for register allocation purposes and assign
10256 each web individual pseudo register. This allows the register allocation pass
10257 to operate on pseudos directly, but also strengthens several other optimization
10258 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10259 however, make debugging impossible, since variables no longer stay in a
10260 ``home register''.
10261
10262 Enabled by default with @option{-funroll-loops}.
10263
10264 @item -fwhole-program
10265 @opindex fwhole-program
10266 Assume that the current compilation unit represents the whole program being
10267 compiled. All public functions and variables with the exception of @code{main}
10268 and those merged by attribute @code{externally_visible} become static functions
10269 and in effect are optimized more aggressively by interprocedural optimizers.
10270
10271 This option should not be used in combination with @option{-flto}.
10272 Instead relying on a linker plugin should provide safer and more precise
10273 information.
10274
10275 @item -flto[=@var{n}]
10276 @opindex flto
10277 This option runs the standard link-time optimizer. When invoked
10278 with source code, it generates GIMPLE (one of GCC's internal
10279 representations) and writes it to special ELF sections in the object
10280 file. When the object files are linked together, all the function
10281 bodies are read from these ELF sections and instantiated as if they
10282 had been part of the same translation unit.
10283
10284 To use the link-time optimizer, @option{-flto} and optimization
10285 options should be specified at compile time and during the final link.
10286 It is recommended that you compile all the files participating in the
10287 same link with the same options and also specify those options at
10288 link time.
10289 For example:
10290
10291 @smallexample
10292 gcc -c -O2 -flto foo.c
10293 gcc -c -O2 -flto bar.c
10294 gcc -o myprog -flto -O2 foo.o bar.o
10295 @end smallexample
10296
10297 The first two invocations to GCC save a bytecode representation
10298 of GIMPLE into special ELF sections inside @file{foo.o} and
10299 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10300 @file{foo.o} and @file{bar.o}, merges the two files into a single
10301 internal image, and compiles the result as usual. Since both
10302 @file{foo.o} and @file{bar.o} are merged into a single image, this
10303 causes all the interprocedural analyses and optimizations in GCC to
10304 work across the two files as if they were a single one. This means,
10305 for example, that the inliner is able to inline functions in
10306 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10307
10308 Another (simpler) way to enable link-time optimization is:
10309
10310 @smallexample
10311 gcc -o myprog -flto -O2 foo.c bar.c
10312 @end smallexample
10313
10314 The above generates bytecode for @file{foo.c} and @file{bar.c},
10315 merges them together into a single GIMPLE representation and optimizes
10316 them as usual to produce @file{myprog}.
10317
10318 The important thing to keep in mind is that to enable link-time
10319 optimizations you need to use the GCC driver to perform the link step.
10320 GCC automatically performs link-time optimization if any of the
10321 objects involved were compiled with the @option{-flto} command-line option.
10322 You can always override
10323 the automatic decision to do link-time optimization
10324 by passing @option{-fno-lto} to the link command.
10325
10326 To make whole program optimization effective, it is necessary to make
10327 certain whole program assumptions. The compiler needs to know
10328 what functions and variables can be accessed by libraries and runtime
10329 outside of the link-time optimized unit. When supported by the linker,
10330 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10331 to the compiler about used and externally visible symbols. When
10332 the linker plugin is not available, @option{-fwhole-program} should be
10333 used to allow the compiler to make these assumptions, which leads
10334 to more aggressive optimization decisions.
10335
10336 When a file is compiled with @option{-flto} without
10337 @option{-fuse-linker-plugin}, the generated object file is larger than
10338 a regular object file because it contains GIMPLE bytecodes and the usual
10339 final code (see @option{-ffat-lto-objects}. This means that
10340 object files with LTO information can be linked as normal object
10341 files; if @option{-fno-lto} is passed to the linker, no
10342 interprocedural optimizations are applied. Note that when
10343 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10344 but you cannot perform a regular, non-LTO link on them.
10345
10346 When producing the final binary, GCC only
10347 applies link-time optimizations to those files that contain bytecode.
10348 Therefore, you can mix and match object files and libraries with
10349 GIMPLE bytecodes and final object code. GCC automatically selects
10350 which files to optimize in LTO mode and which files to link without
10351 further processing.
10352
10353 Generally, options specified at link time override those
10354 specified at compile time, although in some cases GCC attempts to infer
10355 link-time options from the settings used to compile the input files.
10356
10357 If you do not specify an optimization level option @option{-O} at
10358 link time, then GCC uses the highest optimization level
10359 used when compiling the object files. Note that it is generally
10360 ineffective to specify an optimization level option only at link time and
10361 not at compile time, for two reasons. First, compiling without
10362 optimization suppresses compiler passes that gather information
10363 needed for effective optimization at link time. Second, some early
10364 optimization passes can be performed only at compile time and
10365 not at link time.
10366
10367 There are some code generation flags preserved by GCC when
10368 generating bytecodes, as they need to be used during the final link.
10369 Currently, the following options and their settings are taken from
10370 the first object file that explicitly specifies them:
10371 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10372 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10373 and all the @option{-m} target flags.
10374
10375 Certain ABI-changing flags are required to match in all compilation units,
10376 and trying to override this at link time with a conflicting value
10377 is ignored. This includes options such as @option{-freg-struct-return}
10378 and @option{-fpcc-struct-return}.
10379
10380 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10381 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10382 are passed through to the link stage and merged conservatively for
10383 conflicting translation units. Specifically
10384 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10385 precedence; and for example @option{-ffp-contract=off} takes precedence
10386 over @option{-ffp-contract=fast}. You can override them at link time.
10387
10388 To enable debug info generation you need to supply @option{-g} at
10389 compile-time. If any of the input files at link time were built
10390 with debug info generation enabled the link will enable debug info
10391 generation as well. Any elaborate debug info settings
10392 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
10393 at the linker command line and mixing different settings in different
10394 translation units is discouraged.
10395
10396 If LTO encounters objects with C linkage declared with incompatible
10397 types in separate translation units to be linked together (undefined
10398 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10399 issued. The behavior is still undefined at run time. Similar
10400 diagnostics may be raised for other languages.
10401
10402 Another feature of LTO is that it is possible to apply interprocedural
10403 optimizations on files written in different languages:
10404
10405 @smallexample
10406 gcc -c -flto foo.c
10407 g++ -c -flto bar.cc
10408 gfortran -c -flto baz.f90
10409 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10410 @end smallexample
10411
10412 Notice that the final link is done with @command{g++} to get the C++
10413 runtime libraries and @option{-lgfortran} is added to get the Fortran
10414 runtime libraries. In general, when mixing languages in LTO mode, you
10415 should use the same link command options as when mixing languages in a
10416 regular (non-LTO) compilation.
10417
10418 If object files containing GIMPLE bytecode are stored in a library archive, say
10419 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10420 are using a linker with plugin support. To create static libraries suitable
10421 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10422 and @command{ranlib};
10423 to show the symbols of object files with GIMPLE bytecode, use
10424 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10425 and @command{nm} have been compiled with plugin support. At link time, use the
10426 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10427 the LTO optimization process:
10428
10429 @smallexample
10430 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10431 @end smallexample
10432
10433 With the linker plugin enabled, the linker extracts the needed
10434 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10435 to make them part of the aggregated GIMPLE image to be optimized.
10436
10437 If you are not using a linker with plugin support and/or do not
10438 enable the linker plugin, then the objects inside @file{libfoo.a}
10439 are extracted and linked as usual, but they do not participate
10440 in the LTO optimization process. In order to make a static library suitable
10441 for both LTO optimization and usual linkage, compile its object files with
10442 @option{-flto} @option{-ffat-lto-objects}.
10443
10444 Link-time optimizations do not require the presence of the whole program to
10445 operate. If the program does not require any symbols to be exported, it is
10446 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10447 the interprocedural optimizers to use more aggressive assumptions which may
10448 lead to improved optimization opportunities.
10449 Use of @option{-fwhole-program} is not needed when linker plugin is
10450 active (see @option{-fuse-linker-plugin}).
10451
10452 The current implementation of LTO makes no
10453 attempt to generate bytecode that is portable between different
10454 types of hosts. The bytecode files are versioned and there is a
10455 strict version check, so bytecode files generated in one version of
10456 GCC do not work with an older or newer version of GCC.
10457
10458 Link-time optimization does not work well with generation of debugging
10459 information on systems other than those using a combination of ELF and
10460 DWARF.
10461
10462 If you specify the optional @var{n}, the optimization and code
10463 generation done at link time is executed in parallel using @var{n}
10464 parallel jobs by utilizing an installed @command{make} program. The
10465 environment variable @env{MAKE} may be used to override the program
10466 used.
10467
10468 You can also specify @option{-flto=jobserver} to use GNU make's
10469 job server mode to determine the number of parallel jobs. This
10470 is useful when the Makefile calling GCC is already executing in parallel.
10471 You must prepend a @samp{+} to the command recipe in the parent Makefile
10472 for this to work. This option likely only works if @env{MAKE} is
10473 GNU make. Even without the option value, GCC tries to automatically
10474 detect a running GNU make's job server.
10475
10476 Use @option{-flto=auto} to use GNU make's job server, if available,
10477 or otherwise fall back to autodetection of the number of CPU threads
10478 present in your system.
10479
10480 @item -flto-partition=@var{alg}
10481 @opindex flto-partition
10482 Specify the partitioning algorithm used by the link-time optimizer.
10483 The value is either @samp{1to1} to specify a partitioning mirroring
10484 the original source files or @samp{balanced} to specify partitioning
10485 into equally sized chunks (whenever possible) or @samp{max} to create
10486 new partition for every symbol where possible. Specifying @samp{none}
10487 as an algorithm disables partitioning and streaming completely.
10488 The default value is @samp{balanced}. While @samp{1to1} can be used
10489 as an workaround for various code ordering issues, the @samp{max}
10490 partitioning is intended for internal testing only.
10491 The value @samp{one} specifies that exactly one partition should be
10492 used while the value @samp{none} bypasses partitioning and executes
10493 the link-time optimization step directly from the WPA phase.
10494
10495 @item -flto-compression-level=@var{n}
10496 @opindex flto-compression-level
10497 This option specifies the level of compression used for intermediate
10498 language written to LTO object files, and is only meaningful in
10499 conjunction with LTO mode (@option{-flto}). Valid
10500 values are 0 (no compression) to 9 (maximum compression). Values
10501 outside this range are clamped to either 0 or 9. If the option is not
10502 given, a default balanced compression setting is used.
10503
10504 @item -fuse-linker-plugin
10505 @opindex fuse-linker-plugin
10506 Enables the use of a linker plugin during link-time optimization. This
10507 option relies on plugin support in the linker, which is available in gold
10508 or in GNU ld 2.21 or newer.
10509
10510 This option enables the extraction of object files with GIMPLE bytecode out
10511 of library archives. This improves the quality of optimization by exposing
10512 more code to the link-time optimizer. This information specifies what
10513 symbols can be accessed externally (by non-LTO object or during dynamic
10514 linking). Resulting code quality improvements on binaries (and shared
10515 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10516 See @option{-flto} for a description of the effect of this flag and how to
10517 use it.
10518
10519 This option is enabled by default when LTO support in GCC is enabled
10520 and GCC was configured for use with
10521 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10522
10523 @item -ffat-lto-objects
10524 @opindex ffat-lto-objects
10525 Fat LTO objects are object files that contain both the intermediate language
10526 and the object code. This makes them usable for both LTO linking and normal
10527 linking. This option is effective only when compiling with @option{-flto}
10528 and is ignored at link time.
10529
10530 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10531 requires the complete toolchain to be aware of LTO. It requires a linker with
10532 linker plugin support for basic functionality. Additionally,
10533 @command{nm}, @command{ar} and @command{ranlib}
10534 need to support linker plugins to allow a full-featured build environment
10535 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10536 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10537 to these tools. With non fat LTO makefiles need to be modified to use them.
10538
10539 Note that modern binutils provide plugin auto-load mechanism.
10540 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10541 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10542 @command{gcc-ranlib}).
10543
10544 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10545 support.
10546
10547 @item -fcompare-elim
10548 @opindex fcompare-elim
10549 After register allocation and post-register allocation instruction splitting,
10550 identify arithmetic instructions that compute processor flags similar to a
10551 comparison operation based on that arithmetic. If possible, eliminate the
10552 explicit comparison operation.
10553
10554 This pass only applies to certain targets that cannot explicitly represent
10555 the comparison operation before register allocation is complete.
10556
10557 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10558
10559 @item -fcprop-registers
10560 @opindex fcprop-registers
10561 After register allocation and post-register allocation instruction splitting,
10562 perform a copy-propagation pass to try to reduce scheduling dependencies
10563 and occasionally eliminate the copy.
10564
10565 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10566
10567 @item -fprofile-correction
10568 @opindex fprofile-correction
10569 Profiles collected using an instrumented binary for multi-threaded programs may
10570 be inconsistent due to missed counter updates. When this option is specified,
10571 GCC uses heuristics to correct or smooth out such inconsistencies. By
10572 default, GCC emits an error message when an inconsistent profile is detected.
10573
10574 This option is enabled by @option{-fauto-profile}.
10575
10576 @item -fprofile-use
10577 @itemx -fprofile-use=@var{path}
10578 @opindex fprofile-use
10579 Enable profile feedback-directed optimizations,
10580 and the following optimizations, many of which
10581 are generally profitable only with profile feedback available:
10582
10583 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10584 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10585 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10586 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10587 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10588 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10589 -fprofile-reorder-functions}
10590
10591 Before you can use this option, you must first generate profiling information.
10592 @xref{Instrumentation Options}, for information about the
10593 @option{-fprofile-generate} option.
10594
10595 By default, GCC emits an error message if the feedback profiles do not
10596 match the source code. This error can be turned into a warning by using
10597 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10598 optimized code. Additionally, by default, GCC also emits a warning message if
10599 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10600
10601 If @var{path} is specified, GCC looks at the @var{path} to find
10602 the profile feedback data files. See @option{-fprofile-dir}.
10603
10604 @item -fauto-profile
10605 @itemx -fauto-profile=@var{path}
10606 @opindex fauto-profile
10607 Enable sampling-based feedback-directed optimizations,
10608 and the following optimizations,
10609 many of which are generally profitable only with profile feedback available:
10610
10611 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10612 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10613 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10614 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10615 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10616 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10617 -fprofile-correction}
10618
10619 @var{path} is the name of a file containing AutoFDO profile information.
10620 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10621
10622 Producing an AutoFDO profile data file requires running your program
10623 with the @command{perf} utility on a supported GNU/Linux target system.
10624 For more information, see @uref{https://perf.wiki.kernel.org/}.
10625
10626 E.g.
10627 @smallexample
10628 perf record -e br_inst_retired:near_taken -b -o perf.data \
10629 -- your_program
10630 @end smallexample
10631
10632 Then use the @command{create_gcov} tool to convert the raw profile data
10633 to a format that can be used by GCC.@ You must also supply the
10634 unstripped binary for your program to this tool.
10635 See @uref{https://github.com/google/autofdo}.
10636
10637 E.g.
10638 @smallexample
10639 create_gcov --binary=your_program.unstripped --profile=perf.data \
10640 --gcov=profile.afdo
10641 @end smallexample
10642 @end table
10643
10644 The following options control compiler behavior regarding floating-point
10645 arithmetic. These options trade off between speed and
10646 correctness. All must be specifically enabled.
10647
10648 @table @gcctabopt
10649 @item -ffloat-store
10650 @opindex ffloat-store
10651 Do not store floating-point variables in registers, and inhibit other
10652 options that might change whether a floating-point value is taken from a
10653 register or memory.
10654
10655 @cindex floating-point precision
10656 This option prevents undesirable excess precision on machines such as
10657 the 68000 where the floating registers (of the 68881) keep more
10658 precision than a @code{double} is supposed to have. Similarly for the
10659 x86 architecture. For most programs, the excess precision does only
10660 good, but a few programs rely on the precise definition of IEEE floating
10661 point. Use @option{-ffloat-store} for such programs, after modifying
10662 them to store all pertinent intermediate computations into variables.
10663
10664 @item -fexcess-precision=@var{style}
10665 @opindex fexcess-precision
10666 This option allows further control over excess precision on machines
10667 where floating-point operations occur in a format with more precision or
10668 range than the IEEE standard and interchange floating-point types. By
10669 default, @option{-fexcess-precision=fast} is in effect; this means that
10670 operations may be carried out in a wider precision than the types specified
10671 in the source if that would result in faster code, and it is unpredictable
10672 when rounding to the types specified in the source code takes place.
10673 When compiling C, if @option{-fexcess-precision=standard} is specified then
10674 excess precision follows the rules specified in ISO C99; in particular,
10675 both casts and assignments cause values to be rounded to their
10676 semantic types (whereas @option{-ffloat-store} only affects
10677 assignments). This option is enabled by default for C if a strict
10678 conformance option such as @option{-std=c99} is used.
10679 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10680 regardless of whether a strict conformance option is used.
10681
10682 @opindex mfpmath
10683 @option{-fexcess-precision=standard} is not implemented for languages
10684 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10685 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10686 semantics apply without excess precision, and in the latter, rounding
10687 is unpredictable.
10688
10689 @item -ffast-math
10690 @opindex ffast-math
10691 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10692 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10693 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10694 @option{-fexcess-precision=fast}.
10695
10696 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10697
10698 This option is not turned on by any @option{-O} option besides
10699 @option{-Ofast} since it can result in incorrect output for programs
10700 that depend on an exact implementation of IEEE or ISO rules/specifications
10701 for math functions. It may, however, yield faster code for programs
10702 that do not require the guarantees of these specifications.
10703
10704 @item -fno-math-errno
10705 @opindex fno-math-errno
10706 @opindex fmath-errno
10707 Do not set @code{errno} after calling math functions that are executed
10708 with a single instruction, e.g., @code{sqrt}. A program that relies on
10709 IEEE exceptions for math error handling may want to use this flag
10710 for speed while maintaining IEEE arithmetic compatibility.
10711
10712 This option is not turned on by any @option{-O} option since
10713 it can result in incorrect output for programs that depend on
10714 an exact implementation of IEEE or ISO rules/specifications for
10715 math functions. It may, however, yield faster code for programs
10716 that do not require the guarantees of these specifications.
10717
10718 The default is @option{-fmath-errno}.
10719
10720 On Darwin systems, the math library never sets @code{errno}. There is
10721 therefore no reason for the compiler to consider the possibility that
10722 it might, and @option{-fno-math-errno} is the default.
10723
10724 @item -funsafe-math-optimizations
10725 @opindex funsafe-math-optimizations
10726
10727 Allow optimizations for floating-point arithmetic that (a) assume
10728 that arguments and results are valid and (b) may violate IEEE or
10729 ANSI standards. When used at link time, it may include libraries
10730 or startup files that change the default FPU control word or other
10731 similar optimizations.
10732
10733 This option is not turned on by any @option{-O} option since
10734 it can result in incorrect output for programs that depend on
10735 an exact implementation of IEEE or ISO rules/specifications for
10736 math functions. It may, however, yield faster code for programs
10737 that do not require the guarantees of these specifications.
10738 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10739 @option{-fassociative-math} and @option{-freciprocal-math}.
10740
10741 The default is @option{-fno-unsafe-math-optimizations}.
10742
10743 @item -fassociative-math
10744 @opindex fassociative-math
10745
10746 Allow re-association of operands in series of floating-point operations.
10747 This violates the ISO C and C++ language standard by possibly changing
10748 computation result. NOTE: re-ordering may change the sign of zero as
10749 well as ignore NaNs and inhibit or create underflow or overflow (and
10750 thus cannot be used on code that relies on rounding behavior like
10751 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10752 and thus may not be used when ordered comparisons are required.
10753 This option requires that both @option{-fno-signed-zeros} and
10754 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10755 much sense with @option{-frounding-math}. For Fortran the option
10756 is automatically enabled when both @option{-fno-signed-zeros} and
10757 @option{-fno-trapping-math} are in effect.
10758
10759 The default is @option{-fno-associative-math}.
10760
10761 @item -freciprocal-math
10762 @opindex freciprocal-math
10763
10764 Allow the reciprocal of a value to be used instead of dividing by
10765 the value if this enables optimizations. For example @code{x / y}
10766 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10767 is subject to common subexpression elimination. Note that this loses
10768 precision and increases the number of flops operating on the value.
10769
10770 The default is @option{-fno-reciprocal-math}.
10771
10772 @item -ffinite-math-only
10773 @opindex ffinite-math-only
10774 Allow optimizations for floating-point arithmetic that assume
10775 that arguments and results are not NaNs or +-Infs.
10776
10777 This option is not turned on by any @option{-O} option since
10778 it can result in incorrect output for programs that depend on
10779 an exact implementation of IEEE or ISO rules/specifications for
10780 math functions. It may, however, yield faster code for programs
10781 that do not require the guarantees of these specifications.
10782
10783 The default is @option{-fno-finite-math-only}.
10784
10785 @item -fno-signed-zeros
10786 @opindex fno-signed-zeros
10787 @opindex fsigned-zeros
10788 Allow optimizations for floating-point arithmetic that ignore the
10789 signedness of zero. IEEE arithmetic specifies the behavior of
10790 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10791 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10792 This option implies that the sign of a zero result isn't significant.
10793
10794 The default is @option{-fsigned-zeros}.
10795
10796 @item -fno-trapping-math
10797 @opindex fno-trapping-math
10798 @opindex ftrapping-math
10799 Compile code assuming that floating-point operations cannot generate
10800 user-visible traps. These traps include division by zero, overflow,
10801 underflow, inexact result and invalid operation. This option requires
10802 that @option{-fno-signaling-nans} be in effect. Setting this option may
10803 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10804
10805 This option should never be turned on by any @option{-O} option since
10806 it can result in incorrect output for programs that depend on
10807 an exact implementation of IEEE or ISO rules/specifications for
10808 math functions.
10809
10810 The default is @option{-ftrapping-math}.
10811
10812 @item -frounding-math
10813 @opindex frounding-math
10814 Disable transformations and optimizations that assume default floating-point
10815 rounding behavior. This is round-to-zero for all floating point
10816 to integer conversions, and round-to-nearest for all other arithmetic
10817 truncations. This option should be specified for programs that change
10818 the FP rounding mode dynamically, or that may be executed with a
10819 non-default rounding mode. This option disables constant folding of
10820 floating-point expressions at compile time (which may be affected by
10821 rounding mode) and arithmetic transformations that are unsafe in the
10822 presence of sign-dependent rounding modes.
10823
10824 The default is @option{-fno-rounding-math}.
10825
10826 This option is experimental and does not currently guarantee to
10827 disable all GCC optimizations that are affected by rounding mode.
10828 Future versions of GCC may provide finer control of this setting
10829 using C99's @code{FENV_ACCESS} pragma. This command-line option
10830 will be used to specify the default state for @code{FENV_ACCESS}.
10831
10832 @item -fsignaling-nans
10833 @opindex fsignaling-nans
10834 Compile code assuming that IEEE signaling NaNs may generate user-visible
10835 traps during floating-point operations. Setting this option disables
10836 optimizations that may change the number of exceptions visible with
10837 signaling NaNs. This option implies @option{-ftrapping-math}.
10838
10839 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10840 be defined.
10841
10842 The default is @option{-fno-signaling-nans}.
10843
10844 This option is experimental and does not currently guarantee to
10845 disable all GCC optimizations that affect signaling NaN behavior.
10846
10847 @item -fno-fp-int-builtin-inexact
10848 @opindex fno-fp-int-builtin-inexact
10849 @opindex ffp-int-builtin-inexact
10850 Do not allow the built-in functions @code{ceil}, @code{floor},
10851 @code{round} and @code{trunc}, and their @code{float} and @code{long
10852 double} variants, to generate code that raises the ``inexact''
10853 floating-point exception for noninteger arguments. ISO C99 and C11
10854 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10855 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
10856 ISO C2X, does not allow these functions to do so.
10857
10858 The default is @option{-ffp-int-builtin-inexact}, allowing the
10859 exception to be raised, unless C2X or a later C standard is selected.
10860 This option does nothing unless @option{-ftrapping-math} is in effect.
10861
10862 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10863 generate a call to a library function then the ``inexact'' exception
10864 may be raised if the library implementation does not follow TS 18661.
10865
10866 @item -fsingle-precision-constant
10867 @opindex fsingle-precision-constant
10868 Treat floating-point constants as single precision instead of
10869 implicitly converting them to double-precision constants.
10870
10871 @item -fcx-limited-range
10872 @opindex fcx-limited-range
10873 When enabled, this option states that a range reduction step is not
10874 needed when performing complex division. Also, there is no checking
10875 whether the result of a complex multiplication or division is @code{NaN
10876 + I*NaN}, with an attempt to rescue the situation in that case. The
10877 default is @option{-fno-cx-limited-range}, but is enabled by
10878 @option{-ffast-math}.
10879
10880 This option controls the default setting of the ISO C99
10881 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10882 all languages.
10883
10884 @item -fcx-fortran-rules
10885 @opindex fcx-fortran-rules
10886 Complex multiplication and division follow Fortran rules. Range
10887 reduction is done as part of complex division, but there is no checking
10888 whether the result of a complex multiplication or division is @code{NaN
10889 + I*NaN}, with an attempt to rescue the situation in that case.
10890
10891 The default is @option{-fno-cx-fortran-rules}.
10892
10893 @end table
10894
10895 The following options control optimizations that may improve
10896 performance, but are not enabled by any @option{-O} options. This
10897 section includes experimental options that may produce broken code.
10898
10899 @table @gcctabopt
10900 @item -fbranch-probabilities
10901 @opindex fbranch-probabilities
10902 After running a program compiled with @option{-fprofile-arcs}
10903 (@pxref{Instrumentation Options}),
10904 you can compile it a second time using
10905 @option{-fbranch-probabilities}, to improve optimizations based on
10906 the number of times each branch was taken. When a program
10907 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10908 counts to a file called @file{@var{sourcename}.gcda} for each source
10909 file. The information in this data file is very dependent on the
10910 structure of the generated code, so you must use the same source code
10911 and the same optimization options for both compilations.
10912
10913 With @option{-fbranch-probabilities}, GCC puts a
10914 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10915 These can be used to improve optimization. Currently, they are only
10916 used in one place: in @file{reorg.c}, instead of guessing which path a
10917 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10918 exactly determine which path is taken more often.
10919
10920 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10921
10922 @item -fprofile-values
10923 @opindex fprofile-values
10924 If combined with @option{-fprofile-arcs}, it adds code so that some
10925 data about values of expressions in the program is gathered.
10926
10927 With @option{-fbranch-probabilities}, it reads back the data gathered
10928 from profiling values of expressions for usage in optimizations.
10929
10930 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10931 @option{-fauto-profile}.
10932
10933 @item -fprofile-reorder-functions
10934 @opindex fprofile-reorder-functions
10935 Function reordering based on profile instrumentation collects
10936 first time of execution of a function and orders these functions
10937 in ascending order.
10938
10939 Enabled with @option{-fprofile-use}.
10940
10941 @item -fvpt
10942 @opindex fvpt
10943 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10944 to add code to gather information about values of expressions.
10945
10946 With @option{-fbranch-probabilities}, it reads back the data gathered
10947 and actually performs the optimizations based on them.
10948 Currently the optimizations include specialization of division operations
10949 using the knowledge about the value of the denominator.
10950
10951 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10952
10953 @item -frename-registers
10954 @opindex frename-registers
10955 Attempt to avoid false dependencies in scheduled code by making use
10956 of registers left over after register allocation. This optimization
10957 most benefits processors with lots of registers. Depending on the
10958 debug information format adopted by the target, however, it can
10959 make debugging impossible, since variables no longer stay in
10960 a ``home register''.
10961
10962 Enabled by default with @option{-funroll-loops}.
10963
10964 @item -fschedule-fusion
10965 @opindex fschedule-fusion
10966 Performs a target dependent pass over the instruction stream to schedule
10967 instructions of same type together because target machine can execute them
10968 more efficiently if they are adjacent to each other in the instruction flow.
10969
10970 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10971
10972 @item -ftracer
10973 @opindex ftracer
10974 Perform tail duplication to enlarge superblock size. This transformation
10975 simplifies the control flow of the function allowing other optimizations to do
10976 a better job.
10977
10978 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10979
10980 @item -funroll-loops
10981 @opindex funroll-loops
10982 Unroll loops whose number of iterations can be determined at compile time or
10983 upon entry to the loop. @option{-funroll-loops} implies
10984 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10985 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10986 a small constant number of iterations). This option makes code larger, and may
10987 or may not make it run faster.
10988
10989 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10990
10991 @item -funroll-all-loops
10992 @opindex funroll-all-loops
10993 Unroll all loops, even if their number of iterations is uncertain when
10994 the loop is entered. This usually makes programs run more slowly.
10995 @option{-funroll-all-loops} implies the same options as
10996 @option{-funroll-loops}.
10997
10998 @item -fpeel-loops
10999 @opindex fpeel-loops
11000 Peels loops for which there is enough information that they do not
11001 roll much (from profile feedback or static analysis). It also turns on
11002 complete loop peeling (i.e.@: complete removal of loops with small constant
11003 number of iterations).
11004
11005 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
11006
11007 @item -fmove-loop-invariants
11008 @opindex fmove-loop-invariants
11009 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
11010 at level @option{-O1} and higher, except for @option{-Og}.
11011
11012 @item -fsplit-loops
11013 @opindex fsplit-loops
11014 Split a loop into two if it contains a condition that's always true
11015 for one side of the iteration space and false for the other.
11016
11017 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11018
11019 @item -funswitch-loops
11020 @opindex funswitch-loops
11021 Move branches with loop invariant conditions out of the loop, with duplicates
11022 of the loop on both branches (modified according to result of the condition).
11023
11024 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11025
11026 @item -fversion-loops-for-strides
11027 @opindex fversion-loops-for-strides
11028 If a loop iterates over an array with a variable stride, create another
11029 version of the loop that assumes the stride is always one. For example:
11030
11031 @smallexample
11032 for (int i = 0; i < n; ++i)
11033 x[i * stride] = @dots{};
11034 @end smallexample
11035
11036 becomes:
11037
11038 @smallexample
11039 if (stride == 1)
11040 for (int i = 0; i < n; ++i)
11041 x[i] = @dots{};
11042 else
11043 for (int i = 0; i < n; ++i)
11044 x[i * stride] = @dots{};
11045 @end smallexample
11046
11047 This is particularly useful for assumed-shape arrays in Fortran where
11048 (for example) it allows better vectorization assuming contiguous accesses.
11049 This flag is enabled by default at @option{-O3}.
11050 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11051
11052 @item -ffunction-sections
11053 @itemx -fdata-sections
11054 @opindex ffunction-sections
11055 @opindex fdata-sections
11056 Place each function or data item into its own section in the output
11057 file if the target supports arbitrary sections. The name of the
11058 function or the name of the data item determines the section's name
11059 in the output file.
11060
11061 Use these options on systems where the linker can perform optimizations to
11062 improve locality of reference in the instruction space. Most systems using the
11063 ELF object format have linkers with such optimizations. On AIX, the linker
11064 rearranges sections (CSECTs) based on the call graph. The performance impact
11065 varies.
11066
11067 Together with a linker garbage collection (linker @option{--gc-sections}
11068 option) these options may lead to smaller statically-linked executables (after
11069 stripping).
11070
11071 On ELF/DWARF systems these options do not degenerate the quality of the debug
11072 information. There could be issues with other object files/debug info formats.
11073
11074 Only use these options when there are significant benefits from doing so. When
11075 you specify these options, the assembler and linker create larger object and
11076 executable files and are also slower. These options affect code generation.
11077 They prevent optimizations by the compiler and assembler using relative
11078 locations inside a translation unit since the locations are unknown until
11079 link time. An example of such an optimization is relaxing calls to short call
11080 instructions.
11081
11082 @item -fstdarg-opt
11083 @opindex fstdarg-opt
11084 Optimize the prologue of variadic argument functions with respect to usage of
11085 those arguments.
11086
11087 @item -fsection-anchors
11088 @opindex fsection-anchors
11089 Try to reduce the number of symbolic address calculations by using
11090 shared ``anchor'' symbols to address nearby objects. This transformation
11091 can help to reduce the number of GOT entries and GOT accesses on some
11092 targets.
11093
11094 For example, the implementation of the following function @code{foo}:
11095
11096 @smallexample
11097 static int a, b, c;
11098 int foo (void) @{ return a + b + c; @}
11099 @end smallexample
11100
11101 @noindent
11102 usually calculates the addresses of all three variables, but if you
11103 compile it with @option{-fsection-anchors}, it accesses the variables
11104 from a common anchor point instead. The effect is similar to the
11105 following pseudocode (which isn't valid C):
11106
11107 @smallexample
11108 int foo (void)
11109 @{
11110 register int *xr = &x;
11111 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11112 @}
11113 @end smallexample
11114
11115 Not all targets support this option.
11116
11117 @item --param @var{name}=@var{value}
11118 @opindex param
11119 In some places, GCC uses various constants to control the amount of
11120 optimization that is done. For example, GCC does not inline functions
11121 that contain more than a certain number of instructions. You can
11122 control some of these constants on the command line using the
11123 @option{--param} option.
11124
11125 The names of specific parameters, and the meaning of the values, are
11126 tied to the internals of the compiler, and are subject to change
11127 without notice in future releases.
11128
11129 In order to get minimal, maximal and default value of a parameter,
11130 one can use @option{--help=param -Q} options.
11131
11132 In each case, the @var{value} is an integer. The allowable choices for
11133 @var{name} are:
11134
11135 @table @gcctabopt
11136 @item predictable-branch-outcome
11137 When branch is predicted to be taken with probability lower than this threshold
11138 (in percent), then it is considered well predictable.
11139
11140 @item max-rtl-if-conversion-insns
11141 RTL if-conversion tries to remove conditional branches around a block and
11142 replace them with conditionally executed instructions. This parameter
11143 gives the maximum number of instructions in a block which should be
11144 considered for if-conversion. The compiler will
11145 also use other heuristics to decide whether if-conversion is likely to be
11146 profitable.
11147
11148 @item max-rtl-if-conversion-predictable-cost
11149 @itemx max-rtl-if-conversion-unpredictable-cost
11150 RTL if-conversion will try to remove conditional branches around a block
11151 and replace them with conditionally executed instructions. These parameters
11152 give the maximum permissible cost for the sequence that would be generated
11153 by if-conversion depending on whether the branch is statically determined
11154 to be predictable or not. The units for this parameter are the same as
11155 those for the GCC internal seq_cost metric. The compiler will try to
11156 provide a reasonable default for this parameter using the BRANCH_COST
11157 target macro.
11158
11159 @item max-crossjump-edges
11160 The maximum number of incoming edges to consider for cross-jumping.
11161 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11162 the number of edges incoming to each block. Increasing values mean
11163 more aggressive optimization, making the compilation time increase with
11164 probably small improvement in executable size.
11165
11166 @item min-crossjump-insns
11167 The minimum number of instructions that must be matched at the end
11168 of two blocks before cross-jumping is performed on them. This
11169 value is ignored in the case where all instructions in the block being
11170 cross-jumped from are matched.
11171
11172 @item max-grow-copy-bb-insns
11173 The maximum code size expansion factor when copying basic blocks
11174 instead of jumping. The expansion is relative to a jump instruction.
11175
11176 @item max-goto-duplication-insns
11177 The maximum number of instructions to duplicate to a block that jumps
11178 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11179 passes, GCC factors computed gotos early in the compilation process,
11180 and unfactors them as late as possible. Only computed jumps at the
11181 end of a basic blocks with no more than max-goto-duplication-insns are
11182 unfactored.
11183
11184 @item max-delay-slot-insn-search
11185 The maximum number of instructions to consider when looking for an
11186 instruction to fill a delay slot. If more than this arbitrary number of
11187 instructions are searched, the time savings from filling the delay slot
11188 are minimal, so stop searching. Increasing values mean more
11189 aggressive optimization, making the compilation time increase with probably
11190 small improvement in execution time.
11191
11192 @item max-delay-slot-live-search
11193 When trying to fill delay slots, the maximum number of instructions to
11194 consider when searching for a block with valid live register
11195 information. Increasing this arbitrarily chosen value means more
11196 aggressive optimization, increasing the compilation time. This parameter
11197 should be removed when the delay slot code is rewritten to maintain the
11198 control-flow graph.
11199
11200 @item max-gcse-memory
11201 The approximate maximum amount of memory that can be allocated in
11202 order to perform the global common subexpression elimination
11203 optimization. If more memory than specified is required, the
11204 optimization is not done.
11205
11206 @item max-gcse-insertion-ratio
11207 If the ratio of expression insertions to deletions is larger than this value
11208 for any expression, then RTL PRE inserts or removes the expression and thus
11209 leaves partially redundant computations in the instruction stream.
11210
11211 @item max-pending-list-length
11212 The maximum number of pending dependencies scheduling allows
11213 before flushing the current state and starting over. Large functions
11214 with few branches or calls can create excessively large lists which
11215 needlessly consume memory and resources.
11216
11217 @item max-modulo-backtrack-attempts
11218 The maximum number of backtrack attempts the scheduler should make
11219 when modulo scheduling a loop. Larger values can exponentially increase
11220 compilation time.
11221
11222 @item max-inline-insns-single
11223 @item max-inline-insns-single-O2
11224 Several parameters control the tree inliner used in GCC@. This number sets the
11225 maximum number of instructions (counted in GCC's internal representation) in a
11226 single function that the tree inliner considers for inlining. This only
11227 affects functions declared inline and methods implemented in a class
11228 declaration (C++).
11229
11230 For functions compiled with optimization levels
11231 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-single} is
11232 applied. In other cases @option{max-inline-insns-single-O2} is applied.
11233
11234
11235 @item max-inline-insns-auto
11236 @item max-inline-insns-auto-O2
11237 When you use @option{-finline-functions} (included in @option{-O3}),
11238 a lot of functions that would otherwise not be considered for inlining
11239 by the compiler are investigated. To those functions, a different
11240 (more restrictive) limit compared to functions declared inline can
11241 be applied.
11242
11243 For functions compiled with optimization levels
11244 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-auto} is
11245 applied. In other cases @option{max-inline-insns-auto-O2} is applied.
11246
11247 @item max-inline-insns-small
11248 This is bound applied to calls which are considered relevant with
11249 @option{-finline-small-functions}.
11250
11251 @item max-inline-insns-size
11252 This is bound applied to calls which are optimized for size. Small growth
11253 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11254
11255 @item uninlined-function-insns
11256 Number of instructions accounted by inliner for function overhead such as
11257 function prologue and epilogue.
11258
11259 @item uninlined-function-time
11260 Extra time accounted by inliner for function overhead such as time needed to
11261 execute function prologue and epilogue
11262
11263 @item inline-heuristics-hint-percent
11264 @item inline-heuristics-hint-percent-O2
11265 The scale (in percents) applied to @option{inline-insns-single},
11266 @option{inline-insns-single-O2}, @option{inline-insns-auto},
11267 @option{inline-insns-auto-O2} when inline heuristics hints that inlining is
11268 very profitable (will enable later optimizations).
11269
11270 For functions compiled with optimization levels
11271 @option{-O3} and @option{-Ofast} parameter
11272 @option{inline-heuristics-hint-percent} is applied. In other cases
11273 @option{inline-heuristics-hint-percent-O2} is applied.
11274
11275 @item uninlined-thunk-insns
11276 @item uninlined-thunk-time
11277 Same as @option{--param uninlined-function-insns} and
11278 @option{--param uninlined-function-time} but applied to function thunks
11279
11280 @item inline-min-speedup
11281 @item inline-min-speedup-O2
11282 When estimated performance improvement of caller + callee runtime exceeds this
11283 threshold (in percent), the function can be inlined regardless of the limit on
11284 @option{--param max-inline-insns-single} and @option{--param
11285 max-inline-insns-auto}.
11286
11287 For functions compiled with optimization levels
11288 @option{-O3} and @option{-Ofast} parameter @option{inline-min-speedup} is
11289 applied. In other cases @option{inline-min-speedup-O2} is applied.
11290
11291 @item large-function-insns
11292 The limit specifying really large functions. For functions larger than this
11293 limit after inlining, inlining is constrained by
11294 @option{--param large-function-growth}. This parameter is useful primarily
11295 to avoid extreme compilation time caused by non-linear algorithms used by the
11296 back end.
11297
11298 @item large-function-growth
11299 Specifies maximal growth of large function caused by inlining in percents.
11300 For example, parameter value 100 limits large function growth to 2.0 times
11301 the original size.
11302
11303 @item large-unit-insns
11304 The limit specifying large translation unit. Growth caused by inlining of
11305 units larger than this limit is limited by @option{--param inline-unit-growth}.
11306 For small units this might be too tight.
11307 For example, consider a unit consisting of function A
11308 that is inline and B that just calls A three times. If B is small relative to
11309 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11310 large units consisting of small inlineable functions, however, the overall unit
11311 growth limit is needed to avoid exponential explosion of code size. Thus for
11312 smaller units, the size is increased to @option{--param large-unit-insns}
11313 before applying @option{--param inline-unit-growth}.
11314
11315 @item inline-unit-growth
11316 Specifies maximal overall growth of the compilation unit caused by inlining.
11317 For example, parameter value 20 limits unit growth to 1.2 times the original
11318 size. Cold functions (either marked cold via an attribute or by profile
11319 feedback) are not accounted into the unit size.
11320
11321 @item ipcp-unit-growth
11322 Specifies maximal overall growth of the compilation unit caused by
11323 interprocedural constant propagation. For example, parameter value 10 limits
11324 unit growth to 1.1 times the original size.
11325
11326 @item large-stack-frame
11327 The limit specifying large stack frames. While inlining the algorithm is trying
11328 to not grow past this limit too much.
11329
11330 @item large-stack-frame-growth
11331 Specifies maximal growth of large stack frames caused by inlining in percents.
11332 For example, parameter value 1000 limits large stack frame growth to 11 times
11333 the original size.
11334
11335 @item max-inline-insns-recursive
11336 @itemx max-inline-insns-recursive-auto
11337 Specifies the maximum number of instructions an out-of-line copy of a
11338 self-recursive inline
11339 function can grow into by performing recursive inlining.
11340
11341 @option{--param max-inline-insns-recursive} applies to functions
11342 declared inline.
11343 For functions not declared inline, recursive inlining
11344 happens only when @option{-finline-functions} (included in @option{-O3}) is
11345 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11346
11347 @item max-inline-recursive-depth
11348 @itemx max-inline-recursive-depth-auto
11349 Specifies the maximum recursion depth used for recursive inlining.
11350
11351 @option{--param max-inline-recursive-depth} applies to functions
11352 declared inline. For functions not declared inline, recursive inlining
11353 happens only when @option{-finline-functions} (included in @option{-O3}) is
11354 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11355
11356 @item min-inline-recursive-probability
11357 Recursive inlining is profitable only for function having deep recursion
11358 in average and can hurt for function having little recursion depth by
11359 increasing the prologue size or complexity of function body to other
11360 optimizers.
11361
11362 When profile feedback is available (see @option{-fprofile-generate}) the actual
11363 recursion depth can be guessed from the probability that function recurses
11364 via a given call expression. This parameter limits inlining only to call
11365 expressions whose probability exceeds the given threshold (in percents).
11366
11367 @item early-inlining-insns
11368 @item early-inlining-insns-O2
11369 Specify growth that the early inliner can make. In effect it increases
11370 the amount of inlining for code having a large abstraction penalty.
11371
11372 For functions compiled with optimization levels
11373 @option{-O3} and @option{-Ofast} parameter @option{early-inlining-insns} is
11374 applied. In other cases @option{early-inlining-insns-O2} is applied.
11375
11376 @item max-early-inliner-iterations
11377 Limit of iterations of the early inliner. This basically bounds
11378 the number of nested indirect calls the early inliner can resolve.
11379 Deeper chains are still handled by late inlining.
11380
11381 @item comdat-sharing-probability
11382 Probability (in percent) that C++ inline function with comdat visibility
11383 are shared across multiple compilation units.
11384
11385 @item profile-func-internal-id
11386 A parameter to control whether to use function internal id in profile
11387 database lookup. If the value is 0, the compiler uses an id that
11388 is based on function assembler name and filename, which makes old profile
11389 data more tolerant to source changes such as function reordering etc.
11390
11391 @item min-vect-loop-bound
11392 The minimum number of iterations under which loops are not vectorized
11393 when @option{-ftree-vectorize} is used. The number of iterations after
11394 vectorization needs to be greater than the value specified by this option
11395 to allow vectorization.
11396
11397 @item gcse-cost-distance-ratio
11398 Scaling factor in calculation of maximum distance an expression
11399 can be moved by GCSE optimizations. This is currently supported only in the
11400 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11401 is with simple expressions, i.e., the expressions that have cost
11402 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11403 hoisting of simple expressions.
11404
11405 @item gcse-unrestricted-cost
11406 Cost, roughly measured as the cost of a single typical machine
11407 instruction, at which GCSE optimizations do not constrain
11408 the distance an expression can travel. This is currently
11409 supported only in the code hoisting pass. The lesser the cost,
11410 the more aggressive code hoisting is. Specifying 0
11411 allows all expressions to travel unrestricted distances.
11412
11413 @item max-hoist-depth
11414 The depth of search in the dominator tree for expressions to hoist.
11415 This is used to avoid quadratic behavior in hoisting algorithm.
11416 The value of 0 does not limit on the search, but may slow down compilation
11417 of huge functions.
11418
11419 @item max-tail-merge-comparisons
11420 The maximum amount of similar bbs to compare a bb with. This is used to
11421 avoid quadratic behavior in tree tail merging.
11422
11423 @item max-tail-merge-iterations
11424 The maximum amount of iterations of the pass over the function. This is used to
11425 limit compilation time in tree tail merging.
11426
11427 @item store-merging-allow-unaligned
11428 Allow the store merging pass to introduce unaligned stores if it is legal to
11429 do so.
11430
11431 @item max-stores-to-merge
11432 The maximum number of stores to attempt to merge into wider stores in the store
11433 merging pass.
11434
11435 @item max-unrolled-insns
11436 The maximum number of instructions that a loop may have to be unrolled.
11437 If a loop is unrolled, this parameter also determines how many times
11438 the loop code is unrolled.
11439
11440 @item max-average-unrolled-insns
11441 The maximum number of instructions biased by probabilities of their execution
11442 that a loop may have to be unrolled. If a loop is unrolled,
11443 this parameter also determines how many times the loop code is unrolled.
11444
11445 @item max-unroll-times
11446 The maximum number of unrollings of a single loop.
11447
11448 @item max-peeled-insns
11449 The maximum number of instructions that a loop may have to be peeled.
11450 If a loop is peeled, this parameter also determines how many times
11451 the loop code is peeled.
11452
11453 @item max-peel-times
11454 The maximum number of peelings of a single loop.
11455
11456 @item max-peel-branches
11457 The maximum number of branches on the hot path through the peeled sequence.
11458
11459 @item max-completely-peeled-insns
11460 The maximum number of insns of a completely peeled loop.
11461
11462 @item max-completely-peel-times
11463 The maximum number of iterations of a loop to be suitable for complete peeling.
11464
11465 @item max-completely-peel-loop-nest-depth
11466 The maximum depth of a loop nest suitable for complete peeling.
11467
11468 @item max-unswitch-insns
11469 The maximum number of insns of an unswitched loop.
11470
11471 @item max-unswitch-level
11472 The maximum number of branches unswitched in a single loop.
11473
11474 @item lim-expensive
11475 The minimum cost of an expensive expression in the loop invariant motion.
11476
11477 @item iv-consider-all-candidates-bound
11478 Bound on number of candidates for induction variables, below which
11479 all candidates are considered for each use in induction variable
11480 optimizations. If there are more candidates than this,
11481 only the most relevant ones are considered to avoid quadratic time complexity.
11482
11483 @item iv-max-considered-uses
11484 The induction variable optimizations give up on loops that contain more
11485 induction variable uses.
11486
11487 @item iv-always-prune-cand-set-bound
11488 If the number of candidates in the set is smaller than this value,
11489 always try to remove unnecessary ivs from the set
11490 when adding a new one.
11491
11492 @item avg-loop-niter
11493 Average number of iterations of a loop.
11494
11495 @item dse-max-object-size
11496 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11497 Larger values may result in larger compilation times.
11498
11499 @item dse-max-alias-queries-per-store
11500 Maximum number of queries into the alias oracle per store.
11501 Larger values result in larger compilation times and may result in more
11502 removed dead stores.
11503
11504 @item scev-max-expr-size
11505 Bound on size of expressions used in the scalar evolutions analyzer.
11506 Large expressions slow the analyzer.
11507
11508 @item scev-max-expr-complexity
11509 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11510 Complex expressions slow the analyzer.
11511
11512 @item max-tree-if-conversion-phi-args
11513 Maximum number of arguments in a PHI supported by TREE if conversion
11514 unless the loop is marked with simd pragma.
11515
11516 @item vect-max-version-for-alignment-checks
11517 The maximum number of run-time checks that can be performed when
11518 doing loop versioning for alignment in the vectorizer.
11519
11520 @item vect-max-version-for-alias-checks
11521 The maximum number of run-time checks that can be performed when
11522 doing loop versioning for alias in the vectorizer.
11523
11524 @item vect-max-peeling-for-alignment
11525 The maximum number of loop peels to enhance access alignment
11526 for vectorizer. Value -1 means no limit.
11527
11528 @item max-iterations-to-track
11529 The maximum number of iterations of a loop the brute-force algorithm
11530 for analysis of the number of iterations of the loop tries to evaluate.
11531
11532 @item hot-bb-count-fraction
11533 The denominator n of fraction 1/n of the maximal execution count of a
11534 basic block in the entire program that a basic block needs to at least
11535 have in order to be considered hot. The default is 10000, which means
11536 that a basic block is considered hot if its execution count is greater
11537 than 1/10000 of the maximal execution count. 0 means that it is never
11538 considered hot. Used in non-LTO mode.
11539
11540 @item hot-bb-count-ws-permille
11541 The number of most executed permilles, ranging from 0 to 1000, of the
11542 profiled execution of the entire program to which the execution count
11543 of a basic block must be part of in order to be considered hot. The
11544 default is 990, which means that a basic block is considered hot if
11545 its execution count contributes to the upper 990 permilles, or 99.0%,
11546 of the profiled execution of the entire program. 0 means that it is
11547 never considered hot. Used in LTO mode.
11548
11549 @item hot-bb-frequency-fraction
11550 The denominator n of fraction 1/n of the execution frequency of the
11551 entry block of a function that a basic block of this function needs
11552 to at least have in order to be considered hot. The default is 1000,
11553 which means that a basic block is considered hot in a function if it
11554 is executed more frequently than 1/1000 of the frequency of the entry
11555 block of the function. 0 means that it is never considered hot.
11556
11557 @item unlikely-bb-count-fraction
11558 The denominator n of fraction 1/n of the number of profiled runs of
11559 the entire program below which the execution count of a basic block
11560 must be in order for the basic block to be considered unlikely executed.
11561 The default is 20, which means that a basic block is considered unlikely
11562 executed if it is executed in fewer than 1/20, or 5%, of the runs of
11563 the program. 0 means that it is always considered unlikely executed.
11564
11565 @item max-predicted-iterations
11566 The maximum number of loop iterations we predict statically. This is useful
11567 in cases where a function contains a single loop with known bound and
11568 another loop with unknown bound.
11569 The known number of iterations is predicted correctly, while
11570 the unknown number of iterations average to roughly 10. This means that the
11571 loop without bounds appears artificially cold relative to the other one.
11572
11573 @item builtin-expect-probability
11574 Control the probability of the expression having the specified value. This
11575 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11576
11577 @item builtin-string-cmp-inline-length
11578 The maximum length of a constant string for a builtin string cmp call
11579 eligible for inlining.
11580
11581 @item align-threshold
11582
11583 Select fraction of the maximal frequency of executions of a basic block in
11584 a function to align the basic block.
11585
11586 @item align-loop-iterations
11587
11588 A loop expected to iterate at least the selected number of iterations is
11589 aligned.
11590
11591 @item tracer-dynamic-coverage
11592 @itemx tracer-dynamic-coverage-feedback
11593
11594 This value is used to limit superblock formation once the given percentage of
11595 executed instructions is covered. This limits unnecessary code size
11596 expansion.
11597
11598 The @option{tracer-dynamic-coverage-feedback} parameter
11599 is used only when profile
11600 feedback is available. The real profiles (as opposed to statically estimated
11601 ones) are much less balanced allowing the threshold to be larger value.
11602
11603 @item tracer-max-code-growth
11604 Stop tail duplication once code growth has reached given percentage. This is
11605 a rather artificial limit, as most of the duplicates are eliminated later in
11606 cross jumping, so it may be set to much higher values than is the desired code
11607 growth.
11608
11609 @item tracer-min-branch-ratio
11610
11611 Stop reverse growth when the reverse probability of best edge is less than this
11612 threshold (in percent).
11613
11614 @item tracer-min-branch-probability
11615 @itemx tracer-min-branch-probability-feedback
11616
11617 Stop forward growth if the best edge has probability lower than this
11618 threshold.
11619
11620 Similarly to @option{tracer-dynamic-coverage} two parameters are
11621 provided. @option{tracer-min-branch-probability-feedback} is used for
11622 compilation with profile feedback and @option{tracer-min-branch-probability}
11623 compilation without. The value for compilation with profile feedback
11624 needs to be more conservative (higher) in order to make tracer
11625 effective.
11626
11627 @item stack-clash-protection-guard-size
11628 Specify the size of the operating system provided stack guard as
11629 2 raised to @var{num} bytes. Higher values may reduce the
11630 number of explicit probes, but a value larger than the operating system
11631 provided guard will leave code vulnerable to stack clash style attacks.
11632
11633 @item stack-clash-protection-probe-interval
11634 Stack clash protection involves probing stack space as it is allocated. This
11635 param controls the maximum distance between probes into the stack as 2 raised
11636 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11637 larger than the operating system provided guard will leave code vulnerable to
11638 stack clash style attacks.
11639
11640 @item max-cse-path-length
11641
11642 The maximum number of basic blocks on path that CSE considers.
11643
11644 @item max-cse-insns
11645 The maximum number of instructions CSE processes before flushing.
11646
11647 @item ggc-min-expand
11648
11649 GCC uses a garbage collector to manage its own memory allocation. This
11650 parameter specifies the minimum percentage by which the garbage
11651 collector's heap should be allowed to expand between collections.
11652 Tuning this may improve compilation speed; it has no effect on code
11653 generation.
11654
11655 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11656 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11657 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11658 GCC is not able to calculate RAM on a particular platform, the lower
11659 bound of 30% is used. Setting this parameter and
11660 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11661 every opportunity. This is extremely slow, but can be useful for
11662 debugging.
11663
11664 @item ggc-min-heapsize
11665
11666 Minimum size of the garbage collector's heap before it begins bothering
11667 to collect garbage. The first collection occurs after the heap expands
11668 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11669 tuning this may improve compilation speed, and has no effect on code
11670 generation.
11671
11672 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11673 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11674 with a lower bound of 4096 (four megabytes) and an upper bound of
11675 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11676 particular platform, the lower bound is used. Setting this parameter
11677 very large effectively disables garbage collection. Setting this
11678 parameter and @option{ggc-min-expand} to zero causes a full collection
11679 to occur at every opportunity.
11680
11681 @item max-reload-search-insns
11682 The maximum number of instruction reload should look backward for equivalent
11683 register. Increasing values mean more aggressive optimization, making the
11684 compilation time increase with probably slightly better performance.
11685
11686 @item max-cselib-memory-locations
11687 The maximum number of memory locations cselib should take into account.
11688 Increasing values mean more aggressive optimization, making the compilation time
11689 increase with probably slightly better performance.
11690
11691 @item max-sched-ready-insns
11692 The maximum number of instructions ready to be issued the scheduler should
11693 consider at any given time during the first scheduling pass. Increasing
11694 values mean more thorough searches, making the compilation time increase
11695 with probably little benefit.
11696
11697 @item max-sched-region-blocks
11698 The maximum number of blocks in a region to be considered for
11699 interblock scheduling.
11700
11701 @item max-pipeline-region-blocks
11702 The maximum number of blocks in a region to be considered for
11703 pipelining in the selective scheduler.
11704
11705 @item max-sched-region-insns
11706 The maximum number of insns in a region to be considered for
11707 interblock scheduling.
11708
11709 @item max-pipeline-region-insns
11710 The maximum number of insns in a region to be considered for
11711 pipelining in the selective scheduler.
11712
11713 @item min-spec-prob
11714 The minimum probability (in percents) of reaching a source block
11715 for interblock speculative scheduling.
11716
11717 @item max-sched-extend-regions-iters
11718 The maximum number of iterations through CFG to extend regions.
11719 A value of 0 disables region extensions.
11720
11721 @item max-sched-insn-conflict-delay
11722 The maximum conflict delay for an insn to be considered for speculative motion.
11723
11724 @item sched-spec-prob-cutoff
11725 The minimal probability of speculation success (in percents), so that
11726 speculative insns are scheduled.
11727
11728 @item sched-state-edge-prob-cutoff
11729 The minimum probability an edge must have for the scheduler to save its
11730 state across it.
11731
11732 @item sched-mem-true-dep-cost
11733 Minimal distance (in CPU cycles) between store and load targeting same
11734 memory locations.
11735
11736 @item selsched-max-lookahead
11737 The maximum size of the lookahead window of selective scheduling. It is a
11738 depth of search for available instructions.
11739
11740 @item selsched-max-sched-times
11741 The maximum number of times that an instruction is scheduled during
11742 selective scheduling. This is the limit on the number of iterations
11743 through which the instruction may be pipelined.
11744
11745 @item selsched-insns-to-rename
11746 The maximum number of best instructions in the ready list that are considered
11747 for renaming in the selective scheduler.
11748
11749 @item sms-min-sc
11750 The minimum value of stage count that swing modulo scheduler
11751 generates.
11752
11753 @item max-last-value-rtl
11754 The maximum size measured as number of RTLs that can be recorded in an expression
11755 in combiner for a pseudo register as last known value of that register.
11756
11757 @item max-combine-insns
11758 The maximum number of instructions the RTL combiner tries to combine.
11759
11760 @item integer-share-limit
11761 Small integer constants can use a shared data structure, reducing the
11762 compiler's memory usage and increasing its speed. This sets the maximum
11763 value of a shared integer constant.
11764
11765 @item ssp-buffer-size
11766 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11767 protection when @option{-fstack-protection} is used.
11768
11769 @item min-size-for-stack-sharing
11770 The minimum size of variables taking part in stack slot sharing when not
11771 optimizing.
11772
11773 @item max-jump-thread-duplication-stmts
11774 Maximum number of statements allowed in a block that needs to be
11775 duplicated when threading jumps.
11776
11777 @item max-fields-for-field-sensitive
11778 Maximum number of fields in a structure treated in
11779 a field sensitive manner during pointer analysis.
11780
11781 @item prefetch-latency
11782 Estimate on average number of instructions that are executed before
11783 prefetch finishes. The distance prefetched ahead is proportional
11784 to this constant. Increasing this number may also lead to less
11785 streams being prefetched (see @option{simultaneous-prefetches}).
11786
11787 @item simultaneous-prefetches
11788 Maximum number of prefetches that can run at the same time.
11789
11790 @item l1-cache-line-size
11791 The size of cache line in L1 data cache, in bytes.
11792
11793 @item l1-cache-size
11794 The size of L1 data cache, in kilobytes.
11795
11796 @item l2-cache-size
11797 The size of L2 data cache, in kilobytes.
11798
11799 @item prefetch-dynamic-strides
11800 Whether the loop array prefetch pass should issue software prefetch hints
11801 for strides that are non-constant. In some cases this may be
11802 beneficial, though the fact the stride is non-constant may make it
11803 hard to predict when there is clear benefit to issuing these hints.
11804
11805 Set to 1 if the prefetch hints should be issued for non-constant
11806 strides. Set to 0 if prefetch hints should be issued only for strides that
11807 are known to be constant and below @option{prefetch-minimum-stride}.
11808
11809 @item prefetch-minimum-stride
11810 Minimum constant stride, in bytes, to start using prefetch hints for. If
11811 the stride is less than this threshold, prefetch hints will not be issued.
11812
11813 This setting is useful for processors that have hardware prefetchers, in
11814 which case there may be conflicts between the hardware prefetchers and
11815 the software prefetchers. If the hardware prefetchers have a maximum
11816 stride they can handle, it should be used here to improve the use of
11817 software prefetchers.
11818
11819 A value of -1 means we don't have a threshold and therefore
11820 prefetch hints can be issued for any constant stride.
11821
11822 This setting is only useful for strides that are known and constant.
11823
11824 @item loop-interchange-max-num-stmts
11825 The maximum number of stmts in a loop to be interchanged.
11826
11827 @item loop-interchange-stride-ratio
11828 The minimum ratio between stride of two loops for interchange to be profitable.
11829
11830 @item min-insn-to-prefetch-ratio
11831 The minimum ratio between the number of instructions and the
11832 number of prefetches to enable prefetching in a loop.
11833
11834 @item prefetch-min-insn-to-mem-ratio
11835 The minimum ratio between the number of instructions and the
11836 number of memory references to enable prefetching in a loop.
11837
11838 @item use-canonical-types
11839 Whether the compiler should use the ``canonical'' type system.
11840 Should always be 1, which uses a more efficient internal
11841 mechanism for comparing types in C++ and Objective-C++. However, if
11842 bugs in the canonical type system are causing compilation failures,
11843 set this value to 0 to disable canonical types.
11844
11845 @item switch-conversion-max-branch-ratio
11846 Switch initialization conversion refuses to create arrays that are
11847 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11848 branches in the switch.
11849
11850 @item max-partial-antic-length
11851 Maximum length of the partial antic set computed during the tree
11852 partial redundancy elimination optimization (@option{-ftree-pre}) when
11853 optimizing at @option{-O3} and above. For some sorts of source code
11854 the enhanced partial redundancy elimination optimization can run away,
11855 consuming all of the memory available on the host machine. This
11856 parameter sets a limit on the length of the sets that are computed,
11857 which prevents the runaway behavior. Setting a value of 0 for
11858 this parameter allows an unlimited set length.
11859
11860 @item rpo-vn-max-loop-depth
11861 Maximum loop depth that is value-numbered optimistically.
11862 When the limit hits the innermost
11863 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11864 loop nest are value-numbered optimistically and the remaining ones not.
11865
11866 @item sccvn-max-alias-queries-per-access
11867 Maximum number of alias-oracle queries we perform when looking for
11868 redundancies for loads and stores. If this limit is hit the search
11869 is aborted and the load or store is not considered redundant. The
11870 number of queries is algorithmically limited to the number of
11871 stores on all paths from the load to the function entry.
11872
11873 @item ira-max-loops-num
11874 IRA uses regional register allocation by default. If a function
11875 contains more loops than the number given by this parameter, only at most
11876 the given number of the most frequently-executed loops form regions
11877 for regional register allocation.
11878
11879 @item ira-max-conflict-table-size
11880 Although IRA uses a sophisticated algorithm to compress the conflict
11881 table, the table can still require excessive amounts of memory for
11882 huge functions. If the conflict table for a function could be more
11883 than the size in MB given by this parameter, the register allocator
11884 instead uses a faster, simpler, and lower-quality
11885 algorithm that does not require building a pseudo-register conflict table.
11886
11887 @item ira-loop-reserved-regs
11888 IRA can be used to evaluate more accurate register pressure in loops
11889 for decisions to move loop invariants (see @option{-O3}). The number
11890 of available registers reserved for some other purposes is given
11891 by this parameter. Default of the parameter
11892 is the best found from numerous experiments.
11893
11894 @item lra-inheritance-ebb-probability-cutoff
11895 LRA tries to reuse values reloaded in registers in subsequent insns.
11896 This optimization is called inheritance. EBB is used as a region to
11897 do this optimization. The parameter defines a minimal fall-through
11898 edge probability in percentage used to add BB to inheritance EBB in
11899 LRA. The default value was chosen
11900 from numerous runs of SPEC2000 on x86-64.
11901
11902 @item loop-invariant-max-bbs-in-loop
11903 Loop invariant motion can be very expensive, both in compilation time and
11904 in amount of needed compile-time memory, with very large loops. Loops
11905 with more basic blocks than this parameter won't have loop invariant
11906 motion optimization performed on them.
11907
11908 @item loop-max-datarefs-for-datadeps
11909 Building data dependencies is expensive for very large loops. This
11910 parameter limits the number of data references in loops that are
11911 considered for data dependence analysis. These large loops are no
11912 handled by the optimizations using loop data dependencies.
11913
11914 @item max-vartrack-size
11915 Sets a maximum number of hash table slots to use during variable
11916 tracking dataflow analysis of any function. If this limit is exceeded
11917 with variable tracking at assignments enabled, analysis for that
11918 function is retried without it, after removing all debug insns from
11919 the function. If the limit is exceeded even without debug insns, var
11920 tracking analysis is completely disabled for the function. Setting
11921 the parameter to zero makes it unlimited.
11922
11923 @item max-vartrack-expr-depth
11924 Sets a maximum number of recursion levels when attempting to map
11925 variable names or debug temporaries to value expressions. This trades
11926 compilation time for more complete debug information. If this is set too
11927 low, value expressions that are available and could be represented in
11928 debug information may end up not being used; setting this higher may
11929 enable the compiler to find more complex debug expressions, but compile
11930 time and memory use may grow.
11931
11932 @item max-debug-marker-count
11933 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11934 markers) to avoid complexity explosion at inlining or expanding to RTL.
11935 If a function has more such gimple stmts than the set limit, such stmts
11936 will be dropped from the inlined copy of a function, and from its RTL
11937 expansion.
11938
11939 @item min-nondebug-insn-uid
11940 Use uids starting at this parameter for nondebug insns. The range below
11941 the parameter is reserved exclusively for debug insns created by
11942 @option{-fvar-tracking-assignments}, but debug insns may get
11943 (non-overlapping) uids above it if the reserved range is exhausted.
11944
11945 @item ipa-sra-ptr-growth-factor
11946 IPA-SRA replaces a pointer to an aggregate with one or more new
11947 parameters only when their cumulative size is less or equal to
11948 @option{ipa-sra-ptr-growth-factor} times the size of the original
11949 pointer parameter.
11950
11951 @item ipa-sra-max-replacements
11952 Maximum pieces of an aggregate that IPA-SRA tracks. As a
11953 consequence, it is also the maximum number of replacements of a formal
11954 parameter.
11955
11956 @item sra-max-scalarization-size-Ospeed
11957 @itemx sra-max-scalarization-size-Osize
11958 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11959 replace scalar parts of aggregates with uses of independent scalar
11960 variables. These parameters control the maximum size, in storage units,
11961 of aggregate which is considered for replacement when compiling for
11962 speed
11963 (@option{sra-max-scalarization-size-Ospeed}) or size
11964 (@option{sra-max-scalarization-size-Osize}) respectively.
11965
11966 @item tm-max-aggregate-size
11967 When making copies of thread-local variables in a transaction, this
11968 parameter specifies the size in bytes after which variables are
11969 saved with the logging functions as opposed to save/restore code
11970 sequence pairs. This option only applies when using
11971 @option{-fgnu-tm}.
11972
11973 @item graphite-max-nb-scop-params
11974 To avoid exponential effects in the Graphite loop transforms, the
11975 number of parameters in a Static Control Part (SCoP) is bounded.
11976 A value of zero can be used to lift
11977 the bound. A variable whose value is unknown at compilation time and
11978 defined outside a SCoP is a parameter of the SCoP.
11979
11980 @item loop-block-tile-size
11981 Loop blocking or strip mining transforms, enabled with
11982 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11983 loop in the loop nest by a given number of iterations. The strip
11984 length can be changed using the @option{loop-block-tile-size}
11985 parameter.
11986
11987 @item ipa-cp-value-list-size
11988 IPA-CP attempts to track all possible values and types passed to a function's
11989 parameter in order to propagate them and perform devirtualization.
11990 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11991 stores per one formal parameter of a function.
11992
11993 @item ipa-cp-eval-threshold
11994 IPA-CP calculates its own score of cloning profitability heuristics
11995 and performs those cloning opportunities with scores that exceed
11996 @option{ipa-cp-eval-threshold}.
11997
11998 @item ipa-cp-recursion-penalty
11999 Percentage penalty the recursive functions will receive when they
12000 are evaluated for cloning.
12001
12002 @item ipa-cp-single-call-penalty
12003 Percentage penalty functions containing a single call to another
12004 function will receive when they are evaluated for cloning.
12005
12006 @item ipa-max-agg-items
12007 IPA-CP is also capable to propagate a number of scalar values passed
12008 in an aggregate. @option{ipa-max-agg-items} controls the maximum
12009 number of such values per one parameter.
12010
12011 @item ipa-cp-loop-hint-bonus
12012 When IPA-CP determines that a cloning candidate would make the number
12013 of iterations of a loop known, it adds a bonus of
12014 @option{ipa-cp-loop-hint-bonus} to the profitability score of
12015 the candidate.
12016
12017 @item ipa-max-aa-steps
12018 During its analysis of function bodies, IPA-CP employs alias analysis
12019 in order to track values pointed to by function parameters. In order
12020 not spend too much time analyzing huge functions, it gives up and
12021 consider all memory clobbered after examining
12022 @option{ipa-max-aa-steps} statements modifying memory.
12023
12024 @item ipa-max-switch-predicate-bounds
12025 Maximal number of boundary endpoints of case ranges of switch statement.
12026 For switch exceeding this limit, IPA-CP will not construct cloning cost
12027 predicate, which is used to estimate cloning benefit, for default case
12028 of the switch statement.
12029
12030 @item lto-partitions
12031 Specify desired number of partitions produced during WHOPR compilation.
12032 The number of partitions should exceed the number of CPUs used for compilation.
12033
12034 @item lto-min-partition
12035 Size of minimal partition for WHOPR (in estimated instructions).
12036 This prevents expenses of splitting very small programs into too many
12037 partitions.
12038
12039 @item lto-max-partition
12040 Size of max partition for WHOPR (in estimated instructions).
12041 to provide an upper bound for individual size of partition.
12042 Meant to be used only with balanced partitioning.
12043
12044 @item lto-max-streaming-parallelism
12045 Maximal number of parallel processes used for LTO streaming.
12046
12047 @item cxx-max-namespaces-for-diagnostic-help
12048 The maximum number of namespaces to consult for suggestions when C++
12049 name lookup fails for an identifier.
12050
12051 @item sink-frequency-threshold
12052 The maximum relative execution frequency (in percents) of the target block
12053 relative to a statement's original block to allow statement sinking of a
12054 statement. Larger numbers result in more aggressive statement sinking.
12055 A small positive adjustment is applied for
12056 statements with memory operands as those are even more profitable so sink.
12057
12058 @item max-stores-to-sink
12059 The maximum number of conditional store pairs that can be sunk. Set to 0
12060 if either vectorization (@option{-ftree-vectorize}) or if-conversion
12061 (@option{-ftree-loop-if-convert}) is disabled.
12062
12063 @item allow-store-data-races
12064 Allow optimizers to introduce new data races on stores.
12065 Set to 1 to allow, otherwise to 0.
12066
12067 @item case-values-threshold
12068 The smallest number of different values for which it is best to use a
12069 jump-table instead of a tree of conditional branches. If the value is
12070 0, use the default for the machine.
12071
12072 @item jump-table-max-growth-ratio-for-size
12073 The maximum code size growth ratio when expanding
12074 into a jump table (in percent). The parameter is used when
12075 optimizing for size.
12076
12077 @item jump-table-max-growth-ratio-for-speed
12078 The maximum code size growth ratio when expanding
12079 into a jump table (in percent). The parameter is used when
12080 optimizing for speed.
12081
12082 @item tree-reassoc-width
12083 Set the maximum number of instructions executed in parallel in
12084 reassociated tree. This parameter overrides target dependent
12085 heuristics used by default if has non zero value.
12086
12087 @item sched-pressure-algorithm
12088 Choose between the two available implementations of
12089 @option{-fsched-pressure}. Algorithm 1 is the original implementation
12090 and is the more likely to prevent instructions from being reordered.
12091 Algorithm 2 was designed to be a compromise between the relatively
12092 conservative approach taken by algorithm 1 and the rather aggressive
12093 approach taken by the default scheduler. It relies more heavily on
12094 having a regular register file and accurate register pressure classes.
12095 See @file{haifa-sched.c} in the GCC sources for more details.
12096
12097 The default choice depends on the target.
12098
12099 @item max-slsr-cand-scan
12100 Set the maximum number of existing candidates that are considered when
12101 seeking a basis for a new straight-line strength reduction candidate.
12102
12103 @item asan-globals
12104 Enable buffer overflow detection for global objects. This kind
12105 of protection is enabled by default if you are using
12106 @option{-fsanitize=address} option.
12107 To disable global objects protection use @option{--param asan-globals=0}.
12108
12109 @item asan-stack
12110 Enable buffer overflow detection for stack objects. This kind of
12111 protection is enabled by default when using @option{-fsanitize=address}.
12112 To disable stack protection use @option{--param asan-stack=0} option.
12113
12114 @item asan-instrument-reads
12115 Enable buffer overflow detection for memory reads. This kind of
12116 protection is enabled by default when using @option{-fsanitize=address}.
12117 To disable memory reads protection use
12118 @option{--param asan-instrument-reads=0}.
12119
12120 @item asan-instrument-writes
12121 Enable buffer overflow detection for memory writes. This kind of
12122 protection is enabled by default when using @option{-fsanitize=address}.
12123 To disable memory writes protection use
12124 @option{--param asan-instrument-writes=0} option.
12125
12126 @item asan-memintrin
12127 Enable detection for built-in functions. This kind of protection
12128 is enabled by default when using @option{-fsanitize=address}.
12129 To disable built-in functions protection use
12130 @option{--param asan-memintrin=0}.
12131
12132 @item asan-use-after-return
12133 Enable detection of use-after-return. This kind of protection
12134 is enabled by default when using the @option{-fsanitize=address} option.
12135 To disable it use @option{--param asan-use-after-return=0}.
12136
12137 Note: By default the check is disabled at run time. To enable it,
12138 add @code{detect_stack_use_after_return=1} to the environment variable
12139 @env{ASAN_OPTIONS}.
12140
12141 @item asan-instrumentation-with-call-threshold
12142 If number of memory accesses in function being instrumented
12143 is greater or equal to this number, use callbacks instead of inline checks.
12144 E.g. to disable inline code use
12145 @option{--param asan-instrumentation-with-call-threshold=0}.
12146
12147 @item use-after-scope-direct-emission-threshold
12148 If the size of a local variable in bytes is smaller or equal to this
12149 number, directly poison (or unpoison) shadow memory instead of using
12150 run-time callbacks.
12151
12152 @item max-fsm-thread-path-insns
12153 Maximum number of instructions to copy when duplicating blocks on a
12154 finite state automaton jump thread path.
12155
12156 @item max-fsm-thread-length
12157 Maximum number of basic blocks on a finite state automaton jump thread
12158 path.
12159
12160 @item max-fsm-thread-paths
12161 Maximum number of new jump thread paths to create for a finite state
12162 automaton.
12163
12164 @item parloops-chunk-size
12165 Chunk size of omp schedule for loops parallelized by parloops.
12166
12167 @item parloops-schedule
12168 Schedule type of omp schedule for loops parallelized by parloops (static,
12169 dynamic, guided, auto, runtime).
12170
12171 @item parloops-min-per-thread
12172 The minimum number of iterations per thread of an innermost parallelized
12173 loop for which the parallelized variant is preferred over the single threaded
12174 one. Note that for a parallelized loop nest the
12175 minimum number of iterations of the outermost loop per thread is two.
12176
12177 @item max-ssa-name-query-depth
12178 Maximum depth of recursion when querying properties of SSA names in things
12179 like fold routines. One level of recursion corresponds to following a
12180 use-def chain.
12181
12182 @item hsa-gen-debug-stores
12183 Enable emission of special debug stores within HSA kernels which are
12184 then read and reported by libgomp plugin. Generation of these stores
12185 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12186 enable it.
12187
12188 @item max-speculative-devirt-maydefs
12189 The maximum number of may-defs we analyze when looking for a must-def
12190 specifying the dynamic type of an object that invokes a virtual call
12191 we may be able to devirtualize speculatively.
12192
12193 @item max-vrp-switch-assertions
12194 The maximum number of assertions to add along the default edge of a switch
12195 statement during VRP.
12196
12197 @item unroll-jam-min-percent
12198 The minimum percentage of memory references that must be optimized
12199 away for the unroll-and-jam transformation to be considered profitable.
12200
12201 @item unroll-jam-max-unroll
12202 The maximum number of times the outer loop should be unrolled by
12203 the unroll-and-jam transformation.
12204
12205 @item max-rtl-if-conversion-unpredictable-cost
12206 Maximum permissible cost for the sequence that would be generated
12207 by the RTL if-conversion pass for a branch that is considered unpredictable.
12208
12209 @item max-variable-expansions-in-unroller
12210 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12211 of times that an individual variable will be expanded during loop unrolling.
12212
12213 @item tracer-min-branch-probability-feedback
12214 Stop forward growth if the probability of best edge is less than
12215 this threshold (in percent). Used when profile feedback is available.
12216
12217 @item partial-inlining-entry-probability
12218 Maximum probability of the entry BB of split region
12219 (in percent relative to entry BB of the function)
12220 to make partial inlining happen.
12221
12222 @item max-tracked-strlens
12223 Maximum number of strings for which strlen optimization pass will
12224 track string lengths.
12225
12226 @item gcse-after-reload-partial-fraction
12227 The threshold ratio for performing partial redundancy
12228 elimination after reload.
12229
12230 @item gcse-after-reload-critical-fraction
12231 The threshold ratio of critical edges execution count that
12232 permit performing redundancy elimination after reload.
12233
12234 @item max-loop-header-insns
12235 The maximum number of insns in loop header duplicated
12236 by the copy loop headers pass.
12237
12238 @item vect-epilogues-nomask
12239 Enable loop epilogue vectorization using smaller vector size.
12240
12241 @item slp-max-insns-in-bb
12242 Maximum number of instructions in basic block to be
12243 considered for SLP vectorization.
12244
12245 @item avoid-fma-max-bits
12246 Maximum number of bits for which we avoid creating FMAs.
12247
12248 @item sms-loop-average-count-threshold
12249 A threshold on the average loop count considered by the swing modulo scheduler.
12250
12251 @item sms-dfa-history
12252 The number of cycles the swing modulo scheduler considers when checking
12253 conflicts using DFA.
12254
12255 @item max-inline-insns-recursive-auto
12256 The maximum number of instructions non-inline function
12257 can grow to via recursive inlining.
12258
12259 @item graphite-allow-codegen-errors
12260 Whether codegen errors should be ICEs when @option{-fchecking}.
12261
12262 @item sms-max-ii-factor
12263 A factor for tuning the upper bound that swing modulo scheduler
12264 uses for scheduling a loop.
12265
12266 @item lra-max-considered-reload-pseudos
12267 The max number of reload pseudos which are considered during
12268 spilling a non-reload pseudo.
12269
12270 @item max-pow-sqrt-depth
12271 Maximum depth of sqrt chains to use when synthesizing exponentiation
12272 by a real constant.
12273
12274 @item max-dse-active-local-stores
12275 Maximum number of active local stores in RTL dead store elimination.
12276
12277 @item asan-instrument-allocas
12278 Enable asan allocas/VLAs protection.
12279
12280 @item max-iterations-computation-cost
12281 Bound on the cost of an expression to compute the number of iterations.
12282
12283 @item max-isl-operations
12284 Maximum number of isl operations, 0 means unlimited.
12285
12286 @item graphite-max-arrays-per-scop
12287 Maximum number of arrays per scop.
12288
12289 @item max-vartrack-reverse-op-size
12290 Max. size of loc list for which reverse ops should be added.
12291
12292 @item tracer-dynamic-coverage-feedback
12293 The percentage of function, weighted by execution frequency,
12294 that must be covered by trace formation.
12295 Used when profile feedback is available.
12296
12297 @item max-inline-recursive-depth-auto
12298 The maximum depth of recursive inlining for non-inline functions.
12299
12300 @item fsm-scale-path-stmts
12301 Scale factor to apply to the number of statements in a threading path
12302 when comparing to the number of (scaled) blocks.
12303
12304 @item fsm-maximum-phi-arguments
12305 Maximum number of arguments a PHI may have before the FSM threader
12306 will not try to thread through its block.
12307
12308 @item uninit-control-dep-attempts
12309 Maximum number of nested calls to search for control dependencies
12310 during uninitialized variable analysis.
12311
12312 @item max-once-peeled-insns
12313 The maximum number of insns of a peeled loop that rolls only once.
12314
12315 @item sra-max-scalarization-size-Osize
12316 Maximum size, in storage units, of an aggregate
12317 which should be considered for scalarization when compiling for size.
12318
12319 @item fsm-scale-path-blocks
12320 Scale factor to apply to the number of blocks in a threading path
12321 when comparing to the number of (scaled) statements.
12322
12323 @item sched-autopref-queue-depth
12324 Hardware autoprefetcher scheduler model control flag.
12325 Number of lookahead cycles the model looks into; at '
12326 ' only enable instruction sorting heuristic.
12327
12328 @item loop-versioning-max-inner-insns
12329 The maximum number of instructions that an inner loop can have
12330 before the loop versioning pass considers it too big to copy.
12331
12332 @item loop-versioning-max-outer-insns
12333 The maximum number of instructions that an outer loop can have
12334 before the loop versioning pass considers it too big to copy,
12335 discounting any instructions in inner loops that directly benefit
12336 from versioning.
12337
12338 @item ssa-name-def-chain-limit
12339 The maximum number of SSA_NAME assignments to follow in determining
12340 a property of a variable such as its value. This limits the number
12341 of iterations or recursive calls GCC performs when optimizing certain
12342 statements or when determining their validity prior to issuing
12343 diagnostics.
12344
12345 @end table
12346 @end table
12347
12348 @node Instrumentation Options
12349 @section Program Instrumentation Options
12350 @cindex instrumentation options
12351 @cindex program instrumentation options
12352 @cindex run-time error checking options
12353 @cindex profiling options
12354 @cindex options, program instrumentation
12355 @cindex options, run-time error checking
12356 @cindex options, profiling
12357
12358 GCC supports a number of command-line options that control adding
12359 run-time instrumentation to the code it normally generates.
12360 For example, one purpose of instrumentation is collect profiling
12361 statistics for use in finding program hot spots, code coverage
12362 analysis, or profile-guided optimizations.
12363 Another class of program instrumentation is adding run-time checking
12364 to detect programming errors like invalid pointer
12365 dereferences or out-of-bounds array accesses, as well as deliberately
12366 hostile attacks such as stack smashing or C++ vtable hijacking.
12367 There is also a general hook which can be used to implement other
12368 forms of tracing or function-level instrumentation for debug or
12369 program analysis purposes.
12370
12371 @table @gcctabopt
12372 @cindex @command{prof}
12373 @cindex @command{gprof}
12374 @item -p
12375 @itemx -pg
12376 @opindex p
12377 @opindex pg
12378 Generate extra code to write profile information suitable for the
12379 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12380 (for @option{-pg}). You must use this option when compiling
12381 the source files you want data about, and you must also use it when
12382 linking.
12383
12384 You can use the function attribute @code{no_instrument_function} to
12385 suppress profiling of individual functions when compiling with these options.
12386 @xref{Common Function Attributes}.
12387
12388 @item -fprofile-arcs
12389 @opindex fprofile-arcs
12390 Add code so that program flow @dfn{arcs} are instrumented. During
12391 execution the program records how many times each branch and call is
12392 executed and how many times it is taken or returns. On targets that support
12393 constructors with priority support, profiling properly handles constructors,
12394 destructors and C++ constructors (and destructors) of classes which are used
12395 as a type of a global variable.
12396
12397 When the compiled
12398 program exits it saves this data to a file called
12399 @file{@var{auxname}.gcda} for each source file. The data may be used for
12400 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12401 test coverage analysis (@option{-ftest-coverage}). Each object file's
12402 @var{auxname} is generated from the name of the output file, if
12403 explicitly specified and it is not the final executable, otherwise it is
12404 the basename of the source file. In both cases any suffix is removed
12405 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12406 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12407 @xref{Cross-profiling}.
12408
12409 @cindex @command{gcov}
12410 @item --coverage
12411 @opindex coverage
12412
12413 This option is used to compile and link code instrumented for coverage
12414 analysis. The option is a synonym for @option{-fprofile-arcs}
12415 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12416 linking). See the documentation for those options for more details.
12417
12418 @itemize
12419
12420 @item
12421 Compile the source files with @option{-fprofile-arcs} plus optimization
12422 and code generation options. For test coverage analysis, use the
12423 additional @option{-ftest-coverage} option. You do not need to profile
12424 every source file in a program.
12425
12426 @item
12427 Compile the source files additionally with @option{-fprofile-abs-path}
12428 to create absolute path names in the @file{.gcno} files. This allows
12429 @command{gcov} to find the correct sources in projects where compilations
12430 occur with different working directories.
12431
12432 @item
12433 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12434 (the latter implies the former).
12435
12436 @item
12437 Run the program on a representative workload to generate the arc profile
12438 information. This may be repeated any number of times. You can run
12439 concurrent instances of your program, and provided that the file system
12440 supports locking, the data files will be correctly updated. Unless
12441 a strict ISO C dialect option is in effect, @code{fork} calls are
12442 detected and correctly handled without double counting.
12443
12444 @item
12445 For profile-directed optimizations, compile the source files again with
12446 the same optimization and code generation options plus
12447 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12448 Control Optimization}).
12449
12450 @item
12451 For test coverage analysis, use @command{gcov} to produce human readable
12452 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12453 @command{gcov} documentation for further information.
12454
12455 @end itemize
12456
12457 With @option{-fprofile-arcs}, for each function of your program GCC
12458 creates a program flow graph, then finds a spanning tree for the graph.
12459 Only arcs that are not on the spanning tree have to be instrumented: the
12460 compiler adds code to count the number of times that these arcs are
12461 executed. When an arc is the only exit or only entrance to a block, the
12462 instrumentation code can be added to the block; otherwise, a new basic
12463 block must be created to hold the instrumentation code.
12464
12465 @need 2000
12466 @item -ftest-coverage
12467 @opindex ftest-coverage
12468 Produce a notes file that the @command{gcov} code-coverage utility
12469 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12470 show program coverage. Each source file's note file is called
12471 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12472 above for a description of @var{auxname} and instructions on how to
12473 generate test coverage data. Coverage data matches the source files
12474 more closely if you do not optimize.
12475
12476 @item -fprofile-abs-path
12477 @opindex fprofile-abs-path
12478 Automatically convert relative source file names to absolute path names
12479 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12480 sources in projects where compilations occur with different working
12481 directories.
12482
12483 @item -fprofile-dir=@var{path}
12484 @opindex fprofile-dir
12485
12486 Set the directory to search for the profile data files in to @var{path}.
12487 This option affects only the profile data generated by
12488 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12489 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12490 and its related options. Both absolute and relative paths can be used.
12491 By default, GCC uses the current directory as @var{path}, thus the
12492 profile data file appears in the same directory as the object file.
12493 In order to prevent the file name clashing, if the object file name is
12494 not an absolute path, we mangle the absolute path of the
12495 @file{@var{sourcename}.gcda} file and use it as the file name of a
12496 @file{.gcda} file. See similar option @option{-fprofile-note}.
12497
12498 When an executable is run in a massive parallel environment, it is recommended
12499 to save profile to different folders. That can be done with variables
12500 in @var{path} that are exported during run-time:
12501
12502 @table @gcctabopt
12503
12504 @item %p
12505 process ID.
12506
12507 @item %q@{VAR@}
12508 value of environment variable @var{VAR}
12509
12510 @end table
12511
12512 @item -fprofile-generate
12513 @itemx -fprofile-generate=@var{path}
12514 @opindex fprofile-generate
12515
12516 Enable options usually used for instrumenting application to produce
12517 profile useful for later recompilation with profile feedback based
12518 optimization. You must use @option{-fprofile-generate} both when
12519 compiling and when linking your program.
12520
12521 The following options are enabled:
12522 @option{-fprofile-arcs}, @option{-fprofile-values},
12523 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12524
12525 If @var{path} is specified, GCC looks at the @var{path} to find
12526 the profile feedback data files. See @option{-fprofile-dir}.
12527
12528 To optimize the program based on the collected profile information, use
12529 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12530
12531 @item -fprofile-note=@var{path}
12532 @opindex fprofile-note
12533
12534 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
12535 location. If you combine the option with multiple source files,
12536 the @file{.gcno} file will be overwritten.
12537
12538 @item -fprofile-update=@var{method}
12539 @opindex fprofile-update
12540
12541 Alter the update method for an application instrumented for profile
12542 feedback based optimization. The @var{method} argument should be one of
12543 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12544 The first one is useful for single-threaded applications,
12545 while the second one prevents profile corruption by emitting thread-safe code.
12546
12547 @strong{Warning:} When an application does not properly join all threads
12548 (or creates an detached thread), a profile file can be still corrupted.
12549
12550 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12551 when supported by a target, or to @samp{single} otherwise. The GCC driver
12552 automatically selects @samp{prefer-atomic} when @option{-pthread}
12553 is present in the command line.
12554
12555 @item -fprofile-filter-files=@var{regex}
12556 @opindex fprofile-filter-files
12557
12558 Instrument only functions from files where names match
12559 any regular expression (separated by a semi-colon).
12560
12561 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12562 only @file{main.c} and all C files starting with 'module'.
12563
12564 @item -fprofile-exclude-files=@var{regex}
12565 @opindex fprofile-exclude-files
12566
12567 Instrument only functions from files where names do not match
12568 all the regular expressions (separated by a semi-colon).
12569
12570 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12571 of all files that are located in @file{/usr/} folder.
12572
12573 @item -fsanitize=address
12574 @opindex fsanitize=address
12575 Enable AddressSanitizer, a fast memory error detector.
12576 Memory access instructions are instrumented to detect
12577 out-of-bounds and use-after-free bugs.
12578 The option enables @option{-fsanitize-address-use-after-scope}.
12579 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12580 more details. The run-time behavior can be influenced using the
12581 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12582 the available options are shown at startup of the instrumented program. See
12583 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12584 for a list of supported options.
12585 The option cannot be combined with @option{-fsanitize=thread}.
12586
12587 @item -fsanitize=kernel-address
12588 @opindex fsanitize=kernel-address
12589 Enable AddressSanitizer for Linux kernel.
12590 See @uref{https://github.com/google/kasan/wiki} for more details.
12591
12592 @item -fsanitize=pointer-compare
12593 @opindex fsanitize=pointer-compare
12594 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12595 The option must be combined with either @option{-fsanitize=kernel-address} or
12596 @option{-fsanitize=address}
12597 The option cannot be combined with @option{-fsanitize=thread}.
12598 Note: By default the check is disabled at run time. To enable it,
12599 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12600 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12601 invalid operation only when both pointers are non-null.
12602
12603 @item -fsanitize=pointer-subtract
12604 @opindex fsanitize=pointer-subtract
12605 Instrument subtraction with pointer operands.
12606 The option must be combined with either @option{-fsanitize=kernel-address} or
12607 @option{-fsanitize=address}
12608 The option cannot be combined with @option{-fsanitize=thread}.
12609 Note: By default the check is disabled at run time. To enable it,
12610 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12611 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12612 invalid operation only when both pointers are non-null.
12613
12614 @item -fsanitize=thread
12615 @opindex fsanitize=thread
12616 Enable ThreadSanitizer, a fast data race detector.
12617 Memory access instructions are instrumented to detect
12618 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12619 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12620 environment variable; see
12621 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12622 supported options.
12623 The option cannot be combined with @option{-fsanitize=address},
12624 @option{-fsanitize=leak}.
12625
12626 Note that sanitized atomic builtins cannot throw exceptions when
12627 operating on invalid memory addresses with non-call exceptions
12628 (@option{-fnon-call-exceptions}).
12629
12630 @item -fsanitize=leak
12631 @opindex fsanitize=leak
12632 Enable LeakSanitizer, a memory leak detector.
12633 This option only matters for linking of executables and
12634 the executable is linked against a library that overrides @code{malloc}
12635 and other allocator functions. See
12636 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12637 details. The run-time behavior can be influenced using the
12638 @env{LSAN_OPTIONS} environment variable.
12639 The option cannot be combined with @option{-fsanitize=thread}.
12640
12641 @item -fsanitize=undefined
12642 @opindex fsanitize=undefined
12643 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12644 Various computations are instrumented to detect undefined behavior
12645 at runtime. Current suboptions are:
12646
12647 @table @gcctabopt
12648
12649 @item -fsanitize=shift
12650 @opindex fsanitize=shift
12651 This option enables checking that the result of a shift operation is
12652 not undefined. Note that what exactly is considered undefined differs
12653 slightly between C and C++, as well as between ISO C90 and C99, etc.
12654 This option has two suboptions, @option{-fsanitize=shift-base} and
12655 @option{-fsanitize=shift-exponent}.
12656
12657 @item -fsanitize=shift-exponent
12658 @opindex fsanitize=shift-exponent
12659 This option enables checking that the second argument of a shift operation
12660 is not negative and is smaller than the precision of the promoted first
12661 argument.
12662
12663 @item -fsanitize=shift-base
12664 @opindex fsanitize=shift-base
12665 If the second argument of a shift operation is within range, check that the
12666 result of a shift operation is not undefined. Note that what exactly is
12667 considered undefined differs slightly between C and C++, as well as between
12668 ISO C90 and C99, etc.
12669
12670 @item -fsanitize=integer-divide-by-zero
12671 @opindex fsanitize=integer-divide-by-zero
12672 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12673
12674 @item -fsanitize=unreachable
12675 @opindex fsanitize=unreachable
12676 With this option, the compiler turns the @code{__builtin_unreachable}
12677 call into a diagnostics message call instead. When reaching the
12678 @code{__builtin_unreachable} call, the behavior is undefined.
12679
12680 @item -fsanitize=vla-bound
12681 @opindex fsanitize=vla-bound
12682 This option instructs the compiler to check that the size of a variable
12683 length array is positive.
12684
12685 @item -fsanitize=null
12686 @opindex fsanitize=null
12687 This option enables pointer checking. Particularly, the application
12688 built with this option turned on will issue an error message when it
12689 tries to dereference a NULL pointer, or if a reference (possibly an
12690 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12691 on an object pointed by a NULL pointer.
12692
12693 @item -fsanitize=return
12694 @opindex fsanitize=return
12695 This option enables return statement checking. Programs
12696 built with this option turned on will issue an error message
12697 when the end of a non-void function is reached without actually
12698 returning a value. This option works in C++ only.
12699
12700 @item -fsanitize=signed-integer-overflow
12701 @opindex fsanitize=signed-integer-overflow
12702 This option enables signed integer overflow checking. We check that
12703 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12704 does not overflow in the signed arithmetics. Note, integer promotion
12705 rules must be taken into account. That is, the following is not an
12706 overflow:
12707 @smallexample
12708 signed char a = SCHAR_MAX;
12709 a++;
12710 @end smallexample
12711
12712 @item -fsanitize=bounds
12713 @opindex fsanitize=bounds
12714 This option enables instrumentation of array bounds. Various out of bounds
12715 accesses are detected. Flexible array members, flexible array member-like
12716 arrays, and initializers of variables with static storage are not instrumented.
12717
12718 @item -fsanitize=bounds-strict
12719 @opindex fsanitize=bounds-strict
12720 This option enables strict instrumentation of array bounds. Most out of bounds
12721 accesses are detected, including flexible array members and flexible array
12722 member-like arrays. Initializers of variables with static storage are not
12723 instrumented.
12724
12725 @item -fsanitize=alignment
12726 @opindex fsanitize=alignment
12727
12728 This option enables checking of alignment of pointers when they are
12729 dereferenced, or when a reference is bound to insufficiently aligned target,
12730 or when a method or constructor is invoked on insufficiently aligned object.
12731
12732 @item -fsanitize=object-size
12733 @opindex fsanitize=object-size
12734 This option enables instrumentation of memory references using the
12735 @code{__builtin_object_size} function. Various out of bounds pointer
12736 accesses are detected.
12737
12738 @item -fsanitize=float-divide-by-zero
12739 @opindex fsanitize=float-divide-by-zero
12740 Detect floating-point division by zero. Unlike other similar options,
12741 @option{-fsanitize=float-divide-by-zero} is not enabled by
12742 @option{-fsanitize=undefined}, since floating-point division by zero can
12743 be a legitimate way of obtaining infinities and NaNs.
12744
12745 @item -fsanitize=float-cast-overflow
12746 @opindex fsanitize=float-cast-overflow
12747 This option enables floating-point type to integer conversion checking.
12748 We check that the result of the conversion does not overflow.
12749 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12750 not enabled by @option{-fsanitize=undefined}.
12751 This option does not work well with @code{FE_INVALID} exceptions enabled.
12752
12753 @item -fsanitize=nonnull-attribute
12754 @opindex fsanitize=nonnull-attribute
12755
12756 This option enables instrumentation of calls, checking whether null values
12757 are not passed to arguments marked as requiring a non-null value by the
12758 @code{nonnull} function attribute.
12759
12760 @item -fsanitize=returns-nonnull-attribute
12761 @opindex fsanitize=returns-nonnull-attribute
12762
12763 This option enables instrumentation of return statements in functions
12764 marked with @code{returns_nonnull} function attribute, to detect returning
12765 of null values from such functions.
12766
12767 @item -fsanitize=bool
12768 @opindex fsanitize=bool
12769
12770 This option enables instrumentation of loads from bool. If a value other
12771 than 0/1 is loaded, a run-time error is issued.
12772
12773 @item -fsanitize=enum
12774 @opindex fsanitize=enum
12775
12776 This option enables instrumentation of loads from an enum type. If
12777 a value outside the range of values for the enum type is loaded,
12778 a run-time error is issued.
12779
12780 @item -fsanitize=vptr
12781 @opindex fsanitize=vptr
12782
12783 This option enables instrumentation of C++ member function calls, member
12784 accesses and some conversions between pointers to base and derived classes,
12785 to verify the referenced object has the correct dynamic type.
12786
12787 @item -fsanitize=pointer-overflow
12788 @opindex fsanitize=pointer-overflow
12789
12790 This option enables instrumentation of pointer arithmetics. If the pointer
12791 arithmetics overflows, a run-time error is issued.
12792
12793 @item -fsanitize=builtin
12794 @opindex fsanitize=builtin
12795
12796 This option enables instrumentation of arguments to selected builtin
12797 functions. If an invalid value is passed to such arguments, a run-time
12798 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12799 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12800 by this option.
12801
12802 @end table
12803
12804 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12805 @option{-fsanitize=undefined} gives a diagnostic message.
12806 This currently works only for the C family of languages.
12807
12808 @item -fno-sanitize=all
12809 @opindex fno-sanitize=all
12810
12811 This option disables all previously enabled sanitizers.
12812 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12813 together.
12814
12815 @item -fasan-shadow-offset=@var{number}
12816 @opindex fasan-shadow-offset
12817 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12818 It is useful for experimenting with different shadow memory layouts in
12819 Kernel AddressSanitizer.
12820
12821 @item -fsanitize-sections=@var{s1},@var{s2},...
12822 @opindex fsanitize-sections
12823 Sanitize global variables in selected user-defined sections. @var{si} may
12824 contain wildcards.
12825
12826 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12827 @opindex fsanitize-recover
12828 @opindex fno-sanitize-recover
12829 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12830 mentioned in comma-separated list of @var{opts}. Enabling this option
12831 for a sanitizer component causes it to attempt to continue
12832 running the program as if no error happened. This means multiple
12833 runtime errors can be reported in a single program run, and the exit
12834 code of the program may indicate success even when errors
12835 have been reported. The @option{-fno-sanitize-recover=} option
12836 can be used to alter
12837 this behavior: only the first detected error is reported
12838 and program then exits with a non-zero exit code.
12839
12840 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12841 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12842 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12843 @option{-fsanitize=bounds-strict},
12844 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12845 For these sanitizers error recovery is turned on by default,
12846 except @option{-fsanitize=address}, for which this feature is experimental.
12847 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12848 accepted, the former enables recovery for all sanitizers that support it,
12849 the latter disables recovery for all sanitizers that support it.
12850
12851 Even if a recovery mode is turned on the compiler side, it needs to be also
12852 enabled on the runtime library side, otherwise the failures are still fatal.
12853 The runtime library defaults to @code{halt_on_error=0} for
12854 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12855 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12856 setting the @code{halt_on_error} flag in the corresponding environment variable.
12857
12858 Syntax without an explicit @var{opts} parameter is deprecated. It is
12859 equivalent to specifying an @var{opts} list of:
12860
12861 @smallexample
12862 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12863 @end smallexample
12864
12865 @item -fsanitize-address-use-after-scope
12866 @opindex fsanitize-address-use-after-scope
12867 Enable sanitization of local variables to detect use-after-scope bugs.
12868 The option sets @option{-fstack-reuse} to @samp{none}.
12869
12870 @item -fsanitize-undefined-trap-on-error
12871 @opindex fsanitize-undefined-trap-on-error
12872 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12873 report undefined behavior using @code{__builtin_trap} rather than
12874 a @code{libubsan} library routine. The advantage of this is that the
12875 @code{libubsan} library is not needed and is not linked in, so this
12876 is usable even in freestanding environments.
12877
12878 @item -fsanitize-coverage=trace-pc
12879 @opindex fsanitize-coverage=trace-pc
12880 Enable coverage-guided fuzzing code instrumentation.
12881 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12882
12883 @item -fsanitize-coverage=trace-cmp
12884 @opindex fsanitize-coverage=trace-cmp
12885 Enable dataflow guided fuzzing code instrumentation.
12886 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12887 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12888 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12889 variable or @code{__sanitizer_cov_trace_const_cmp1},
12890 @code{__sanitizer_cov_trace_const_cmp2},
12891 @code{__sanitizer_cov_trace_const_cmp4} or
12892 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12893 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12894 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12895 @code{__sanitizer_cov_trace_switch} for switch statements.
12896
12897 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12898 @opindex fcf-protection
12899 Enable code instrumentation of control-flow transfers to increase
12900 program security by checking that target addresses of control-flow
12901 transfer instructions (such as indirect function call, function return,
12902 indirect jump) are valid. This prevents diverting the flow of control
12903 to an unexpected target. This is intended to protect against such
12904 threats as Return-oriented Programming (ROP), and similarly
12905 call/jmp-oriented programming (COP/JOP).
12906
12907 The value @code{branch} tells the compiler to implement checking of
12908 validity of control-flow transfer at the point of indirect branch
12909 instructions, i.e.@: call/jmp instructions. The value @code{return}
12910 implements checking of validity at the point of returning from a
12911 function. The value @code{full} is an alias for specifying both
12912 @code{branch} and @code{return}. The value @code{none} turns off
12913 instrumentation.
12914
12915 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12916 used. The first bit of @code{__CET__} is set to 1 for the value
12917 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12918 the @code{return}.
12919
12920 You can also use the @code{nocf_check} attribute to identify
12921 which functions and calls should be skipped from instrumentation
12922 (@pxref{Function Attributes}).
12923
12924 Currently the x86 GNU/Linux target provides an implementation based
12925 on Intel Control-flow Enforcement Technology (CET).
12926
12927 @item -fstack-protector
12928 @opindex fstack-protector
12929 Emit extra code to check for buffer overflows, such as stack smashing
12930 attacks. This is done by adding a guard variable to functions with
12931 vulnerable objects. This includes functions that call @code{alloca}, and
12932 functions with buffers larger than 8 bytes. The guards are initialized
12933 when a function is entered and then checked when the function exits.
12934 If a guard check fails, an error message is printed and the program exits.
12935
12936 @item -fstack-protector-all
12937 @opindex fstack-protector-all
12938 Like @option{-fstack-protector} except that all functions are protected.
12939
12940 @item -fstack-protector-strong
12941 @opindex fstack-protector-strong
12942 Like @option{-fstack-protector} but includes additional functions to
12943 be protected --- those that have local array definitions, or have
12944 references to local frame addresses.
12945
12946 @item -fstack-protector-explicit
12947 @opindex fstack-protector-explicit
12948 Like @option{-fstack-protector} but only protects those functions which
12949 have the @code{stack_protect} attribute.
12950
12951 @item -fstack-check
12952 @opindex fstack-check
12953 Generate code to verify that you do not go beyond the boundary of the
12954 stack. You should specify this flag if you are running in an
12955 environment with multiple threads, but you only rarely need to specify it in
12956 a single-threaded environment since stack overflow is automatically
12957 detected on nearly all systems if there is only one stack.
12958
12959 Note that this switch does not actually cause checking to be done; the
12960 operating system or the language runtime must do that. The switch causes
12961 generation of code to ensure that they see the stack being extended.
12962
12963 You can additionally specify a string parameter: @samp{no} means no
12964 checking, @samp{generic} means force the use of old-style checking,
12965 @samp{specific} means use the best checking method and is equivalent
12966 to bare @option{-fstack-check}.
12967
12968 Old-style checking is a generic mechanism that requires no specific
12969 target support in the compiler but comes with the following drawbacks:
12970
12971 @enumerate
12972 @item
12973 Modified allocation strategy for large objects: they are always
12974 allocated dynamically if their size exceeds a fixed threshold. Note this
12975 may change the semantics of some code.
12976
12977 @item
12978 Fixed limit on the size of the static frame of functions: when it is
12979 topped by a particular function, stack checking is not reliable and
12980 a warning is issued by the compiler.
12981
12982 @item
12983 Inefficiency: because of both the modified allocation strategy and the
12984 generic implementation, code performance is hampered.
12985 @end enumerate
12986
12987 Note that old-style stack checking is also the fallback method for
12988 @samp{specific} if no target support has been added in the compiler.
12989
12990 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12991 and stack overflows. @samp{specific} is an excellent choice when compiling
12992 Ada code. It is not generally sufficient to protect against stack-clash
12993 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12994
12995 @item -fstack-clash-protection
12996 @opindex fstack-clash-protection
12997 Generate code to prevent stack clash style attacks. When this option is
12998 enabled, the compiler will only allocate one page of stack space at a time
12999 and each page is accessed immediately after allocation. Thus, it prevents
13000 allocations from jumping over any stack guard page provided by the
13001 operating system.
13002
13003 Most targets do not fully support stack clash protection. However, on
13004 those targets @option{-fstack-clash-protection} will protect dynamic stack
13005 allocations. @option{-fstack-clash-protection} may also provide limited
13006 protection for static stack allocations if the target supports
13007 @option{-fstack-check=specific}.
13008
13009 @item -fstack-limit-register=@var{reg}
13010 @itemx -fstack-limit-symbol=@var{sym}
13011 @itemx -fno-stack-limit
13012 @opindex fstack-limit-register
13013 @opindex fstack-limit-symbol
13014 @opindex fno-stack-limit
13015 Generate code to ensure that the stack does not grow beyond a certain value,
13016 either the value of a register or the address of a symbol. If a larger
13017 stack is required, a signal is raised at run time. For most targets,
13018 the signal is raised before the stack overruns the boundary, so
13019 it is possible to catch the signal without taking special precautions.
13020
13021 For instance, if the stack starts at absolute address @samp{0x80000000}
13022 and grows downwards, you can use the flags
13023 @option{-fstack-limit-symbol=__stack_limit} and
13024 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
13025 of 128KB@. Note that this may only work with the GNU linker.
13026
13027 You can locally override stack limit checking by using the
13028 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
13029
13030 @item -fsplit-stack
13031 @opindex fsplit-stack
13032 Generate code to automatically split the stack before it overflows.
13033 The resulting program has a discontiguous stack which can only
13034 overflow if the program is unable to allocate any more memory. This
13035 is most useful when running threaded programs, as it is no longer
13036 necessary to calculate a good stack size to use for each thread. This
13037 is currently only implemented for the x86 targets running
13038 GNU/Linux.
13039
13040 When code compiled with @option{-fsplit-stack} calls code compiled
13041 without @option{-fsplit-stack}, there may not be much stack space
13042 available for the latter code to run. If compiling all code,
13043 including library code, with @option{-fsplit-stack} is not an option,
13044 then the linker can fix up these calls so that the code compiled
13045 without @option{-fsplit-stack} always has a large stack. Support for
13046 this is implemented in the gold linker in GNU binutils release 2.21
13047 and later.
13048
13049 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
13050 @opindex fvtable-verify
13051 This option is only available when compiling C++ code.
13052 It turns on (or off, if using @option{-fvtable-verify=none}) the security
13053 feature that verifies at run time, for every virtual call, that
13054 the vtable pointer through which the call is made is valid for the type of
13055 the object, and has not been corrupted or overwritten. If an invalid vtable
13056 pointer is detected at run time, an error is reported and execution of the
13057 program is immediately halted.
13058
13059 This option causes run-time data structures to be built at program startup,
13060 which are used for verifying the vtable pointers.
13061 The options @samp{std} and @samp{preinit}
13062 control the timing of when these data structures are built. In both cases the
13063 data structures are built before execution reaches @code{main}. Using
13064 @option{-fvtable-verify=std} causes the data structures to be built after
13065 shared libraries have been loaded and initialized.
13066 @option{-fvtable-verify=preinit} causes them to be built before shared
13067 libraries have been loaded and initialized.
13068
13069 If this option appears multiple times in the command line with different
13070 values specified, @samp{none} takes highest priority over both @samp{std} and
13071 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
13072
13073 @item -fvtv-debug
13074 @opindex fvtv-debug
13075 When used in conjunction with @option{-fvtable-verify=std} or
13076 @option{-fvtable-verify=preinit}, causes debug versions of the
13077 runtime functions for the vtable verification feature to be called.
13078 This flag also causes the compiler to log information about which
13079 vtable pointers it finds for each class.
13080 This information is written to a file named @file{vtv_set_ptr_data.log}
13081 in the directory named by the environment variable @env{VTV_LOGS_DIR}
13082 if that is defined or the current working directory otherwise.
13083
13084 Note: This feature @emph{appends} data to the log file. If you want a fresh log
13085 file, be sure to delete any existing one.
13086
13087 @item -fvtv-counts
13088 @opindex fvtv-counts
13089 This is a debugging flag. When used in conjunction with
13090 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
13091 causes the compiler to keep track of the total number of virtual calls
13092 it encounters and the number of verifications it inserts. It also
13093 counts the number of calls to certain run-time library functions
13094 that it inserts and logs this information for each compilation unit.
13095 The compiler writes this information to a file named
13096 @file{vtv_count_data.log} in the directory named by the environment
13097 variable @env{VTV_LOGS_DIR} if that is defined or the current working
13098 directory otherwise. It also counts the size of the vtable pointer sets
13099 for each class, and writes this information to @file{vtv_class_set_sizes.log}
13100 in the same directory.
13101
13102 Note: This feature @emph{appends} data to the log files. To get fresh log
13103 files, be sure to delete any existing ones.
13104
13105 @item -finstrument-functions
13106 @opindex finstrument-functions
13107 Generate instrumentation calls for entry and exit to functions. Just
13108 after function entry and just before function exit, the following
13109 profiling functions are called with the address of the current
13110 function and its call site. (On some platforms,
13111 @code{__builtin_return_address} does not work beyond the current
13112 function, so the call site information may not be available to the
13113 profiling functions otherwise.)
13114
13115 @smallexample
13116 void __cyg_profile_func_enter (void *this_fn,
13117 void *call_site);
13118 void __cyg_profile_func_exit (void *this_fn,
13119 void *call_site);
13120 @end smallexample
13121
13122 The first argument is the address of the start of the current function,
13123 which may be looked up exactly in the symbol table.
13124
13125 This instrumentation is also done for functions expanded inline in other
13126 functions. The profiling calls indicate where, conceptually, the
13127 inline function is entered and exited. This means that addressable
13128 versions of such functions must be available. If all your uses of a
13129 function are expanded inline, this may mean an additional expansion of
13130 code size. If you use @code{extern inline} in your C code, an
13131 addressable version of such functions must be provided. (This is
13132 normally the case anyway, but if you get lucky and the optimizer always
13133 expands the functions inline, you might have gotten away without
13134 providing static copies.)
13135
13136 A function may be given the attribute @code{no_instrument_function}, in
13137 which case this instrumentation is not done. This can be used, for
13138 example, for the profiling functions listed above, high-priority
13139 interrupt routines, and any functions from which the profiling functions
13140 cannot safely be called (perhaps signal handlers, if the profiling
13141 routines generate output or allocate memory).
13142 @xref{Common Function Attributes}.
13143
13144 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13145 @opindex finstrument-functions-exclude-file-list
13146
13147 Set the list of functions that are excluded from instrumentation (see
13148 the description of @option{-finstrument-functions}). If the file that
13149 contains a function definition matches with one of @var{file}, then
13150 that function is not instrumented. The match is done on substrings:
13151 if the @var{file} parameter is a substring of the file name, it is
13152 considered to be a match.
13153
13154 For example:
13155
13156 @smallexample
13157 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13158 @end smallexample
13159
13160 @noindent
13161 excludes any inline function defined in files whose pathnames
13162 contain @file{/bits/stl} or @file{include/sys}.
13163
13164 If, for some reason, you want to include letter @samp{,} in one of
13165 @var{sym}, write @samp{\,}. For example,
13166 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13167 (note the single quote surrounding the option).
13168
13169 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13170 @opindex finstrument-functions-exclude-function-list
13171
13172 This is similar to @option{-finstrument-functions-exclude-file-list},
13173 but this option sets the list of function names to be excluded from
13174 instrumentation. The function name to be matched is its user-visible
13175 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13176 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13177 match is done on substrings: if the @var{sym} parameter is a substring
13178 of the function name, it is considered to be a match. For C99 and C++
13179 extended identifiers, the function name must be given in UTF-8, not
13180 using universal character names.
13181
13182 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13183 @opindex fpatchable-function-entry
13184 Generate @var{N} NOPs right at the beginning
13185 of each function, with the function entry point before the @var{M}th NOP.
13186 If @var{M} is omitted, it defaults to @code{0} so the
13187 function entry points to the address just at the first NOP.
13188 The NOP instructions reserve extra space which can be used to patch in
13189 any desired instrumentation at run time, provided that the code segment
13190 is writable. The amount of space is controllable indirectly via
13191 the number of NOPs; the NOP instruction used corresponds to the instruction
13192 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13193 is target-specific and may also depend on the architecture variant and/or
13194 other compilation options.
13195
13196 For run-time identification, the starting addresses of these areas,
13197 which correspond to their respective function entries minus @var{M},
13198 are additionally collected in the @code{__patchable_function_entries}
13199 section of the resulting binary.
13200
13201 Note that the value of @code{__attribute__ ((patchable_function_entry
13202 (N,M)))} takes precedence over command-line option
13203 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13204 the area size or to remove it completely on a single function.
13205 If @code{N=0}, no pad location is recorded.
13206
13207 The NOP instructions are inserted at---and maybe before, depending on
13208 @var{M}---the function entry address, even before the prologue.
13209
13210 @end table
13211
13212
13213 @node Preprocessor Options
13214 @section Options Controlling the Preprocessor
13215 @cindex preprocessor options
13216 @cindex options, preprocessor
13217
13218 These options control the C preprocessor, which is run on each C source
13219 file before actual compilation.
13220
13221 If you use the @option{-E} option, nothing is done except preprocessing.
13222 Some of these options make sense only together with @option{-E} because
13223 they cause the preprocessor output to be unsuitable for actual
13224 compilation.
13225
13226 In addition to the options listed here, there are a number of options
13227 to control search paths for include files documented in
13228 @ref{Directory Options}.
13229 Options to control preprocessor diagnostics are listed in
13230 @ref{Warning Options}.
13231
13232 @table @gcctabopt
13233 @include cppopts.texi
13234
13235 @item -Wp,@var{option}
13236 @opindex Wp
13237 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13238 and pass @var{option} directly through to the preprocessor. If
13239 @var{option} contains commas, it is split into multiple options at the
13240 commas. However, many options are modified, translated or interpreted
13241 by the compiler driver before being passed to the preprocessor, and
13242 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13243 interface is undocumented and subject to change, so whenever possible
13244 you should avoid using @option{-Wp} and let the driver handle the
13245 options instead.
13246
13247 @item -Xpreprocessor @var{option}
13248 @opindex Xpreprocessor
13249 Pass @var{option} as an option to the preprocessor. You can use this to
13250 supply system-specific preprocessor options that GCC does not
13251 recognize.
13252
13253 If you want to pass an option that takes an argument, you must use
13254 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13255
13256 @item -no-integrated-cpp
13257 @opindex no-integrated-cpp
13258 Perform preprocessing as a separate pass before compilation.
13259 By default, GCC performs preprocessing as an integrated part of
13260 input tokenization and parsing.
13261 If this option is provided, the appropriate language front end
13262 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13263 and Objective-C, respectively) is instead invoked twice,
13264 once for preprocessing only and once for actual compilation
13265 of the preprocessed input.
13266 This option may be useful in conjunction with the @option{-B} or
13267 @option{-wrapper} options to specify an alternate preprocessor or
13268 perform additional processing of the program source between
13269 normal preprocessing and compilation.
13270
13271 @end table
13272
13273 @node Assembler Options
13274 @section Passing Options to the Assembler
13275
13276 @c prevent bad page break with this line
13277 You can pass options to the assembler.
13278
13279 @table @gcctabopt
13280 @item -Wa,@var{option}
13281 @opindex Wa
13282 Pass @var{option} as an option to the assembler. If @var{option}
13283 contains commas, it is split into multiple options at the commas.
13284
13285 @item -Xassembler @var{option}
13286 @opindex Xassembler
13287 Pass @var{option} as an option to the assembler. You can use this to
13288 supply system-specific assembler options that GCC does not
13289 recognize.
13290
13291 If you want to pass an option that takes an argument, you must use
13292 @option{-Xassembler} twice, once for the option and once for the argument.
13293
13294 @end table
13295
13296 @node Link Options
13297 @section Options for Linking
13298 @cindex link options
13299 @cindex options, linking
13300
13301 These options come into play when the compiler links object files into
13302 an executable output file. They are meaningless if the compiler is
13303 not doing a link step.
13304
13305 @table @gcctabopt
13306 @cindex file names
13307 @item @var{object-file-name}
13308 A file name that does not end in a special recognized suffix is
13309 considered to name an object file or library. (Object files are
13310 distinguished from libraries by the linker according to the file
13311 contents.) If linking is done, these object files are used as input
13312 to the linker.
13313
13314 @item -c
13315 @itemx -S
13316 @itemx -E
13317 @opindex c
13318 @opindex S
13319 @opindex E
13320 If any of these options is used, then the linker is not run, and
13321 object file names should not be used as arguments. @xref{Overall
13322 Options}.
13323
13324 @item -flinker-output=@var{type}
13325 @opindex flinker-output
13326 This option controls code generation of the link-time optimizer. By
13327 default the linker output is automatically determined by the linker
13328 plugin. For debugging the compiler and if incremental linking with a
13329 non-LTO object file is desired, it may be useful to control the type
13330 manually.
13331
13332 If @var{type} is @samp{exec}, code generation produces a static
13333 binary. In this case @option{-fpic} and @option{-fpie} are both
13334 disabled.
13335
13336 If @var{type} is @samp{dyn}, code generation produces a shared
13337 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13338 but not enabled automatically. This allows to build shared libraries
13339 without position-independent code on architectures where this is
13340 possible, i.e.@: on x86.
13341
13342 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
13343 executable. This results in similar optimizations as @samp{exec}
13344 except that @option{-fpie} is not disabled if specified at compilation
13345 time.
13346
13347 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
13348 done. The sections containing intermediate code for link-time optimization are
13349 merged, pre-optimized, and output to the resulting object file. In addition, if
13350 @option{-ffat-lto-objects} is specified, binary code is produced for future
13351 non-LTO linking. The object file produced by incremental linking is smaller
13352 than a static library produced from the same object files. At link time the
13353 result of incremental linking also loads faster than a static
13354 library assuming that the majority of objects in the library are used.
13355
13356 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13357 code generation is forced, a final binary is produced, and the intermediate
13358 code for later link-time optimization is stripped. When multiple object files
13359 are linked together the resulting code is better optimized than with
13360 link-time optimizations disabled (for example, cross-module inlining
13361 happens), but most of benefits of whole program optimizations are lost.
13362
13363 During the incremental link (by @option{-r}) the linker plugin defaults to
13364 @option{rel}. With current interfaces to GNU Binutils it is however not
13365 possible to incrementally link LTO objects and non-LTO objects into a single
13366 mixed object file. If any of object files in incremental link cannot
13367 be used for link-time optimization, the linker plugin issues a warning and
13368 uses @samp{nolto-rel}. To maintain whole program optimization, it is
13369 recommended to link such objects into static library instead. Alternatively it
13370 is possible to use H.J. Lu's binutils with support for mixed objects.
13371
13372 @item -fuse-ld=bfd
13373 @opindex fuse-ld=bfd
13374 Use the @command{bfd} linker instead of the default linker.
13375
13376 @item -fuse-ld=gold
13377 @opindex fuse-ld=gold
13378 Use the @command{gold} linker instead of the default linker.
13379
13380 @item -fuse-ld=lld
13381 @opindex fuse-ld=lld
13382 Use the LLVM @command{lld} linker instead of the default linker.
13383
13384 @cindex Libraries
13385 @item -l@var{library}
13386 @itemx -l @var{library}
13387 @opindex l
13388 Search the library named @var{library} when linking. (The second
13389 alternative with the library as a separate argument is only for
13390 POSIX compliance and is not recommended.)
13391
13392 The @option{-l} option is passed directly to the linker by GCC. Refer
13393 to your linker documentation for exact details. The general
13394 description below applies to the GNU linker.
13395
13396 The linker searches a standard list of directories for the library.
13397 The directories searched include several standard system directories
13398 plus any that you specify with @option{-L}.
13399
13400 Static libraries are archives of object files, and have file names
13401 like @file{lib@var{library}.a}. Some targets also support shared
13402 libraries, which typically have names like @file{lib@var{library}.so}.
13403 If both static and shared libraries are found, the linker gives
13404 preference to linking with the shared library unless the
13405 @option{-static} option is used.
13406
13407 It makes a difference where in the command you write this option; the
13408 linker searches and processes libraries and object files in the order they
13409 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13410 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13411 to functions in @samp{z}, those functions may not be loaded.
13412
13413 @item -lobjc
13414 @opindex lobjc
13415 You need this special case of the @option{-l} option in order to
13416 link an Objective-C or Objective-C++ program.
13417
13418 @item -nostartfiles
13419 @opindex nostartfiles
13420 Do not use the standard system startup files when linking.
13421 The standard system libraries are used normally, unless @option{-nostdlib},
13422 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13423
13424 @item -nodefaultlibs
13425 @opindex nodefaultlibs
13426 Do not use the standard system libraries when linking.
13427 Only the libraries you specify are passed to the linker, and options
13428 specifying linkage of the system libraries, such as @option{-static-libgcc}
13429 or @option{-shared-libgcc}, are ignored.
13430 The standard startup files are used normally, unless @option{-nostartfiles}
13431 is used.
13432
13433 The compiler may generate calls to @code{memcmp},
13434 @code{memset}, @code{memcpy} and @code{memmove}.
13435 These entries are usually resolved by entries in
13436 libc. These entry points should be supplied through some other
13437 mechanism when this option is specified.
13438
13439 @item -nolibc
13440 @opindex nolibc
13441 Do not use the C library or system libraries tightly coupled with it when
13442 linking. Still link with the startup files, @file{libgcc} or toolchain
13443 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13444 or @file{libstdc++} unless options preventing their inclusion are used as
13445 well. This typically removes @option{-lc} from the link command line, as well
13446 as system libraries that normally go with it and become meaningless when
13447 absence of a C library is assumed, for example @option{-lpthread} or
13448 @option{-lm} in some configurations. This is intended for bare-board
13449 targets when there is indeed no C library available.
13450
13451 @item -nostdlib
13452 @opindex nostdlib
13453 Do not use the standard system startup files or libraries when linking.
13454 No startup files and only the libraries you specify are passed to
13455 the linker, and options specifying linkage of the system libraries, such as
13456 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13457
13458 The compiler may generate calls to @code{memcmp}, @code{memset},
13459 @code{memcpy} and @code{memmove}.
13460 These entries are usually resolved by entries in
13461 libc. These entry points should be supplied through some other
13462 mechanism when this option is specified.
13463
13464 @cindex @option{-lgcc}, use with @option{-nostdlib}
13465 @cindex @option{-nostdlib} and unresolved references
13466 @cindex unresolved references and @option{-nostdlib}
13467 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13468 @cindex @option{-nodefaultlibs} and unresolved references
13469 @cindex unresolved references and @option{-nodefaultlibs}
13470 One of the standard libraries bypassed by @option{-nostdlib} and
13471 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13472 which GCC uses to overcome shortcomings of particular machines, or special
13473 needs for some languages.
13474 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13475 Collection (GCC) Internals},
13476 for more discussion of @file{libgcc.a}.)
13477 In most cases, you need @file{libgcc.a} even when you want to avoid
13478 other standard libraries. In other words, when you specify @option{-nostdlib}
13479 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13480 This ensures that you have no unresolved references to internal GCC
13481 library subroutines.
13482 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13483 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13484 GNU Compiler Collection (GCC) Internals}.)
13485
13486 @item -e @var{entry}
13487 @itemx --entry=@var{entry}
13488 @opindex e
13489 @opindex entry
13490
13491 Specify that the program entry point is @var{entry}. The argument is
13492 interpreted by the linker; the GNU linker accepts either a symbol name
13493 or an address.
13494
13495 @item -pie
13496 @opindex pie
13497 Produce a dynamically linked position independent executable on targets
13498 that support it. For predictable results, you must also specify the same
13499 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13500 or model suboptions) when you specify this linker option.
13501
13502 @item -no-pie
13503 @opindex no-pie
13504 Don't produce a dynamically linked position independent executable.
13505
13506 @item -static-pie
13507 @opindex static-pie
13508 Produce a static position independent executable on targets that support
13509 it. A static position independent executable is similar to a static
13510 executable, but can be loaded at any address without a dynamic linker.
13511 For predictable results, you must also specify the same set of options
13512 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13513 suboptions) when you specify this linker option.
13514
13515 @item -pthread
13516 @opindex pthread
13517 Link with the POSIX threads library. This option is supported on
13518 GNU/Linux targets, most other Unix derivatives, and also on
13519 x86 Cygwin and MinGW targets. On some targets this option also sets
13520 flags for the preprocessor, so it should be used consistently for both
13521 compilation and linking.
13522
13523 @item -r
13524 @opindex r
13525 Produce a relocatable object as output. This is also known as partial
13526 linking.
13527
13528 @item -rdynamic
13529 @opindex rdynamic
13530 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13531 that support it. This instructs the linker to add all symbols, not
13532 only used ones, to the dynamic symbol table. This option is needed
13533 for some uses of @code{dlopen} or to allow obtaining backtraces
13534 from within a program.
13535
13536 @item -s
13537 @opindex s
13538 Remove all symbol table and relocation information from the executable.
13539
13540 @item -static
13541 @opindex static
13542 On systems that support dynamic linking, this overrides @option{-pie}
13543 and prevents linking with the shared libraries. On other systems, this
13544 option has no effect.
13545
13546 @item -shared
13547 @opindex shared
13548 Produce a shared object which can then be linked with other objects to
13549 form an executable. Not all systems support this option. For predictable
13550 results, you must also specify the same set of options used for compilation
13551 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13552 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13553 needs to build supplementary stub code for constructors to work. On
13554 multi-libbed systems, @samp{gcc -shared} must select the correct support
13555 libraries to link against. Failing to supply the correct flags may lead
13556 to subtle defects. Supplying them in cases where they are not necessary
13557 is innocuous.}
13558
13559 @item -shared-libgcc
13560 @itemx -static-libgcc
13561 @opindex shared-libgcc
13562 @opindex static-libgcc
13563 On systems that provide @file{libgcc} as a shared library, these options
13564 force the use of either the shared or static version, respectively.
13565 If no shared version of @file{libgcc} was built when the compiler was
13566 configured, these options have no effect.
13567
13568 There are several situations in which an application should use the
13569 shared @file{libgcc} instead of the static version. The most common
13570 of these is when the application wishes to throw and catch exceptions
13571 across different shared libraries. In that case, each of the libraries
13572 as well as the application itself should use the shared @file{libgcc}.
13573
13574 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13575 whenever you build a shared library or a main executable, because C++
13576 programs typically use exceptions, so this is the right thing to do.
13577
13578 If, instead, you use the GCC driver to create shared libraries, you may
13579 find that they are not always linked with the shared @file{libgcc}.
13580 If GCC finds, at its configuration time, that you have a non-GNU linker
13581 or a GNU linker that does not support option @option{--eh-frame-hdr},
13582 it links the shared version of @file{libgcc} into shared libraries
13583 by default. Otherwise, it takes advantage of the linker and optimizes
13584 away the linking with the shared version of @file{libgcc}, linking with
13585 the static version of libgcc by default. This allows exceptions to
13586 propagate through such shared libraries, without incurring relocation
13587 costs at library load time.
13588
13589 However, if a library or main executable is supposed to throw or catch
13590 exceptions, you must link it using the G++ driver, or using the option
13591 @option{-shared-libgcc}, such that it is linked with the shared
13592 @file{libgcc}.
13593
13594 @item -static-libasan
13595 @opindex static-libasan
13596 When the @option{-fsanitize=address} option is used to link a program,
13597 the GCC driver automatically links against @option{libasan}. If
13598 @file{libasan} is available as a shared library, and the @option{-static}
13599 option is not used, then this links against the shared version of
13600 @file{libasan}. The @option{-static-libasan} option directs the GCC
13601 driver to link @file{libasan} statically, without necessarily linking
13602 other libraries statically.
13603
13604 @item -static-libtsan
13605 @opindex static-libtsan
13606 When the @option{-fsanitize=thread} option is used to link a program,
13607 the GCC driver automatically links against @option{libtsan}. If
13608 @file{libtsan} is available as a shared library, and the @option{-static}
13609 option is not used, then this links against the shared version of
13610 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13611 driver to link @file{libtsan} statically, without necessarily linking
13612 other libraries statically.
13613
13614 @item -static-liblsan
13615 @opindex static-liblsan
13616 When the @option{-fsanitize=leak} option is used to link a program,
13617 the GCC driver automatically links against @option{liblsan}. If
13618 @file{liblsan} is available as a shared library, and the @option{-static}
13619 option is not used, then this links against the shared version of
13620 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13621 driver to link @file{liblsan} statically, without necessarily linking
13622 other libraries statically.
13623
13624 @item -static-libubsan
13625 @opindex static-libubsan
13626 When the @option{-fsanitize=undefined} option is used to link a program,
13627 the GCC driver automatically links against @option{libubsan}. If
13628 @file{libubsan} is available as a shared library, and the @option{-static}
13629 option is not used, then this links against the shared version of
13630 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13631 driver to link @file{libubsan} statically, without necessarily linking
13632 other libraries statically.
13633
13634 @item -static-libstdc++
13635 @opindex static-libstdc++
13636 When the @command{g++} program is used to link a C++ program, it
13637 normally automatically links against @option{libstdc++}. If
13638 @file{libstdc++} is available as a shared library, and the
13639 @option{-static} option is not used, then this links against the
13640 shared version of @file{libstdc++}. That is normally fine. However, it
13641 is sometimes useful to freeze the version of @file{libstdc++} used by
13642 the program without going all the way to a fully static link. The
13643 @option{-static-libstdc++} option directs the @command{g++} driver to
13644 link @file{libstdc++} statically, without necessarily linking other
13645 libraries statically.
13646
13647 @item -symbolic
13648 @opindex symbolic
13649 Bind references to global symbols when building a shared object. Warn
13650 about any unresolved references (unless overridden by the link editor
13651 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13652 this option.
13653
13654 @item -T @var{script}
13655 @opindex T
13656 @cindex linker script
13657 Use @var{script} as the linker script. This option is supported by most
13658 systems using the GNU linker. On some targets, such as bare-board
13659 targets without an operating system, the @option{-T} option may be required
13660 when linking to avoid references to undefined symbols.
13661
13662 @item -Xlinker @var{option}
13663 @opindex Xlinker
13664 Pass @var{option} as an option to the linker. You can use this to
13665 supply system-specific linker options that GCC does not recognize.
13666
13667 If you want to pass an option that takes a separate argument, you must use
13668 @option{-Xlinker} twice, once for the option and once for the argument.
13669 For example, to pass @option{-assert definitions}, you must write
13670 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13671 @option{-Xlinker "-assert definitions"}, because this passes the entire
13672 string as a single argument, which is not what the linker expects.
13673
13674 When using the GNU linker, it is usually more convenient to pass
13675 arguments to linker options using the @option{@var{option}=@var{value}}
13676 syntax than as separate arguments. For example, you can specify
13677 @option{-Xlinker -Map=output.map} rather than
13678 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13679 this syntax for command-line options.
13680
13681 @item -Wl,@var{option}
13682 @opindex Wl
13683 Pass @var{option} as an option to the linker. If @var{option} contains
13684 commas, it is split into multiple options at the commas. You can use this
13685 syntax to pass an argument to the option.
13686 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13687 linker. When using the GNU linker, you can also get the same effect with
13688 @option{-Wl,-Map=output.map}.
13689
13690 @item -u @var{symbol}
13691 @opindex u
13692 Pretend the symbol @var{symbol} is undefined, to force linking of
13693 library modules to define it. You can use @option{-u} multiple times with
13694 different symbols to force loading of additional library modules.
13695
13696 @item -z @var{keyword}
13697 @opindex z
13698 @option{-z} is passed directly on to the linker along with the keyword
13699 @var{keyword}. See the section in the documentation of your linker for
13700 permitted values and their meanings.
13701 @end table
13702
13703 @node Directory Options
13704 @section Options for Directory Search
13705 @cindex directory options
13706 @cindex options, directory search
13707 @cindex search path
13708
13709 These options specify directories to search for header files, for
13710 libraries and for parts of the compiler:
13711
13712 @table @gcctabopt
13713 @include cppdiropts.texi
13714
13715 @item -iplugindir=@var{dir}
13716 @opindex iplugindir=
13717 Set the directory to search for plugins that are passed
13718 by @option{-fplugin=@var{name}} instead of
13719 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13720 to be used by the user, but only passed by the driver.
13721
13722 @item -L@var{dir}
13723 @opindex L
13724 Add directory @var{dir} to the list of directories to be searched
13725 for @option{-l}.
13726
13727 @item -B@var{prefix}
13728 @opindex B
13729 This option specifies where to find the executables, libraries,
13730 include files, and data files of the compiler itself.
13731
13732 The compiler driver program runs one or more of the subprograms
13733 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13734 @var{prefix} as a prefix for each program it tries to run, both with and
13735 without @samp{@var{machine}/@var{version}/} for the corresponding target
13736 machine and compiler version.
13737
13738 For each subprogram to be run, the compiler driver first tries the
13739 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13740 is not specified, the driver tries two standard prefixes,
13741 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13742 those results in a file name that is found, the unmodified program
13743 name is searched for using the directories specified in your
13744 @env{PATH} environment variable.
13745
13746 The compiler checks to see if the path provided by @option{-B}
13747 refers to a directory, and if necessary it adds a directory
13748 separator character at the end of the path.
13749
13750 @option{-B} prefixes that effectively specify directory names also apply
13751 to libraries in the linker, because the compiler translates these
13752 options into @option{-L} options for the linker. They also apply to
13753 include files in the preprocessor, because the compiler translates these
13754 options into @option{-isystem} options for the preprocessor. In this case,
13755 the compiler appends @samp{include} to the prefix.
13756
13757 The runtime support file @file{libgcc.a} can also be searched for using
13758 the @option{-B} prefix, if needed. If it is not found there, the two
13759 standard prefixes above are tried, and that is all. The file is left
13760 out of the link if it is not found by those means.
13761
13762 Another way to specify a prefix much like the @option{-B} prefix is to use
13763 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13764 Variables}.
13765
13766 As a special kludge, if the path provided by @option{-B} is
13767 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13768 9, then it is replaced by @file{[dir/]include}. This is to help
13769 with boot-strapping the compiler.
13770
13771 @item -no-canonical-prefixes
13772 @opindex no-canonical-prefixes
13773 Do not expand any symbolic links, resolve references to @samp{/../}
13774 or @samp{/./}, or make the path absolute when generating a relative
13775 prefix.
13776
13777 @item --sysroot=@var{dir}
13778 @opindex sysroot
13779 Use @var{dir} as the logical root directory for headers and libraries.
13780 For example, if the compiler normally searches for headers in
13781 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13782 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13783
13784 If you use both this option and the @option{-isysroot} option, then
13785 the @option{--sysroot} option applies to libraries, but the
13786 @option{-isysroot} option applies to header files.
13787
13788 The GNU linker (beginning with version 2.16) has the necessary support
13789 for this option. If your linker does not support this option, the
13790 header file aspect of @option{--sysroot} still works, but the
13791 library aspect does not.
13792
13793 @item --no-sysroot-suffix
13794 @opindex no-sysroot-suffix
13795 For some targets, a suffix is added to the root directory specified
13796 with @option{--sysroot}, depending on the other options used, so that
13797 headers may for example be found in
13798 @file{@var{dir}/@var{suffix}/usr/include} instead of
13799 @file{@var{dir}/usr/include}. This option disables the addition of
13800 such a suffix.
13801
13802 @end table
13803
13804 @node Code Gen Options
13805 @section Options for Code Generation Conventions
13806 @cindex code generation conventions
13807 @cindex options, code generation
13808 @cindex run-time options
13809
13810 These machine-independent options control the interface conventions
13811 used in code generation.
13812
13813 Most of them have both positive and negative forms; the negative form
13814 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13815 one of the forms is listed---the one that is not the default. You
13816 can figure out the other form by either removing @samp{no-} or adding
13817 it.
13818
13819 @table @gcctabopt
13820 @item -fstack-reuse=@var{reuse-level}
13821 @opindex fstack_reuse
13822 This option controls stack space reuse for user declared local/auto variables
13823 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13824 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13825 local variables and temporaries, @samp{named_vars} enables the reuse only for
13826 user defined local variables with names, and @samp{none} disables stack reuse
13827 completely. The default value is @samp{all}. The option is needed when the
13828 program extends the lifetime of a scoped local variable or a compiler generated
13829 temporary beyond the end point defined by the language. When a lifetime of
13830 a variable ends, and if the variable lives in memory, the optimizing compiler
13831 has the freedom to reuse its stack space with other temporaries or scoped
13832 local variables whose live range does not overlap with it. Legacy code extending
13833 local lifetime is likely to break with the stack reuse optimization.
13834
13835 For example,
13836
13837 @smallexample
13838 int *p;
13839 @{
13840 int local1;
13841
13842 p = &local1;
13843 local1 = 10;
13844 ....
13845 @}
13846 @{
13847 int local2;
13848 local2 = 20;
13849 ...
13850 @}
13851
13852 if (*p == 10) // out of scope use of local1
13853 @{
13854
13855 @}
13856 @end smallexample
13857
13858 Another example:
13859 @smallexample
13860
13861 struct A
13862 @{
13863 A(int k) : i(k), j(k) @{ @}
13864 int i;
13865 int j;
13866 @};
13867
13868 A *ap;
13869
13870 void foo(const A& ar)
13871 @{
13872 ap = &ar;
13873 @}
13874
13875 void bar()
13876 @{
13877 foo(A(10)); // temp object's lifetime ends when foo returns
13878
13879 @{
13880 A a(20);
13881 ....
13882 @}
13883 ap->i+= 10; // ap references out of scope temp whose space
13884 // is reused with a. What is the value of ap->i?
13885 @}
13886
13887 @end smallexample
13888
13889 The lifetime of a compiler generated temporary is well defined by the C++
13890 standard. When a lifetime of a temporary ends, and if the temporary lives
13891 in memory, the optimizing compiler has the freedom to reuse its stack
13892 space with other temporaries or scoped local variables whose live range
13893 does not overlap with it. However some of the legacy code relies on
13894 the behavior of older compilers in which temporaries' stack space is
13895 not reused, the aggressive stack reuse can lead to runtime errors. This
13896 option is used to control the temporary stack reuse optimization.
13897
13898 @item -ftrapv
13899 @opindex ftrapv
13900 This option generates traps for signed overflow on addition, subtraction,
13901 multiplication operations.
13902 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13903 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13904 @option{-fwrapv} being effective. Note that only active options override, so
13905 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13906 results in @option{-ftrapv} being effective.
13907
13908 @item -fwrapv
13909 @opindex fwrapv
13910 This option instructs the compiler to assume that signed arithmetic
13911 overflow of addition, subtraction and multiplication wraps around
13912 using twos-complement representation. This flag enables some optimizations
13913 and disables others.
13914 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13915 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13916 @option{-fwrapv} being effective. Note that only active options override, so
13917 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13918 results in @option{-ftrapv} being effective.
13919
13920 @item -fwrapv-pointer
13921 @opindex fwrapv-pointer
13922 This option instructs the compiler to assume that pointer arithmetic
13923 overflow on addition and subtraction wraps around using twos-complement
13924 representation. This flag disables some optimizations which assume
13925 pointer overflow is invalid.
13926
13927 @item -fstrict-overflow
13928 @opindex fstrict-overflow
13929 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13930 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13931
13932 @item -fexceptions
13933 @opindex fexceptions
13934 Enable exception handling. Generates extra code needed to propagate
13935 exceptions. For some targets, this implies GCC generates frame
13936 unwind information for all functions, which can produce significant data
13937 size overhead, although it does not affect execution. If you do not
13938 specify this option, GCC enables it by default for languages like
13939 C++ that normally require exception handling, and disables it for
13940 languages like C that do not normally require it. However, you may need
13941 to enable this option when compiling C code that needs to interoperate
13942 properly with exception handlers written in C++. You may also wish to
13943 disable this option if you are compiling older C++ programs that don't
13944 use exception handling.
13945
13946 @item -fnon-call-exceptions
13947 @opindex fnon-call-exceptions
13948 Generate code that allows trapping instructions to throw exceptions.
13949 Note that this requires platform-specific runtime support that does
13950 not exist everywhere. Moreover, it only allows @emph{trapping}
13951 instructions to throw exceptions, i.e.@: memory references or floating-point
13952 instructions. It does not allow exceptions to be thrown from
13953 arbitrary signal handlers such as @code{SIGALRM}.
13954
13955 @item -fdelete-dead-exceptions
13956 @opindex fdelete-dead-exceptions
13957 Consider that instructions that may throw exceptions but don't otherwise
13958 contribute to the execution of the program can be optimized away.
13959 This option is enabled by default for the Ada front end, as permitted by
13960 the Ada language specification.
13961 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13962
13963 @item -funwind-tables
13964 @opindex funwind-tables
13965 Similar to @option{-fexceptions}, except that it just generates any needed
13966 static data, but does not affect the generated code in any other way.
13967 You normally do not need to enable this option; instead, a language processor
13968 that needs this handling enables it on your behalf.
13969
13970 @item -fasynchronous-unwind-tables
13971 @opindex fasynchronous-unwind-tables
13972 Generate unwind table in DWARF format, if supported by target machine. The
13973 table is exact at each instruction boundary, so it can be used for stack
13974 unwinding from asynchronous events (such as debugger or garbage collector).
13975
13976 @item -fno-gnu-unique
13977 @opindex fno-gnu-unique
13978 @opindex fgnu-unique
13979 On systems with recent GNU assembler and C library, the C++ compiler
13980 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13981 of template static data members and static local variables in inline
13982 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13983 is necessary to avoid problems with a library used by two different
13984 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13985 therefore disagreeing with the other one about the binding of the
13986 symbol. But this causes @code{dlclose} to be ignored for affected
13987 DSOs; if your program relies on reinitialization of a DSO via
13988 @code{dlclose} and @code{dlopen}, you can use
13989 @option{-fno-gnu-unique}.
13990
13991 @item -fpcc-struct-return
13992 @opindex fpcc-struct-return
13993 Return ``short'' @code{struct} and @code{union} values in memory like
13994 longer ones, rather than in registers. This convention is less
13995 efficient, but it has the advantage of allowing intercallability between
13996 GCC-compiled files and files compiled with other compilers, particularly
13997 the Portable C Compiler (pcc).
13998
13999 The precise convention for returning structures in memory depends
14000 on the target configuration macros.
14001
14002 Short structures and unions are those whose size and alignment match
14003 that of some integer type.
14004
14005 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
14006 switch is not binary compatible with code compiled with the
14007 @option{-freg-struct-return} switch.
14008 Use it to conform to a non-default application binary interface.
14009
14010 @item -freg-struct-return
14011 @opindex freg-struct-return
14012 Return @code{struct} and @code{union} values in registers when possible.
14013 This is more efficient for small structures than
14014 @option{-fpcc-struct-return}.
14015
14016 If you specify neither @option{-fpcc-struct-return} nor
14017 @option{-freg-struct-return}, GCC defaults to whichever convention is
14018 standard for the target. If there is no standard convention, GCC
14019 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
14020 the principal compiler. In those cases, we can choose the standard, and
14021 we chose the more efficient register return alternative.
14022
14023 @strong{Warning:} code compiled with the @option{-freg-struct-return}
14024 switch is not binary compatible with code compiled with the
14025 @option{-fpcc-struct-return} switch.
14026 Use it to conform to a non-default application binary interface.
14027
14028 @item -fshort-enums
14029 @opindex fshort-enums
14030 Allocate to an @code{enum} type only as many bytes as it needs for the
14031 declared range of possible values. Specifically, the @code{enum} type
14032 is equivalent to the smallest integer type that has enough room.
14033
14034 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
14035 code that is not binary compatible with code generated without that switch.
14036 Use it to conform to a non-default application binary interface.
14037
14038 @item -fshort-wchar
14039 @opindex fshort-wchar
14040 Override the underlying type for @code{wchar_t} to be @code{short
14041 unsigned int} instead of the default for the target. This option is
14042 useful for building programs to run under WINE@.
14043
14044 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
14045 code that is not binary compatible with code generated without that switch.
14046 Use it to conform to a non-default application binary interface.
14047
14048 @item -fno-common
14049 @opindex fno-common
14050 @opindex fcommon
14051 @cindex tentative definitions
14052 In C code, this option controls the placement of global variables
14053 defined without an initializer, known as @dfn{tentative definitions}
14054 in the C standard. Tentative definitions are distinct from declarations
14055 of a variable with the @code{extern} keyword, which do not allocate storage.
14056
14057 Unix C compilers have traditionally allocated storage for
14058 uninitialized global variables in a common block. This allows the
14059 linker to resolve all tentative definitions of the same variable
14060 in different compilation units to the same object, or to a non-tentative
14061 definition.
14062 This is the behavior specified by @option{-fcommon}, and is the default for
14063 GCC on most targets.
14064 On the other hand, this behavior is not required by ISO
14065 C, and on some targets may carry a speed or code size penalty on
14066 variable references.
14067
14068 The @option{-fno-common} option specifies that the compiler should instead
14069 place uninitialized global variables in the BSS section of the object file.
14070 This inhibits the merging of tentative definitions by the linker so
14071 you get a multiple-definition error if the same
14072 variable is defined in more than one compilation unit.
14073 Compiling with @option{-fno-common} is useful on targets for which
14074 it provides better performance, or if you wish to verify that the
14075 program will work on other systems that always treat uninitialized
14076 variable definitions this way.
14077
14078 @item -fno-ident
14079 @opindex fno-ident
14080 @opindex fident
14081 Ignore the @code{#ident} directive.
14082
14083 @item -finhibit-size-directive
14084 @opindex finhibit-size-directive
14085 Don't output a @code{.size} assembler directive, or anything else that
14086 would cause trouble if the function is split in the middle, and the
14087 two halves are placed at locations far apart in memory. This option is
14088 used when compiling @file{crtstuff.c}; you should not need to use it
14089 for anything else.
14090
14091 @item -fverbose-asm
14092 @opindex fverbose-asm
14093 Put extra commentary information in the generated assembly code to
14094 make it more readable. This option is generally only of use to those
14095 who actually need to read the generated assembly code (perhaps while
14096 debugging the compiler itself).
14097
14098 @option{-fno-verbose-asm}, the default, causes the
14099 extra information to be omitted and is useful when comparing two assembler
14100 files.
14101
14102 The added comments include:
14103
14104 @itemize @bullet
14105
14106 @item
14107 information on the compiler version and command-line options,
14108
14109 @item
14110 the source code lines associated with the assembly instructions,
14111 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14112
14113 @item
14114 hints on which high-level expressions correspond to
14115 the various assembly instruction operands.
14116
14117 @end itemize
14118
14119 For example, given this C source file:
14120
14121 @smallexample
14122 int test (int n)
14123 @{
14124 int i;
14125 int total = 0;
14126
14127 for (i = 0; i < n; i++)
14128 total += i * i;
14129
14130 return total;
14131 @}
14132 @end smallexample
14133
14134 compiling to (x86_64) assembly via @option{-S} and emitting the result
14135 direct to stdout via @option{-o} @option{-}
14136
14137 @smallexample
14138 gcc -S test.c -fverbose-asm -Os -o -
14139 @end smallexample
14140
14141 gives output similar to this:
14142
14143 @smallexample
14144 .file "test.c"
14145 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14146 [...snip...]
14147 # options passed:
14148 [...snip...]
14149
14150 .text
14151 .globl test
14152 .type test, @@function
14153 test:
14154 .LFB0:
14155 .cfi_startproc
14156 # test.c:4: int total = 0;
14157 xorl %eax, %eax # <retval>
14158 # test.c:6: for (i = 0; i < n; i++)
14159 xorl %edx, %edx # i
14160 .L2:
14161 # test.c:6: for (i = 0; i < n; i++)
14162 cmpl %edi, %edx # n, i
14163 jge .L5 #,
14164 # test.c:7: total += i * i;
14165 movl %edx, %ecx # i, tmp92
14166 imull %edx, %ecx # i, tmp92
14167 # test.c:6: for (i = 0; i < n; i++)
14168 incl %edx # i
14169 # test.c:7: total += i * i;
14170 addl %ecx, %eax # tmp92, <retval>
14171 jmp .L2 #
14172 .L5:
14173 # test.c:10: @}
14174 ret
14175 .cfi_endproc
14176 .LFE0:
14177 .size test, .-test
14178 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14179 .section .note.GNU-stack,"",@@progbits
14180 @end smallexample
14181
14182 The comments are intended for humans rather than machines and hence the
14183 precise format of the comments is subject to change.
14184
14185 @item -frecord-gcc-switches
14186 @opindex frecord-gcc-switches
14187 This switch causes the command line used to invoke the
14188 compiler to be recorded into the object file that is being created.
14189 This switch is only implemented on some targets and the exact format
14190 of the recording is target and binary file format dependent, but it
14191 usually takes the form of a section containing ASCII text. This
14192 switch is related to the @option{-fverbose-asm} switch, but that
14193 switch only records information in the assembler output file as
14194 comments, so it never reaches the object file.
14195 See also @option{-grecord-gcc-switches} for another
14196 way of storing compiler options into the object file.
14197
14198 @item -fpic
14199 @opindex fpic
14200 @cindex global offset table
14201 @cindex PIC
14202 Generate position-independent code (PIC) suitable for use in a shared
14203 library, if supported for the target machine. Such code accesses all
14204 constant addresses through a global offset table (GOT)@. The dynamic
14205 loader resolves the GOT entries when the program starts (the dynamic
14206 loader is not part of GCC; it is part of the operating system). If
14207 the GOT size for the linked executable exceeds a machine-specific
14208 maximum size, you get an error message from the linker indicating that
14209 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14210 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14211 on the m68k and RS/6000. The x86 has no such limit.)
14212
14213 Position-independent code requires special support, and therefore works
14214 only on certain machines. For the x86, GCC supports PIC for System V
14215 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14216 position-independent.
14217
14218 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14219 are defined to 1.
14220
14221 @item -fPIC
14222 @opindex fPIC
14223 If supported for the target machine, emit position-independent code,
14224 suitable for dynamic linking and avoiding any limit on the size of the
14225 global offset table. This option makes a difference on AArch64, m68k,
14226 PowerPC and SPARC@.
14227
14228 Position-independent code requires special support, and therefore works
14229 only on certain machines.
14230
14231 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14232 are defined to 2.
14233
14234 @item -fpie
14235 @itemx -fPIE
14236 @opindex fpie
14237 @opindex fPIE
14238 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14239 generated position-independent code can be only linked into executables.
14240 Usually these options are used to compile code that will be linked using
14241 the @option{-pie} GCC option.
14242
14243 @option{-fpie} and @option{-fPIE} both define the macros
14244 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14245 for @option{-fpie} and 2 for @option{-fPIE}.
14246
14247 @item -fno-plt
14248 @opindex fno-plt
14249 @opindex fplt
14250 Do not use the PLT for external function calls in position-independent code.
14251 Instead, load the callee address at call sites from the GOT and branch to it.
14252 This leads to more efficient code by eliminating PLT stubs and exposing
14253 GOT loads to optimizations. On architectures such as 32-bit x86 where
14254 PLT stubs expect the GOT pointer in a specific register, this gives more
14255 register allocation freedom to the compiler.
14256 Lazy binding requires use of the PLT;
14257 with @option{-fno-plt} all external symbols are resolved at load time.
14258
14259 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14260 through the PLT for specific external functions.
14261
14262 In position-dependent code, a few targets also convert calls to
14263 functions that are marked to not use the PLT to use the GOT instead.
14264
14265 @item -fno-jump-tables
14266 @opindex fno-jump-tables
14267 @opindex fjump-tables
14268 Do not use jump tables for switch statements even where it would be
14269 more efficient than other code generation strategies. This option is
14270 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14271 building code that forms part of a dynamic linker and cannot
14272 reference the address of a jump table. On some targets, jump tables
14273 do not require a GOT and this option is not needed.
14274
14275 @item -ffixed-@var{reg}
14276 @opindex ffixed
14277 Treat the register named @var{reg} as a fixed register; generated code
14278 should never refer to it (except perhaps as a stack pointer, frame
14279 pointer or in some other fixed role).
14280
14281 @var{reg} must be the name of a register. The register names accepted
14282 are machine-specific and are defined in the @code{REGISTER_NAMES}
14283 macro in the machine description macro file.
14284
14285 This flag does not have a negative form, because it specifies a
14286 three-way choice.
14287
14288 @item -fcall-used-@var{reg}
14289 @opindex fcall-used
14290 Treat the register named @var{reg} as an allocable register that is
14291 clobbered by function calls. It may be allocated for temporaries or
14292 variables that do not live across a call. Functions compiled this way
14293 do not save and restore the register @var{reg}.
14294
14295 It is an error to use this flag with the frame pointer or stack pointer.
14296 Use of this flag for other registers that have fixed pervasive roles in
14297 the machine's execution model produces disastrous results.
14298
14299 This flag does not have a negative form, because it specifies a
14300 three-way choice.
14301
14302 @item -fcall-saved-@var{reg}
14303 @opindex fcall-saved
14304 Treat the register named @var{reg} as an allocable register saved by
14305 functions. It may be allocated even for temporaries or variables that
14306 live across a call. Functions compiled this way save and restore
14307 the register @var{reg} if they use it.
14308
14309 It is an error to use this flag with the frame pointer or stack pointer.
14310 Use of this flag for other registers that have fixed pervasive roles in
14311 the machine's execution model produces disastrous results.
14312
14313 A different sort of disaster results from the use of this flag for
14314 a register in which function values may be returned.
14315
14316 This flag does not have a negative form, because it specifies a
14317 three-way choice.
14318
14319 @item -fpack-struct[=@var{n}]
14320 @opindex fpack-struct
14321 Without a value specified, pack all structure members together without
14322 holes. When a value is specified (which must be a small power of two), pack
14323 structure members according to this value, representing the maximum
14324 alignment (that is, objects with default alignment requirements larger than
14325 this are output potentially unaligned at the next fitting location.
14326
14327 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14328 code that is not binary compatible with code generated without that switch.
14329 Additionally, it makes the code suboptimal.
14330 Use it to conform to a non-default application binary interface.
14331
14332 @item -fleading-underscore
14333 @opindex fleading-underscore
14334 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14335 change the way C symbols are represented in the object file. One use
14336 is to help link with legacy assembly code.
14337
14338 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14339 generate code that is not binary compatible with code generated without that
14340 switch. Use it to conform to a non-default application binary interface.
14341 Not all targets provide complete support for this switch.
14342
14343 @item -ftls-model=@var{model}
14344 @opindex ftls-model
14345 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14346 The @var{model} argument should be one of @samp{global-dynamic},
14347 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14348 Note that the choice is subject to optimization: the compiler may use
14349 a more efficient model for symbols not visible outside of the translation
14350 unit, or if @option{-fpic} is not given on the command line.
14351
14352 The default without @option{-fpic} is @samp{initial-exec}; with
14353 @option{-fpic} the default is @samp{global-dynamic}.
14354
14355 @item -ftrampolines
14356 @opindex ftrampolines
14357 For targets that normally need trampolines for nested functions, always
14358 generate them instead of using descriptors. Otherwise, for targets that
14359 do not need them, like for example HP-PA or IA-64, do nothing.
14360
14361 A trampoline is a small piece of code that is created at run time on the
14362 stack when the address of a nested function is taken, and is used to call
14363 the nested function indirectly. Therefore, it requires the stack to be
14364 made executable in order for the program to work properly.
14365
14366 @option{-fno-trampolines} is enabled by default on a language by language
14367 basis to let the compiler avoid generating them, if it computes that this
14368 is safe, and replace them with descriptors. Descriptors are made up of data
14369 only, but the generated code must be prepared to deal with them. As of this
14370 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14371
14372 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14373 @option{-fno-trampolines} are not binary compatible if nested functions are
14374 present. This option must therefore be used on a program-wide basis and be
14375 manipulated with extreme care.
14376
14377 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14378 @opindex fvisibility
14379 Set the default ELF image symbol visibility to the specified option---all
14380 symbols are marked with this unless overridden within the code.
14381 Using this feature can very substantially improve linking and
14382 load times of shared object libraries, produce more optimized
14383 code, provide near-perfect API export and prevent symbol clashes.
14384 It is @strong{strongly} recommended that you use this in any shared objects
14385 you distribute.
14386
14387 Despite the nomenclature, @samp{default} always means public; i.e.,
14388 available to be linked against from outside the shared object.
14389 @samp{protected} and @samp{internal} are pretty useless in real-world
14390 usage so the only other commonly used option is @samp{hidden}.
14391 The default if @option{-fvisibility} isn't specified is
14392 @samp{default}, i.e., make every symbol public.
14393
14394 A good explanation of the benefits offered by ensuring ELF
14395 symbols have the correct visibility is given by ``How To Write
14396 Shared Libraries'' by Ulrich Drepper (which can be found at
14397 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14398 solution made possible by this option to marking things hidden when
14399 the default is public is to make the default hidden and mark things
14400 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14401 and @code{__attribute__ ((visibility("default")))} instead of
14402 @code{__declspec(dllexport)} you get almost identical semantics with
14403 identical syntax. This is a great boon to those working with
14404 cross-platform projects.
14405
14406 For those adding visibility support to existing code, you may find
14407 @code{#pragma GCC visibility} of use. This works by you enclosing
14408 the declarations you wish to set visibility for with (for example)
14409 @code{#pragma GCC visibility push(hidden)} and
14410 @code{#pragma GCC visibility pop}.
14411 Bear in mind that symbol visibility should be viewed @strong{as
14412 part of the API interface contract} and thus all new code should
14413 always specify visibility when it is not the default; i.e., declarations
14414 only for use within the local DSO should @strong{always} be marked explicitly
14415 as hidden as so to avoid PLT indirection overheads---making this
14416 abundantly clear also aids readability and self-documentation of the code.
14417 Note that due to ISO C++ specification requirements, @code{operator new} and
14418 @code{operator delete} must always be of default visibility.
14419
14420 Be aware that headers from outside your project, in particular system
14421 headers and headers from any other library you use, may not be
14422 expecting to be compiled with visibility other than the default. You
14423 may need to explicitly say @code{#pragma GCC visibility push(default)}
14424 before including any such headers.
14425
14426 @code{extern} declarations are not affected by @option{-fvisibility}, so
14427 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14428 no modifications. However, this means that calls to @code{extern}
14429 functions with no explicit visibility use the PLT, so it is more
14430 effective to use @code{__attribute ((visibility))} and/or
14431 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14432 declarations should be treated as hidden.
14433
14434 Note that @option{-fvisibility} does affect C++ vague linkage
14435 entities. This means that, for instance, an exception class that is
14436 be thrown between DSOs must be explicitly marked with default
14437 visibility so that the @samp{type_info} nodes are unified between
14438 the DSOs.
14439
14440 An overview of these techniques, their benefits and how to use them
14441 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14442
14443 @item -fstrict-volatile-bitfields
14444 @opindex fstrict-volatile-bitfields
14445 This option should be used if accesses to volatile bit-fields (or other
14446 structure fields, although the compiler usually honors those types
14447 anyway) should use a single access of the width of the
14448 field's type, aligned to a natural alignment if possible. For
14449 example, targets with memory-mapped peripheral registers might require
14450 all such accesses to be 16 bits wide; with this flag you can
14451 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14452 is 16 bits on these targets) to force GCC to use 16-bit accesses
14453 instead of, perhaps, a more efficient 32-bit access.
14454
14455 If this option is disabled, the compiler uses the most efficient
14456 instruction. In the previous example, that might be a 32-bit load
14457 instruction, even though that accesses bytes that do not contain
14458 any portion of the bit-field, or memory-mapped registers unrelated to
14459 the one being updated.
14460
14461 In some cases, such as when the @code{packed} attribute is applied to a
14462 structure field, it may not be possible to access the field with a single
14463 read or write that is correctly aligned for the target machine. In this
14464 case GCC falls back to generating multiple accesses rather than code that
14465 will fault or truncate the result at run time.
14466
14467 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14468 not allowed to touch non bit-field members. It is therefore recommended
14469 to define all bits of the field's type as bit-field members.
14470
14471 The default value of this option is determined by the application binary
14472 interface for the target processor.
14473
14474 @item -fsync-libcalls
14475 @opindex fsync-libcalls
14476 This option controls whether any out-of-line instance of the @code{__sync}
14477 family of functions may be used to implement the C++11 @code{__atomic}
14478 family of functions.
14479
14480 The default value of this option is enabled, thus the only useful form
14481 of the option is @option{-fno-sync-libcalls}. This option is used in
14482 the implementation of the @file{libatomic} runtime library.
14483
14484 @end table
14485
14486 @node Developer Options
14487 @section GCC Developer Options
14488 @cindex developer options
14489 @cindex debugging GCC
14490 @cindex debug dump options
14491 @cindex dump options
14492 @cindex compilation statistics
14493
14494 This section describes command-line options that are primarily of
14495 interest to GCC developers, including options to support compiler
14496 testing and investigation of compiler bugs and compile-time
14497 performance problems. This includes options that produce debug dumps
14498 at various points in the compilation; that print statistics such as
14499 memory use and execution time; and that print information about GCC's
14500 configuration, such as where it searches for libraries. You should
14501 rarely need to use any of these options for ordinary compilation and
14502 linking tasks.
14503
14504 Many developer options that cause GCC to dump output to a file take an
14505 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14506 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14507 error.
14508
14509 If @samp{=@var{filename}} is omitted, a default dump file name is
14510 constructed by concatenating the base dump file name, a pass number,
14511 phase letter, and pass name. The base dump file name is the name of
14512 output file produced by the compiler if explicitly specified and not
14513 an executable; otherwise it is the source file name.
14514 The pass number is determined by the order passes are registered with
14515 the compiler's pass manager.
14516 This is generally the same as the order of execution, but passes
14517 registered by plugins, target-specific passes, or passes that are
14518 otherwise registered late are numbered higher than the pass named
14519 @samp{final}, even if they are executed earlier. The phase letter is
14520 one of @samp{i} (inter-procedural analysis), @samp{l}
14521 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14522 The files are created in the directory of the output file.
14523
14524 @table @gcctabopt
14525
14526 @item -d@var{letters}
14527 @itemx -fdump-rtl-@var{pass}
14528 @itemx -fdump-rtl-@var{pass}=@var{filename}
14529 @opindex d
14530 @opindex fdump-rtl-@var{pass}
14531 Says to make debugging dumps during compilation at times specified by
14532 @var{letters}. This is used for debugging the RTL-based passes of the
14533 compiler.
14534
14535 Some @option{-d@var{letters}} switches have different meaning when
14536 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14537 for information about preprocessor-specific dump options.
14538
14539 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14540 @option{-d} option @var{letters}. Here are the possible
14541 letters for use in @var{pass} and @var{letters}, and their meanings:
14542
14543 @table @gcctabopt
14544
14545 @item -fdump-rtl-alignments
14546 @opindex fdump-rtl-alignments
14547 Dump after branch alignments have been computed.
14548
14549 @item -fdump-rtl-asmcons
14550 @opindex fdump-rtl-asmcons
14551 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14552
14553 @item -fdump-rtl-auto_inc_dec
14554 @opindex fdump-rtl-auto_inc_dec
14555 Dump after auto-inc-dec discovery. This pass is only run on
14556 architectures that have auto inc or auto dec instructions.
14557
14558 @item -fdump-rtl-barriers
14559 @opindex fdump-rtl-barriers
14560 Dump after cleaning up the barrier instructions.
14561
14562 @item -fdump-rtl-bbpart
14563 @opindex fdump-rtl-bbpart
14564 Dump after partitioning hot and cold basic blocks.
14565
14566 @item -fdump-rtl-bbro
14567 @opindex fdump-rtl-bbro
14568 Dump after block reordering.
14569
14570 @item -fdump-rtl-btl1
14571 @itemx -fdump-rtl-btl2
14572 @opindex fdump-rtl-btl2
14573 @opindex fdump-rtl-btl2
14574 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14575 after the two branch
14576 target load optimization passes.
14577
14578 @item -fdump-rtl-bypass
14579 @opindex fdump-rtl-bypass
14580 Dump after jump bypassing and control flow optimizations.
14581
14582 @item -fdump-rtl-combine
14583 @opindex fdump-rtl-combine
14584 Dump after the RTL instruction combination pass.
14585
14586 @item -fdump-rtl-compgotos
14587 @opindex fdump-rtl-compgotos
14588 Dump after duplicating the computed gotos.
14589
14590 @item -fdump-rtl-ce1
14591 @itemx -fdump-rtl-ce2
14592 @itemx -fdump-rtl-ce3
14593 @opindex fdump-rtl-ce1
14594 @opindex fdump-rtl-ce2
14595 @opindex fdump-rtl-ce3
14596 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14597 @option{-fdump-rtl-ce3} enable dumping after the three
14598 if conversion passes.
14599
14600 @item -fdump-rtl-cprop_hardreg
14601 @opindex fdump-rtl-cprop_hardreg
14602 Dump after hard register copy propagation.
14603
14604 @item -fdump-rtl-csa
14605 @opindex fdump-rtl-csa
14606 Dump after combining stack adjustments.
14607
14608 @item -fdump-rtl-cse1
14609 @itemx -fdump-rtl-cse2
14610 @opindex fdump-rtl-cse1
14611 @opindex fdump-rtl-cse2
14612 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14613 the two common subexpression elimination passes.
14614
14615 @item -fdump-rtl-dce
14616 @opindex fdump-rtl-dce
14617 Dump after the standalone dead code elimination passes.
14618
14619 @item -fdump-rtl-dbr
14620 @opindex fdump-rtl-dbr
14621 Dump after delayed branch scheduling.
14622
14623 @item -fdump-rtl-dce1
14624 @itemx -fdump-rtl-dce2
14625 @opindex fdump-rtl-dce1
14626 @opindex fdump-rtl-dce2
14627 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14628 the two dead store elimination passes.
14629
14630 @item -fdump-rtl-eh
14631 @opindex fdump-rtl-eh
14632 Dump after finalization of EH handling code.
14633
14634 @item -fdump-rtl-eh_ranges
14635 @opindex fdump-rtl-eh_ranges
14636 Dump after conversion of EH handling range regions.
14637
14638 @item -fdump-rtl-expand
14639 @opindex fdump-rtl-expand
14640 Dump after RTL generation.
14641
14642 @item -fdump-rtl-fwprop1
14643 @itemx -fdump-rtl-fwprop2
14644 @opindex fdump-rtl-fwprop1
14645 @opindex fdump-rtl-fwprop2
14646 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14647 dumping after the two forward propagation passes.
14648
14649 @item -fdump-rtl-gcse1
14650 @itemx -fdump-rtl-gcse2
14651 @opindex fdump-rtl-gcse1
14652 @opindex fdump-rtl-gcse2
14653 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14654 after global common subexpression elimination.
14655
14656 @item -fdump-rtl-init-regs
14657 @opindex fdump-rtl-init-regs
14658 Dump after the initialization of the registers.
14659
14660 @item -fdump-rtl-initvals
14661 @opindex fdump-rtl-initvals
14662 Dump after the computation of the initial value sets.
14663
14664 @item -fdump-rtl-into_cfglayout
14665 @opindex fdump-rtl-into_cfglayout
14666 Dump after converting to cfglayout mode.
14667
14668 @item -fdump-rtl-ira
14669 @opindex fdump-rtl-ira
14670 Dump after iterated register allocation.
14671
14672 @item -fdump-rtl-jump
14673 @opindex fdump-rtl-jump
14674 Dump after the second jump optimization.
14675
14676 @item -fdump-rtl-loop2
14677 @opindex fdump-rtl-loop2
14678 @option{-fdump-rtl-loop2} enables dumping after the rtl
14679 loop optimization passes.
14680
14681 @item -fdump-rtl-mach
14682 @opindex fdump-rtl-mach
14683 Dump after performing the machine dependent reorganization pass, if that
14684 pass exists.
14685
14686 @item -fdump-rtl-mode_sw
14687 @opindex fdump-rtl-mode_sw
14688 Dump after removing redundant mode switches.
14689
14690 @item -fdump-rtl-rnreg
14691 @opindex fdump-rtl-rnreg
14692 Dump after register renumbering.
14693
14694 @item -fdump-rtl-outof_cfglayout
14695 @opindex fdump-rtl-outof_cfglayout
14696 Dump after converting from cfglayout mode.
14697
14698 @item -fdump-rtl-peephole2
14699 @opindex fdump-rtl-peephole2
14700 Dump after the peephole pass.
14701
14702 @item -fdump-rtl-postreload
14703 @opindex fdump-rtl-postreload
14704 Dump after post-reload optimizations.
14705
14706 @item -fdump-rtl-pro_and_epilogue
14707 @opindex fdump-rtl-pro_and_epilogue
14708 Dump after generating the function prologues and epilogues.
14709
14710 @item -fdump-rtl-sched1
14711 @itemx -fdump-rtl-sched2
14712 @opindex fdump-rtl-sched1
14713 @opindex fdump-rtl-sched2
14714 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14715 after the basic block scheduling passes.
14716
14717 @item -fdump-rtl-ree
14718 @opindex fdump-rtl-ree
14719 Dump after sign/zero extension elimination.
14720
14721 @item -fdump-rtl-seqabstr
14722 @opindex fdump-rtl-seqabstr
14723 Dump after common sequence discovery.
14724
14725 @item -fdump-rtl-shorten
14726 @opindex fdump-rtl-shorten
14727 Dump after shortening branches.
14728
14729 @item -fdump-rtl-sibling
14730 @opindex fdump-rtl-sibling
14731 Dump after sibling call optimizations.
14732
14733 @item -fdump-rtl-split1
14734 @itemx -fdump-rtl-split2
14735 @itemx -fdump-rtl-split3
14736 @itemx -fdump-rtl-split4
14737 @itemx -fdump-rtl-split5
14738 @opindex fdump-rtl-split1
14739 @opindex fdump-rtl-split2
14740 @opindex fdump-rtl-split3
14741 @opindex fdump-rtl-split4
14742 @opindex fdump-rtl-split5
14743 These options enable dumping after five rounds of
14744 instruction splitting.
14745
14746 @item -fdump-rtl-sms
14747 @opindex fdump-rtl-sms
14748 Dump after modulo scheduling. This pass is only run on some
14749 architectures.
14750
14751 @item -fdump-rtl-stack
14752 @opindex fdump-rtl-stack
14753 Dump after conversion from GCC's ``flat register file'' registers to the
14754 x87's stack-like registers. This pass is only run on x86 variants.
14755
14756 @item -fdump-rtl-subreg1
14757 @itemx -fdump-rtl-subreg2
14758 @opindex fdump-rtl-subreg1
14759 @opindex fdump-rtl-subreg2
14760 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14761 the two subreg expansion passes.
14762
14763 @item -fdump-rtl-unshare
14764 @opindex fdump-rtl-unshare
14765 Dump after all rtl has been unshared.
14766
14767 @item -fdump-rtl-vartrack
14768 @opindex fdump-rtl-vartrack
14769 Dump after variable tracking.
14770
14771 @item -fdump-rtl-vregs
14772 @opindex fdump-rtl-vregs
14773 Dump after converting virtual registers to hard registers.
14774
14775 @item -fdump-rtl-web
14776 @opindex fdump-rtl-web
14777 Dump after live range splitting.
14778
14779 @item -fdump-rtl-regclass
14780 @itemx -fdump-rtl-subregs_of_mode_init
14781 @itemx -fdump-rtl-subregs_of_mode_finish
14782 @itemx -fdump-rtl-dfinit
14783 @itemx -fdump-rtl-dfinish
14784 @opindex fdump-rtl-regclass
14785 @opindex fdump-rtl-subregs_of_mode_init
14786 @opindex fdump-rtl-subregs_of_mode_finish
14787 @opindex fdump-rtl-dfinit
14788 @opindex fdump-rtl-dfinish
14789 These dumps are defined but always produce empty files.
14790
14791 @item -da
14792 @itemx -fdump-rtl-all
14793 @opindex da
14794 @opindex fdump-rtl-all
14795 Produce all the dumps listed above.
14796
14797 @item -dA
14798 @opindex dA
14799 Annotate the assembler output with miscellaneous debugging information.
14800
14801 @item -dD
14802 @opindex dD
14803 Dump all macro definitions, at the end of preprocessing, in addition to
14804 normal output.
14805
14806 @item -dH
14807 @opindex dH
14808 Produce a core dump whenever an error occurs.
14809
14810 @item -dp
14811 @opindex dp
14812 Annotate the assembler output with a comment indicating which
14813 pattern and alternative is used. The length and cost of each instruction are
14814 also printed.
14815
14816 @item -dP
14817 @opindex dP
14818 Dump the RTL in the assembler output as a comment before each instruction.
14819 Also turns on @option{-dp} annotation.
14820
14821 @item -dx
14822 @opindex dx
14823 Just generate RTL for a function instead of compiling it. Usually used
14824 with @option{-fdump-rtl-expand}.
14825 @end table
14826
14827 @item -fdump-debug
14828 @opindex fdump-debug
14829 Dump debugging information generated during the debug
14830 generation phase.
14831
14832 @item -fdump-earlydebug
14833 @opindex fdump-earlydebug
14834 Dump debugging information generated during the early debug
14835 generation phase.
14836
14837 @item -fdump-noaddr
14838 @opindex fdump-noaddr
14839 When doing debugging dumps, suppress address output. This makes it more
14840 feasible to use diff on debugging dumps for compiler invocations with
14841 different compiler binaries and/or different
14842 text / bss / data / heap / stack / dso start locations.
14843
14844 @item -freport-bug
14845 @opindex freport-bug
14846 Collect and dump debug information into a temporary file if an
14847 internal compiler error (ICE) occurs.
14848
14849 @item -fdump-unnumbered
14850 @opindex fdump-unnumbered
14851 When doing debugging dumps, suppress instruction numbers and address output.
14852 This makes it more feasible to use diff on debugging dumps for compiler
14853 invocations with different options, in particular with and without
14854 @option{-g}.
14855
14856 @item -fdump-unnumbered-links
14857 @opindex fdump-unnumbered-links
14858 When doing debugging dumps (see @option{-d} option above), suppress
14859 instruction numbers for the links to the previous and next instructions
14860 in a sequence.
14861
14862 @item -fdump-ipa-@var{switch}
14863 @itemx -fdump-ipa-@var{switch}-@var{options}
14864 @opindex fdump-ipa
14865 Control the dumping at various stages of inter-procedural analysis
14866 language tree to a file. The file name is generated by appending a
14867 switch specific suffix to the source file name, and the file is created
14868 in the same directory as the output file. The following dumps are
14869 possible:
14870
14871 @table @samp
14872 @item all
14873 Enables all inter-procedural analysis dumps.
14874
14875 @item cgraph
14876 Dumps information about call-graph optimization, unused function removal,
14877 and inlining decisions.
14878
14879 @item inline
14880 Dump after function inlining.
14881
14882 @end table
14883
14884 Additionally, the options @option{-optimized}, @option{-missed},
14885 @option{-note}, and @option{-all} can be provided, with the same meaning
14886 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14887
14888 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14889 information on callsites that were inlined, along with callsites
14890 that were not inlined.
14891
14892 By default, the dump will contain messages about successful
14893 optimizations (equivalent to @option{-optimized}) together with
14894 low-level details about the analysis.
14895
14896 @item -fdump-lang-all
14897 @itemx -fdump-lang-@var{switch}
14898 @itemx -fdump-lang-@var{switch}-@var{options}
14899 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14900 @opindex fdump-lang-all
14901 @opindex fdump-lang
14902 Control the dumping of language-specific information. The @var{options}
14903 and @var{filename} portions behave as described in the
14904 @option{-fdump-tree} option. The following @var{switch} values are
14905 accepted:
14906
14907 @table @samp
14908 @item all
14909
14910 Enable all language-specific dumps.
14911
14912 @item class
14913 Dump class hierarchy information. Virtual table information is emitted
14914 unless '@option{slim}' is specified. This option is applicable to C++ only.
14915
14916 @item raw
14917 Dump the raw internal tree data. This option is applicable to C++ only.
14918
14919 @end table
14920
14921 @item -fdump-passes
14922 @opindex fdump-passes
14923 Print on @file{stderr} the list of optimization passes that are turned
14924 on and off by the current command-line options.
14925
14926 @item -fdump-statistics-@var{option}
14927 @opindex fdump-statistics
14928 Enable and control dumping of pass statistics in a separate file. The
14929 file name is generated by appending a suffix ending in
14930 @samp{.statistics} to the source file name, and the file is created in
14931 the same directory as the output file. If the @samp{-@var{option}}
14932 form is used, @samp{-stats} causes counters to be summed over the
14933 whole compilation unit while @samp{-details} dumps every event as
14934 the passes generate them. The default with no option is to sum
14935 counters for each function compiled.
14936
14937 @item -fdump-tree-all
14938 @itemx -fdump-tree-@var{switch}
14939 @itemx -fdump-tree-@var{switch}-@var{options}
14940 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14941 @opindex fdump-tree-all
14942 @opindex fdump-tree
14943 Control the dumping at various stages of processing the intermediate
14944 language tree to a file. If the @samp{-@var{options}}
14945 form is used, @var{options} is a list of @samp{-} separated options
14946 which control the details of the dump. Not all options are applicable
14947 to all dumps; those that are not meaningful are ignored. The
14948 following options are available
14949
14950 @table @samp
14951 @item address
14952 Print the address of each node. Usually this is not meaningful as it
14953 changes according to the environment and source file. Its primary use
14954 is for tying up a dump file with a debug environment.
14955 @item asmname
14956 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14957 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14958 use working backward from mangled names in the assembly file.
14959 @item slim
14960 When dumping front-end intermediate representations, inhibit dumping
14961 of members of a scope or body of a function merely because that scope
14962 has been reached. Only dump such items when they are directly reachable
14963 by some other path.
14964
14965 When dumping pretty-printed trees, this option inhibits dumping the
14966 bodies of control structures.
14967
14968 When dumping RTL, print the RTL in slim (condensed) form instead of
14969 the default LISP-like representation.
14970 @item raw
14971 Print a raw representation of the tree. By default, trees are
14972 pretty-printed into a C-like representation.
14973 @item details
14974 Enable more detailed dumps (not honored by every dump option). Also
14975 include information from the optimization passes.
14976 @item stats
14977 Enable dumping various statistics about the pass (not honored by every dump
14978 option).
14979 @item blocks
14980 Enable showing basic block boundaries (disabled in raw dumps).
14981 @item graph
14982 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14983 dump a representation of the control flow graph suitable for viewing with
14984 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14985 the file is pretty-printed as a subgraph, so that GraphViz can render them
14986 all in a single plot.
14987
14988 This option currently only works for RTL dumps, and the RTL is always
14989 dumped in slim form.
14990 @item vops
14991 Enable showing virtual operands for every statement.
14992 @item lineno
14993 Enable showing line numbers for statements.
14994 @item uid
14995 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14996 @item verbose
14997 Enable showing the tree dump for each statement.
14998 @item eh
14999 Enable showing the EH region number holding each statement.
15000 @item scev
15001 Enable showing scalar evolution analysis details.
15002 @item optimized
15003 Enable showing optimization information (only available in certain
15004 passes).
15005 @item missed
15006 Enable showing missed optimization information (only available in certain
15007 passes).
15008 @item note
15009 Enable other detailed optimization information (only available in
15010 certain passes).
15011 @item all
15012 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
15013 and @option{lineno}.
15014 @item optall
15015 Turn on all optimization options, i.e., @option{optimized},
15016 @option{missed}, and @option{note}.
15017 @end table
15018
15019 To determine what tree dumps are available or find the dump for a pass
15020 of interest follow the steps below.
15021
15022 @enumerate
15023 @item
15024 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
15025 look for a code that corresponds to the pass you are interested in.
15026 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
15027 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
15028 The number at the end distinguishes distinct invocations of the same pass.
15029 @item
15030 To enable the creation of the dump file, append the pass code to
15031 the @option{-fdump-} option prefix and invoke GCC with it. For example,
15032 to enable the dump from the Early Value Range Propagation pass, invoke
15033 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
15034 specify the name of the dump file. If you don't specify one, GCC
15035 creates as described below.
15036 @item
15037 Find the pass dump in a file whose name is composed of three components
15038 separated by a period: the name of the source file GCC was invoked to
15039 compile, a numeric suffix indicating the pass number followed by the
15040 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
15041 and finally the pass code. For example, the Early VRP pass dump might
15042 be in a file named @file{myfile.c.038t.evrp} in the current working
15043 directory. Note that the numeric codes are not stable and may change
15044 from one version of GCC to another.
15045 @end enumerate
15046
15047 @item -fopt-info
15048 @itemx -fopt-info-@var{options}
15049 @itemx -fopt-info-@var{options}=@var{filename}
15050 @opindex fopt-info
15051 Controls optimization dumps from various optimization passes. If the
15052 @samp{-@var{options}} form is used, @var{options} is a list of
15053 @samp{-} separated option keywords to select the dump details and
15054 optimizations.
15055
15056 The @var{options} can be divided into three groups:
15057 @enumerate
15058 @item
15059 options describing what kinds of messages should be emitted,
15060 @item
15061 options describing the verbosity of the dump, and
15062 @item
15063 options describing which optimizations should be included.
15064 @end enumerate
15065 The options from each group can be freely mixed as they are
15066 non-overlapping. However, in case of any conflicts,
15067 the later options override the earlier options on the command
15068 line.
15069
15070 The following options control which kinds of messages should be emitted:
15071
15072 @table @samp
15073 @item optimized
15074 Print information when an optimization is successfully applied. It is
15075 up to a pass to decide which information is relevant. For example, the
15076 vectorizer passes print the source location of loops which are
15077 successfully vectorized.
15078 @item missed
15079 Print information about missed optimizations. Individual passes
15080 control which information to include in the output.
15081 @item note
15082 Print verbose information about optimizations, such as certain
15083 transformations, more detailed messages about decisions etc.
15084 @item all
15085 Print detailed optimization information. This includes
15086 @samp{optimized}, @samp{missed}, and @samp{note}.
15087 @end table
15088
15089 The following option controls the dump verbosity:
15090
15091 @table @samp
15092 @item internals
15093 By default, only ``high-level'' messages are emitted. This option enables
15094 additional, more detailed, messages, which are likely to only be of interest
15095 to GCC developers.
15096 @end table
15097
15098 One or more of the following option keywords can be used to describe a
15099 group of optimizations:
15100
15101 @table @samp
15102 @item ipa
15103 Enable dumps from all interprocedural optimizations.
15104 @item loop
15105 Enable dumps from all loop optimizations.
15106 @item inline
15107 Enable dumps from all inlining optimizations.
15108 @item omp
15109 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
15110 @item vec
15111 Enable dumps from all vectorization optimizations.
15112 @item optall
15113 Enable dumps from all optimizations. This is a superset of
15114 the optimization groups listed above.
15115 @end table
15116
15117 If @var{options} is
15118 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15119 about successful optimizations from all the passes, omitting messages
15120 that are treated as ``internals''.
15121
15122 If the @var{filename} is provided, then the dumps from all the
15123 applicable optimizations are concatenated into the @var{filename}.
15124 Otherwise the dump is output onto @file{stderr}. Though multiple
15125 @option{-fopt-info} options are accepted, only one of them can include
15126 a @var{filename}. If other filenames are provided then all but the
15127 first such option are ignored.
15128
15129 Note that the output @var{filename} is overwritten
15130 in case of multiple translation units. If a combined output from
15131 multiple translation units is desired, @file{stderr} should be used
15132 instead.
15133
15134 In the following example, the optimization info is output to
15135 @file{stderr}:
15136
15137 @smallexample
15138 gcc -O3 -fopt-info
15139 @end smallexample
15140
15141 This example:
15142 @smallexample
15143 gcc -O3 -fopt-info-missed=missed.all
15144 @end smallexample
15145
15146 @noindent
15147 outputs missed optimization report from all the passes into
15148 @file{missed.all}, and this one:
15149
15150 @smallexample
15151 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15152 @end smallexample
15153
15154 @noindent
15155 prints information about missed optimization opportunities from
15156 vectorization passes on @file{stderr}.
15157 Note that @option{-fopt-info-vec-missed} is equivalent to
15158 @option{-fopt-info-missed-vec}. The order of the optimization group
15159 names and message types listed after @option{-fopt-info} does not matter.
15160
15161 As another example,
15162 @smallexample
15163 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15164 @end smallexample
15165
15166 @noindent
15167 outputs information about missed optimizations as well as
15168 optimized locations from all the inlining passes into
15169 @file{inline.txt}.
15170
15171 Finally, consider:
15172
15173 @smallexample
15174 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15175 @end smallexample
15176
15177 @noindent
15178 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15179 in conflict since only one output file is allowed. In this case, only
15180 the first option takes effect and the subsequent options are
15181 ignored. Thus only @file{vec.miss} is produced which contains
15182 dumps from the vectorizer about missed opportunities.
15183
15184 @item -fsave-optimization-record
15185 @opindex fsave-optimization-record
15186 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15187 were performed, for those optimizations that support @option{-fopt-info}.
15188
15189 This option is experimental and the format of the data within the
15190 compressed JSON file is subject to change.
15191
15192 It is roughly equivalent to a machine-readable version of
15193 @option{-fopt-info-all}, as a collection of messages with source file,
15194 line number and column number, with the following additional data for
15195 each message:
15196
15197 @itemize @bullet
15198
15199 @item
15200 the execution count of the code being optimized, along with metadata about
15201 whether this was from actual profile data, or just an estimate, allowing
15202 consumers to prioritize messages by code hotness,
15203
15204 @item
15205 the function name of the code being optimized, where applicable,
15206
15207 @item
15208 the ``inlining chain'' for the code being optimized, so that when
15209 a function is inlined into several different places (which might
15210 themselves be inlined), the reader can distinguish between the copies,
15211
15212 @item
15213 objects identifying those parts of the message that refer to expressions,
15214 statements or symbol-table nodes, which of these categories they are, and,
15215 when available, their source code location,
15216
15217 @item
15218 the GCC pass that emitted the message, and
15219
15220 @item
15221 the location in GCC's own code from which the message was emitted
15222
15223 @end itemize
15224
15225 Additionally, some messages are logically nested within other
15226 messages, reflecting implementation details of the optimization
15227 passes.
15228
15229 @item -fsched-verbose=@var{n}
15230 @opindex fsched-verbose
15231 On targets that use instruction scheduling, this option controls the
15232 amount of debugging output the scheduler prints to the dump files.
15233
15234 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15235 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15236 For @var{n} greater than one, it also output basic block probabilities,
15237 detailed ready list information and unit/insn info. For @var{n} greater
15238 than two, it includes RTL at abort point, control-flow and regions info.
15239 And for @var{n} over four, @option{-fsched-verbose} also includes
15240 dependence info.
15241
15242
15243
15244 @item -fenable-@var{kind}-@var{pass}
15245 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15246 @opindex fdisable-
15247 @opindex fenable-
15248
15249 This is a set of options that are used to explicitly disable/enable
15250 optimization passes. These options are intended for use for debugging GCC.
15251 Compiler users should use regular options for enabling/disabling
15252 passes instead.
15253
15254 @table @gcctabopt
15255
15256 @item -fdisable-ipa-@var{pass}
15257 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15258 statically invoked in the compiler multiple times, the pass name should be
15259 appended with a sequential number starting from 1.
15260
15261 @item -fdisable-rtl-@var{pass}
15262 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15263 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15264 statically invoked in the compiler multiple times, the pass name should be
15265 appended with a sequential number starting from 1. @var{range-list} is a
15266 comma-separated list of function ranges or assembler names. Each range is a number
15267 pair separated by a colon. The range is inclusive in both ends. If the range
15268 is trivial, the number pair can be simplified as a single number. If the
15269 function's call graph node's @var{uid} falls within one of the specified ranges,
15270 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15271 function header of a dump file, and the pass names can be dumped by using
15272 option @option{-fdump-passes}.
15273
15274 @item -fdisable-tree-@var{pass}
15275 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15276 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15277 option arguments.
15278
15279 @item -fenable-ipa-@var{pass}
15280 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15281 statically invoked in the compiler multiple times, the pass name should be
15282 appended with a sequential number starting from 1.
15283
15284 @item -fenable-rtl-@var{pass}
15285 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15286 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15287 description and examples.
15288
15289 @item -fenable-tree-@var{pass}
15290 @itemx -fenable-tree-@var{pass}=@var{range-list}
15291 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15292 of option arguments.
15293
15294 @end table
15295
15296 Here are some examples showing uses of these options.
15297
15298 @smallexample
15299
15300 # disable ccp1 for all functions
15301 -fdisable-tree-ccp1
15302 # disable complete unroll for function whose cgraph node uid is 1
15303 -fenable-tree-cunroll=1
15304 # disable gcse2 for functions at the following ranges [1,1],
15305 # [300,400], and [400,1000]
15306 # disable gcse2 for functions foo and foo2
15307 -fdisable-rtl-gcse2=foo,foo2
15308 # disable early inlining
15309 -fdisable-tree-einline
15310 # disable ipa inlining
15311 -fdisable-ipa-inline
15312 # enable tree full unroll
15313 -fenable-tree-unroll
15314
15315 @end smallexample
15316
15317 @item -fchecking
15318 @itemx -fchecking=@var{n}
15319 @opindex fchecking
15320 @opindex fno-checking
15321 Enable internal consistency checking. The default depends on
15322 the compiler configuration. @option{-fchecking=2} enables further
15323 internal consistency checking that might affect code generation.
15324
15325 @item -frandom-seed=@var{string}
15326 @opindex frandom-seed
15327 This option provides a seed that GCC uses in place of
15328 random numbers in generating certain symbol names
15329 that have to be different in every compiled file. It is also used to
15330 place unique stamps in coverage data files and the object files that
15331 produce them. You can use the @option{-frandom-seed} option to produce
15332 reproducibly identical object files.
15333
15334 The @var{string} can either be a number (decimal, octal or hex) or an
15335 arbitrary string (in which case it's converted to a number by
15336 computing CRC32).
15337
15338 The @var{string} should be different for every file you compile.
15339
15340 @item -save-temps
15341 @itemx -save-temps=cwd
15342 @opindex save-temps
15343 Store the usual ``temporary'' intermediate files permanently; place them
15344 in the current directory and name them based on the source file. Thus,
15345 compiling @file{foo.c} with @option{-c -save-temps} produces files
15346 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15347 preprocessed @file{foo.i} output file even though the compiler now
15348 normally uses an integrated preprocessor.
15349
15350 When used in combination with the @option{-x} command-line option,
15351 @option{-save-temps} is sensible enough to avoid over writing an
15352 input source file with the same extension as an intermediate file.
15353 The corresponding intermediate file may be obtained by renaming the
15354 source file before using @option{-save-temps}.
15355
15356 If you invoke GCC in parallel, compiling several different source
15357 files that share a common base name in different subdirectories or the
15358 same source file compiled for multiple output destinations, it is
15359 likely that the different parallel compilers will interfere with each
15360 other, and overwrite the temporary files. For instance:
15361
15362 @smallexample
15363 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15364 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15365 @end smallexample
15366
15367 may result in @file{foo.i} and @file{foo.o} being written to
15368 simultaneously by both compilers.
15369
15370 @item -save-temps=obj
15371 @opindex save-temps=obj
15372 Store the usual ``temporary'' intermediate files permanently. If the
15373 @option{-o} option is used, the temporary files are based on the
15374 object file. If the @option{-o} option is not used, the
15375 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15376
15377 For example:
15378
15379 @smallexample
15380 gcc -save-temps=obj -c foo.c
15381 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15382 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15383 @end smallexample
15384
15385 @noindent
15386 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15387 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15388 @file{dir2/yfoobar.o}.
15389
15390 @item -time@r{[}=@var{file}@r{]}
15391 @opindex time
15392 Report the CPU time taken by each subprocess in the compilation
15393 sequence. For C source files, this is the compiler proper and assembler
15394 (plus the linker if linking is done).
15395
15396 Without the specification of an output file, the output looks like this:
15397
15398 @smallexample
15399 # cc1 0.12 0.01
15400 # as 0.00 0.01
15401 @end smallexample
15402
15403 The first number on each line is the ``user time'', that is time spent
15404 executing the program itself. The second number is ``system time'',
15405 time spent executing operating system routines on behalf of the program.
15406 Both numbers are in seconds.
15407
15408 With the specification of an output file, the output is appended to the
15409 named file, and it looks like this:
15410
15411 @smallexample
15412 0.12 0.01 cc1 @var{options}
15413 0.00 0.01 as @var{options}
15414 @end smallexample
15415
15416 The ``user time'' and the ``system time'' are moved before the program
15417 name, and the options passed to the program are displayed, so that one
15418 can later tell what file was being compiled, and with which options.
15419
15420 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15421 @opindex fdump-final-insns
15422 Dump the final internal representation (RTL) to @var{file}. If the
15423 optional argument is omitted (or if @var{file} is @code{.}), the name
15424 of the dump file is determined by appending @code{.gkd} to the
15425 compilation output file name.
15426
15427 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15428 @opindex fcompare-debug
15429 @opindex fno-compare-debug
15430 If no error occurs during compilation, run the compiler a second time,
15431 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15432 passed to the second compilation. Dump the final internal
15433 representation in both compilations, and print an error if they differ.
15434
15435 If the equal sign is omitted, the default @option{-gtoggle} is used.
15436
15437 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15438 and nonzero, implicitly enables @option{-fcompare-debug}. If
15439 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15440 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15441 is used.
15442
15443 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15444 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15445 of the final representation and the second compilation, preventing even
15446 @env{GCC_COMPARE_DEBUG} from taking effect.
15447
15448 To verify full coverage during @option{-fcompare-debug} testing, set
15449 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15450 which GCC rejects as an invalid option in any actual compilation
15451 (rather than preprocessing, assembly or linking). To get just a
15452 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15453 not overridden} will do.
15454
15455 @item -fcompare-debug-second
15456 @opindex fcompare-debug-second
15457 This option is implicitly passed to the compiler for the second
15458 compilation requested by @option{-fcompare-debug}, along with options to
15459 silence warnings, and omitting other options that would cause the compiler
15460 to produce output to files or to standard output as a side effect. Dump
15461 files and preserved temporary files are renamed so as to contain the
15462 @code{.gk} additional extension during the second compilation, to avoid
15463 overwriting those generated by the first.
15464
15465 When this option is passed to the compiler driver, it causes the
15466 @emph{first} compilation to be skipped, which makes it useful for little
15467 other than debugging the compiler proper.
15468
15469 @item -gtoggle
15470 @opindex gtoggle
15471 Turn off generation of debug info, if leaving out this option
15472 generates it, or turn it on at level 2 otherwise. The position of this
15473 argument in the command line does not matter; it takes effect after all
15474 other options are processed, and it does so only once, no matter how
15475 many times it is given. This is mainly intended to be used with
15476 @option{-fcompare-debug}.
15477
15478 @item -fvar-tracking-assignments-toggle
15479 @opindex fvar-tracking-assignments-toggle
15480 @opindex fno-var-tracking-assignments-toggle
15481 Toggle @option{-fvar-tracking-assignments}, in the same way that
15482 @option{-gtoggle} toggles @option{-g}.
15483
15484 @item -Q
15485 @opindex Q
15486 Makes the compiler print out each function name as it is compiled, and
15487 print some statistics about each pass when it finishes.
15488
15489 @item -ftime-report
15490 @opindex ftime-report
15491 Makes the compiler print some statistics about the time consumed by each
15492 pass when it finishes.
15493
15494 @item -ftime-report-details
15495 @opindex ftime-report-details
15496 Record the time consumed by infrastructure parts separately for each pass.
15497
15498 @item -fira-verbose=@var{n}
15499 @opindex fira-verbose
15500 Control the verbosity of the dump file for the integrated register allocator.
15501 The default value is 5. If the value @var{n} is greater or equal to 10,
15502 the dump output is sent to stderr using the same format as @var{n} minus 10.
15503
15504 @item -flto-report
15505 @opindex flto-report
15506 Prints a report with internal details on the workings of the link-time
15507 optimizer. The contents of this report vary from version to version.
15508 It is meant to be useful to GCC developers when processing object
15509 files in LTO mode (via @option{-flto}).
15510
15511 Disabled by default.
15512
15513 @item -flto-report-wpa
15514 @opindex flto-report-wpa
15515 Like @option{-flto-report}, but only print for the WPA phase of link-time
15516 optimization.
15517
15518 @item -fmem-report
15519 @opindex fmem-report
15520 Makes the compiler print some statistics about permanent memory
15521 allocation when it finishes.
15522
15523 @item -fmem-report-wpa
15524 @opindex fmem-report-wpa
15525 Makes the compiler print some statistics about permanent memory
15526 allocation for the WPA phase only.
15527
15528 @item -fpre-ipa-mem-report
15529 @opindex fpre-ipa-mem-report
15530 @item -fpost-ipa-mem-report
15531 @opindex fpost-ipa-mem-report
15532 Makes the compiler print some statistics about permanent memory
15533 allocation before or after interprocedural optimization.
15534
15535 @item -fprofile-report
15536 @opindex fprofile-report
15537 Makes the compiler print some statistics about consistency of the
15538 (estimated) profile and effect of individual passes.
15539
15540 @item -fstack-usage
15541 @opindex fstack-usage
15542 Makes the compiler output stack usage information for the program, on a
15543 per-function basis. The filename for the dump is made by appending
15544 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15545 the output file, if explicitly specified and it is not an executable,
15546 otherwise it is the basename of the source file. An entry is made up
15547 of three fields:
15548
15549 @itemize
15550 @item
15551 The name of the function.
15552 @item
15553 A number of bytes.
15554 @item
15555 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15556 @end itemize
15557
15558 The qualifier @code{static} means that the function manipulates the stack
15559 statically: a fixed number of bytes are allocated for the frame on function
15560 entry and released on function exit; no stack adjustments are otherwise made
15561 in the function. The second field is this fixed number of bytes.
15562
15563 The qualifier @code{dynamic} means that the function manipulates the stack
15564 dynamically: in addition to the static allocation described above, stack
15565 adjustments are made in the body of the function, for example to push/pop
15566 arguments around function calls. If the qualifier @code{bounded} is also
15567 present, the amount of these adjustments is bounded at compile time and
15568 the second field is an upper bound of the total amount of stack used by
15569 the function. If it is not present, the amount of these adjustments is
15570 not bounded at compile time and the second field only represents the
15571 bounded part.
15572
15573 @item -fstats
15574 @opindex fstats
15575 Emit statistics about front-end processing at the end of the compilation.
15576 This option is supported only by the C++ front end, and
15577 the information is generally only useful to the G++ development team.
15578
15579 @item -fdbg-cnt-list
15580 @opindex fdbg-cnt-list
15581 Print the name and the counter upper bound for all debug counters.
15582
15583
15584 @item -fdbg-cnt=@var{counter-value-list}
15585 @opindex fdbg-cnt
15586 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15587 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15588 tuples which sets the lower and the upper bound of each debug
15589 counter @var{name}. The @var{lower_bound} is optional and is zero
15590 initialized if not set.
15591 All debug counters have the initial upper bound of @code{UINT_MAX};
15592 thus @code{dbg_cnt} returns true always unless the upper bound
15593 is set by this option.
15594 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15595 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15596 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15597
15598 @item -print-file-name=@var{library}
15599 @opindex print-file-name
15600 Print the full absolute name of the library file @var{library} that
15601 would be used when linking---and don't do anything else. With this
15602 option, GCC does not compile or link anything; it just prints the
15603 file name.
15604
15605 @item -print-multi-directory
15606 @opindex print-multi-directory
15607 Print the directory name corresponding to the multilib selected by any
15608 other switches present in the command line. This directory is supposed
15609 to exist in @env{GCC_EXEC_PREFIX}.
15610
15611 @item -print-multi-lib
15612 @opindex print-multi-lib
15613 Print the mapping from multilib directory names to compiler switches
15614 that enable them. The directory name is separated from the switches by
15615 @samp{;}, and each switch starts with an @samp{@@} instead of the
15616 @samp{-}, without spaces between multiple switches. This is supposed to
15617 ease shell processing.
15618
15619 @item -print-multi-os-directory
15620 @opindex print-multi-os-directory
15621 Print the path to OS libraries for the selected
15622 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15623 present in the @file{lib} subdirectory and no multilibs are used, this is
15624 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15625 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15626 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15627 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15628
15629 @item -print-multiarch
15630 @opindex print-multiarch
15631 Print the path to OS libraries for the selected multiarch,
15632 relative to some @file{lib} subdirectory.
15633
15634 @item -print-prog-name=@var{program}
15635 @opindex print-prog-name
15636 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15637
15638 @item -print-libgcc-file-name
15639 @opindex print-libgcc-file-name
15640 Same as @option{-print-file-name=libgcc.a}.
15641
15642 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15643 but you do want to link with @file{libgcc.a}. You can do:
15644
15645 @smallexample
15646 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15647 @end smallexample
15648
15649 @item -print-search-dirs
15650 @opindex print-search-dirs
15651 Print the name of the configured installation directory and a list of
15652 program and library directories @command{gcc} searches---and don't do anything else.
15653
15654 This is useful when @command{gcc} prints the error message
15655 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15656 To resolve this you either need to put @file{cpp0} and the other compiler
15657 components where @command{gcc} expects to find them, or you can set the environment
15658 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15659 Don't forget the trailing @samp{/}.
15660 @xref{Environment Variables}.
15661
15662 @item -print-sysroot
15663 @opindex print-sysroot
15664 Print the target sysroot directory that is used during
15665 compilation. This is the target sysroot specified either at configure
15666 time or using the @option{--sysroot} option, possibly with an extra
15667 suffix that depends on compilation options. If no target sysroot is
15668 specified, the option prints nothing.
15669
15670 @item -print-sysroot-headers-suffix
15671 @opindex print-sysroot-headers-suffix
15672 Print the suffix added to the target sysroot when searching for
15673 headers, or give an error if the compiler is not configured with such
15674 a suffix---and don't do anything else.
15675
15676 @item -dumpmachine
15677 @opindex dumpmachine
15678 Print the compiler's target machine (for example,
15679 @samp{i686-pc-linux-gnu})---and don't do anything else.
15680
15681 @item -dumpversion
15682 @opindex dumpversion
15683 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15684 anything else. This is the compiler version used in filesystem paths and
15685 specs. Depending on how the compiler has been configured it can be just
15686 a single number (major version), two numbers separated by a dot (major and
15687 minor version) or three numbers separated by dots (major, minor and patchlevel
15688 version).
15689
15690 @item -dumpfullversion
15691 @opindex dumpfullversion
15692 Print the full compiler version---and don't do anything else. The output is
15693 always three numbers separated by dots, major, minor and patchlevel version.
15694
15695 @item -dumpspecs
15696 @opindex dumpspecs
15697 Print the compiler's built-in specs---and don't do anything else. (This
15698 is used when GCC itself is being built.) @xref{Spec Files}.
15699 @end table
15700
15701 @node Submodel Options
15702 @section Machine-Dependent Options
15703 @cindex submodel options
15704 @cindex specifying hardware config
15705 @cindex hardware models and configurations, specifying
15706 @cindex target-dependent options
15707 @cindex machine-dependent options
15708
15709 Each target machine supported by GCC can have its own options---for
15710 example, to allow you to compile for a particular processor variant or
15711 ABI, or to control optimizations specific to that machine. By
15712 convention, the names of machine-specific options start with
15713 @samp{-m}.
15714
15715 Some configurations of the compiler also support additional target-specific
15716 options, usually for compatibility with other compilers on the same
15717 platform.
15718
15719 @c This list is ordered alphanumerically by subsection name.
15720 @c It should be the same order and spelling as these options are listed
15721 @c in Machine Dependent Options
15722
15723 @menu
15724 * AArch64 Options::
15725 * Adapteva Epiphany Options::
15726 * AMD GCN Options::
15727 * ARC Options::
15728 * ARM Options::
15729 * AVR Options::
15730 * Blackfin Options::
15731 * C6X Options::
15732 * CRIS Options::
15733 * CR16 Options::
15734 * C-SKY Options::
15735 * Darwin Options::
15736 * DEC Alpha Options::
15737 * eBPF Options::
15738 * FR30 Options::
15739 * FT32 Options::
15740 * FRV Options::
15741 * GNU/Linux Options::
15742 * H8/300 Options::
15743 * HPPA Options::
15744 * IA-64 Options::
15745 * LM32 Options::
15746 * M32C Options::
15747 * M32R/D Options::
15748 * M680x0 Options::
15749 * MCore Options::
15750 * MeP Options::
15751 * MicroBlaze Options::
15752 * MIPS Options::
15753 * MMIX Options::
15754 * MN10300 Options::
15755 * Moxie Options::
15756 * MSP430 Options::
15757 * NDS32 Options::
15758 * Nios II Options::
15759 * Nvidia PTX Options::
15760 * OpenRISC Options::
15761 * PDP-11 Options::
15762 * picoChip Options::
15763 * PowerPC Options::
15764 * PRU Options::
15765 * RISC-V Options::
15766 * RL78 Options::
15767 * RS/6000 and PowerPC Options::
15768 * RX Options::
15769 * S/390 and zSeries Options::
15770 * Score Options::
15771 * SH Options::
15772 * Solaris 2 Options::
15773 * SPARC Options::
15774 * System V Options::
15775 * TILE-Gx Options::
15776 * TILEPro Options::
15777 * V850 Options::
15778 * VAX Options::
15779 * Visium Options::
15780 * VMS Options::
15781 * VxWorks Options::
15782 * x86 Options::
15783 * x86 Windows Options::
15784 * Xstormy16 Options::
15785 * Xtensa Options::
15786 * zSeries Options::
15787 @end menu
15788
15789 @node AArch64 Options
15790 @subsection AArch64 Options
15791 @cindex AArch64 Options
15792
15793 These options are defined for AArch64 implementations:
15794
15795 @table @gcctabopt
15796
15797 @item -mabi=@var{name}
15798 @opindex mabi
15799 Generate code for the specified data model. Permissible values
15800 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15801 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15802 but long int and pointers are 64 bits.
15803
15804 The default depends on the specific target configuration. Note that
15805 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15806 entire program with the same ABI, and link with a compatible set of libraries.
15807
15808 @item -mbig-endian
15809 @opindex mbig-endian
15810 Generate big-endian code. This is the default when GCC is configured for an
15811 @samp{aarch64_be-*-*} target.
15812
15813 @item -mgeneral-regs-only
15814 @opindex mgeneral-regs-only
15815 Generate code which uses only the general-purpose registers. This will prevent
15816 the compiler from using floating-point and Advanced SIMD registers but will not
15817 impose any restrictions on the assembler.
15818
15819 @item -mlittle-endian
15820 @opindex mlittle-endian
15821 Generate little-endian code. This is the default when GCC is configured for an
15822 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15823
15824 @item -mcmodel=tiny
15825 @opindex mcmodel=tiny
15826 Generate code for the tiny code model. The program and its statically defined
15827 symbols must be within 1MB of each other. Programs can be statically or
15828 dynamically linked.
15829
15830 @item -mcmodel=small
15831 @opindex mcmodel=small
15832 Generate code for the small code model. The program and its statically defined
15833 symbols must be within 4GB of each other. Programs can be statically or
15834 dynamically linked. This is the default code model.
15835
15836 @item -mcmodel=large
15837 @opindex mcmodel=large
15838 Generate code for the large code model. This makes no assumptions about
15839 addresses and sizes of sections. Programs can be statically linked only.
15840
15841 @item -mstrict-align
15842 @itemx -mno-strict-align
15843 @opindex mstrict-align
15844 @opindex mno-strict-align
15845 Avoid or allow generating memory accesses that may not be aligned on a natural
15846 object boundary as described in the architecture specification.
15847
15848 @item -momit-leaf-frame-pointer
15849 @itemx -mno-omit-leaf-frame-pointer
15850 @opindex momit-leaf-frame-pointer
15851 @opindex mno-omit-leaf-frame-pointer
15852 Omit or keep the frame pointer in leaf functions. The former behavior is the
15853 default.
15854
15855 @item -mstack-protector-guard=@var{guard}
15856 @itemx -mstack-protector-guard-reg=@var{reg}
15857 @itemx -mstack-protector-guard-offset=@var{offset}
15858 @opindex mstack-protector-guard
15859 @opindex mstack-protector-guard-reg
15860 @opindex mstack-protector-guard-offset
15861 Generate stack protection code using canary at @var{guard}. Supported
15862 locations are @samp{global} for a global canary or @samp{sysreg} for a
15863 canary in an appropriate system register.
15864
15865 With the latter choice the options
15866 @option{-mstack-protector-guard-reg=@var{reg}} and
15867 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15868 which system register to use as base register for reading the canary,
15869 and from what offset from that base register. There is no default
15870 register or offset as this is entirely for use within the Linux
15871 kernel.
15872
15873 @item -mstack-protector-guard=@var{guard}
15874 @itemx -mstack-protector-guard-reg=@var{reg}
15875 @itemx -mstack-protector-guard-offset=@var{offset}
15876 @opindex mstack-protector-guard
15877 @opindex mstack-protector-guard-reg
15878 @opindex mstack-protector-guard-offset
15879 Generate stack protection code using canary at @var{guard}. Supported
15880 locations are @samp{global} for a global canary or @samp{sysreg} for a
15881 canary in an appropriate system register.
15882
15883 With the latter choice the options
15884 @option{-mstack-protector-guard-reg=@var{reg}} and
15885 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15886 which system register to use as base register for reading the canary,
15887 and from what offset from that base register. There is no default
15888 register or offset as this is entirely for use within the Linux
15889 kernel.
15890
15891 @item -mtls-dialect=desc
15892 @opindex mtls-dialect=desc
15893 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15894 of TLS variables. This is the default.
15895
15896 @item -mtls-dialect=traditional
15897 @opindex mtls-dialect=traditional
15898 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15899 of TLS variables.
15900
15901 @item -mtls-size=@var{size}
15902 @opindex mtls-size
15903 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15904 This option requires binutils 2.26 or newer.
15905
15906 @item -mfix-cortex-a53-835769
15907 @itemx -mno-fix-cortex-a53-835769
15908 @opindex mfix-cortex-a53-835769
15909 @opindex mno-fix-cortex-a53-835769
15910 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15911 This involves inserting a NOP instruction between memory instructions and
15912 64-bit integer multiply-accumulate instructions.
15913
15914 @item -mfix-cortex-a53-843419
15915 @itemx -mno-fix-cortex-a53-843419
15916 @opindex mfix-cortex-a53-843419
15917 @opindex mno-fix-cortex-a53-843419
15918 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15919 This erratum workaround is made at link time and this will only pass the
15920 corresponding flag to the linker.
15921
15922 @item -mlow-precision-recip-sqrt
15923 @itemx -mno-low-precision-recip-sqrt
15924 @opindex mlow-precision-recip-sqrt
15925 @opindex mno-low-precision-recip-sqrt
15926 Enable or disable the reciprocal square root approximation.
15927 This option only has an effect if @option{-ffast-math} or
15928 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15929 precision of reciprocal square root results to about 16 bits for
15930 single precision and to 32 bits for double precision.
15931
15932 @item -mlow-precision-sqrt
15933 @itemx -mno-low-precision-sqrt
15934 @opindex mlow-precision-sqrt
15935 @opindex mno-low-precision-sqrt
15936 Enable or disable the square root approximation.
15937 This option only has an effect if @option{-ffast-math} or
15938 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15939 precision of square root results to about 16 bits for
15940 single precision and to 32 bits for double precision.
15941 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15942
15943 @item -mlow-precision-div
15944 @itemx -mno-low-precision-div
15945 @opindex mlow-precision-div
15946 @opindex mno-low-precision-div
15947 Enable or disable the division approximation.
15948 This option only has an effect if @option{-ffast-math} or
15949 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15950 precision of division results to about 16 bits for
15951 single precision and to 32 bits for double precision.
15952
15953 @item -mtrack-speculation
15954 @itemx -mno-track-speculation
15955 Enable or disable generation of additional code to track speculative
15956 execution through conditional branches. The tracking state can then
15957 be used by the compiler when expanding calls to
15958 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15959 sequence to be generated.
15960
15961 @item -moutline-atomics
15962 @itemx -mno-outline-atomics
15963 Enable or disable calls to out-of-line helpers to implement atomic operations.
15964 These helpers will, at runtime, determine if the LSE instructions from
15965 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
15966 instructions that are present in the base ARMv8.0 ISA.
15967
15968 This option is only applicable when compiling for the base ARMv8.0
15969 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
15970 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
15971 used directly. The same applies when using @option{-mcpu=} when the
15972 selected cpu supports the @samp{lse} feature.
15973
15974 @item -march=@var{name}
15975 @opindex march
15976 Specify the name of the target architecture and, optionally, one or
15977 more feature modifiers. This option has the form
15978 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15979
15980 The permissible values for @var{arch} are @samp{armv8-a},
15981 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15982 @samp{armv8.5-a} or @var{native}.
15983
15984 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15985 support for the ARMv8.5-A architecture extensions.
15986
15987 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15988 support for the ARMv8.4-A architecture extensions.
15989
15990 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15991 support for the ARMv8.3-A architecture extensions.
15992
15993 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15994 support for the ARMv8.2-A architecture extensions.
15995
15996 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15997 support for the ARMv8.1-A architecture extension. In particular, it
15998 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15999
16000 The value @samp{native} is available on native AArch64 GNU/Linux and
16001 causes the compiler to pick the architecture of the host system. This
16002 option has no effect if the compiler is unable to recognize the
16003 architecture of the host system,
16004
16005 The permissible values for @var{feature} are listed in the sub-section
16006 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16007 Feature Modifiers}. Where conflicting feature modifiers are
16008 specified, the right-most feature is used.
16009
16010 GCC uses @var{name} to determine what kind of instructions it can emit
16011 when generating assembly code. If @option{-march} is specified
16012 without either of @option{-mtune} or @option{-mcpu} also being
16013 specified, the code is tuned to perform well across a range of target
16014 processors implementing the target architecture.
16015
16016 @item -mtune=@var{name}
16017 @opindex mtune
16018 Specify the name of the target processor for which GCC should tune the
16019 performance of the code. Permissible values for this option are:
16020 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16021 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16022 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
16023 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
16024 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
16025 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
16026 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
16027 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
16028 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
16029 @samp{thunderxt83}, @samp{thunderx2t99},
16030 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16031 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16032 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
16033 @samp{native}.
16034
16035 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16036 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16037 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
16038 should tune for a big.LITTLE system.
16039
16040 Additionally on native AArch64 GNU/Linux systems the value
16041 @samp{native} tunes performance to the host system. This option has no effect
16042 if the compiler is unable to recognize the processor of the host system.
16043
16044 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
16045 are specified, the code is tuned to perform well across a range
16046 of target processors.
16047
16048 This option cannot be suffixed by feature modifiers.
16049
16050 @item -mcpu=@var{name}
16051 @opindex mcpu
16052 Specify the name of the target processor, optionally suffixed by one
16053 or more feature modifiers. This option has the form
16054 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
16055 the permissible values for @var{cpu} are the same as those available
16056 for @option{-mtune}. The permissible values for @var{feature} are
16057 documented in the sub-section on
16058 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16059 Feature Modifiers}. Where conflicting feature modifiers are
16060 specified, the right-most feature is used.
16061
16062 GCC uses @var{name} to determine what kind of instructions it can emit when
16063 generating assembly code (as if by @option{-march}) and to determine
16064 the target processor for which to tune for performance (as if
16065 by @option{-mtune}). Where this option is used in conjunction
16066 with @option{-march} or @option{-mtune}, those options take precedence
16067 over the appropriate part of this option.
16068
16069 @item -moverride=@var{string}
16070 @opindex moverride
16071 Override tuning decisions made by the back-end in response to a
16072 @option{-mtune=} switch. The syntax, semantics, and accepted values
16073 for @var{string} in this option are not guaranteed to be consistent
16074 across releases.
16075
16076 This option is only intended to be useful when developing GCC.
16077
16078 @item -mverbose-cost-dump
16079 @opindex mverbose-cost-dump
16080 Enable verbose cost model dumping in the debug dump files. This option is
16081 provided for use in debugging the compiler.
16082
16083 @item -mpc-relative-literal-loads
16084 @itemx -mno-pc-relative-literal-loads
16085 @opindex mpc-relative-literal-loads
16086 @opindex mno-pc-relative-literal-loads
16087 Enable or disable PC-relative literal loads. With this option literal pools are
16088 accessed using a single instruction and emitted after each function. This
16089 limits the maximum size of functions to 1MB. This is enabled by default for
16090 @option{-mcmodel=tiny}.
16091
16092 @item -msign-return-address=@var{scope}
16093 @opindex msign-return-address
16094 Select the function scope on which return address signing will be applied.
16095 Permissible values are @samp{none}, which disables return address signing,
16096 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
16097 functions, and @samp{all}, which enables pointer signing for all functions. The
16098 default value is @samp{none}. This option has been deprecated by
16099 -mbranch-protection.
16100
16101 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
16102 @opindex mbranch-protection
16103 Select the branch protection features to use.
16104 @samp{none} is the default and turns off all types of branch protection.
16105 @samp{standard} turns on all types of branch protection features. If a feature
16106 has additional tuning options, then @samp{standard} sets it to its standard
16107 level.
16108 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
16109 level: signing functions that save the return address to memory (non-leaf
16110 functions will practically always do this) using the a-key. The optional
16111 argument @samp{leaf} can be used to extend the signing to include leaf
16112 functions. The optional argument @samp{b-key} can be used to sign the functions
16113 with the B-key instead of the A-key.
16114 @samp{bti} turns on branch target identification mechanism.
16115
16116 @item -msve-vector-bits=@var{bits}
16117 @opindex msve-vector-bits
16118 Specify the number of bits in an SVE vector register. This option only has
16119 an effect when SVE is enabled.
16120
16121 GCC supports two forms of SVE code generation: ``vector-length
16122 agnostic'' output that works with any size of vector register and
16123 ``vector-length specific'' output that allows GCC to make assumptions
16124 about the vector length when it is useful for optimization reasons.
16125 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
16126 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
16127 Specifying @samp{scalable} selects vector-length agnostic
16128 output. At present @samp{-msve-vector-bits=128} also generates vector-length
16129 agnostic output. All other values generate vector-length specific code.
16130 The behavior of these values may change in future releases and no value except
16131 @samp{scalable} should be relied on for producing code that is portable across
16132 different hardware SVE vector lengths.
16133
16134 The default is @samp{-msve-vector-bits=scalable}, which produces
16135 vector-length agnostic code.
16136 @end table
16137
16138 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16139 @anchor{aarch64-feature-modifiers}
16140 @cindex @option{-march} feature modifiers
16141 @cindex @option{-mcpu} feature modifiers
16142 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16143 the following and their inverses @option{no@var{feature}}:
16144
16145 @table @samp
16146 @item crc
16147 Enable CRC extension. This is on by default for
16148 @option{-march=armv8.1-a}.
16149 @item crypto
16150 Enable Crypto extension. This also enables Advanced SIMD and floating-point
16151 instructions.
16152 @item fp
16153 Enable floating-point instructions. This is on by default for all possible
16154 values for options @option{-march} and @option{-mcpu}.
16155 @item simd
16156 Enable Advanced SIMD instructions. This also enables floating-point
16157 instructions. This is on by default for all possible values for options
16158 @option{-march} and @option{-mcpu}.
16159 @item sve
16160 Enable Scalable Vector Extension instructions. This also enables Advanced
16161 SIMD and floating-point instructions.
16162 @item lse
16163 Enable Large System Extension instructions. This is on by default for
16164 @option{-march=armv8.1-a}.
16165 @item rdma
16166 Enable Round Double Multiply Accumulate instructions. This is on by default
16167 for @option{-march=armv8.1-a}.
16168 @item fp16
16169 Enable FP16 extension. This also enables floating-point instructions.
16170 @item fp16fml
16171 Enable FP16 fmla extension. This also enables FP16 extensions and
16172 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.
16173
16174 @item rcpc
16175 Enable the RcPc extension. This does not change code generation from GCC,
16176 but is passed on to the assembler, enabling inline asm statements to use
16177 instructions from the RcPc extension.
16178 @item dotprod
16179 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16180 @item aes
16181 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16182 SIMD instructions.
16183 @item sha2
16184 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16185 @item sha3
16186 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16187 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16188 @item sm4
16189 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16190 Use of this option with architectures prior to Armv8.2-A is not supported.
16191 @item profile
16192 Enable the Statistical Profiling extension. This option is only to enable the
16193 extension at the assembler level and does not affect code generation.
16194 @item rng
16195 Enable the Armv8.5-a Random Number instructions. This option is only to
16196 enable the extension at the assembler level and does not affect code
16197 generation.
16198 @item memtag
16199 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16200 enable the extension at the assembler level and does not affect code
16201 generation.
16202 @item sb
16203 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16204 enable the extension at the assembler level and does not affect code
16205 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16206 @item ssbs
16207 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16208 is only to enable the extension at the assembler level and does not affect code
16209 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16210 @item predres
16211 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16212 This option is only to enable the extension at the assembler level and does
16213 not affect code generation. This option is enabled by default for
16214 @item sve2
16215 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16216 instructions.
16217 @item sve2-bitperm
16218 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16219 @item sve2-sm4
16220 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16221 @item sve2-aes
16222 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16223 @item sve2-sha3
16224 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16225 @option{-march=armv8.5-a}.
16226 @item tme
16227 Enable the Transactional Memory Extension.
16228
16229 @end table
16230
16231 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16232 which implies @option{fp}.
16233 Conversely, @option{nofp} implies @option{nosimd}, which implies
16234 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16235
16236 @node Adapteva Epiphany Options
16237 @subsection Adapteva Epiphany Options
16238
16239 These @samp{-m} options are defined for Adapteva Epiphany:
16240
16241 @table @gcctabopt
16242 @item -mhalf-reg-file
16243 @opindex mhalf-reg-file
16244 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16245 That allows code to run on hardware variants that lack these registers.
16246
16247 @item -mprefer-short-insn-regs
16248 @opindex mprefer-short-insn-regs
16249 Preferentially allocate registers that allow short instruction generation.
16250 This can result in increased instruction count, so this may either reduce or
16251 increase overall code size.
16252
16253 @item -mbranch-cost=@var{num}
16254 @opindex mbranch-cost
16255 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16256 This cost is only a heuristic and is not guaranteed to produce
16257 consistent results across releases.
16258
16259 @item -mcmove
16260 @opindex mcmove
16261 Enable the generation of conditional moves.
16262
16263 @item -mnops=@var{num}
16264 @opindex mnops
16265 Emit @var{num} NOPs before every other generated instruction.
16266
16267 @item -mno-soft-cmpsf
16268 @opindex mno-soft-cmpsf
16269 @opindex msoft-cmpsf
16270 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16271 and test the flags. This is faster than a software comparison, but can
16272 get incorrect results in the presence of NaNs, or when two different small
16273 numbers are compared such that their difference is calculated as zero.
16274 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16275 software comparisons.
16276
16277 @item -mstack-offset=@var{num}
16278 @opindex mstack-offset
16279 Set the offset between the top of the stack and the stack pointer.
16280 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16281 can be used by leaf functions without stack allocation.
16282 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16283 Note also that this option changes the ABI; compiling a program with a
16284 different stack offset than the libraries have been compiled with
16285 generally does not work.
16286 This option can be useful if you want to evaluate if a different stack
16287 offset would give you better code, but to actually use a different stack
16288 offset to build working programs, it is recommended to configure the
16289 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16290
16291 @item -mno-round-nearest
16292 @opindex mno-round-nearest
16293 @opindex mround-nearest
16294 Make the scheduler assume that the rounding mode has been set to
16295 truncating. The default is @option{-mround-nearest}.
16296
16297 @item -mlong-calls
16298 @opindex mlong-calls
16299 If not otherwise specified by an attribute, assume all calls might be beyond
16300 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16301 function address into a register before performing a (otherwise direct) call.
16302 This is the default.
16303
16304 @item -mshort-calls
16305 @opindex short-calls
16306 If not otherwise specified by an attribute, assume all direct calls are
16307 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16308 for direct calls. The default is @option{-mlong-calls}.
16309
16310 @item -msmall16
16311 @opindex msmall16
16312 Assume addresses can be loaded as 16-bit unsigned values. This does not
16313 apply to function addresses for which @option{-mlong-calls} semantics
16314 are in effect.
16315
16316 @item -mfp-mode=@var{mode}
16317 @opindex mfp-mode
16318 Set the prevailing mode of the floating-point unit.
16319 This determines the floating-point mode that is provided and expected
16320 at function call and return time. Making this mode match the mode you
16321 predominantly need at function start can make your programs smaller and
16322 faster by avoiding unnecessary mode switches.
16323
16324 @var{mode} can be set to one the following values:
16325
16326 @table @samp
16327 @item caller
16328 Any mode at function entry is valid, and retained or restored when
16329 the function returns, and when it calls other functions.
16330 This mode is useful for compiling libraries or other compilation units
16331 you might want to incorporate into different programs with different
16332 prevailing FPU modes, and the convenience of being able to use a single
16333 object file outweighs the size and speed overhead for any extra
16334 mode switching that might be needed, compared with what would be needed
16335 with a more specific choice of prevailing FPU mode.
16336
16337 @item truncate
16338 This is the mode used for floating-point calculations with
16339 truncating (i.e.@: round towards zero) rounding mode. That includes
16340 conversion from floating point to integer.
16341
16342 @item round-nearest
16343 This is the mode used for floating-point calculations with
16344 round-to-nearest-or-even rounding mode.
16345
16346 @item int
16347 This is the mode used to perform integer calculations in the FPU, e.g.@:
16348 integer multiply, or integer multiply-and-accumulate.
16349 @end table
16350
16351 The default is @option{-mfp-mode=caller}
16352
16353 @item -mno-split-lohi
16354 @itemx -mno-postinc
16355 @itemx -mno-postmodify
16356 @opindex mno-split-lohi
16357 @opindex msplit-lohi
16358 @opindex mno-postinc
16359 @opindex mpostinc
16360 @opindex mno-postmodify
16361 @opindex mpostmodify
16362 Code generation tweaks that disable, respectively, splitting of 32-bit
16363 loads, generation of post-increment addresses, and generation of
16364 post-modify addresses. The defaults are @option{msplit-lohi},
16365 @option{-mpost-inc}, and @option{-mpost-modify}.
16366
16367 @item -mnovect-double
16368 @opindex mno-vect-double
16369 @opindex mvect-double
16370 Change the preferred SIMD mode to SImode. The default is
16371 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16372
16373 @item -max-vect-align=@var{num}
16374 @opindex max-vect-align
16375 The maximum alignment for SIMD vector mode types.
16376 @var{num} may be 4 or 8. The default is 8.
16377 Note that this is an ABI change, even though many library function
16378 interfaces are unaffected if they don't use SIMD vector modes
16379 in places that affect size and/or alignment of relevant types.
16380
16381 @item -msplit-vecmove-early
16382 @opindex msplit-vecmove-early
16383 Split vector moves into single word moves before reload. In theory this
16384 can give better register allocation, but so far the reverse seems to be
16385 generally the case.
16386
16387 @item -m1reg-@var{reg}
16388 @opindex m1reg-
16389 Specify a register to hold the constant @minus{}1, which makes loading small negative
16390 constants and certain bitmasks faster.
16391 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16392 which specify use of that register as a fixed register,
16393 and @samp{none}, which means that no register is used for this
16394 purpose. The default is @option{-m1reg-none}.
16395
16396 @end table
16397
16398 @node AMD GCN Options
16399 @subsection AMD GCN Options
16400 @cindex AMD GCN Options
16401
16402 These options are defined specifically for the AMD GCN port.
16403
16404 @table @gcctabopt
16405
16406 @item -march=@var{gpu}
16407 @opindex march
16408 @itemx -mtune=@var{gpu}
16409 @opindex mtune
16410 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16411 are
16412
16413 @table @samp
16414 @opindex fiji
16415 @item fiji
16416 Compile for GCN3 Fiji devices (gfx803).
16417
16418 @item gfx900
16419 Compile for GCN5 Vega 10 devices (gfx900).
16420
16421 @item gfx906
16422 Compile for GCN5 Vega 20 devices (gfx906).
16423
16424 @end table
16425
16426 @item -mstack-size=@var{bytes}
16427 @opindex mstack-size
16428 Specify how many @var{bytes} of stack space will be requested for each GPU
16429 thread (wave-front). Beware that there may be many threads and limited memory
16430 available. The size of the stack allocation may also have an impact on
16431 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16432 1MB otherwise.
16433
16434 @end table
16435
16436 @node ARC Options
16437 @subsection ARC Options
16438 @cindex ARC options
16439
16440 The following options control the architecture variant for which code
16441 is being compiled:
16442
16443 @c architecture variants
16444 @table @gcctabopt
16445
16446 @item -mbarrel-shifter
16447 @opindex mbarrel-shifter
16448 Generate instructions supported by barrel shifter. This is the default
16449 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16450
16451 @item -mjli-always
16452 @opindex mjli-alawys
16453 Force to call a function using jli_s instruction. This option is
16454 valid only for ARCv2 architecture.
16455
16456 @item -mcpu=@var{cpu}
16457 @opindex mcpu
16458 Set architecture type, register usage, and instruction scheduling
16459 parameters for @var{cpu}. There are also shortcut alias options
16460 available for backward compatibility and convenience. Supported
16461 values for @var{cpu} are
16462
16463 @table @samp
16464 @opindex mA6
16465 @opindex mARC600
16466 @item arc600
16467 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16468
16469 @item arc601
16470 @opindex mARC601
16471 Compile for ARC601. Alias: @option{-mARC601}.
16472
16473 @item arc700
16474 @opindex mA7
16475 @opindex mARC700
16476 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16477 This is the default when configured with @option{--with-cpu=arc700}@.
16478
16479 @item arcem
16480 Compile for ARC EM.
16481
16482 @item archs
16483 Compile for ARC HS.
16484
16485 @item em
16486 Compile for ARC EM CPU with no hardware extensions.
16487
16488 @item em4
16489 Compile for ARC EM4 CPU.
16490
16491 @item em4_dmips
16492 Compile for ARC EM4 DMIPS CPU.
16493
16494 @item em4_fpus
16495 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16496 extension.
16497
16498 @item em4_fpuda
16499 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16500 double assist instructions.
16501
16502 @item hs
16503 Compile for ARC HS CPU with no hardware extensions except the atomic
16504 instructions.
16505
16506 @item hs34
16507 Compile for ARC HS34 CPU.
16508
16509 @item hs38
16510 Compile for ARC HS38 CPU.
16511
16512 @item hs38_linux
16513 Compile for ARC HS38 CPU with all hardware extensions on.
16514
16515 @item arc600_norm
16516 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16517
16518 @item arc600_mul32x16
16519 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16520 instructions enabled.
16521
16522 @item arc600_mul64
16523 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16524 instructions enabled.
16525
16526 @item arc601_norm
16527 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16528
16529 @item arc601_mul32x16
16530 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16531 instructions enabled.
16532
16533 @item arc601_mul64
16534 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16535 instructions enabled.
16536
16537 @item nps400
16538 Compile for ARC 700 on NPS400 chip.
16539
16540 @item em_mini
16541 Compile for ARC EM minimalist configuration featuring reduced register
16542 set.
16543
16544 @end table
16545
16546 @item -mdpfp
16547 @opindex mdpfp
16548 @itemx -mdpfp-compact
16549 @opindex mdpfp-compact
16550 Generate double-precision FPX instructions, tuned for the compact
16551 implementation.
16552
16553 @item -mdpfp-fast
16554 @opindex mdpfp-fast
16555 Generate double-precision FPX instructions, tuned for the fast
16556 implementation.
16557
16558 @item -mno-dpfp-lrsr
16559 @opindex mno-dpfp-lrsr
16560 Disable @code{lr} and @code{sr} instructions from using FPX extension
16561 aux registers.
16562
16563 @item -mea
16564 @opindex mea
16565 Generate extended arithmetic instructions. Currently only
16566 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16567 supported. This is always enabled for @option{-mcpu=ARC700}.
16568
16569 @item -mno-mpy
16570 @opindex mno-mpy
16571 @opindex mmpy
16572 Do not generate @code{mpy}-family instructions for ARC700. This option is
16573 deprecated.
16574
16575 @item -mmul32x16
16576 @opindex mmul32x16
16577 Generate 32x16-bit multiply and multiply-accumulate instructions.
16578
16579 @item -mmul64
16580 @opindex mmul64
16581 Generate @code{mul64} and @code{mulu64} instructions.
16582 Only valid for @option{-mcpu=ARC600}.
16583
16584 @item -mnorm
16585 @opindex mnorm
16586 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16587 is in effect.
16588
16589 @item -mspfp
16590 @opindex mspfp
16591 @itemx -mspfp-compact
16592 @opindex mspfp-compact
16593 Generate single-precision FPX instructions, tuned for the compact
16594 implementation.
16595
16596 @item -mspfp-fast
16597 @opindex mspfp-fast
16598 Generate single-precision FPX instructions, tuned for the fast
16599 implementation.
16600
16601 @item -msimd
16602 @opindex msimd
16603 Enable generation of ARC SIMD instructions via target-specific
16604 builtins. Only valid for @option{-mcpu=ARC700}.
16605
16606 @item -msoft-float
16607 @opindex msoft-float
16608 This option ignored; it is provided for compatibility purposes only.
16609 Software floating-point code is emitted by default, and this default
16610 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16611 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16612 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16613
16614 @item -mswap
16615 @opindex mswap
16616 Generate @code{swap} instructions.
16617
16618 @item -matomic
16619 @opindex matomic
16620 This enables use of the locked load/store conditional extension to implement
16621 atomic memory built-in functions. Not available for ARC 6xx or ARC
16622 EM cores.
16623
16624 @item -mdiv-rem
16625 @opindex mdiv-rem
16626 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16627
16628 @item -mcode-density
16629 @opindex mcode-density
16630 Enable code density instructions for ARC EM.
16631 This option is on by default for ARC HS.
16632
16633 @item -mll64
16634 @opindex mll64
16635 Enable double load/store operations for ARC HS cores.
16636
16637 @item -mtp-regno=@var{regno}
16638 @opindex mtp-regno
16639 Specify thread pointer register number.
16640
16641 @item -mmpy-option=@var{multo}
16642 @opindex mmpy-option
16643 Compile ARCv2 code with a multiplier design option. You can specify
16644 the option using either a string or numeric value for @var{multo}.
16645 @samp{wlh1} is the default value. The recognized values are:
16646
16647 @table @samp
16648 @item 0
16649 @itemx none
16650 No multiplier available.
16651
16652 @item 1
16653 @itemx w
16654 16x16 multiplier, fully pipelined.
16655 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16656
16657 @item 2
16658 @itemx wlh1
16659 32x32 multiplier, fully
16660 pipelined (1 stage). The following instructions are additionally
16661 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16662
16663 @item 3
16664 @itemx wlh2
16665 32x32 multiplier, fully pipelined
16666 (2 stages). The following instructions are additionally enabled: @code{mpy},
16667 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16668
16669 @item 4
16670 @itemx wlh3
16671 Two 16x16 multipliers, blocking,
16672 sequential. The following instructions are additionally enabled: @code{mpy},
16673 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16674
16675 @item 5
16676 @itemx wlh4
16677 One 16x16 multiplier, blocking,
16678 sequential. The following instructions are additionally enabled: @code{mpy},
16679 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16680
16681 @item 6
16682 @itemx wlh5
16683 One 32x4 multiplier, blocking,
16684 sequential. The following instructions are additionally enabled: @code{mpy},
16685 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16686
16687 @item 7
16688 @itemx plus_dmpy
16689 ARC HS SIMD support.
16690
16691 @item 8
16692 @itemx plus_macd
16693 ARC HS SIMD support.
16694
16695 @item 9
16696 @itemx plus_qmacw
16697 ARC HS SIMD support.
16698
16699 @end table
16700
16701 This option is only available for ARCv2 cores@.
16702
16703 @item -mfpu=@var{fpu}
16704 @opindex mfpu
16705 Enables support for specific floating-point hardware extensions for ARCv2
16706 cores. Supported values for @var{fpu} are:
16707
16708 @table @samp
16709
16710 @item fpus
16711 Enables support for single-precision floating-point hardware
16712 extensions@.
16713
16714 @item fpud
16715 Enables support for double-precision floating-point hardware
16716 extensions. The single-precision floating-point extension is also
16717 enabled. Not available for ARC EM@.
16718
16719 @item fpuda
16720 Enables support for double-precision floating-point hardware
16721 extensions using double-precision assist instructions. The single-precision
16722 floating-point extension is also enabled. This option is
16723 only available for ARC EM@.
16724
16725 @item fpuda_div
16726 Enables support for double-precision floating-point hardware
16727 extensions using double-precision assist instructions.
16728 The single-precision floating-point, square-root, and divide
16729 extensions are also enabled. This option is
16730 only available for ARC EM@.
16731
16732 @item fpuda_fma
16733 Enables support for double-precision floating-point hardware
16734 extensions using double-precision assist instructions.
16735 The single-precision floating-point and fused multiply and add
16736 hardware extensions are also enabled. This option is
16737 only available for ARC EM@.
16738
16739 @item fpuda_all
16740 Enables support for double-precision floating-point hardware
16741 extensions using double-precision assist instructions.
16742 All single-precision floating-point hardware extensions are also
16743 enabled. This option is only available for ARC EM@.
16744
16745 @item fpus_div
16746 Enables support for single-precision floating-point, square-root and divide
16747 hardware extensions@.
16748
16749 @item fpud_div
16750 Enables support for double-precision floating-point, square-root and divide
16751 hardware extensions. This option
16752 includes option @samp{fpus_div}. Not available for ARC EM@.
16753
16754 @item fpus_fma
16755 Enables support for single-precision floating-point and
16756 fused multiply and add hardware extensions@.
16757
16758 @item fpud_fma
16759 Enables support for double-precision floating-point and
16760 fused multiply and add hardware extensions. This option
16761 includes option @samp{fpus_fma}. Not available for ARC EM@.
16762
16763 @item fpus_all
16764 Enables support for all single-precision floating-point hardware
16765 extensions@.
16766
16767 @item fpud_all
16768 Enables support for all single- and double-precision floating-point
16769 hardware extensions. Not available for ARC EM@.
16770
16771 @end table
16772
16773 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16774 @opindex mirq-ctrl-saved
16775 Specifies general-purposes registers that the processor automatically
16776 saves/restores on interrupt entry and exit. @var{register-range} is
16777 specified as two registers separated by a dash. The register range
16778 always starts with @code{r0}, the upper limit is @code{fp} register.
16779 @var{blink} and @var{lp_count} are optional. This option is only
16780 valid for ARC EM and ARC HS cores.
16781
16782 @item -mrgf-banked-regs=@var{number}
16783 @opindex mrgf-banked-regs
16784 Specifies the number of registers replicated in second register bank
16785 on entry to fast interrupt. Fast interrupts are interrupts with the
16786 highest priority level P0. These interrupts save only PC and STATUS32
16787 registers to avoid memory transactions during interrupt entry and exit
16788 sequences. Use this option when you are using fast interrupts in an
16789 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16790
16791 @item -mlpc-width=@var{width}
16792 @opindex mlpc-width
16793 Specify the width of the @code{lp_count} register. Valid values for
16794 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16795 fixed to 32 bits. If the width is less than 32, the compiler does not
16796 attempt to transform loops in your program to use the zero-delay loop
16797 mechanism unless it is known that the @code{lp_count} register can
16798 hold the required loop-counter value. Depending on the width
16799 specified, the compiler and run-time library might continue to use the
16800 loop mechanism for various needs. This option defines macro
16801 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16802
16803 @item -mrf16
16804 @opindex mrf16
16805 This option instructs the compiler to generate code for a 16-entry
16806 register file. This option defines the @code{__ARC_RF16__}
16807 preprocessor macro.
16808
16809 @item -mbranch-index
16810 @opindex mbranch-index
16811 Enable use of @code{bi} or @code{bih} instructions to implement jump
16812 tables.
16813
16814 @end table
16815
16816 The following options are passed through to the assembler, and also
16817 define preprocessor macro symbols.
16818
16819 @c Flags used by the assembler, but for which we define preprocessor
16820 @c macro symbols as well.
16821 @table @gcctabopt
16822 @item -mdsp-packa
16823 @opindex mdsp-packa
16824 Passed down to the assembler to enable the DSP Pack A extensions.
16825 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16826 deprecated.
16827
16828 @item -mdvbf
16829 @opindex mdvbf
16830 Passed down to the assembler to enable the dual Viterbi butterfly
16831 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16832 option is deprecated.
16833
16834 @c ARC700 4.10 extension instruction
16835 @item -mlock
16836 @opindex mlock
16837 Passed down to the assembler to enable the locked load/store
16838 conditional extension. Also sets the preprocessor symbol
16839 @code{__Xlock}.
16840
16841 @item -mmac-d16
16842 @opindex mmac-d16
16843 Passed down to the assembler. Also sets the preprocessor symbol
16844 @code{__Xxmac_d16}. This option is deprecated.
16845
16846 @item -mmac-24
16847 @opindex mmac-24
16848 Passed down to the assembler. Also sets the preprocessor symbol
16849 @code{__Xxmac_24}. This option is deprecated.
16850
16851 @c ARC700 4.10 extension instruction
16852 @item -mrtsc
16853 @opindex mrtsc
16854 Passed down to the assembler to enable the 64-bit time-stamp counter
16855 extension instruction. Also sets the preprocessor symbol
16856 @code{__Xrtsc}. This option is deprecated.
16857
16858 @c ARC700 4.10 extension instruction
16859 @item -mswape
16860 @opindex mswape
16861 Passed down to the assembler to enable the swap byte ordering
16862 extension instruction. Also sets the preprocessor symbol
16863 @code{__Xswape}.
16864
16865 @item -mtelephony
16866 @opindex mtelephony
16867 Passed down to the assembler to enable dual- and single-operand
16868 instructions for telephony. Also sets the preprocessor symbol
16869 @code{__Xtelephony}. This option is deprecated.
16870
16871 @item -mxy
16872 @opindex mxy
16873 Passed down to the assembler to enable the XY memory extension. Also
16874 sets the preprocessor symbol @code{__Xxy}.
16875
16876 @end table
16877
16878 The following options control how the assembly code is annotated:
16879
16880 @c Assembly annotation options
16881 @table @gcctabopt
16882 @item -misize
16883 @opindex misize
16884 Annotate assembler instructions with estimated addresses.
16885
16886 @item -mannotate-align
16887 @opindex mannotate-align
16888 Explain what alignment considerations lead to the decision to make an
16889 instruction short or long.
16890
16891 @end table
16892
16893 The following options are passed through to the linker:
16894
16895 @c options passed through to the linker
16896 @table @gcctabopt
16897 @item -marclinux
16898 @opindex marclinux
16899 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16900 This option is enabled by default in tool chains built for
16901 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16902 when profiling is not requested.
16903
16904 @item -marclinux_prof
16905 @opindex marclinux_prof
16906 Passed through to the linker, to specify use of the
16907 @code{arclinux_prof} emulation. This option is enabled by default in
16908 tool chains built for @w{@code{arc-linux-uclibc}} and
16909 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16910
16911 @end table
16912
16913 The following options control the semantics of generated code:
16914
16915 @c semantically relevant code generation options
16916 @table @gcctabopt
16917 @item -mlong-calls
16918 @opindex mlong-calls
16919 Generate calls as register indirect calls, thus providing access
16920 to the full 32-bit address range.
16921
16922 @item -mmedium-calls
16923 @opindex mmedium-calls
16924 Don't use less than 25-bit addressing range for calls, which is the
16925 offset available for an unconditional branch-and-link
16926 instruction. Conditional execution of function calls is suppressed, to
16927 allow use of the 25-bit range, rather than the 21-bit range with
16928 conditional branch-and-link. This is the default for tool chains built
16929 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16930
16931 @item -G @var{num}
16932 @opindex G
16933 Put definitions of externally-visible data in a small data section if
16934 that data is no bigger than @var{num} bytes. The default value of
16935 @var{num} is 4 for any ARC configuration, or 8 when we have double
16936 load/store operations.
16937
16938 @item -mno-sdata
16939 @opindex mno-sdata
16940 @opindex msdata
16941 Do not generate sdata references. This is the default for tool chains
16942 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16943 targets.
16944
16945 @item -mvolatile-cache
16946 @opindex mvolatile-cache
16947 Use ordinarily cached memory accesses for volatile references. This is the
16948 default.
16949
16950 @item -mno-volatile-cache
16951 @opindex mno-volatile-cache
16952 @opindex mvolatile-cache
16953 Enable cache bypass for volatile references.
16954
16955 @end table
16956
16957 The following options fine tune code generation:
16958 @c code generation tuning options
16959 @table @gcctabopt
16960 @item -malign-call
16961 @opindex malign-call
16962 Do alignment optimizations for call instructions.
16963
16964 @item -mauto-modify-reg
16965 @opindex mauto-modify-reg
16966 Enable the use of pre/post modify with register displacement.
16967
16968 @item -mbbit-peephole
16969 @opindex mbbit-peephole
16970 Enable bbit peephole2.
16971
16972 @item -mno-brcc
16973 @opindex mno-brcc
16974 This option disables a target-specific pass in @file{arc_reorg} to
16975 generate compare-and-branch (@code{br@var{cc}}) instructions.
16976 It has no effect on
16977 generation of these instructions driven by the combiner pass.
16978
16979 @item -mcase-vector-pcrel
16980 @opindex mcase-vector-pcrel
16981 Use PC-relative switch case tables to enable case table shortening.
16982 This is the default for @option{-Os}.
16983
16984 @item -mcompact-casesi
16985 @opindex mcompact-casesi
16986 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16987 and only available for ARCv1 cores. This option is deprecated.
16988
16989 @item -mno-cond-exec
16990 @opindex mno-cond-exec
16991 Disable the ARCompact-specific pass to generate conditional
16992 execution instructions.
16993
16994 Due to delay slot scheduling and interactions between operand numbers,
16995 literal sizes, instruction lengths, and the support for conditional execution,
16996 the target-independent pass to generate conditional execution is often lacking,
16997 so the ARC port has kept a special pass around that tries to find more
16998 conditional execution generation opportunities after register allocation,
16999 branch shortening, and delay slot scheduling have been done. This pass
17000 generally, but not always, improves performance and code size, at the cost of
17001 extra compilation time, which is why there is an option to switch it off.
17002 If you have a problem with call instructions exceeding their allowable
17003 offset range because they are conditionalized, you should consider using
17004 @option{-mmedium-calls} instead.
17005
17006 @item -mearly-cbranchsi
17007 @opindex mearly-cbranchsi
17008 Enable pre-reload use of the @code{cbranchsi} pattern.
17009
17010 @item -mexpand-adddi
17011 @opindex mexpand-adddi
17012 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
17013 @code{add.f}, @code{adc} etc. This option is deprecated.
17014
17015 @item -mindexed-loads
17016 @opindex mindexed-loads
17017 Enable the use of indexed loads. This can be problematic because some
17018 optimizers then assume that indexed stores exist, which is not
17019 the case.
17020
17021 @item -mlra
17022 @opindex mlra
17023 Enable Local Register Allocation. This is still experimental for ARC,
17024 so by default the compiler uses standard reload
17025 (i.e.@: @option{-mno-lra}).
17026
17027 @item -mlra-priority-none
17028 @opindex mlra-priority-none
17029 Don't indicate any priority for target registers.
17030
17031 @item -mlra-priority-compact
17032 @opindex mlra-priority-compact
17033 Indicate target register priority for r0..r3 / r12..r15.
17034
17035 @item -mlra-priority-noncompact
17036 @opindex mlra-priority-noncompact
17037 Reduce target register priority for r0..r3 / r12..r15.
17038
17039 @item -mmillicode
17040 @opindex mmillicode
17041 When optimizing for size (using @option{-Os}), prologues and epilogues
17042 that have to save or restore a large number of registers are often
17043 shortened by using call to a special function in libgcc; this is
17044 referred to as a @emph{millicode} call. As these calls can pose
17045 performance issues, and/or cause linking issues when linking in a
17046 nonstandard way, this option is provided to turn on or off millicode
17047 call generation.
17048
17049 @item -mcode-density-frame
17050 @opindex mcode-density-frame
17051 This option enable the compiler to emit @code{enter} and @code{leave}
17052 instructions. These instructions are only valid for CPUs with
17053 code-density feature.
17054
17055 @item -mmixed-code
17056 @opindex mmixed-code
17057 Tweak register allocation to help 16-bit instruction generation.
17058 This generally has the effect of decreasing the average instruction size
17059 while increasing the instruction count.
17060
17061 @item -mq-class
17062 @opindex mq-class
17063 Enable @samp{q} instruction alternatives.
17064 This is the default for @option{-Os}.
17065
17066 @item -mRcq
17067 @opindex mRcq
17068 Enable @samp{Rcq} constraint handling.
17069 Most short code generation depends on this.
17070 This is the default.
17071
17072 @item -mRcw
17073 @opindex mRcw
17074 Enable @samp{Rcw} constraint handling.
17075 Most ccfsm condexec mostly depends on this.
17076 This is the default.
17077
17078 @item -msize-level=@var{level}
17079 @opindex msize-level
17080 Fine-tune size optimization with regards to instruction lengths and alignment.
17081 The recognized values for @var{level} are:
17082 @table @samp
17083 @item 0
17084 No size optimization. This level is deprecated and treated like @samp{1}.
17085
17086 @item 1
17087 Short instructions are used opportunistically.
17088
17089 @item 2
17090 In addition, alignment of loops and of code after barriers are dropped.
17091
17092 @item 3
17093 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
17094
17095 @end table
17096
17097 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
17098 the behavior when this is not set is equivalent to level @samp{1}.
17099
17100 @item -mtune=@var{cpu}
17101 @opindex mtune
17102 Set instruction scheduling parameters for @var{cpu}, overriding any implied
17103 by @option{-mcpu=}.
17104
17105 Supported values for @var{cpu} are
17106
17107 @table @samp
17108 @item ARC600
17109 Tune for ARC600 CPU.
17110
17111 @item ARC601
17112 Tune for ARC601 CPU.
17113
17114 @item ARC700
17115 Tune for ARC700 CPU with standard multiplier block.
17116
17117 @item ARC700-xmac
17118 Tune for ARC700 CPU with XMAC block.
17119
17120 @item ARC725D
17121 Tune for ARC725D CPU.
17122
17123 @item ARC750D
17124 Tune for ARC750D CPU.
17125
17126 @end table
17127
17128 @item -mmultcost=@var{num}
17129 @opindex mmultcost
17130 Cost to assume for a multiply instruction, with @samp{4} being equal to a
17131 normal instruction.
17132
17133 @item -munalign-prob-threshold=@var{probability}
17134 @opindex munalign-prob-threshold
17135 Set probability threshold for unaligning branches.
17136 When tuning for @samp{ARC700} and optimizing for speed, branches without
17137 filled delay slot are preferably emitted unaligned and long, unless
17138 profiling indicates that the probability for the branch to be taken
17139 is below @var{probability}. @xref{Cross-profiling}.
17140 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17141
17142 @end table
17143
17144 The following options are maintained for backward compatibility, but
17145 are now deprecated and will be removed in a future release:
17146
17147 @c Deprecated options
17148 @table @gcctabopt
17149
17150 @item -margonaut
17151 @opindex margonaut
17152 Obsolete FPX.
17153
17154 @item -mbig-endian
17155 @opindex mbig-endian
17156 @itemx -EB
17157 @opindex EB
17158 Compile code for big-endian targets. Use of these options is now
17159 deprecated. Big-endian code is supported by configuring GCC to build
17160 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17161 for which big endian is the default.
17162
17163 @item -mlittle-endian
17164 @opindex mlittle-endian
17165 @itemx -EL
17166 @opindex EL
17167 Compile code for little-endian targets. Use of these options is now
17168 deprecated. Little-endian code is supported by configuring GCC to build
17169 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17170 for which little endian is the default.
17171
17172 @item -mbarrel_shifter
17173 @opindex mbarrel_shifter
17174 Replaced by @option{-mbarrel-shifter}.
17175
17176 @item -mdpfp_compact
17177 @opindex mdpfp_compact
17178 Replaced by @option{-mdpfp-compact}.
17179
17180 @item -mdpfp_fast
17181 @opindex mdpfp_fast
17182 Replaced by @option{-mdpfp-fast}.
17183
17184 @item -mdsp_packa
17185 @opindex mdsp_packa
17186 Replaced by @option{-mdsp-packa}.
17187
17188 @item -mEA
17189 @opindex mEA
17190 Replaced by @option{-mea}.
17191
17192 @item -mmac_24
17193 @opindex mmac_24
17194 Replaced by @option{-mmac-24}.
17195
17196 @item -mmac_d16
17197 @opindex mmac_d16
17198 Replaced by @option{-mmac-d16}.
17199
17200 @item -mspfp_compact
17201 @opindex mspfp_compact
17202 Replaced by @option{-mspfp-compact}.
17203
17204 @item -mspfp_fast
17205 @opindex mspfp_fast
17206 Replaced by @option{-mspfp-fast}.
17207
17208 @item -mtune=@var{cpu}
17209 @opindex mtune
17210 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17211 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17212 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17213
17214 @item -multcost=@var{num}
17215 @opindex multcost
17216 Replaced by @option{-mmultcost}.
17217
17218 @end table
17219
17220 @node ARM Options
17221 @subsection ARM Options
17222 @cindex ARM options
17223
17224 These @samp{-m} options are defined for the ARM port:
17225
17226 @table @gcctabopt
17227 @item -mabi=@var{name}
17228 @opindex mabi
17229 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17230 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17231
17232 @item -mapcs-frame
17233 @opindex mapcs-frame
17234 Generate a stack frame that is compliant with the ARM Procedure Call
17235 Standard for all functions, even if this is not strictly necessary for
17236 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17237 with this option causes the stack frames not to be generated for
17238 leaf functions. The default is @option{-mno-apcs-frame}.
17239 This option is deprecated.
17240
17241 @item -mapcs
17242 @opindex mapcs
17243 This is a synonym for @option{-mapcs-frame} and is deprecated.
17244
17245 @ignore
17246 @c not currently implemented
17247 @item -mapcs-stack-check
17248 @opindex mapcs-stack-check
17249 Generate code to check the amount of stack space available upon entry to
17250 every function (that actually uses some stack space). If there is
17251 insufficient space available then either the function
17252 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17253 called, depending upon the amount of stack space required. The runtime
17254 system is required to provide these functions. The default is
17255 @option{-mno-apcs-stack-check}, since this produces smaller code.
17256
17257 @c not currently implemented
17258 @item -mapcs-reentrant
17259 @opindex mapcs-reentrant
17260 Generate reentrant, position-independent code. The default is
17261 @option{-mno-apcs-reentrant}.
17262 @end ignore
17263
17264 @item -mthumb-interwork
17265 @opindex mthumb-interwork
17266 Generate code that supports calling between the ARM and Thumb
17267 instruction sets. Without this option, on pre-v5 architectures, the
17268 two instruction sets cannot be reliably used inside one program. The
17269 default is @option{-mno-thumb-interwork}, since slightly larger code
17270 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17271 configurations this option is meaningless.
17272
17273 @item -mno-sched-prolog
17274 @opindex mno-sched-prolog
17275 @opindex msched-prolog
17276 Prevent the reordering of instructions in the function prologue, or the
17277 merging of those instruction with the instructions in the function's
17278 body. This means that all functions start with a recognizable set
17279 of instructions (or in fact one of a choice from a small set of
17280 different function prologues), and this information can be used to
17281 locate the start of functions inside an executable piece of code. The
17282 default is @option{-msched-prolog}.
17283
17284 @item -mfloat-abi=@var{name}
17285 @opindex mfloat-abi
17286 Specifies which floating-point ABI to use. Permissible values
17287 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17288
17289 Specifying @samp{soft} causes GCC to generate output containing
17290 library calls for floating-point operations.
17291 @samp{softfp} allows the generation of code using hardware floating-point
17292 instructions, but still uses the soft-float calling conventions.
17293 @samp{hard} allows generation of floating-point instructions
17294 and uses FPU-specific calling conventions.
17295
17296 The default depends on the specific target configuration. Note that
17297 the hard-float and soft-float ABIs are not link-compatible; you must
17298 compile your entire program with the same ABI, and link with a
17299 compatible set of libraries.
17300
17301 @item -mgeneral-regs-only
17302 @opindex mgeneral-regs-only
17303 Generate code which uses only the general-purpose registers. This will prevent
17304 the compiler from using floating-point and Advanced SIMD registers but will not
17305 impose any restrictions on the assembler.
17306
17307 @item -mlittle-endian
17308 @opindex mlittle-endian
17309 Generate code for a processor running in little-endian mode. This is
17310 the default for all standard configurations.
17311
17312 @item -mbig-endian
17313 @opindex mbig-endian
17314 Generate code for a processor running in big-endian mode; the default is
17315 to compile code for a little-endian processor.
17316
17317 @item -mbe8
17318 @itemx -mbe32
17319 @opindex mbe8
17320 When linking a big-endian image select between BE8 and BE32 formats.
17321 The option has no effect for little-endian images and is ignored. The
17322 default is dependent on the selected target architecture. For ARMv6
17323 and later architectures the default is BE8, for older architectures
17324 the default is BE32. BE32 format has been deprecated by ARM.
17325
17326 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17327 @opindex march
17328 This specifies the name of the target ARM architecture. GCC uses this
17329 name to determine what kind of instructions it can emit when generating
17330 assembly code. This option can be used in conjunction with or instead
17331 of the @option{-mcpu=} option.
17332
17333 Permissible names are:
17334 @samp{armv4t},
17335 @samp{armv5t}, @samp{armv5te},
17336 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17337 @samp{armv6z}, @samp{armv6zk},
17338 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17339 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17340 @samp{armv8.4-a},
17341 @samp{armv8.5-a},
17342 @samp{armv7-r},
17343 @samp{armv8-r},
17344 @samp{armv6-m}, @samp{armv6s-m},
17345 @samp{armv7-m}, @samp{armv7e-m},
17346 @samp{armv8-m.base}, @samp{armv8-m.main},
17347 @samp{iwmmxt} and @samp{iwmmxt2}.
17348
17349 Additionally, the following architectures, which lack support for the
17350 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17351
17352 Many of the architectures support extensions. These can be added by
17353 appending @samp{+@var{extension}} to the architecture name. Extension
17354 options are processed in order and capabilities accumulate. An extension
17355 will also enable any necessary base extensions
17356 upon which it depends. For example, the @samp{+crypto} extension
17357 will always enable the @samp{+simd} extension. The exception to the
17358 additive construction is for extensions that are prefixed with
17359 @samp{+no@dots{}}: these extensions disable the specified option and
17360 any other extensions that may depend on the presence of that
17361 extension.
17362
17363 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17364 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17365 entirely disabled by the @samp{+nofp} option that follows it.
17366
17367 Most extension names are generically named, but have an effect that is
17368 dependent upon the architecture to which it is applied. For example,
17369 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17370 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17371 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17372 variant for @samp{armv8-a}.
17373
17374 The table below lists the supported extensions for each architecture.
17375 Architectures not mentioned do not support any extensions.
17376
17377 @table @samp
17378 @item armv5te
17379 @itemx armv6
17380 @itemx armv6j
17381 @itemx armv6k
17382 @itemx armv6kz
17383 @itemx armv6t2
17384 @itemx armv6z
17385 @itemx armv6zk
17386 @table @samp
17387 @item +fp
17388 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17389 used as an alias for this extension.
17390
17391 @item +nofp
17392 Disable the floating-point instructions.
17393 @end table
17394
17395 @item armv7
17396 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17397 @table @samp
17398 @item +fp
17399 The VFPv3 floating-point instructions, with 16 double-precision
17400 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17401 for this extension. Note that floating-point is not supported by the
17402 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17403 ARMv7-R architectures.
17404
17405 @item +nofp
17406 Disable the floating-point instructions.
17407 @end table
17408
17409 @item armv7-a
17410 @table @samp
17411 @item +mp
17412 The multiprocessing extension.
17413
17414 @item +sec
17415 The security extension.
17416
17417 @item +fp
17418 The VFPv3 floating-point instructions, with 16 double-precision
17419 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17420 for this extension.
17421
17422 @item +simd
17423 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17424 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17425 for this extension.
17426
17427 @item +vfpv3
17428 The VFPv3 floating-point instructions, with 32 double-precision
17429 registers.
17430
17431 @item +vfpv3-d16-fp16
17432 The VFPv3 floating-point instructions, with 16 double-precision
17433 registers and the half-precision floating-point conversion operations.
17434
17435 @item +vfpv3-fp16
17436 The VFPv3 floating-point instructions, with 32 double-precision
17437 registers and the half-precision floating-point conversion operations.
17438
17439 @item +vfpv4-d16
17440 The VFPv4 floating-point instructions, with 16 double-precision
17441 registers.
17442
17443 @item +vfpv4
17444 The VFPv4 floating-point instructions, with 32 double-precision
17445 registers.
17446
17447 @item +neon-fp16
17448 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17449 the half-precision floating-point conversion operations.
17450
17451 @item +neon-vfpv4
17452 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17453
17454 @item +nosimd
17455 Disable the Advanced SIMD instructions (does not disable floating point).
17456
17457 @item +nofp
17458 Disable the floating-point and Advanced SIMD instructions.
17459 @end table
17460
17461 @item armv7ve
17462 The extended version of the ARMv7-A architecture with support for
17463 virtualization.
17464 @table @samp
17465 @item +fp
17466 The VFPv4 floating-point instructions, with 16 double-precision registers.
17467 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17468
17469 @item +simd
17470 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17471 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17472
17473 @item +vfpv3-d16
17474 The VFPv3 floating-point instructions, with 16 double-precision
17475 registers.
17476
17477 @item +vfpv3
17478 The VFPv3 floating-point instructions, with 32 double-precision
17479 registers.
17480
17481 @item +vfpv3-d16-fp16
17482 The VFPv3 floating-point instructions, with 16 double-precision
17483 registers and the half-precision floating-point conversion operations.
17484
17485 @item +vfpv3-fp16
17486 The VFPv3 floating-point instructions, with 32 double-precision
17487 registers and the half-precision floating-point conversion operations.
17488
17489 @item +vfpv4-d16
17490 The VFPv4 floating-point instructions, with 16 double-precision
17491 registers.
17492
17493 @item +vfpv4
17494 The VFPv4 floating-point instructions, with 32 double-precision
17495 registers.
17496
17497 @item +neon
17498 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17499 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17500
17501 @item +neon-fp16
17502 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17503 the half-precision floating-point conversion operations.
17504
17505 @item +nosimd
17506 Disable the Advanced SIMD instructions (does not disable floating point).
17507
17508 @item +nofp
17509 Disable the floating-point and Advanced SIMD instructions.
17510 @end table
17511
17512 @item armv8-a
17513 @table @samp
17514 @item +crc
17515 The Cyclic Redundancy Check (CRC) instructions.
17516 @item +simd
17517 The ARMv8-A Advanced SIMD and floating-point instructions.
17518 @item +crypto
17519 The cryptographic instructions.
17520 @item +nocrypto
17521 Disable the cryptographic instructions.
17522 @item +nofp
17523 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17524 @item +sb
17525 Speculation Barrier Instruction.
17526 @item +predres
17527 Execution and Data Prediction Restriction Instructions.
17528 @end table
17529
17530 @item armv8.1-a
17531 @table @samp
17532 @item +simd
17533 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17534
17535 @item +crypto
17536 The cryptographic instructions. This also enables the Advanced SIMD and
17537 floating-point instructions.
17538
17539 @item +nocrypto
17540 Disable the cryptographic instructions.
17541
17542 @item +nofp
17543 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17544
17545 @item +sb
17546 Speculation Barrier Instruction.
17547
17548 @item +predres
17549 Execution and Data Prediction Restriction Instructions.
17550 @end table
17551
17552 @item armv8.2-a
17553 @itemx armv8.3-a
17554 @table @samp
17555 @item +fp16
17556 The half-precision floating-point data processing instructions.
17557 This also enables the Advanced SIMD and floating-point instructions.
17558
17559 @item +fp16fml
17560 The half-precision floating-point fmla extension. This also enables
17561 the half-precision floating-point extension and Advanced SIMD and
17562 floating-point instructions.
17563
17564 @item +simd
17565 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17566
17567 @item +crypto
17568 The cryptographic instructions. This also enables the Advanced SIMD and
17569 floating-point instructions.
17570
17571 @item +dotprod
17572 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17573
17574 @item +nocrypto
17575 Disable the cryptographic extension.
17576
17577 @item +nofp
17578 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17579
17580 @item +sb
17581 Speculation Barrier Instruction.
17582
17583 @item +predres
17584 Execution and Data Prediction Restriction Instructions.
17585 @end table
17586
17587 @item armv8.4-a
17588 @table @samp
17589 @item +fp16
17590 The half-precision floating-point data processing instructions.
17591 This also enables the Advanced SIMD and floating-point instructions as well
17592 as the Dot Product extension and the half-precision floating-point fmla
17593 extension.
17594
17595 @item +simd
17596 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17597 Dot Product extension.
17598
17599 @item +crypto
17600 The cryptographic instructions. This also enables the Advanced SIMD and
17601 floating-point instructions as well as the Dot Product extension.
17602
17603 @item +nocrypto
17604 Disable the cryptographic extension.
17605
17606 @item +nofp
17607 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17608
17609 @item +sb
17610 Speculation Barrier Instruction.
17611
17612 @item +predres
17613 Execution and Data Prediction Restriction Instructions.
17614 @end table
17615
17616 @item armv8.5-a
17617 @table @samp
17618 @item +fp16
17619 The half-precision floating-point data processing instructions.
17620 This also enables the Advanced SIMD and floating-point instructions as well
17621 as the Dot Product extension and the half-precision floating-point fmla
17622 extension.
17623
17624 @item +simd
17625 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17626 Dot Product extension.
17627
17628 @item +crypto
17629 The cryptographic instructions. This also enables the Advanced SIMD and
17630 floating-point instructions as well as the Dot Product extension.
17631
17632 @item +nocrypto
17633 Disable the cryptographic extension.
17634
17635 @item +nofp
17636 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17637 @end table
17638
17639 @item armv7-r
17640 @table @samp
17641 @item +fp.sp
17642 The single-precision VFPv3 floating-point instructions. The extension
17643 @samp{+vfpv3xd} can be used as an alias for this extension.
17644
17645 @item +fp
17646 The VFPv3 floating-point instructions with 16 double-precision registers.
17647 The extension +vfpv3-d16 can be used as an alias for this extension.
17648
17649 @item +vfpv3xd-d16-fp16
17650 The single-precision VFPv3 floating-point instructions with 16 double-precision
17651 registers and the half-precision floating-point conversion operations.
17652
17653 @item +vfpv3-d16-fp16
17654 The VFPv3 floating-point instructions with 16 double-precision
17655 registers and the half-precision floating-point conversion operations.
17656
17657 @item +nofp
17658 Disable the floating-point extension.
17659
17660 @item +idiv
17661 The ARM-state integer division instructions.
17662
17663 @item +noidiv
17664 Disable the ARM-state integer division extension.
17665 @end table
17666
17667 @item armv7e-m
17668 @table @samp
17669 @item +fp
17670 The single-precision VFPv4 floating-point instructions.
17671
17672 @item +fpv5
17673 The single-precision FPv5 floating-point instructions.
17674
17675 @item +fp.dp
17676 The single- and double-precision FPv5 floating-point instructions.
17677
17678 @item +nofp
17679 Disable the floating-point extensions.
17680 @end table
17681
17682 @item armv8-m.main
17683 @table @samp
17684 @item +dsp
17685 The DSP instructions.
17686
17687 @item +nodsp
17688 Disable the DSP extension.
17689
17690 @item +fp
17691 The single-precision floating-point instructions.
17692
17693 @item +fp.dp
17694 The single- and double-precision floating-point instructions.
17695
17696 @item +nofp
17697 Disable the floating-point extension.
17698 @end table
17699
17700 @item armv8-r
17701 @table @samp
17702 @item +crc
17703 The Cyclic Redundancy Check (CRC) instructions.
17704 @item +fp.sp
17705 The single-precision FPv5 floating-point instructions.
17706 @item +simd
17707 The ARMv8-A Advanced SIMD and floating-point instructions.
17708 @item +crypto
17709 The cryptographic instructions.
17710 @item +nocrypto
17711 Disable the cryptographic instructions.
17712 @item +nofp
17713 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17714 @end table
17715
17716 @end table
17717
17718 @option{-march=native} causes the compiler to auto-detect the architecture
17719 of the build computer. At present, this feature is only supported on
17720 GNU/Linux, and not all architectures are recognized. If the auto-detect
17721 is unsuccessful the option has no effect.
17722
17723 @item -mtune=@var{name}
17724 @opindex mtune
17725 This option specifies the name of the target ARM processor for
17726 which GCC should tune the performance of the code.
17727 For some ARM implementations better performance can be obtained by using
17728 this option.
17729 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17730 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17731 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17732 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17733 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17734 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17735 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17736 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17737 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17738 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17739 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17740 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17741 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17742 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
17743 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17744 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17745 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17746 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17747 @samp{cortex-m35p},
17748 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17749 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17750 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17751 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17752 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17753
17754 Additionally, this option can specify that GCC should tune the performance
17755 of the code for a big.LITTLE system. Permissible names are:
17756 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17757 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17758 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17759 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17760
17761 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17762 performance for a blend of processors within architecture @var{arch}.
17763 The aim is to generate code that run well on the current most popular
17764 processors, balancing between optimizations that benefit some CPUs in the
17765 range, and avoiding performance pitfalls of other CPUs. The effects of
17766 this option may change in future GCC versions as CPU models come and go.
17767
17768 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17769 the extension options do not affect the tuning of the generated code.
17770
17771 @option{-mtune=native} causes the compiler to auto-detect the CPU
17772 of the build computer. At present, this feature is only supported on
17773 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17774 unsuccessful the option has no effect.
17775
17776 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17777 @opindex mcpu
17778 This specifies the name of the target ARM processor. GCC uses this name
17779 to derive the name of the target ARM architecture (as if specified
17780 by @option{-march}) and the ARM processor type for which to tune for
17781 performance (as if specified by @option{-mtune}). Where this option
17782 is used in conjunction with @option{-march} or @option{-mtune},
17783 those options take precedence over the appropriate part of this option.
17784
17785 Many of the supported CPUs implement optional architectural
17786 extensions. Where this is so the architectural extensions are
17787 normally enabled by default. If implementations that lack the
17788 extension exist, then the extension syntax can be used to disable
17789 those extensions that have been omitted. For floating-point and
17790 Advanced SIMD (Neon) instructions, the settings of the options
17791 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17792 floating-point and Advanced SIMD instructions will only be used if
17793 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17794 @option{-mfpu} other than @samp{auto} will override the available
17795 floating-point and SIMD extension instructions.
17796
17797 For example, @samp{cortex-a9} can be found in three major
17798 configurations: integer only, with just a floating-point unit or with
17799 floating-point and Advanced SIMD. The default is to enable all the
17800 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17801 be used to disable just the SIMD or both the SIMD and floating-point
17802 instructions respectively.
17803
17804 Permissible names for this option are the same as those for
17805 @option{-mtune}.
17806
17807 The following extension options are common to the listed CPUs:
17808
17809 @table @samp
17810 @item +nodsp
17811 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
17812
17813 @item +nofp
17814 Disables the floating-point instructions on @samp{arm9e},
17815 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17816 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17817 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17818 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
17819 Disables the floating-point and SIMD instructions on
17820 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17821 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17822 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17823 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17824 @samp{cortex-a53} and @samp{cortex-a55}.
17825
17826 @item +nofp.dp
17827 Disables the double-precision component of the floating-point instructions
17828 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17829 @samp{cortex-m7}.
17830
17831 @item +nosimd
17832 Disables the SIMD (but not floating-point) instructions on
17833 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17834 and @samp{cortex-a9}.
17835
17836 @item +crypto
17837 Enables the cryptographic instructions on @samp{cortex-a32},
17838 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17839 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17840 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17841 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17842 @samp{cortex-a75.cortex-a55}.
17843 @end table
17844
17845 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17846 VFPv3 with 16 double-precision registers. It supports the following
17847 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17848 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17849 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17850 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17851 the extensions to @option{-march=armv7-a}.
17852
17853 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17854 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17855 See @option{-mtune} for more information.
17856
17857 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17858 of the build computer. At present, this feature is only supported on
17859 GNU/Linux, and not all architectures are recognized. If the auto-detect
17860 is unsuccessful the option has no effect.
17861
17862 @item -mfpu=@var{name}
17863 @opindex mfpu
17864 This specifies what floating-point hardware (or hardware emulation) is
17865 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17866 @samp{vfpv3},
17867 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17868 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17869 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17870 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17871 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17872 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17873 is an alias for @samp{vfpv2}.
17874
17875 The setting @samp{auto} is the default and is special. It causes the
17876 compiler to select the floating-point and Advanced SIMD instructions
17877 based on the settings of @option{-mcpu} and @option{-march}.
17878
17879 If the selected floating-point hardware includes the NEON extension
17880 (e.g.@: @option{-mfpu=neon}), note that floating-point
17881 operations are not generated by GCC's auto-vectorization pass unless
17882 @option{-funsafe-math-optimizations} is also specified. This is
17883 because NEON hardware does not fully implement the IEEE 754 standard for
17884 floating-point arithmetic (in particular denormal values are treated as
17885 zero), so the use of NEON instructions may lead to a loss of precision.
17886
17887 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}).
17888
17889 @item -mfp16-format=@var{name}
17890 @opindex mfp16-format
17891 Specify the format of the @code{__fp16} half-precision floating-point type.
17892 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17893 the default is @samp{none}, in which case the @code{__fp16} type is not
17894 defined. @xref{Half-Precision}, for more information.
17895
17896 @item -mstructure-size-boundary=@var{n}
17897 @opindex mstructure-size-boundary
17898 The sizes of all structures and unions are rounded up to a multiple
17899 of the number of bits set by this option. Permissible values are 8, 32
17900 and 64. The default value varies for different toolchains. For the COFF
17901 targeted toolchain the default value is 8. A value of 64 is only allowed
17902 if the underlying ABI supports it.
17903
17904 Specifying a larger number can produce faster, more efficient code, but
17905 can also increase the size of the program. Different values are potentially
17906 incompatible. Code compiled with one value cannot necessarily expect to
17907 work with code or libraries compiled with another value, if they exchange
17908 information using structures or unions.
17909
17910 This option is deprecated.
17911
17912 @item -mabort-on-noreturn
17913 @opindex mabort-on-noreturn
17914 Generate a call to the function @code{abort} at the end of a
17915 @code{noreturn} function. It is executed if the function tries to
17916 return.
17917
17918 @item -mlong-calls
17919 @itemx -mno-long-calls
17920 @opindex mlong-calls
17921 @opindex mno-long-calls
17922 Tells the compiler to perform function calls by first loading the
17923 address of the function into a register and then performing a subroutine
17924 call on this register. This switch is needed if the target function
17925 lies outside of the 64-megabyte addressing range of the offset-based
17926 version of subroutine call instruction.
17927
17928 Even if this switch is enabled, not all function calls are turned
17929 into long calls. The heuristic is that static functions, functions
17930 that have the @code{short_call} attribute, functions that are inside
17931 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17932 definitions have already been compiled within the current compilation
17933 unit are not turned into long calls. The exceptions to this rule are
17934 that weak function definitions, functions with the @code{long_call}
17935 attribute or the @code{section} attribute, and functions that are within
17936 the scope of a @code{#pragma long_calls} directive are always
17937 turned into long calls.
17938
17939 This feature is not enabled by default. Specifying
17940 @option{-mno-long-calls} restores the default behavior, as does
17941 placing the function calls within the scope of a @code{#pragma
17942 long_calls_off} directive. Note these switches have no effect on how
17943 the compiler generates code to handle function calls via function
17944 pointers.
17945
17946 @item -msingle-pic-base
17947 @opindex msingle-pic-base
17948 Treat the register used for PIC addressing as read-only, rather than
17949 loading it in the prologue for each function. The runtime system is
17950 responsible for initializing this register with an appropriate value
17951 before execution begins.
17952
17953 @item -mpic-register=@var{reg}
17954 @opindex mpic-register
17955 Specify the register to be used for PIC addressing.
17956 For standard PIC base case, the default is any suitable register
17957 determined by compiler. For single PIC base case, the default is
17958 @samp{R9} if target is EABI based or stack-checking is enabled,
17959 otherwise the default is @samp{R10}.
17960
17961 @item -mpic-data-is-text-relative
17962 @opindex mpic-data-is-text-relative
17963 Assume that the displacement between the text and data segments is fixed
17964 at static link time. This permits using PC-relative addressing
17965 operations to access data known to be in the data segment. For
17966 non-VxWorks RTP targets, this option is enabled by default. When
17967 disabled on such targets, it will enable @option{-msingle-pic-base} by
17968 default.
17969
17970 @item -mpoke-function-name
17971 @opindex mpoke-function-name
17972 Write the name of each function into the text section, directly
17973 preceding the function prologue. The generated code is similar to this:
17974
17975 @smallexample
17976 t0
17977 .ascii "arm_poke_function_name", 0
17978 .align
17979 t1
17980 .word 0xff000000 + (t1 - t0)
17981 arm_poke_function_name
17982 mov ip, sp
17983 stmfd sp!, @{fp, ip, lr, pc@}
17984 sub fp, ip, #4
17985 @end smallexample
17986
17987 When performing a stack backtrace, code can inspect the value of
17988 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17989 location @code{pc - 12} and the top 8 bits are set, then we know that
17990 there is a function name embedded immediately preceding this location
17991 and has length @code{((pc[-3]) & 0xff000000)}.
17992
17993 @item -mthumb
17994 @itemx -marm
17995 @opindex marm
17996 @opindex mthumb
17997
17998 Select between generating code that executes in ARM and Thumb
17999 states. The default for most configurations is to generate code
18000 that executes in ARM state, but the default can be changed by
18001 configuring GCC with the @option{--with-mode=}@var{state}
18002 configure option.
18003
18004 You can also override the ARM and Thumb mode for each function
18005 by using the @code{target("thumb")} and @code{target("arm")} function attributes
18006 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
18007
18008 @item -mflip-thumb
18009 @opindex mflip-thumb
18010 Switch ARM/Thumb modes on alternating functions.
18011 This option is provided for regression testing of mixed Thumb/ARM code
18012 generation, and is not intended for ordinary use in compiling code.
18013
18014 @item -mtpcs-frame
18015 @opindex mtpcs-frame
18016 Generate a stack frame that is compliant with the Thumb Procedure Call
18017 Standard for all non-leaf functions. (A leaf function is one that does
18018 not call any other functions.) The default is @option{-mno-tpcs-frame}.
18019
18020 @item -mtpcs-leaf-frame
18021 @opindex mtpcs-leaf-frame
18022 Generate a stack frame that is compliant with the Thumb Procedure Call
18023 Standard for all leaf functions. (A leaf function is one that does
18024 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
18025
18026 @item -mcallee-super-interworking
18027 @opindex mcallee-super-interworking
18028 Gives all externally visible functions in the file being compiled an ARM
18029 instruction set header which switches to Thumb mode before executing the
18030 rest of the function. This allows these functions to be called from
18031 non-interworking code. This option is not valid in AAPCS configurations
18032 because interworking is enabled by default.
18033
18034 @item -mcaller-super-interworking
18035 @opindex mcaller-super-interworking
18036 Allows calls via function pointers (including virtual functions) to
18037 execute correctly regardless of whether the target code has been
18038 compiled for interworking or not. There is a small overhead in the cost
18039 of executing a function pointer if this option is enabled. This option
18040 is not valid in AAPCS configurations because interworking is enabled
18041 by default.
18042
18043 @item -mtp=@var{name}
18044 @opindex mtp
18045 Specify the access model for the thread local storage pointer. The valid
18046 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
18047 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
18048 (supported in the arm6k architecture), and @samp{auto}, which uses the
18049 best available method for the selected processor. The default setting is
18050 @samp{auto}.
18051
18052 @item -mtls-dialect=@var{dialect}
18053 @opindex mtls-dialect
18054 Specify the dialect to use for accessing thread local storage. Two
18055 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
18056 @samp{gnu} dialect selects the original GNU scheme for supporting
18057 local and global dynamic TLS models. The @samp{gnu2} dialect
18058 selects the GNU descriptor scheme, which provides better performance
18059 for shared libraries. The GNU descriptor scheme is compatible with
18060 the original scheme, but does require new assembler, linker and
18061 library support. Initial and local exec TLS models are unaffected by
18062 this option and always use the original scheme.
18063
18064 @item -mword-relocations
18065 @opindex mword-relocations
18066 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
18067 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
18068 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
18069 is specified. This option conflicts with @option{-mslow-flash-data}.
18070
18071 @item -mfix-cortex-m3-ldrd
18072 @opindex mfix-cortex-m3-ldrd
18073 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
18074 with overlapping destination and base registers are used. This option avoids
18075 generating these instructions. This option is enabled by default when
18076 @option{-mcpu=cortex-m3} is specified.
18077
18078 @item -munaligned-access
18079 @itemx -mno-unaligned-access
18080 @opindex munaligned-access
18081 @opindex mno-unaligned-access
18082 Enables (or disables) reading and writing of 16- and 32- bit values
18083 from addresses that are not 16- or 32- bit aligned. By default
18084 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18085 ARMv8-M Baseline architectures, and enabled for all other
18086 architectures. If unaligned access is not enabled then words in packed
18087 data structures are accessed a byte at a time.
18088
18089 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
18090 generated object file to either true or false, depending upon the
18091 setting of this option. If unaligned access is enabled then the
18092 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
18093 defined.
18094
18095 @item -mneon-for-64bits
18096 @opindex mneon-for-64bits
18097 This option is deprecated and has no effect.
18098
18099 @item -mslow-flash-data
18100 @opindex mslow-flash-data
18101 Assume loading data from flash is slower than fetching instruction.
18102 Therefore literal load is minimized for better performance.
18103 This option is only supported when compiling for ARMv7 M-profile and
18104 off by default. It conflicts with @option{-mword-relocations}.
18105
18106 @item -masm-syntax-unified
18107 @opindex masm-syntax-unified
18108 Assume inline assembler is using unified asm syntax. The default is
18109 currently off which implies divided syntax. This option has no impact
18110 on Thumb2. However, this may change in future releases of GCC.
18111 Divided syntax should be considered deprecated.
18112
18113 @item -mrestrict-it
18114 @opindex mrestrict-it
18115 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
18116 IT blocks can only contain a single 16-bit instruction from a select
18117 set of instructions. This option is on by default for ARMv8-A Thumb mode.
18118
18119 @item -mprint-tune-info
18120 @opindex mprint-tune-info
18121 Print CPU tuning information as comment in assembler file. This is
18122 an option used only for regression testing of the compiler and not
18123 intended for ordinary use in compiling code. This option is disabled
18124 by default.
18125
18126 @item -mverbose-cost-dump
18127 @opindex mverbose-cost-dump
18128 Enable verbose cost model dumping in the debug dump files. This option is
18129 provided for use in debugging the compiler.
18130
18131 @item -mpure-code
18132 @opindex mpure-code
18133 Do not allow constant data to be placed in code sections.
18134 Additionally, when compiling for ELF object format give all text sections the
18135 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
18136 is only available when generating non-pic code for M-profile targets with the
18137 MOVT instruction.
18138
18139 @item -mcmse
18140 @opindex mcmse
18141 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
18142 Development Tools Engineering Specification", which can be found on
18143 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
18144
18145 @item -mfdpic
18146 @itemx -mno-fdpic
18147 @opindex mfdpic
18148 @opindex mno-fdpic
18149 Select the FDPIC ABI, which uses 64-bit function descriptors to
18150 represent pointers to functions. When the compiler is configured for
18151 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
18152 and implies @option{-fPIE} if none of the PIC/PIE-related options is
18153 provided. On other targets, it only enables the FDPIC-specific code
18154 generation features, and the user should explicitly provide the
18155 PIC/PIE-related options as needed.
18156
18157 Note that static linking is not supported because it would still
18158 involve the dynamic linker when the program self-relocates. If such
18159 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
18160
18161 The opposite @option{-mno-fdpic} option is useful (and required) to
18162 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
18163 toolchain as the one used to build the userland programs.
18164
18165 @end table
18166
18167 @node AVR Options
18168 @subsection AVR Options
18169 @cindex AVR Options
18170
18171 These options are defined for AVR implementations:
18172
18173 @table @gcctabopt
18174 @item -mmcu=@var{mcu}
18175 @opindex mmcu
18176 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18177
18178 The default for this option is@tie{}@samp{avr2}.
18179
18180 GCC supports the following AVR devices and ISAs:
18181
18182 @include avr-mmcu.texi
18183
18184 @item -mabsdata
18185 @opindex mabsdata
18186
18187 Assume that all data in static storage can be accessed by LDS / STS
18188 instructions. This option has only an effect on reduced Tiny devices like
18189 ATtiny40. See also the @code{absdata}
18190 @ref{AVR Variable Attributes,variable attribute}.
18191
18192 @item -maccumulate-args
18193 @opindex maccumulate-args
18194 Accumulate outgoing function arguments and acquire/release the needed
18195 stack space for outgoing function arguments once in function
18196 prologue/epilogue. Without this option, outgoing arguments are pushed
18197 before calling a function and popped afterwards.
18198
18199 Popping the arguments after the function call can be expensive on
18200 AVR so that accumulating the stack space might lead to smaller
18201 executables because arguments need not be removed from the
18202 stack after such a function call.
18203
18204 This option can lead to reduced code size for functions that perform
18205 several calls to functions that get their arguments on the stack like
18206 calls to printf-like functions.
18207
18208 @item -mbranch-cost=@var{cost}
18209 @opindex mbranch-cost
18210 Set the branch costs for conditional branch instructions to
18211 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18212 integers. The default branch cost is 0.
18213
18214 @item -mcall-prologues
18215 @opindex mcall-prologues
18216 Functions prologues/epilogues are expanded as calls to appropriate
18217 subroutines. Code size is smaller.
18218
18219 @item -mgas-isr-prologues
18220 @opindex mgas-isr-prologues
18221 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18222 instruction supported by GNU Binutils.
18223 If this option is on, the feature can still be disabled for individual
18224 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18225 function attribute. This feature is activated per default
18226 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18227 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18228
18229 @item -mint8
18230 @opindex mint8
18231 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18232 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18233 and @code{long long} is 4 bytes. Please note that this option does not
18234 conform to the C standards, but it results in smaller code
18235 size.
18236
18237 @item -mmain-is-OS_task
18238 @opindex mmain-is-OS_task
18239 Do not save registers in @code{main}. The effect is the same like
18240 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18241 to @code{main}. It is activated per default if optimization is on.
18242
18243 @item -mn-flash=@var{num}
18244 @opindex mn-flash
18245 Assume that the flash memory has a size of
18246 @var{num} times 64@tie{}KiB.
18247
18248 @item -mno-interrupts
18249 @opindex mno-interrupts
18250 Generated code is not compatible with hardware interrupts.
18251 Code size is smaller.
18252
18253 @item -mrelax
18254 @opindex mrelax
18255 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18256 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18257 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18258 the assembler's command line and the @option{--relax} option to the
18259 linker's command line.
18260
18261 Jump relaxing is performed by the linker because jump offsets are not
18262 known before code is located. Therefore, the assembler code generated by the
18263 compiler is the same, but the instructions in the executable may
18264 differ from instructions in the assembler code.
18265
18266 Relaxing must be turned on if linker stubs are needed, see the
18267 section on @code{EIND} and linker stubs below.
18268
18269 @item -mrmw
18270 @opindex mrmw
18271 Assume that the device supports the Read-Modify-Write
18272 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18273
18274 @item -mshort-calls
18275 @opindex mshort-calls
18276
18277 Assume that @code{RJMP} and @code{RCALL} can target the whole
18278 program memory.
18279
18280 This option is used internally for multilib selection. It is
18281 not an optimization option, and you don't need to set it by hand.
18282
18283 @item -msp8
18284 @opindex msp8
18285 Treat the stack pointer register as an 8-bit register,
18286 i.e.@: assume the high byte of the stack pointer is zero.
18287 In general, you don't need to set this option by hand.
18288
18289 This option is used internally by the compiler to select and
18290 build multilibs for architectures @code{avr2} and @code{avr25}.
18291 These architectures mix devices with and without @code{SPH}.
18292 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18293 the compiler driver adds or removes this option from the compiler
18294 proper's command line, because the compiler then knows if the device
18295 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18296 register or not.
18297
18298 @item -mstrict-X
18299 @opindex mstrict-X
18300 Use address register @code{X} in a way proposed by the hardware. This means
18301 that @code{X} is only used in indirect, post-increment or
18302 pre-decrement addressing.
18303
18304 Without this option, the @code{X} register may be used in the same way
18305 as @code{Y} or @code{Z} which then is emulated by additional
18306 instructions.
18307 For example, loading a value with @code{X+const} addressing with a
18308 small non-negative @code{const < 64} to a register @var{Rn} is
18309 performed as
18310
18311 @example
18312 adiw r26, const ; X += const
18313 ld @var{Rn}, X ; @var{Rn} = *X
18314 sbiw r26, const ; X -= const
18315 @end example
18316
18317 @item -mtiny-stack
18318 @opindex mtiny-stack
18319 Only change the lower 8@tie{}bits of the stack pointer.
18320
18321 @item -mfract-convert-truncate
18322 @opindex mfract-convert-truncate
18323 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18324
18325 @item -nodevicelib
18326 @opindex nodevicelib
18327 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18328
18329 @item -Waddr-space-convert
18330 @opindex Waddr-space-convert
18331 @opindex Wno-addr-space-convert
18332 Warn about conversions between address spaces in the case where the
18333 resulting address space is not contained in the incoming address space.
18334
18335 @item -Wmisspelled-isr
18336 @opindex Wmisspelled-isr
18337 @opindex Wno-misspelled-isr
18338 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18339 Enabled by default.
18340 @end table
18341
18342 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18343 @cindex @code{EIND}
18344 Pointers in the implementation are 16@tie{}bits wide.
18345 The address of a function or label is represented as word address so
18346 that indirect jumps and calls can target any code address in the
18347 range of 64@tie{}Ki words.
18348
18349 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18350 bytes of program memory space, there is a special function register called
18351 @code{EIND} that serves as most significant part of the target address
18352 when @code{EICALL} or @code{EIJMP} instructions are used.
18353
18354 Indirect jumps and calls on these devices are handled as follows by
18355 the compiler and are subject to some limitations:
18356
18357 @itemize @bullet
18358
18359 @item
18360 The compiler never sets @code{EIND}.
18361
18362 @item
18363 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18364 instructions or might read @code{EIND} directly in order to emulate an
18365 indirect call/jump by means of a @code{RET} instruction.
18366
18367 @item
18368 The compiler assumes that @code{EIND} never changes during the startup
18369 code or during the application. In particular, @code{EIND} is not
18370 saved/restored in function or interrupt service routine
18371 prologue/epilogue.
18372
18373 @item
18374 For indirect calls to functions and computed goto, the linker
18375 generates @emph{stubs}. Stubs are jump pads sometimes also called
18376 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18377 The stub contains a direct jump to the desired address.
18378
18379 @item
18380 Linker relaxation must be turned on so that the linker generates
18381 the stubs correctly in all situations. See the compiler option
18382 @option{-mrelax} and the linker option @option{--relax}.
18383 There are corner cases where the linker is supposed to generate stubs
18384 but aborts without relaxation and without a helpful error message.
18385
18386 @item
18387 The default linker script is arranged for code with @code{EIND = 0}.
18388 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18389 linker script has to be used in order to place the sections whose
18390 name start with @code{.trampolines} into the segment where @code{EIND}
18391 points to.
18392
18393 @item
18394 The startup code from libgcc never sets @code{EIND}.
18395 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18396 For the impact of AVR-LibC on @code{EIND}, see the
18397 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18398
18399 @item
18400 It is legitimate for user-specific startup code to set up @code{EIND}
18401 early, for example by means of initialization code located in
18402 section @code{.init3}. Such code runs prior to general startup code
18403 that initializes RAM and calls constructors, but after the bit
18404 of startup code from AVR-LibC that sets @code{EIND} to the segment
18405 where the vector table is located.
18406 @example
18407 #include <avr/io.h>
18408
18409 static void
18410 __attribute__((section(".init3"),naked,used,no_instrument_function))
18411 init3_set_eind (void)
18412 @{
18413 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18414 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18415 @}
18416 @end example
18417
18418 @noindent
18419 The @code{__trampolines_start} symbol is defined in the linker script.
18420
18421 @item
18422 Stubs are generated automatically by the linker if
18423 the following two conditions are met:
18424 @itemize @minus
18425
18426 @item The address of a label is taken by means of the @code{gs} modifier
18427 (short for @emph{generate stubs}) like so:
18428 @example
18429 LDI r24, lo8(gs(@var{func}))
18430 LDI r25, hi8(gs(@var{func}))
18431 @end example
18432 @item The final location of that label is in a code segment
18433 @emph{outside} the segment where the stubs are located.
18434 @end itemize
18435
18436 @item
18437 The compiler emits such @code{gs} modifiers for code labels in the
18438 following situations:
18439 @itemize @minus
18440 @item Taking address of a function or code label.
18441 @item Computed goto.
18442 @item If prologue-save function is used, see @option{-mcall-prologues}
18443 command-line option.
18444 @item Switch/case dispatch tables. If you do not want such dispatch
18445 tables you can specify the @option{-fno-jump-tables} command-line option.
18446 @item C and C++ constructors/destructors called during startup/shutdown.
18447 @item If the tools hit a @code{gs()} modifier explained above.
18448 @end itemize
18449
18450 @item
18451 Jumping to non-symbolic addresses like so is @emph{not} supported:
18452
18453 @example
18454 int main (void)
18455 @{
18456 /* Call function at word address 0x2 */
18457 return ((int(*)(void)) 0x2)();
18458 @}
18459 @end example
18460
18461 Instead, a stub has to be set up, i.e.@: the function has to be called
18462 through a symbol (@code{func_4} in the example):
18463
18464 @example
18465 int main (void)
18466 @{
18467 extern int func_4 (void);
18468
18469 /* Call function at byte address 0x4 */
18470 return func_4();
18471 @}
18472 @end example
18473
18474 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18475 Alternatively, @code{func_4} can be defined in the linker script.
18476 @end itemize
18477
18478 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18479 @cindex @code{RAMPD}
18480 @cindex @code{RAMPX}
18481 @cindex @code{RAMPY}
18482 @cindex @code{RAMPZ}
18483 Some AVR devices support memories larger than the 64@tie{}KiB range
18484 that can be accessed with 16-bit pointers. To access memory locations
18485 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18486 register is used as high part of the address:
18487 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18488 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18489 register, respectively, to get a wide address. Similarly,
18490 @code{RAMPD} is used together with direct addressing.
18491
18492 @itemize
18493 @item
18494 The startup code initializes the @code{RAMP} special function
18495 registers with zero.
18496
18497 @item
18498 If a @ref{AVR Named Address Spaces,named address space} other than
18499 generic or @code{__flash} is used, then @code{RAMPZ} is set
18500 as needed before the operation.
18501
18502 @item
18503 If the device supports RAM larger than 64@tie{}KiB and the compiler
18504 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18505 is reset to zero after the operation.
18506
18507 @item
18508 If the device comes with a specific @code{RAMP} register, the ISR
18509 prologue/epilogue saves/restores that SFR and initializes it with
18510 zero in case the ISR code might (implicitly) use it.
18511
18512 @item
18513 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18514 If you use inline assembler to read from locations outside the
18515 16-bit address range and change one of the @code{RAMP} registers,
18516 you must reset it to zero after the access.
18517
18518 @end itemize
18519
18520 @subsubsection AVR Built-in Macros
18521
18522 GCC defines several built-in macros so that the user code can test
18523 for the presence or absence of features. Almost any of the following
18524 built-in macros are deduced from device capabilities and thus
18525 triggered by the @option{-mmcu=} command-line option.
18526
18527 For even more AVR-specific built-in macros see
18528 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18529
18530 @table @code
18531
18532 @item __AVR_ARCH__
18533 Build-in macro that resolves to a decimal number that identifies the
18534 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18535 Possible values are:
18536
18537 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18538 @code{4}, @code{5}, @code{51}, @code{6}
18539
18540 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18541 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18542
18543 respectively and
18544
18545 @code{100},
18546 @code{102}, @code{103}, @code{104},
18547 @code{105}, @code{106}, @code{107}
18548
18549 for @var{mcu}=@code{avrtiny},
18550 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18551 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18552 If @var{mcu} specifies a device, this built-in macro is set
18553 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18554 defined to @code{4}.
18555
18556 @item __AVR_@var{Device}__
18557 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18558 the device's name. For example, @option{-mmcu=atmega8} defines the
18559 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18560 @code{__AVR_ATtiny261A__}, etc.
18561
18562 The built-in macros' names follow
18563 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18564 the device name as from the AVR user manual. The difference between
18565 @var{Device} in the built-in macro and @var{device} in
18566 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18567
18568 If @var{device} is not a device but only a core architecture like
18569 @samp{avr51}, this macro is not defined.
18570
18571 @item __AVR_DEVICE_NAME__
18572 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18573 the device's name. For example, with @option{-mmcu=atmega8} the macro
18574 is defined to @code{atmega8}.
18575
18576 If @var{device} is not a device but only a core architecture like
18577 @samp{avr51}, this macro is not defined.
18578
18579 @item __AVR_XMEGA__
18580 The device / architecture belongs to the XMEGA family of devices.
18581
18582 @item __AVR_HAVE_ELPM__
18583 The device has the @code{ELPM} instruction.
18584
18585 @item __AVR_HAVE_ELPMX__
18586 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18587 R@var{n},Z+} instructions.
18588
18589 @item __AVR_HAVE_MOVW__
18590 The device has the @code{MOVW} instruction to perform 16-bit
18591 register-register moves.
18592
18593 @item __AVR_HAVE_LPMX__
18594 The device has the @code{LPM R@var{n},Z} and
18595 @code{LPM R@var{n},Z+} instructions.
18596
18597 @item __AVR_HAVE_MUL__
18598 The device has a hardware multiplier.
18599
18600 @item __AVR_HAVE_JMP_CALL__
18601 The device has the @code{JMP} and @code{CALL} instructions.
18602 This is the case for devices with more than 8@tie{}KiB of program
18603 memory.
18604
18605 @item __AVR_HAVE_EIJMP_EICALL__
18606 @itemx __AVR_3_BYTE_PC__
18607 The device has the @code{EIJMP} and @code{EICALL} instructions.
18608 This is the case for devices with more than 128@tie{}KiB of program memory.
18609 This also means that the program counter
18610 (PC) is 3@tie{}bytes wide.
18611
18612 @item __AVR_2_BYTE_PC__
18613 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18614 with up to 128@tie{}KiB of program memory.
18615
18616 @item __AVR_HAVE_8BIT_SP__
18617 @itemx __AVR_HAVE_16BIT_SP__
18618 The stack pointer (SP) register is treated as 8-bit respectively
18619 16-bit register by the compiler.
18620 The definition of these macros is affected by @option{-mtiny-stack}.
18621
18622 @item __AVR_HAVE_SPH__
18623 @itemx __AVR_SP8__
18624 The device has the SPH (high part of stack pointer) special function
18625 register or has an 8-bit stack pointer, respectively.
18626 The definition of these macros is affected by @option{-mmcu=} and
18627 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18628 by @option{-msp8}.
18629
18630 @item __AVR_HAVE_RAMPD__
18631 @itemx __AVR_HAVE_RAMPX__
18632 @itemx __AVR_HAVE_RAMPY__
18633 @itemx __AVR_HAVE_RAMPZ__
18634 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18635 @code{RAMPZ} special function register, respectively.
18636
18637 @item __NO_INTERRUPTS__
18638 This macro reflects the @option{-mno-interrupts} command-line option.
18639
18640 @item __AVR_ERRATA_SKIP__
18641 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18642 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18643 instructions because of a hardware erratum. Skip instructions are
18644 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18645 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18646 set.
18647
18648 @item __AVR_ISA_RMW__
18649 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18650
18651 @item __AVR_SFR_OFFSET__=@var{offset}
18652 Instructions that can address I/O special function registers directly
18653 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18654 address as if addressed by an instruction to access RAM like @code{LD}
18655 or @code{STS}. This offset depends on the device architecture and has
18656 to be subtracted from the RAM address in order to get the
18657 respective I/O@tie{}address.
18658
18659 @item __AVR_SHORT_CALLS__
18660 The @option{-mshort-calls} command line option is set.
18661
18662 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18663 Some devices support reading from flash memory by means of @code{LD*}
18664 instructions. The flash memory is seen in the data address space
18665 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18666 is not defined, this feature is not available. If defined,
18667 the address space is linear and there is no need to put
18668 @code{.rodata} into RAM. This is handled by the default linker
18669 description file, and is currently available for
18670 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18671 there is no need to use address spaces like @code{__flash} or
18672 features like attribute @code{progmem} and @code{pgm_read_*}.
18673
18674 @item __WITH_AVRLIBC__
18675 The compiler is configured to be used together with AVR-Libc.
18676 See the @option{--with-avrlibc} configure option.
18677
18678 @end table
18679
18680 @node Blackfin Options
18681 @subsection Blackfin Options
18682 @cindex Blackfin Options
18683
18684 @table @gcctabopt
18685 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18686 @opindex mcpu=
18687 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18688 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18689 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18690 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18691 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18692 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18693 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18694 @samp{bf561}, @samp{bf592}.
18695
18696 The optional @var{sirevision} specifies the silicon revision of the target
18697 Blackfin processor. Any workarounds available for the targeted silicon revision
18698 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18699 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18700 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18701 hexadecimal digits representing the major and minor numbers in the silicon
18702 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18703 is not defined. If @var{sirevision} is @samp{any}, the
18704 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18705 If this optional @var{sirevision} is not used, GCC assumes the latest known
18706 silicon revision of the targeted Blackfin processor.
18707
18708 GCC defines a preprocessor macro for the specified @var{cpu}.
18709 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18710 provided by libgloss to be linked in if @option{-msim} is not given.
18711
18712 Without this option, @samp{bf532} is used as the processor by default.
18713
18714 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18715 only the preprocessor macro is defined.
18716
18717 @item -msim
18718 @opindex msim
18719 Specifies that the program will be run on the simulator. This causes
18720 the simulator BSP provided by libgloss to be linked in. This option
18721 has effect only for @samp{bfin-elf} toolchain.
18722 Certain other options, such as @option{-mid-shared-library} and
18723 @option{-mfdpic}, imply @option{-msim}.
18724
18725 @item -momit-leaf-frame-pointer
18726 @opindex momit-leaf-frame-pointer
18727 Don't keep the frame pointer in a register for leaf functions. This
18728 avoids the instructions to save, set up and restore frame pointers and
18729 makes an extra register available in leaf functions.
18730
18731 @item -mspecld-anomaly
18732 @opindex mspecld-anomaly
18733 When enabled, the compiler ensures that the generated code does not
18734 contain speculative loads after jump instructions. If this option is used,
18735 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18736
18737 @item -mno-specld-anomaly
18738 @opindex mno-specld-anomaly
18739 @opindex mspecld-anomaly
18740 Don't generate extra code to prevent speculative loads from occurring.
18741
18742 @item -mcsync-anomaly
18743 @opindex mcsync-anomaly
18744 When enabled, the compiler ensures that the generated code does not
18745 contain CSYNC or SSYNC instructions too soon after conditional branches.
18746 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18747
18748 @item -mno-csync-anomaly
18749 @opindex mno-csync-anomaly
18750 @opindex mcsync-anomaly
18751 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18752 occurring too soon after a conditional branch.
18753
18754 @item -mlow64k
18755 @opindex mlow64k
18756 When enabled, the compiler is free to take advantage of the knowledge that
18757 the entire program fits into the low 64k of memory.
18758
18759 @item -mno-low64k
18760 @opindex mno-low64k
18761 Assume that the program is arbitrarily large. This is the default.
18762
18763 @item -mstack-check-l1
18764 @opindex mstack-check-l1
18765 Do stack checking using information placed into L1 scratchpad memory by the
18766 uClinux kernel.
18767
18768 @item -mid-shared-library
18769 @opindex mid-shared-library
18770 Generate code that supports shared libraries via the library ID method.
18771 This allows for execute in place and shared libraries in an environment
18772 without virtual memory management. This option implies @option{-fPIC}.
18773 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18774
18775 @item -mno-id-shared-library
18776 @opindex mno-id-shared-library
18777 @opindex mid-shared-library
18778 Generate code that doesn't assume ID-based shared libraries are being used.
18779 This is the default.
18780
18781 @item -mleaf-id-shared-library
18782 @opindex mleaf-id-shared-library
18783 Generate code that supports shared libraries via the library ID method,
18784 but assumes that this library or executable won't link against any other
18785 ID shared libraries. That allows the compiler to use faster code for jumps
18786 and calls.
18787
18788 @item -mno-leaf-id-shared-library
18789 @opindex mno-leaf-id-shared-library
18790 @opindex mleaf-id-shared-library
18791 Do not assume that the code being compiled won't link against any ID shared
18792 libraries. Slower code is generated for jump and call insns.
18793
18794 @item -mshared-library-id=n
18795 @opindex mshared-library-id
18796 Specifies the identification number of the ID-based shared library being
18797 compiled. Specifying a value of 0 generates more compact code; specifying
18798 other values forces the allocation of that number to the current
18799 library but is no more space- or time-efficient than omitting this option.
18800
18801 @item -msep-data
18802 @opindex msep-data
18803 Generate code that allows the data segment to be located in a different
18804 area of memory from the text segment. This allows for execute in place in
18805 an environment without virtual memory management by eliminating relocations
18806 against the text section.
18807
18808 @item -mno-sep-data
18809 @opindex mno-sep-data
18810 @opindex msep-data
18811 Generate code that assumes that the data segment follows the text segment.
18812 This is the default.
18813
18814 @item -mlong-calls
18815 @itemx -mno-long-calls
18816 @opindex mlong-calls
18817 @opindex mno-long-calls
18818 Tells the compiler to perform function calls by first loading the
18819 address of the function into a register and then performing a subroutine
18820 call on this register. This switch is needed if the target function
18821 lies outside of the 24-bit addressing range of the offset-based
18822 version of subroutine call instruction.
18823
18824 This feature is not enabled by default. Specifying
18825 @option{-mno-long-calls} restores the default behavior. Note these
18826 switches have no effect on how the compiler generates code to handle
18827 function calls via function pointers.
18828
18829 @item -mfast-fp
18830 @opindex mfast-fp
18831 Link with the fast floating-point library. This library relaxes some of
18832 the IEEE floating-point standard's rules for checking inputs against
18833 Not-a-Number (NAN), in the interest of performance.
18834
18835 @item -minline-plt
18836 @opindex minline-plt
18837 Enable inlining of PLT entries in function calls to functions that are
18838 not known to bind locally. It has no effect without @option{-mfdpic}.
18839
18840 @item -mmulticore
18841 @opindex mmulticore
18842 Build a standalone application for multicore Blackfin processors.
18843 This option causes proper start files and link scripts supporting
18844 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18845 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18846
18847 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18848 selects the one-application-per-core programming model. Without
18849 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18850 programming model is used. In this model, the main function of Core B
18851 should be named as @code{coreb_main}.
18852
18853 If this option is not used, the single-core application programming
18854 model is used.
18855
18856 @item -mcorea
18857 @opindex mcorea
18858 Build a standalone application for Core A of BF561 when using
18859 the one-application-per-core programming model. Proper start files
18860 and link scripts are used to support Core A, and the macro
18861 @code{__BFIN_COREA} is defined.
18862 This option can only be used in conjunction with @option{-mmulticore}.
18863
18864 @item -mcoreb
18865 @opindex mcoreb
18866 Build a standalone application for Core B of BF561 when using
18867 the one-application-per-core programming model. Proper start files
18868 and link scripts are used to support Core B, and the macro
18869 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18870 should be used instead of @code{main}.
18871 This option can only be used in conjunction with @option{-mmulticore}.
18872
18873 @item -msdram
18874 @opindex msdram
18875 Build a standalone application for SDRAM. Proper start files and
18876 link scripts are used to put the application into SDRAM, and the macro
18877 @code{__BFIN_SDRAM} is defined.
18878 The loader should initialize SDRAM before loading the application.
18879
18880 @item -micplb
18881 @opindex micplb
18882 Assume that ICPLBs are enabled at run time. This has an effect on certain
18883 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18884 are enabled; for standalone applications the default is off.
18885 @end table
18886
18887 @node C6X Options
18888 @subsection C6X Options
18889 @cindex C6X Options
18890
18891 @table @gcctabopt
18892 @item -march=@var{name}
18893 @opindex march
18894 This specifies the name of the target architecture. GCC uses this
18895 name to determine what kind of instructions it can emit when generating
18896 assembly code. Permissible names are: @samp{c62x},
18897 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18898
18899 @item -mbig-endian
18900 @opindex mbig-endian
18901 Generate code for a big-endian target.
18902
18903 @item -mlittle-endian
18904 @opindex mlittle-endian
18905 Generate code for a little-endian target. This is the default.
18906
18907 @item -msim
18908 @opindex msim
18909 Choose startup files and linker script suitable for the simulator.
18910
18911 @item -msdata=default
18912 @opindex msdata=default
18913 Put small global and static data in the @code{.neardata} section,
18914 which is pointed to by register @code{B14}. Put small uninitialized
18915 global and static data in the @code{.bss} section, which is adjacent
18916 to the @code{.neardata} section. Put small read-only data into the
18917 @code{.rodata} section. The corresponding sections used for large
18918 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18919
18920 @item -msdata=all
18921 @opindex msdata=all
18922 Put all data, not just small objects, into the sections reserved for
18923 small data, and use addressing relative to the @code{B14} register to
18924 access them.
18925
18926 @item -msdata=none
18927 @opindex msdata=none
18928 Make no use of the sections reserved for small data, and use absolute
18929 addresses to access all data. Put all initialized global and static
18930 data in the @code{.fardata} section, and all uninitialized data in the
18931 @code{.far} section. Put all constant data into the @code{.const}
18932 section.
18933 @end table
18934
18935 @node CRIS Options
18936 @subsection CRIS Options
18937 @cindex CRIS Options
18938
18939 These options are defined specifically for the CRIS ports.
18940
18941 @table @gcctabopt
18942 @item -march=@var{architecture-type}
18943 @itemx -mcpu=@var{architecture-type}
18944 @opindex march
18945 @opindex mcpu
18946 Generate code for the specified architecture. The choices for
18947 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18948 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18949 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18950 @samp{v10}.
18951
18952 @item -mtune=@var{architecture-type}
18953 @opindex mtune
18954 Tune to @var{architecture-type} everything applicable about the generated
18955 code, except for the ABI and the set of available instructions. The
18956 choices for @var{architecture-type} are the same as for
18957 @option{-march=@var{architecture-type}}.
18958
18959 @item -mmax-stack-frame=@var{n}
18960 @opindex mmax-stack-frame
18961 Warn when the stack frame of a function exceeds @var{n} bytes.
18962
18963 @item -metrax4
18964 @itemx -metrax100
18965 @opindex metrax4
18966 @opindex metrax100
18967 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18968 @option{-march=v3} and @option{-march=v8} respectively.
18969
18970 @item -mmul-bug-workaround
18971 @itemx -mno-mul-bug-workaround
18972 @opindex mmul-bug-workaround
18973 @opindex mno-mul-bug-workaround
18974 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18975 models where it applies. This option is active by default.
18976
18977 @item -mpdebug
18978 @opindex mpdebug
18979 Enable CRIS-specific verbose debug-related information in the assembly
18980 code. This option also has the effect of turning off the @samp{#NO_APP}
18981 formatted-code indicator to the assembler at the beginning of the
18982 assembly file.
18983
18984 @item -mcc-init
18985 @opindex mcc-init
18986 Do not use condition-code results from previous instruction; always emit
18987 compare and test instructions before use of condition codes.
18988
18989 @item -mno-side-effects
18990 @opindex mno-side-effects
18991 @opindex mside-effects
18992 Do not emit instructions with side effects in addressing modes other than
18993 post-increment.
18994
18995 @item -mstack-align
18996 @itemx -mno-stack-align
18997 @itemx -mdata-align
18998 @itemx -mno-data-align
18999 @itemx -mconst-align
19000 @itemx -mno-const-align
19001 @opindex mstack-align
19002 @opindex mno-stack-align
19003 @opindex mdata-align
19004 @opindex mno-data-align
19005 @opindex mconst-align
19006 @opindex mno-const-align
19007 These options (@samp{no-} options) arrange (eliminate arrangements) for the
19008 stack frame, individual data and constants to be aligned for the maximum
19009 single data access size for the chosen CPU model. The default is to
19010 arrange for 32-bit alignment. ABI details such as structure layout are
19011 not affected by these options.
19012
19013 @item -m32-bit
19014 @itemx -m16-bit
19015 @itemx -m8-bit
19016 @opindex m32-bit
19017 @opindex m16-bit
19018 @opindex m8-bit
19019 Similar to the stack- data- and const-align options above, these options
19020 arrange for stack frame, writable data and constants to all be 32-bit,
19021 16-bit or 8-bit aligned. The default is 32-bit alignment.
19022
19023 @item -mno-prologue-epilogue
19024 @itemx -mprologue-epilogue
19025 @opindex mno-prologue-epilogue
19026 @opindex mprologue-epilogue
19027 With @option{-mno-prologue-epilogue}, the normal function prologue and
19028 epilogue which set up the stack frame are omitted and no return
19029 instructions or return sequences are generated in the code. Use this
19030 option only together with visual inspection of the compiled code: no
19031 warnings or errors are generated when call-saved registers must be saved,
19032 or storage for local variables needs to be allocated.
19033
19034 @item -mno-gotplt
19035 @itemx -mgotplt
19036 @opindex mno-gotplt
19037 @opindex mgotplt
19038 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
19039 instruction sequences that load addresses for functions from the PLT part
19040 of the GOT rather than (traditional on other architectures) calls to the
19041 PLT@. The default is @option{-mgotplt}.
19042
19043 @item -melf
19044 @opindex melf
19045 Legacy no-op option only recognized with the cris-axis-elf and
19046 cris-axis-linux-gnu targets.
19047
19048 @item -mlinux
19049 @opindex mlinux
19050 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
19051
19052 @item -sim
19053 @opindex sim
19054 This option, recognized for the cris-axis-elf, arranges
19055 to link with input-output functions from a simulator library. Code,
19056 initialized data and zero-initialized data are allocated consecutively.
19057
19058 @item -sim2
19059 @opindex sim2
19060 Like @option{-sim}, but pass linker options to locate initialized data at
19061 0x40000000 and zero-initialized data at 0x80000000.
19062 @end table
19063
19064 @node CR16 Options
19065 @subsection CR16 Options
19066 @cindex CR16 Options
19067
19068 These options are defined specifically for the CR16 ports.
19069
19070 @table @gcctabopt
19071
19072 @item -mmac
19073 @opindex mmac
19074 Enable the use of multiply-accumulate instructions. Disabled by default.
19075
19076 @item -mcr16cplus
19077 @itemx -mcr16c
19078 @opindex mcr16cplus
19079 @opindex mcr16c
19080 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
19081 is default.
19082
19083 @item -msim
19084 @opindex msim
19085 Links the library libsim.a which is in compatible with simulator. Applicable
19086 to ELF compiler only.
19087
19088 @item -mint32
19089 @opindex mint32
19090 Choose integer type as 32-bit wide.
19091
19092 @item -mbit-ops
19093 @opindex mbit-ops
19094 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
19095
19096 @item -mdata-model=@var{model}
19097 @opindex mdata-model
19098 Choose a data model. The choices for @var{model} are @samp{near},
19099 @samp{far} or @samp{medium}. @samp{medium} is default.
19100 However, @samp{far} is not valid with @option{-mcr16c}, as the
19101 CR16C architecture does not support the far data model.
19102 @end table
19103
19104 @node C-SKY Options
19105 @subsection C-SKY Options
19106 @cindex C-SKY Options
19107
19108 GCC supports these options when compiling for C-SKY V2 processors.
19109
19110 @table @gcctabopt
19111
19112 @item -march=@var{arch}
19113 @opindex march=
19114 Specify the C-SKY target architecture. Valid values for @var{arch} are:
19115 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
19116 The default is @samp{ck810}.
19117
19118 @item -mcpu=@var{cpu}
19119 @opindex mcpu=
19120 Specify the C-SKY target processor. Valid values for @var{cpu} are:
19121 @samp{ck801}, @samp{ck801t},
19122 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
19123 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
19124 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
19125 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
19126 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
19127 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
19128 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
19129 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
19130 @samp{ck803eftr1}, @samp{ck803efhtr1},
19131 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
19132 @samp{ck803sef}, @samp{ck803seft},
19133 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
19134 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
19135 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
19136 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
19137
19138 @item -mbig-endian
19139 @opindex mbig-endian
19140 @itemx -EB
19141 @opindex EB
19142 @itemx -mlittle-endian
19143 @opindex mlittle-endian
19144 @itemx -EL
19145 @opindex EL
19146
19147 Select big- or little-endian code. The default is little-endian.
19148
19149 @item -mhard-float
19150 @opindex mhard-float
19151 @itemx -msoft-float
19152 @opindex msoft-float
19153
19154 Select hardware or software floating-point implementations.
19155 The default is soft float.
19156
19157 @item -mdouble-float
19158 @itemx -mno-double-float
19159 @opindex mdouble-float
19160 When @option{-mhard-float} is in effect, enable generation of
19161 double-precision float instructions. This is the default except
19162 when compiling for CK803.
19163
19164 @item -mfdivdu
19165 @itemx -mno-fdivdu
19166 @opindex mfdivdu
19167 When @option{-mhard-float} is in effect, enable generation of
19168 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19169 This is the default except when compiling for CK803.
19170
19171 @item -mfpu=@var{fpu}
19172 @opindex mfpu=
19173 Select the floating-point processor. This option can only be used with
19174 @option{-mhard-float}.
19175 Values for @var{fpu} are
19176 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19177 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19178 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19179
19180 @item -melrw
19181 @itemx -mno-elrw
19182 @opindex melrw
19183 Enable the extended @code{lrw} instruction. This option defaults to on
19184 for CK801 and off otherwise.
19185
19186 @item -mistack
19187 @itemx -mno-istack
19188 @opindex mistack
19189 Enable interrupt stack instructions; the default is off.
19190
19191 The @option{-mistack} option is required to handle the
19192 @code{interrupt} and @code{isr} function attributes
19193 (@pxref{C-SKY Function Attributes}).
19194
19195 @item -mmp
19196 @opindex mmp
19197 Enable multiprocessor instructions; the default is off.
19198
19199 @item -mcp
19200 @opindex mcp
19201 Enable coprocessor instructions; the default is off.
19202
19203 @item -mcache
19204 @opindex mcache
19205 Enable coprocessor instructions; the default is off.
19206
19207 @item -msecurity
19208 @opindex msecurity
19209 Enable C-SKY security instructions; the default is off.
19210
19211 @item -mtrust
19212 @opindex mtrust
19213 Enable C-SKY trust instructions; the default is off.
19214
19215 @item -mdsp
19216 @opindex mdsp
19217 @itemx -medsp
19218 @opindex medsp
19219 @itemx -mvdsp
19220 @opindex mvdsp
19221 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19222 All of these options default to off.
19223
19224 @item -mdiv
19225 @itemx -mno-div
19226 @opindex mdiv
19227 Generate divide instructions. Default is off.
19228
19229 @item -msmart
19230 @itemx -mno-smart
19231 @opindex msmart
19232 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19233 use of 16-bit instructions. This option is ignored for CK801 where this
19234 is the required behavior, and it defaults to on for CK802.
19235 For other targets, the default is off.
19236
19237 @item -mhigh-registers
19238 @itemx -mno-high-registers
19239 @opindex mhigh-registers
19240 Generate code using the high registers numbered 16-31. This option
19241 is not supported on CK801, CK802, or CK803, and is enabled by default
19242 for other processors.
19243
19244 @item -manchor
19245 @itemx -mno-anchor
19246 @opindex manchor
19247 Generate code using global anchor symbol addresses.
19248
19249 @item -mpushpop
19250 @itemx -mno-pushpop
19251 @opindex mpushpop
19252 Generate code using @code{push} and @code{pop} instructions. This option
19253 defaults to on.
19254
19255 @item -mmultiple-stld
19256 @itemx -mstm
19257 @itemx -mno-multiple-stld
19258 @itemx -mno-stm
19259 @opindex mmultiple-stld
19260 Generate code using @code{stm} and @code{ldm} instructions. This option
19261 isn't supported on CK801 but is enabled by default on other processors.
19262
19263 @item -mconstpool
19264 @itemx -mno-constpool
19265 @opindex mconstpool
19266 Create constant pools in the compiler instead of deferring it to the
19267 assembler. This option is the default and required for correct code
19268 generation on CK801 and CK802, and is optional on other processors.
19269
19270 @item -mstack-size
19271 @item -mno-stack-size
19272 @opindex mstack-size
19273 Emit @code{.stack_size} directives for each function in the assembly
19274 output. This option defaults to off.
19275
19276 @item -mccrt
19277 @itemx -mno-ccrt
19278 @opindex mccrt
19279 Generate code for the C-SKY compiler runtime instead of libgcc. This
19280 option defaults to off.
19281
19282 @item -mbranch-cost=@var{n}
19283 @opindex mbranch-cost=
19284 Set the branch costs to roughly @code{n} instructions. The default is 1.
19285
19286 @item -msched-prolog
19287 @itemx -mno-sched-prolog
19288 @opindex msched-prolog
19289 Permit scheduling of function prologue and epilogue sequences. Using
19290 this option can result in code that is not compliant with the C-SKY V2 ABI
19291 prologue requirements and that cannot be debugged or backtraced.
19292 It is disabled by default.
19293
19294 @end table
19295
19296 @node Darwin Options
19297 @subsection Darwin Options
19298 @cindex Darwin options
19299
19300 These options are defined for all architectures running the Darwin operating
19301 system.
19302
19303 FSF GCC on Darwin does not create ``fat'' object files; it creates
19304 an object file for the single architecture that GCC was built to
19305 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19306 @option{-arch} options are used; it does so by running the compiler or
19307 linker multiple times and joining the results together with
19308 @file{lipo}.
19309
19310 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19311 @samp{i686}) is determined by the flags that specify the ISA
19312 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19313 @option{-force_cpusubtype_ALL} option can be used to override this.
19314
19315 The Darwin tools vary in their behavior when presented with an ISA
19316 mismatch. The assembler, @file{as}, only permits instructions to
19317 be used that are valid for the subtype of the file it is generating,
19318 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19319 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19320 and prints an error if asked to create a shared library with a less
19321 restrictive subtype than its input files (for instance, trying to put
19322 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19323 for executables, @command{ld}, quietly gives the executable the most
19324 restrictive subtype of any of its input files.
19325
19326 @table @gcctabopt
19327 @item -F@var{dir}
19328 @opindex F
19329 Add the framework directory @var{dir} to the head of the list of
19330 directories to be searched for header files. These directories are
19331 interleaved with those specified by @option{-I} options and are
19332 scanned in a left-to-right order.
19333
19334 A framework directory is a directory with frameworks in it. A
19335 framework is a directory with a @file{Headers} and/or
19336 @file{PrivateHeaders} directory contained directly in it that ends
19337 in @file{.framework}. The name of a framework is the name of this
19338 directory excluding the @file{.framework}. Headers associated with
19339 the framework are found in one of those two directories, with
19340 @file{Headers} being searched first. A subframework is a framework
19341 directory that is in a framework's @file{Frameworks} directory.
19342 Includes of subframework headers can only appear in a header of a
19343 framework that contains the subframework, or in a sibling subframework
19344 header. Two subframeworks are siblings if they occur in the same
19345 framework. A subframework should not have the same name as a
19346 framework; a warning is issued if this is violated. Currently a
19347 subframework cannot have subframeworks; in the future, the mechanism
19348 may be extended to support this. The standard frameworks can be found
19349 in @file{/System/Library/Frameworks} and
19350 @file{/Library/Frameworks}. An example include looks like
19351 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19352 the name of the framework and @file{header.h} is found in the
19353 @file{PrivateHeaders} or @file{Headers} directory.
19354
19355 @item -iframework@var{dir}
19356 @opindex iframework
19357 Like @option{-F} except the directory is a treated as a system
19358 directory. The main difference between this @option{-iframework} and
19359 @option{-F} is that with @option{-iframework} the compiler does not
19360 warn about constructs contained within header files found via
19361 @var{dir}. This option is valid only for the C family of languages.
19362
19363 @item -gused
19364 @opindex gused
19365 Emit debugging information for symbols that are used. For stabs
19366 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19367 This is by default ON@.
19368
19369 @item -gfull
19370 @opindex gfull
19371 Emit debugging information for all symbols and types.
19372
19373 @item -mmacosx-version-min=@var{version}
19374 The earliest version of MacOS X that this executable will run on
19375 is @var{version}. Typical values of @var{version} include @code{10.1},
19376 @code{10.2}, and @code{10.3.9}.
19377
19378 If the compiler was built to use the system's headers by default,
19379 then the default for this option is the system version on which the
19380 compiler is running, otherwise the default is to make choices that
19381 are compatible with as many systems and code bases as possible.
19382
19383 @item -mkernel
19384 @opindex mkernel
19385 Enable kernel development mode. The @option{-mkernel} option sets
19386 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19387 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19388 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19389 applicable. This mode also sets @option{-mno-altivec},
19390 @option{-msoft-float}, @option{-fno-builtin} and
19391 @option{-mlong-branch} for PowerPC targets.
19392
19393 @item -mone-byte-bool
19394 @opindex mone-byte-bool
19395 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19396 By default @code{sizeof(bool)} is @code{4} when compiling for
19397 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19398 option has no effect on x86.
19399
19400 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19401 to generate code that is not binary compatible with code generated
19402 without that switch. Using this switch may require recompiling all
19403 other modules in a program, including system libraries. Use this
19404 switch to conform to a non-default data model.
19405
19406 @item -mfix-and-continue
19407 @itemx -ffix-and-continue
19408 @itemx -findirect-data
19409 @opindex mfix-and-continue
19410 @opindex ffix-and-continue
19411 @opindex findirect-data
19412 Generate code suitable for fast turnaround development, such as to
19413 allow GDB to dynamically load @file{.o} files into already-running
19414 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19415 are provided for backwards compatibility.
19416
19417 @item -all_load
19418 @opindex all_load
19419 Loads all members of static archive libraries.
19420 See man ld(1) for more information.
19421
19422 @item -arch_errors_fatal
19423 @opindex arch_errors_fatal
19424 Cause the errors having to do with files that have the wrong architecture
19425 to be fatal.
19426
19427 @item -bind_at_load
19428 @opindex bind_at_load
19429 Causes the output file to be marked such that the dynamic linker will
19430 bind all undefined references when the file is loaded or launched.
19431
19432 @item -bundle
19433 @opindex bundle
19434 Produce a Mach-o bundle format file.
19435 See man ld(1) for more information.
19436
19437 @item -bundle_loader @var{executable}
19438 @opindex bundle_loader
19439 This option specifies the @var{executable} that will load the build
19440 output file being linked. See man ld(1) for more information.
19441
19442 @item -dynamiclib
19443 @opindex dynamiclib
19444 When passed this option, GCC produces a dynamic library instead of
19445 an executable when linking, using the Darwin @file{libtool} command.
19446
19447 @item -force_cpusubtype_ALL
19448 @opindex force_cpusubtype_ALL
19449 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19450 one controlled by the @option{-mcpu} or @option{-march} option.
19451
19452 @item -allowable_client @var{client_name}
19453 @itemx -client_name
19454 @itemx -compatibility_version
19455 @itemx -current_version
19456 @itemx -dead_strip
19457 @itemx -dependency-file
19458 @itemx -dylib_file
19459 @itemx -dylinker_install_name
19460 @itemx -dynamic
19461 @itemx -exported_symbols_list
19462 @itemx -filelist
19463 @need 800
19464 @itemx -flat_namespace
19465 @itemx -force_flat_namespace
19466 @itemx -headerpad_max_install_names
19467 @itemx -image_base
19468 @itemx -init
19469 @itemx -install_name
19470 @itemx -keep_private_externs
19471 @itemx -multi_module
19472 @itemx -multiply_defined
19473 @itemx -multiply_defined_unused
19474 @need 800
19475 @itemx -noall_load
19476 @itemx -no_dead_strip_inits_and_terms
19477 @itemx -nofixprebinding
19478 @itemx -nomultidefs
19479 @itemx -noprebind
19480 @itemx -noseglinkedit
19481 @itemx -pagezero_size
19482 @itemx -prebind
19483 @itemx -prebind_all_twolevel_modules
19484 @itemx -private_bundle
19485 @need 800
19486 @itemx -read_only_relocs
19487 @itemx -sectalign
19488 @itemx -sectobjectsymbols
19489 @itemx -whyload
19490 @itemx -seg1addr
19491 @itemx -sectcreate
19492 @itemx -sectobjectsymbols
19493 @itemx -sectorder
19494 @itemx -segaddr
19495 @itemx -segs_read_only_addr
19496 @need 800
19497 @itemx -segs_read_write_addr
19498 @itemx -seg_addr_table
19499 @itemx -seg_addr_table_filename
19500 @itemx -seglinkedit
19501 @itemx -segprot
19502 @itemx -segs_read_only_addr
19503 @itemx -segs_read_write_addr
19504 @itemx -single_module
19505 @itemx -static
19506 @itemx -sub_library
19507 @need 800
19508 @itemx -sub_umbrella
19509 @itemx -twolevel_namespace
19510 @itemx -umbrella
19511 @itemx -undefined
19512 @itemx -unexported_symbols_list
19513 @itemx -weak_reference_mismatches
19514 @itemx -whatsloaded
19515 @opindex allowable_client
19516 @opindex client_name
19517 @opindex compatibility_version
19518 @opindex current_version
19519 @opindex dead_strip
19520 @opindex dependency-file
19521 @opindex dylib_file
19522 @opindex dylinker_install_name
19523 @opindex dynamic
19524 @opindex exported_symbols_list
19525 @opindex filelist
19526 @opindex flat_namespace
19527 @opindex force_flat_namespace
19528 @opindex headerpad_max_install_names
19529 @opindex image_base
19530 @opindex init
19531 @opindex install_name
19532 @opindex keep_private_externs
19533 @opindex multi_module
19534 @opindex multiply_defined
19535 @opindex multiply_defined_unused
19536 @opindex noall_load
19537 @opindex no_dead_strip_inits_and_terms
19538 @opindex nofixprebinding
19539 @opindex nomultidefs
19540 @opindex noprebind
19541 @opindex noseglinkedit
19542 @opindex pagezero_size
19543 @opindex prebind
19544 @opindex prebind_all_twolevel_modules
19545 @opindex private_bundle
19546 @opindex read_only_relocs
19547 @opindex sectalign
19548 @opindex sectobjectsymbols
19549 @opindex whyload
19550 @opindex seg1addr
19551 @opindex sectcreate
19552 @opindex sectobjectsymbols
19553 @opindex sectorder
19554 @opindex segaddr
19555 @opindex segs_read_only_addr
19556 @opindex segs_read_write_addr
19557 @opindex seg_addr_table
19558 @opindex seg_addr_table_filename
19559 @opindex seglinkedit
19560 @opindex segprot
19561 @opindex segs_read_only_addr
19562 @opindex segs_read_write_addr
19563 @opindex single_module
19564 @opindex static
19565 @opindex sub_library
19566 @opindex sub_umbrella
19567 @opindex twolevel_namespace
19568 @opindex umbrella
19569 @opindex undefined
19570 @opindex unexported_symbols_list
19571 @opindex weak_reference_mismatches
19572 @opindex whatsloaded
19573 These options are passed to the Darwin linker. The Darwin linker man page
19574 describes them in detail.
19575 @end table
19576
19577 @node DEC Alpha Options
19578 @subsection DEC Alpha Options
19579
19580 These @samp{-m} options are defined for the DEC Alpha implementations:
19581
19582 @table @gcctabopt
19583 @item -mno-soft-float
19584 @itemx -msoft-float
19585 @opindex mno-soft-float
19586 @opindex msoft-float
19587 Use (do not use) the hardware floating-point instructions for
19588 floating-point operations. When @option{-msoft-float} is specified,
19589 functions in @file{libgcc.a} are used to perform floating-point
19590 operations. Unless they are replaced by routines that emulate the
19591 floating-point operations, or compiled in such a way as to call such
19592 emulations routines, these routines issue floating-point
19593 operations. If you are compiling for an Alpha without floating-point
19594 operations, you must ensure that the library is built so as not to call
19595 them.
19596
19597 Note that Alpha implementations without floating-point operations are
19598 required to have floating-point registers.
19599
19600 @item -mfp-reg
19601 @itemx -mno-fp-regs
19602 @opindex mfp-reg
19603 @opindex mno-fp-regs
19604 Generate code that uses (does not use) the floating-point register set.
19605 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19606 register set is not used, floating-point operands are passed in integer
19607 registers as if they were integers and floating-point results are passed
19608 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19609 so any function with a floating-point argument or return value called by code
19610 compiled with @option{-mno-fp-regs} must also be compiled with that
19611 option.
19612
19613 A typical use of this option is building a kernel that does not use,
19614 and hence need not save and restore, any floating-point registers.
19615
19616 @item -mieee
19617 @opindex mieee
19618 The Alpha architecture implements floating-point hardware optimized for
19619 maximum performance. It is mostly compliant with the IEEE floating-point
19620 standard. However, for full compliance, software assistance is
19621 required. This option generates code fully IEEE-compliant code
19622 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19623 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19624 defined during compilation. The resulting code is less efficient but is
19625 able to correctly support denormalized numbers and exceptional IEEE
19626 values such as not-a-number and plus/minus infinity. Other Alpha
19627 compilers call this option @option{-ieee_with_no_inexact}.
19628
19629 @item -mieee-with-inexact
19630 @opindex mieee-with-inexact
19631 This is like @option{-mieee} except the generated code also maintains
19632 the IEEE @var{inexact-flag}. Turning on this option causes the
19633 generated code to implement fully-compliant IEEE math. In addition to
19634 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19635 macro. On some Alpha implementations the resulting code may execute
19636 significantly slower than the code generated by default. Since there is
19637 very little code that depends on the @var{inexact-flag}, you should
19638 normally not specify this option. Other Alpha compilers call this
19639 option @option{-ieee_with_inexact}.
19640
19641 @item -mfp-trap-mode=@var{trap-mode}
19642 @opindex mfp-trap-mode
19643 This option controls what floating-point related traps are enabled.
19644 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19645 The trap mode can be set to one of four values:
19646
19647 @table @samp
19648 @item n
19649 This is the default (normal) setting. The only traps that are enabled
19650 are the ones that cannot be disabled in software (e.g., division by zero
19651 trap).
19652
19653 @item u
19654 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19655 as well.
19656
19657 @item su
19658 Like @samp{u}, but the instructions are marked to be safe for software
19659 completion (see Alpha architecture manual for details).
19660
19661 @item sui
19662 Like @samp{su}, but inexact traps are enabled as well.
19663 @end table
19664
19665 @item -mfp-rounding-mode=@var{rounding-mode}
19666 @opindex mfp-rounding-mode
19667 Selects the IEEE rounding mode. Other Alpha compilers call this option
19668 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19669 of:
19670
19671 @table @samp
19672 @item n
19673 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19674 the nearest machine number or towards the even machine number in case
19675 of a tie.
19676
19677 @item m
19678 Round towards minus infinity.
19679
19680 @item c
19681 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19682
19683 @item d
19684 Dynamic rounding mode. A field in the floating-point control register
19685 (@var{fpcr}, see Alpha architecture reference manual) controls the
19686 rounding mode in effect. The C library initializes this register for
19687 rounding towards plus infinity. Thus, unless your program modifies the
19688 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19689 @end table
19690
19691 @item -mtrap-precision=@var{trap-precision}
19692 @opindex mtrap-precision
19693 In the Alpha architecture, floating-point traps are imprecise. This
19694 means without software assistance it is impossible to recover from a
19695 floating trap and program execution normally needs to be terminated.
19696 GCC can generate code that can assist operating system trap handlers
19697 in determining the exact location that caused a floating-point trap.
19698 Depending on the requirements of an application, different levels of
19699 precisions can be selected:
19700
19701 @table @samp
19702 @item p
19703 Program precision. This option is the default and means a trap handler
19704 can only identify which program caused a floating-point exception.
19705
19706 @item f
19707 Function precision. The trap handler can determine the function that
19708 caused a floating-point exception.
19709
19710 @item i
19711 Instruction precision. The trap handler can determine the exact
19712 instruction that caused a floating-point exception.
19713 @end table
19714
19715 Other Alpha compilers provide the equivalent options called
19716 @option{-scope_safe} and @option{-resumption_safe}.
19717
19718 @item -mieee-conformant
19719 @opindex mieee-conformant
19720 This option marks the generated code as IEEE conformant. You must not
19721 use this option unless you also specify @option{-mtrap-precision=i} and either
19722 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19723 is to emit the line @samp{.eflag 48} in the function prologue of the
19724 generated assembly file.
19725
19726 @item -mbuild-constants
19727 @opindex mbuild-constants
19728 Normally GCC examines a 32- or 64-bit integer constant to
19729 see if it can construct it from smaller constants in two or three
19730 instructions. If it cannot, it outputs the constant as a literal and
19731 generates code to load it from the data segment at run time.
19732
19733 Use this option to require GCC to construct @emph{all} integer constants
19734 using code, even if it takes more instructions (the maximum is six).
19735
19736 You typically use this option to build a shared library dynamic
19737 loader. Itself a shared library, it must relocate itself in memory
19738 before it can find the variables and constants in its own data segment.
19739
19740 @item -mbwx
19741 @itemx -mno-bwx
19742 @itemx -mcix
19743 @itemx -mno-cix
19744 @itemx -mfix
19745 @itemx -mno-fix
19746 @itemx -mmax
19747 @itemx -mno-max
19748 @opindex mbwx
19749 @opindex mno-bwx
19750 @opindex mcix
19751 @opindex mno-cix
19752 @opindex mfix
19753 @opindex mno-fix
19754 @opindex mmax
19755 @opindex mno-max
19756 Indicate whether GCC should generate code to use the optional BWX,
19757 CIX, FIX and MAX instruction sets. The default is to use the instruction
19758 sets supported by the CPU type specified via @option{-mcpu=} option or that
19759 of the CPU on which GCC was built if none is specified.
19760
19761 @item -mfloat-vax
19762 @itemx -mfloat-ieee
19763 @opindex mfloat-vax
19764 @opindex mfloat-ieee
19765 Generate code that uses (does not use) VAX F and G floating-point
19766 arithmetic instead of IEEE single and double precision.
19767
19768 @item -mexplicit-relocs
19769 @itemx -mno-explicit-relocs
19770 @opindex mexplicit-relocs
19771 @opindex mno-explicit-relocs
19772 Older Alpha assemblers provided no way to generate symbol relocations
19773 except via assembler macros. Use of these macros does not allow
19774 optimal instruction scheduling. GNU binutils as of version 2.12
19775 supports a new syntax that allows the compiler to explicitly mark
19776 which relocations should apply to which instructions. This option
19777 is mostly useful for debugging, as GCC detects the capabilities of
19778 the assembler when it is built and sets the default accordingly.
19779
19780 @item -msmall-data
19781 @itemx -mlarge-data
19782 @opindex msmall-data
19783 @opindex mlarge-data
19784 When @option{-mexplicit-relocs} is in effect, static data is
19785 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19786 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19787 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19788 16-bit relocations off of the @code{$gp} register. This limits the
19789 size of the small data area to 64KB, but allows the variables to be
19790 directly accessed via a single instruction.
19791
19792 The default is @option{-mlarge-data}. With this option the data area
19793 is limited to just below 2GB@. Programs that require more than 2GB of
19794 data must use @code{malloc} or @code{mmap} to allocate the data in the
19795 heap instead of in the program's data segment.
19796
19797 When generating code for shared libraries, @option{-fpic} implies
19798 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19799
19800 @item -msmall-text
19801 @itemx -mlarge-text
19802 @opindex msmall-text
19803 @opindex mlarge-text
19804 When @option{-msmall-text} is used, the compiler assumes that the
19805 code of the entire program (or shared library) fits in 4MB, and is
19806 thus reachable with a branch instruction. When @option{-msmall-data}
19807 is used, the compiler can assume that all local symbols share the
19808 same @code{$gp} value, and thus reduce the number of instructions
19809 required for a function call from 4 to 1.
19810
19811 The default is @option{-mlarge-text}.
19812
19813 @item -mcpu=@var{cpu_type}
19814 @opindex mcpu
19815 Set the instruction set and instruction scheduling parameters for
19816 machine type @var{cpu_type}. You can specify either the @samp{EV}
19817 style name or the corresponding chip number. GCC supports scheduling
19818 parameters for the EV4, EV5 and EV6 family of processors and
19819 chooses the default values for the instruction set from the processor
19820 you specify. If you do not specify a processor type, GCC defaults
19821 to the processor on which the compiler was built.
19822
19823 Supported values for @var{cpu_type} are
19824
19825 @table @samp
19826 @item ev4
19827 @itemx ev45
19828 @itemx 21064
19829 Schedules as an EV4 and has no instruction set extensions.
19830
19831 @item ev5
19832 @itemx 21164
19833 Schedules as an EV5 and has no instruction set extensions.
19834
19835 @item ev56
19836 @itemx 21164a
19837 Schedules as an EV5 and supports the BWX extension.
19838
19839 @item pca56
19840 @itemx 21164pc
19841 @itemx 21164PC
19842 Schedules as an EV5 and supports the BWX and MAX extensions.
19843
19844 @item ev6
19845 @itemx 21264
19846 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19847
19848 @item ev67
19849 @itemx 21264a
19850 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19851 @end table
19852
19853 Native toolchains also support the value @samp{native},
19854 which selects the best architecture option for the host processor.
19855 @option{-mcpu=native} has no effect if GCC does not recognize
19856 the processor.
19857
19858 @item -mtune=@var{cpu_type}
19859 @opindex mtune
19860 Set only the instruction scheduling parameters for machine type
19861 @var{cpu_type}. The instruction set is not changed.
19862
19863 Native toolchains also support the value @samp{native},
19864 which selects the best architecture option for the host processor.
19865 @option{-mtune=native} has no effect if GCC does not recognize
19866 the processor.
19867
19868 @item -mmemory-latency=@var{time}
19869 @opindex mmemory-latency
19870 Sets the latency the scheduler should assume for typical memory
19871 references as seen by the application. This number is highly
19872 dependent on the memory access patterns used by the application
19873 and the size of the external cache on the machine.
19874
19875 Valid options for @var{time} are
19876
19877 @table @samp
19878 @item @var{number}
19879 A decimal number representing clock cycles.
19880
19881 @item L1
19882 @itemx L2
19883 @itemx L3
19884 @itemx main
19885 The compiler contains estimates of the number of clock cycles for
19886 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19887 (also called Dcache, Scache, and Bcache), as well as to main memory.
19888 Note that L3 is only valid for EV5.
19889
19890 @end table
19891 @end table
19892
19893 @node eBPF Options
19894 @subsection eBPF Options
19895 @cindex eBPF Options
19896
19897 @table @gcctabopt
19898 @item -mframe-limit=@var{bytes}
19899 This specifies the hard limit for frame sizes, in bytes. Currently,
19900 the value that can be specified should be less than or equal to
19901 @samp{32767}. Defaults to whatever limit is imposed by the version of
19902 the Linux kernel targeted.
19903
19904 @item -mkernel=@var{version}
19905 @opindex mkernel
19906 This specifies the minimum version of the kernel that will run the
19907 compiled program. GCC uses this version to determine which
19908 instructions to use, what kernel helpers to allow, etc. Currently,
19909 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
19910 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
19911 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
19912 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
19913 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
19914 @samp{5.2}, @samp{latest} and @samp{native}.
19915
19916 @item -mbig-endian
19917 @opindex mbig-endian
19918 Generate code for a big-endian target.
19919
19920 @item -mlittle-endian
19921 @opindex mlittle-endian
19922 Generate code for a little-endian target. This is the default.
19923 @end table
19924
19925 @node FR30 Options
19926 @subsection FR30 Options
19927 @cindex FR30 Options
19928
19929 These options are defined specifically for the FR30 port.
19930
19931 @table @gcctabopt
19932
19933 @item -msmall-model
19934 @opindex msmall-model
19935 Use the small address space model. This can produce smaller code, but
19936 it does assume that all symbolic values and addresses fit into a
19937 20-bit range.
19938
19939 @item -mno-lsim
19940 @opindex mno-lsim
19941 Assume that runtime support has been provided and so there is no need
19942 to include the simulator library (@file{libsim.a}) on the linker
19943 command line.
19944
19945 @end table
19946
19947 @node FT32 Options
19948 @subsection FT32 Options
19949 @cindex FT32 Options
19950
19951 These options are defined specifically for the FT32 port.
19952
19953 @table @gcctabopt
19954
19955 @item -msim
19956 @opindex msim
19957 Specifies that the program will be run on the simulator. This causes
19958 an alternate runtime startup and library to be linked.
19959 You must not use this option when generating programs that will run on
19960 real hardware; you must provide your own runtime library for whatever
19961 I/O functions are needed.
19962
19963 @item -mlra
19964 @opindex mlra
19965 Enable Local Register Allocation. This is still experimental for FT32,
19966 so by default the compiler uses standard reload.
19967
19968 @item -mnodiv
19969 @opindex mnodiv
19970 Do not use div and mod instructions.
19971
19972 @item -mft32b
19973 @opindex mft32b
19974 Enable use of the extended instructions of the FT32B processor.
19975
19976 @item -mcompress
19977 @opindex mcompress
19978 Compress all code using the Ft32B code compression scheme.
19979
19980 @item -mnopm
19981 @opindex mnopm
19982 Do not generate code that reads program memory.
19983
19984 @end table
19985
19986 @node FRV Options
19987 @subsection FRV Options
19988 @cindex FRV Options
19989
19990 @table @gcctabopt
19991 @item -mgpr-32
19992 @opindex mgpr-32
19993
19994 Only use the first 32 general-purpose registers.
19995
19996 @item -mgpr-64
19997 @opindex mgpr-64
19998
19999 Use all 64 general-purpose registers.
20000
20001 @item -mfpr-32
20002 @opindex mfpr-32
20003
20004 Use only the first 32 floating-point registers.
20005
20006 @item -mfpr-64
20007 @opindex mfpr-64
20008
20009 Use all 64 floating-point registers.
20010
20011 @item -mhard-float
20012 @opindex mhard-float
20013
20014 Use hardware instructions for floating-point operations.
20015
20016 @item -msoft-float
20017 @opindex msoft-float
20018
20019 Use library routines for floating-point operations.
20020
20021 @item -malloc-cc
20022 @opindex malloc-cc
20023
20024 Dynamically allocate condition code registers.
20025
20026 @item -mfixed-cc
20027 @opindex mfixed-cc
20028
20029 Do not try to dynamically allocate condition code registers, only
20030 use @code{icc0} and @code{fcc0}.
20031
20032 @item -mdword
20033 @opindex mdword
20034
20035 Change ABI to use double word insns.
20036
20037 @item -mno-dword
20038 @opindex mno-dword
20039 @opindex mdword
20040
20041 Do not use double word instructions.
20042
20043 @item -mdouble
20044 @opindex mdouble
20045
20046 Use floating-point double instructions.
20047
20048 @item -mno-double
20049 @opindex mno-double
20050
20051 Do not use floating-point double instructions.
20052
20053 @item -mmedia
20054 @opindex mmedia
20055
20056 Use media instructions.
20057
20058 @item -mno-media
20059 @opindex mno-media
20060
20061 Do not use media instructions.
20062
20063 @item -mmuladd
20064 @opindex mmuladd
20065
20066 Use multiply and add/subtract instructions.
20067
20068 @item -mno-muladd
20069 @opindex mno-muladd
20070
20071 Do not use multiply and add/subtract instructions.
20072
20073 @item -mfdpic
20074 @opindex mfdpic
20075
20076 Select the FDPIC ABI, which uses function descriptors to represent
20077 pointers to functions. Without any PIC/PIE-related options, it
20078 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
20079 assumes GOT entries and small data are within a 12-bit range from the
20080 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
20081 are computed with 32 bits.
20082 With a @samp{bfin-elf} target, this option implies @option{-msim}.
20083
20084 @item -minline-plt
20085 @opindex minline-plt
20086
20087 Enable inlining of PLT entries in function calls to functions that are
20088 not known to bind locally. It has no effect without @option{-mfdpic}.
20089 It's enabled by default if optimizing for speed and compiling for
20090 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
20091 optimization option such as @option{-O3} or above is present in the
20092 command line.
20093
20094 @item -mTLS
20095 @opindex mTLS
20096
20097 Assume a large TLS segment when generating thread-local code.
20098
20099 @item -mtls
20100 @opindex mtls
20101
20102 Do not assume a large TLS segment when generating thread-local code.
20103
20104 @item -mgprel-ro
20105 @opindex mgprel-ro
20106
20107 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
20108 that is known to be in read-only sections. It's enabled by default,
20109 except for @option{-fpic} or @option{-fpie}: even though it may help
20110 make the global offset table smaller, it trades 1 instruction for 4.
20111 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
20112 one of which may be shared by multiple symbols, and it avoids the need
20113 for a GOT entry for the referenced symbol, so it's more likely to be a
20114 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
20115
20116 @item -multilib-library-pic
20117 @opindex multilib-library-pic
20118
20119 Link with the (library, not FD) pic libraries. It's implied by
20120 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
20121 @option{-fpic} without @option{-mfdpic}. You should never have to use
20122 it explicitly.
20123
20124 @item -mlinked-fp
20125 @opindex mlinked-fp
20126
20127 Follow the EABI requirement of always creating a frame pointer whenever
20128 a stack frame is allocated. This option is enabled by default and can
20129 be disabled with @option{-mno-linked-fp}.
20130
20131 @item -mlong-calls
20132 @opindex mlong-calls
20133
20134 Use indirect addressing to call functions outside the current
20135 compilation unit. This allows the functions to be placed anywhere
20136 within the 32-bit address space.
20137
20138 @item -malign-labels
20139 @opindex malign-labels
20140
20141 Try to align labels to an 8-byte boundary by inserting NOPs into the
20142 previous packet. This option only has an effect when VLIW packing
20143 is enabled. It doesn't create new packets; it merely adds NOPs to
20144 existing ones.
20145
20146 @item -mlibrary-pic
20147 @opindex mlibrary-pic
20148
20149 Generate position-independent EABI code.
20150
20151 @item -macc-4
20152 @opindex macc-4
20153
20154 Use only the first four media accumulator registers.
20155
20156 @item -macc-8
20157 @opindex macc-8
20158
20159 Use all eight media accumulator registers.
20160
20161 @item -mpack
20162 @opindex mpack
20163
20164 Pack VLIW instructions.
20165
20166 @item -mno-pack
20167 @opindex mno-pack
20168
20169 Do not pack VLIW instructions.
20170
20171 @item -mno-eflags
20172 @opindex mno-eflags
20173
20174 Do not mark ABI switches in e_flags.
20175
20176 @item -mcond-move
20177 @opindex mcond-move
20178
20179 Enable the use of conditional-move instructions (default).
20180
20181 This switch is mainly for debugging the compiler and will likely be removed
20182 in a future version.
20183
20184 @item -mno-cond-move
20185 @opindex mno-cond-move
20186
20187 Disable the use of conditional-move instructions.
20188
20189 This switch is mainly for debugging the compiler and will likely be removed
20190 in a future version.
20191
20192 @item -mscc
20193 @opindex mscc
20194
20195 Enable the use of conditional set instructions (default).
20196
20197 This switch is mainly for debugging the compiler and will likely be removed
20198 in a future version.
20199
20200 @item -mno-scc
20201 @opindex mno-scc
20202
20203 Disable the use of conditional set instructions.
20204
20205 This switch is mainly for debugging the compiler and will likely be removed
20206 in a future version.
20207
20208 @item -mcond-exec
20209 @opindex mcond-exec
20210
20211 Enable the use of conditional execution (default).
20212
20213 This switch is mainly for debugging the compiler and will likely be removed
20214 in a future version.
20215
20216 @item -mno-cond-exec
20217 @opindex mno-cond-exec
20218
20219 Disable the use of conditional execution.
20220
20221 This switch is mainly for debugging the compiler and will likely be removed
20222 in a future version.
20223
20224 @item -mvliw-branch
20225 @opindex mvliw-branch
20226
20227 Run a pass to pack branches into VLIW instructions (default).
20228
20229 This switch is mainly for debugging the compiler and will likely be removed
20230 in a future version.
20231
20232 @item -mno-vliw-branch
20233 @opindex mno-vliw-branch
20234
20235 Do not run a pass to pack branches into VLIW instructions.
20236
20237 This switch is mainly for debugging the compiler and will likely be removed
20238 in a future version.
20239
20240 @item -mmulti-cond-exec
20241 @opindex mmulti-cond-exec
20242
20243 Enable optimization of @code{&&} and @code{||} in conditional execution
20244 (default).
20245
20246 This switch is mainly for debugging the compiler and will likely be removed
20247 in a future version.
20248
20249 @item -mno-multi-cond-exec
20250 @opindex mno-multi-cond-exec
20251
20252 Disable optimization of @code{&&} and @code{||} in conditional execution.
20253
20254 This switch is mainly for debugging the compiler and will likely be removed
20255 in a future version.
20256
20257 @item -mnested-cond-exec
20258 @opindex mnested-cond-exec
20259
20260 Enable nested conditional execution optimizations (default).
20261
20262 This switch is mainly for debugging the compiler and will likely be removed
20263 in a future version.
20264
20265 @item -mno-nested-cond-exec
20266 @opindex mno-nested-cond-exec
20267
20268 Disable nested conditional execution optimizations.
20269
20270 This switch is mainly for debugging the compiler and will likely be removed
20271 in a future version.
20272
20273 @item -moptimize-membar
20274 @opindex moptimize-membar
20275
20276 This switch removes redundant @code{membar} instructions from the
20277 compiler-generated code. It is enabled by default.
20278
20279 @item -mno-optimize-membar
20280 @opindex mno-optimize-membar
20281 @opindex moptimize-membar
20282
20283 This switch disables the automatic removal of redundant @code{membar}
20284 instructions from the generated code.
20285
20286 @item -mtomcat-stats
20287 @opindex mtomcat-stats
20288
20289 Cause gas to print out tomcat statistics.
20290
20291 @item -mcpu=@var{cpu}
20292 @opindex mcpu
20293
20294 Select the processor type for which to generate code. Possible values are
20295 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20296 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20297
20298 @end table
20299
20300 @node GNU/Linux Options
20301 @subsection GNU/Linux Options
20302
20303 These @samp{-m} options are defined for GNU/Linux targets:
20304
20305 @table @gcctabopt
20306 @item -mglibc
20307 @opindex mglibc
20308 Use the GNU C library. This is the default except
20309 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20310 @samp{*-*-linux-*android*} targets.
20311
20312 @item -muclibc
20313 @opindex muclibc
20314 Use uClibc C library. This is the default on
20315 @samp{*-*-linux-*uclibc*} targets.
20316
20317 @item -mmusl
20318 @opindex mmusl
20319 Use the musl C library. This is the default on
20320 @samp{*-*-linux-*musl*} targets.
20321
20322 @item -mbionic
20323 @opindex mbionic
20324 Use Bionic C library. This is the default on
20325 @samp{*-*-linux-*android*} targets.
20326
20327 @item -mandroid
20328 @opindex mandroid
20329 Compile code compatible with Android platform. This is the default on
20330 @samp{*-*-linux-*android*} targets.
20331
20332 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20333 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20334 this option makes the GCC driver pass Android-specific options to the linker.
20335 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20336 to be defined.
20337
20338 @item -tno-android-cc
20339 @opindex tno-android-cc
20340 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20341 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20342 @option{-fno-rtti} by default.
20343
20344 @item -tno-android-ld
20345 @opindex tno-android-ld
20346 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20347 linking options to the linker.
20348
20349 @end table
20350
20351 @node H8/300 Options
20352 @subsection H8/300 Options
20353
20354 These @samp{-m} options are defined for the H8/300 implementations:
20355
20356 @table @gcctabopt
20357 @item -mrelax
20358 @opindex mrelax
20359 Shorten some address references at link time, when possible; uses the
20360 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20361 ld, Using ld}, for a fuller description.
20362
20363 @item -mh
20364 @opindex mh
20365 Generate code for the H8/300H@.
20366
20367 @item -ms
20368 @opindex ms
20369 Generate code for the H8S@.
20370
20371 @item -mn
20372 @opindex mn
20373 Generate code for the H8S and H8/300H in the normal mode. This switch
20374 must be used either with @option{-mh} or @option{-ms}.
20375
20376 @item -ms2600
20377 @opindex ms2600
20378 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20379
20380 @item -mexr
20381 @opindex mexr
20382 Extended registers are stored on stack before execution of function
20383 with monitor attribute. Default option is @option{-mexr}.
20384 This option is valid only for H8S targets.
20385
20386 @item -mno-exr
20387 @opindex mno-exr
20388 @opindex mexr
20389 Extended registers are not stored on stack before execution of function
20390 with monitor attribute. Default option is @option{-mno-exr}.
20391 This option is valid only for H8S targets.
20392
20393 @item -mint32
20394 @opindex mint32
20395 Make @code{int} data 32 bits by default.
20396
20397 @item -malign-300
20398 @opindex malign-300
20399 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20400 The default for the H8/300H and H8S is to align longs and floats on
20401 4-byte boundaries.
20402 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20403 This option has no effect on the H8/300.
20404 @end table
20405
20406 @node HPPA Options
20407 @subsection HPPA Options
20408 @cindex HPPA Options
20409
20410 These @samp{-m} options are defined for the HPPA family of computers:
20411
20412 @table @gcctabopt
20413 @item -march=@var{architecture-type}
20414 @opindex march
20415 Generate code for the specified architecture. The choices for
20416 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20417 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20418 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20419 architecture option for your machine. Code compiled for lower numbered
20420 architectures runs on higher numbered architectures, but not the
20421 other way around.
20422
20423 @item -mpa-risc-1-0
20424 @itemx -mpa-risc-1-1
20425 @itemx -mpa-risc-2-0
20426 @opindex mpa-risc-1-0
20427 @opindex mpa-risc-1-1
20428 @opindex mpa-risc-2-0
20429 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20430
20431 @item -mcaller-copies
20432 @opindex mcaller-copies
20433 The caller copies function arguments passed by hidden reference. This
20434 option should be used with care as it is not compatible with the default
20435 32-bit runtime. However, only aggregates larger than eight bytes are
20436 passed by hidden reference and the option provides better compatibility
20437 with OpenMP.
20438
20439 @item -mjump-in-delay
20440 @opindex mjump-in-delay
20441 This option is ignored and provided for compatibility purposes only.
20442
20443 @item -mdisable-fpregs
20444 @opindex mdisable-fpregs
20445 Prevent floating-point registers from being used in any manner. This is
20446 necessary for compiling kernels that perform lazy context switching of
20447 floating-point registers. If you use this option and attempt to perform
20448 floating-point operations, the compiler aborts.
20449
20450 @item -mdisable-indexing
20451 @opindex mdisable-indexing
20452 Prevent the compiler from using indexing address modes. This avoids some
20453 rather obscure problems when compiling MIG generated code under MACH@.
20454
20455 @item -mno-space-regs
20456 @opindex mno-space-regs
20457 @opindex mspace-regs
20458 Generate code that assumes the target has no space registers. This allows
20459 GCC to generate faster indirect calls and use unscaled index address modes.
20460
20461 Such code is suitable for level 0 PA systems and kernels.
20462
20463 @item -mfast-indirect-calls
20464 @opindex mfast-indirect-calls
20465 Generate code that assumes calls never cross space boundaries. This
20466 allows GCC to emit code that performs faster indirect calls.
20467
20468 This option does not work in the presence of shared libraries or nested
20469 functions.
20470
20471 @item -mfixed-range=@var{register-range}
20472 @opindex mfixed-range
20473 Generate code treating the given register range as fixed registers.
20474 A fixed register is one that the register allocator cannot use. This is
20475 useful when compiling kernel code. A register range is specified as
20476 two registers separated by a dash. Multiple register ranges can be
20477 specified separated by a comma.
20478
20479 @item -mlong-load-store
20480 @opindex mlong-load-store
20481 Generate 3-instruction load and store sequences as sometimes required by
20482 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20483 the HP compilers.
20484
20485 @item -mportable-runtime
20486 @opindex mportable-runtime
20487 Use the portable calling conventions proposed by HP for ELF systems.
20488
20489 @item -mgas
20490 @opindex mgas
20491 Enable the use of assembler directives only GAS understands.
20492
20493 @item -mschedule=@var{cpu-type}
20494 @opindex mschedule
20495 Schedule code according to the constraints for the machine type
20496 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20497 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20498 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20499 proper scheduling option for your machine. The default scheduling is
20500 @samp{8000}.
20501
20502 @item -mlinker-opt
20503 @opindex mlinker-opt
20504 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20505 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20506 linkers in which they give bogus error messages when linking some programs.
20507
20508 @item -msoft-float
20509 @opindex msoft-float
20510 Generate output containing library calls for floating point.
20511 @strong{Warning:} the requisite libraries are not available for all HPPA
20512 targets. Normally the facilities of the machine's usual C compiler are
20513 used, but this cannot be done directly in cross-compilation. You must make
20514 your own arrangements to provide suitable library functions for
20515 cross-compilation.
20516
20517 @option{-msoft-float} changes the calling convention in the output file;
20518 therefore, it is only useful if you compile @emph{all} of a program with
20519 this option. In particular, you need to compile @file{libgcc.a}, the
20520 library that comes with GCC, with @option{-msoft-float} in order for
20521 this to work.
20522
20523 @item -msio
20524 @opindex msio
20525 Generate the predefine, @code{_SIO}, for server IO@. The default is
20526 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20527 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20528 options are available under HP-UX and HI-UX@.
20529
20530 @item -mgnu-ld
20531 @opindex mgnu-ld
20532 Use options specific to GNU @command{ld}.
20533 This passes @option{-shared} to @command{ld} when
20534 building a shared library. It is the default when GCC is configured,
20535 explicitly or implicitly, with the GNU linker. This option does not
20536 affect which @command{ld} is called; it only changes what parameters
20537 are passed to that @command{ld}.
20538 The @command{ld} that is called is determined by the
20539 @option{--with-ld} configure option, GCC's program search path, and
20540 finally by the user's @env{PATH}. The linker used by GCC can be printed
20541 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20542 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20543
20544 @item -mhp-ld
20545 @opindex mhp-ld
20546 Use options specific to HP @command{ld}.
20547 This passes @option{-b} to @command{ld} when building
20548 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20549 links. It is the default when GCC is configured, explicitly or
20550 implicitly, with the HP linker. This option does not affect
20551 which @command{ld} is called; it only changes what parameters are passed to that
20552 @command{ld}.
20553 The @command{ld} that is called is determined by the @option{--with-ld}
20554 configure option, GCC's program search path, and finally by the user's
20555 @env{PATH}. The linker used by GCC can be printed using @samp{which
20556 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20557 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20558
20559 @item -mlong-calls
20560 @opindex mno-long-calls
20561 @opindex mlong-calls
20562 Generate code that uses long call sequences. This ensures that a call
20563 is always able to reach linker generated stubs. The default is to generate
20564 long calls only when the distance from the call site to the beginning
20565 of the function or translation unit, as the case may be, exceeds a
20566 predefined limit set by the branch type being used. The limits for
20567 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20568 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20569 240,000 bytes.
20570
20571 Distances are measured from the beginning of functions when using the
20572 @option{-ffunction-sections} option, or when using the @option{-mgas}
20573 and @option{-mno-portable-runtime} options together under HP-UX with
20574 the SOM linker.
20575
20576 It is normally not desirable to use this option as it degrades
20577 performance. However, it may be useful in large applications,
20578 particularly when partial linking is used to build the application.
20579
20580 The types of long calls used depends on the capabilities of the
20581 assembler and linker, and the type of code being generated. The
20582 impact on systems that support long absolute calls, and long pic
20583 symbol-difference or pc-relative calls should be relatively small.
20584 However, an indirect call is used on 32-bit ELF systems in pic code
20585 and it is quite long.
20586
20587 @item -munix=@var{unix-std}
20588 @opindex march
20589 Generate compiler predefines and select a startfile for the specified
20590 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20591 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20592 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20593 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20594 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20595 and later.
20596
20597 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20598 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20599 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20600 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20601 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20602 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20603
20604 It is @emph{important} to note that this option changes the interfaces
20605 for various library routines. It also affects the operational behavior
20606 of the C library. Thus, @emph{extreme} care is needed in using this
20607 option.
20608
20609 Library code that is intended to operate with more than one UNIX
20610 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20611 as appropriate. Most GNU software doesn't provide this capability.
20612
20613 @item -nolibdld
20614 @opindex nolibdld
20615 Suppress the generation of link options to search libdld.sl when the
20616 @option{-static} option is specified on HP-UX 10 and later.
20617
20618 @item -static
20619 @opindex static
20620 The HP-UX implementation of setlocale in libc has a dependency on
20621 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20622 when the @option{-static} option is specified, special link options
20623 are needed to resolve this dependency.
20624
20625 On HP-UX 10 and later, the GCC driver adds the necessary options to
20626 link with libdld.sl when the @option{-static} option is specified.
20627 This causes the resulting binary to be dynamic. On the 64-bit port,
20628 the linkers generate dynamic binaries by default in any case. The
20629 @option{-nolibdld} option can be used to prevent the GCC driver from
20630 adding these link options.
20631
20632 @item -threads
20633 @opindex threads
20634 Add support for multithreading with the @dfn{dce thread} library
20635 under HP-UX@. This option sets flags for both the preprocessor and
20636 linker.
20637 @end table
20638
20639 @node IA-64 Options
20640 @subsection IA-64 Options
20641 @cindex IA-64 Options
20642
20643 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20644
20645 @table @gcctabopt
20646 @item -mbig-endian
20647 @opindex mbig-endian
20648 Generate code for a big-endian target. This is the default for HP-UX@.
20649
20650 @item -mlittle-endian
20651 @opindex mlittle-endian
20652 Generate code for a little-endian target. This is the default for AIX5
20653 and GNU/Linux.
20654
20655 @item -mgnu-as
20656 @itemx -mno-gnu-as
20657 @opindex mgnu-as
20658 @opindex mno-gnu-as
20659 Generate (or don't) code for the GNU assembler. This is the default.
20660 @c Also, this is the default if the configure option @option{--with-gnu-as}
20661 @c is used.
20662
20663 @item -mgnu-ld
20664 @itemx -mno-gnu-ld
20665 @opindex mgnu-ld
20666 @opindex mno-gnu-ld
20667 Generate (or don't) code for the GNU linker. This is the default.
20668 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20669 @c is used.
20670
20671 @item -mno-pic
20672 @opindex mno-pic
20673 Generate code that does not use a global pointer register. The result
20674 is not position independent code, and violates the IA-64 ABI@.
20675
20676 @item -mvolatile-asm-stop
20677 @itemx -mno-volatile-asm-stop
20678 @opindex mvolatile-asm-stop
20679 @opindex mno-volatile-asm-stop
20680 Generate (or don't) a stop bit immediately before and after volatile asm
20681 statements.
20682
20683 @item -mregister-names
20684 @itemx -mno-register-names
20685 @opindex mregister-names
20686 @opindex mno-register-names
20687 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20688 the stacked registers. This may make assembler output more readable.
20689
20690 @item -mno-sdata
20691 @itemx -msdata
20692 @opindex mno-sdata
20693 @opindex msdata
20694 Disable (or enable) optimizations that use the small data section. This may
20695 be useful for working around optimizer bugs.
20696
20697 @item -mconstant-gp
20698 @opindex mconstant-gp
20699 Generate code that uses a single constant global pointer value. This is
20700 useful when compiling kernel code.
20701
20702 @item -mauto-pic
20703 @opindex mauto-pic
20704 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20705 This is useful when compiling firmware code.
20706
20707 @item -minline-float-divide-min-latency
20708 @opindex minline-float-divide-min-latency
20709 Generate code for inline divides of floating-point values
20710 using the minimum latency algorithm.
20711
20712 @item -minline-float-divide-max-throughput
20713 @opindex minline-float-divide-max-throughput
20714 Generate code for inline divides of floating-point values
20715 using the maximum throughput algorithm.
20716
20717 @item -mno-inline-float-divide
20718 @opindex mno-inline-float-divide
20719 Do not generate inline code for divides of floating-point values.
20720
20721 @item -minline-int-divide-min-latency
20722 @opindex minline-int-divide-min-latency
20723 Generate code for inline divides of integer values
20724 using the minimum latency algorithm.
20725
20726 @item -minline-int-divide-max-throughput
20727 @opindex minline-int-divide-max-throughput
20728 Generate code for inline divides of integer values
20729 using the maximum throughput algorithm.
20730
20731 @item -mno-inline-int-divide
20732 @opindex mno-inline-int-divide
20733 @opindex minline-int-divide
20734 Do not generate inline code for divides of integer values.
20735
20736 @item -minline-sqrt-min-latency
20737 @opindex minline-sqrt-min-latency
20738 Generate code for inline square roots
20739 using the minimum latency algorithm.
20740
20741 @item -minline-sqrt-max-throughput
20742 @opindex minline-sqrt-max-throughput
20743 Generate code for inline square roots
20744 using the maximum throughput algorithm.
20745
20746 @item -mno-inline-sqrt
20747 @opindex mno-inline-sqrt
20748 Do not generate inline code for @code{sqrt}.
20749
20750 @item -mfused-madd
20751 @itemx -mno-fused-madd
20752 @opindex mfused-madd
20753 @opindex mno-fused-madd
20754 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20755 instructions. The default is to use these instructions.
20756
20757 @item -mno-dwarf2-asm
20758 @itemx -mdwarf2-asm
20759 @opindex mno-dwarf2-asm
20760 @opindex mdwarf2-asm
20761 Don't (or do) generate assembler code for the DWARF line number debugging
20762 info. This may be useful when not using the GNU assembler.
20763
20764 @item -mearly-stop-bits
20765 @itemx -mno-early-stop-bits
20766 @opindex mearly-stop-bits
20767 @opindex mno-early-stop-bits
20768 Allow stop bits to be placed earlier than immediately preceding the
20769 instruction that triggered the stop bit. This can improve instruction
20770 scheduling, but does not always do so.
20771
20772 @item -mfixed-range=@var{register-range}
20773 @opindex mfixed-range
20774 Generate code treating the given register range as fixed registers.
20775 A fixed register is one that the register allocator cannot use. This is
20776 useful when compiling kernel code. A register range is specified as
20777 two registers separated by a dash. Multiple register ranges can be
20778 specified separated by a comma.
20779
20780 @item -mtls-size=@var{tls-size}
20781 @opindex mtls-size
20782 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20783 64.
20784
20785 @item -mtune=@var{cpu-type}
20786 @opindex mtune
20787 Tune the instruction scheduling for a particular CPU, Valid values are
20788 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20789 and @samp{mckinley}.
20790
20791 @item -milp32
20792 @itemx -mlp64
20793 @opindex milp32
20794 @opindex mlp64
20795 Generate code for a 32-bit or 64-bit environment.
20796 The 32-bit environment sets int, long and pointer to 32 bits.
20797 The 64-bit environment sets int to 32 bits and long and pointer
20798 to 64 bits. These are HP-UX specific flags.
20799
20800 @item -mno-sched-br-data-spec
20801 @itemx -msched-br-data-spec
20802 @opindex mno-sched-br-data-spec
20803 @opindex msched-br-data-spec
20804 (Dis/En)able data speculative scheduling before reload.
20805 This results in generation of @code{ld.a} instructions and
20806 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20807 The default setting is disabled.
20808
20809 @item -msched-ar-data-spec
20810 @itemx -mno-sched-ar-data-spec
20811 @opindex msched-ar-data-spec
20812 @opindex mno-sched-ar-data-spec
20813 (En/Dis)able data speculative scheduling after reload.
20814 This results in generation of @code{ld.a} instructions and
20815 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20816 The default setting is enabled.
20817
20818 @item -mno-sched-control-spec
20819 @itemx -msched-control-spec
20820 @opindex mno-sched-control-spec
20821 @opindex msched-control-spec
20822 (Dis/En)able control speculative scheduling. This feature is
20823 available only during region scheduling (i.e.@: before reload).
20824 This results in generation of the @code{ld.s} instructions and
20825 the corresponding check instructions @code{chk.s}.
20826 The default setting is disabled.
20827
20828 @item -msched-br-in-data-spec
20829 @itemx -mno-sched-br-in-data-spec
20830 @opindex msched-br-in-data-spec
20831 @opindex mno-sched-br-in-data-spec
20832 (En/Dis)able speculative scheduling of the instructions that
20833 are dependent on the data speculative loads before reload.
20834 This is effective only with @option{-msched-br-data-spec} enabled.
20835 The default setting is enabled.
20836
20837 @item -msched-ar-in-data-spec
20838 @itemx -mno-sched-ar-in-data-spec
20839 @opindex msched-ar-in-data-spec
20840 @opindex mno-sched-ar-in-data-spec
20841 (En/Dis)able speculative scheduling of the instructions that
20842 are dependent on the data speculative loads after reload.
20843 This is effective only with @option{-msched-ar-data-spec} enabled.
20844 The default setting is enabled.
20845
20846 @item -msched-in-control-spec
20847 @itemx -mno-sched-in-control-spec
20848 @opindex msched-in-control-spec
20849 @opindex mno-sched-in-control-spec
20850 (En/Dis)able speculative scheduling of the instructions that
20851 are dependent on the control speculative loads.
20852 This is effective only with @option{-msched-control-spec} enabled.
20853 The default setting is enabled.
20854
20855 @item -mno-sched-prefer-non-data-spec-insns
20856 @itemx -msched-prefer-non-data-spec-insns
20857 @opindex mno-sched-prefer-non-data-spec-insns
20858 @opindex msched-prefer-non-data-spec-insns
20859 If enabled, data-speculative instructions are chosen for schedule
20860 only if there are no other choices at the moment. This makes
20861 the use of the data speculation much more conservative.
20862 The default setting is disabled.
20863
20864 @item -mno-sched-prefer-non-control-spec-insns
20865 @itemx -msched-prefer-non-control-spec-insns
20866 @opindex mno-sched-prefer-non-control-spec-insns
20867 @opindex msched-prefer-non-control-spec-insns
20868 If enabled, control-speculative instructions are chosen for schedule
20869 only if there are no other choices at the moment. This makes
20870 the use of the control speculation much more conservative.
20871 The default setting is disabled.
20872
20873 @item -mno-sched-count-spec-in-critical-path
20874 @itemx -msched-count-spec-in-critical-path
20875 @opindex mno-sched-count-spec-in-critical-path
20876 @opindex msched-count-spec-in-critical-path
20877 If enabled, speculative dependencies are considered during
20878 computation of the instructions priorities. This makes the use of the
20879 speculation a bit more conservative.
20880 The default setting is disabled.
20881
20882 @item -msched-spec-ldc
20883 @opindex msched-spec-ldc
20884 Use a simple data speculation check. This option is on by default.
20885
20886 @item -msched-control-spec-ldc
20887 @opindex msched-spec-ldc
20888 Use a simple check for control speculation. This option is on by default.
20889
20890 @item -msched-stop-bits-after-every-cycle
20891 @opindex msched-stop-bits-after-every-cycle
20892 Place a stop bit after every cycle when scheduling. This option is on
20893 by default.
20894
20895 @item -msched-fp-mem-deps-zero-cost
20896 @opindex msched-fp-mem-deps-zero-cost
20897 Assume that floating-point stores and loads are not likely to cause a conflict
20898 when placed into the same instruction group. This option is disabled by
20899 default.
20900
20901 @item -msel-sched-dont-check-control-spec
20902 @opindex msel-sched-dont-check-control-spec
20903 Generate checks for control speculation in selective scheduling.
20904 This flag is disabled by default.
20905
20906 @item -msched-max-memory-insns=@var{max-insns}
20907 @opindex msched-max-memory-insns
20908 Limit on the number of memory insns per instruction group, giving lower
20909 priority to subsequent memory insns attempting to schedule in the same
20910 instruction group. Frequently useful to prevent cache bank conflicts.
20911 The default value is 1.
20912
20913 @item -msched-max-memory-insns-hard-limit
20914 @opindex msched-max-memory-insns-hard-limit
20915 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20916 disallowing more than that number in an instruction group.
20917 Otherwise, the limit is ``soft'', meaning that non-memory operations
20918 are preferred when the limit is reached, but memory operations may still
20919 be scheduled.
20920
20921 @end table
20922
20923 @node LM32 Options
20924 @subsection LM32 Options
20925 @cindex LM32 options
20926
20927 These @option{-m} options are defined for the LatticeMico32 architecture:
20928
20929 @table @gcctabopt
20930 @item -mbarrel-shift-enabled
20931 @opindex mbarrel-shift-enabled
20932 Enable barrel-shift instructions.
20933
20934 @item -mdivide-enabled
20935 @opindex mdivide-enabled
20936 Enable divide and modulus instructions.
20937
20938 @item -mmultiply-enabled
20939 @opindex multiply-enabled
20940 Enable multiply instructions.
20941
20942 @item -msign-extend-enabled
20943 @opindex msign-extend-enabled
20944 Enable sign extend instructions.
20945
20946 @item -muser-enabled
20947 @opindex muser-enabled
20948 Enable user-defined instructions.
20949
20950 @end table
20951
20952 @node M32C Options
20953 @subsection M32C Options
20954 @cindex M32C options
20955
20956 @table @gcctabopt
20957 @item -mcpu=@var{name}
20958 @opindex mcpu=
20959 Select the CPU for which code is generated. @var{name} may be one of
20960 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20961 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20962 the M32C/80 series.
20963
20964 @item -msim
20965 @opindex msim
20966 Specifies that the program will be run on the simulator. This causes
20967 an alternate runtime library to be linked in which supports, for
20968 example, file I/O@. You must not use this option when generating
20969 programs that will run on real hardware; you must provide your own
20970 runtime library for whatever I/O functions are needed.
20971
20972 @item -memregs=@var{number}
20973 @opindex memregs=
20974 Specifies the number of memory-based pseudo-registers GCC uses
20975 during code generation. These pseudo-registers are used like real
20976 registers, so there is a tradeoff between GCC's ability to fit the
20977 code into available registers, and the performance penalty of using
20978 memory instead of registers. Note that all modules in a program must
20979 be compiled with the same value for this option. Because of that, you
20980 must not use this option with GCC's default runtime libraries.
20981
20982 @end table
20983
20984 @node M32R/D Options
20985 @subsection M32R/D Options
20986 @cindex M32R/D options
20987
20988 These @option{-m} options are defined for Renesas M32R/D architectures:
20989
20990 @table @gcctabopt
20991 @item -m32r2
20992 @opindex m32r2
20993 Generate code for the M32R/2@.
20994
20995 @item -m32rx
20996 @opindex m32rx
20997 Generate code for the M32R/X@.
20998
20999 @item -m32r
21000 @opindex m32r
21001 Generate code for the M32R@. This is the default.
21002
21003 @item -mmodel=small
21004 @opindex mmodel=small
21005 Assume all objects live in the lower 16MB of memory (so that their addresses
21006 can be loaded with the @code{ld24} instruction), and assume all subroutines
21007 are reachable with the @code{bl} instruction.
21008 This is the default.
21009
21010 The addressability of a particular object can be set with the
21011 @code{model} attribute.
21012
21013 @item -mmodel=medium
21014 @opindex mmodel=medium
21015 Assume objects may be anywhere in the 32-bit address space (the compiler
21016 generates @code{seth/add3} instructions to load their addresses), and
21017 assume all subroutines are reachable with the @code{bl} instruction.
21018
21019 @item -mmodel=large
21020 @opindex mmodel=large
21021 Assume objects may be anywhere in the 32-bit address space (the compiler
21022 generates @code{seth/add3} instructions to load their addresses), and
21023 assume subroutines may not be reachable with the @code{bl} instruction
21024 (the compiler generates the much slower @code{seth/add3/jl}
21025 instruction sequence).
21026
21027 @item -msdata=none
21028 @opindex msdata=none
21029 Disable use of the small data area. Variables are put into
21030 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
21031 @code{section} attribute has been specified).
21032 This is the default.
21033
21034 The small data area consists of sections @code{.sdata} and @code{.sbss}.
21035 Objects may be explicitly put in the small data area with the
21036 @code{section} attribute using one of these sections.
21037
21038 @item -msdata=sdata
21039 @opindex msdata=sdata
21040 Put small global and static data in the small data area, but do not
21041 generate special code to reference them.
21042
21043 @item -msdata=use
21044 @opindex msdata=use
21045 Put small global and static data in the small data area, and generate
21046 special instructions to reference them.
21047
21048 @item -G @var{num}
21049 @opindex G
21050 @cindex smaller data references
21051 Put global and static objects less than or equal to @var{num} bytes
21052 into the small data or BSS sections instead of the normal data or BSS
21053 sections. The default value of @var{num} is 8.
21054 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
21055 for this option to have any effect.
21056
21057 All modules should be compiled with the same @option{-G @var{num}} value.
21058 Compiling with different values of @var{num} may or may not work; if it
21059 doesn't the linker gives an error message---incorrect code is not
21060 generated.
21061
21062 @item -mdebug
21063 @opindex mdebug
21064 Makes the M32R-specific code in the compiler display some statistics
21065 that might help in debugging programs.
21066
21067 @item -malign-loops
21068 @opindex malign-loops
21069 Align all loops to a 32-byte boundary.
21070
21071 @item -mno-align-loops
21072 @opindex mno-align-loops
21073 Do not enforce a 32-byte alignment for loops. This is the default.
21074
21075 @item -missue-rate=@var{number}
21076 @opindex missue-rate=@var{number}
21077 Issue @var{number} instructions per cycle. @var{number} can only be 1
21078 or 2.
21079
21080 @item -mbranch-cost=@var{number}
21081 @opindex mbranch-cost=@var{number}
21082 @var{number} can only be 1 or 2. If it is 1 then branches are
21083 preferred over conditional code, if it is 2, then the opposite applies.
21084
21085 @item -mflush-trap=@var{number}
21086 @opindex mflush-trap=@var{number}
21087 Specifies the trap number to use to flush the cache. The default is
21088 12. Valid numbers are between 0 and 15 inclusive.
21089
21090 @item -mno-flush-trap
21091 @opindex mno-flush-trap
21092 Specifies that the cache cannot be flushed by using a trap.
21093
21094 @item -mflush-func=@var{name}
21095 @opindex mflush-func=@var{name}
21096 Specifies the name of the operating system function to call to flush
21097 the cache. The default is @samp{_flush_cache}, but a function call
21098 is only used if a trap is not available.
21099
21100 @item -mno-flush-func
21101 @opindex mno-flush-func
21102 Indicates that there is no OS function for flushing the cache.
21103
21104 @end table
21105
21106 @node M680x0 Options
21107 @subsection M680x0 Options
21108 @cindex M680x0 options
21109
21110 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
21111 The default settings depend on which architecture was selected when
21112 the compiler was configured; the defaults for the most common choices
21113 are given below.
21114
21115 @table @gcctabopt
21116 @item -march=@var{arch}
21117 @opindex march
21118 Generate code for a specific M680x0 or ColdFire instruction set
21119 architecture. Permissible values of @var{arch} for M680x0
21120 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
21121 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
21122 architectures are selected according to Freescale's ISA classification
21123 and the permissible values are: @samp{isaa}, @samp{isaaplus},
21124 @samp{isab} and @samp{isac}.
21125
21126 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
21127 code for a ColdFire target. The @var{arch} in this macro is one of the
21128 @option{-march} arguments given above.
21129
21130 When used together, @option{-march} and @option{-mtune} select code
21131 that runs on a family of similar processors but that is optimized
21132 for a particular microarchitecture.
21133
21134 @item -mcpu=@var{cpu}
21135 @opindex mcpu
21136 Generate code for a specific M680x0 or ColdFire processor.
21137 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
21138 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
21139 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
21140 below, which also classifies the CPUs into families:
21141
21142 @multitable @columnfractions 0.20 0.80
21143 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
21144 @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}
21145 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
21146 @item @samp{5206e} @tab @samp{5206e}
21147 @item @samp{5208} @tab @samp{5207} @samp{5208}
21148 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
21149 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
21150 @item @samp{5216} @tab @samp{5214} @samp{5216}
21151 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
21152 @item @samp{5225} @tab @samp{5224} @samp{5225}
21153 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
21154 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
21155 @item @samp{5249} @tab @samp{5249}
21156 @item @samp{5250} @tab @samp{5250}
21157 @item @samp{5271} @tab @samp{5270} @samp{5271}
21158 @item @samp{5272} @tab @samp{5272}
21159 @item @samp{5275} @tab @samp{5274} @samp{5275}
21160 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
21161 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
21162 @item @samp{5307} @tab @samp{5307}
21163 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
21164 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
21165 @item @samp{5407} @tab @samp{5407}
21166 @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}
21167 @end multitable
21168
21169 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
21170 @var{arch} is compatible with @var{cpu}. Other combinations of
21171 @option{-mcpu} and @option{-march} are rejected.
21172
21173 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
21174 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
21175 where the value of @var{family} is given by the table above.
21176
21177 @item -mtune=@var{tune}
21178 @opindex mtune
21179 Tune the code for a particular microarchitecture within the
21180 constraints set by @option{-march} and @option{-mcpu}.
21181 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
21182 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
21183 and @samp{cpu32}. The ColdFire microarchitectures
21184 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
21185
21186 You can also use @option{-mtune=68020-40} for code that needs
21187 to run relatively well on 68020, 68030 and 68040 targets.
21188 @option{-mtune=68020-60} is similar but includes 68060 targets
21189 as well. These two options select the same tuning decisions as
21190 @option{-m68020-40} and @option{-m68020-60} respectively.
21191
21192 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
21193 when tuning for 680x0 architecture @var{arch}. It also defines
21194 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
21195 option is used. If GCC is tuning for a range of architectures,
21196 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21197 it defines the macros for every architecture in the range.
21198
21199 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21200 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21201 of the arguments given above.
21202
21203 @item -m68000
21204 @itemx -mc68000
21205 @opindex m68000
21206 @opindex mc68000
21207 Generate output for a 68000. This is the default
21208 when the compiler is configured for 68000-based systems.
21209 It is equivalent to @option{-march=68000}.
21210
21211 Use this option for microcontrollers with a 68000 or EC000 core,
21212 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21213
21214 @item -m68010
21215 @opindex m68010
21216 Generate output for a 68010. This is the default
21217 when the compiler is configured for 68010-based systems.
21218 It is equivalent to @option{-march=68010}.
21219
21220 @item -m68020
21221 @itemx -mc68020
21222 @opindex m68020
21223 @opindex mc68020
21224 Generate output for a 68020. This is the default
21225 when the compiler is configured for 68020-based systems.
21226 It is equivalent to @option{-march=68020}.
21227
21228 @item -m68030
21229 @opindex m68030
21230 Generate output for a 68030. This is the default when the compiler is
21231 configured for 68030-based systems. It is equivalent to
21232 @option{-march=68030}.
21233
21234 @item -m68040
21235 @opindex m68040
21236 Generate output for a 68040. This is the default when the compiler is
21237 configured for 68040-based systems. It is equivalent to
21238 @option{-march=68040}.
21239
21240 This option inhibits the use of 68881/68882 instructions that have to be
21241 emulated by software on the 68040. Use this option if your 68040 does not
21242 have code to emulate those instructions.
21243
21244 @item -m68060
21245 @opindex m68060
21246 Generate output for a 68060. This is the default when the compiler is
21247 configured for 68060-based systems. It is equivalent to
21248 @option{-march=68060}.
21249
21250 This option inhibits the use of 68020 and 68881/68882 instructions that
21251 have to be emulated by software on the 68060. Use this option if your 68060
21252 does not have code to emulate those instructions.
21253
21254 @item -mcpu32
21255 @opindex mcpu32
21256 Generate output for a CPU32. This is the default
21257 when the compiler is configured for CPU32-based systems.
21258 It is equivalent to @option{-march=cpu32}.
21259
21260 Use this option for microcontrollers with a
21261 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21262 68336, 68340, 68341, 68349 and 68360.
21263
21264 @item -m5200
21265 @opindex m5200
21266 Generate output for a 520X ColdFire CPU@. This is the default
21267 when the compiler is configured for 520X-based systems.
21268 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21269 in favor of that option.
21270
21271 Use this option for microcontroller with a 5200 core, including
21272 the MCF5202, MCF5203, MCF5204 and MCF5206.
21273
21274 @item -m5206e
21275 @opindex m5206e
21276 Generate output for a 5206e ColdFire CPU@. The option is now
21277 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21278
21279 @item -m528x
21280 @opindex m528x
21281 Generate output for a member of the ColdFire 528X family.
21282 The option is now deprecated in favor of the equivalent
21283 @option{-mcpu=528x}.
21284
21285 @item -m5307
21286 @opindex m5307
21287 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21288 in favor of the equivalent @option{-mcpu=5307}.
21289
21290 @item -m5407
21291 @opindex m5407
21292 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21293 in favor of the equivalent @option{-mcpu=5407}.
21294
21295 @item -mcfv4e
21296 @opindex mcfv4e
21297 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21298 This includes use of hardware floating-point instructions.
21299 The option is equivalent to @option{-mcpu=547x}, and is now
21300 deprecated in favor of that option.
21301
21302 @item -m68020-40
21303 @opindex m68020-40
21304 Generate output for a 68040, without using any of the new instructions.
21305 This results in code that can run relatively efficiently on either a
21306 68020/68881 or a 68030 or a 68040. The generated code does use the
21307 68881 instructions that are emulated on the 68040.
21308
21309 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21310
21311 @item -m68020-60
21312 @opindex m68020-60
21313 Generate output for a 68060, without using any of the new instructions.
21314 This results in code that can run relatively efficiently on either a
21315 68020/68881 or a 68030 or a 68040. The generated code does use the
21316 68881 instructions that are emulated on the 68060.
21317
21318 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21319
21320 @item -mhard-float
21321 @itemx -m68881
21322 @opindex mhard-float
21323 @opindex m68881
21324 Generate floating-point instructions. This is the default for 68020
21325 and above, and for ColdFire devices that have an FPU@. It defines the
21326 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21327 on ColdFire targets.
21328
21329 @item -msoft-float
21330 @opindex msoft-float
21331 Do not generate floating-point instructions; use library calls instead.
21332 This is the default for 68000, 68010, and 68832 targets. It is also
21333 the default for ColdFire devices that have no FPU.
21334
21335 @item -mdiv
21336 @itemx -mno-div
21337 @opindex mdiv
21338 @opindex mno-div
21339 Generate (do not generate) ColdFire hardware divide and remainder
21340 instructions. If @option{-march} is used without @option{-mcpu},
21341 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21342 architectures. Otherwise, the default is taken from the target CPU
21343 (either the default CPU, or the one specified by @option{-mcpu}). For
21344 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21345 @option{-mcpu=5206e}.
21346
21347 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21348
21349 @item -mshort
21350 @opindex mshort
21351 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21352 Additionally, parameters passed on the stack are also aligned to a
21353 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21354
21355 @item -mno-short
21356 @opindex mno-short
21357 Do not consider type @code{int} to be 16 bits wide. This is the default.
21358
21359 @item -mnobitfield
21360 @itemx -mno-bitfield
21361 @opindex mnobitfield
21362 @opindex mno-bitfield
21363 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21364 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21365
21366 @item -mbitfield
21367 @opindex mbitfield
21368 Do use the bit-field instructions. The @option{-m68020} option implies
21369 @option{-mbitfield}. This is the default if you use a configuration
21370 designed for a 68020.
21371
21372 @item -mrtd
21373 @opindex mrtd
21374 Use a different function-calling convention, in which functions
21375 that take a fixed number of arguments return with the @code{rtd}
21376 instruction, which pops their arguments while returning. This
21377 saves one instruction in the caller since there is no need to pop
21378 the arguments there.
21379
21380 This calling convention is incompatible with the one normally
21381 used on Unix, so you cannot use it if you need to call libraries
21382 compiled with the Unix compiler.
21383
21384 Also, you must provide function prototypes for all functions that
21385 take variable numbers of arguments (including @code{printf});
21386 otherwise incorrect code is generated for calls to those
21387 functions.
21388
21389 In addition, seriously incorrect code results if you call a
21390 function with too many arguments. (Normally, extra arguments are
21391 harmlessly ignored.)
21392
21393 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21394 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21395
21396 The default is @option{-mno-rtd}.
21397
21398 @item -malign-int
21399 @itemx -mno-align-int
21400 @opindex malign-int
21401 @opindex mno-align-int
21402 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21403 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21404 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21405 Aligning variables on 32-bit boundaries produces code that runs somewhat
21406 faster on processors with 32-bit busses at the expense of more memory.
21407
21408 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21409 aligns structures containing the above types differently than
21410 most published application binary interface specifications for the m68k.
21411
21412 @item -mpcrel
21413 @opindex mpcrel
21414 Use the pc-relative addressing mode of the 68000 directly, instead of
21415 using a global offset table. At present, this option implies @option{-fpic},
21416 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21417 not presently supported with @option{-mpcrel}, though this could be supported for
21418 68020 and higher processors.
21419
21420 @item -mno-strict-align
21421 @itemx -mstrict-align
21422 @opindex mno-strict-align
21423 @opindex mstrict-align
21424 Do not (do) assume that unaligned memory references are handled by
21425 the system.
21426
21427 @item -msep-data
21428 Generate code that allows the data segment to be located in a different
21429 area of memory from the text segment. This allows for execute-in-place in
21430 an environment without virtual memory management. This option implies
21431 @option{-fPIC}.
21432
21433 @item -mno-sep-data
21434 Generate code that assumes that the data segment follows the text segment.
21435 This is the default.
21436
21437 @item -mid-shared-library
21438 Generate code that supports shared libraries via the library ID method.
21439 This allows for execute-in-place and shared libraries in an environment
21440 without virtual memory management. This option implies @option{-fPIC}.
21441
21442 @item -mno-id-shared-library
21443 Generate code that doesn't assume ID-based shared libraries are being used.
21444 This is the default.
21445
21446 @item -mshared-library-id=n
21447 Specifies the identification number of the ID-based shared library being
21448 compiled. Specifying a value of 0 generates more compact code; specifying
21449 other values forces the allocation of that number to the current
21450 library, but is no more space- or time-efficient than omitting this option.
21451
21452 @item -mxgot
21453 @itemx -mno-xgot
21454 @opindex mxgot
21455 @opindex mno-xgot
21456 When generating position-independent code for ColdFire, generate code
21457 that works if the GOT has more than 8192 entries. This code is
21458 larger and slower than code generated without this option. On M680x0
21459 processors, this option is not needed; @option{-fPIC} suffices.
21460
21461 GCC normally uses a single instruction to load values from the GOT@.
21462 While this is relatively efficient, it only works if the GOT
21463 is smaller than about 64k. Anything larger causes the linker
21464 to report an error such as:
21465
21466 @cindex relocation truncated to fit (ColdFire)
21467 @smallexample
21468 relocation truncated to fit: R_68K_GOT16O foobar
21469 @end smallexample
21470
21471 If this happens, you should recompile your code with @option{-mxgot}.
21472 It should then work with very large GOTs. However, code generated with
21473 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21474 the value of a global symbol.
21475
21476 Note that some linkers, including newer versions of the GNU linker,
21477 can create multiple GOTs and sort GOT entries. If you have such a linker,
21478 you should only need to use @option{-mxgot} when compiling a single
21479 object file that accesses more than 8192 GOT entries. Very few do.
21480
21481 These options have no effect unless GCC is generating
21482 position-independent code.
21483
21484 @item -mlong-jump-table-offsets
21485 @opindex mlong-jump-table-offsets
21486 Use 32-bit offsets in @code{switch} tables. The default is to use
21487 16-bit offsets.
21488
21489 @end table
21490
21491 @node MCore Options
21492 @subsection MCore Options
21493 @cindex MCore options
21494
21495 These are the @samp{-m} options defined for the Motorola M*Core
21496 processors.
21497
21498 @table @gcctabopt
21499
21500 @item -mhardlit
21501 @itemx -mno-hardlit
21502 @opindex mhardlit
21503 @opindex mno-hardlit
21504 Inline constants into the code stream if it can be done in two
21505 instructions or less.
21506
21507 @item -mdiv
21508 @itemx -mno-div
21509 @opindex mdiv
21510 @opindex mno-div
21511 Use the divide instruction. (Enabled by default).
21512
21513 @item -mrelax-immediate
21514 @itemx -mno-relax-immediate
21515 @opindex mrelax-immediate
21516 @opindex mno-relax-immediate
21517 Allow arbitrary-sized immediates in bit operations.
21518
21519 @item -mwide-bitfields
21520 @itemx -mno-wide-bitfields
21521 @opindex mwide-bitfields
21522 @opindex mno-wide-bitfields
21523 Always treat bit-fields as @code{int}-sized.
21524
21525 @item -m4byte-functions
21526 @itemx -mno-4byte-functions
21527 @opindex m4byte-functions
21528 @opindex mno-4byte-functions
21529 Force all functions to be aligned to a 4-byte boundary.
21530
21531 @item -mcallgraph-data
21532 @itemx -mno-callgraph-data
21533 @opindex mcallgraph-data
21534 @opindex mno-callgraph-data
21535 Emit callgraph information.
21536
21537 @item -mslow-bytes
21538 @itemx -mno-slow-bytes
21539 @opindex mslow-bytes
21540 @opindex mno-slow-bytes
21541 Prefer word access when reading byte quantities.
21542
21543 @item -mlittle-endian
21544 @itemx -mbig-endian
21545 @opindex mlittle-endian
21546 @opindex mbig-endian
21547 Generate code for a little-endian target.
21548
21549 @item -m210
21550 @itemx -m340
21551 @opindex m210
21552 @opindex m340
21553 Generate code for the 210 processor.
21554
21555 @item -mno-lsim
21556 @opindex mno-lsim
21557 Assume that runtime support has been provided and so omit the
21558 simulator library (@file{libsim.a)} from the linker command line.
21559
21560 @item -mstack-increment=@var{size}
21561 @opindex mstack-increment
21562 Set the maximum amount for a single stack increment operation. Large
21563 values can increase the speed of programs that contain functions
21564 that need a large amount of stack space, but they can also trigger a
21565 segmentation fault if the stack is extended too much. The default
21566 value is 0x1000.
21567
21568 @end table
21569
21570 @node MeP Options
21571 @subsection MeP Options
21572 @cindex MeP options
21573
21574 @table @gcctabopt
21575
21576 @item -mabsdiff
21577 @opindex mabsdiff
21578 Enables the @code{abs} instruction, which is the absolute difference
21579 between two registers.
21580
21581 @item -mall-opts
21582 @opindex mall-opts
21583 Enables all the optional instructions---average, multiply, divide, bit
21584 operations, leading zero, absolute difference, min/max, clip, and
21585 saturation.
21586
21587
21588 @item -maverage
21589 @opindex maverage
21590 Enables the @code{ave} instruction, which computes the average of two
21591 registers.
21592
21593 @item -mbased=@var{n}
21594 @opindex mbased=
21595 Variables of size @var{n} bytes or smaller are placed in the
21596 @code{.based} section by default. Based variables use the @code{$tp}
21597 register as a base register, and there is a 128-byte limit to the
21598 @code{.based} section.
21599
21600 @item -mbitops
21601 @opindex mbitops
21602 Enables the bit operation instructions---bit test (@code{btstm}), set
21603 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21604 test-and-set (@code{tas}).
21605
21606 @item -mc=@var{name}
21607 @opindex mc=
21608 Selects which section constant data is placed in. @var{name} may
21609 be @samp{tiny}, @samp{near}, or @samp{far}.
21610
21611 @item -mclip
21612 @opindex mclip
21613 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21614 useful unless you also provide @option{-mminmax}.
21615
21616 @item -mconfig=@var{name}
21617 @opindex mconfig=
21618 Selects one of the built-in core configurations. Each MeP chip has
21619 one or more modules in it; each module has a core CPU and a variety of
21620 coprocessors, optional instructions, and peripherals. The
21621 @code{MeP-Integrator} tool, not part of GCC, provides these
21622 configurations through this option; using this option is the same as
21623 using all the corresponding command-line options. The default
21624 configuration is @samp{default}.
21625
21626 @item -mcop
21627 @opindex mcop
21628 Enables the coprocessor instructions. By default, this is a 32-bit
21629 coprocessor. Note that the coprocessor is normally enabled via the
21630 @option{-mconfig=} option.
21631
21632 @item -mcop32
21633 @opindex mcop32
21634 Enables the 32-bit coprocessor's instructions.
21635
21636 @item -mcop64
21637 @opindex mcop64
21638 Enables the 64-bit coprocessor's instructions.
21639
21640 @item -mivc2
21641 @opindex mivc2
21642 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21643
21644 @item -mdc
21645 @opindex mdc
21646 Causes constant variables to be placed in the @code{.near} section.
21647
21648 @item -mdiv
21649 @opindex mdiv
21650 Enables the @code{div} and @code{divu} instructions.
21651
21652 @item -meb
21653 @opindex meb
21654 Generate big-endian code.
21655
21656 @item -mel
21657 @opindex mel
21658 Generate little-endian code.
21659
21660 @item -mio-volatile
21661 @opindex mio-volatile
21662 Tells the compiler that any variable marked with the @code{io}
21663 attribute is to be considered volatile.
21664
21665 @item -ml
21666 @opindex ml
21667 Causes variables to be assigned to the @code{.far} section by default.
21668
21669 @item -mleadz
21670 @opindex mleadz
21671 Enables the @code{leadz} (leading zero) instruction.
21672
21673 @item -mm
21674 @opindex mm
21675 Causes variables to be assigned to the @code{.near} section by default.
21676
21677 @item -mminmax
21678 @opindex mminmax
21679 Enables the @code{min} and @code{max} instructions.
21680
21681 @item -mmult
21682 @opindex mmult
21683 Enables the multiplication and multiply-accumulate instructions.
21684
21685 @item -mno-opts
21686 @opindex mno-opts
21687 Disables all the optional instructions enabled by @option{-mall-opts}.
21688
21689 @item -mrepeat
21690 @opindex mrepeat
21691 Enables the @code{repeat} and @code{erepeat} instructions, used for
21692 low-overhead looping.
21693
21694 @item -ms
21695 @opindex ms
21696 Causes all variables to default to the @code{.tiny} section. Note
21697 that there is a 65536-byte limit to this section. Accesses to these
21698 variables use the @code{%gp} base register.
21699
21700 @item -msatur
21701 @opindex msatur
21702 Enables the saturation instructions. Note that the compiler does not
21703 currently generate these itself, but this option is included for
21704 compatibility with other tools, like @code{as}.
21705
21706 @item -msdram
21707 @opindex msdram
21708 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21709
21710 @item -msim
21711 @opindex msim
21712 Link the simulator run-time libraries.
21713
21714 @item -msimnovec
21715 @opindex msimnovec
21716 Link the simulator runtime libraries, excluding built-in support
21717 for reset and exception vectors and tables.
21718
21719 @item -mtf
21720 @opindex mtf
21721 Causes all functions to default to the @code{.far} section. Without
21722 this option, functions default to the @code{.near} section.
21723
21724 @item -mtiny=@var{n}
21725 @opindex mtiny=
21726 Variables that are @var{n} bytes or smaller are allocated to the
21727 @code{.tiny} section. These variables use the @code{$gp} base
21728 register. The default for this option is 4, but note that there's a
21729 65536-byte limit to the @code{.tiny} section.
21730
21731 @end table
21732
21733 @node MicroBlaze Options
21734 @subsection MicroBlaze Options
21735 @cindex MicroBlaze Options
21736
21737 @table @gcctabopt
21738
21739 @item -msoft-float
21740 @opindex msoft-float
21741 Use software emulation for floating point (default).
21742
21743 @item -mhard-float
21744 @opindex mhard-float
21745 Use hardware floating-point instructions.
21746
21747 @item -mmemcpy
21748 @opindex mmemcpy
21749 Do not optimize block moves, use @code{memcpy}.
21750
21751 @item -mno-clearbss
21752 @opindex mno-clearbss
21753 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21754
21755 @item -mcpu=@var{cpu-type}
21756 @opindex mcpu=
21757 Use features of, and schedule code for, the given CPU.
21758 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21759 where @var{X} is a major version, @var{YY} is the minor version, and
21760 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21761 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21762
21763 @item -mxl-soft-mul
21764 @opindex mxl-soft-mul
21765 Use software multiply emulation (default).
21766
21767 @item -mxl-soft-div
21768 @opindex mxl-soft-div
21769 Use software emulation for divides (default).
21770
21771 @item -mxl-barrel-shift
21772 @opindex mxl-barrel-shift
21773 Use the hardware barrel shifter.
21774
21775 @item -mxl-pattern-compare
21776 @opindex mxl-pattern-compare
21777 Use pattern compare instructions.
21778
21779 @item -msmall-divides
21780 @opindex msmall-divides
21781 Use table lookup optimization for small signed integer divisions.
21782
21783 @item -mxl-stack-check
21784 @opindex mxl-stack-check
21785 This option is deprecated. Use @option{-fstack-check} instead.
21786
21787 @item -mxl-gp-opt
21788 @opindex mxl-gp-opt
21789 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21790
21791 @item -mxl-multiply-high
21792 @opindex mxl-multiply-high
21793 Use multiply high instructions for high part of 32x32 multiply.
21794
21795 @item -mxl-float-convert
21796 @opindex mxl-float-convert
21797 Use hardware floating-point conversion instructions.
21798
21799 @item -mxl-float-sqrt
21800 @opindex mxl-float-sqrt
21801 Use hardware floating-point square root instruction.
21802
21803 @item -mbig-endian
21804 @opindex mbig-endian
21805 Generate code for a big-endian target.
21806
21807 @item -mlittle-endian
21808 @opindex mlittle-endian
21809 Generate code for a little-endian target.
21810
21811 @item -mxl-reorder
21812 @opindex mxl-reorder
21813 Use reorder instructions (swap and byte reversed load/store).
21814
21815 @item -mxl-mode-@var{app-model}
21816 Select application model @var{app-model}. Valid models are
21817 @table @samp
21818 @item executable
21819 normal executable (default), uses startup code @file{crt0.o}.
21820
21821 @item -mpic-data-is-text-relative
21822 @opindex mpic-data-is-text-relative
21823 Assume that the displacement between the text and data segments is fixed
21824 at static link time. This allows data to be referenced by offset from start of
21825 text address instead of GOT since PC-relative addressing is not supported.
21826
21827 @item xmdstub
21828 for use with Xilinx Microprocessor Debugger (XMD) based
21829 software intrusive debug agent called xmdstub. This uses startup file
21830 @file{crt1.o} and sets the start address of the program to 0x800.
21831
21832 @item bootstrap
21833 for applications that are loaded using a bootloader.
21834 This model uses startup file @file{crt2.o} which does not contain a processor
21835 reset vector handler. This is suitable for transferring control on a
21836 processor reset to the bootloader rather than the application.
21837
21838 @item novectors
21839 for applications that do not require any of the
21840 MicroBlaze vectors. This option may be useful for applications running
21841 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21842 @end table
21843
21844 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21845 @option{-mxl-mode-@var{app-model}}.
21846
21847 @end table
21848
21849 @node MIPS Options
21850 @subsection MIPS Options
21851 @cindex MIPS options
21852
21853 @table @gcctabopt
21854
21855 @item -EB
21856 @opindex EB
21857 Generate big-endian code.
21858
21859 @item -EL
21860 @opindex EL
21861 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21862 configurations.
21863
21864 @item -march=@var{arch}
21865 @opindex march
21866 Generate code that runs on @var{arch}, which can be the name of a
21867 generic MIPS ISA, or the name of a particular processor.
21868 The ISA names are:
21869 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21870 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21871 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21872 @samp{mips64r5} and @samp{mips64r6}.
21873 The processor names are:
21874 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21875 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21876 @samp{5kc}, @samp{5kf},
21877 @samp{20kc},
21878 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21879 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21880 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21881 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21882 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21883 @samp{i6400}, @samp{i6500},
21884 @samp{interaptiv},
21885 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21886 @samp{gs464e}, @samp{gs264e},
21887 @samp{m4k},
21888 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21889 @samp{m5100}, @samp{m5101},
21890 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21891 @samp{orion},
21892 @samp{p5600}, @samp{p6600},
21893 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21894 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21895 @samp{r6000}, @samp{r8000},
21896 @samp{rm7000}, @samp{rm9000},
21897 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21898 @samp{sb1},
21899 @samp{sr71000},
21900 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21901 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21902 @samp{xlr} and @samp{xlp}.
21903 The special value @samp{from-abi} selects the
21904 most compatible architecture for the selected ABI (that is,
21905 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21906
21907 The native Linux/GNU toolchain also supports the value @samp{native},
21908 which selects the best architecture option for the host processor.
21909 @option{-march=native} has no effect if GCC does not recognize
21910 the processor.
21911
21912 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21913 (for example, @option{-march=r2k}). Prefixes are optional, and
21914 @samp{vr} may be written @samp{r}.
21915
21916 Names of the form @samp{@var{n}f2_1} refer to processors with
21917 FPUs clocked at half the rate of the core, names of the form
21918 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21919 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21920 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21921 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21922 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21923 accepted as synonyms for @samp{@var{n}f1_1}.
21924
21925 GCC defines two macros based on the value of this option. The first
21926 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21927 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21928 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21929 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21930 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21931
21932 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21933 above. In other words, it has the full prefix and does not
21934 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21935 the macro names the resolved architecture (either @code{"mips1"} or
21936 @code{"mips3"}). It names the default architecture when no
21937 @option{-march} option is given.
21938
21939 @item -mtune=@var{arch}
21940 @opindex mtune
21941 Optimize for @var{arch}. Among other things, this option controls
21942 the way instructions are scheduled, and the perceived cost of arithmetic
21943 operations. The list of @var{arch} values is the same as for
21944 @option{-march}.
21945
21946 When this option is not used, GCC optimizes for the processor
21947 specified by @option{-march}. By using @option{-march} and
21948 @option{-mtune} together, it is possible to generate code that
21949 runs on a family of processors, but optimize the code for one
21950 particular member of that family.
21951
21952 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21953 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21954 @option{-march} ones described above.
21955
21956 @item -mips1
21957 @opindex mips1
21958 Equivalent to @option{-march=mips1}.
21959
21960 @item -mips2
21961 @opindex mips2
21962 Equivalent to @option{-march=mips2}.
21963
21964 @item -mips3
21965 @opindex mips3
21966 Equivalent to @option{-march=mips3}.
21967
21968 @item -mips4
21969 @opindex mips4
21970 Equivalent to @option{-march=mips4}.
21971
21972 @item -mips32
21973 @opindex mips32
21974 Equivalent to @option{-march=mips32}.
21975
21976 @item -mips32r3
21977 @opindex mips32r3
21978 Equivalent to @option{-march=mips32r3}.
21979
21980 @item -mips32r5
21981 @opindex mips32r5
21982 Equivalent to @option{-march=mips32r5}.
21983
21984 @item -mips32r6
21985 @opindex mips32r6
21986 Equivalent to @option{-march=mips32r6}.
21987
21988 @item -mips64
21989 @opindex mips64
21990 Equivalent to @option{-march=mips64}.
21991
21992 @item -mips64r2
21993 @opindex mips64r2
21994 Equivalent to @option{-march=mips64r2}.
21995
21996 @item -mips64r3
21997 @opindex mips64r3
21998 Equivalent to @option{-march=mips64r3}.
21999
22000 @item -mips64r5
22001 @opindex mips64r5
22002 Equivalent to @option{-march=mips64r5}.
22003
22004 @item -mips64r6
22005 @opindex mips64r6
22006 Equivalent to @option{-march=mips64r6}.
22007
22008 @item -mips16
22009 @itemx -mno-mips16
22010 @opindex mips16
22011 @opindex mno-mips16
22012 Generate (do not generate) MIPS16 code. If GCC is targeting a
22013 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
22014
22015 MIPS16 code generation can also be controlled on a per-function basis
22016 by means of @code{mips16} and @code{nomips16} attributes.
22017 @xref{Function Attributes}, for more information.
22018
22019 @item -mflip-mips16
22020 @opindex mflip-mips16
22021 Generate MIPS16 code on alternating functions. This option is provided
22022 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
22023 not intended for ordinary use in compiling user code.
22024
22025 @item -minterlink-compressed
22026 @itemx -mno-interlink-compressed
22027 @opindex minterlink-compressed
22028 @opindex mno-interlink-compressed
22029 Require (do not require) that code using the standard (uncompressed) MIPS ISA
22030 be link-compatible with MIPS16 and microMIPS code, and vice versa.
22031
22032 For example, code using the standard ISA encoding cannot jump directly
22033 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
22034 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
22035 knows that the target of the jump is not compressed.
22036
22037 @item -minterlink-mips16
22038 @itemx -mno-interlink-mips16
22039 @opindex minterlink-mips16
22040 @opindex mno-interlink-mips16
22041 Aliases of @option{-minterlink-compressed} and
22042 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
22043 and are retained for backwards compatibility.
22044
22045 @item -mabi=32
22046 @itemx -mabi=o64
22047 @itemx -mabi=n32
22048 @itemx -mabi=64
22049 @itemx -mabi=eabi
22050 @opindex mabi=32
22051 @opindex mabi=o64
22052 @opindex mabi=n32
22053 @opindex mabi=64
22054 @opindex mabi=eabi
22055 Generate code for the given ABI@.
22056
22057 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
22058 generates 64-bit code when you select a 64-bit architecture, but you
22059 can use @option{-mgp32} to get 32-bit code instead.
22060
22061 For information about the O64 ABI, see
22062 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
22063
22064 GCC supports a variant of the o32 ABI in which floating-point registers
22065 are 64 rather than 32 bits wide. You can select this combination with
22066 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
22067 and @code{mfhc1} instructions and is therefore only supported for
22068 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
22069
22070 The register assignments for arguments and return values remain the
22071 same, but each scalar value is passed in a single 64-bit register
22072 rather than a pair of 32-bit registers. For example, scalar
22073 floating-point values are returned in @samp{$f0} only, not a
22074 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
22075 remains the same in that the even-numbered double-precision registers
22076 are saved.
22077
22078 Two additional variants of the o32 ABI are supported to enable
22079 a transition from 32-bit to 64-bit registers. These are FPXX
22080 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
22081 The FPXX extension mandates that all code must execute correctly
22082 when run using 32-bit or 64-bit registers. The code can be interlinked
22083 with either FP32 or FP64, but not both.
22084 The FP64A extension is similar to the FP64 extension but forbids the
22085 use of odd-numbered single-precision registers. This can be used
22086 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
22087 processors and allows both FP32 and FP64A code to interlink and
22088 run in the same process without changing FPU modes.
22089
22090 @item -mabicalls
22091 @itemx -mno-abicalls
22092 @opindex mabicalls
22093 @opindex mno-abicalls
22094 Generate (do not generate) code that is suitable for SVR4-style
22095 dynamic objects. @option{-mabicalls} is the default for SVR4-based
22096 systems.
22097
22098 @item -mshared
22099 @itemx -mno-shared
22100 Generate (do not generate) code that is fully position-independent,
22101 and that can therefore be linked into shared libraries. This option
22102 only affects @option{-mabicalls}.
22103
22104 All @option{-mabicalls} code has traditionally been position-independent,
22105 regardless of options like @option{-fPIC} and @option{-fpic}. However,
22106 as an extension, the GNU toolchain allows executables to use absolute
22107 accesses for locally-binding symbols. It can also use shorter GP
22108 initialization sequences and generate direct calls to locally-defined
22109 functions. This mode is selected by @option{-mno-shared}.
22110
22111 @option{-mno-shared} depends on binutils 2.16 or higher and generates
22112 objects that can only be linked by the GNU linker. However, the option
22113 does not affect the ABI of the final executable; it only affects the ABI
22114 of relocatable objects. Using @option{-mno-shared} generally makes
22115 executables both smaller and quicker.
22116
22117 @option{-mshared} is the default.
22118
22119 @item -mplt
22120 @itemx -mno-plt
22121 @opindex mplt
22122 @opindex mno-plt
22123 Assume (do not assume) that the static and dynamic linkers
22124 support PLTs and copy relocations. This option only affects
22125 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
22126 has no effect without @option{-msym32}.
22127
22128 You can make @option{-mplt} the default by configuring
22129 GCC with @option{--with-mips-plt}. The default is
22130 @option{-mno-plt} otherwise.
22131
22132 @item -mxgot
22133 @itemx -mno-xgot
22134 @opindex mxgot
22135 @opindex mno-xgot
22136 Lift (do not lift) the usual restrictions on the size of the global
22137 offset table.
22138
22139 GCC normally uses a single instruction to load values from the GOT@.
22140 While this is relatively efficient, it only works if the GOT
22141 is smaller than about 64k. Anything larger causes the linker
22142 to report an error such as:
22143
22144 @cindex relocation truncated to fit (MIPS)
22145 @smallexample
22146 relocation truncated to fit: R_MIPS_GOT16 foobar
22147 @end smallexample
22148
22149 If this happens, you should recompile your code with @option{-mxgot}.
22150 This works with very large GOTs, although the code is also
22151 less efficient, since it takes three instructions to fetch the
22152 value of a global symbol.
22153
22154 Note that some linkers can create multiple GOTs. If you have such a
22155 linker, you should only need to use @option{-mxgot} when a single object
22156 file accesses more than 64k's worth of GOT entries. Very few do.
22157
22158 These options have no effect unless GCC is generating position
22159 independent code.
22160
22161 @item -mgp32
22162 @opindex mgp32
22163 Assume that general-purpose registers are 32 bits wide.
22164
22165 @item -mgp64
22166 @opindex mgp64
22167 Assume that general-purpose registers are 64 bits wide.
22168
22169 @item -mfp32
22170 @opindex mfp32
22171 Assume that floating-point registers are 32 bits wide.
22172
22173 @item -mfp64
22174 @opindex mfp64
22175 Assume that floating-point registers are 64 bits wide.
22176
22177 @item -mfpxx
22178 @opindex mfpxx
22179 Do not assume the width of floating-point registers.
22180
22181 @item -mhard-float
22182 @opindex mhard-float
22183 Use floating-point coprocessor instructions.
22184
22185 @item -msoft-float
22186 @opindex msoft-float
22187 Do not use floating-point coprocessor instructions. Implement
22188 floating-point calculations using library calls instead.
22189
22190 @item -mno-float
22191 @opindex mno-float
22192 Equivalent to @option{-msoft-float}, but additionally asserts that the
22193 program being compiled does not perform any floating-point operations.
22194 This option is presently supported only by some bare-metal MIPS
22195 configurations, where it may select a special set of libraries
22196 that lack all floating-point support (including, for example, the
22197 floating-point @code{printf} formats).
22198 If code compiled with @option{-mno-float} accidentally contains
22199 floating-point operations, it is likely to suffer a link-time
22200 or run-time failure.
22201
22202 @item -msingle-float
22203 @opindex msingle-float
22204 Assume that the floating-point coprocessor only supports single-precision
22205 operations.
22206
22207 @item -mdouble-float
22208 @opindex mdouble-float
22209 Assume that the floating-point coprocessor supports double-precision
22210 operations. This is the default.
22211
22212 @item -modd-spreg
22213 @itemx -mno-odd-spreg
22214 @opindex modd-spreg
22215 @opindex mno-odd-spreg
22216 Enable the use of odd-numbered single-precision floating-point registers
22217 for the o32 ABI. This is the default for processors that are known to
22218 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22219 is set by default.
22220
22221 @item -mabs=2008
22222 @itemx -mabs=legacy
22223 @opindex mabs=2008
22224 @opindex mabs=legacy
22225 These options control the treatment of the special not-a-number (NaN)
22226 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22227 @code{neg.@i{fmt}} machine instructions.
22228
22229 By default or when @option{-mabs=legacy} is used the legacy
22230 treatment is selected. In this case these instructions are considered
22231 arithmetic and avoided where correct operation is required and the
22232 input operand might be a NaN. A longer sequence of instructions that
22233 manipulate the sign bit of floating-point datum manually is used
22234 instead unless the @option{-ffinite-math-only} option has also been
22235 specified.
22236
22237 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22238 this case these instructions are considered non-arithmetic and therefore
22239 operating correctly in all cases, including in particular where the
22240 input operand is a NaN. These instructions are therefore always used
22241 for the respective operations.
22242
22243 @item -mnan=2008
22244 @itemx -mnan=legacy
22245 @opindex mnan=2008
22246 @opindex mnan=legacy
22247 These options control the encoding of the special not-a-number (NaN)
22248 IEEE 754 floating-point data.
22249
22250 The @option{-mnan=legacy} option selects the legacy encoding. In this
22251 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22252 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22253 by the first bit of their trailing significand field being 1.
22254
22255 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22256 this case qNaNs are denoted by the first bit of their trailing
22257 significand field being 1, whereas sNaNs are denoted by the first bit of
22258 their trailing significand field being 0.
22259
22260 The default is @option{-mnan=legacy} unless GCC has been configured with
22261 @option{--with-nan=2008}.
22262
22263 @item -mllsc
22264 @itemx -mno-llsc
22265 @opindex mllsc
22266 @opindex mno-llsc
22267 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22268 implement atomic memory built-in functions. When neither option is
22269 specified, GCC uses the instructions if the target architecture
22270 supports them.
22271
22272 @option{-mllsc} is useful if the runtime environment can emulate the
22273 instructions and @option{-mno-llsc} can be useful when compiling for
22274 nonstandard ISAs. You can make either option the default by
22275 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22276 respectively. @option{--with-llsc} is the default for some
22277 configurations; see the installation documentation for details.
22278
22279 @item -mdsp
22280 @itemx -mno-dsp
22281 @opindex mdsp
22282 @opindex mno-dsp
22283 Use (do not use) revision 1 of the MIPS DSP ASE@.
22284 @xref{MIPS DSP Built-in Functions}. This option defines the
22285 preprocessor macro @code{__mips_dsp}. It also defines
22286 @code{__mips_dsp_rev} to 1.
22287
22288 @item -mdspr2
22289 @itemx -mno-dspr2
22290 @opindex mdspr2
22291 @opindex mno-dspr2
22292 Use (do not use) revision 2 of the MIPS DSP ASE@.
22293 @xref{MIPS DSP Built-in Functions}. This option defines the
22294 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22295 It also defines @code{__mips_dsp_rev} to 2.
22296
22297 @item -msmartmips
22298 @itemx -mno-smartmips
22299 @opindex msmartmips
22300 @opindex mno-smartmips
22301 Use (do not use) the MIPS SmartMIPS ASE.
22302
22303 @item -mpaired-single
22304 @itemx -mno-paired-single
22305 @opindex mpaired-single
22306 @opindex mno-paired-single
22307 Use (do not use) paired-single floating-point instructions.
22308 @xref{MIPS Paired-Single Support}. This option requires
22309 hardware floating-point support to be enabled.
22310
22311 @item -mdmx
22312 @itemx -mno-mdmx
22313 @opindex mdmx
22314 @opindex mno-mdmx
22315 Use (do not use) MIPS Digital Media Extension instructions.
22316 This option can only be used when generating 64-bit code and requires
22317 hardware floating-point support to be enabled.
22318
22319 @item -mips3d
22320 @itemx -mno-mips3d
22321 @opindex mips3d
22322 @opindex mno-mips3d
22323 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22324 The option @option{-mips3d} implies @option{-mpaired-single}.
22325
22326 @item -mmicromips
22327 @itemx -mno-micromips
22328 @opindex mmicromips
22329 @opindex mno-mmicromips
22330 Generate (do not generate) microMIPS code.
22331
22332 MicroMIPS code generation can also be controlled on a per-function basis
22333 by means of @code{micromips} and @code{nomicromips} attributes.
22334 @xref{Function Attributes}, for more information.
22335
22336 @item -mmt
22337 @itemx -mno-mt
22338 @opindex mmt
22339 @opindex mno-mt
22340 Use (do not use) MT Multithreading instructions.
22341
22342 @item -mmcu
22343 @itemx -mno-mcu
22344 @opindex mmcu
22345 @opindex mno-mcu
22346 Use (do not use) the MIPS MCU ASE instructions.
22347
22348 @item -meva
22349 @itemx -mno-eva
22350 @opindex meva
22351 @opindex mno-eva
22352 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22353
22354 @item -mvirt
22355 @itemx -mno-virt
22356 @opindex mvirt
22357 @opindex mno-virt
22358 Use (do not use) the MIPS Virtualization (VZ) instructions.
22359
22360 @item -mxpa
22361 @itemx -mno-xpa
22362 @opindex mxpa
22363 @opindex mno-xpa
22364 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22365
22366 @item -mcrc
22367 @itemx -mno-crc
22368 @opindex mcrc
22369 @opindex mno-crc
22370 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22371
22372 @item -mginv
22373 @itemx -mno-ginv
22374 @opindex mginv
22375 @opindex mno-ginv
22376 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22377
22378 @item -mloongson-mmi
22379 @itemx -mno-loongson-mmi
22380 @opindex mloongson-mmi
22381 @opindex mno-loongson-mmi
22382 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22383
22384 @item -mloongson-ext
22385 @itemx -mno-loongson-ext
22386 @opindex mloongson-ext
22387 @opindex mno-loongson-ext
22388 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22389
22390 @item -mloongson-ext2
22391 @itemx -mno-loongson-ext2
22392 @opindex mloongson-ext2
22393 @opindex mno-loongson-ext2
22394 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22395
22396 @item -mlong64
22397 @opindex mlong64
22398 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22399 an explanation of the default and the way that the pointer size is
22400 determined.
22401
22402 @item -mlong32
22403 @opindex mlong32
22404 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22405
22406 The default size of @code{int}s, @code{long}s and pointers depends on
22407 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22408 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22409 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22410 or the same size as integer registers, whichever is smaller.
22411
22412 @item -msym32
22413 @itemx -mno-sym32
22414 @opindex msym32
22415 @opindex mno-sym32
22416 Assume (do not assume) that all symbols have 32-bit values, regardless
22417 of the selected ABI@. This option is useful in combination with
22418 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22419 to generate shorter and faster references to symbolic addresses.
22420
22421 @item -G @var{num}
22422 @opindex G
22423 Put definitions of externally-visible data in a small data section
22424 if that data is no bigger than @var{num} bytes. GCC can then generate
22425 more efficient accesses to the data; see @option{-mgpopt} for details.
22426
22427 The default @option{-G} option depends on the configuration.
22428
22429 @item -mlocal-sdata
22430 @itemx -mno-local-sdata
22431 @opindex mlocal-sdata
22432 @opindex mno-local-sdata
22433 Extend (do not extend) the @option{-G} behavior to local data too,
22434 such as to static variables in C@. @option{-mlocal-sdata} is the
22435 default for all configurations.
22436
22437 If the linker complains that an application is using too much small data,
22438 you might want to try rebuilding the less performance-critical parts with
22439 @option{-mno-local-sdata}. You might also want to build large
22440 libraries with @option{-mno-local-sdata}, so that the libraries leave
22441 more room for the main program.
22442
22443 @item -mextern-sdata
22444 @itemx -mno-extern-sdata
22445 @opindex mextern-sdata
22446 @opindex mno-extern-sdata
22447 Assume (do not assume) that externally-defined data is in
22448 a small data section if the size of that data is within the @option{-G} limit.
22449 @option{-mextern-sdata} is the default for all configurations.
22450
22451 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22452 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22453 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22454 is placed in a small data section. If @var{Var} is defined by another
22455 module, you must either compile that module with a high-enough
22456 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22457 definition. If @var{Var} is common, you must link the application
22458 with a high-enough @option{-G} setting.
22459
22460 The easiest way of satisfying these restrictions is to compile
22461 and link every module with the same @option{-G} option. However,
22462 you may wish to build a library that supports several different
22463 small data limits. You can do this by compiling the library with
22464 the highest supported @option{-G} setting and additionally using
22465 @option{-mno-extern-sdata} to stop the library from making assumptions
22466 about externally-defined data.
22467
22468 @item -mgpopt
22469 @itemx -mno-gpopt
22470 @opindex mgpopt
22471 @opindex mno-gpopt
22472 Use (do not use) GP-relative accesses for symbols that are known to be
22473 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22474 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22475 configurations.
22476
22477 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22478 might not hold the value of @code{_gp}. For example, if the code is
22479 part of a library that might be used in a boot monitor, programs that
22480 call boot monitor routines pass an unknown value in @code{$gp}.
22481 (In such situations, the boot monitor itself is usually compiled
22482 with @option{-G0}.)
22483
22484 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22485 @option{-mno-extern-sdata}.
22486
22487 @item -membedded-data
22488 @itemx -mno-embedded-data
22489 @opindex membedded-data
22490 @opindex mno-embedded-data
22491 Allocate variables to the read-only data section first if possible, then
22492 next in the small data section if possible, otherwise in data. This gives
22493 slightly slower code than the default, but reduces the amount of RAM required
22494 when executing, and thus may be preferred for some embedded systems.
22495
22496 @item -muninit-const-in-rodata
22497 @itemx -mno-uninit-const-in-rodata
22498 @opindex muninit-const-in-rodata
22499 @opindex mno-uninit-const-in-rodata
22500 Put uninitialized @code{const} variables in the read-only data section.
22501 This option is only meaningful in conjunction with @option{-membedded-data}.
22502
22503 @item -mcode-readable=@var{setting}
22504 @opindex mcode-readable
22505 Specify whether GCC may generate code that reads from executable sections.
22506 There are three possible settings:
22507
22508 @table @gcctabopt
22509 @item -mcode-readable=yes
22510 Instructions may freely access executable sections. This is the
22511 default setting.
22512
22513 @item -mcode-readable=pcrel
22514 MIPS16 PC-relative load instructions can access executable sections,
22515 but other instructions must not do so. This option is useful on 4KSc
22516 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22517 It is also useful on processors that can be configured to have a dual
22518 instruction/data SRAM interface and that, like the M4K, automatically
22519 redirect PC-relative loads to the instruction RAM.
22520
22521 @item -mcode-readable=no
22522 Instructions must not access executable sections. This option can be
22523 useful on targets that are configured to have a dual instruction/data
22524 SRAM interface but that (unlike the M4K) do not automatically redirect
22525 PC-relative loads to the instruction RAM.
22526 @end table
22527
22528 @item -msplit-addresses
22529 @itemx -mno-split-addresses
22530 @opindex msplit-addresses
22531 @opindex mno-split-addresses
22532 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22533 relocation operators. This option has been superseded by
22534 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22535
22536 @item -mexplicit-relocs
22537 @itemx -mno-explicit-relocs
22538 @opindex mexplicit-relocs
22539 @opindex mno-explicit-relocs
22540 Use (do not use) assembler relocation operators when dealing with symbolic
22541 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22542 is to use assembler macros instead.
22543
22544 @option{-mexplicit-relocs} is the default if GCC was configured
22545 to use an assembler that supports relocation operators.
22546
22547 @item -mcheck-zero-division
22548 @itemx -mno-check-zero-division
22549 @opindex mcheck-zero-division
22550 @opindex mno-check-zero-division
22551 Trap (do not trap) on integer division by zero.
22552
22553 The default is @option{-mcheck-zero-division}.
22554
22555 @item -mdivide-traps
22556 @itemx -mdivide-breaks
22557 @opindex mdivide-traps
22558 @opindex mdivide-breaks
22559 MIPS systems check for division by zero by generating either a
22560 conditional trap or a break instruction. Using traps results in
22561 smaller code, but is only supported on MIPS II and later. Also, some
22562 versions of the Linux kernel have a bug that prevents trap from
22563 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22564 allow conditional traps on architectures that support them and
22565 @option{-mdivide-breaks} to force the use of breaks.
22566
22567 The default is usually @option{-mdivide-traps}, but this can be
22568 overridden at configure time using @option{--with-divide=breaks}.
22569 Divide-by-zero checks can be completely disabled using
22570 @option{-mno-check-zero-division}.
22571
22572 @item -mload-store-pairs
22573 @itemx -mno-load-store-pairs
22574 @opindex mload-store-pairs
22575 @opindex mno-load-store-pairs
22576 Enable (disable) an optimization that pairs consecutive load or store
22577 instructions to enable load/store bonding. This option is enabled by
22578 default but only takes effect when the selected architecture is known
22579 to support bonding.
22580
22581 @item -mmemcpy
22582 @itemx -mno-memcpy
22583 @opindex mmemcpy
22584 @opindex mno-memcpy
22585 Force (do not force) the use of @code{memcpy} for non-trivial block
22586 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22587 most constant-sized copies.
22588
22589 @item -mlong-calls
22590 @itemx -mno-long-calls
22591 @opindex mlong-calls
22592 @opindex mno-long-calls
22593 Disable (do not disable) use of the @code{jal} instruction. Calling
22594 functions using @code{jal} is more efficient but requires the caller
22595 and callee to be in the same 256 megabyte segment.
22596
22597 This option has no effect on abicalls code. The default is
22598 @option{-mno-long-calls}.
22599
22600 @item -mmad
22601 @itemx -mno-mad
22602 @opindex mmad
22603 @opindex mno-mad
22604 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22605 instructions, as provided by the R4650 ISA@.
22606
22607 @item -mimadd
22608 @itemx -mno-imadd
22609 @opindex mimadd
22610 @opindex mno-imadd
22611 Enable (disable) use of the @code{madd} and @code{msub} integer
22612 instructions. The default is @option{-mimadd} on architectures
22613 that support @code{madd} and @code{msub} except for the 74k
22614 architecture where it was found to generate slower code.
22615
22616 @item -mfused-madd
22617 @itemx -mno-fused-madd
22618 @opindex mfused-madd
22619 @opindex mno-fused-madd
22620 Enable (disable) use of the floating-point multiply-accumulate
22621 instructions, when they are available. The default is
22622 @option{-mfused-madd}.
22623
22624 On the R8000 CPU when multiply-accumulate instructions are used,
22625 the intermediate product is calculated to infinite precision
22626 and is not subject to the FCSR Flush to Zero bit. This may be
22627 undesirable in some circumstances. On other processors the result
22628 is numerically identical to the equivalent computation using
22629 separate multiply, add, subtract and negate instructions.
22630
22631 @item -nocpp
22632 @opindex nocpp
22633 Tell the MIPS assembler to not run its preprocessor over user
22634 assembler files (with a @samp{.s} suffix) when assembling them.
22635
22636 @item -mfix-24k
22637 @itemx -mno-fix-24k
22638 @opindex mfix-24k
22639 @opindex mno-fix-24k
22640 Work around the 24K E48 (lost data on stores during refill) errata.
22641 The workarounds are implemented by the assembler rather than by GCC@.
22642
22643 @item -mfix-r4000
22644 @itemx -mno-fix-r4000
22645 @opindex mfix-r4000
22646 @opindex mno-fix-r4000
22647 Work around certain R4000 CPU errata:
22648 @itemize @minus
22649 @item
22650 A double-word or a variable shift may give an incorrect result if executed
22651 immediately after starting an integer division.
22652 @item
22653 A double-word or a variable shift may give an incorrect result if executed
22654 while an integer multiplication is in progress.
22655 @item
22656 An integer division may give an incorrect result if started in a delay slot
22657 of a taken branch or a jump.
22658 @end itemize
22659
22660 @item -mfix-r4400
22661 @itemx -mno-fix-r4400
22662 @opindex mfix-r4400
22663 @opindex mno-fix-r4400
22664 Work around certain R4400 CPU errata:
22665 @itemize @minus
22666 @item
22667 A double-word or a variable shift may give an incorrect result if executed
22668 immediately after starting an integer division.
22669 @end itemize
22670
22671 @item -mfix-r10000
22672 @itemx -mno-fix-r10000
22673 @opindex mfix-r10000
22674 @opindex mno-fix-r10000
22675 Work around certain R10000 errata:
22676 @itemize @minus
22677 @item
22678 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22679 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22680 @end itemize
22681
22682 This option can only be used if the target architecture supports
22683 branch-likely instructions. @option{-mfix-r10000} is the default when
22684 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22685 otherwise.
22686
22687 @item -mfix-r5900
22688 @itemx -mno-fix-r5900
22689 @opindex mfix-r5900
22690 Do not attempt to schedule the preceding instruction into the delay slot
22691 of a branch instruction placed at the end of a short loop of six
22692 instructions or fewer and always schedule a @code{nop} instruction there
22693 instead. The short loop bug under certain conditions causes loops to
22694 execute only once or twice, due to a hardware bug in the R5900 chip. The
22695 workaround is implemented by the assembler rather than by GCC@.
22696
22697 @item -mfix-rm7000
22698 @itemx -mno-fix-rm7000
22699 @opindex mfix-rm7000
22700 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22701 workarounds are implemented by the assembler rather than by GCC@.
22702
22703 @item -mfix-vr4120
22704 @itemx -mno-fix-vr4120
22705 @opindex mfix-vr4120
22706 Work around certain VR4120 errata:
22707 @itemize @minus
22708 @item
22709 @code{dmultu} does not always produce the correct result.
22710 @item
22711 @code{div} and @code{ddiv} do not always produce the correct result if one
22712 of the operands is negative.
22713 @end itemize
22714 The workarounds for the division errata rely on special functions in
22715 @file{libgcc.a}. At present, these functions are only provided by
22716 the @code{mips64vr*-elf} configurations.
22717
22718 Other VR4120 errata require a NOP to be inserted between certain pairs of
22719 instructions. These errata are handled by the assembler, not by GCC itself.
22720
22721 @item -mfix-vr4130
22722 @opindex mfix-vr4130
22723 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22724 workarounds are implemented by the assembler rather than by GCC,
22725 although GCC avoids using @code{mflo} and @code{mfhi} if the
22726 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22727 instructions are available instead.
22728
22729 @item -mfix-sb1
22730 @itemx -mno-fix-sb1
22731 @opindex mfix-sb1
22732 Work around certain SB-1 CPU core errata.
22733 (This flag currently works around the SB-1 revision 2
22734 ``F1'' and ``F2'' floating-point errata.)
22735
22736 @item -mr10k-cache-barrier=@var{setting}
22737 @opindex mr10k-cache-barrier
22738 Specify whether GCC should insert cache barriers to avoid the
22739 side effects of speculation on R10K processors.
22740
22741 In common with many processors, the R10K tries to predict the outcome
22742 of a conditional branch and speculatively executes instructions from
22743 the ``taken'' branch. It later aborts these instructions if the
22744 predicted outcome is wrong. However, on the R10K, even aborted
22745 instructions can have side effects.
22746
22747 This problem only affects kernel stores and, depending on the system,
22748 kernel loads. As an example, a speculatively-executed store may load
22749 the target memory into cache and mark the cache line as dirty, even if
22750 the store itself is later aborted. If a DMA operation writes to the
22751 same area of memory before the ``dirty'' line is flushed, the cached
22752 data overwrites the DMA-ed data. See the R10K processor manual
22753 for a full description, including other potential problems.
22754
22755 One workaround is to insert cache barrier instructions before every memory
22756 access that might be speculatively executed and that might have side
22757 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22758 controls GCC's implementation of this workaround. It assumes that
22759 aborted accesses to any byte in the following regions does not have
22760 side effects:
22761
22762 @enumerate
22763 @item
22764 the memory occupied by the current function's stack frame;
22765
22766 @item
22767 the memory occupied by an incoming stack argument;
22768
22769 @item
22770 the memory occupied by an object with a link-time-constant address.
22771 @end enumerate
22772
22773 It is the kernel's responsibility to ensure that speculative
22774 accesses to these regions are indeed safe.
22775
22776 If the input program contains a function declaration such as:
22777
22778 @smallexample
22779 void foo (void);
22780 @end smallexample
22781
22782 then the implementation of @code{foo} must allow @code{j foo} and
22783 @code{jal foo} to be executed speculatively. GCC honors this
22784 restriction for functions it compiles itself. It expects non-GCC
22785 functions (such as hand-written assembly code) to do the same.
22786
22787 The option has three forms:
22788
22789 @table @gcctabopt
22790 @item -mr10k-cache-barrier=load-store
22791 Insert a cache barrier before a load or store that might be
22792 speculatively executed and that might have side effects even
22793 if aborted.
22794
22795 @item -mr10k-cache-barrier=store
22796 Insert a cache barrier before a store that might be speculatively
22797 executed and that might have side effects even if aborted.
22798
22799 @item -mr10k-cache-barrier=none
22800 Disable the insertion of cache barriers. This is the default setting.
22801 @end table
22802
22803 @item -mflush-func=@var{func}
22804 @itemx -mno-flush-func
22805 @opindex mflush-func
22806 Specifies the function to call to flush the I and D caches, or to not
22807 call any such function. If called, the function must take the same
22808 arguments as the common @code{_flush_func}, that is, the address of the
22809 memory range for which the cache is being flushed, the size of the
22810 memory range, and the number 3 (to flush both caches). The default
22811 depends on the target GCC was configured for, but commonly is either
22812 @code{_flush_func} or @code{__cpu_flush}.
22813
22814 @item mbranch-cost=@var{num}
22815 @opindex mbranch-cost
22816 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22817 This cost is only a heuristic and is not guaranteed to produce
22818 consistent results across releases. A zero cost redundantly selects
22819 the default, which is based on the @option{-mtune} setting.
22820
22821 @item -mbranch-likely
22822 @itemx -mno-branch-likely
22823 @opindex mbranch-likely
22824 @opindex mno-branch-likely
22825 Enable or disable use of Branch Likely instructions, regardless of the
22826 default for the selected architecture. By default, Branch Likely
22827 instructions may be generated if they are supported by the selected
22828 architecture. An exception is for the MIPS32 and MIPS64 architectures
22829 and processors that implement those architectures; for those, Branch
22830 Likely instructions are not be generated by default because the MIPS32
22831 and MIPS64 architectures specifically deprecate their use.
22832
22833 @item -mcompact-branches=never
22834 @itemx -mcompact-branches=optimal
22835 @itemx -mcompact-branches=always
22836 @opindex mcompact-branches=never
22837 @opindex mcompact-branches=optimal
22838 @opindex mcompact-branches=always
22839 These options control which form of branches will be generated. The
22840 default is @option{-mcompact-branches=optimal}.
22841
22842 The @option{-mcompact-branches=never} option ensures that compact branch
22843 instructions will never be generated.
22844
22845 The @option{-mcompact-branches=always} option ensures that a compact
22846 branch instruction will be generated if available. If a compact branch
22847 instruction is not available, a delay slot form of the branch will be
22848 used instead.
22849
22850 This option is supported from MIPS Release 6 onwards.
22851
22852 The @option{-mcompact-branches=optimal} option will cause a delay slot
22853 branch to be used if one is available in the current ISA and the delay
22854 slot is successfully filled. If the delay slot is not filled, a compact
22855 branch will be chosen if one is available.
22856
22857 @item -mfp-exceptions
22858 @itemx -mno-fp-exceptions
22859 @opindex mfp-exceptions
22860 Specifies whether FP exceptions are enabled. This affects how
22861 FP instructions are scheduled for some processors.
22862 The default is that FP exceptions are
22863 enabled.
22864
22865 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22866 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22867 FP pipe.
22868
22869 @item -mvr4130-align
22870 @itemx -mno-vr4130-align
22871 @opindex mvr4130-align
22872 The VR4130 pipeline is two-way superscalar, but can only issue two
22873 instructions together if the first one is 8-byte aligned. When this
22874 option is enabled, GCC aligns pairs of instructions that it
22875 thinks should execute in parallel.
22876
22877 This option only has an effect when optimizing for the VR4130.
22878 It normally makes code faster, but at the expense of making it bigger.
22879 It is enabled by default at optimization level @option{-O3}.
22880
22881 @item -msynci
22882 @itemx -mno-synci
22883 @opindex msynci
22884 Enable (disable) generation of @code{synci} instructions on
22885 architectures that support it. The @code{synci} instructions (if
22886 enabled) are generated when @code{__builtin___clear_cache} is
22887 compiled.
22888
22889 This option defaults to @option{-mno-synci}, but the default can be
22890 overridden by configuring GCC with @option{--with-synci}.
22891
22892 When compiling code for single processor systems, it is generally safe
22893 to use @code{synci}. However, on many multi-core (SMP) systems, it
22894 does not invalidate the instruction caches on all cores and may lead
22895 to undefined behavior.
22896
22897 @item -mrelax-pic-calls
22898 @itemx -mno-relax-pic-calls
22899 @opindex mrelax-pic-calls
22900 Try to turn PIC calls that are normally dispatched via register
22901 @code{$25} into direct calls. This is only possible if the linker can
22902 resolve the destination at link time and if the destination is within
22903 range for a direct call.
22904
22905 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22906 an assembler and a linker that support the @code{.reloc} assembly
22907 directive and @option{-mexplicit-relocs} is in effect. With
22908 @option{-mno-explicit-relocs}, this optimization can be performed by the
22909 assembler and the linker alone without help from the compiler.
22910
22911 @item -mmcount-ra-address
22912 @itemx -mno-mcount-ra-address
22913 @opindex mmcount-ra-address
22914 @opindex mno-mcount-ra-address
22915 Emit (do not emit) code that allows @code{_mcount} to modify the
22916 calling function's return address. When enabled, this option extends
22917 the usual @code{_mcount} interface with a new @var{ra-address}
22918 parameter, which has type @code{intptr_t *} and is passed in register
22919 @code{$12}. @code{_mcount} can then modify the return address by
22920 doing both of the following:
22921 @itemize
22922 @item
22923 Returning the new address in register @code{$31}.
22924 @item
22925 Storing the new address in @code{*@var{ra-address}},
22926 if @var{ra-address} is nonnull.
22927 @end itemize
22928
22929 The default is @option{-mno-mcount-ra-address}.
22930
22931 @item -mframe-header-opt
22932 @itemx -mno-frame-header-opt
22933 @opindex mframe-header-opt
22934 Enable (disable) frame header optimization in the o32 ABI. When using the
22935 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22936 function to write out register arguments. When enabled, this optimization
22937 will suppress the allocation of the frame header if it can be determined that
22938 it is unused.
22939
22940 This optimization is off by default at all optimization levels.
22941
22942 @item -mlxc1-sxc1
22943 @itemx -mno-lxc1-sxc1
22944 @opindex mlxc1-sxc1
22945 When applicable, enable (disable) the generation of @code{lwxc1},
22946 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22947
22948 @item -mmadd4
22949 @itemx -mno-madd4
22950 @opindex mmadd4
22951 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22952 @code{madd.d} and related instructions. Enabled by default.
22953
22954 @end table
22955
22956 @node MMIX Options
22957 @subsection MMIX Options
22958 @cindex MMIX Options
22959
22960 These options are defined for the MMIX:
22961
22962 @table @gcctabopt
22963 @item -mlibfuncs
22964 @itemx -mno-libfuncs
22965 @opindex mlibfuncs
22966 @opindex mno-libfuncs
22967 Specify that intrinsic library functions are being compiled, passing all
22968 values in registers, no matter the size.
22969
22970 @item -mepsilon
22971 @itemx -mno-epsilon
22972 @opindex mepsilon
22973 @opindex mno-epsilon
22974 Generate floating-point comparison instructions that compare with respect
22975 to the @code{rE} epsilon register.
22976
22977 @item -mabi=mmixware
22978 @itemx -mabi=gnu
22979 @opindex mabi=mmixware
22980 @opindex mabi=gnu
22981 Generate code that passes function parameters and return values that (in
22982 the called function) are seen as registers @code{$0} and up, as opposed to
22983 the GNU ABI which uses global registers @code{$231} and up.
22984
22985 @item -mzero-extend
22986 @itemx -mno-zero-extend
22987 @opindex mzero-extend
22988 @opindex mno-zero-extend
22989 When reading data from memory in sizes shorter than 64 bits, use (do not
22990 use) zero-extending load instructions by default, rather than
22991 sign-extending ones.
22992
22993 @item -mknuthdiv
22994 @itemx -mno-knuthdiv
22995 @opindex mknuthdiv
22996 @opindex mno-knuthdiv
22997 Make the result of a division yielding a remainder have the same sign as
22998 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22999 remainder follows the sign of the dividend. Both methods are
23000 arithmetically valid, the latter being almost exclusively used.
23001
23002 @item -mtoplevel-symbols
23003 @itemx -mno-toplevel-symbols
23004 @opindex mtoplevel-symbols
23005 @opindex mno-toplevel-symbols
23006 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
23007 code can be used with the @code{PREFIX} assembly directive.
23008
23009 @item -melf
23010 @opindex melf
23011 Generate an executable in the ELF format, rather than the default
23012 @samp{mmo} format used by the @command{mmix} simulator.
23013
23014 @item -mbranch-predict
23015 @itemx -mno-branch-predict
23016 @opindex mbranch-predict
23017 @opindex mno-branch-predict
23018 Use (do not use) the probable-branch instructions, when static branch
23019 prediction indicates a probable branch.
23020
23021 @item -mbase-addresses
23022 @itemx -mno-base-addresses
23023 @opindex mbase-addresses
23024 @opindex mno-base-addresses
23025 Generate (do not generate) code that uses @emph{base addresses}. Using a
23026 base address automatically generates a request (handled by the assembler
23027 and the linker) for a constant to be set up in a global register. The
23028 register is used for one or more base address requests within the range 0
23029 to 255 from the value held in the register. The generally leads to short
23030 and fast code, but the number of different data items that can be
23031 addressed is limited. This means that a program that uses lots of static
23032 data may require @option{-mno-base-addresses}.
23033
23034 @item -msingle-exit
23035 @itemx -mno-single-exit
23036 @opindex msingle-exit
23037 @opindex mno-single-exit
23038 Force (do not force) generated code to have a single exit point in each
23039 function.
23040 @end table
23041
23042 @node MN10300 Options
23043 @subsection MN10300 Options
23044 @cindex MN10300 options
23045
23046 These @option{-m} options are defined for Matsushita MN10300 architectures:
23047
23048 @table @gcctabopt
23049 @item -mmult-bug
23050 @opindex mmult-bug
23051 Generate code to avoid bugs in the multiply instructions for the MN10300
23052 processors. This is the default.
23053
23054 @item -mno-mult-bug
23055 @opindex mno-mult-bug
23056 Do not generate code to avoid bugs in the multiply instructions for the
23057 MN10300 processors.
23058
23059 @item -mam33
23060 @opindex mam33
23061 Generate code using features specific to the AM33 processor.
23062
23063 @item -mno-am33
23064 @opindex mno-am33
23065 Do not generate code using features specific to the AM33 processor. This
23066 is the default.
23067
23068 @item -mam33-2
23069 @opindex mam33-2
23070 Generate code using features specific to the AM33/2.0 processor.
23071
23072 @item -mam34
23073 @opindex mam34
23074 Generate code using features specific to the AM34 processor.
23075
23076 @item -mtune=@var{cpu-type}
23077 @opindex mtune
23078 Use the timing characteristics of the indicated CPU type when
23079 scheduling instructions. This does not change the targeted processor
23080 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
23081 @samp{am33-2} or @samp{am34}.
23082
23083 @item -mreturn-pointer-on-d0
23084 @opindex mreturn-pointer-on-d0
23085 When generating a function that returns a pointer, return the pointer
23086 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
23087 only in @code{a0}, and attempts to call such functions without a prototype
23088 result in errors. Note that this option is on by default; use
23089 @option{-mno-return-pointer-on-d0} to disable it.
23090
23091 @item -mno-crt0
23092 @opindex mno-crt0
23093 Do not link in the C run-time initialization object file.
23094
23095 @item -mrelax
23096 @opindex mrelax
23097 Indicate to the linker that it should perform a relaxation optimization pass
23098 to shorten branches, calls and absolute memory addresses. This option only
23099 has an effect when used on the command line for the final link step.
23100
23101 This option makes symbolic debugging impossible.
23102
23103 @item -mliw
23104 @opindex mliw
23105 Allow the compiler to generate @emph{Long Instruction Word}
23106 instructions if the target is the @samp{AM33} or later. This is the
23107 default. This option defines the preprocessor macro @code{__LIW__}.
23108
23109 @item -mno-liw
23110 @opindex mno-liw
23111 Do not allow the compiler to generate @emph{Long Instruction Word}
23112 instructions. This option defines the preprocessor macro
23113 @code{__NO_LIW__}.
23114
23115 @item -msetlb
23116 @opindex msetlb
23117 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
23118 instructions if the target is the @samp{AM33} or later. This is the
23119 default. This option defines the preprocessor macro @code{__SETLB__}.
23120
23121 @item -mno-setlb
23122 @opindex mno-setlb
23123 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
23124 instructions. This option defines the preprocessor macro
23125 @code{__NO_SETLB__}.
23126
23127 @end table
23128
23129 @node Moxie Options
23130 @subsection Moxie Options
23131 @cindex Moxie Options
23132
23133 @table @gcctabopt
23134
23135 @item -meb
23136 @opindex meb
23137 Generate big-endian code. This is the default for @samp{moxie-*-*}
23138 configurations.
23139
23140 @item -mel
23141 @opindex mel
23142 Generate little-endian code.
23143
23144 @item -mmul.x
23145 @opindex mmul.x
23146 Generate mul.x and umul.x instructions. This is the default for
23147 @samp{moxiebox-*-*} configurations.
23148
23149 @item -mno-crt0
23150 @opindex mno-crt0
23151 Do not link in the C run-time initialization object file.
23152
23153 @end table
23154
23155 @node MSP430 Options
23156 @subsection MSP430 Options
23157 @cindex MSP430 Options
23158
23159 These options are defined for the MSP430:
23160
23161 @table @gcctabopt
23162
23163 @item -masm-hex
23164 @opindex masm-hex
23165 Force assembly output to always use hex constants. Normally such
23166 constants are signed decimals, but this option is available for
23167 testsuite and/or aesthetic purposes.
23168
23169 @item -mmcu=
23170 @opindex mmcu=
23171 Select the MCU to target. This is used to create a C preprocessor
23172 symbol based upon the MCU name, converted to upper case and pre- and
23173 post-fixed with @samp{__}. This in turn is used by the
23174 @file{msp430.h} header file to select an MCU-specific supplementary
23175 header file.
23176
23177 The option also sets the ISA to use. If the MCU name is one that is
23178 known to only support the 430 ISA then that is selected, otherwise the
23179 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
23180 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
23181 name selects the 430X ISA.
23182
23183 In addition an MCU-specific linker script is added to the linker
23184 command line. The script's name is the name of the MCU with
23185 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
23186 command line defines the C preprocessor symbol @code{__XXX__} and
23187 cause the linker to search for a script called @file{xxx.ld}.
23188
23189 The ISA and hardware multiply supported for the different MCUs is hard-coded
23190 into GCC. However, an external @samp{devices.csv} file can be used to
23191 extend device support beyond those that have been hard-coded.
23192
23193 GCC searches for the @samp{devices.csv} file on the paths specified
23194 with the @code{-I} and @code{-L} options.
23195
23196 @item -mwarn-mcu
23197 @itemx -mno-warn-mcu
23198 @opindex mwarn-mcu
23199 @opindex mno-warn-mcu
23200 This option enables or disables warnings about conflicts between the
23201 MCU name specified by the @option{-mmcu} option and the ISA set by the
23202 @option{-mcpu} option and/or the hardware multiply support set by the
23203 @option{-mhwmult} option. It also toggles warnings about unrecognized
23204 MCU names. This option is on by default.
23205
23206 @item -mcpu=
23207 @opindex mcpu=
23208 Specifies the ISA to use. Accepted values are @samp{msp430},
23209 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
23210 @option{-mmcu=} option should be used to select the ISA.
23211
23212 @item -msim
23213 @opindex msim
23214 Link to the simulator runtime libraries and linker script. Overrides
23215 any scripts that would be selected by the @option{-mmcu=} option.
23216
23217 @item -mlarge
23218 @opindex mlarge
23219 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23220
23221 @item -msmall
23222 @opindex msmall
23223 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23224
23225 @item -mrelax
23226 @opindex mrelax
23227 This option is passed to the assembler and linker, and allows the
23228 linker to perform certain optimizations that cannot be done until
23229 the final link.
23230
23231 @item mhwmult=
23232 @opindex mhwmult=
23233 Describes the type of hardware multiply supported by the target.
23234 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23235 for the original 16-bit-only multiply supported by early MCUs.
23236 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23237 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23238 A value of @samp{auto} can also be given. This tells GCC to deduce
23239 the hardware multiply support based upon the MCU name provided by the
23240 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23241 the MCU name is not recognized then no hardware multiply support is
23242 assumed. @code{auto} is the default setting.
23243
23244 Hardware multiplies are normally performed by calling a library
23245 routine. This saves space in the generated code. When compiling at
23246 @option{-O3} or higher however the hardware multiplier is invoked
23247 inline. This makes for bigger, but faster code.
23248
23249 The hardware multiply routines disable interrupts whilst running and
23250 restore the previous interrupt state when they finish. This makes
23251 them safe to use inside interrupt handlers as well as in normal code.
23252
23253 @item -minrt
23254 @opindex minrt
23255 Enable the use of a minimum runtime environment - no static
23256 initializers or constructors. This is intended for memory-constrained
23257 devices. The compiler includes special symbols in some objects
23258 that tell the linker and runtime which code fragments are required.
23259
23260 @item -mcode-region=
23261 @itemx -mdata-region=
23262 @opindex mcode-region
23263 @opindex mdata-region
23264 These options tell the compiler where to place functions and data that
23265 do not have one of the @code{lower}, @code{upper}, @code{either} or
23266 @code{section} attributes. Possible values are @code{lower},
23267 @code{upper}, @code{either} or @code{any}. The first three behave
23268 like the corresponding attribute. The fourth possible value -
23269 @code{any} - is the default. It leaves placement entirely up to the
23270 linker script and how it assigns the standard sections
23271 (@code{.text}, @code{.data}, etc) to the memory regions.
23272
23273 @item -msilicon-errata=
23274 @opindex msilicon-errata
23275 This option passes on a request to assembler to enable the fixes for
23276 the named silicon errata.
23277
23278 @item -msilicon-errata-warn=
23279 @opindex msilicon-errata-warn
23280 This option passes on a request to the assembler to enable warning
23281 messages when a silicon errata might need to be applied.
23282
23283 @item -mwarn-devices-csv
23284 @itemx -mno-warn-devices-csv
23285 @opindex mwarn-devices-csv
23286 @opindex mno-warn-devices-csv
23287 Warn if @samp{devices.csv} is not found or there are problem parsing it
23288 (default: on).
23289
23290 @end table
23291
23292 @node NDS32 Options
23293 @subsection NDS32 Options
23294 @cindex NDS32 Options
23295
23296 These options are defined for NDS32 implementations:
23297
23298 @table @gcctabopt
23299
23300 @item -mbig-endian
23301 @opindex mbig-endian
23302 Generate code in big-endian mode.
23303
23304 @item -mlittle-endian
23305 @opindex mlittle-endian
23306 Generate code in little-endian mode.
23307
23308 @item -mreduced-regs
23309 @opindex mreduced-regs
23310 Use reduced-set registers for register allocation.
23311
23312 @item -mfull-regs
23313 @opindex mfull-regs
23314 Use full-set registers for register allocation.
23315
23316 @item -mcmov
23317 @opindex mcmov
23318 Generate conditional move instructions.
23319
23320 @item -mno-cmov
23321 @opindex mno-cmov
23322 Do not generate conditional move instructions.
23323
23324 @item -mext-perf
23325 @opindex mext-perf
23326 Generate performance extension instructions.
23327
23328 @item -mno-ext-perf
23329 @opindex mno-ext-perf
23330 Do not generate performance extension instructions.
23331
23332 @item -mext-perf2
23333 @opindex mext-perf2
23334 Generate performance extension 2 instructions.
23335
23336 @item -mno-ext-perf2
23337 @opindex mno-ext-perf2
23338 Do not generate performance extension 2 instructions.
23339
23340 @item -mext-string
23341 @opindex mext-string
23342 Generate string extension instructions.
23343
23344 @item -mno-ext-string
23345 @opindex mno-ext-string
23346 Do not generate string extension instructions.
23347
23348 @item -mv3push
23349 @opindex mv3push
23350 Generate v3 push25/pop25 instructions.
23351
23352 @item -mno-v3push
23353 @opindex mno-v3push
23354 Do not generate v3 push25/pop25 instructions.
23355
23356 @item -m16-bit
23357 @opindex m16-bit
23358 Generate 16-bit instructions.
23359
23360 @item -mno-16-bit
23361 @opindex mno-16-bit
23362 Do not generate 16-bit instructions.
23363
23364 @item -misr-vector-size=@var{num}
23365 @opindex misr-vector-size
23366 Specify the size of each interrupt vector, which must be 4 or 16.
23367
23368 @item -mcache-block-size=@var{num}
23369 @opindex mcache-block-size
23370 Specify the size of each cache block,
23371 which must be a power of 2 between 4 and 512.
23372
23373 @item -march=@var{arch}
23374 @opindex march
23375 Specify the name of the target architecture.
23376
23377 @item -mcmodel=@var{code-model}
23378 @opindex mcmodel
23379 Set the code model to one of
23380 @table @asis
23381 @item @samp{small}
23382 All the data and read-only data segments must be within 512KB addressing space.
23383 The text segment must be within 16MB addressing space.
23384 @item @samp{medium}
23385 The data segment must be within 512KB while the read-only data segment can be
23386 within 4GB addressing space. The text segment should be still within 16MB
23387 addressing space.
23388 @item @samp{large}
23389 All the text and data segments can be within 4GB addressing space.
23390 @end table
23391
23392 @item -mctor-dtor
23393 @opindex mctor-dtor
23394 Enable constructor/destructor feature.
23395
23396 @item -mrelax
23397 @opindex mrelax
23398 Guide linker to relax instructions.
23399
23400 @end table
23401
23402 @node Nios II Options
23403 @subsection Nios II Options
23404 @cindex Nios II options
23405 @cindex Altera Nios II options
23406
23407 These are the options defined for the Altera Nios II processor.
23408
23409 @table @gcctabopt
23410
23411 @item -G @var{num}
23412 @opindex G
23413 @cindex smaller data references
23414 Put global and static objects less than or equal to @var{num} bytes
23415 into the small data or BSS sections instead of the normal data or BSS
23416 sections. The default value of @var{num} is 8.
23417
23418 @item -mgpopt=@var{option}
23419 @itemx -mgpopt
23420 @itemx -mno-gpopt
23421 @opindex mgpopt
23422 @opindex mno-gpopt
23423 Generate (do not generate) GP-relative accesses. The following
23424 @var{option} names are recognized:
23425
23426 @table @samp
23427
23428 @item none
23429 Do not generate GP-relative accesses.
23430
23431 @item local
23432 Generate GP-relative accesses for small data objects that are not
23433 external, weak, or uninitialized common symbols.
23434 Also use GP-relative addressing for objects that
23435 have been explicitly placed in a small data section via a @code{section}
23436 attribute.
23437
23438 @item global
23439 As for @samp{local}, but also generate GP-relative accesses for
23440 small data objects that are external, weak, or common. If you use this option,
23441 you must ensure that all parts of your program (including libraries) are
23442 compiled with the same @option{-G} setting.
23443
23444 @item data
23445 Generate GP-relative accesses for all data objects in the program. If you
23446 use this option, the entire data and BSS segments
23447 of your program must fit in 64K of memory and you must use an appropriate
23448 linker script to allocate them within the addressable range of the
23449 global pointer.
23450
23451 @item all
23452 Generate GP-relative addresses for function pointers as well as data
23453 pointers. If you use this option, the entire text, data, and BSS segments
23454 of your program must fit in 64K of memory and you must use an appropriate
23455 linker script to allocate them within the addressable range of the
23456 global pointer.
23457
23458 @end table
23459
23460 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23461 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23462
23463 The default is @option{-mgpopt} except when @option{-fpic} or
23464 @option{-fPIC} is specified to generate position-independent code.
23465 Note that the Nios II ABI does not permit GP-relative accesses from
23466 shared libraries.
23467
23468 You may need to specify @option{-mno-gpopt} explicitly when building
23469 programs that include large amounts of small data, including large
23470 GOT data sections. In this case, the 16-bit offset for GP-relative
23471 addressing may not be large enough to allow access to the entire
23472 small data section.
23473
23474 @item -mgprel-sec=@var{regexp}
23475 @opindex mgprel-sec
23476 This option specifies additional section names that can be accessed via
23477 GP-relative addressing. It is most useful in conjunction with
23478 @code{section} attributes on variable declarations
23479 (@pxref{Common Variable Attributes}) and a custom linker script.
23480 The @var{regexp} is a POSIX Extended Regular Expression.
23481
23482 This option does not affect the behavior of the @option{-G} option, and
23483 the specified sections are in addition to the standard @code{.sdata}
23484 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23485
23486 @item -mr0rel-sec=@var{regexp}
23487 @opindex mr0rel-sec
23488 This option specifies names of sections that can be accessed via a
23489 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23490 of the 32-bit address space. It is most useful in conjunction with
23491 @code{section} attributes on variable declarations
23492 (@pxref{Common Variable Attributes}) and a custom linker script.
23493 The @var{regexp} is a POSIX Extended Regular Expression.
23494
23495 In contrast to the use of GP-relative addressing for small data,
23496 zero-based addressing is never generated by default and there are no
23497 conventional section names used in standard linker scripts for sections
23498 in the low or high areas of memory.
23499
23500 @item -mel
23501 @itemx -meb
23502 @opindex mel
23503 @opindex meb
23504 Generate little-endian (default) or big-endian (experimental) code,
23505 respectively.
23506
23507 @item -march=@var{arch}
23508 @opindex march
23509 This specifies the name of the target Nios II architecture. GCC uses this
23510 name to determine what kind of instructions it can emit when generating
23511 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23512
23513 The preprocessor macro @code{__nios2_arch__} is available to programs,
23514 with value 1 or 2, indicating the targeted ISA level.
23515
23516 @item -mbypass-cache
23517 @itemx -mno-bypass-cache
23518 @opindex mno-bypass-cache
23519 @opindex mbypass-cache
23520 Force all load and store instructions to always bypass cache by
23521 using I/O variants of the instructions. The default is not to
23522 bypass the cache.
23523
23524 @item -mno-cache-volatile
23525 @itemx -mcache-volatile
23526 @opindex mcache-volatile
23527 @opindex mno-cache-volatile
23528 Volatile memory access bypass the cache using the I/O variants of
23529 the load and store instructions. The default is not to bypass the cache.
23530
23531 @item -mno-fast-sw-div
23532 @itemx -mfast-sw-div
23533 @opindex mno-fast-sw-div
23534 @opindex mfast-sw-div
23535 Do not use table-based fast divide for small numbers. The default
23536 is to use the fast divide at @option{-O3} and above.
23537
23538 @item -mno-hw-mul
23539 @itemx -mhw-mul
23540 @itemx -mno-hw-mulx
23541 @itemx -mhw-mulx
23542 @itemx -mno-hw-div
23543 @itemx -mhw-div
23544 @opindex mno-hw-mul
23545 @opindex mhw-mul
23546 @opindex mno-hw-mulx
23547 @opindex mhw-mulx
23548 @opindex mno-hw-div
23549 @opindex mhw-div
23550 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23551 instructions by the compiler. The default is to emit @code{mul}
23552 and not emit @code{div} and @code{mulx}.
23553
23554 @item -mbmx
23555 @itemx -mno-bmx
23556 @itemx -mcdx
23557 @itemx -mno-cdx
23558 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23559 CDX (code density) instructions. Enabling these instructions also
23560 requires @option{-march=r2}. Since these instructions are optional
23561 extensions to the R2 architecture, the default is not to emit them.
23562
23563 @item -mcustom-@var{insn}=@var{N}
23564 @itemx -mno-custom-@var{insn}
23565 @opindex mcustom-@var{insn}
23566 @opindex mno-custom-@var{insn}
23567 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23568 custom instruction with encoding @var{N} when generating code that uses
23569 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23570 instruction 253 for single-precision floating-point add operations instead
23571 of the default behavior of using a library call.
23572
23573 The following values of @var{insn} are supported. Except as otherwise
23574 noted, floating-point operations are expected to be implemented with
23575 normal IEEE 754 semantics and correspond directly to the C operators or the
23576 equivalent GCC built-in functions (@pxref{Other Builtins}).
23577
23578 Single-precision floating point:
23579 @table @asis
23580
23581 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23582 Binary arithmetic operations.
23583
23584 @item @samp{fnegs}
23585 Unary negation.
23586
23587 @item @samp{fabss}
23588 Unary absolute value.
23589
23590 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23591 Comparison operations.
23592
23593 @item @samp{fmins}, @samp{fmaxs}
23594 Floating-point minimum and maximum. These instructions are only
23595 generated if @option{-ffinite-math-only} is specified.
23596
23597 @item @samp{fsqrts}
23598 Unary square root operation.
23599
23600 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23601 Floating-point trigonometric and exponential functions. These instructions
23602 are only generated if @option{-funsafe-math-optimizations} is also specified.
23603
23604 @end table
23605
23606 Double-precision floating point:
23607 @table @asis
23608
23609 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23610 Binary arithmetic operations.
23611
23612 @item @samp{fnegd}
23613 Unary negation.
23614
23615 @item @samp{fabsd}
23616 Unary absolute value.
23617
23618 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23619 Comparison operations.
23620
23621 @item @samp{fmind}, @samp{fmaxd}
23622 Double-precision minimum and maximum. These instructions are only
23623 generated if @option{-ffinite-math-only} is specified.
23624
23625 @item @samp{fsqrtd}
23626 Unary square root operation.
23627
23628 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23629 Double-precision trigonometric and exponential functions. These instructions
23630 are only generated if @option{-funsafe-math-optimizations} is also specified.
23631
23632 @end table
23633
23634 Conversions:
23635 @table @asis
23636 @item @samp{fextsd}
23637 Conversion from single precision to double precision.
23638
23639 @item @samp{ftruncds}
23640 Conversion from double precision to single precision.
23641
23642 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23643 Conversion from floating point to signed or unsigned integer types, with
23644 truncation towards zero.
23645
23646 @item @samp{round}
23647 Conversion from single-precision floating point to signed integer,
23648 rounding to the nearest integer and ties away from zero.
23649 This corresponds to the @code{__builtin_lroundf} function when
23650 @option{-fno-math-errno} is used.
23651
23652 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23653 Conversion from signed or unsigned integer types to floating-point types.
23654
23655 @end table
23656
23657 In addition, all of the following transfer instructions for internal
23658 registers X and Y must be provided to use any of the double-precision
23659 floating-point instructions. Custom instructions taking two
23660 double-precision source operands expect the first operand in the
23661 64-bit register X. The other operand (or only operand of a unary
23662 operation) is given to the custom arithmetic instruction with the
23663 least significant half in source register @var{src1} and the most
23664 significant half in @var{src2}. A custom instruction that returns a
23665 double-precision result returns the most significant 32 bits in the
23666 destination register and the other half in 32-bit register Y.
23667 GCC automatically generates the necessary code sequences to write
23668 register X and/or read register Y when double-precision floating-point
23669 instructions are used.
23670
23671 @table @asis
23672
23673 @item @samp{fwrx}
23674 Write @var{src1} into the least significant half of X and @var{src2} into
23675 the most significant half of X.
23676
23677 @item @samp{fwry}
23678 Write @var{src1} into Y.
23679
23680 @item @samp{frdxhi}, @samp{frdxlo}
23681 Read the most or least (respectively) significant half of X and store it in
23682 @var{dest}.
23683
23684 @item @samp{frdy}
23685 Read the value of Y and store it into @var{dest}.
23686 @end table
23687
23688 Note that you can gain more local control over generation of Nios II custom
23689 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23690 and @code{target("no-custom-@var{insn}")} function attributes
23691 (@pxref{Function Attributes})
23692 or pragmas (@pxref{Function Specific Option Pragmas}).
23693
23694 @item -mcustom-fpu-cfg=@var{name}
23695 @opindex mcustom-fpu-cfg
23696
23697 This option enables a predefined, named set of custom instruction encodings
23698 (see @option{-mcustom-@var{insn}} above).
23699 Currently, the following sets are defined:
23700
23701 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23702 @gccoptlist{-mcustom-fmuls=252 @gol
23703 -mcustom-fadds=253 @gol
23704 -mcustom-fsubs=254 @gol
23705 -fsingle-precision-constant}
23706
23707 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23708 @gccoptlist{-mcustom-fmuls=252 @gol
23709 -mcustom-fadds=253 @gol
23710 -mcustom-fsubs=254 @gol
23711 -mcustom-fdivs=255 @gol
23712 -fsingle-precision-constant}
23713
23714 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23715 @gccoptlist{-mcustom-floatus=243 @gol
23716 -mcustom-fixsi=244 @gol
23717 -mcustom-floatis=245 @gol
23718 -mcustom-fcmpgts=246 @gol
23719 -mcustom-fcmples=249 @gol
23720 -mcustom-fcmpeqs=250 @gol
23721 -mcustom-fcmpnes=251 @gol
23722 -mcustom-fmuls=252 @gol
23723 -mcustom-fadds=253 @gol
23724 -mcustom-fsubs=254 @gol
23725 -mcustom-fdivs=255 @gol
23726 -fsingle-precision-constant}
23727
23728 Custom instruction assignments given by individual
23729 @option{-mcustom-@var{insn}=} options override those given by
23730 @option{-mcustom-fpu-cfg=}, regardless of the
23731 order of the options on the command line.
23732
23733 Note that you can gain more local control over selection of a FPU
23734 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23735 function attribute (@pxref{Function Attributes})
23736 or pragma (@pxref{Function Specific Option Pragmas}).
23737
23738 @end table
23739
23740 These additional @samp{-m} options are available for the Altera Nios II
23741 ELF (bare-metal) target:
23742
23743 @table @gcctabopt
23744
23745 @item -mhal
23746 @opindex mhal
23747 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23748 startup and termination code, and is typically used in conjunction with
23749 @option{-msys-crt0=} to specify the location of the alternate startup code
23750 provided by the HAL BSP.
23751
23752 @item -msmallc
23753 @opindex msmallc
23754 Link with a limited version of the C library, @option{-lsmallc}, rather than
23755 Newlib.
23756
23757 @item -msys-crt0=@var{startfile}
23758 @opindex msys-crt0
23759 @var{startfile} is the file name of the startfile (crt0) to use
23760 when linking. This option is only useful in conjunction with @option{-mhal}.
23761
23762 @item -msys-lib=@var{systemlib}
23763 @opindex msys-lib
23764 @var{systemlib} is the library name of the library that provides
23765 low-level system calls required by the C library,
23766 e.g.@: @code{read} and @code{write}.
23767 This option is typically used to link with a library provided by a HAL BSP.
23768
23769 @end table
23770
23771 @node Nvidia PTX Options
23772 @subsection Nvidia PTX Options
23773 @cindex Nvidia PTX options
23774 @cindex nvptx options
23775
23776 These options are defined for Nvidia PTX:
23777
23778 @table @gcctabopt
23779
23780 @item -m32
23781 @itemx -m64
23782 @opindex m32
23783 @opindex m64
23784 Generate code for 32-bit or 64-bit ABI.
23785
23786 @item -misa=@var{ISA-string}
23787 @opindex march
23788 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23789 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23790 @samp{sm_35}. The default ISA is sm_30.
23791
23792 @item -mmainkernel
23793 @opindex mmainkernel
23794 Link in code for a __main kernel. This is for stand-alone instead of
23795 offloading execution.
23796
23797 @item -moptimize
23798 @opindex moptimize
23799 Apply partitioned execution optimizations. This is the default when any
23800 level of optimization is selected.
23801
23802 @item -msoft-stack
23803 @opindex msoft-stack
23804 Generate code that does not use @code{.local} memory
23805 directly for stack storage. Instead, a per-warp stack pointer is
23806 maintained explicitly. This enables variable-length stack allocation (with
23807 variable-length arrays or @code{alloca}), and when global memory is used for
23808 underlying storage, makes it possible to access automatic variables from other
23809 threads, or with atomic instructions. This code generation variant is used
23810 for OpenMP offloading, but the option is exposed on its own for the purpose
23811 of testing the compiler; to generate code suitable for linking into programs
23812 using OpenMP offloading, use option @option{-mgomp}.
23813
23814 @item -muniform-simt
23815 @opindex muniform-simt
23816 Switch to code generation variant that allows to execute all threads in each
23817 warp, while maintaining memory state and side effects as if only one thread
23818 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23819 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23820 current lane index equals the master lane index), and the register being
23821 assigned is copied via a shuffle instruction from the master lane. Outside of
23822 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23823 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23824 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23825 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23826 with current lane index to compute the master lane index.
23827
23828 @item -mgomp
23829 @opindex mgomp
23830 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23831 @option{-muniform-simt} options, and selects corresponding multilib variant.
23832
23833 @end table
23834
23835 @node OpenRISC Options
23836 @subsection OpenRISC Options
23837 @cindex OpenRISC Options
23838
23839 These options are defined for OpenRISC:
23840
23841 @table @gcctabopt
23842
23843 @item -mboard=@var{name}
23844 @opindex mboard
23845 Configure a board specific runtime. This will be passed to the linker for
23846 newlib board library linking. The default is @code{or1ksim}.
23847
23848 @item -mnewlib
23849 @opindex mnewlib
23850 This option is ignored; it is for compatibility purposes only. This used to
23851 select linker and preprocessor options for use with newlib.
23852
23853 @item -msoft-div
23854 @itemx -mhard-div
23855 @opindex msoft-div
23856 @opindex mhard-div
23857 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
23858 This default is hardware divide.
23859
23860 @item -msoft-mul
23861 @itemx -mhard-mul
23862 @opindex msoft-mul
23863 @opindex mhard-mul
23864 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
23865 This default is hardware multiply.
23866
23867 @item -msoft-float
23868 @itemx -mhard-float
23869 @opindex msoft-float
23870 @opindex mhard-float
23871 Select software or hardware for floating point operations.
23872 The default is software.
23873
23874 @item -mdouble-float
23875 @opindex mdouble-float
23876 When @option{-mhard-float} is selected, enables generation of double-precision
23877 floating point instructions. By default functions from @file{libgcc} are used
23878 to perform double-precision floating point operations.
23879
23880 @item -munordered-float
23881 @opindex munordered-float
23882 When @option{-mhard-float} is selected, enables generation of unordered
23883 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
23884 functions from @file{libgcc} are used to perform unordered floating point
23885 compare and set flag operations.
23886
23887 @item -mcmov
23888 @opindex mcmov
23889 Enable generation of conditional move (@code{l.cmov}) instructions. By
23890 default the equivalent will be generated using using set and branch.
23891
23892 @item -mror
23893 @opindex mror
23894 Enable generation of rotate right (@code{l.ror}) instructions. By default
23895 functions from @file{libgcc} are used to perform rotate right operations.
23896
23897 @item -mrori
23898 @opindex mrori
23899 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
23900 By default functions from @file{libgcc} are used to perform rotate right with
23901 immediate operations.
23902
23903 @item -msext
23904 @opindex msext
23905 Enable generation of sign extension (@code{l.ext*}) instructions. By default
23906 memory loads are used to perform sign extension.
23907
23908 @item -msfimm
23909 @opindex msfimm
23910 Enable generation of compare and set flag with immediate (@code{l.sf*i})
23911 instructions. By default extra instructions will be generated to store the
23912 immediate to a register first.
23913
23914 @item -mshftimm
23915 @opindex mshftimm
23916 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
23917 @code{l.slli}) instructions. By default extra instructions will be generated
23918 to store the immediate to a register first.
23919
23920
23921 @end table
23922
23923 @node PDP-11 Options
23924 @subsection PDP-11 Options
23925 @cindex PDP-11 Options
23926
23927 These options are defined for the PDP-11:
23928
23929 @table @gcctabopt
23930 @item -mfpu
23931 @opindex mfpu
23932 Use hardware FPP floating point. This is the default. (FIS floating
23933 point on the PDP-11/40 is not supported.) Implies -m45.
23934
23935 @item -msoft-float
23936 @opindex msoft-float
23937 Do not use hardware floating point.
23938
23939 @item -mac0
23940 @opindex mac0
23941 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23942
23943 @item -mno-ac0
23944 @opindex mno-ac0
23945 Return floating-point results in memory. This is the default.
23946
23947 @item -m40
23948 @opindex m40
23949 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23950
23951 @item -m45
23952 @opindex m45
23953 Generate code for a PDP-11/45. This is the default.
23954
23955 @item -m10
23956 @opindex m10
23957 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23958
23959 @item -mint16
23960 @itemx -mno-int32
23961 @opindex mint16
23962 @opindex mno-int32
23963 Use 16-bit @code{int}. This is the default.
23964
23965 @item -mint32
23966 @itemx -mno-int16
23967 @opindex mint32
23968 @opindex mno-int16
23969 Use 32-bit @code{int}.
23970
23971 @item -msplit
23972 @opindex msplit
23973 Target has split instruction and data space. Implies -m45.
23974
23975 @item -munix-asm
23976 @opindex munix-asm
23977 Use Unix assembler syntax.
23978
23979 @item -mdec-asm
23980 @opindex mdec-asm
23981 Use DEC assembler syntax.
23982
23983 @item -mgnu-asm
23984 @opindex mgnu-asm
23985 Use GNU assembler syntax. This is the default.
23986
23987 @item -mlra
23988 @opindex mlra
23989 Use the new LRA register allocator. By default, the old ``reload''
23990 allocator is used.
23991 @end table
23992
23993 @node picoChip Options
23994 @subsection picoChip Options
23995 @cindex picoChip options
23996
23997 These @samp{-m} options are defined for picoChip implementations:
23998
23999 @table @gcctabopt
24000
24001 @item -mae=@var{ae_type}
24002 @opindex mcpu
24003 Set the instruction set, register set, and instruction scheduling
24004 parameters for array element type @var{ae_type}. Supported values
24005 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
24006
24007 @option{-mae=ANY} selects a completely generic AE type. Code
24008 generated with this option runs on any of the other AE types. The
24009 code is not as efficient as it would be if compiled for a specific
24010 AE type, and some types of operation (e.g., multiplication) do not
24011 work properly on all types of AE.
24012
24013 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
24014 for compiled code, and is the default.
24015
24016 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
24017 option may suffer from poor performance of byte (char) manipulation,
24018 since the DSP AE does not provide hardware support for byte load/stores.
24019
24020 @item -msymbol-as-address
24021 Enable the compiler to directly use a symbol name as an address in a
24022 load/store instruction, without first loading it into a
24023 register. Typically, the use of this option generates larger
24024 programs, which run faster than when the option isn't used. However, the
24025 results vary from program to program, so it is left as a user option,
24026 rather than being permanently enabled.
24027
24028 @item -mno-inefficient-warnings
24029 Disables warnings about the generation of inefficient code. These
24030 warnings can be generated, for example, when compiling code that
24031 performs byte-level memory operations on the MAC AE type. The MAC AE has
24032 no hardware support for byte-level memory operations, so all byte
24033 load/stores must be synthesized from word load/store operations. This is
24034 inefficient and a warning is generated to indicate
24035 that you should rewrite the code to avoid byte operations, or to target
24036 an AE type that has the necessary hardware support. This option disables
24037 these warnings.
24038
24039 @end table
24040
24041 @node PowerPC Options
24042 @subsection PowerPC Options
24043 @cindex PowerPC options
24044
24045 These are listed under @xref{RS/6000 and PowerPC Options}.
24046
24047 @node PRU Options
24048 @subsection PRU Options
24049 @cindex PRU Options
24050
24051 These command-line options are defined for PRU target:
24052
24053 @table @gcctabopt
24054 @item -minrt
24055 @opindex minrt
24056 Link with a minimum runtime environment, with no support for static
24057 initializers and constructors. Using this option can significantly reduce
24058 the size of the final ELF binary. Beware that the compiler could still
24059 generate code with static initializers and constructors. It is up to the
24060 programmer to ensure that the source program will not use those features.
24061
24062 @item -mmcu=@var{mcu}
24063 @opindex mmcu
24064 Specify the PRU MCU variant to use. Check Newlib for the exact list of
24065 supported MCUs.
24066
24067 @item -mno-relax
24068 @opindex mno-relax
24069 Make GCC pass the @option{--no-relax} command-line option to the linker
24070 instead of the @option{--relax} option.
24071
24072 @item -mloop
24073 @opindex mloop
24074 Allow (or do not allow) GCC to use the LOOP instruction.
24075
24076 @item -mabi=@var{variant}
24077 @opindex mabi
24078 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
24079 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
24080 more naturally with certain GCC assumptions. These are the differences:
24081
24082 @table @samp
24083 @item Function Pointer Size
24084 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
24085 supports only 32-bit data and code pointers.
24086
24087 @item Optional Return Value Pointer
24088 Function return values larger than 64 bits are passed by using a hidden
24089 pointer as the first argument of the function. TI ABI, though, mandates that
24090 the pointer can be NULL in case the caller is not using the returned value.
24091 GNU always passes and expects a valid return value pointer.
24092
24093 @end table
24094
24095 The current @option{-mabi=ti} implementation simply raises a compile error
24096 when any of the above code constructs is detected. As a consequence
24097 the standard C library cannot be built and it is omitted when linking with
24098 @option{-mabi=ti}.
24099
24100 Relaxation is a GNU feature and for safety reasons is disabled when using
24101 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
24102 instructions, so the GNU linker cannot adjust them when shortening adjacent
24103 LDI32 pseudo instructions.
24104
24105 @end table
24106
24107 @node RISC-V Options
24108 @subsection RISC-V Options
24109 @cindex RISC-V Options
24110
24111 These command-line options are defined for RISC-V targets:
24112
24113 @table @gcctabopt
24114 @item -mbranch-cost=@var{n}
24115 @opindex mbranch-cost
24116 Set the cost of branches to roughly @var{n} instructions.
24117
24118 @item -mplt
24119 @itemx -mno-plt
24120 @opindex plt
24121 When generating PIC code, do or don't allow the use of PLTs. Ignored for
24122 non-PIC. The default is @option{-mplt}.
24123
24124 @item -mabi=@var{ABI-string}
24125 @opindex mabi
24126 Specify integer and floating-point calling convention. @var{ABI-string}
24127 contains two parts: the size of integer types and the registers used for
24128 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
24129 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
24130 32-bit), and that floating-point values up to 64 bits wide are passed in F
24131 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
24132 allows the compiler to generate code that uses the F and D extensions but only
24133 allows floating-point values up to 32 bits long to be passed in registers; or
24134 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
24135 passed in registers.
24136
24137 The default for this argument is system dependent, users who want a specific
24138 calling convention should specify one explicitly. The valid calling
24139 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
24140 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
24141 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
24142 invalid because the ABI requires 64-bit values be passed in F registers, but F
24143 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
24144 only be used with the @samp{rv32e} architecture. This ABI is not well
24145 specified at present, and is subject to change.
24146
24147 @item -mfdiv
24148 @itemx -mno-fdiv
24149 @opindex mfdiv
24150 Do or don't use hardware floating-point divide and square root instructions.
24151 This requires the F or D extensions for floating-point registers. The default
24152 is to use them if the specified architecture has these instructions.
24153
24154 @item -mdiv
24155 @itemx -mno-div
24156 @opindex mdiv
24157 Do or don't use hardware instructions for integer division. This requires the
24158 M extension. The default is to use them if the specified architecture has
24159 these instructions.
24160
24161 @item -march=@var{ISA-string}
24162 @opindex march
24163 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
24164 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
24165 @samp{rv32imaf}.
24166
24167 @item -mtune=@var{processor-string}
24168 @opindex mtune
24169 Optimize the output for the given processor, specified by microarchitecture
24170 name. Permissible values for this option are: @samp{rocket},
24171 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
24172 and @samp{size}.
24173
24174 When @option{-mtune=} is not specified, the default is @samp{rocket}.
24175
24176 The @samp{size} choice is not intended for use by end-users. This is used
24177 when @option{-Os} is specified. It overrides the instruction cost info
24178 provided by @option{-mtune=}, but does not override the pipeline info. This
24179 helps reduce code size while still giving good performance.
24180
24181 @item -mpreferred-stack-boundary=@var{num}
24182 @opindex mpreferred-stack-boundary
24183 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24184 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24185 the default is 4 (16 bytes or 128-bits).
24186
24187 @strong{Warning:} If you use this switch, then you must build all modules with
24188 the same value, including any libraries. This includes the system libraries
24189 and startup modules.
24190
24191 @item -msmall-data-limit=@var{n}
24192 @opindex msmall-data-limit
24193 Put global and static data smaller than @var{n} bytes into a special section
24194 (on some targets).
24195
24196 @item -msave-restore
24197 @itemx -mno-save-restore
24198 @opindex msave-restore
24199 Do or don't use smaller but slower prologue and epilogue code that uses
24200 library function calls. The default is to use fast inline prologues and
24201 epilogues.
24202
24203 @item -mstrict-align
24204 @itemx -mno-strict-align
24205 @opindex mstrict-align
24206 Do not or do generate unaligned memory accesses. The default is set depending
24207 on whether the processor we are optimizing for supports fast unaligned access
24208 or not.
24209
24210 @item -mcmodel=medlow
24211 @opindex mcmodel=medlow
24212 Generate code for the medium-low code model. The program and its statically
24213 defined symbols must lie within a single 2 GiB address range and must lie
24214 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24215 statically or dynamically linked. This is the default code model.
24216
24217 @item -mcmodel=medany
24218 @opindex mcmodel=medany
24219 Generate code for the medium-any code model. The program and its statically
24220 defined symbols must be within any single 2 GiB address range. Programs can be
24221 statically or dynamically linked.
24222
24223 @item -mexplicit-relocs
24224 @itemx -mno-exlicit-relocs
24225 Use or do not use assembler relocation operators when dealing with symbolic
24226 addresses. The alternative is to use assembler macros instead, which may
24227 limit optimization.
24228
24229 @item -mrelax
24230 @itemx -mno-relax
24231 Take advantage of linker relaxations to reduce the number of instructions
24232 required to materialize symbol addresses. The default is to take advantage of
24233 linker relaxations.
24234
24235 @item -memit-attribute
24236 @itemx -mno-emit-attribute
24237 Emit (do not emit) RISC-V attribute to record extra information into ELF
24238 objects. This feature requires at least binutils 2.32.
24239
24240 @item -malign-data=@var{type}
24241 @opindex malign-data
24242 Control how GCC aligns variables and constants of array, structure, or union
24243 types. Supported values for @var{type} are @samp{xlen} which uses x register
24244 width as the alignment value, and @samp{natural} which uses natural alignment.
24245 @samp{xlen} is the default.
24246 @end table
24247
24248 @node RL78 Options
24249 @subsection RL78 Options
24250 @cindex RL78 Options
24251
24252 @table @gcctabopt
24253
24254 @item -msim
24255 @opindex msim
24256 Links in additional target libraries to support operation within a
24257 simulator.
24258
24259 @item -mmul=none
24260 @itemx -mmul=g10
24261 @itemx -mmul=g13
24262 @itemx -mmul=g14
24263 @itemx -mmul=rl78
24264 @opindex mmul
24265 Specifies the type of hardware multiplication and division support to
24266 be used. The simplest is @code{none}, which uses software for both
24267 multiplication and division. This is the default. The @code{g13}
24268 value is for the hardware multiply/divide peripheral found on the
24269 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24270 the multiplication and division instructions supported by the RL78/G14
24271 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24272 the value @code{mg10} is an alias for @code{none}.
24273
24274 In addition a C preprocessor macro is defined, based upon the setting
24275 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24276 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24277
24278 @item -mcpu=g10
24279 @itemx -mcpu=g13
24280 @itemx -mcpu=g14
24281 @itemx -mcpu=rl78
24282 @opindex mcpu
24283 Specifies the RL78 core to target. The default is the G14 core, also
24284 known as an S3 core or just RL78. The G13 or S2 core does not have
24285 multiply or divide instructions, instead it uses a hardware peripheral
24286 for these operations. The G10 or S1 core does not have register
24287 banks, so it uses a different calling convention.
24288
24289 If this option is set it also selects the type of hardware multiply
24290 support to use, unless this is overridden by an explicit
24291 @option{-mmul=none} option on the command line. Thus specifying
24292 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24293 peripheral and specifying @option{-mcpu=g10} disables the use of
24294 hardware multiplications altogether.
24295
24296 Note, although the RL78/G14 core is the default target, specifying
24297 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24298 change the behavior of the toolchain since it also enables G14
24299 hardware multiply support. If these options are not specified on the
24300 command line then software multiplication routines will be used even
24301 though the code targets the RL78 core. This is for backwards
24302 compatibility with older toolchains which did not have hardware
24303 multiply and divide support.
24304
24305 In addition a C preprocessor macro is defined, based upon the setting
24306 of this option. Possible values are: @code{__RL78_G10__},
24307 @code{__RL78_G13__} or @code{__RL78_G14__}.
24308
24309 @item -mg10
24310 @itemx -mg13
24311 @itemx -mg14
24312 @itemx -mrl78
24313 @opindex mg10
24314 @opindex mg13
24315 @opindex mg14
24316 @opindex mrl78
24317 These are aliases for the corresponding @option{-mcpu=} option. They
24318 are provided for backwards compatibility.
24319
24320 @item -mallregs
24321 @opindex mallregs
24322 Allow the compiler to use all of the available registers. By default
24323 registers @code{r24..r31} are reserved for use in interrupt handlers.
24324 With this option enabled these registers can be used in ordinary
24325 functions as well.
24326
24327 @item -m64bit-doubles
24328 @itemx -m32bit-doubles
24329 @opindex m64bit-doubles
24330 @opindex m32bit-doubles
24331 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24332 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24333 @option{-m32bit-doubles}.
24334
24335 @item -msave-mduc-in-interrupts
24336 @itemx -mno-save-mduc-in-interrupts
24337 @opindex msave-mduc-in-interrupts
24338 @opindex mno-save-mduc-in-interrupts
24339 Specifies that interrupt handler functions should preserve the
24340 MDUC registers. This is only necessary if normal code might use
24341 the MDUC registers, for example because it performs multiplication
24342 and division operations. The default is to ignore the MDUC registers
24343 as this makes the interrupt handlers faster. The target option -mg13
24344 needs to be passed for this to work as this feature is only available
24345 on the G13 target (S2 core). The MDUC registers will only be saved
24346 if the interrupt handler performs a multiplication or division
24347 operation or it calls another function.
24348
24349 @end table
24350
24351 @node RS/6000 and PowerPC Options
24352 @subsection IBM RS/6000 and PowerPC Options
24353 @cindex RS/6000 and PowerPC Options
24354 @cindex IBM RS/6000 and PowerPC Options
24355
24356 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24357 @table @gcctabopt
24358 @item -mpowerpc-gpopt
24359 @itemx -mno-powerpc-gpopt
24360 @itemx -mpowerpc-gfxopt
24361 @itemx -mno-powerpc-gfxopt
24362 @need 800
24363 @itemx -mpowerpc64
24364 @itemx -mno-powerpc64
24365 @itemx -mmfcrf
24366 @itemx -mno-mfcrf
24367 @itemx -mpopcntb
24368 @itemx -mno-popcntb
24369 @itemx -mpopcntd
24370 @itemx -mno-popcntd
24371 @itemx -mfprnd
24372 @itemx -mno-fprnd
24373 @need 800
24374 @itemx -mcmpb
24375 @itemx -mno-cmpb
24376 @itemx -mhard-dfp
24377 @itemx -mno-hard-dfp
24378 @opindex mpowerpc-gpopt
24379 @opindex mno-powerpc-gpopt
24380 @opindex mpowerpc-gfxopt
24381 @opindex mno-powerpc-gfxopt
24382 @opindex mpowerpc64
24383 @opindex mno-powerpc64
24384 @opindex mmfcrf
24385 @opindex mno-mfcrf
24386 @opindex mpopcntb
24387 @opindex mno-popcntb
24388 @opindex mpopcntd
24389 @opindex mno-popcntd
24390 @opindex mfprnd
24391 @opindex mno-fprnd
24392 @opindex mcmpb
24393 @opindex mno-cmpb
24394 @opindex mhard-dfp
24395 @opindex mno-hard-dfp
24396 You use these options to specify which instructions are available on the
24397 processor you are using. The default value of these options is
24398 determined when configuring GCC@. Specifying the
24399 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24400 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24401 rather than the options listed above.
24402
24403 Specifying @option{-mpowerpc-gpopt} allows
24404 GCC to use the optional PowerPC architecture instructions in the
24405 General Purpose group, including floating-point square root. Specifying
24406 @option{-mpowerpc-gfxopt} allows GCC to
24407 use the optional PowerPC architecture instructions in the Graphics
24408 group, including floating-point select.
24409
24410 The @option{-mmfcrf} option allows GCC to generate the move from
24411 condition register field instruction implemented on the POWER4
24412 processor and other processors that support the PowerPC V2.01
24413 architecture.
24414 The @option{-mpopcntb} option allows GCC to generate the popcount and
24415 double-precision FP reciprocal estimate instruction implemented on the
24416 POWER5 processor and other processors that support the PowerPC V2.02
24417 architecture.
24418 The @option{-mpopcntd} option allows GCC to generate the popcount
24419 instruction implemented on the POWER7 processor and other processors
24420 that support the PowerPC V2.06 architecture.
24421 The @option{-mfprnd} option allows GCC to generate the FP round to
24422 integer instructions implemented on the POWER5+ processor and other
24423 processors that support the PowerPC V2.03 architecture.
24424 The @option{-mcmpb} option allows GCC to generate the compare bytes
24425 instruction implemented on the POWER6 processor and other processors
24426 that support the PowerPC V2.05 architecture.
24427 The @option{-mhard-dfp} option allows GCC to generate the decimal
24428 floating-point instructions implemented on some POWER processors.
24429
24430 The @option{-mpowerpc64} option allows GCC to generate the additional
24431 64-bit instructions that are found in the full PowerPC64 architecture
24432 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24433 @option{-mno-powerpc64}.
24434
24435 @item -mcpu=@var{cpu_type}
24436 @opindex mcpu
24437 Set architecture type, register usage, and
24438 instruction scheduling parameters for machine type @var{cpu_type}.
24439 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24440 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24441 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24442 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24443 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24444 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24445 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24446 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24447 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24448 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24449 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24450 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24451
24452 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24453 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24454 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24455 architecture machine types, with an appropriate, generic processor
24456 model assumed for scheduling purposes.
24457
24458 Specifying @samp{native} as cpu type detects and selects the
24459 architecture option that corresponds to the host processor of the
24460 system performing the compilation.
24461 @option{-mcpu=native} has no effect if GCC does not recognize the
24462 processor.
24463
24464 The other options specify a specific processor. Code generated under
24465 those options runs best on that processor, and may not run at all on
24466 others.
24467
24468 The @option{-mcpu} options automatically enable or disable the
24469 following options:
24470
24471 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24472 -mpopcntb -mpopcntd -mpowerpc64 @gol
24473 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24474 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24475 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24476 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24477
24478 The particular options set for any particular CPU varies between
24479 compiler versions, depending on what setting seems to produce optimal
24480 code for that CPU; it doesn't necessarily reflect the actual hardware's
24481 capabilities. If you wish to set an individual option to a particular
24482 value, you may specify it after the @option{-mcpu} option, like
24483 @option{-mcpu=970 -mno-altivec}.
24484
24485 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24486 not enabled or disabled by the @option{-mcpu} option at present because
24487 AIX does not have full support for these options. You may still
24488 enable or disable them individually if you're sure it'll work in your
24489 environment.
24490
24491 @item -mtune=@var{cpu_type}
24492 @opindex mtune
24493 Set the instruction scheduling parameters for machine type
24494 @var{cpu_type}, but do not set the architecture type or register usage,
24495 as @option{-mcpu=@var{cpu_type}} does. The same
24496 values for @var{cpu_type} are used for @option{-mtune} as for
24497 @option{-mcpu}. If both are specified, the code generated uses the
24498 architecture and registers set by @option{-mcpu}, but the
24499 scheduling parameters set by @option{-mtune}.
24500
24501 @item -mcmodel=small
24502 @opindex mcmodel=small
24503 Generate PowerPC64 code for the small model: The TOC is limited to
24504 64k.
24505
24506 @item -mcmodel=medium
24507 @opindex mcmodel=medium
24508 Generate PowerPC64 code for the medium model: The TOC and other static
24509 data may be up to a total of 4G in size. This is the default for 64-bit
24510 Linux.
24511
24512 @item -mcmodel=large
24513 @opindex mcmodel=large
24514 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24515 in size. Other data and code is only limited by the 64-bit address
24516 space.
24517
24518 @item -maltivec
24519 @itemx -mno-altivec
24520 @opindex maltivec
24521 @opindex mno-altivec
24522 Generate code that uses (does not use) AltiVec instructions, and also
24523 enable the use of built-in functions that allow more direct access to
24524 the AltiVec instruction set. You may also need to set
24525 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24526 enhancements.
24527
24528 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24529 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24530 match array element order corresponding to the endianness of the
24531 target. That is, element zero identifies the leftmost element in a
24532 vector register when targeting a big-endian platform, and identifies
24533 the rightmost element in a vector register when targeting a
24534 little-endian platform.
24535
24536 @item -mvrsave
24537 @itemx -mno-vrsave
24538 @opindex mvrsave
24539 @opindex mno-vrsave
24540 Generate VRSAVE instructions when generating AltiVec code.
24541
24542 @item -msecure-plt
24543 @opindex msecure-plt
24544 Generate code that allows @command{ld} and @command{ld.so}
24545 to build executables and shared
24546 libraries with non-executable @code{.plt} and @code{.got} sections.
24547 This is a PowerPC
24548 32-bit SYSV ABI option.
24549
24550 @item -mbss-plt
24551 @opindex mbss-plt
24552 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24553 fills in, and
24554 requires @code{.plt} and @code{.got}
24555 sections that are both writable and executable.
24556 This is a PowerPC 32-bit SYSV ABI option.
24557
24558 @item -misel
24559 @itemx -mno-isel
24560 @opindex misel
24561 @opindex mno-isel
24562 This switch enables or disables the generation of ISEL instructions.
24563
24564 @item -mvsx
24565 @itemx -mno-vsx
24566 @opindex mvsx
24567 @opindex mno-vsx
24568 Generate code that uses (does not use) vector/scalar (VSX)
24569 instructions, and also enable the use of built-in functions that allow
24570 more direct access to the VSX instruction set.
24571
24572 @item -mcrypto
24573 @itemx -mno-crypto
24574 @opindex mcrypto
24575 @opindex mno-crypto
24576 Enable the use (disable) of the built-in functions that allow direct
24577 access to the cryptographic instructions that were added in version
24578 2.07 of the PowerPC ISA.
24579
24580 @item -mhtm
24581 @itemx -mno-htm
24582 @opindex mhtm
24583 @opindex mno-htm
24584 Enable (disable) the use of the built-in functions that allow direct
24585 access to the Hardware Transactional Memory (HTM) instructions that
24586 were added in version 2.07 of the PowerPC ISA.
24587
24588 @item -mpower8-fusion
24589 @itemx -mno-power8-fusion
24590 @opindex mpower8-fusion
24591 @opindex mno-power8-fusion
24592 Generate code that keeps (does not keeps) some integer operations
24593 adjacent so that the instructions can be fused together on power8 and
24594 later processors.
24595
24596 @item -mpower8-vector
24597 @itemx -mno-power8-vector
24598 @opindex mpower8-vector
24599 @opindex mno-power8-vector
24600 Generate code that uses (does not use) the vector and scalar
24601 instructions that were added in version 2.07 of the PowerPC ISA. Also
24602 enable the use of built-in functions that allow more direct access to
24603 the vector instructions.
24604
24605 @item -mquad-memory
24606 @itemx -mno-quad-memory
24607 @opindex mquad-memory
24608 @opindex mno-quad-memory
24609 Generate code that uses (does not use) the non-atomic quad word memory
24610 instructions. The @option{-mquad-memory} option requires use of
24611 64-bit mode.
24612
24613 @item -mquad-memory-atomic
24614 @itemx -mno-quad-memory-atomic
24615 @opindex mquad-memory-atomic
24616 @opindex mno-quad-memory-atomic
24617 Generate code that uses (does not use) the atomic quad word memory
24618 instructions. The @option{-mquad-memory-atomic} option requires use of
24619 64-bit mode.
24620
24621 @item -mfloat128
24622 @itemx -mno-float128
24623 @opindex mfloat128
24624 @opindex mno-float128
24625 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24626 and use either software emulation for IEEE 128-bit floating point or
24627 hardware instructions.
24628
24629 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24630 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24631 use the IEEE 128-bit floating point support. The IEEE 128-bit
24632 floating point support only works on PowerPC Linux systems.
24633
24634 The default for @option{-mfloat128} is enabled on PowerPC Linux
24635 systems using the VSX instruction set, and disabled on other systems.
24636
24637 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24638 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24639 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24640 floating point instructions. Otherwise, if you do not specify to
24641 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24642 system, IEEE 128-bit floating point will be done with software
24643 emulation.
24644
24645 @item -mfloat128-hardware
24646 @itemx -mno-float128-hardware
24647 @opindex mfloat128-hardware
24648 @opindex mno-float128-hardware
24649 Enable/disable using ISA 3.0 hardware instructions to support the
24650 @var{__float128} data type.
24651
24652 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24653 Linux systems using the ISA 3.0 instruction set, and disabled on other
24654 systems.
24655
24656 @item -m32
24657 @itemx -m64
24658 @opindex m32
24659 @opindex m64
24660 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24661 targets (including GNU/Linux). The 32-bit environment sets int, long
24662 and pointer to 32 bits and generates code that runs on any PowerPC
24663 variant. The 64-bit environment sets int to 32 bits and long and
24664 pointer to 64 bits, and generates code for PowerPC64, as for
24665 @option{-mpowerpc64}.
24666
24667 @item -mfull-toc
24668 @itemx -mno-fp-in-toc
24669 @itemx -mno-sum-in-toc
24670 @itemx -mminimal-toc
24671 @opindex mfull-toc
24672 @opindex mno-fp-in-toc
24673 @opindex mno-sum-in-toc
24674 @opindex mminimal-toc
24675 Modify generation of the TOC (Table Of Contents), which is created for
24676 every executable file. The @option{-mfull-toc} option is selected by
24677 default. In that case, GCC allocates at least one TOC entry for
24678 each unique non-automatic variable reference in your program. GCC
24679 also places floating-point constants in the TOC@. However, only
24680 16,384 entries are available in the TOC@.
24681
24682 If you receive a linker error message that saying you have overflowed
24683 the available TOC space, you can reduce the amount of TOC space used
24684 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24685 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24686 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24687 generate code to calculate the sum of an address and a constant at
24688 run time instead of putting that sum into the TOC@. You may specify one
24689 or both of these options. Each causes GCC to produce very slightly
24690 slower and larger code at the expense of conserving TOC space.
24691
24692 If you still run out of space in the TOC even when you specify both of
24693 these options, specify @option{-mminimal-toc} instead. This option causes
24694 GCC to make only one TOC entry for every file. When you specify this
24695 option, GCC produces code that is slower and larger but which
24696 uses extremely little TOC space. You may wish to use this option
24697 only on files that contain less frequently-executed code.
24698
24699 @item -maix64
24700 @itemx -maix32
24701 @opindex maix64
24702 @opindex maix32
24703 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24704 @code{long} type, and the infrastructure needed to support them.
24705 Specifying @option{-maix64} implies @option{-mpowerpc64},
24706 while @option{-maix32} disables the 64-bit ABI and
24707 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24708
24709 @item -mxl-compat
24710 @itemx -mno-xl-compat
24711 @opindex mxl-compat
24712 @opindex mno-xl-compat
24713 Produce code that conforms more closely to IBM XL compiler semantics
24714 when using AIX-compatible ABI@. Pass floating-point arguments to
24715 prototyped functions beyond the register save area (RSA) on the stack
24716 in addition to argument FPRs. Do not assume that most significant
24717 double in 128-bit long double value is properly rounded when comparing
24718 values and converting to double. Use XL symbol names for long double
24719 support routines.
24720
24721 The AIX calling convention was extended but not initially documented to
24722 handle an obscure K&R C case of calling a function that takes the
24723 address of its arguments with fewer arguments than declared. IBM XL
24724 compilers access floating-point arguments that do not fit in the
24725 RSA from the stack when a subroutine is compiled without
24726 optimization. Because always storing floating-point arguments on the
24727 stack is inefficient and rarely needed, this option is not enabled by
24728 default and only is necessary when calling subroutines compiled by IBM
24729 XL compilers without optimization.
24730
24731 @item -mpe
24732 @opindex mpe
24733 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24734 application written to use message passing with special startup code to
24735 enable the application to run. The system must have PE installed in the
24736 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24737 must be overridden with the @option{-specs=} option to specify the
24738 appropriate directory location. The Parallel Environment does not
24739 support threads, so the @option{-mpe} option and the @option{-pthread}
24740 option are incompatible.
24741
24742 @item -malign-natural
24743 @itemx -malign-power
24744 @opindex malign-natural
24745 @opindex malign-power
24746 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24747 @option{-malign-natural} overrides the ABI-defined alignment of larger
24748 types, such as floating-point doubles, on their natural size-based boundary.
24749 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24750 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24751
24752 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24753 is not supported.
24754
24755 @item -msoft-float
24756 @itemx -mhard-float
24757 @opindex msoft-float
24758 @opindex mhard-float
24759 Generate code that does not use (uses) the floating-point register set.
24760 Software floating-point emulation is provided if you use the
24761 @option{-msoft-float} option, and pass the option to GCC when linking.
24762
24763 @item -mmultiple
24764 @itemx -mno-multiple
24765 @opindex mmultiple
24766 @opindex mno-multiple
24767 Generate code that uses (does not use) the load multiple word
24768 instructions and the store multiple word instructions. These
24769 instructions are generated by default on POWER systems, and not
24770 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24771 PowerPC systems, since those instructions do not work when the
24772 processor is in little-endian mode. The exceptions are PPC740 and
24773 PPC750 which permit these instructions in little-endian mode.
24774
24775 @item -mupdate
24776 @itemx -mno-update
24777 @opindex mupdate
24778 @opindex mno-update
24779 Generate code that uses (does not use) the load or store instructions
24780 that update the base register to the address of the calculated memory
24781 location. These instructions are generated by default. If you use
24782 @option{-mno-update}, there is a small window between the time that the
24783 stack pointer is updated and the address of the previous frame is
24784 stored, which means code that walks the stack frame across interrupts or
24785 signals may get corrupted data.
24786
24787 @item -mavoid-indexed-addresses
24788 @itemx -mno-avoid-indexed-addresses
24789 @opindex mavoid-indexed-addresses
24790 @opindex mno-avoid-indexed-addresses
24791 Generate code that tries to avoid (not avoid) the use of indexed load
24792 or store instructions. These instructions can incur a performance
24793 penalty on Power6 processors in certain situations, such as when
24794 stepping through large arrays that cross a 16M boundary. This option
24795 is enabled by default when targeting Power6 and disabled otherwise.
24796
24797 @item -mfused-madd
24798 @itemx -mno-fused-madd
24799 @opindex mfused-madd
24800 @opindex mno-fused-madd
24801 Generate code that uses (does not use) the floating-point multiply and
24802 accumulate instructions. These instructions are generated by default
24803 if hardware floating point is used. The machine-dependent
24804 @option{-mfused-madd} option is now mapped to the machine-independent
24805 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24806 mapped to @option{-ffp-contract=off}.
24807
24808 @item -mmulhw
24809 @itemx -mno-mulhw
24810 @opindex mmulhw
24811 @opindex mno-mulhw
24812 Generate code that uses (does not use) the half-word multiply and
24813 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24814 These instructions are generated by default when targeting those
24815 processors.
24816
24817 @item -mdlmzb
24818 @itemx -mno-dlmzb
24819 @opindex mdlmzb
24820 @opindex mno-dlmzb
24821 Generate code that uses (does not use) the string-search @samp{dlmzb}
24822 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24823 generated by default when targeting those processors.
24824
24825 @item -mno-bit-align
24826 @itemx -mbit-align
24827 @opindex mno-bit-align
24828 @opindex mbit-align
24829 On System V.4 and embedded PowerPC systems do not (do) force structures
24830 and unions that contain bit-fields to be aligned to the base type of the
24831 bit-field.
24832
24833 For example, by default a structure containing nothing but 8
24834 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24835 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24836 the structure is aligned to a 1-byte boundary and is 1 byte in
24837 size.
24838
24839 @item -mno-strict-align
24840 @itemx -mstrict-align
24841 @opindex mno-strict-align
24842 @opindex mstrict-align
24843 On System V.4 and embedded PowerPC systems do not (do) assume that
24844 unaligned memory references are handled by the system.
24845
24846 @item -mrelocatable
24847 @itemx -mno-relocatable
24848 @opindex mrelocatable
24849 @opindex mno-relocatable
24850 Generate code that allows (does not allow) a static executable to be
24851 relocated to a different address at run time. A simple embedded
24852 PowerPC system loader should relocate the entire contents of
24853 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24854 a table of 32-bit addresses generated by this option. For this to
24855 work, all objects linked together must be compiled with
24856 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24857 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24858
24859 @item -mrelocatable-lib
24860 @itemx -mno-relocatable-lib
24861 @opindex mrelocatable-lib
24862 @opindex mno-relocatable-lib
24863 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24864 @code{.fixup} section to allow static executables to be relocated at
24865 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24866 alignment of @option{-mrelocatable}. Objects compiled with
24867 @option{-mrelocatable-lib} may be linked with objects compiled with
24868 any combination of the @option{-mrelocatable} options.
24869
24870 @item -mno-toc
24871 @itemx -mtoc
24872 @opindex mno-toc
24873 @opindex mtoc
24874 On System V.4 and embedded PowerPC systems do not (do) assume that
24875 register 2 contains a pointer to a global area pointing to the addresses
24876 used in the program.
24877
24878 @item -mlittle
24879 @itemx -mlittle-endian
24880 @opindex mlittle
24881 @opindex mlittle-endian
24882 On System V.4 and embedded PowerPC systems compile code for the
24883 processor in little-endian mode. The @option{-mlittle-endian} option is
24884 the same as @option{-mlittle}.
24885
24886 @item -mbig
24887 @itemx -mbig-endian
24888 @opindex mbig
24889 @opindex mbig-endian
24890 On System V.4 and embedded PowerPC systems compile code for the
24891 processor in big-endian mode. The @option{-mbig-endian} option is
24892 the same as @option{-mbig}.
24893
24894 @item -mdynamic-no-pic
24895 @opindex mdynamic-no-pic
24896 On Darwin and Mac OS X systems, compile code so that it is not
24897 relocatable, but that its external references are relocatable. The
24898 resulting code is suitable for applications, but not shared
24899 libraries.
24900
24901 @item -msingle-pic-base
24902 @opindex msingle-pic-base
24903 Treat the register used for PIC addressing as read-only, rather than
24904 loading it in the prologue for each function. The runtime system is
24905 responsible for initializing this register with an appropriate value
24906 before execution begins.
24907
24908 @item -mprioritize-restricted-insns=@var{priority}
24909 @opindex mprioritize-restricted-insns
24910 This option controls the priority that is assigned to
24911 dispatch-slot restricted instructions during the second scheduling
24912 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24913 or @samp{2} to assign no, highest, or second-highest (respectively)
24914 priority to dispatch-slot restricted
24915 instructions.
24916
24917 @item -msched-costly-dep=@var{dependence_type}
24918 @opindex msched-costly-dep
24919 This option controls which dependences are considered costly
24920 by the target during instruction scheduling. The argument
24921 @var{dependence_type} takes one of the following values:
24922
24923 @table @asis
24924 @item @samp{no}
24925 No dependence is costly.
24926
24927 @item @samp{all}
24928 All dependences are costly.
24929
24930 @item @samp{true_store_to_load}
24931 A true dependence from store to load is costly.
24932
24933 @item @samp{store_to_load}
24934 Any dependence from store to load is costly.
24935
24936 @item @var{number}
24937 Any dependence for which the latency is greater than or equal to
24938 @var{number} is costly.
24939 @end table
24940
24941 @item -minsert-sched-nops=@var{scheme}
24942 @opindex minsert-sched-nops
24943 This option controls which NOP insertion scheme is used during
24944 the second scheduling pass. The argument @var{scheme} takes one of the
24945 following values:
24946
24947 @table @asis
24948 @item @samp{no}
24949 Don't insert NOPs.
24950
24951 @item @samp{pad}
24952 Pad with NOPs any dispatch group that has vacant issue slots,
24953 according to the scheduler's grouping.
24954
24955 @item @samp{regroup_exact}
24956 Insert NOPs to force costly dependent insns into
24957 separate groups. Insert exactly as many NOPs as needed to force an insn
24958 to a new group, according to the estimated processor grouping.
24959
24960 @item @var{number}
24961 Insert NOPs to force costly dependent insns into
24962 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24963 @end table
24964
24965 @item -mcall-sysv
24966 @opindex mcall-sysv
24967 On System V.4 and embedded PowerPC systems compile code using calling
24968 conventions that adhere to the March 1995 draft of the System V
24969 Application Binary Interface, PowerPC processor supplement. This is the
24970 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24971
24972 @item -mcall-sysv-eabi
24973 @itemx -mcall-eabi
24974 @opindex mcall-sysv-eabi
24975 @opindex mcall-eabi
24976 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24977
24978 @item -mcall-sysv-noeabi
24979 @opindex mcall-sysv-noeabi
24980 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24981
24982 @item -mcall-aixdesc
24983 @opindex m
24984 On System V.4 and embedded PowerPC systems compile code for the AIX
24985 operating system.
24986
24987 @item -mcall-linux
24988 @opindex mcall-linux
24989 On System V.4 and embedded PowerPC systems compile code for the
24990 Linux-based GNU system.
24991
24992 @item -mcall-freebsd
24993 @opindex mcall-freebsd
24994 On System V.4 and embedded PowerPC systems compile code for the
24995 FreeBSD operating system.
24996
24997 @item -mcall-netbsd
24998 @opindex mcall-netbsd
24999 On System V.4 and embedded PowerPC systems compile code for the
25000 NetBSD operating system.
25001
25002 @item -mcall-openbsd
25003 @opindex mcall-netbsd
25004 On System V.4 and embedded PowerPC systems compile code for the
25005 OpenBSD operating system.
25006
25007 @item -mtraceback=@var{traceback_type}
25008 @opindex mtraceback
25009 Select the type of traceback table. Valid values for @var{traceback_type}
25010 are @samp{full}, @samp{part}, and @samp{no}.
25011
25012 @item -maix-struct-return
25013 @opindex maix-struct-return
25014 Return all structures in memory (as specified by the AIX ABI)@.
25015
25016 @item -msvr4-struct-return
25017 @opindex msvr4-struct-return
25018 Return structures smaller than 8 bytes in registers (as specified by the
25019 SVR4 ABI)@.
25020
25021 @item -mabi=@var{abi-type}
25022 @opindex mabi
25023 Extend the current ABI with a particular extension, or remove such extension.
25024 Valid values are @samp{altivec}, @samp{no-altivec},
25025 @samp{ibmlongdouble}, @samp{ieeelongdouble},
25026 @samp{elfv1}, @samp{elfv2}@.
25027
25028 @item -mabi=ibmlongdouble
25029 @opindex mabi=ibmlongdouble
25030 Change the current ABI to use IBM extended-precision long double.
25031 This is not likely to work if your system defaults to using IEEE
25032 extended-precision long double. If you change the long double type
25033 from IEEE extended-precision, the compiler will issue a warning unless
25034 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
25035 to be enabled.
25036
25037 @item -mabi=ieeelongdouble
25038 @opindex mabi=ieeelongdouble
25039 Change the current ABI to use IEEE extended-precision long double.
25040 This is not likely to work if your system defaults to using IBM
25041 extended-precision long double. If you change the long double type
25042 from IBM extended-precision, the compiler will issue a warning unless
25043 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
25044 to be enabled.
25045
25046 @item -mabi=elfv1
25047 @opindex mabi=elfv1
25048 Change the current ABI to use the ELFv1 ABI.
25049 This is the default ABI for big-endian PowerPC 64-bit Linux.
25050 Overriding the default ABI requires special system support and is
25051 likely to fail in spectacular ways.
25052
25053 @item -mabi=elfv2
25054 @opindex mabi=elfv2
25055 Change the current ABI to use the ELFv2 ABI.
25056 This is the default ABI for little-endian PowerPC 64-bit Linux.
25057 Overriding the default ABI requires special system support and is
25058 likely to fail in spectacular ways.
25059
25060 @item -mgnu-attribute
25061 @itemx -mno-gnu-attribute
25062 @opindex mgnu-attribute
25063 @opindex mno-gnu-attribute
25064 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25065 .gnu.attributes section that specify ABI variations in function
25066 parameters or return values.
25067
25068 @item -mprototype
25069 @itemx -mno-prototype
25070 @opindex mprototype
25071 @opindex mno-prototype
25072 On System V.4 and embedded PowerPC systems assume that all calls to
25073 variable argument functions are properly prototyped. Otherwise, the
25074 compiler must insert an instruction before every non-prototyped call to
25075 set or clear bit 6 of the condition code register (@code{CR}) to
25076 indicate whether floating-point values are passed in the floating-point
25077 registers in case the function takes variable arguments. With
25078 @option{-mprototype}, only calls to prototyped variable argument functions
25079 set or clear the bit.
25080
25081 @item -msim
25082 @opindex msim
25083 On embedded PowerPC systems, assume that the startup module is called
25084 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
25085 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
25086 configurations.
25087
25088 @item -mmvme
25089 @opindex mmvme
25090 On embedded PowerPC systems, assume that the startup module is called
25091 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
25092 @file{libc.a}.
25093
25094 @item -mads
25095 @opindex mads
25096 On embedded PowerPC systems, assume that the startup module is called
25097 @file{crt0.o} and the standard C libraries are @file{libads.a} and
25098 @file{libc.a}.
25099
25100 @item -myellowknife
25101 @opindex myellowknife
25102 On embedded PowerPC systems, assume that the startup module is called
25103 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
25104 @file{libc.a}.
25105
25106 @item -mvxworks
25107 @opindex mvxworks
25108 On System V.4 and embedded PowerPC systems, specify that you are
25109 compiling for a VxWorks system.
25110
25111 @item -memb
25112 @opindex memb
25113 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
25114 header to indicate that @samp{eabi} extended relocations are used.
25115
25116 @item -meabi
25117 @itemx -mno-eabi
25118 @opindex meabi
25119 @opindex mno-eabi
25120 On System V.4 and embedded PowerPC systems do (do not) adhere to the
25121 Embedded Applications Binary Interface (EABI), which is a set of
25122 modifications to the System V.4 specifications. Selecting @option{-meabi}
25123 means that the stack is aligned to an 8-byte boundary, a function
25124 @code{__eabi} is called from @code{main} to set up the EABI
25125 environment, and the @option{-msdata} option can use both @code{r2} and
25126 @code{r13} to point to two separate small data areas. Selecting
25127 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
25128 no EABI initialization function is called from @code{main}, and the
25129 @option{-msdata} option only uses @code{r13} to point to a single
25130 small data area. The @option{-meabi} option is on by default if you
25131 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
25132
25133 @item -msdata=eabi
25134 @opindex msdata=eabi
25135 On System V.4 and embedded PowerPC systems, put small initialized
25136 @code{const} global and static data in the @code{.sdata2} section, which
25137 is pointed to by register @code{r2}. Put small initialized
25138 non-@code{const} global and static data in the @code{.sdata} section,
25139 which is pointed to by register @code{r13}. Put small uninitialized
25140 global and static data in the @code{.sbss} section, which is adjacent to
25141 the @code{.sdata} section. The @option{-msdata=eabi} option is
25142 incompatible with the @option{-mrelocatable} option. The
25143 @option{-msdata=eabi} option also sets the @option{-memb} option.
25144
25145 @item -msdata=sysv
25146 @opindex msdata=sysv
25147 On System V.4 and embedded PowerPC systems, put small global and static
25148 data in the @code{.sdata} section, which is pointed to by register
25149 @code{r13}. Put small uninitialized global and static data in the
25150 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
25151 The @option{-msdata=sysv} option is incompatible with the
25152 @option{-mrelocatable} option.
25153
25154 @item -msdata=default
25155 @itemx -msdata
25156 @opindex msdata=default
25157 @opindex msdata
25158 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
25159 compile code the same as @option{-msdata=eabi}, otherwise compile code the
25160 same as @option{-msdata=sysv}.
25161
25162 @item -msdata=data
25163 @opindex msdata=data
25164 On System V.4 and embedded PowerPC systems, put small global
25165 data in the @code{.sdata} section. Put small uninitialized global
25166 data in the @code{.sbss} section. Do not use register @code{r13}
25167 to address small data however. This is the default behavior unless
25168 other @option{-msdata} options are used.
25169
25170 @item -msdata=none
25171 @itemx -mno-sdata
25172 @opindex msdata=none
25173 @opindex mno-sdata
25174 On embedded PowerPC systems, put all initialized global and static data
25175 in the @code{.data} section, and all uninitialized data in the
25176 @code{.bss} section.
25177
25178 @item -mreadonly-in-sdata
25179 @opindex mreadonly-in-sdata
25180 @opindex mno-readonly-in-sdata
25181 Put read-only objects in the @code{.sdata} section as well. This is the
25182 default.
25183
25184 @item -mblock-move-inline-limit=@var{num}
25185 @opindex mblock-move-inline-limit
25186 Inline all block moves (such as calls to @code{memcpy} or structure
25187 copies) less than or equal to @var{num} bytes. The minimum value for
25188 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25189 targets. The default value is target-specific.
25190
25191 @item -mblock-compare-inline-limit=@var{num}
25192 @opindex mblock-compare-inline-limit
25193 Generate non-looping inline code for all block compares (such as calls
25194 to @code{memcmp} or structure compares) less than or equal to @var{num}
25195 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25196 block compare is disabled. The default value is target-specific.
25197
25198 @item -mblock-compare-inline-loop-limit=@var{num}
25199 @opindex mblock-compare-inline-loop-limit
25200 Generate an inline expansion using loop code for all block compares that
25201 are less than or equal to @var{num} bytes, but greater than the limit
25202 for non-loop inline block compare expansion. If the block length is not
25203 constant, at most @var{num} bytes will be compared before @code{memcmp}
25204 is called to compare the remainder of the block. The default value is
25205 target-specific.
25206
25207 @item -mstring-compare-inline-limit=@var{num}
25208 @opindex mstring-compare-inline-limit
25209 Compare at most @var{num} string bytes with inline code.
25210 If the difference or end of string is not found at the
25211 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25212 take care of the rest of the comparison. The default is 64 bytes.
25213
25214 @item -G @var{num}
25215 @opindex G
25216 @cindex smaller data references (PowerPC)
25217 @cindex .sdata/.sdata2 references (PowerPC)
25218 On embedded PowerPC systems, put global and static items less than or
25219 equal to @var{num} bytes into the small data or BSS sections instead of
25220 the normal data or BSS section. By default, @var{num} is 8. The
25221 @option{-G @var{num}} switch is also passed to the linker.
25222 All modules should be compiled with the same @option{-G @var{num}} value.
25223
25224 @item -mregnames
25225 @itemx -mno-regnames
25226 @opindex mregnames
25227 @opindex mno-regnames
25228 On System V.4 and embedded PowerPC systems do (do not) emit register
25229 names in the assembly language output using symbolic forms.
25230
25231 @item -mlongcall
25232 @itemx -mno-longcall
25233 @opindex mlongcall
25234 @opindex mno-longcall
25235 By default assume that all calls are far away so that a longer and more
25236 expensive calling sequence is required. This is required for calls
25237 farther than 32 megabytes (33,554,432 bytes) from the current location.
25238 A short call is generated if the compiler knows
25239 the call cannot be that far away. This setting can be overridden by
25240 the @code{shortcall} function attribute, or by @code{#pragma
25241 longcall(0)}.
25242
25243 Some linkers are capable of detecting out-of-range calls and generating
25244 glue code on the fly. On these systems, long calls are unnecessary and
25245 generate slower code. As of this writing, the AIX linker can do this,
25246 as can the GNU linker for PowerPC/64. It is planned to add this feature
25247 to the GNU linker for 32-bit PowerPC systems as well.
25248
25249 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25250 GCC can generate long calls using an inline PLT call sequence (see
25251 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
25252 ELFv1 (big-endian) do not support inline PLT calls.
25253
25254 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25255 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25256 addresses represent the callee and the branch island. The
25257 Darwin/PPC linker prefers the first address and generates a @code{bl
25258 callee} if the PPC @code{bl} instruction reaches the callee directly;
25259 otherwise, the linker generates @code{bl L42} to call the branch
25260 island. The branch island is appended to the body of the
25261 calling function; it computes the full 32-bit address of the callee
25262 and jumps to it.
25263
25264 On Mach-O (Darwin) systems, this option directs the compiler emit to
25265 the glue for every direct call, and the Darwin linker decides whether
25266 to use or discard it.
25267
25268 In the future, GCC may ignore all longcall specifications
25269 when the linker is known to generate glue.
25270
25271 @item -mpltseq
25272 @itemx -mno-pltseq
25273 @opindex mpltseq
25274 @opindex mno-pltseq
25275 Implement (do not implement) -fno-plt and long calls using an inline
25276 PLT call sequence that supports lazy linking and long calls to
25277 functions in dlopen'd shared libraries. Inline PLT calls are only
25278 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25279 linkers, and are enabled by default if the support is detected when
25280 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25281 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25282 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25283 linked together.
25284
25285 @item -mtls-markers
25286 @itemx -mno-tls-markers
25287 @opindex mtls-markers
25288 @opindex mno-tls-markers
25289 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25290 specifying the function argument. The relocation allows the linker to
25291 reliably associate function call with argument setup instructions for
25292 TLS optimization, which in turn allows GCC to better schedule the
25293 sequence.
25294
25295 @item -mrecip
25296 @itemx -mno-recip
25297 @opindex mrecip
25298 This option enables use of the reciprocal estimate and
25299 reciprocal square root estimate instructions with additional
25300 Newton-Raphson steps to increase precision instead of doing a divide or
25301 square root and divide for floating-point arguments. You should use
25302 the @option{-ffast-math} option when using @option{-mrecip} (or at
25303 least @option{-funsafe-math-optimizations},
25304 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25305 @option{-fno-trapping-math}). Note that while the throughput of the
25306 sequence is generally higher than the throughput of the non-reciprocal
25307 instruction, the precision of the sequence can be decreased by up to 2
25308 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25309 roots.
25310
25311 @item -mrecip=@var{opt}
25312 @opindex mrecip=opt
25313 This option controls which reciprocal estimate instructions
25314 may be used. @var{opt} is a comma-separated list of options, which may
25315 be preceded by a @code{!} to invert the option:
25316
25317 @table @samp
25318
25319 @item all
25320 Enable all estimate instructions.
25321
25322 @item default
25323 Enable the default instructions, equivalent to @option{-mrecip}.
25324
25325 @item none
25326 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25327
25328 @item div
25329 Enable the reciprocal approximation instructions for both
25330 single and double precision.
25331
25332 @item divf
25333 Enable the single-precision reciprocal approximation instructions.
25334
25335 @item divd
25336 Enable the double-precision reciprocal approximation instructions.
25337
25338 @item rsqrt
25339 Enable the reciprocal square root approximation instructions for both
25340 single and double precision.
25341
25342 @item rsqrtf
25343 Enable the single-precision reciprocal square root approximation instructions.
25344
25345 @item rsqrtd
25346 Enable the double-precision reciprocal square root approximation instructions.
25347
25348 @end table
25349
25350 So, for example, @option{-mrecip=all,!rsqrtd} enables
25351 all of the reciprocal estimate instructions, except for the
25352 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25353 which handle the double-precision reciprocal square root calculations.
25354
25355 @item -mrecip-precision
25356 @itemx -mno-recip-precision
25357 @opindex mrecip-precision
25358 Assume (do not assume) that the reciprocal estimate instructions
25359 provide higher-precision estimates than is mandated by the PowerPC
25360 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25361 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25362 The double-precision square root estimate instructions are not generated by
25363 default on low-precision machines, since they do not provide an
25364 estimate that converges after three steps.
25365
25366 @item -mveclibabi=@var{type}
25367 @opindex mveclibabi
25368 Specifies the ABI type to use for vectorizing intrinsics using an
25369 external library. The only type supported at present is @samp{mass},
25370 which specifies to use IBM's Mathematical Acceleration Subsystem
25371 (MASS) libraries for vectorizing intrinsics using external libraries.
25372 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25373 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25374 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25375 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25376 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25377 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25378 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25379 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25380 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25381 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25382 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25383 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25384 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25385 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25386 for power7. Both @option{-ftree-vectorize} and
25387 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25388 libraries must be specified at link time.
25389
25390 @item -mfriz
25391 @itemx -mno-friz
25392 @opindex mfriz
25393 Generate (do not generate) the @code{friz} instruction when the
25394 @option{-funsafe-math-optimizations} option is used to optimize
25395 rounding of floating-point values to 64-bit integer and back to floating
25396 point. The @code{friz} instruction does not return the same value if
25397 the floating-point number is too large to fit in an integer.
25398
25399 @item -mpointers-to-nested-functions
25400 @itemx -mno-pointers-to-nested-functions
25401 @opindex mpointers-to-nested-functions
25402 Generate (do not generate) code to load up the static chain register
25403 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25404 systems where a function pointer points to a 3-word descriptor giving
25405 the function address, TOC value to be loaded in register @code{r2}, and
25406 static chain value to be loaded in register @code{r11}. The
25407 @option{-mpointers-to-nested-functions} is on by default. You cannot
25408 call through pointers to nested functions or pointers
25409 to functions compiled in other languages that use the static chain if
25410 you use @option{-mno-pointers-to-nested-functions}.
25411
25412 @item -msave-toc-indirect
25413 @itemx -mno-save-toc-indirect
25414 @opindex msave-toc-indirect
25415 Generate (do not generate) code to save the TOC value in the reserved
25416 stack location in the function prologue if the function calls through
25417 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25418 saved in the prologue, it is saved just before the call through the
25419 pointer. The @option{-mno-save-toc-indirect} option is the default.
25420
25421 @item -mcompat-align-parm
25422 @itemx -mno-compat-align-parm
25423 @opindex mcompat-align-parm
25424 Generate (do not generate) code to pass structure parameters with a
25425 maximum alignment of 64 bits, for compatibility with older versions
25426 of GCC.
25427
25428 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25429 structure parameter on a 128-bit boundary when that structure contained
25430 a member requiring 128-bit alignment. This is corrected in more
25431 recent versions of GCC. This option may be used to generate code
25432 that is compatible with functions compiled with older versions of
25433 GCC.
25434
25435 The @option{-mno-compat-align-parm} option is the default.
25436
25437 @item -mstack-protector-guard=@var{guard}
25438 @itemx -mstack-protector-guard-reg=@var{reg}
25439 @itemx -mstack-protector-guard-offset=@var{offset}
25440 @itemx -mstack-protector-guard-symbol=@var{symbol}
25441 @opindex mstack-protector-guard
25442 @opindex mstack-protector-guard-reg
25443 @opindex mstack-protector-guard-offset
25444 @opindex mstack-protector-guard-symbol
25445 Generate stack protection code using canary at @var{guard}. Supported
25446 locations are @samp{global} for global canary or @samp{tls} for per-thread
25447 canary in the TLS block (the default with GNU libc version 2.4 or later).
25448
25449 With the latter choice the options
25450 @option{-mstack-protector-guard-reg=@var{reg}} and
25451 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25452 which register to use as base register for reading the canary, and from what
25453 offset from that base register. The default for those is as specified in the
25454 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25455 the offset with a symbol reference to a canary in the TLS block.
25456
25457 @item -mpcrel
25458 @itemx -mno-pcrel
25459 @opindex mpcrel
25460 @opindex mno-pcrel
25461 Generate (do not generate) pc-relative addressing when the option
25462 @option{-mcpu=future} is used.
25463 @end table
25464
25465 @node RX Options
25466 @subsection RX Options
25467 @cindex RX Options
25468
25469 These command-line options are defined for RX targets:
25470
25471 @table @gcctabopt
25472 @item -m64bit-doubles
25473 @itemx -m32bit-doubles
25474 @opindex m64bit-doubles
25475 @opindex m32bit-doubles
25476 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25477 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25478 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25479 works on 32-bit values, which is why the default is
25480 @option{-m32bit-doubles}.
25481
25482 @item -fpu
25483 @itemx -nofpu
25484 @opindex fpu
25485 @opindex nofpu
25486 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25487 floating-point hardware. The default is enabled for the RX600
25488 series and disabled for the RX200 series.
25489
25490 Floating-point instructions are only generated for 32-bit floating-point
25491 values, however, so the FPU hardware is not used for doubles if the
25492 @option{-m64bit-doubles} option is used.
25493
25494 @emph{Note} If the @option{-fpu} option is enabled then
25495 @option{-funsafe-math-optimizations} is also enabled automatically.
25496 This is because the RX FPU instructions are themselves unsafe.
25497
25498 @item -mcpu=@var{name}
25499 @opindex mcpu
25500 Selects the type of RX CPU to be targeted. Currently three types are
25501 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25502 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25503
25504 The only difference between @samp{RX600} and @samp{RX610} is that the
25505 @samp{RX610} does not support the @code{MVTIPL} instruction.
25506
25507 The @samp{RX200} series does not have a hardware floating-point unit
25508 and so @option{-nofpu} is enabled by default when this type is
25509 selected.
25510
25511 @item -mbig-endian-data
25512 @itemx -mlittle-endian-data
25513 @opindex mbig-endian-data
25514 @opindex mlittle-endian-data
25515 Store data (but not code) in the big-endian format. The default is
25516 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25517 format.
25518
25519 @item -msmall-data-limit=@var{N}
25520 @opindex msmall-data-limit
25521 Specifies the maximum size in bytes of global and static variables
25522 which can be placed into the small data area. Using the small data
25523 area can lead to smaller and faster code, but the size of area is
25524 limited and it is up to the programmer to ensure that the area does
25525 not overflow. Also when the small data area is used one of the RX's
25526 registers (usually @code{r13}) is reserved for use pointing to this
25527 area, so it is no longer available for use by the compiler. This
25528 could result in slower and/or larger code if variables are pushed onto
25529 the stack instead of being held in this register.
25530
25531 Note, common variables (variables that have not been initialized) and
25532 constants are not placed into the small data area as they are assigned
25533 to other sections in the output executable.
25534
25535 The default value is zero, which disables this feature. Note, this
25536 feature is not enabled by default with higher optimization levels
25537 (@option{-O2} etc) because of the potentially detrimental effects of
25538 reserving a register. It is up to the programmer to experiment and
25539 discover whether this feature is of benefit to their program. See the
25540 description of the @option{-mpid} option for a description of how the
25541 actual register to hold the small data area pointer is chosen.
25542
25543 @item -msim
25544 @itemx -mno-sim
25545 @opindex msim
25546 @opindex mno-sim
25547 Use the simulator runtime. The default is to use the libgloss
25548 board-specific runtime.
25549
25550 @item -mas100-syntax
25551 @itemx -mno-as100-syntax
25552 @opindex mas100-syntax
25553 @opindex mno-as100-syntax
25554 When generating assembler output use a syntax that is compatible with
25555 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25556 assembler, but it has some restrictions so it is not generated by default.
25557
25558 @item -mmax-constant-size=@var{N}
25559 @opindex mmax-constant-size
25560 Specifies the maximum size, in bytes, of a constant that can be used as
25561 an operand in a RX instruction. Although the RX instruction set does
25562 allow constants of up to 4 bytes in length to be used in instructions,
25563 a longer value equates to a longer instruction. Thus in some
25564 circumstances it can be beneficial to restrict the size of constants
25565 that are used in instructions. Constants that are too big are instead
25566 placed into a constant pool and referenced via register indirection.
25567
25568 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25569 or 4 means that constants of any size are allowed.
25570
25571 @item -mrelax
25572 @opindex mrelax
25573 Enable linker relaxation. Linker relaxation is a process whereby the
25574 linker attempts to reduce the size of a program by finding shorter
25575 versions of various instructions. Disabled by default.
25576
25577 @item -mint-register=@var{N}
25578 @opindex mint-register
25579 Specify the number of registers to reserve for fast interrupt handler
25580 functions. The value @var{N} can be between 0 and 4. A value of 1
25581 means that register @code{r13} is reserved for the exclusive use
25582 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25583 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25584 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25585 A value of 0, the default, does not reserve any registers.
25586
25587 @item -msave-acc-in-interrupts
25588 @opindex msave-acc-in-interrupts
25589 Specifies that interrupt handler functions should preserve the
25590 accumulator register. This is only necessary if normal code might use
25591 the accumulator register, for example because it performs 64-bit
25592 multiplications. The default is to ignore the accumulator as this
25593 makes the interrupt handlers faster.
25594
25595 @item -mpid
25596 @itemx -mno-pid
25597 @opindex mpid
25598 @opindex mno-pid
25599 Enables the generation of position independent data. When enabled any
25600 access to constant data is done via an offset from a base address
25601 held in a register. This allows the location of constant data to be
25602 determined at run time without requiring the executable to be
25603 relocated, which is a benefit to embedded applications with tight
25604 memory constraints. Data that can be modified is not affected by this
25605 option.
25606
25607 Note, using this feature reserves a register, usually @code{r13}, for
25608 the constant data base address. This can result in slower and/or
25609 larger code, especially in complicated functions.
25610
25611 The actual register chosen to hold the constant data base address
25612 depends upon whether the @option{-msmall-data-limit} and/or the
25613 @option{-mint-register} command-line options are enabled. Starting
25614 with register @code{r13} and proceeding downwards, registers are
25615 allocated first to satisfy the requirements of @option{-mint-register},
25616 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25617 is possible for the small data area register to be @code{r8} if both
25618 @option{-mint-register=4} and @option{-mpid} are specified on the
25619 command line.
25620
25621 By default this feature is not enabled. The default can be restored
25622 via the @option{-mno-pid} command-line option.
25623
25624 @item -mno-warn-multiple-fast-interrupts
25625 @itemx -mwarn-multiple-fast-interrupts
25626 @opindex mno-warn-multiple-fast-interrupts
25627 @opindex mwarn-multiple-fast-interrupts
25628 Prevents GCC from issuing a warning message if it finds more than one
25629 fast interrupt handler when it is compiling a file. The default is to
25630 issue a warning for each extra fast interrupt handler found, as the RX
25631 only supports one such interrupt.
25632
25633 @item -mallow-string-insns
25634 @itemx -mno-allow-string-insns
25635 @opindex mallow-string-insns
25636 @opindex mno-allow-string-insns
25637 Enables or disables the use of the string manipulation instructions
25638 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25639 @code{SWHILE} and also the @code{RMPA} instruction. These
25640 instructions may prefetch data, which is not safe to do if accessing
25641 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25642 for more information).
25643
25644 The default is to allow these instructions, but it is not possible for
25645 GCC to reliably detect all circumstances where a string instruction
25646 might be used to access an I/O register, so their use cannot be
25647 disabled automatically. Instead it is reliant upon the programmer to
25648 use the @option{-mno-allow-string-insns} option if their program
25649 accesses I/O space.
25650
25651 When the instructions are enabled GCC defines the C preprocessor
25652 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25653 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25654
25655 @item -mjsr
25656 @itemx -mno-jsr
25657 @opindex mjsr
25658 @opindex mno-jsr
25659 Use only (or not only) @code{JSR} instructions to access functions.
25660 This option can be used when code size exceeds the range of @code{BSR}
25661 instructions. Note that @option{-mno-jsr} does not mean to not use
25662 @code{JSR} but instead means that any type of branch may be used.
25663 @end table
25664
25665 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25666 has special significance to the RX port when used with the
25667 @code{interrupt} function attribute. This attribute indicates a
25668 function intended to process fast interrupts. GCC ensures
25669 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25670 and/or @code{r13} and only provided that the normal use of the
25671 corresponding registers have been restricted via the
25672 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25673 options.
25674
25675 @node S/390 and zSeries Options
25676 @subsection S/390 and zSeries Options
25677 @cindex S/390 and zSeries Options
25678
25679 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25680
25681 @table @gcctabopt
25682 @item -mhard-float
25683 @itemx -msoft-float
25684 @opindex mhard-float
25685 @opindex msoft-float
25686 Use (do not use) the hardware floating-point instructions and registers
25687 for floating-point operations. When @option{-msoft-float} is specified,
25688 functions in @file{libgcc.a} are used to perform floating-point
25689 operations. When @option{-mhard-float} is specified, the compiler
25690 generates IEEE floating-point instructions. This is the default.
25691
25692 @item -mhard-dfp
25693 @itemx -mno-hard-dfp
25694 @opindex mhard-dfp
25695 @opindex mno-hard-dfp
25696 Use (do not use) the hardware decimal-floating-point instructions for
25697 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25698 specified, functions in @file{libgcc.a} are used to perform
25699 decimal-floating-point operations. When @option{-mhard-dfp} is
25700 specified, the compiler generates decimal-floating-point hardware
25701 instructions. This is the default for @option{-march=z9-ec} or higher.
25702
25703 @item -mlong-double-64
25704 @itemx -mlong-double-128
25705 @opindex mlong-double-64
25706 @opindex mlong-double-128
25707 These switches control the size of @code{long double} type. A size
25708 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25709 type. This is the default.
25710
25711 @item -mbackchain
25712 @itemx -mno-backchain
25713 @opindex mbackchain
25714 @opindex mno-backchain
25715 Store (do not store) the address of the caller's frame as backchain pointer
25716 into the callee's stack frame.
25717 A backchain may be needed to allow debugging using tools that do not understand
25718 DWARF call frame information.
25719 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25720 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25721 the backchain is placed into the topmost word of the 96/160 byte register
25722 save area.
25723
25724 In general, code compiled with @option{-mbackchain} is call-compatible with
25725 code compiled with @option{-mmo-backchain}; however, use of the backchain
25726 for debugging purposes usually requires that the whole binary is built with
25727 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25728 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25729 to build a linux kernel use @option{-msoft-float}.
25730
25731 The default is to not maintain the backchain.
25732
25733 @item -mpacked-stack
25734 @itemx -mno-packed-stack
25735 @opindex mpacked-stack
25736 @opindex mno-packed-stack
25737 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25738 specified, the compiler uses the all fields of the 96/160 byte register save
25739 area only for their default purpose; unused fields still take up stack space.
25740 When @option{-mpacked-stack} is specified, register save slots are densely
25741 packed at the top of the register save area; unused space is reused for other
25742 purposes, allowing for more efficient use of the available stack space.
25743 However, when @option{-mbackchain} is also in effect, the topmost word of
25744 the save area is always used to store the backchain, and the return address
25745 register is always saved two words below the backchain.
25746
25747 As long as the stack frame backchain is not used, code generated with
25748 @option{-mpacked-stack} is call-compatible with code generated with
25749 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25750 S/390 or zSeries generated code that uses the stack frame backchain at run
25751 time, not just for debugging purposes. Such code is not call-compatible
25752 with code compiled with @option{-mpacked-stack}. Also, note that the
25753 combination of @option{-mbackchain},
25754 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25755 to build a linux kernel use @option{-msoft-float}.
25756
25757 The default is to not use the packed stack layout.
25758
25759 @item -msmall-exec
25760 @itemx -mno-small-exec
25761 @opindex msmall-exec
25762 @opindex mno-small-exec
25763 Generate (or do not generate) code using the @code{bras} instruction
25764 to do subroutine calls.
25765 This only works reliably if the total executable size does not
25766 exceed 64k. The default is to use the @code{basr} instruction instead,
25767 which does not have this limitation.
25768
25769 @item -m64
25770 @itemx -m31
25771 @opindex m64
25772 @opindex m31
25773 When @option{-m31} is specified, generate code compliant to the
25774 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25775 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25776 particular to generate 64-bit instructions. For the @samp{s390}
25777 targets, the default is @option{-m31}, while the @samp{s390x}
25778 targets default to @option{-m64}.
25779
25780 @item -mzarch
25781 @itemx -mesa
25782 @opindex mzarch
25783 @opindex mesa
25784 When @option{-mzarch} is specified, generate code using the
25785 instructions available on z/Architecture.
25786 When @option{-mesa} is specified, generate code using the
25787 instructions available on ESA/390. Note that @option{-mesa} is
25788 not possible with @option{-m64}.
25789 When generating code compliant to the GNU/Linux for S/390 ABI,
25790 the default is @option{-mesa}. When generating code compliant
25791 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25792
25793 @item -mhtm
25794 @itemx -mno-htm
25795 @opindex mhtm
25796 @opindex mno-htm
25797 The @option{-mhtm} option enables a set of builtins making use of
25798 instructions available with the transactional execution facility
25799 introduced with the IBM zEnterprise EC12 machine generation
25800 @ref{S/390 System z Built-in Functions}.
25801 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25802
25803 @item -mvx
25804 @itemx -mno-vx
25805 @opindex mvx
25806 @opindex mno-vx
25807 When @option{-mvx} is specified, generate code using the instructions
25808 available with the vector extension facility introduced with the IBM
25809 z13 machine generation.
25810 This option changes the ABI for some vector type values with regard to
25811 alignment and calling conventions. In case vector type values are
25812 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25813 command will be added to mark the resulting binary with the ABI used.
25814 @option{-mvx} is enabled by default when using @option{-march=z13}.
25815
25816 @item -mzvector
25817 @itemx -mno-zvector
25818 @opindex mzvector
25819 @opindex mno-zvector
25820 The @option{-mzvector} option enables vector language extensions and
25821 builtins using instructions available with the vector extension
25822 facility introduced with the IBM z13 machine generation.
25823 This option adds support for @samp{vector} to be used as a keyword to
25824 define vector type variables and arguments. @samp{vector} is only
25825 available when GNU extensions are enabled. It will not be expanded
25826 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25827 In addition to the GCC low-level builtins @option{-mzvector} enables
25828 a set of builtins added for compatibility with AltiVec-style
25829 implementations like Power and Cell. In order to make use of these
25830 builtins the header file @file{vecintrin.h} needs to be included.
25831 @option{-mzvector} is disabled by default.
25832
25833 @item -mmvcle
25834 @itemx -mno-mvcle
25835 @opindex mmvcle
25836 @opindex mno-mvcle
25837 Generate (or do not generate) code using the @code{mvcle} instruction
25838 to perform block moves. When @option{-mno-mvcle} is specified,
25839 use a @code{mvc} loop instead. This is the default unless optimizing for
25840 size.
25841
25842 @item -mdebug
25843 @itemx -mno-debug
25844 @opindex mdebug
25845 @opindex mno-debug
25846 Print (or do not print) additional debug information when compiling.
25847 The default is to not print debug information.
25848
25849 @item -march=@var{cpu-type}
25850 @opindex march
25851 Generate code that runs on @var{cpu-type}, which is the name of a
25852 system representing a certain processor type. Possible values for
25853 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25854 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25855 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25856 @samp{z14}/@samp{arch12}, and @samp{native}.
25857
25858 The default is @option{-march=z900}.
25859
25860 Specifying @samp{native} as cpu type can be used to select the best
25861 architecture option for the host processor.
25862 @option{-march=native} has no effect if GCC does not recognize the
25863 processor.
25864
25865 @item -mtune=@var{cpu-type}
25866 @opindex mtune
25867 Tune to @var{cpu-type} everything applicable about the generated code,
25868 except for the ABI and the set of available instructions.
25869 The list of @var{cpu-type} values is the same as for @option{-march}.
25870 The default is the value used for @option{-march}.
25871
25872 @item -mtpf-trace
25873 @itemx -mno-tpf-trace
25874 @opindex mtpf-trace
25875 @opindex mno-tpf-trace
25876 Generate code that adds (does not add) in TPF OS specific branches to trace
25877 routines in the operating system. This option is off by default, even
25878 when compiling for the TPF OS@.
25879
25880 @item -mfused-madd
25881 @itemx -mno-fused-madd
25882 @opindex mfused-madd
25883 @opindex mno-fused-madd
25884 Generate code that uses (does not use) the floating-point multiply and
25885 accumulate instructions. These instructions are generated by default if
25886 hardware floating point is used.
25887
25888 @item -mwarn-framesize=@var{framesize}
25889 @opindex mwarn-framesize
25890 Emit a warning if the current function exceeds the given frame size. Because
25891 this is a compile-time check it doesn't need to be a real problem when the program
25892 runs. It is intended to identify functions that most probably cause
25893 a stack overflow. It is useful to be used in an environment with limited stack
25894 size e.g.@: the linux kernel.
25895
25896 @item -mwarn-dynamicstack
25897 @opindex mwarn-dynamicstack
25898 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25899 arrays. This is generally a bad idea with a limited stack size.
25900
25901 @item -mstack-guard=@var{stack-guard}
25902 @itemx -mstack-size=@var{stack-size}
25903 @opindex mstack-guard
25904 @opindex mstack-size
25905 If these options are provided the S/390 back end emits additional instructions in
25906 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25907 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25908 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25909 the frame size of the compiled function is chosen.
25910 These options are intended to be used to help debugging stack overflow problems.
25911 The additionally emitted code causes only little overhead and hence can also be
25912 used in production-like systems without greater performance degradation. The given
25913 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25914 @var{stack-guard} without exceeding 64k.
25915 In order to be efficient the extra code makes the assumption that the stack starts
25916 at an address aligned to the value given by @var{stack-size}.
25917 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25918
25919 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25920 @opindex mhotpatch
25921 If the hotpatch option is enabled, a ``hot-patching'' function
25922 prologue is generated for all functions in the compilation unit.
25923 The funtion label is prepended with the given number of two-byte
25924 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25925 the label, 2 * @var{post-halfwords} bytes are appended, using the
25926 largest NOP like instructions the architecture allows (maximum
25927 1000000).
25928
25929 If both arguments are zero, hotpatching is disabled.
25930
25931 This option can be overridden for individual functions with the
25932 @code{hotpatch} attribute.
25933 @end table
25934
25935 @node Score Options
25936 @subsection Score Options
25937 @cindex Score Options
25938
25939 These options are defined for Score implementations:
25940
25941 @table @gcctabopt
25942 @item -meb
25943 @opindex meb
25944 Compile code for big-endian mode. This is the default.
25945
25946 @item -mel
25947 @opindex mel
25948 Compile code for little-endian mode.
25949
25950 @item -mnhwloop
25951 @opindex mnhwloop
25952 Disable generation of @code{bcnz} instructions.
25953
25954 @item -muls
25955 @opindex muls
25956 Enable generation of unaligned load and store instructions.
25957
25958 @item -mmac
25959 @opindex mmac
25960 Enable the use of multiply-accumulate instructions. Disabled by default.
25961
25962 @item -mscore5
25963 @opindex mscore5
25964 Specify the SCORE5 as the target architecture.
25965
25966 @item -mscore5u
25967 @opindex mscore5u
25968 Specify the SCORE5U of the target architecture.
25969
25970 @item -mscore7
25971 @opindex mscore7
25972 Specify the SCORE7 as the target architecture. This is the default.
25973
25974 @item -mscore7d
25975 @opindex mscore7d
25976 Specify the SCORE7D as the target architecture.
25977 @end table
25978
25979 @node SH Options
25980 @subsection SH Options
25981
25982 These @samp{-m} options are defined for the SH implementations:
25983
25984 @table @gcctabopt
25985 @item -m1
25986 @opindex m1
25987 Generate code for the SH1.
25988
25989 @item -m2
25990 @opindex m2
25991 Generate code for the SH2.
25992
25993 @item -m2e
25994 Generate code for the SH2e.
25995
25996 @item -m2a-nofpu
25997 @opindex m2a-nofpu
25998 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25999 that the floating-point unit is not used.
26000
26001 @item -m2a-single-only
26002 @opindex m2a-single-only
26003 Generate code for the SH2a-FPU, in such a way that no double-precision
26004 floating-point operations are used.
26005
26006 @item -m2a-single
26007 @opindex m2a-single
26008 Generate code for the SH2a-FPU assuming the floating-point unit is in
26009 single-precision mode by default.
26010
26011 @item -m2a
26012 @opindex m2a
26013 Generate code for the SH2a-FPU assuming the floating-point unit is in
26014 double-precision mode by default.
26015
26016 @item -m3
26017 @opindex m3
26018 Generate code for the SH3.
26019
26020 @item -m3e
26021 @opindex m3e
26022 Generate code for the SH3e.
26023
26024 @item -m4-nofpu
26025 @opindex m4-nofpu
26026 Generate code for the SH4 without a floating-point unit.
26027
26028 @item -m4-single-only
26029 @opindex m4-single-only
26030 Generate code for the SH4 with a floating-point unit that only
26031 supports single-precision arithmetic.
26032
26033 @item -m4-single
26034 @opindex m4-single
26035 Generate code for the SH4 assuming the floating-point unit is in
26036 single-precision mode by default.
26037
26038 @item -m4
26039 @opindex m4
26040 Generate code for the SH4.
26041
26042 @item -m4-100
26043 @opindex m4-100
26044 Generate code for SH4-100.
26045
26046 @item -m4-100-nofpu
26047 @opindex m4-100-nofpu
26048 Generate code for SH4-100 in such a way that the
26049 floating-point unit is not used.
26050
26051 @item -m4-100-single
26052 @opindex m4-100-single
26053 Generate code for SH4-100 assuming the floating-point unit is in
26054 single-precision mode by default.
26055
26056 @item -m4-100-single-only
26057 @opindex m4-100-single-only
26058 Generate code for SH4-100 in such a way that no double-precision
26059 floating-point operations are used.
26060
26061 @item -m4-200
26062 @opindex m4-200
26063 Generate code for SH4-200.
26064
26065 @item -m4-200-nofpu
26066 @opindex m4-200-nofpu
26067 Generate code for SH4-200 without in such a way that the
26068 floating-point unit is not used.
26069
26070 @item -m4-200-single
26071 @opindex m4-200-single
26072 Generate code for SH4-200 assuming the floating-point unit is in
26073 single-precision mode by default.
26074
26075 @item -m4-200-single-only
26076 @opindex m4-200-single-only
26077 Generate code for SH4-200 in such a way that no double-precision
26078 floating-point operations are used.
26079
26080 @item -m4-300
26081 @opindex m4-300
26082 Generate code for SH4-300.
26083
26084 @item -m4-300-nofpu
26085 @opindex m4-300-nofpu
26086 Generate code for SH4-300 without in such a way that the
26087 floating-point unit is not used.
26088
26089 @item -m4-300-single
26090 @opindex m4-300-single
26091 Generate code for SH4-300 in such a way that no double-precision
26092 floating-point operations are used.
26093
26094 @item -m4-300-single-only
26095 @opindex m4-300-single-only
26096 Generate code for SH4-300 in such a way that no double-precision
26097 floating-point operations are used.
26098
26099 @item -m4-340
26100 @opindex m4-340
26101 Generate code for SH4-340 (no MMU, no FPU).
26102
26103 @item -m4-500
26104 @opindex m4-500
26105 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
26106 assembler.
26107
26108 @item -m4a-nofpu
26109 @opindex m4a-nofpu
26110 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
26111 floating-point unit is not used.
26112
26113 @item -m4a-single-only
26114 @opindex m4a-single-only
26115 Generate code for the SH4a, in such a way that no double-precision
26116 floating-point operations are used.
26117
26118 @item -m4a-single
26119 @opindex m4a-single
26120 Generate code for the SH4a assuming the floating-point unit is in
26121 single-precision mode by default.
26122
26123 @item -m4a
26124 @opindex m4a
26125 Generate code for the SH4a.
26126
26127 @item -m4al
26128 @opindex m4al
26129 Same as @option{-m4a-nofpu}, except that it implicitly passes
26130 @option{-dsp} to the assembler. GCC doesn't generate any DSP
26131 instructions at the moment.
26132
26133 @item -mb
26134 @opindex mb
26135 Compile code for the processor in big-endian mode.
26136
26137 @item -ml
26138 @opindex ml
26139 Compile code for the processor in little-endian mode.
26140
26141 @item -mdalign
26142 @opindex mdalign
26143 Align doubles at 64-bit boundaries. Note that this changes the calling
26144 conventions, and thus some functions from the standard C library do
26145 not work unless you recompile it first with @option{-mdalign}.
26146
26147 @item -mrelax
26148 @opindex mrelax
26149 Shorten some address references at link time, when possible; uses the
26150 linker option @option{-relax}.
26151
26152 @item -mbigtable
26153 @opindex mbigtable
26154 Use 32-bit offsets in @code{switch} tables. The default is to use
26155 16-bit offsets.
26156
26157 @item -mbitops
26158 @opindex mbitops
26159 Enable the use of bit manipulation instructions on SH2A.
26160
26161 @item -mfmovd
26162 @opindex mfmovd
26163 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
26164 alignment constraints.
26165
26166 @item -mrenesas
26167 @opindex mrenesas
26168 Comply with the calling conventions defined by Renesas.
26169
26170 @item -mno-renesas
26171 @opindex mno-renesas
26172 Comply with the calling conventions defined for GCC before the Renesas
26173 conventions were available. This option is the default for all
26174 targets of the SH toolchain.
26175
26176 @item -mnomacsave
26177 @opindex mnomacsave
26178 Mark the @code{MAC} register as call-clobbered, even if
26179 @option{-mrenesas} is given.
26180
26181 @item -mieee
26182 @itemx -mno-ieee
26183 @opindex mieee
26184 @opindex mno-ieee
26185 Control the IEEE compliance of floating-point comparisons, which affects the
26186 handling of cases where the result of a comparison is unordered. By default
26187 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
26188 enabled @option{-mno-ieee} is implicitly set, which results in faster
26189 floating-point greater-equal and less-equal comparisons. The implicit settings
26190 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
26191
26192 @item -minline-ic_invalidate
26193 @opindex minline-ic_invalidate
26194 Inline code to invalidate instruction cache entries after setting up
26195 nested function trampolines.
26196 This option has no effect if @option{-musermode} is in effect and the selected
26197 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26198 instruction.
26199 If the selected code generation option does not allow the use of the @code{icbi}
26200 instruction, and @option{-musermode} is not in effect, the inlined code
26201 manipulates the instruction cache address array directly with an associative
26202 write. This not only requires privileged mode at run time, but it also
26203 fails if the cache line had been mapped via the TLB and has become unmapped.
26204
26205 @item -misize
26206 @opindex misize
26207 Dump instruction size and location in the assembly code.
26208
26209 @item -mpadstruct
26210 @opindex mpadstruct
26211 This option is deprecated. It pads structures to multiple of 4 bytes,
26212 which is incompatible with the SH ABI@.
26213
26214 @item -matomic-model=@var{model}
26215 @opindex matomic-model=@var{model}
26216 Sets the model of atomic operations and additional parameters as a comma
26217 separated list. For details on the atomic built-in functions see
26218 @ref{__atomic Builtins}. The following models and parameters are supported:
26219
26220 @table @samp
26221
26222 @item none
26223 Disable compiler generated atomic sequences and emit library calls for atomic
26224 operations. This is the default if the target is not @code{sh*-*-linux*}.
26225
26226 @item soft-gusa
26227 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26228 built-in functions. The generated atomic sequences require additional support
26229 from the interrupt/exception handling code of the system and are only suitable
26230 for SH3* and SH4* single-core systems. This option is enabled by default when
26231 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26232 this option also partially utilizes the hardware atomic instructions
26233 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26234 @samp{strict} is specified.
26235
26236 @item soft-tcb
26237 Generate software atomic sequences that use a variable in the thread control
26238 block. This is a variation of the gUSA sequences which can also be used on
26239 SH1* and SH2* targets. The generated atomic sequences require additional
26240 support from the interrupt/exception handling code of the system and are only
26241 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26242 parameter has to be specified as well.
26243
26244 @item soft-imask
26245 Generate software atomic sequences that temporarily disable interrupts by
26246 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26247 in privileged mode and is only suitable for single-core systems. Additional
26248 support from the interrupt/exception handling code of the system is not
26249 required. This model is enabled by default when the target is
26250 @code{sh*-*-linux*} and SH1* or SH2*.
26251
26252 @item hard-llcs
26253 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26254 instructions only. This is only available on SH4A and is suitable for
26255 multi-core systems. Since the hardware instructions support only 32 bit atomic
26256 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26257 Code compiled with this option is also compatible with other software
26258 atomic model interrupt/exception handling systems if executed on an SH4A
26259 system. Additional support from the interrupt/exception handling code of the
26260 system is not required for this model.
26261
26262 @item gbr-offset=
26263 This parameter specifies the offset in bytes of the variable in the thread
26264 control block structure that should be used by the generated atomic sequences
26265 when the @samp{soft-tcb} model has been selected. For other models this
26266 parameter is ignored. The specified value must be an integer multiple of four
26267 and in the range 0-1020.
26268
26269 @item strict
26270 This parameter prevents mixed usage of multiple atomic models, even if they
26271 are compatible, and makes the compiler generate atomic sequences of the
26272 specified model only.
26273
26274 @end table
26275
26276 @item -mtas
26277 @opindex mtas
26278 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26279 Notice that depending on the particular hardware and software configuration
26280 this can degrade overall performance due to the operand cache line flushes
26281 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26282 processors the @code{tas.b} instruction must be used with caution since it
26283 can result in data corruption for certain cache configurations.
26284
26285 @item -mprefergot
26286 @opindex mprefergot
26287 When generating position-independent code, emit function calls using
26288 the Global Offset Table instead of the Procedure Linkage Table.
26289
26290 @item -musermode
26291 @itemx -mno-usermode
26292 @opindex musermode
26293 @opindex mno-usermode
26294 Don't allow (allow) the compiler generating privileged mode code. Specifying
26295 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26296 inlined code would not work in user mode. @option{-musermode} is the default
26297 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26298 @option{-musermode} has no effect, since there is no user mode.
26299
26300 @item -multcost=@var{number}
26301 @opindex multcost=@var{number}
26302 Set the cost to assume for a multiply insn.
26303
26304 @item -mdiv=@var{strategy}
26305 @opindex mdiv=@var{strategy}
26306 Set the division strategy to be used for integer division operations.
26307 @var{strategy} can be one of:
26308
26309 @table @samp
26310
26311 @item call-div1
26312 Calls a library function that uses the single-step division instruction
26313 @code{div1} to perform the operation. Division by zero calculates an
26314 unspecified result and does not trap. This is the default except for SH4,
26315 SH2A and SHcompact.
26316
26317 @item call-fp
26318 Calls a library function that performs the operation in double precision
26319 floating point. Division by zero causes a floating-point exception. This is
26320 the default for SHcompact with FPU. Specifying this for targets that do not
26321 have a double precision FPU defaults to @code{call-div1}.
26322
26323 @item call-table
26324 Calls a library function that uses a lookup table for small divisors and
26325 the @code{div1} instruction with case distinction for larger divisors. Division
26326 by zero calculates an unspecified result and does not trap. This is the default
26327 for SH4. Specifying this for targets that do not have dynamic shift
26328 instructions defaults to @code{call-div1}.
26329
26330 @end table
26331
26332 When a division strategy has not been specified the default strategy is
26333 selected based on the current target. For SH2A the default strategy is to
26334 use the @code{divs} and @code{divu} instructions instead of library function
26335 calls.
26336
26337 @item -maccumulate-outgoing-args
26338 @opindex maccumulate-outgoing-args
26339 Reserve space once for outgoing arguments in the function prologue rather
26340 than around each call. Generally beneficial for performance and size. Also
26341 needed for unwinding to avoid changing the stack frame around conditional code.
26342
26343 @item -mdivsi3_libfunc=@var{name}
26344 @opindex mdivsi3_libfunc=@var{name}
26345 Set the name of the library function used for 32-bit signed division to
26346 @var{name}.
26347 This only affects the name used in the @samp{call} division strategies, and
26348 the compiler still expects the same sets of input/output/clobbered registers as
26349 if this option were not present.
26350
26351 @item -mfixed-range=@var{register-range}
26352 @opindex mfixed-range
26353 Generate code treating the given register range as fixed registers.
26354 A fixed register is one that the register allocator cannot use. This is
26355 useful when compiling kernel code. A register range is specified as
26356 two registers separated by a dash. Multiple register ranges can be
26357 specified separated by a comma.
26358
26359 @item -mbranch-cost=@var{num}
26360 @opindex mbranch-cost=@var{num}
26361 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26362 make the compiler try to generate more branch-free code if possible.
26363 If not specified the value is selected depending on the processor type that
26364 is being compiled for.
26365
26366 @item -mzdcbranch
26367 @itemx -mno-zdcbranch
26368 @opindex mzdcbranch
26369 @opindex mno-zdcbranch
26370 Assume (do not assume) that zero displacement conditional branch instructions
26371 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26372 compiler prefers zero displacement branch code sequences. This is
26373 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26374 disabled by specifying @option{-mno-zdcbranch}.
26375
26376 @item -mcbranch-force-delay-slot
26377 @opindex mcbranch-force-delay-slot
26378 Force the usage of delay slots for conditional branches, which stuffs the delay
26379 slot with a @code{nop} if a suitable instruction cannot be found. By default
26380 this option is disabled. It can be enabled to work around hardware bugs as
26381 found in the original SH7055.
26382
26383 @item -mfused-madd
26384 @itemx -mno-fused-madd
26385 @opindex mfused-madd
26386 @opindex mno-fused-madd
26387 Generate code that uses (does not use) the floating-point multiply and
26388 accumulate instructions. These instructions are generated by default
26389 if hardware floating point is used. The machine-dependent
26390 @option{-mfused-madd} option is now mapped to the machine-independent
26391 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26392 mapped to @option{-ffp-contract=off}.
26393
26394 @item -mfsca
26395 @itemx -mno-fsca
26396 @opindex mfsca
26397 @opindex mno-fsca
26398 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26399 and cosine approximations. The option @option{-mfsca} must be used in
26400 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26401 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26402 approximations even if @option{-funsafe-math-optimizations} is in effect.
26403
26404 @item -mfsrra
26405 @itemx -mno-fsrra
26406 @opindex mfsrra
26407 @opindex mno-fsrra
26408 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26409 reciprocal square root approximations. The option @option{-mfsrra} must be used
26410 in combination with @option{-funsafe-math-optimizations} and
26411 @option{-ffinite-math-only}. It is enabled by default when generating code for
26412 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26413 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26414 in effect.
26415
26416 @item -mpretend-cmove
26417 @opindex mpretend-cmove
26418 Prefer zero-displacement conditional branches for conditional move instruction
26419 patterns. This can result in faster code on the SH4 processor.
26420
26421 @item -mfdpic
26422 @opindex fdpic
26423 Generate code using the FDPIC ABI.
26424
26425 @end table
26426
26427 @node Solaris 2 Options
26428 @subsection Solaris 2 Options
26429 @cindex Solaris 2 options
26430
26431 These @samp{-m} options are supported on Solaris 2:
26432
26433 @table @gcctabopt
26434 @item -mclear-hwcap
26435 @opindex mclear-hwcap
26436 @option{-mclear-hwcap} tells the compiler to remove the hardware
26437 capabilities generated by the Solaris assembler. This is only necessary
26438 when object files use ISA extensions not supported by the current
26439 machine, but check at runtime whether or not to use them.
26440
26441 @item -mimpure-text
26442 @opindex mimpure-text
26443 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26444 the compiler to not pass @option{-z text} to the linker when linking a
26445 shared object. Using this option, you can link position-dependent
26446 code into a shared object.
26447
26448 @option{-mimpure-text} suppresses the ``relocations remain against
26449 allocatable but non-writable sections'' linker error message.
26450 However, the necessary relocations trigger copy-on-write, and the
26451 shared object is not actually shared across processes. Instead of
26452 using @option{-mimpure-text}, you should compile all source code with
26453 @option{-fpic} or @option{-fPIC}.
26454
26455 @end table
26456
26457 These switches are supported in addition to the above on Solaris 2:
26458
26459 @table @gcctabopt
26460 @item -pthreads
26461 @opindex pthreads
26462 This is a synonym for @option{-pthread}.
26463 @end table
26464
26465 @node SPARC Options
26466 @subsection SPARC Options
26467 @cindex SPARC options
26468
26469 These @samp{-m} options are supported on the SPARC:
26470
26471 @table @gcctabopt
26472 @item -mno-app-regs
26473 @itemx -mapp-regs
26474 @opindex mno-app-regs
26475 @opindex mapp-regs
26476 Specify @option{-mapp-regs} to generate output using the global registers
26477 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26478 global register 1, each global register 2 through 4 is then treated as an
26479 allocable register that is clobbered by function calls. This is the default.
26480
26481 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26482 specify @option{-mno-app-regs}. You should compile libraries and system
26483 software with this option.
26484
26485 @item -mflat
26486 @itemx -mno-flat
26487 @opindex mflat
26488 @opindex mno-flat
26489 With @option{-mflat}, the compiler does not generate save/restore instructions
26490 and uses a ``flat'' or single register window model. This model is compatible
26491 with the regular register window model. The local registers and the input
26492 registers (0--5) are still treated as ``call-saved'' registers and are
26493 saved on the stack as needed.
26494
26495 With @option{-mno-flat} (the default), the compiler generates save/restore
26496 instructions (except for leaf functions). This is the normal operating mode.
26497
26498 @item -mfpu
26499 @itemx -mhard-float
26500 @opindex mfpu
26501 @opindex mhard-float
26502 Generate output containing floating-point instructions. This is the
26503 default.
26504
26505 @item -mno-fpu
26506 @itemx -msoft-float
26507 @opindex mno-fpu
26508 @opindex msoft-float
26509 Generate output containing library calls for floating point.
26510 @strong{Warning:} the requisite libraries are not available for all SPARC
26511 targets. Normally the facilities of the machine's usual C compiler are
26512 used, but this cannot be done directly in cross-compilation. You must make
26513 your own arrangements to provide suitable library functions for
26514 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26515 @samp{sparclite-*-*} do provide software floating-point support.
26516
26517 @option{-msoft-float} changes the calling convention in the output file;
26518 therefore, it is only useful if you compile @emph{all} of a program with
26519 this option. In particular, you need to compile @file{libgcc.a}, the
26520 library that comes with GCC, with @option{-msoft-float} in order for
26521 this to work.
26522
26523 @item -mhard-quad-float
26524 @opindex mhard-quad-float
26525 Generate output containing quad-word (long double) floating-point
26526 instructions.
26527
26528 @item -msoft-quad-float
26529 @opindex msoft-quad-float
26530 Generate output containing library calls for quad-word (long double)
26531 floating-point instructions. The functions called are those specified
26532 in the SPARC ABI@. This is the default.
26533
26534 As of this writing, there are no SPARC implementations that have hardware
26535 support for the quad-word floating-point instructions. They all invoke
26536 a trap handler for one of these instructions, and then the trap handler
26537 emulates the effect of the instruction. Because of the trap handler overhead,
26538 this is much slower than calling the ABI library routines. Thus the
26539 @option{-msoft-quad-float} option is the default.
26540
26541 @item -mno-unaligned-doubles
26542 @itemx -munaligned-doubles
26543 @opindex mno-unaligned-doubles
26544 @opindex munaligned-doubles
26545 Assume that doubles have 8-byte alignment. This is the default.
26546
26547 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26548 alignment only if they are contained in another type, or if they have an
26549 absolute address. Otherwise, it assumes they have 4-byte alignment.
26550 Specifying this option avoids some rare compatibility problems with code
26551 generated by other compilers. It is not the default because it results
26552 in a performance loss, especially for floating-point code.
26553
26554 @item -muser-mode
26555 @itemx -mno-user-mode
26556 @opindex muser-mode
26557 @opindex mno-user-mode
26558 Do not generate code that can only run in supervisor mode. This is relevant
26559 only for the @code{casa} instruction emitted for the LEON3 processor. This
26560 is the default.
26561
26562 @item -mfaster-structs
26563 @itemx -mno-faster-structs
26564 @opindex mfaster-structs
26565 @opindex mno-faster-structs
26566 With @option{-mfaster-structs}, the compiler assumes that structures
26567 should have 8-byte alignment. This enables the use of pairs of
26568 @code{ldd} and @code{std} instructions for copies in structure
26569 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26570 However, the use of this changed alignment directly violates the SPARC
26571 ABI@. Thus, it's intended only for use on targets where the developer
26572 acknowledges that their resulting code is not directly in line with
26573 the rules of the ABI@.
26574
26575 @item -mstd-struct-return
26576 @itemx -mno-std-struct-return
26577 @opindex mstd-struct-return
26578 @opindex mno-std-struct-return
26579 With @option{-mstd-struct-return}, the compiler generates checking code
26580 in functions returning structures or unions to detect size mismatches
26581 between the two sides of function calls, as per the 32-bit ABI@.
26582
26583 The default is @option{-mno-std-struct-return}. This option has no effect
26584 in 64-bit mode.
26585
26586 @item -mlra
26587 @itemx -mno-lra
26588 @opindex mlra
26589 @opindex mno-lra
26590 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26591 so @option{-mno-lra} needs to be passed to get old Reload.
26592
26593 @item -mcpu=@var{cpu_type}
26594 @opindex mcpu
26595 Set the instruction set, register set, and instruction scheduling parameters
26596 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26597 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26598 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26599 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26600 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26601 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26602
26603 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26604 which selects the best architecture option for the host processor.
26605 @option{-mcpu=native} has no effect if GCC does not recognize
26606 the processor.
26607
26608 Default instruction scheduling parameters are used for values that select
26609 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26610 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26611
26612 Here is a list of each supported architecture and their supported
26613 implementations.
26614
26615 @table @asis
26616 @item v7
26617 cypress, leon3v7
26618
26619 @item v8
26620 supersparc, hypersparc, leon, leon3
26621
26622 @item sparclite
26623 f930, f934, sparclite86x
26624
26625 @item sparclet
26626 tsc701
26627
26628 @item v9
26629 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26630 niagara7, m8
26631 @end table
26632
26633 By default (unless configured otherwise), GCC generates code for the V7
26634 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26635 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26636 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26637 SPARCStation 1, 2, IPX etc.
26638
26639 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26640 architecture. The only difference from V7 code is that the compiler emits
26641 the integer multiply and integer divide instructions which exist in SPARC-V8
26642 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26643 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26644 2000 series.
26645
26646 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26647 the SPARC architecture. This adds the integer multiply, integer divide step
26648 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26649 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26650 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26651 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26652 MB86934 chip, which is the more recent SPARClite with FPU@.
26653
26654 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26655 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26656 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26657 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26658 optimizes it for the TEMIC SPARClet chip.
26659
26660 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26661 architecture. This adds 64-bit integer and floating-point move instructions,
26662 3 additional floating-point condition code registers and conditional move
26663 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26664 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26665 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26666 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26667 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26668 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26669 additionally optimizes it for Sun UltraSPARC T2 chips. With
26670 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26671 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26672 additionally optimizes it for Sun UltraSPARC T4 chips. With
26673 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26674 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26675 additionally optimizes it for Oracle M8 chips.
26676
26677 @item -mtune=@var{cpu_type}
26678 @opindex mtune
26679 Set the instruction scheduling parameters for machine type
26680 @var{cpu_type}, but do not set the instruction set or register set that the
26681 option @option{-mcpu=@var{cpu_type}} does.
26682
26683 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26684 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26685 that select a particular CPU implementation. Those are
26686 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26687 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26688 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26689 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26690 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26691 and GNU/Linux toolchains, @samp{native} can also be used.
26692
26693 @item -mv8plus
26694 @itemx -mno-v8plus
26695 @opindex mv8plus
26696 @opindex mno-v8plus
26697 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26698 difference from the V8 ABI is that the global and out registers are
26699 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26700 mode for all SPARC-V9 processors.
26701
26702 @item -mvis
26703 @itemx -mno-vis
26704 @opindex mvis
26705 @opindex mno-vis
26706 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26707 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26708
26709 @item -mvis2
26710 @itemx -mno-vis2
26711 @opindex mvis2
26712 @opindex mno-vis2
26713 With @option{-mvis2}, GCC generates code that takes advantage of
26714 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26715 default is @option{-mvis2} when targeting a cpu that supports such
26716 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26717 also sets @option{-mvis}.
26718
26719 @item -mvis3
26720 @itemx -mno-vis3
26721 @opindex mvis3
26722 @opindex mno-vis3
26723 With @option{-mvis3}, GCC generates code that takes advantage of
26724 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26725 default is @option{-mvis3} when targeting a cpu that supports such
26726 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26727 also sets @option{-mvis2} and @option{-mvis}.
26728
26729 @item -mvis4
26730 @itemx -mno-vis4
26731 @opindex mvis4
26732 @opindex mno-vis4
26733 With @option{-mvis4}, GCC generates code that takes advantage of
26734 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26735 default is @option{-mvis4} when targeting a cpu that supports such
26736 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26737 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26738
26739 @item -mvis4b
26740 @itemx -mno-vis4b
26741 @opindex mvis4b
26742 @opindex mno-vis4b
26743 With @option{-mvis4b}, GCC generates code that takes advantage of
26744 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26745 the additional VIS instructions introduced in the Oracle SPARC
26746 Architecture 2017. The default is @option{-mvis4b} when targeting a
26747 cpu that supports such instructions, such as m8 and later. Setting
26748 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26749 @option{-mvis2} and @option{-mvis}.
26750
26751 @item -mcbcond
26752 @itemx -mno-cbcond
26753 @opindex mcbcond
26754 @opindex mno-cbcond
26755 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26756 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26757 when targeting a CPU that supports such instructions, such as Niagara-4 and
26758 later.
26759
26760 @item -mfmaf
26761 @itemx -mno-fmaf
26762 @opindex mfmaf
26763 @opindex mno-fmaf
26764 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26765 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26766 when targeting a CPU that supports such instructions, such as Niagara-3 and
26767 later.
26768
26769 @item -mfsmuld
26770 @itemx -mno-fsmuld
26771 @opindex mfsmuld
26772 @opindex mno-fsmuld
26773 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26774 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26775 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26776 or V9 with FPU except @option{-mcpu=leon}.
26777
26778 @item -mpopc
26779 @itemx -mno-popc
26780 @opindex mpopc
26781 @opindex mno-popc
26782 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26783 Population Count instruction. The default is @option{-mpopc}
26784 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26785 later.
26786
26787 @item -msubxc
26788 @itemx -mno-subxc
26789 @opindex msubxc
26790 @opindex mno-subxc
26791 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26792 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26793 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26794 later.
26795
26796 @item -mfix-at697f
26797 @opindex mfix-at697f
26798 Enable the documented workaround for the single erratum of the Atmel AT697F
26799 processor (which corresponds to erratum #13 of the AT697E processor).
26800
26801 @item -mfix-ut699
26802 @opindex mfix-ut699
26803 Enable the documented workarounds for the floating-point errata and the data
26804 cache nullify errata of the UT699 processor.
26805
26806 @item -mfix-ut700
26807 @opindex mfix-ut700
26808 Enable the documented workaround for the back-to-back store errata of
26809 the UT699E/UT700 processor.
26810
26811 @item -mfix-gr712rc
26812 @opindex mfix-gr712rc
26813 Enable the documented workaround for the back-to-back store errata of
26814 the GR712RC processor.
26815 @end table
26816
26817 These @samp{-m} options are supported in addition to the above
26818 on SPARC-V9 processors in 64-bit environments:
26819
26820 @table @gcctabopt
26821 @item -m32
26822 @itemx -m64
26823 @opindex m32
26824 @opindex m64
26825 Generate code for a 32-bit or 64-bit environment.
26826 The 32-bit environment sets int, long and pointer to 32 bits.
26827 The 64-bit environment sets int to 32 bits and long and pointer
26828 to 64 bits.
26829
26830 @item -mcmodel=@var{which}
26831 @opindex mcmodel
26832 Set the code model to one of
26833
26834 @table @samp
26835 @item medlow
26836 The Medium/Low code model: 64-bit addresses, programs
26837 must be linked in the low 32 bits of memory. Programs can be statically
26838 or dynamically linked.
26839
26840 @item medmid
26841 The Medium/Middle code model: 64-bit addresses, programs
26842 must be linked in the low 44 bits of memory, the text and data segments must
26843 be less than 2GB in size and the data segment must be located within 2GB of
26844 the text segment.
26845
26846 @item medany
26847 The Medium/Anywhere code model: 64-bit addresses, programs
26848 may be linked anywhere in memory, the text and data segments must be less
26849 than 2GB in size and the data segment must be located within 2GB of the
26850 text segment.
26851
26852 @item embmedany
26853 The Medium/Anywhere code model for embedded systems:
26854 64-bit addresses, the text and data segments must be less than 2GB in
26855 size, both starting anywhere in memory (determined at link time). The
26856 global register %g4 points to the base of the data segment. Programs
26857 are statically linked and PIC is not supported.
26858 @end table
26859
26860 @item -mmemory-model=@var{mem-model}
26861 @opindex mmemory-model
26862 Set the memory model in force on the processor to one of
26863
26864 @table @samp
26865 @item default
26866 The default memory model for the processor and operating system.
26867
26868 @item rmo
26869 Relaxed Memory Order
26870
26871 @item pso
26872 Partial Store Order
26873
26874 @item tso
26875 Total Store Order
26876
26877 @item sc
26878 Sequential Consistency
26879 @end table
26880
26881 These memory models are formally defined in Appendix D of the SPARC-V9
26882 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26883
26884 @item -mstack-bias
26885 @itemx -mno-stack-bias
26886 @opindex mstack-bias
26887 @opindex mno-stack-bias
26888 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26889 frame pointer if present, are offset by @minus{}2047 which must be added back
26890 when making stack frame references. This is the default in 64-bit mode.
26891 Otherwise, assume no such offset is present.
26892 @end table
26893
26894 @node System V Options
26895 @subsection Options for System V
26896
26897 These additional options are available on System V Release 4 for
26898 compatibility with other compilers on those systems:
26899
26900 @table @gcctabopt
26901 @item -G
26902 @opindex G
26903 Create a shared object.
26904 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26905
26906 @item -Qy
26907 @opindex Qy
26908 Identify the versions of each tool used by the compiler, in a
26909 @code{.ident} assembler directive in the output.
26910
26911 @item -Qn
26912 @opindex Qn
26913 Refrain from adding @code{.ident} directives to the output file (this is
26914 the default).
26915
26916 @item -YP,@var{dirs}
26917 @opindex YP
26918 Search the directories @var{dirs}, and no others, for libraries
26919 specified with @option{-l}.
26920
26921 @item -Ym,@var{dir}
26922 @opindex Ym
26923 Look in the directory @var{dir} to find the M4 preprocessor.
26924 The assembler uses this option.
26925 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26926 @c the generic assembler that comes with Solaris takes just -Ym.
26927 @end table
26928
26929 @node TILE-Gx Options
26930 @subsection TILE-Gx Options
26931 @cindex TILE-Gx options
26932
26933 These @samp{-m} options are supported on the TILE-Gx:
26934
26935 @table @gcctabopt
26936 @item -mcmodel=small
26937 @opindex mcmodel=small
26938 Generate code for the small model. The distance for direct calls is
26939 limited to 500M in either direction. PC-relative addresses are 32
26940 bits. Absolute addresses support the full address range.
26941
26942 @item -mcmodel=large
26943 @opindex mcmodel=large
26944 Generate code for the large model. There is no limitation on call
26945 distance, pc-relative addresses, or absolute addresses.
26946
26947 @item -mcpu=@var{name}
26948 @opindex mcpu
26949 Selects the type of CPU to be targeted. Currently the only supported
26950 type is @samp{tilegx}.
26951
26952 @item -m32
26953 @itemx -m64
26954 @opindex m32
26955 @opindex m64
26956 Generate code for a 32-bit or 64-bit environment. The 32-bit
26957 environment sets int, long, and pointer to 32 bits. The 64-bit
26958 environment sets int to 32 bits and long and pointer to 64 bits.
26959
26960 @item -mbig-endian
26961 @itemx -mlittle-endian
26962 @opindex mbig-endian
26963 @opindex mlittle-endian
26964 Generate code in big/little endian mode, respectively.
26965 @end table
26966
26967 @node TILEPro Options
26968 @subsection TILEPro Options
26969 @cindex TILEPro options
26970
26971 These @samp{-m} options are supported on the TILEPro:
26972
26973 @table @gcctabopt
26974 @item -mcpu=@var{name}
26975 @opindex mcpu
26976 Selects the type of CPU to be targeted. Currently the only supported
26977 type is @samp{tilepro}.
26978
26979 @item -m32
26980 @opindex m32
26981 Generate code for a 32-bit environment, which sets int, long, and
26982 pointer to 32 bits. This is the only supported behavior so the flag
26983 is essentially ignored.
26984 @end table
26985
26986 @node V850 Options
26987 @subsection V850 Options
26988 @cindex V850 Options
26989
26990 These @samp{-m} options are defined for V850 implementations:
26991
26992 @table @gcctabopt
26993 @item -mlong-calls
26994 @itemx -mno-long-calls
26995 @opindex mlong-calls
26996 @opindex mno-long-calls
26997 Treat all calls as being far away (near). If calls are assumed to be
26998 far away, the compiler always loads the function's address into a
26999 register, and calls indirect through the pointer.
27000
27001 @item -mno-ep
27002 @itemx -mep
27003 @opindex mno-ep
27004 @opindex mep
27005 Do not optimize (do optimize) basic blocks that use the same index
27006 pointer 4 or more times to copy pointer into the @code{ep} register, and
27007 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
27008 option is on by default if you optimize.
27009
27010 @item -mno-prolog-function
27011 @itemx -mprolog-function
27012 @opindex mno-prolog-function
27013 @opindex mprolog-function
27014 Do not use (do use) external functions to save and restore registers
27015 at the prologue and epilogue of a function. The external functions
27016 are slower, but use less code space if more than one function saves
27017 the same number of registers. The @option{-mprolog-function} option
27018 is on by default if you optimize.
27019
27020 @item -mspace
27021 @opindex mspace
27022 Try to make the code as small as possible. At present, this just turns
27023 on the @option{-mep} and @option{-mprolog-function} options.
27024
27025 @item -mtda=@var{n}
27026 @opindex mtda
27027 Put static or global variables whose size is @var{n} bytes or less into
27028 the tiny data area that register @code{ep} points to. The tiny data
27029 area can hold up to 256 bytes in total (128 bytes for byte references).
27030
27031 @item -msda=@var{n}
27032 @opindex msda
27033 Put static or global variables whose size is @var{n} bytes or less into
27034 the small data area that register @code{gp} points to. The small data
27035 area can hold up to 64 kilobytes.
27036
27037 @item -mzda=@var{n}
27038 @opindex mzda
27039 Put static or global variables whose size is @var{n} bytes or less into
27040 the first 32 kilobytes of memory.
27041
27042 @item -mv850
27043 @opindex mv850
27044 Specify that the target processor is the V850.
27045
27046 @item -mv850e3v5
27047 @opindex mv850e3v5
27048 Specify that the target processor is the V850E3V5. The preprocessor
27049 constant @code{__v850e3v5__} is defined if this option is used.
27050
27051 @item -mv850e2v4
27052 @opindex mv850e2v4
27053 Specify that the target processor is the V850E3V5. This is an alias for
27054 the @option{-mv850e3v5} option.
27055
27056 @item -mv850e2v3
27057 @opindex mv850e2v3
27058 Specify that the target processor is the V850E2V3. The preprocessor
27059 constant @code{__v850e2v3__} is defined if this option is used.
27060
27061 @item -mv850e2
27062 @opindex mv850e2
27063 Specify that the target processor is the V850E2. The preprocessor
27064 constant @code{__v850e2__} is defined if this option is used.
27065
27066 @item -mv850e1
27067 @opindex mv850e1
27068 Specify that the target processor is the V850E1. The preprocessor
27069 constants @code{__v850e1__} and @code{__v850e__} are defined if
27070 this option is used.
27071
27072 @item -mv850es
27073 @opindex mv850es
27074 Specify that the target processor is the V850ES. This is an alias for
27075 the @option{-mv850e1} option.
27076
27077 @item -mv850e
27078 @opindex mv850e
27079 Specify that the target processor is the V850E@. The preprocessor
27080 constant @code{__v850e__} is defined if this option is used.
27081
27082 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27083 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27084 are defined then a default target processor is chosen and the
27085 relevant @samp{__v850*__} preprocessor constant is defined.
27086
27087 The preprocessor constants @code{__v850} and @code{__v851__} are always
27088 defined, regardless of which processor variant is the target.
27089
27090 @item -mdisable-callt
27091 @itemx -mno-disable-callt
27092 @opindex mdisable-callt
27093 @opindex mno-disable-callt
27094 This option suppresses generation of the @code{CALLT} instruction for the
27095 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27096 architecture.
27097
27098 This option is enabled by default when the RH850 ABI is
27099 in use (see @option{-mrh850-abi}), and disabled by default when the
27100 GCC ABI is in use. If @code{CALLT} instructions are being generated
27101 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27102
27103 @item -mrelax
27104 @itemx -mno-relax
27105 @opindex mrelax
27106 @opindex mno-relax
27107 Pass on (or do not pass on) the @option{-mrelax} command-line option
27108 to the assembler.
27109
27110 @item -mlong-jumps
27111 @itemx -mno-long-jumps
27112 @opindex mlong-jumps
27113 @opindex mno-long-jumps
27114 Disable (or re-enable) the generation of PC-relative jump instructions.
27115
27116 @item -msoft-float
27117 @itemx -mhard-float
27118 @opindex msoft-float
27119 @opindex mhard-float
27120 Disable (or re-enable) the generation of hardware floating point
27121 instructions. This option is only significant when the target
27122 architecture is @samp{V850E2V3} or higher. If hardware floating point
27123 instructions are being generated then the C preprocessor symbol
27124 @code{__FPU_OK__} is defined, otherwise the symbol
27125 @code{__NO_FPU__} is defined.
27126
27127 @item -mloop
27128 @opindex mloop
27129 Enables the use of the e3v5 LOOP instruction. The use of this
27130 instruction is not enabled by default when the e3v5 architecture is
27131 selected because its use is still experimental.
27132
27133 @item -mrh850-abi
27134 @itemx -mghs
27135 @opindex mrh850-abi
27136 @opindex mghs
27137 Enables support for the RH850 version of the V850 ABI. This is the
27138 default. With this version of the ABI the following rules apply:
27139
27140 @itemize
27141 @item
27142 Integer sized structures and unions are returned via a memory pointer
27143 rather than a register.
27144
27145 @item
27146 Large structures and unions (more than 8 bytes in size) are passed by
27147 value.
27148
27149 @item
27150 Functions are aligned to 16-bit boundaries.
27151
27152 @item
27153 The @option{-m8byte-align} command-line option is supported.
27154
27155 @item
27156 The @option{-mdisable-callt} command-line option is enabled by
27157 default. The @option{-mno-disable-callt} command-line option is not
27158 supported.
27159 @end itemize
27160
27161 When this version of the ABI is enabled the C preprocessor symbol
27162 @code{__V850_RH850_ABI__} is defined.
27163
27164 @item -mgcc-abi
27165 @opindex mgcc-abi
27166 Enables support for the old GCC version of the V850 ABI. With this
27167 version of the ABI the following rules apply:
27168
27169 @itemize
27170 @item
27171 Integer sized structures and unions are returned in register @code{r10}.
27172
27173 @item
27174 Large structures and unions (more than 8 bytes in size) are passed by
27175 reference.
27176
27177 @item
27178 Functions are aligned to 32-bit boundaries, unless optimizing for
27179 size.
27180
27181 @item
27182 The @option{-m8byte-align} command-line option is not supported.
27183
27184 @item
27185 The @option{-mdisable-callt} command-line option is supported but not
27186 enabled by default.
27187 @end itemize
27188
27189 When this version of the ABI is enabled the C preprocessor symbol
27190 @code{__V850_GCC_ABI__} is defined.
27191
27192 @item -m8byte-align
27193 @itemx -mno-8byte-align
27194 @opindex m8byte-align
27195 @opindex mno-8byte-align
27196 Enables support for @code{double} and @code{long long} types to be
27197 aligned on 8-byte boundaries. The default is to restrict the
27198 alignment of all objects to at most 4-bytes. When
27199 @option{-m8byte-align} is in effect the C preprocessor symbol
27200 @code{__V850_8BYTE_ALIGN__} is defined.
27201
27202 @item -mbig-switch
27203 @opindex mbig-switch
27204 Generate code suitable for big switch tables. Use this option only if
27205 the assembler/linker complain about out of range branches within a switch
27206 table.
27207
27208 @item -mapp-regs
27209 @opindex mapp-regs
27210 This option causes r2 and r5 to be used in the code generated by
27211 the compiler. This setting is the default.
27212
27213 @item -mno-app-regs
27214 @opindex mno-app-regs
27215 This option causes r2 and r5 to be treated as fixed registers.
27216
27217 @end table
27218
27219 @node VAX Options
27220 @subsection VAX Options
27221 @cindex VAX options
27222
27223 These @samp{-m} options are defined for the VAX:
27224
27225 @table @gcctabopt
27226 @item -munix
27227 @opindex munix
27228 Do not output certain jump instructions (@code{aobleq} and so on)
27229 that the Unix assembler for the VAX cannot handle across long
27230 ranges.
27231
27232 @item -mgnu
27233 @opindex mgnu
27234 Do output those jump instructions, on the assumption that the
27235 GNU assembler is being used.
27236
27237 @item -mg
27238 @opindex mg
27239 Output code for G-format floating-point numbers instead of D-format.
27240 @end table
27241
27242 @node Visium Options
27243 @subsection Visium Options
27244 @cindex Visium options
27245
27246 @table @gcctabopt
27247
27248 @item -mdebug
27249 @opindex mdebug
27250 A program which performs file I/O and is destined to run on an MCM target
27251 should be linked with this option. It causes the libraries libc.a and
27252 libdebug.a to be linked. The program should be run on the target under
27253 the control of the GDB remote debugging stub.
27254
27255 @item -msim
27256 @opindex msim
27257 A program which performs file I/O and is destined to run on the simulator
27258 should be linked with option. This causes libraries libc.a and libsim.a to
27259 be linked.
27260
27261 @item -mfpu
27262 @itemx -mhard-float
27263 @opindex mfpu
27264 @opindex mhard-float
27265 Generate code containing floating-point instructions. This is the
27266 default.
27267
27268 @item -mno-fpu
27269 @itemx -msoft-float
27270 @opindex mno-fpu
27271 @opindex msoft-float
27272 Generate code containing library calls for floating-point.
27273
27274 @option{-msoft-float} changes the calling convention in the output file;
27275 therefore, it is only useful if you compile @emph{all} of a program with
27276 this option. In particular, you need to compile @file{libgcc.a}, the
27277 library that comes with GCC, with @option{-msoft-float} in order for
27278 this to work.
27279
27280 @item -mcpu=@var{cpu_type}
27281 @opindex mcpu
27282 Set the instruction set, register set, and instruction scheduling parameters
27283 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27284 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27285
27286 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27287
27288 By default (unless configured otherwise), GCC generates code for the GR5
27289 variant of the Visium architecture.
27290
27291 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27292 architecture. The only difference from GR5 code is that the compiler will
27293 generate block move instructions.
27294
27295 @item -mtune=@var{cpu_type}
27296 @opindex mtune
27297 Set the instruction scheduling parameters for machine type @var{cpu_type},
27298 but do not set the instruction set or register set that the option
27299 @option{-mcpu=@var{cpu_type}} would.
27300
27301 @item -msv-mode
27302 @opindex msv-mode
27303 Generate code for the supervisor mode, where there are no restrictions on
27304 the access to general registers. This is the default.
27305
27306 @item -muser-mode
27307 @opindex muser-mode
27308 Generate code for the user mode, where the access to some general registers
27309 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27310 mode; on the GR6, only registers r29 to r31 are affected.
27311 @end table
27312
27313 @node VMS Options
27314 @subsection VMS Options
27315
27316 These @samp{-m} options are defined for the VMS implementations:
27317
27318 @table @gcctabopt
27319 @item -mvms-return-codes
27320 @opindex mvms-return-codes
27321 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27322 condition (e.g.@: error) codes.
27323
27324 @item -mdebug-main=@var{prefix}
27325 @opindex mdebug-main=@var{prefix}
27326 Flag the first routine whose name starts with @var{prefix} as the main
27327 routine for the debugger.
27328
27329 @item -mmalloc64
27330 @opindex mmalloc64
27331 Default to 64-bit memory allocation routines.
27332
27333 @item -mpointer-size=@var{size}
27334 @opindex mpointer-size=@var{size}
27335 Set the default size of pointers. Possible options for @var{size} are
27336 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27337 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27338 The later option disables @code{pragma pointer_size}.
27339 @end table
27340
27341 @node VxWorks Options
27342 @subsection VxWorks Options
27343 @cindex VxWorks Options
27344
27345 The options in this section are defined for all VxWorks targets.
27346 Options specific to the target hardware are listed with the other
27347 options for that target.
27348
27349 @table @gcctabopt
27350 @item -mrtp
27351 @opindex mrtp
27352 GCC can generate code for both VxWorks kernels and real time processes
27353 (RTPs). This option switches from the former to the latter. It also
27354 defines the preprocessor macro @code{__RTP__}.
27355
27356 @item -non-static
27357 @opindex non-static
27358 Link an RTP executable against shared libraries rather than static
27359 libraries. The options @option{-static} and @option{-shared} can
27360 also be used for RTPs (@pxref{Link Options}); @option{-static}
27361 is the default.
27362
27363 @item -Bstatic
27364 @itemx -Bdynamic
27365 @opindex Bstatic
27366 @opindex Bdynamic
27367 These options are passed down to the linker. They are defined for
27368 compatibility with Diab.
27369
27370 @item -Xbind-lazy
27371 @opindex Xbind-lazy
27372 Enable lazy binding of function calls. This option is equivalent to
27373 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27374
27375 @item -Xbind-now
27376 @opindex Xbind-now
27377 Disable lazy binding of function calls. This option is the default and
27378 is defined for compatibility with Diab.
27379 @end table
27380
27381 @node x86 Options
27382 @subsection x86 Options
27383 @cindex x86 Options
27384
27385 These @samp{-m} options are defined for the x86 family of computers.
27386
27387 @table @gcctabopt
27388
27389 @item -march=@var{cpu-type}
27390 @opindex march
27391 Generate instructions for the machine type @var{cpu-type}. In contrast to
27392 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27393 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27394 to generate code that may not run at all on processors other than the one
27395 indicated. Specifying @option{-march=@var{cpu-type}} implies
27396 @option{-mtune=@var{cpu-type}}.
27397
27398 The choices for @var{cpu-type} are:
27399
27400 @table @samp
27401 @item native
27402 This selects the CPU to generate code for at compilation time by determining
27403 the processor type of the compiling machine. Using @option{-march=native}
27404 enables all instruction subsets supported by the local machine (hence
27405 the result might not run on different machines). Using @option{-mtune=native}
27406 produces code optimized for the local machine under the constraints
27407 of the selected instruction set.
27408
27409 @item x86-64
27410 A generic CPU with 64-bit extensions.
27411
27412 @item i386
27413 Original Intel i386 CPU@.
27414
27415 @item i486
27416 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27417
27418 @item i586
27419 @itemx pentium
27420 Intel Pentium CPU with no MMX support.
27421
27422 @item lakemont
27423 Intel Lakemont MCU, based on Intel Pentium CPU.
27424
27425 @item pentium-mmx
27426 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27427
27428 @item pentiumpro
27429 Intel Pentium Pro CPU@.
27430
27431 @item i686
27432 When used with @option{-march}, the Pentium Pro
27433 instruction set is used, so the code runs on all i686 family chips.
27434 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27435
27436 @item pentium2
27437 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27438 support.
27439
27440 @item pentium3
27441 @itemx pentium3m
27442 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27443 set support.
27444
27445 @item pentium-m
27446 Intel Pentium M; low-power version of Intel Pentium III CPU
27447 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27448
27449 @item pentium4
27450 @itemx pentium4m
27451 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27452
27453 @item prescott
27454 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27455 set support.
27456
27457 @item nocona
27458 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27459 SSE2 and SSE3 instruction set support.
27460
27461 @item core2
27462 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27463 instruction set support.
27464
27465 @item nehalem
27466 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27467 SSE4.1, SSE4.2 and POPCNT instruction set support.
27468
27469 @item westmere
27470 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27471 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27472
27473 @item sandybridge
27474 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27475 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27476
27477 @item ivybridge
27478 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27479 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27480 instruction set support.
27481
27482 @item haswell
27483 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27484 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27485 BMI, BMI2 and F16C instruction set support.
27486
27487 @item broadwell
27488 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27489 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27490 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27491
27492 @item skylake
27493 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27494 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27495 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27496 XSAVES instruction set support.
27497
27498 @item bonnell
27499 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27500 instruction set support.
27501
27502 @item silvermont
27503 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27504 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27505
27506 @item goldmont
27507 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27508 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27509 instruction set support.
27510
27511 @item goldmont-plus
27512 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27513 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27514 PTWRITE, RDPID, SGX and UMIP instruction set support.
27515
27516 @item tremont
27517 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27518 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27519 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27520
27521 @item knl
27522 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27523 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27524 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27525 AVX512CD instruction set support.
27526
27527 @item knm
27528 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27529 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27530 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27531 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27532
27533 @item skylake-avx512
27534 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27535 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27536 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27537 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27538
27539 @item cannonlake
27540 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27541 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27542 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27543 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27544 AVX512IFMA, SHA and UMIP instruction set support.
27545
27546 @item icelake-client
27547 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27548 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27549 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27550 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27551 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27552 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27553
27554 @item icelake-server
27555 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27556 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27557 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27558 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27559 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27560 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27561 set support.
27562
27563 @item cascadelake
27564 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27565 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27566 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27567 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27568
27569 @item cooperlake
27570 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27571 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27572 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27573 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
27574 set support.
27575
27576 @item tigerlake
27577 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27578 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27579 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27580 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
27581 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
27582 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction
27583 set support.
27584
27585 @item k6
27586 AMD K6 CPU with MMX instruction set support.
27587
27588 @item k6-2
27589 @itemx k6-3
27590 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27591
27592 @item athlon
27593 @itemx athlon-tbird
27594 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27595 support.
27596
27597 @item athlon-4
27598 @itemx athlon-xp
27599 @itemx athlon-mp
27600 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27601 instruction set support.
27602
27603 @item k8
27604 @itemx opteron
27605 @itemx athlon64
27606 @itemx athlon-fx
27607 Processors based on the AMD K8 core with x86-64 instruction set support,
27608 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27609 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27610 instruction set extensions.)
27611
27612 @item k8-sse3
27613 @itemx opteron-sse3
27614 @itemx athlon64-sse3
27615 Improved versions of AMD K8 cores with SSE3 instruction set support.
27616
27617 @item amdfam10
27618 @itemx barcelona
27619 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27620 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27621 instruction set extensions.)
27622
27623 @item bdver1
27624 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27625 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27626 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27627 @item bdver2
27628 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27629 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27630 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27631 extensions.)
27632 @item bdver3
27633 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27634 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27635 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27636 64-bit instruction set extensions.
27637 @item bdver4
27638 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27639 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27640 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27641 SSE4.2, ABM and 64-bit instruction set extensions.
27642
27643 @item znver1
27644 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27645 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27646 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27647 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27648 instruction set extensions.
27649 @item znver2
27650 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27651 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27652 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27653 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27654 instruction set extensions.)
27655
27656
27657 @item btver1
27658 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27659 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27660 instruction set extensions.)
27661
27662 @item btver2
27663 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27664 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27665 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27666
27667 @item winchip-c6
27668 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27669 set support.
27670
27671 @item winchip2
27672 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27673 instruction set support.
27674
27675 @item c3
27676 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27677 (No scheduling is implemented for this chip.)
27678
27679 @item c3-2
27680 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27681 (No scheduling is implemented for this chip.)
27682
27683 @item c7
27684 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27685 (No scheduling is implemented for this chip.)
27686
27687 @item samuel-2
27688 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27689 (No scheduling is implemented for this chip.)
27690
27691 @item nehemiah
27692 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27693 (No scheduling is implemented for this chip.)
27694
27695 @item esther
27696 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27697 (No scheduling is implemented for this chip.)
27698
27699 @item eden-x2
27700 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27701 (No scheduling is implemented for this chip.)
27702
27703 @item eden-x4
27704 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27705 AVX and AVX2 instruction set support.
27706 (No scheduling is implemented for this chip.)
27707
27708 @item nano
27709 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27710 instruction set support.
27711 (No scheduling is implemented for this chip.)
27712
27713 @item nano-1000
27714 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27715 instruction set support.
27716 (No scheduling is implemented for this chip.)
27717
27718 @item nano-2000
27719 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27720 instruction set support.
27721 (No scheduling is implemented for this chip.)
27722
27723 @item nano-3000
27724 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27725 instruction set support.
27726 (No scheduling is implemented for this chip.)
27727
27728 @item nano-x2
27729 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27730 instruction set support.
27731 (No scheduling is implemented for this chip.)
27732
27733 @item nano-x4
27734 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27735 instruction set support.
27736 (No scheduling is implemented for this chip.)
27737
27738 @item geode
27739 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27740 @end table
27741
27742 @item -mtune=@var{cpu-type}
27743 @opindex mtune
27744 Tune to @var{cpu-type} everything applicable about the generated code, except
27745 for the ABI and the set of available instructions.
27746 While picking a specific @var{cpu-type} schedules things appropriately
27747 for that particular chip, the compiler does not generate any code that
27748 cannot run on the default machine type unless you use a
27749 @option{-march=@var{cpu-type}} option.
27750 For example, if GCC is configured for i686-pc-linux-gnu
27751 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27752 but still runs on i686 machines.
27753
27754 The choices for @var{cpu-type} are the same as for @option{-march}.
27755 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27756
27757 @table @samp
27758 @item generic
27759 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27760 If you know the CPU on which your code will run, then you should use
27761 the corresponding @option{-mtune} or @option{-march} option instead of
27762 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27763 of your application will have, then you should use this option.
27764
27765 As new processors are deployed in the marketplace, the behavior of this
27766 option will change. Therefore, if you upgrade to a newer version of
27767 GCC, code generation controlled by this option will change to reflect
27768 the processors
27769 that are most common at the time that version of GCC is released.
27770
27771 There is no @option{-march=generic} option because @option{-march}
27772 indicates the instruction set the compiler can use, and there is no
27773 generic instruction set applicable to all processors. In contrast,
27774 @option{-mtune} indicates the processor (or, in this case, collection of
27775 processors) for which the code is optimized.
27776
27777 @item intel
27778 Produce code optimized for the most current Intel processors, which are
27779 Haswell and Silvermont for this version of GCC. If you know the CPU
27780 on which your code will run, then you should use the corresponding
27781 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27782 But, if you want your application performs better on both Haswell and
27783 Silvermont, then you should use this option.
27784
27785 As new Intel processors are deployed in the marketplace, the behavior of
27786 this option will change. Therefore, if you upgrade to a newer version of
27787 GCC, code generation controlled by this option will change to reflect
27788 the most current Intel processors at the time that version of GCC is
27789 released.
27790
27791 There is no @option{-march=intel} option because @option{-march} indicates
27792 the instruction set the compiler can use, and there is no common
27793 instruction set applicable to all processors. In contrast,
27794 @option{-mtune} indicates the processor (or, in this case, collection of
27795 processors) for which the code is optimized.
27796 @end table
27797
27798 @item -mcpu=@var{cpu-type}
27799 @opindex mcpu
27800 A deprecated synonym for @option{-mtune}.
27801
27802 @item -mfpmath=@var{unit}
27803 @opindex mfpmath
27804 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27805 for @var{unit} are:
27806
27807 @table @samp
27808 @item 387
27809 Use the standard 387 floating-point coprocessor present on the majority of chips and
27810 emulated otherwise. Code compiled with this option runs almost everywhere.
27811 The temporary results are computed in 80-bit precision instead of the precision
27812 specified by the type, resulting in slightly different results compared to most
27813 of other chips. See @option{-ffloat-store} for more detailed description.
27814
27815 This is the default choice for non-Darwin x86-32 targets.
27816
27817 @item sse
27818 Use scalar floating-point instructions present in the SSE instruction set.
27819 This instruction set is supported by Pentium III and newer chips,
27820 and in the AMD line
27821 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27822 instruction set supports only single-precision arithmetic, thus the double and
27823 extended-precision arithmetic are still done using 387. A later version, present
27824 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27825 arithmetic too.
27826
27827 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27828 or @option{-msse2} switches to enable SSE extensions and make this option
27829 effective. For the x86-64 compiler, these extensions are enabled by default.
27830
27831 The resulting code should be considerably faster in the majority of cases and avoid
27832 the numerical instability problems of 387 code, but may break some existing
27833 code that expects temporaries to be 80 bits.
27834
27835 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27836 and the default choice for x86-32 targets with the SSE2 instruction set
27837 when @option{-ffast-math} is enabled.
27838
27839 @item sse,387
27840 @itemx sse+387
27841 @itemx both
27842 Attempt to utilize both instruction sets at once. This effectively doubles the
27843 amount of available registers, and on chips with separate execution units for
27844 387 and SSE the execution resources too. Use this option with care, as it is
27845 still experimental, because the GCC register allocator does not model separate
27846 functional units well, resulting in unstable performance.
27847 @end table
27848
27849 @item -masm=@var{dialect}
27850 @opindex masm=@var{dialect}
27851 Output assembly instructions using selected @var{dialect}. Also affects
27852 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27853 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27854 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27855 not support @samp{intel}.
27856
27857 @item -mieee-fp
27858 @itemx -mno-ieee-fp
27859 @opindex mieee-fp
27860 @opindex mno-ieee-fp
27861 Control whether or not the compiler uses IEEE floating-point
27862 comparisons. These correctly handle the case where the result of a
27863 comparison is unordered.
27864
27865 @item -m80387
27866 @itemx -mhard-float
27867 @opindex 80387
27868 @opindex mhard-float
27869 Generate output containing 80387 instructions for floating point.
27870
27871 @item -mno-80387
27872 @itemx -msoft-float
27873 @opindex no-80387
27874 @opindex msoft-float
27875 Generate output containing library calls for floating point.
27876
27877 @strong{Warning:} the requisite libraries are not part of GCC@.
27878 Normally the facilities of the machine's usual C compiler are used, but
27879 this cannot be done directly in cross-compilation. You must make your
27880 own arrangements to provide suitable library functions for
27881 cross-compilation.
27882
27883 On machines where a function returns floating-point results in the 80387
27884 register stack, some floating-point opcodes may be emitted even if
27885 @option{-msoft-float} is used.
27886
27887 @item -mno-fp-ret-in-387
27888 @opindex mno-fp-ret-in-387
27889 @opindex mfp-ret-in-387
27890 Do not use the FPU registers for return values of functions.
27891
27892 The usual calling convention has functions return values of types
27893 @code{float} and @code{double} in an FPU register, even if there
27894 is no FPU@. The idea is that the operating system should emulate
27895 an FPU@.
27896
27897 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27898 in ordinary CPU registers instead.
27899
27900 @item -mno-fancy-math-387
27901 @opindex mno-fancy-math-387
27902 @opindex mfancy-math-387
27903 Some 387 emulators do not support the @code{sin}, @code{cos} and
27904 @code{sqrt} instructions for the 387. Specify this option to avoid
27905 generating those instructions.
27906 This option is overridden when @option{-march}
27907 indicates that the target CPU always has an FPU and so the
27908 instruction does not need emulation. These
27909 instructions are not generated unless you also use the
27910 @option{-funsafe-math-optimizations} switch.
27911
27912 @item -malign-double
27913 @itemx -mno-align-double
27914 @opindex malign-double
27915 @opindex mno-align-double
27916 Control whether GCC aligns @code{double}, @code{long double}, and
27917 @code{long long} variables on a two-word boundary or a one-word
27918 boundary. Aligning @code{double} variables on a two-word boundary
27919 produces code that runs somewhat faster on a Pentium at the
27920 expense of more memory.
27921
27922 On x86-64, @option{-malign-double} is enabled by default.
27923
27924 @strong{Warning:} if you use the @option{-malign-double} switch,
27925 structures containing the above types are aligned differently than
27926 the published application binary interface specifications for the x86-32
27927 and are not binary compatible with structures in code compiled
27928 without that switch.
27929
27930 @item -m96bit-long-double
27931 @itemx -m128bit-long-double
27932 @opindex m96bit-long-double
27933 @opindex m128bit-long-double
27934 These switches control the size of @code{long double} type. The x86-32
27935 application binary interface specifies the size to be 96 bits,
27936 so @option{-m96bit-long-double} is the default in 32-bit mode.
27937
27938 Modern architectures (Pentium and newer) prefer @code{long double}
27939 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27940 conforming to the ABI, this is not possible. So specifying
27941 @option{-m128bit-long-double} aligns @code{long double}
27942 to a 16-byte boundary by padding the @code{long double} with an additional
27943 32-bit zero.
27944
27945 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27946 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27947
27948 Notice that neither of these options enable any extra precision over the x87
27949 standard of 80 bits for a @code{long double}.
27950
27951 @strong{Warning:} if you override the default value for your target ABI, this
27952 changes the size of
27953 structures and arrays containing @code{long double} variables,
27954 as well as modifying the function calling convention for functions taking
27955 @code{long double}. Hence they are not binary-compatible
27956 with code compiled without that switch.
27957
27958 @item -mlong-double-64
27959 @itemx -mlong-double-80
27960 @itemx -mlong-double-128
27961 @opindex mlong-double-64
27962 @opindex mlong-double-80
27963 @opindex mlong-double-128
27964 These switches control the size of @code{long double} type. A size
27965 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27966 type. This is the default for 32-bit Bionic C library. A size
27967 of 128 bits makes the @code{long double} type equivalent to the
27968 @code{__float128} type. This is the default for 64-bit Bionic C library.
27969
27970 @strong{Warning:} if you override the default value for your target ABI, this
27971 changes the size of
27972 structures and arrays containing @code{long double} variables,
27973 as well as modifying the function calling convention for functions taking
27974 @code{long double}. Hence they are not binary-compatible
27975 with code compiled without that switch.
27976
27977 @item -malign-data=@var{type}
27978 @opindex malign-data
27979 Control how GCC aligns variables. Supported values for @var{type} are
27980 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27981 and earlier, @samp{abi} uses alignment value as specified by the
27982 psABI, and @samp{cacheline} uses increased alignment value to match
27983 the cache line size. @samp{compat} is the default.
27984
27985 @item -mlarge-data-threshold=@var{threshold}
27986 @opindex mlarge-data-threshold
27987 When @option{-mcmodel=medium} is specified, data objects larger than
27988 @var{threshold} are placed in the large data section. This value must be the
27989 same across all objects linked into the binary, and defaults to 65535.
27990
27991 @item -mrtd
27992 @opindex mrtd
27993 Use a different function-calling convention, in which functions that
27994 take a fixed number of arguments return with the @code{ret @var{num}}
27995 instruction, which pops their arguments while returning. This saves one
27996 instruction in the caller since there is no need to pop the arguments
27997 there.
27998
27999 You can specify that an individual function is called with this calling
28000 sequence with the function attribute @code{stdcall}. You can also
28001 override the @option{-mrtd} option by using the function attribute
28002 @code{cdecl}. @xref{Function Attributes}.
28003
28004 @strong{Warning:} this calling convention is incompatible with the one
28005 normally used on Unix, so you cannot use it if you need to call
28006 libraries compiled with the Unix compiler.
28007
28008 Also, you must provide function prototypes for all functions that
28009 take variable numbers of arguments (including @code{printf});
28010 otherwise incorrect code is generated for calls to those
28011 functions.
28012
28013 In addition, seriously incorrect code results if you call a
28014 function with too many arguments. (Normally, extra arguments are
28015 harmlessly ignored.)
28016
28017 @item -mregparm=@var{num}
28018 @opindex mregparm
28019 Control how many registers are used to pass integer arguments. By
28020 default, no registers are used to pass arguments, and at most 3
28021 registers can be used. You can control this behavior for a specific
28022 function by using the function attribute @code{regparm}.
28023 @xref{Function Attributes}.
28024
28025 @strong{Warning:} if you use this switch, and
28026 @var{num} is nonzero, then you must build all modules with the same
28027 value, including any libraries. This includes the system libraries and
28028 startup modules.
28029
28030 @item -msseregparm
28031 @opindex msseregparm
28032 Use SSE register passing conventions for float and double arguments
28033 and return values. You can control this behavior for a specific
28034 function by using the function attribute @code{sseregparm}.
28035 @xref{Function Attributes}.
28036
28037 @strong{Warning:} if you use this switch then you must build all
28038 modules with the same value, including any libraries. This includes
28039 the system libraries and startup modules.
28040
28041 @item -mvect8-ret-in-mem
28042 @opindex mvect8-ret-in-mem
28043 Return 8-byte vectors in memory instead of MMX registers. This is the
28044 default on VxWorks to match the ABI of the Sun Studio compilers until
28045 version 12. @emph{Only} use this option if you need to remain
28046 compatible with existing code produced by those previous compiler
28047 versions or older versions of GCC@.
28048
28049 @item -mpc32
28050 @itemx -mpc64
28051 @itemx -mpc80
28052 @opindex mpc32
28053 @opindex mpc64
28054 @opindex mpc80
28055
28056 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
28057 is specified, the significands of results of floating-point operations are
28058 rounded to 24 bits (single precision); @option{-mpc64} rounds the
28059 significands of results of floating-point operations to 53 bits (double
28060 precision) and @option{-mpc80} rounds the significands of results of
28061 floating-point operations to 64 bits (extended double precision), which is
28062 the default. When this option is used, floating-point operations in higher
28063 precisions are not available to the programmer without setting the FPU
28064 control word explicitly.
28065
28066 Setting the rounding of floating-point operations to less than the default
28067 80 bits can speed some programs by 2% or more. Note that some mathematical
28068 libraries assume that extended-precision (80-bit) floating-point operations
28069 are enabled by default; routines in such libraries could suffer significant
28070 loss of accuracy, typically through so-called ``catastrophic cancellation'',
28071 when this option is used to set the precision to less than extended precision.
28072
28073 @item -mstackrealign
28074 @opindex mstackrealign
28075 Realign the stack at entry. On the x86, the @option{-mstackrealign}
28076 option generates an alternate prologue and epilogue that realigns the
28077 run-time stack if necessary. This supports mixing legacy codes that keep
28078 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
28079 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
28080 applicable to individual functions.
28081
28082 @item -mpreferred-stack-boundary=@var{num}
28083 @opindex mpreferred-stack-boundary
28084 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28085 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28086 the default is 4 (16 bytes or 128 bits).
28087
28088 @strong{Warning:} When generating code for the x86-64 architecture with
28089 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28090 used to keep the stack boundary aligned to 8 byte boundary. Since
28091 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28092 intended to be used in controlled environment where stack space is
28093 important limitation. This option leads to wrong code when functions
28094 compiled with 16 byte stack alignment (such as functions from a standard
28095 library) are called with misaligned stack. In this case, SSE
28096 instructions may lead to misaligned memory access traps. In addition,
28097 variable arguments are handled incorrectly for 16 byte aligned
28098 objects (including x87 long double and __int128), leading to wrong
28099 results. You must build all modules with
28100 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28101 includes the system libraries and startup modules.
28102
28103 @item -mincoming-stack-boundary=@var{num}
28104 @opindex mincoming-stack-boundary
28105 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28106 boundary. If @option{-mincoming-stack-boundary} is not specified,
28107 the one specified by @option{-mpreferred-stack-boundary} is used.
28108
28109 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28110 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28111 suffer significant run time performance penalties. On Pentium III, the
28112 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28113 properly if it is not 16-byte aligned.
28114
28115 To ensure proper alignment of this values on the stack, the stack boundary
28116 must be as aligned as that required by any value stored on the stack.
28117 Further, every function must be generated such that it keeps the stack
28118 aligned. Thus calling a function compiled with a higher preferred
28119 stack boundary from a function compiled with a lower preferred stack
28120 boundary most likely misaligns the stack. It is recommended that
28121 libraries that use callbacks always use the default setting.
28122
28123 This extra alignment does consume extra stack space, and generally
28124 increases code size. Code that is sensitive to stack space usage, such
28125 as embedded systems and operating system kernels, may want to reduce the
28126 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28127
28128 @need 200
28129 @item -mmmx
28130 @opindex mmmx
28131 @need 200
28132 @itemx -msse
28133 @opindex msse
28134 @need 200
28135 @itemx -msse2
28136 @opindex msse2
28137 @need 200
28138 @itemx -msse3
28139 @opindex msse3
28140 @need 200
28141 @itemx -mssse3
28142 @opindex mssse3
28143 @need 200
28144 @itemx -msse4
28145 @opindex msse4
28146 @need 200
28147 @itemx -msse4a
28148 @opindex msse4a
28149 @need 200
28150 @itemx -msse4.1
28151 @opindex msse4.1
28152 @need 200
28153 @itemx -msse4.2
28154 @opindex msse4.2
28155 @need 200
28156 @itemx -mavx
28157 @opindex mavx
28158 @need 200
28159 @itemx -mavx2
28160 @opindex mavx2
28161 @need 200
28162 @itemx -mavx512f
28163 @opindex mavx512f
28164 @need 200
28165 @itemx -mavx512pf
28166 @opindex mavx512pf
28167 @need 200
28168 @itemx -mavx512er
28169 @opindex mavx512er
28170 @need 200
28171 @itemx -mavx512cd
28172 @opindex mavx512cd
28173 @need 200
28174 @itemx -mavx512vl
28175 @opindex mavx512vl
28176 @need 200
28177 @itemx -mavx512bw
28178 @opindex mavx512bw
28179 @need 200
28180 @itemx -mavx512dq
28181 @opindex mavx512dq
28182 @need 200
28183 @itemx -mavx512ifma
28184 @opindex mavx512ifma
28185 @need 200
28186 @itemx -mavx512vbmi
28187 @opindex mavx512vbmi
28188 @need 200
28189 @itemx -msha
28190 @opindex msha
28191 @need 200
28192 @itemx -maes
28193 @opindex maes
28194 @need 200
28195 @itemx -mpclmul
28196 @opindex mpclmul
28197 @need 200
28198 @itemx -mclflushopt
28199 @opindex mclflushopt
28200 @need 200
28201 @itemx -mclwb
28202 @opindex mclwb
28203 @need 200
28204 @itemx -mfsgsbase
28205 @opindex mfsgsbase
28206 @need 200
28207 @itemx -mptwrite
28208 @opindex mptwrite
28209 @need 200
28210 @itemx -mrdrnd
28211 @opindex mrdrnd
28212 @need 200
28213 @itemx -mf16c
28214 @opindex mf16c
28215 @need 200
28216 @itemx -mfma
28217 @opindex mfma
28218 @need 200
28219 @itemx -mpconfig
28220 @opindex mpconfig
28221 @need 200
28222 @itemx -mwbnoinvd
28223 @opindex mwbnoinvd
28224 @need 200
28225 @itemx -mfma4
28226 @opindex mfma4
28227 @need 200
28228 @itemx -mprfchw
28229 @opindex mprfchw
28230 @need 200
28231 @itemx -mrdpid
28232 @opindex mrdpid
28233 @need 200
28234 @itemx -mprefetchwt1
28235 @opindex mprefetchwt1
28236 @need 200
28237 @itemx -mrdseed
28238 @opindex mrdseed
28239 @need 200
28240 @itemx -msgx
28241 @opindex msgx
28242 @need 200
28243 @itemx -mxop
28244 @opindex mxop
28245 @need 200
28246 @itemx -mlwp
28247 @opindex mlwp
28248 @need 200
28249 @itemx -m3dnow
28250 @opindex m3dnow
28251 @need 200
28252 @itemx -m3dnowa
28253 @opindex m3dnowa
28254 @need 200
28255 @itemx -mpopcnt
28256 @opindex mpopcnt
28257 @need 200
28258 @itemx -mabm
28259 @opindex mabm
28260 @need 200
28261 @itemx -madx
28262 @opindex madx
28263 @need 200
28264 @itemx -mbmi
28265 @opindex mbmi
28266 @need 200
28267 @itemx -mbmi2
28268 @opindex mbmi2
28269 @need 200
28270 @itemx -mlzcnt
28271 @opindex mlzcnt
28272 @need 200
28273 @itemx -mfxsr
28274 @opindex mfxsr
28275 @need 200
28276 @itemx -mxsave
28277 @opindex mxsave
28278 @need 200
28279 @itemx -mxsaveopt
28280 @opindex mxsaveopt
28281 @need 200
28282 @itemx -mxsavec
28283 @opindex mxsavec
28284 @need 200
28285 @itemx -mxsaves
28286 @opindex mxsaves
28287 @need 200
28288 @itemx -mrtm
28289 @opindex mrtm
28290 @need 200
28291 @itemx -mhle
28292 @opindex mhle
28293 @need 200
28294 @itemx -mtbm
28295 @opindex mtbm
28296 @need 200
28297 @itemx -mmwaitx
28298 @opindex mmwaitx
28299 @need 200
28300 @itemx -mclzero
28301 @opindex mclzero
28302 @need 200
28303 @itemx -mpku
28304 @opindex mpku
28305 @need 200
28306 @itemx -mavx512vbmi2
28307 @opindex mavx512vbmi2
28308 @need 200
28309 @itemx -mavx512bf16
28310 @opindex mavx512bf16
28311 @need 200
28312 @itemx -mgfni
28313 @opindex mgfni
28314 @need 200
28315 @itemx -mvaes
28316 @opindex mvaes
28317 @need 200
28318 @itemx -mwaitpkg
28319 @opindex mwaitpkg
28320 @need 200
28321 @itemx -mvpclmulqdq
28322 @opindex mvpclmulqdq
28323 @need 200
28324 @itemx -mavx512bitalg
28325 @opindex mavx512bitalg
28326 @need 200
28327 @itemx -mmovdiri
28328 @opindex mmovdiri
28329 @need 200
28330 @itemx -mmovdir64b
28331 @opindex mmovdir64b
28332 @need 200
28333 @itemx -menqcmd
28334 @opindex menqcmd
28335 @need 200
28336 @itemx -mavx512vpopcntdq
28337 @opindex mavx512vpopcntdq
28338 @need 200
28339 @itemx -mavx512vp2intersect
28340 @opindex mavx512vp2intersect
28341 @need 200
28342 @itemx -mavx5124fmaps
28343 @opindex mavx5124fmaps
28344 @need 200
28345 @itemx -mavx512vnni
28346 @opindex mavx512vnni
28347 @need 200
28348 @itemx -mavx5124vnniw
28349 @opindex mavx5124vnniw
28350 @need 200
28351 @itemx -mcldemote
28352 @opindex mcldemote
28353 These switches enable the use of instructions in the MMX, SSE,
28354 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28355 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28356 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28357 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28358 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28359 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28360 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28361 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28362 extended instruction sets. Each has a corresponding @option{-mno-} option to
28363 disable use of these instructions.
28364
28365 These extensions are also available as built-in functions: see
28366 @ref{x86 Built-in Functions}, for details of the functions enabled and
28367 disabled by these switches.
28368
28369 To generate SSE/SSE2 instructions automatically from floating-point
28370 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28371
28372 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28373 generates new AVX instructions or AVX equivalence for all SSEx instructions
28374 when needed.
28375
28376 These options enable GCC to use these extended instructions in
28377 generated code, even without @option{-mfpmath=sse}. Applications that
28378 perform run-time CPU detection must compile separate files for each
28379 supported architecture, using the appropriate flags. In particular,
28380 the file containing the CPU detection code should be compiled without
28381 these options.
28382
28383 @item -mdump-tune-features
28384 @opindex mdump-tune-features
28385 This option instructs GCC to dump the names of the x86 performance
28386 tuning features and default settings. The names can be used in
28387 @option{-mtune-ctrl=@var{feature-list}}.
28388
28389 @item -mtune-ctrl=@var{feature-list}
28390 @opindex mtune-ctrl=@var{feature-list}
28391 This option is used to do fine grain control of x86 code generation features.
28392 @var{feature-list} is a comma separated list of @var{feature} names. See also
28393 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28394 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28395 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28396 developers. Using it may lead to code paths not covered by testing and can
28397 potentially result in compiler ICEs or runtime errors.
28398
28399 @item -mno-default
28400 @opindex mno-default
28401 This option instructs GCC to turn off all tunable features. See also
28402 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28403
28404 @item -mcld
28405 @opindex mcld
28406 This option instructs GCC to emit a @code{cld} instruction in the prologue
28407 of functions that use string instructions. String instructions depend on
28408 the DF flag to select between autoincrement or autodecrement mode. While the
28409 ABI specifies the DF flag to be cleared on function entry, some operating
28410 systems violate this specification by not clearing the DF flag in their
28411 exception dispatchers. The exception handler can be invoked with the DF flag
28412 set, which leads to wrong direction mode when string instructions are used.
28413 This option can be enabled by default on 32-bit x86 targets by configuring
28414 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28415 instructions can be suppressed with the @option{-mno-cld} compiler option
28416 in this case.
28417
28418 @item -mvzeroupper
28419 @opindex mvzeroupper
28420 This option instructs GCC to emit a @code{vzeroupper} instruction
28421 before a transfer of control flow out of the function to minimize
28422 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28423 intrinsics.
28424
28425 @item -mprefer-avx128
28426 @opindex mprefer-avx128
28427 This option instructs GCC to use 128-bit AVX instructions instead of
28428 256-bit AVX instructions in the auto-vectorizer.
28429
28430 @item -mprefer-vector-width=@var{opt}
28431 @opindex mprefer-vector-width
28432 This option instructs GCC to use @var{opt}-bit vector width in instructions
28433 instead of default on the selected platform.
28434
28435 @table @samp
28436 @item none
28437 No extra limitations applied to GCC other than defined by the selected platform.
28438
28439 @item 128
28440 Prefer 128-bit vector width for instructions.
28441
28442 @item 256
28443 Prefer 256-bit vector width for instructions.
28444
28445 @item 512
28446 Prefer 512-bit vector width for instructions.
28447 @end table
28448
28449 @item -mcx16
28450 @opindex mcx16
28451 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28452 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28453 objects. This is useful for atomic updates of data structures exceeding one
28454 machine word in size. The compiler uses this instruction to implement
28455 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28456 128-bit integers, a library call is always used.
28457
28458 @item -msahf
28459 @opindex msahf
28460 This option enables generation of @code{SAHF} instructions in 64-bit code.
28461 Early Intel Pentium 4 CPUs with Intel 64 support,
28462 prior to the introduction of Pentium 4 G1 step in December 2005,
28463 lacked the @code{LAHF} and @code{SAHF} instructions
28464 which are supported by AMD64.
28465 These are load and store instructions, respectively, for certain status flags.
28466 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28467 @code{drem}, and @code{remainder} built-in functions;
28468 see @ref{Other Builtins} for details.
28469
28470 @item -mmovbe
28471 @opindex mmovbe
28472 This option enables use of the @code{movbe} instruction to implement
28473 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28474
28475 @item -mshstk
28476 @opindex mshstk
28477 The @option{-mshstk} option enables shadow stack built-in functions
28478 from x86 Control-flow Enforcement Technology (CET).
28479
28480 @item -mcrc32
28481 @opindex mcrc32
28482 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28483 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28484 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28485
28486 @item -mrecip
28487 @opindex mrecip
28488 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28489 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28490 with an additional Newton-Raphson step
28491 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28492 (and their vectorized
28493 variants) for single-precision floating-point arguments. These instructions
28494 are generated only when @option{-funsafe-math-optimizations} is enabled
28495 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28496 Note that while the throughput of the sequence is higher than the throughput
28497 of the non-reciprocal instruction, the precision of the sequence can be
28498 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28499
28500 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28501 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28502 combination), and doesn't need @option{-mrecip}.
28503
28504 Also note that GCC emits the above sequence with additional Newton-Raphson step
28505 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28506 already with @option{-ffast-math} (or the above option combination), and
28507 doesn't need @option{-mrecip}.
28508
28509 @item -mrecip=@var{opt}
28510 @opindex mrecip=opt
28511 This option controls which reciprocal estimate instructions
28512 may be used. @var{opt} is a comma-separated list of options, which may
28513 be preceded by a @samp{!} to invert the option:
28514
28515 @table @samp
28516 @item all
28517 Enable all estimate instructions.
28518
28519 @item default
28520 Enable the default instructions, equivalent to @option{-mrecip}.
28521
28522 @item none
28523 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28524
28525 @item div
28526 Enable the approximation for scalar division.
28527
28528 @item vec-div
28529 Enable the approximation for vectorized division.
28530
28531 @item sqrt
28532 Enable the approximation for scalar square root.
28533
28534 @item vec-sqrt
28535 Enable the approximation for vectorized square root.
28536 @end table
28537
28538 So, for example, @option{-mrecip=all,!sqrt} enables
28539 all of the reciprocal approximations, except for square root.
28540
28541 @item -mveclibabi=@var{type}
28542 @opindex mveclibabi
28543 Specifies the ABI type to use for vectorizing intrinsics using an
28544 external library. Supported values for @var{type} are @samp{svml}
28545 for the Intel short
28546 vector math library and @samp{acml} for the AMD math core library.
28547 To use this option, both @option{-ftree-vectorize} and
28548 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28549 ABI-compatible library must be specified at link time.
28550
28551 GCC currently emits calls to @code{vmldExp2},
28552 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28553 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28554 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28555 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28556 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28557 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28558 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28559 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28560 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28561 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28562 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28563 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28564 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28565 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28566 when @option{-mveclibabi=acml} is used.
28567
28568 @item -mabi=@var{name}
28569 @opindex mabi
28570 Generate code for the specified calling convention. Permissible values
28571 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28572 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28573 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28574 You can control this behavior for specific functions by
28575 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28576 @xref{Function Attributes}.
28577
28578 @item -mforce-indirect-call
28579 @opindex mforce-indirect-call
28580 Force all calls to functions to be indirect. This is useful
28581 when using Intel Processor Trace where it generates more precise timing
28582 information for function calls.
28583
28584 @item -mmanual-endbr
28585 @opindex mmanual-endbr
28586 Insert ENDBR instruction at function entry only via the @code{cf_check}
28587 function attribute. This is useful when used with the option
28588 @option{-fcf-protection=branch} to control ENDBR insertion at the
28589 function entry.
28590
28591 @item -mcall-ms2sysv-xlogues
28592 @opindex mcall-ms2sysv-xlogues
28593 @opindex mno-call-ms2sysv-xlogues
28594 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28595 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28596 default, the code for saving and restoring these registers is emitted inline,
28597 resulting in fairly lengthy prologues and epilogues. Using
28598 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28599 use stubs in the static portion of libgcc to perform these saves and restores,
28600 thus reducing function size at the cost of a few extra instructions.
28601
28602 @item -mtls-dialect=@var{type}
28603 @opindex mtls-dialect
28604 Generate code to access thread-local storage using the @samp{gnu} or
28605 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28606 @samp{gnu2} is more efficient, but it may add compile- and run-time
28607 requirements that cannot be satisfied on all systems.
28608
28609 @item -mpush-args
28610 @itemx -mno-push-args
28611 @opindex mpush-args
28612 @opindex mno-push-args
28613 Use PUSH operations to store outgoing parameters. This method is shorter
28614 and usually equally fast as method using SUB/MOV operations and is enabled
28615 by default. In some cases disabling it may improve performance because of
28616 improved scheduling and reduced dependencies.
28617
28618 @item -maccumulate-outgoing-args
28619 @opindex maccumulate-outgoing-args
28620 If enabled, the maximum amount of space required for outgoing arguments is
28621 computed in the function prologue. This is faster on most modern CPUs
28622 because of reduced dependencies, improved scheduling and reduced stack usage
28623 when the preferred stack boundary is not equal to 2. The drawback is a notable
28624 increase in code size. This switch implies @option{-mno-push-args}.
28625
28626 @item -mthreads
28627 @opindex mthreads
28628 Support thread-safe exception handling on MinGW. Programs that rely
28629 on thread-safe exception handling must compile and link all code with the
28630 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28631 @option{-D_MT}; when linking, it links in a special thread helper library
28632 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28633
28634 @item -mms-bitfields
28635 @itemx -mno-ms-bitfields
28636 @opindex mms-bitfields
28637 @opindex mno-ms-bitfields
28638
28639 Enable/disable bit-field layout compatible with the native Microsoft
28640 Windows compiler.
28641
28642 If @code{packed} is used on a structure, or if bit-fields are used,
28643 it may be that the Microsoft ABI lays out the structure differently
28644 than the way GCC normally does. Particularly when moving packed
28645 data between functions compiled with GCC and the native Microsoft compiler
28646 (either via function call or as data in a file), it may be necessary to access
28647 either format.
28648
28649 This option is enabled by default for Microsoft Windows
28650 targets. This behavior can also be controlled locally by use of variable
28651 or type attributes. For more information, see @ref{x86 Variable Attributes}
28652 and @ref{x86 Type Attributes}.
28653
28654 The Microsoft structure layout algorithm is fairly simple with the exception
28655 of the bit-field packing.
28656 The padding and alignment of members of structures and whether a bit-field
28657 can straddle a storage-unit boundary are determine by these rules:
28658
28659 @enumerate
28660 @item Structure members are stored sequentially in the order in which they are
28661 declared: the first member has the lowest memory address and the last member
28662 the highest.
28663
28664 @item Every data object has an alignment requirement. The alignment requirement
28665 for all data except structures, unions, and arrays is either the size of the
28666 object or the current packing size (specified with either the
28667 @code{aligned} attribute or the @code{pack} pragma),
28668 whichever is less. For structures, unions, and arrays,
28669 the alignment requirement is the largest alignment requirement of its members.
28670 Every object is allocated an offset so that:
28671
28672 @smallexample
28673 offset % alignment_requirement == 0
28674 @end smallexample
28675
28676 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28677 unit if the integral types are the same size and if the next bit-field fits
28678 into the current allocation unit without crossing the boundary imposed by the
28679 common alignment requirements of the bit-fields.
28680 @end enumerate
28681
28682 MSVC interprets zero-length bit-fields in the following ways:
28683
28684 @enumerate
28685 @item If a zero-length bit-field is inserted between two bit-fields that
28686 are normally coalesced, the bit-fields are not coalesced.
28687
28688 For example:
28689
28690 @smallexample
28691 struct
28692 @{
28693 unsigned long bf_1 : 12;
28694 unsigned long : 0;
28695 unsigned long bf_2 : 12;
28696 @} t1;
28697 @end smallexample
28698
28699 @noindent
28700 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28701 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28702
28703 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28704 alignment of the zero-length bit-field is greater than the member that follows it,
28705 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28706
28707 For example:
28708
28709 @smallexample
28710 struct
28711 @{
28712 char foo : 4;
28713 short : 0;
28714 char bar;
28715 @} t2;
28716
28717 struct
28718 @{
28719 char foo : 4;
28720 short : 0;
28721 double bar;
28722 @} t3;
28723 @end smallexample
28724
28725 @noindent
28726 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28727 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28728 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28729 of the structure.
28730
28731 Taking this into account, it is important to note the following:
28732
28733 @enumerate
28734 @item If a zero-length bit-field follows a normal bit-field, the type of the
28735 zero-length bit-field may affect the alignment of the structure as whole. For
28736 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28737 normal bit-field, and is of type short.
28738
28739 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28740 still affect the alignment of the structure:
28741
28742 @smallexample
28743 struct
28744 @{
28745 char foo : 6;
28746 long : 0;
28747 @} t4;
28748 @end smallexample
28749
28750 @noindent
28751 Here, @code{t4} takes up 4 bytes.
28752 @end enumerate
28753
28754 @item Zero-length bit-fields following non-bit-field members are ignored:
28755
28756 @smallexample
28757 struct
28758 @{
28759 char foo;
28760 long : 0;
28761 char bar;
28762 @} t5;
28763 @end smallexample
28764
28765 @noindent
28766 Here, @code{t5} takes up 2 bytes.
28767 @end enumerate
28768
28769
28770 @item -mno-align-stringops
28771 @opindex mno-align-stringops
28772 @opindex malign-stringops
28773 Do not align the destination of inlined string operations. This switch reduces
28774 code size and improves performance in case the destination is already aligned,
28775 but GCC doesn't know about it.
28776
28777 @item -minline-all-stringops
28778 @opindex minline-all-stringops
28779 By default GCC inlines string operations only when the destination is
28780 known to be aligned to least a 4-byte boundary.
28781 This enables more inlining and increases code
28782 size, but may improve performance of code that depends on fast
28783 @code{memcpy} and @code{memset} for short lengths.
28784 The option enables inline expansion of @code{strlen} for all
28785 pointer alignments.
28786
28787 @item -minline-stringops-dynamically
28788 @opindex minline-stringops-dynamically
28789 For string operations of unknown size, use run-time checks with
28790 inline code for small blocks and a library call for large blocks.
28791
28792 @item -mstringop-strategy=@var{alg}
28793 @opindex mstringop-strategy=@var{alg}
28794 Override the internal decision heuristic for the particular algorithm to use
28795 for inlining string operations. The allowed values for @var{alg} are:
28796
28797 @table @samp
28798 @item rep_byte
28799 @itemx rep_4byte
28800 @itemx rep_8byte
28801 Expand using i386 @code{rep} prefix of the specified size.
28802
28803 @item byte_loop
28804 @itemx loop
28805 @itemx unrolled_loop
28806 Expand into an inline loop.
28807
28808 @item libcall
28809 Always use a library call.
28810 @end table
28811
28812 @item -mmemcpy-strategy=@var{strategy}
28813 @opindex mmemcpy-strategy=@var{strategy}
28814 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28815 should be inlined and what inline algorithm to use when the expected size
28816 of the copy operation is known. @var{strategy}
28817 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28818 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28819 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28820 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28821 in the list must be specified in increasing order. The minimal byte size for
28822 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28823 preceding range.
28824
28825 @item -mmemset-strategy=@var{strategy}
28826 @opindex mmemset-strategy=@var{strategy}
28827 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28828 @code{__builtin_memset} expansion.
28829
28830 @item -momit-leaf-frame-pointer
28831 @opindex momit-leaf-frame-pointer
28832 Don't keep the frame pointer in a register for leaf functions. This
28833 avoids the instructions to save, set up, and restore frame pointers and
28834 makes an extra register available in leaf functions. The option
28835 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28836 which might make debugging harder.
28837
28838 @item -mtls-direct-seg-refs
28839 @itemx -mno-tls-direct-seg-refs
28840 @opindex mtls-direct-seg-refs
28841 Controls whether TLS variables may be accessed with offsets from the
28842 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28843 or whether the thread base pointer must be added. Whether or not this
28844 is valid depends on the operating system, and whether it maps the
28845 segment to cover the entire TLS area.
28846
28847 For systems that use the GNU C Library, the default is on.
28848
28849 @item -msse2avx
28850 @itemx -mno-sse2avx
28851 @opindex msse2avx
28852 Specify that the assembler should encode SSE instructions with VEX
28853 prefix. The option @option{-mavx} turns this on by default.
28854
28855 @item -mfentry
28856 @itemx -mno-fentry
28857 @opindex mfentry
28858 If profiling is active (@option{-pg}), put the profiling
28859 counter call before the prologue.
28860 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28861 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28862
28863 @item -mrecord-mcount
28864 @itemx -mno-record-mcount
28865 @opindex mrecord-mcount
28866 If profiling is active (@option{-pg}), generate a __mcount_loc section
28867 that contains pointers to each profiling call. This is useful for
28868 automatically patching and out calls.
28869
28870 @item -mnop-mcount
28871 @itemx -mno-nop-mcount
28872 @opindex mnop-mcount
28873 If profiling is active (@option{-pg}), generate the calls to
28874 the profiling functions as NOPs. This is useful when they
28875 should be patched in later dynamically. This is likely only
28876 useful together with @option{-mrecord-mcount}.
28877
28878 @item -minstrument-return=@var{type}
28879 @opindex minstrument-return
28880 Instrument function exit in -pg -mfentry instrumented functions with
28881 call to specified function. This only instruments true returns ending
28882 with ret, but not sibling calls ending with jump. Valid types
28883 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28884 or @var{nop5} to generate a 5 byte nop.
28885
28886 @item -mrecord-return
28887 @itemx -mno-record-return
28888 @opindex mrecord-return
28889 Generate a __return_loc section pointing to all return instrumentation code.
28890
28891 @item -mfentry-name=@var{name}
28892 @opindex mfentry-name
28893 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28894
28895 @item -mfentry-section=@var{name}
28896 @opindex mfentry-section
28897 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28898
28899 @item -mskip-rax-setup
28900 @itemx -mno-skip-rax-setup
28901 @opindex mskip-rax-setup
28902 When generating code for the x86-64 architecture with SSE extensions
28903 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28904 register when there are no variable arguments passed in vector registers.
28905
28906 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28907 saving vector registers on stack when passing variable arguments, the
28908 impacts of this option are callees may waste some stack space,
28909 misbehave or jump to a random location. GCC 4.4 or newer don't have
28910 those issues, regardless the RAX register value.
28911
28912 @item -m8bit-idiv
28913 @itemx -mno-8bit-idiv
28914 @opindex m8bit-idiv
28915 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28916 much faster than 32-bit/64-bit integer divide. This option generates a
28917 run-time check. If both dividend and divisor are within range of 0
28918 to 255, 8-bit unsigned integer divide is used instead of
28919 32-bit/64-bit integer divide.
28920
28921 @item -mavx256-split-unaligned-load
28922 @itemx -mavx256-split-unaligned-store
28923 @opindex mavx256-split-unaligned-load
28924 @opindex mavx256-split-unaligned-store
28925 Split 32-byte AVX unaligned load and store.
28926
28927 @item -mstack-protector-guard=@var{guard}
28928 @itemx -mstack-protector-guard-reg=@var{reg}
28929 @itemx -mstack-protector-guard-offset=@var{offset}
28930 @opindex mstack-protector-guard
28931 @opindex mstack-protector-guard-reg
28932 @opindex mstack-protector-guard-offset
28933 Generate stack protection code using canary at @var{guard}. Supported
28934 locations are @samp{global} for global canary or @samp{tls} for per-thread
28935 canary in the TLS block (the default). This option has effect only when
28936 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28937
28938 With the latter choice the options
28939 @option{-mstack-protector-guard-reg=@var{reg}} and
28940 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28941 which segment register (@code{%fs} or @code{%gs}) to use as base register
28942 for reading the canary, and from what offset from that base register.
28943 The default for those is as specified in the relevant ABI.
28944
28945 @item -mgeneral-regs-only
28946 @opindex mgeneral-regs-only
28947 Generate code that uses only the general-purpose registers. This
28948 prevents the compiler from using floating-point, vector, mask and bound
28949 registers.
28950
28951 @item -mindirect-branch=@var{choice}
28952 @opindex mindirect-branch
28953 Convert indirect call and jump with @var{choice}. The default is
28954 @samp{keep}, which keeps indirect call and jump unmodified.
28955 @samp{thunk} converts indirect call and jump to call and return thunk.
28956 @samp{thunk-inline} converts indirect call and jump to inlined call
28957 and return thunk. @samp{thunk-extern} converts indirect call and jump
28958 to external call and return thunk provided in a separate object file.
28959 You can control this behavior for a specific function by using the
28960 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28961
28962 Note that @option{-mcmodel=large} is incompatible with
28963 @option{-mindirect-branch=thunk} and
28964 @option{-mindirect-branch=thunk-extern} since the thunk function may
28965 not be reachable in the large code model.
28966
28967 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28968 @option{-fcf-protection=branch} since the external thunk cannot be modified
28969 to disable control-flow check.
28970
28971 @item -mfunction-return=@var{choice}
28972 @opindex mfunction-return
28973 Convert function return with @var{choice}. The default is @samp{keep},
28974 which keeps function return unmodified. @samp{thunk} converts function
28975 return to call and return thunk. @samp{thunk-inline} converts function
28976 return to inlined call and return thunk. @samp{thunk-extern} converts
28977 function return to external call and return thunk provided in a separate
28978 object file. You can control this behavior for a specific function by
28979 using the function attribute @code{function_return}.
28980 @xref{Function Attributes}.
28981
28982 Note that @option{-mcmodel=large} is incompatible with
28983 @option{-mfunction-return=thunk} and
28984 @option{-mfunction-return=thunk-extern} since the thunk function may
28985 not be reachable in the large code model.
28986
28987
28988 @item -mindirect-branch-register
28989 @opindex mindirect-branch-register
28990 Force indirect call and jump via register.
28991
28992 @end table
28993
28994 These @samp{-m} switches are supported in addition to the above
28995 on x86-64 processors in 64-bit environments.
28996
28997 @table @gcctabopt
28998 @item -m32
28999 @itemx -m64
29000 @itemx -mx32
29001 @itemx -m16
29002 @itemx -miamcu
29003 @opindex m32
29004 @opindex m64
29005 @opindex mx32
29006 @opindex m16
29007 @opindex miamcu
29008 Generate code for a 16-bit, 32-bit or 64-bit environment.
29009 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
29010 to 32 bits, and
29011 generates code that runs on any i386 system.
29012
29013 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
29014 types to 64 bits, and generates code for the x86-64 architecture.
29015 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
29016 and @option{-mdynamic-no-pic} options.
29017
29018 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
29019 to 32 bits, and
29020 generates code for the x86-64 architecture.
29021
29022 The @option{-m16} option is the same as @option{-m32}, except for that
29023 it outputs the @code{.code16gcc} assembly directive at the beginning of
29024 the assembly output so that the binary can run in 16-bit mode.
29025
29026 The @option{-miamcu} option generates code which conforms to Intel MCU
29027 psABI. It requires the @option{-m32} option to be turned on.
29028
29029 @item -mno-red-zone
29030 @opindex mno-red-zone
29031 @opindex mred-zone
29032 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
29033 by the x86-64 ABI; it is a 128-byte area beyond the location of the
29034 stack pointer that is not modified by signal or interrupt handlers
29035 and therefore can be used for temporary data without adjusting the stack
29036 pointer. The flag @option{-mno-red-zone} disables this red zone.
29037
29038 @item -mcmodel=small
29039 @opindex mcmodel=small
29040 Generate code for the small code model: the program and its symbols must
29041 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
29042 Programs can be statically or dynamically linked. This is the default
29043 code model.
29044
29045 @item -mcmodel=kernel
29046 @opindex mcmodel=kernel
29047 Generate code for the kernel code model. The kernel runs in the
29048 negative 2 GB of the address space.
29049 This model has to be used for Linux kernel code.
29050
29051 @item -mcmodel=medium
29052 @opindex mcmodel=medium
29053 Generate code for the medium model: the program is linked in the lower 2
29054 GB of the address space. Small symbols are also placed there. Symbols
29055 with sizes larger than @option{-mlarge-data-threshold} are put into
29056 large data or BSS sections and can be located above 2GB. Programs can
29057 be statically or dynamically linked.
29058
29059 @item -mcmodel=large
29060 @opindex mcmodel=large
29061 Generate code for the large model. This model makes no assumptions
29062 about addresses and sizes of sections.
29063
29064 @item -maddress-mode=long
29065 @opindex maddress-mode=long
29066 Generate code for long address mode. This is only supported for 64-bit
29067 and x32 environments. It is the default address mode for 64-bit
29068 environments.
29069
29070 @item -maddress-mode=short
29071 @opindex maddress-mode=short
29072 Generate code for short address mode. This is only supported for 32-bit
29073 and x32 environments. It is the default address mode for 32-bit and
29074 x32 environments.
29075 @end table
29076
29077 @node x86 Windows Options
29078 @subsection x86 Windows Options
29079 @cindex x86 Windows Options
29080 @cindex Windows Options for x86
29081
29082 These additional options are available for Microsoft Windows targets:
29083
29084 @table @gcctabopt
29085 @item -mconsole
29086 @opindex mconsole
29087 This option
29088 specifies that a console application is to be generated, by
29089 instructing the linker to set the PE header subsystem type
29090 required for console applications.
29091 This option is available for Cygwin and MinGW targets and is
29092 enabled by default on those targets.
29093
29094 @item -mdll
29095 @opindex mdll
29096 This option is available for Cygwin and MinGW targets. It
29097 specifies that a DLL---a dynamic link library---is to be
29098 generated, enabling the selection of the required runtime
29099 startup object and entry point.
29100
29101 @item -mnop-fun-dllimport
29102 @opindex mnop-fun-dllimport
29103 This option is available for Cygwin and MinGW targets. It
29104 specifies that the @code{dllimport} attribute should be ignored.
29105
29106 @item -mthread
29107 @opindex mthread
29108 This option is available for MinGW targets. It specifies
29109 that MinGW-specific thread support is to be used.
29110
29111 @item -municode
29112 @opindex municode
29113 This option is available for MinGW-w64 targets. It causes
29114 the @code{UNICODE} preprocessor macro to be predefined, and
29115 chooses Unicode-capable runtime startup code.
29116
29117 @item -mwin32
29118 @opindex mwin32
29119 This option is available for Cygwin and MinGW targets. It
29120 specifies that the typical Microsoft Windows predefined macros are to
29121 be set in the pre-processor, but does not influence the choice
29122 of runtime library/startup code.
29123
29124 @item -mwindows
29125 @opindex mwindows
29126 This option is available for Cygwin and MinGW targets. It
29127 specifies that a GUI application is to be generated by
29128 instructing the linker to set the PE header subsystem type
29129 appropriately.
29130
29131 @item -fno-set-stack-executable
29132 @opindex fno-set-stack-executable
29133 @opindex fset-stack-executable
29134 This option is available for MinGW targets. It specifies that
29135 the executable flag for the stack used by nested functions isn't
29136 set. This is necessary for binaries running in kernel mode of
29137 Microsoft Windows, as there the User32 API, which is used to set executable
29138 privileges, isn't available.
29139
29140 @item -fwritable-relocated-rdata
29141 @opindex fno-writable-relocated-rdata
29142 @opindex fwritable-relocated-rdata
29143 This option is available for MinGW and Cygwin targets. It specifies
29144 that relocated-data in read-only section is put into the @code{.data}
29145 section. This is a necessary for older runtimes not supporting
29146 modification of @code{.rdata} sections for pseudo-relocation.
29147
29148 @item -mpe-aligned-commons
29149 @opindex mpe-aligned-commons
29150 This option is available for Cygwin and MinGW targets. It
29151 specifies that the GNU extension to the PE file format that
29152 permits the correct alignment of COMMON variables should be
29153 used when generating code. It is enabled by default if
29154 GCC detects that the target assembler found during configuration
29155 supports the feature.
29156 @end table
29157
29158 See also under @ref{x86 Options} for standard options.
29159
29160 @node Xstormy16 Options
29161 @subsection Xstormy16 Options
29162 @cindex Xstormy16 Options
29163
29164 These options are defined for Xstormy16:
29165
29166 @table @gcctabopt
29167 @item -msim
29168 @opindex msim
29169 Choose startup files and linker script suitable for the simulator.
29170 @end table
29171
29172 @node Xtensa Options
29173 @subsection Xtensa Options
29174 @cindex Xtensa Options
29175
29176 These options are supported for Xtensa targets:
29177
29178 @table @gcctabopt
29179 @item -mconst16
29180 @itemx -mno-const16
29181 @opindex mconst16
29182 @opindex mno-const16
29183 Enable or disable use of @code{CONST16} instructions for loading
29184 constant values. The @code{CONST16} instruction is currently not a
29185 standard option from Tensilica. When enabled, @code{CONST16}
29186 instructions are always used in place of the standard @code{L32R}
29187 instructions. The use of @code{CONST16} is enabled by default only if
29188 the @code{L32R} instruction is not available.
29189
29190 @item -mfused-madd
29191 @itemx -mno-fused-madd
29192 @opindex mfused-madd
29193 @opindex mno-fused-madd
29194 Enable or disable use of fused multiply/add and multiply/subtract
29195 instructions in the floating-point option. This has no effect if the
29196 floating-point option is not also enabled. Disabling fused multiply/add
29197 and multiply/subtract instructions forces the compiler to use separate
29198 instructions for the multiply and add/subtract operations. This may be
29199 desirable in some cases where strict IEEE 754-compliant results are
29200 required: the fused multiply add/subtract instructions do not round the
29201 intermediate result, thereby producing results with @emph{more} bits of
29202 precision than specified by the IEEE standard. Disabling fused multiply
29203 add/subtract instructions also ensures that the program output is not
29204 sensitive to the compiler's ability to combine multiply and add/subtract
29205 operations.
29206
29207 @item -mserialize-volatile
29208 @itemx -mno-serialize-volatile
29209 @opindex mserialize-volatile
29210 @opindex mno-serialize-volatile
29211 When this option is enabled, GCC inserts @code{MEMW} instructions before
29212 @code{volatile} memory references to guarantee sequential consistency.
29213 The default is @option{-mserialize-volatile}. Use
29214 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29215
29216 @item -mforce-no-pic
29217 @opindex mforce-no-pic
29218 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29219 position-independent code (PIC), this option disables PIC for compiling
29220 kernel code.
29221
29222 @item -mtext-section-literals
29223 @itemx -mno-text-section-literals
29224 @opindex mtext-section-literals
29225 @opindex mno-text-section-literals
29226 These options control the treatment of literal pools. The default is
29227 @option{-mno-text-section-literals}, which places literals in a separate
29228 section in the output file. This allows the literal pool to be placed
29229 in a data RAM/ROM, and it also allows the linker to combine literal
29230 pools from separate object files to remove redundant literals and
29231 improve code size. With @option{-mtext-section-literals}, the literals
29232 are interspersed in the text section in order to keep them as close as
29233 possible to their references. This may be necessary for large assembly
29234 files. Literals for each function are placed right before that function.
29235
29236 @item -mauto-litpools
29237 @itemx -mno-auto-litpools
29238 @opindex mauto-litpools
29239 @opindex mno-auto-litpools
29240 These options control the treatment of literal pools. The default is
29241 @option{-mno-auto-litpools}, which places literals in a separate
29242 section in the output file unless @option{-mtext-section-literals} is
29243 used. With @option{-mauto-litpools} the literals are interspersed in
29244 the text section by the assembler. Compiler does not produce explicit
29245 @code{.literal} directives and loads literals into registers with
29246 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29247 do relaxation and place literals as necessary. This option allows
29248 assembler to create several literal pools per function and assemble
29249 very big functions, which may not be possible with
29250 @option{-mtext-section-literals}.
29251
29252 @item -mtarget-align
29253 @itemx -mno-target-align
29254 @opindex mtarget-align
29255 @opindex mno-target-align
29256 When this option is enabled, GCC instructs the assembler to
29257 automatically align instructions to reduce branch penalties at the
29258 expense of some code density. The assembler attempts to widen density
29259 instructions to align branch targets and the instructions following call
29260 instructions. If there are not enough preceding safe density
29261 instructions to align a target, no widening is performed. The
29262 default is @option{-mtarget-align}. These options do not affect the
29263 treatment of auto-aligned instructions like @code{LOOP}, which the
29264 assembler always aligns, either by widening density instructions or
29265 by inserting NOP instructions.
29266
29267 @item -mlongcalls
29268 @itemx -mno-longcalls
29269 @opindex mlongcalls
29270 @opindex mno-longcalls
29271 When this option is enabled, GCC instructs the assembler to translate
29272 direct calls to indirect calls unless it can determine that the target
29273 of a direct call is in the range allowed by the call instruction. This
29274 translation typically occurs for calls to functions in other source
29275 files. Specifically, the assembler translates a direct @code{CALL}
29276 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29277 The default is @option{-mno-longcalls}. This option should be used in
29278 programs where the call target can potentially be out of range. This
29279 option is implemented in the assembler, not the compiler, so the
29280 assembly code generated by GCC still shows direct call
29281 instructions---look at the disassembled object code to see the actual
29282 instructions. Note that the assembler uses an indirect call for
29283 every cross-file call, not just those that really are out of range.
29284 @end table
29285
29286 @node zSeries Options
29287 @subsection zSeries Options
29288 @cindex zSeries options
29289
29290 These are listed under @xref{S/390 and zSeries Options}.
29291
29292
29293 @c man end
29294
29295 @node Spec Files
29296 @section Specifying Subprocesses and the Switches to Pass to Them
29297 @cindex Spec Files
29298
29299 @command{gcc} is a driver program. It performs its job by invoking a
29300 sequence of other programs to do the work of compiling, assembling and
29301 linking. GCC interprets its command-line parameters and uses these to
29302 deduce which programs it should invoke, and which command-line options
29303 it ought to place on their command lines. This behavior is controlled
29304 by @dfn{spec strings}. In most cases there is one spec string for each
29305 program that GCC can invoke, but a few programs have multiple spec
29306 strings to control their behavior. The spec strings built into GCC can
29307 be overridden by using the @option{-specs=} command-line switch to specify
29308 a spec file.
29309
29310 @dfn{Spec files} are plain-text files that are used to construct spec
29311 strings. They consist of a sequence of directives separated by blank
29312 lines. The type of directive is determined by the first non-whitespace
29313 character on the line, which can be one of the following:
29314
29315 @table @code
29316 @item %@var{command}
29317 Issues a @var{command} to the spec file processor. The commands that can
29318 appear here are:
29319
29320 @table @code
29321 @item %include <@var{file}>
29322 @cindex @code{%include}
29323 Search for @var{file} and insert its text at the current point in the
29324 specs file.
29325
29326 @item %include_noerr <@var{file}>
29327 @cindex @code{%include_noerr}
29328 Just like @samp{%include}, but do not generate an error message if the include
29329 file cannot be found.
29330
29331 @item %rename @var{old_name} @var{new_name}
29332 @cindex @code{%rename}
29333 Rename the spec string @var{old_name} to @var{new_name}.
29334
29335 @end table
29336
29337 @item *[@var{spec_name}]:
29338 This tells the compiler to create, override or delete the named spec
29339 string. All lines after this directive up to the next directive or
29340 blank line are considered to be the text for the spec string. If this
29341 results in an empty string then the spec is deleted. (Or, if the
29342 spec did not exist, then nothing happens.) Otherwise, if the spec
29343 does not currently exist a new spec is created. If the spec does
29344 exist then its contents are overridden by the text of this
29345 directive, unless the first character of that text is the @samp{+}
29346 character, in which case the text is appended to the spec.
29347
29348 @item [@var{suffix}]:
29349 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29350 and up to the next directive or blank line are considered to make up the
29351 spec string for the indicated suffix. When the compiler encounters an
29352 input file with the named suffix, it processes the spec string in
29353 order to work out how to compile that file. For example:
29354
29355 @smallexample
29356 .ZZ:
29357 z-compile -input %i
29358 @end smallexample
29359
29360 This says that any input file whose name ends in @samp{.ZZ} should be
29361 passed to the program @samp{z-compile}, which should be invoked with the
29362 command-line switch @option{-input} and with the result of performing the
29363 @samp{%i} substitution. (See below.)
29364
29365 As an alternative to providing a spec string, the text following a
29366 suffix directive can be one of the following:
29367
29368 @table @code
29369 @item @@@var{language}
29370 This says that the suffix is an alias for a known @var{language}. This is
29371 similar to using the @option{-x} command-line switch to GCC to specify a
29372 language explicitly. For example:
29373
29374 @smallexample
29375 .ZZ:
29376 @@c++
29377 @end smallexample
29378
29379 Says that .ZZ files are, in fact, C++ source files.
29380
29381 @item #@var{name}
29382 This causes an error messages saying:
29383
29384 @smallexample
29385 @var{name} compiler not installed on this system.
29386 @end smallexample
29387 @end table
29388
29389 GCC already has an extensive list of suffixes built into it.
29390 This directive adds an entry to the end of the list of suffixes, but
29391 since the list is searched from the end backwards, it is effectively
29392 possible to override earlier entries using this technique.
29393
29394 @end table
29395
29396 GCC has the following spec strings built into it. Spec files can
29397 override these strings or create their own. Note that individual
29398 targets can also add their own spec strings to this list.
29399
29400 @smallexample
29401 asm Options to pass to the assembler
29402 asm_final Options to pass to the assembler post-processor
29403 cpp Options to pass to the C preprocessor
29404 cc1 Options to pass to the C compiler
29405 cc1plus Options to pass to the C++ compiler
29406 endfile Object files to include at the end of the link
29407 link Options to pass to the linker
29408 lib Libraries to include on the command line to the linker
29409 libgcc Decides which GCC support library to pass to the linker
29410 linker Sets the name of the linker
29411 predefines Defines to be passed to the C preprocessor
29412 signed_char Defines to pass to CPP to say whether @code{char} is signed
29413 by default
29414 startfile Object files to include at the start of the link
29415 @end smallexample
29416
29417 Here is a small example of a spec file:
29418
29419 @smallexample
29420 %rename lib old_lib
29421
29422 *lib:
29423 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29424 @end smallexample
29425
29426 This example renames the spec called @samp{lib} to @samp{old_lib} and
29427 then overrides the previous definition of @samp{lib} with a new one.
29428 The new definition adds in some extra command-line options before
29429 including the text of the old definition.
29430
29431 @dfn{Spec strings} are a list of command-line options to be passed to their
29432 corresponding program. In addition, the spec strings can contain
29433 @samp{%}-prefixed sequences to substitute variable text or to
29434 conditionally insert text into the command line. Using these constructs
29435 it is possible to generate quite complex command lines.
29436
29437 Here is a table of all defined @samp{%}-sequences for spec
29438 strings. Note that spaces are not generated automatically around the
29439 results of expanding these sequences. Therefore you can concatenate them
29440 together or combine them with constant text in a single argument.
29441
29442 @table @code
29443 @item %%
29444 Substitute one @samp{%} into the program name or argument.
29445
29446 @item %i
29447 Substitute the name of the input file being processed.
29448
29449 @item %b
29450 Substitute the basename of the input file being processed.
29451 This is the substring up to (and not including) the last period
29452 and not including the directory.
29453
29454 @item %B
29455 This is the same as @samp{%b}, but include the file suffix (text after
29456 the last period).
29457
29458 @item %d
29459 Marks the argument containing or following the @samp{%d} as a
29460 temporary file name, so that that file is deleted if GCC exits
29461 successfully. Unlike @samp{%g}, this contributes no text to the
29462 argument.
29463
29464 @item %g@var{suffix}
29465 Substitute a file name that has suffix @var{suffix} and is chosen
29466 once per compilation, and mark the argument in the same way as
29467 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29468 name is now chosen in a way that is hard to predict even when previously
29469 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29470 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29471 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29472 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29473 was simply substituted with a file name chosen once per compilation,
29474 without regard to any appended suffix (which was therefore treated
29475 just like ordinary text), making such attacks more likely to succeed.
29476
29477 @item %u@var{suffix}
29478 Like @samp{%g}, but generates a new temporary file name
29479 each time it appears instead of once per compilation.
29480
29481 @item %U@var{suffix}
29482 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29483 new one if there is no such last file name. In the absence of any
29484 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29485 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29486 involves the generation of two distinct file names, one
29487 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29488 simply substituted with a file name chosen for the previous @samp{%u},
29489 without regard to any appended suffix.
29490
29491 @item %j@var{suffix}
29492 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29493 writable, and if @option{-save-temps} is not used;
29494 otherwise, substitute the name
29495 of a temporary file, just like @samp{%u}. This temporary file is not
29496 meant for communication between processes, but rather as a junk
29497 disposal mechanism.
29498
29499 @item %|@var{suffix}
29500 @itemx %m@var{suffix}
29501 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29502 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29503 all. These are the two most common ways to instruct a program that it
29504 should read from standard input or write to standard output. If you
29505 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29506 construct: see for example @file{gcc/fortran/lang-specs.h}.
29507
29508 @item %.@var{SUFFIX}
29509 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29510 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29511 terminated by the next space or %.
29512
29513 @item %w
29514 Marks the argument containing or following the @samp{%w} as the
29515 designated output file of this compilation. This puts the argument
29516 into the sequence of arguments that @samp{%o} substitutes.
29517
29518 @item %o
29519 Substitutes the names of all the output files, with spaces
29520 automatically placed around them. You should write spaces
29521 around the @samp{%o} as well or the results are undefined.
29522 @samp{%o} is for use in the specs for running the linker.
29523 Input files whose names have no recognized suffix are not compiled
29524 at all, but they are included among the output files, so they are
29525 linked.
29526
29527 @item %O
29528 Substitutes the suffix for object files. Note that this is
29529 handled specially when it immediately follows @samp{%g, %u, or %U},
29530 because of the need for those to form complete file names. The
29531 handling is such that @samp{%O} is treated exactly as if it had already
29532 been substituted, except that @samp{%g, %u, and %U} do not currently
29533 support additional @var{suffix} characters following @samp{%O} as they do
29534 following, for example, @samp{.o}.
29535
29536 @item %p
29537 Substitutes the standard macro predefinitions for the
29538 current target machine. Use this when running @command{cpp}.
29539
29540 @item %P
29541 Like @samp{%p}, but puts @samp{__} before and after the name of each
29542 predefined macro, except for macros that start with @samp{__} or with
29543 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29544 C@.
29545
29546 @item %I
29547 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29548 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29549 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29550 and @option{-imultilib} as necessary.
29551
29552 @item %s
29553 Current argument is the name of a library or startup file of some sort.
29554 Search for that file in a standard list of directories and substitute
29555 the full name found. The current working directory is included in the
29556 list of directories scanned.
29557
29558 @item %T
29559 Current argument is the name of a linker script. Search for that file
29560 in the current list of directories to scan for libraries. If the file
29561 is located insert a @option{--script} option into the command line
29562 followed by the full path name found. If the file is not found then
29563 generate an error message. Note: the current working directory is not
29564 searched.
29565
29566 @item %e@var{str}
29567 Print @var{str} as an error message. @var{str} is terminated by a newline.
29568 Use this when inconsistent options are detected.
29569
29570 @item %(@var{name})
29571 Substitute the contents of spec string @var{name} at this point.
29572
29573 @item %x@{@var{option}@}
29574 Accumulate an option for @samp{%X}.
29575
29576 @item %X
29577 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29578 spec string.
29579
29580 @item %Y
29581 Output the accumulated assembler options specified by @option{-Wa}.
29582
29583 @item %Z
29584 Output the accumulated preprocessor options specified by @option{-Wp}.
29585
29586 @item %a
29587 Process the @code{asm} spec. This is used to compute the
29588 switches to be passed to the assembler.
29589
29590 @item %A
29591 Process the @code{asm_final} spec. This is a spec string for
29592 passing switches to an assembler post-processor, if such a program is
29593 needed.
29594
29595 @item %l
29596 Process the @code{link} spec. This is the spec for computing the
29597 command line passed to the linker. Typically it makes use of the
29598 @samp{%L %G %S %D and %E} sequences.
29599
29600 @item %D
29601 Dump out a @option{-L} option for each directory that GCC believes might
29602 contain startup files. If the target supports multilibs then the
29603 current multilib directory is prepended to each of these paths.
29604
29605 @item %L
29606 Process the @code{lib} spec. This is a spec string for deciding which
29607 libraries are included on the command line to the linker.
29608
29609 @item %G
29610 Process the @code{libgcc} spec. This is a spec string for deciding
29611 which GCC support library is included on the command line to the linker.
29612
29613 @item %S
29614 Process the @code{startfile} spec. This is a spec for deciding which
29615 object files are the first ones passed to the linker. Typically
29616 this might be a file named @file{crt0.o}.
29617
29618 @item %E
29619 Process the @code{endfile} spec. This is a spec string that specifies
29620 the last object files that are passed to the linker.
29621
29622 @item %C
29623 Process the @code{cpp} spec. This is used to construct the arguments
29624 to be passed to the C preprocessor.
29625
29626 @item %1
29627 Process the @code{cc1} spec. This is used to construct the options to be
29628 passed to the actual C compiler (@command{cc1}).
29629
29630 @item %2
29631 Process the @code{cc1plus} spec. This is used to construct the options to be
29632 passed to the actual C++ compiler (@command{cc1plus}).
29633
29634 @item %*
29635 Substitute the variable part of a matched option. See below.
29636 Note that each comma in the substituted string is replaced by
29637 a single space.
29638
29639 @item %<S
29640 Remove all occurrences of @code{-S} from the command line. Note---this
29641 command is position dependent. @samp{%} commands in the spec string
29642 before this one see @code{-S}, @samp{%} commands in the spec string
29643 after this one do not.
29644
29645 @item %:@var{function}(@var{args})
29646 Call the named function @var{function}, passing it @var{args}.
29647 @var{args} is first processed as a nested spec string, then split
29648 into an argument vector in the usual fashion. The function returns
29649 a string which is processed as if it had appeared literally as part
29650 of the current spec.
29651
29652 The following built-in spec functions are provided:
29653
29654 @table @code
29655 @item @code{getenv}
29656 The @code{getenv} spec function takes two arguments: an environment
29657 variable name and a string. If the environment variable is not
29658 defined, a fatal error is issued. Otherwise, the return value is the
29659 value of the environment variable concatenated with the string. For
29660 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29661
29662 @smallexample
29663 %:getenv(TOPDIR /include)
29664 @end smallexample
29665
29666 expands to @file{/path/to/top/include}.
29667
29668 @item @code{if-exists}
29669 The @code{if-exists} spec function takes one argument, an absolute
29670 pathname to a file. If the file exists, @code{if-exists} returns the
29671 pathname. Here is a small example of its usage:
29672
29673 @smallexample
29674 *startfile:
29675 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29676 @end smallexample
29677
29678 @item @code{if-exists-else}
29679 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29680 spec function, except that it takes two arguments. The first argument is
29681 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29682 returns the pathname. If it does not exist, it returns the second argument.
29683 This way, @code{if-exists-else} can be used to select one file or another,
29684 based on the existence of the first. Here is a small example of its usage:
29685
29686 @smallexample
29687 *startfile:
29688 crt0%O%s %:if-exists(crti%O%s) \
29689 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29690 @end smallexample
29691
29692 @item @code{replace-outfile}
29693 The @code{replace-outfile} spec function takes two arguments. It looks for the
29694 first argument in the outfiles array and replaces it with the second argument. Here
29695 is a small example of its usage:
29696
29697 @smallexample
29698 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29699 @end smallexample
29700
29701 @item @code{remove-outfile}
29702 The @code{remove-outfile} spec function takes one argument. It looks for the
29703 first argument in the outfiles array and removes it. Here is a small example
29704 its usage:
29705
29706 @smallexample
29707 %:remove-outfile(-lm)
29708 @end smallexample
29709
29710 @item @code{pass-through-libs}
29711 The @code{pass-through-libs} spec function takes any number of arguments. It
29712 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29713 assumes are the names of linker input library archive files) and returns a
29714 result containing all the found arguments each prepended by
29715 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29716 intended to be passed to the LTO linker plugin.
29717
29718 @smallexample
29719 %:pass-through-libs(%G %L %G)
29720 @end smallexample
29721
29722 @item @code{print-asm-header}
29723 The @code{print-asm-header} function takes no arguments and simply
29724 prints a banner like:
29725
29726 @smallexample
29727 Assembler options
29728 =================
29729
29730 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29731 @end smallexample
29732
29733 It is used to separate compiler options from assembler options
29734 in the @option{--target-help} output.
29735 @end table
29736
29737 @item %@{S@}
29738 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29739 If that switch is not specified, this substitutes nothing. Note that
29740 the leading dash is omitted when specifying this option, and it is
29741 automatically inserted if the substitution is performed. Thus the spec
29742 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29743 and outputs the command-line option @option{-foo}.
29744
29745 @item %W@{S@}
29746 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29747 deleted on failure.
29748
29749 @item %@{S*@}
29750 Substitutes all the switches specified to GCC whose names start
29751 with @code{-S}, but which also take an argument. This is used for
29752 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29753 GCC considers @option{-o foo} as being
29754 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29755 text, including the space. Thus two arguments are generated.
29756
29757 @item %@{S*&T*@}
29758 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29759 (the order of @code{S} and @code{T} in the spec is not significant).
29760 There can be any number of ampersand-separated variables; for each the
29761 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29762
29763 @item %@{S:X@}
29764 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29765
29766 @item %@{!S:X@}
29767 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29768
29769 @item %@{S*:X@}
29770 Substitutes @code{X} if one or more switches whose names start with
29771 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29772 once, no matter how many such switches appeared. However, if @code{%*}
29773 appears somewhere in @code{X}, then @code{X} is substituted once
29774 for each matching switch, with the @code{%*} replaced by the part of
29775 that switch matching the @code{*}.
29776
29777 If @code{%*} appears as the last part of a spec sequence then a space
29778 is added after the end of the last substitution. If there is more
29779 text in the sequence, however, then a space is not generated. This
29780 allows the @code{%*} substitution to be used as part of a larger
29781 string. For example, a spec string like this:
29782
29783 @smallexample
29784 %@{mcu=*:--script=%*/memory.ld@}
29785 @end smallexample
29786
29787 @noindent
29788 when matching an option like @option{-mcu=newchip} produces:
29789
29790 @smallexample
29791 --script=newchip/memory.ld
29792 @end smallexample
29793
29794 @item %@{.S:X@}
29795 Substitutes @code{X}, if processing a file with suffix @code{S}.
29796
29797 @item %@{!.S:X@}
29798 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29799
29800 @item %@{,S:X@}
29801 Substitutes @code{X}, if processing a file for language @code{S}.
29802
29803 @item %@{!,S:X@}
29804 Substitutes @code{X}, if not processing a file for language @code{S}.
29805
29806 @item %@{S|P:X@}
29807 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29808 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29809 @code{*} sequences as well, although they have a stronger binding than
29810 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29811 alternatives must be starred, and only the first matching alternative
29812 is substituted.
29813
29814 For example, a spec string like this:
29815
29816 @smallexample
29817 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29818 @end smallexample
29819
29820 @noindent
29821 outputs the following command-line options from the following input
29822 command-line options:
29823
29824 @smallexample
29825 fred.c -foo -baz
29826 jim.d -bar -boggle
29827 -d fred.c -foo -baz -boggle
29828 -d jim.d -bar -baz -boggle
29829 @end smallexample
29830
29831 @item %@{S:X; T:Y; :D@}
29832
29833 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29834 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29835 be as many clauses as you need. This may be combined with @code{.},
29836 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29837
29838
29839 @end table
29840
29841 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29842 or similar construct can use a backslash to ignore the special meaning
29843 of the character following it, thus allowing literal matching of a
29844 character that is otherwise specially treated. For example,
29845 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29846 @option{-std=iso9899:1999} option is given.
29847
29848 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29849 construct may contain other nested @samp{%} constructs or spaces, or
29850 even newlines. They are processed as usual, as described above.
29851 Trailing white space in @code{X} is ignored. White space may also
29852 appear anywhere on the left side of the colon in these constructs,
29853 except between @code{.} or @code{*} and the corresponding word.
29854
29855 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29856 handled specifically in these constructs. If another value of
29857 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29858 @option{-W} switch is found later in the command line, the earlier
29859 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29860 just one letter, which passes all matching options.
29861
29862 The character @samp{|} at the beginning of the predicate text is used to
29863 indicate that a command should be piped to the following command, but
29864 only if @option{-pipe} is specified.
29865
29866 It is built into GCC which switches take arguments and which do not.
29867 (You might think it would be useful to generalize this to allow each
29868 compiler's spec to say which switches take arguments. But this cannot
29869 be done in a consistent fashion. GCC cannot even decide which input
29870 files have been specified without knowing which switches take arguments,
29871 and it must know which input files to compile in order to tell which
29872 compilers to run).
29873
29874 GCC also knows implicitly that arguments starting in @option{-l} are to be
29875 treated as compiler output files, and passed to the linker in their
29876 proper position among the other output files.
29877
29878 @node Environment Variables
29879 @section Environment Variables Affecting GCC
29880 @cindex environment variables
29881
29882 @c man begin ENVIRONMENT
29883 This section describes several environment variables that affect how GCC
29884 operates. Some of them work by specifying directories or prefixes to use
29885 when searching for various kinds of files. Some are used to specify other
29886 aspects of the compilation environment.
29887
29888 Note that you can also specify places to search using options such as
29889 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29890 take precedence over places specified using environment variables, which
29891 in turn take precedence over those specified by the configuration of GCC@.
29892 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29893 GNU Compiler Collection (GCC) Internals}.
29894
29895 @table @env
29896 @item LANG
29897 @itemx LC_CTYPE
29898 @c @itemx LC_COLLATE
29899 @itemx LC_MESSAGES
29900 @c @itemx LC_MONETARY
29901 @c @itemx LC_NUMERIC
29902 @c @itemx LC_TIME
29903 @itemx LC_ALL
29904 @findex LANG
29905 @findex LC_CTYPE
29906 @c @findex LC_COLLATE
29907 @findex LC_MESSAGES
29908 @c @findex LC_MONETARY
29909 @c @findex LC_NUMERIC
29910 @c @findex LC_TIME
29911 @findex LC_ALL
29912 @cindex locale
29913 These environment variables control the way that GCC uses
29914 localization information which allows GCC to work with different
29915 national conventions. GCC inspects the locale categories
29916 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29917 so. These locale categories can be set to any value supported by your
29918 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29919 Kingdom encoded in UTF-8.
29920
29921 The @env{LC_CTYPE} environment variable specifies character
29922 classification. GCC uses it to determine the character boundaries in
29923 a string; this is needed for some multibyte encodings that contain quote
29924 and escape characters that are otherwise interpreted as a string
29925 end or escape.
29926
29927 The @env{LC_MESSAGES} environment variable specifies the language to
29928 use in diagnostic messages.
29929
29930 If the @env{LC_ALL} environment variable is set, it overrides the value
29931 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29932 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29933 environment variable. If none of these variables are set, GCC
29934 defaults to traditional C English behavior.
29935
29936 @item TMPDIR
29937 @findex TMPDIR
29938 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29939 files. GCC uses temporary files to hold the output of one stage of
29940 compilation which is to be used as input to the next stage: for example,
29941 the output of the preprocessor, which is the input to the compiler
29942 proper.
29943
29944 @item GCC_COMPARE_DEBUG
29945 @findex GCC_COMPARE_DEBUG
29946 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29947 @option{-fcompare-debug} to the compiler driver. See the documentation
29948 of this option for more details.
29949
29950 @item GCC_EXEC_PREFIX
29951 @findex GCC_EXEC_PREFIX
29952 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29953 names of the subprograms executed by the compiler. No slash is added
29954 when this prefix is combined with the name of a subprogram, but you can
29955 specify a prefix that ends with a slash if you wish.
29956
29957 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29958 an appropriate prefix to use based on the pathname it is invoked with.
29959
29960 If GCC cannot find the subprogram using the specified prefix, it
29961 tries looking in the usual places for the subprogram.
29962
29963 The default value of @env{GCC_EXEC_PREFIX} is
29964 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29965 the installed compiler. In many cases @var{prefix} is the value
29966 of @code{prefix} when you ran the @file{configure} script.
29967
29968 Other prefixes specified with @option{-B} take precedence over this prefix.
29969
29970 This prefix is also used for finding files such as @file{crt0.o} that are
29971 used for linking.
29972
29973 In addition, the prefix is used in an unusual way in finding the
29974 directories to search for header files. For each of the standard
29975 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29976 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29977 replacing that beginning with the specified prefix to produce an
29978 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29979 @file{foo/bar} just before it searches the standard directory
29980 @file{/usr/local/lib/bar}.
29981 If a standard directory begins with the configured
29982 @var{prefix} then the value of @var{prefix} is replaced by
29983 @env{GCC_EXEC_PREFIX} when looking for header files.
29984
29985 @item COMPILER_PATH
29986 @findex COMPILER_PATH
29987 The value of @env{COMPILER_PATH} is a colon-separated list of
29988 directories, much like @env{PATH}. GCC tries the directories thus
29989 specified when searching for subprograms, if it cannot find the
29990 subprograms using @env{GCC_EXEC_PREFIX}.
29991
29992 @item LIBRARY_PATH
29993 @findex LIBRARY_PATH
29994 The value of @env{LIBRARY_PATH} is a colon-separated list of
29995 directories, much like @env{PATH}. When configured as a native compiler,
29996 GCC tries the directories thus specified when searching for special
29997 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29998 using GCC also uses these directories when searching for ordinary
29999 libraries for the @option{-l} option (but directories specified with
30000 @option{-L} come first).
30001
30002 @item LANG
30003 @findex LANG
30004 @cindex locale definition
30005 This variable is used to pass locale information to the compiler. One way in
30006 which this information is used is to determine the character set to be used
30007 when character literals, string literals and comments are parsed in C and C++.
30008 When the compiler is configured to allow multibyte characters,
30009 the following values for @env{LANG} are recognized:
30010
30011 @table @samp
30012 @item C-JIS
30013 Recognize JIS characters.
30014 @item C-SJIS
30015 Recognize SJIS characters.
30016 @item C-EUCJP
30017 Recognize EUCJP characters.
30018 @end table
30019
30020 If @env{LANG} is not defined, or if it has some other value, then the
30021 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
30022 recognize and translate multibyte characters.
30023 @end table
30024
30025 @noindent
30026 Some additional environment variables affect the behavior of the
30027 preprocessor.
30028
30029 @include cppenv.texi
30030
30031 @c man end
30032
30033 @node Precompiled Headers
30034 @section Using Precompiled Headers
30035 @cindex precompiled headers
30036 @cindex speed of compilation
30037
30038 Often large projects have many header files that are included in every
30039 source file. The time the compiler takes to process these header files
30040 over and over again can account for nearly all of the time required to
30041 build the project. To make builds faster, GCC allows you to
30042 @dfn{precompile} a header file.
30043
30044 To create a precompiled header file, simply compile it as you would any
30045 other file, if necessary using the @option{-x} option to make the driver
30046 treat it as a C or C++ header file. You may want to use a
30047 tool like @command{make} to keep the precompiled header up-to-date when
30048 the headers it contains change.
30049
30050 A precompiled header file is searched for when @code{#include} is
30051 seen in the compilation. As it searches for the included file
30052 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
30053 compiler looks for a precompiled header in each directory just before it
30054 looks for the include file in that directory. The name searched for is
30055 the name specified in the @code{#include} with @samp{.gch} appended. If
30056 the precompiled header file cannot be used, it is ignored.
30057
30058 For instance, if you have @code{#include "all.h"}, and you have
30059 @file{all.h.gch} in the same directory as @file{all.h}, then the
30060 precompiled header file is used if possible, and the original
30061 header is used otherwise.
30062
30063 Alternatively, you might decide to put the precompiled header file in a
30064 directory and use @option{-I} to ensure that directory is searched
30065 before (or instead of) the directory containing the original header.
30066 Then, if you want to check that the precompiled header file is always
30067 used, you can put a file of the same name as the original header in this
30068 directory containing an @code{#error} command.
30069
30070 This also works with @option{-include}. So yet another way to use
30071 precompiled headers, good for projects not designed with precompiled
30072 header files in mind, is to simply take most of the header files used by
30073 a project, include them from another header file, precompile that header
30074 file, and @option{-include} the precompiled header. If the header files
30075 have guards against multiple inclusion, they are skipped because
30076 they've already been included (in the precompiled header).
30077
30078 If you need to precompile the same header file for different
30079 languages, targets, or compiler options, you can instead make a
30080 @emph{directory} named like @file{all.h.gch}, and put each precompiled
30081 header in the directory, perhaps using @option{-o}. It doesn't matter
30082 what you call the files in the directory; every precompiled header in
30083 the directory is considered. The first precompiled header
30084 encountered in the directory that is valid for this compilation is
30085 used; they're searched in no particular order.
30086
30087 There are many other possibilities, limited only by your imagination,
30088 good sense, and the constraints of your build system.
30089
30090 A precompiled header file can be used only when these conditions apply:
30091
30092 @itemize
30093 @item
30094 Only one precompiled header can be used in a particular compilation.
30095
30096 @item
30097 A precompiled header cannot be used once the first C token is seen. You
30098 can have preprocessor directives before a precompiled header; you cannot
30099 include a precompiled header from inside another header.
30100
30101 @item
30102 The precompiled header file must be produced for the same language as
30103 the current compilation. You cannot use a C precompiled header for a C++
30104 compilation.
30105
30106 @item
30107 The precompiled header file must have been produced by the same compiler
30108 binary as the current compilation is using.
30109
30110 @item
30111 Any macros defined before the precompiled header is included must
30112 either be defined in the same way as when the precompiled header was
30113 generated, or must not affect the precompiled header, which usually
30114 means that they don't appear in the precompiled header at all.
30115
30116 The @option{-D} option is one way to define a macro before a
30117 precompiled header is included; using a @code{#define} can also do it.
30118 There are also some options that define macros implicitly, like
30119 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30120 defined this way.
30121
30122 @item If debugging information is output when using the precompiled
30123 header, using @option{-g} or similar, the same kind of debugging information
30124 must have been output when building the precompiled header. However,
30125 a precompiled header built using @option{-g} can be used in a compilation
30126 when no debugging information is being output.
30127
30128 @item The same @option{-m} options must generally be used when building
30129 and using the precompiled header. @xref{Submodel Options},
30130 for any cases where this rule is relaxed.
30131
30132 @item Each of the following options must be the same when building and using
30133 the precompiled header:
30134
30135 @gccoptlist{-fexceptions}
30136
30137 @item
30138 Some other command-line options starting with @option{-f},
30139 @option{-p}, or @option{-O} must be defined in the same way as when
30140 the precompiled header was generated. At present, it's not clear
30141 which options are safe to change and which are not; the safest choice
30142 is to use exactly the same options when generating and using the
30143 precompiled header. The following are known to be safe:
30144
30145 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30146 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30147 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30148 -pedantic-errors}
30149
30150 @end itemize
30151
30152 For all of these except the last, the compiler automatically
30153 ignores the precompiled header if the conditions aren't met. If you
30154 find an option combination that doesn't work and doesn't cause the
30155 precompiled header to be ignored, please consider filing a bug report,
30156 see @ref{Bugs}.
30157
30158 If you do use differing options when generating and using the
30159 precompiled header, the actual behavior is a mixture of the
30160 behavior for the options. For instance, if you use @option{-g} to
30161 generate the precompiled header but not when using it, you may or may
30162 not get debugging information for routines in the precompiled header.