]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
Remove Cell Broadband Engine SPU targets
[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 -frepo -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-format=@r{[}text@r{|}json@r{]} @gol
277 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
278 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
279 -fdiagnostics-minimum-margin-width=@var{width} @gol
280 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
281 -fdiagnostics-show-template-tree -fno-elide-type @gol
282 -fno-show-column}
283
284 @item Warning Options
285 @xref{Warning Options,,Options to Request or Suppress Warnings}.
286 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
287 -pedantic-errors @gol
288 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
289 -Waggregate-return -Waligned-new @gol
290 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
291 -Walloca -Walloca-larger-than=@var{byte-size} @gol
292 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
293 -Wno-attributes -Wattribute-alias=@var{n} @gol
294 -Wbool-compare -Wbool-operation @gol
295 -Wno-builtin-declaration-mismatch @gol
296 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
297 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
298 -Wc++20-compat @gol
299 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
300 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
301 -Wclobbered -Wcomment -Wconditionally-supported @gol
302 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
303 -Wdelete-incomplete @gol
304 -Wno-attribute-warning @gol
305 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
306 -Wdisabled-optimization @gol
307 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
308 -Wno-div-by-zero -Wdouble-promotion @gol
309 -Wduplicated-branches -Wduplicated-cond @gol
310 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
311 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
312 -Wfloat-equal -Wformat -Wformat=2 @gol
313 -Wno-format-contains-nul -Wno-format-extra-args @gol
314 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
315 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
316 -Wformat-y2k -Wframe-address @gol
317 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
318 -Wjump-misses-init @gol
319 -Whsa -Wif-not-aligned @gol
320 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
321 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
322 -Wimplicit-function-declaration -Wimplicit-int @gol
323 -Winaccessible-base @gol
324 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
325 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
326 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
327 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
328 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
329 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
330 -Wmissing-field-initializers -Wmissing-format-attribute @gol
331 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
332 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
333 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
334 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
335 -Woverride-init-side-effects -Woverlength-strings @gol
336 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
337 -Wparentheses -Wno-pedantic-ms-format @gol
338 -Wplacement-new -Wplacement-new=@var{n} @gol
339 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
340 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
341 -Wrestrict -Wno-return-local-addr @gol
342 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
343 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
344 -Wshift-overflow -Wshift-overflow=@var{n} @gol
345 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
346 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
347 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
348 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
349 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
350 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
351 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
352 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
353 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
354 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
355 -Wswitch-unreachable -Wsync-nand @gol
356 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
357 -Wtype-limits -Wundef @gol
358 -Wuninitialized -Wunknown-pragmas @gol
359 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
360 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
361 -Wunused-parameter -Wno-unused-result @gol
362 -Wunused-value -Wunused-variable @gol
363 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
364 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
365 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
366 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
367 -Wwrite-strings @gol
368 -Wzero-as-null-pointer-constant}
369
370 @item C and Objective-C-only Warning Options
371 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
372 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
373 -Wold-style-declaration -Wold-style-definition @gol
374 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
375 -Wdeclaration-after-statement -Wpointer-sign}
376
377 @item Debugging Options
378 @xref{Debugging Options,,Options for Debugging Your Program}.
379 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
380 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
381 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
382 -gas-loc-support -gno-as-loc-support @gol
383 -gas-locview-support -gno-as-locview-support @gol
384 -gcolumn-info -gno-column-info @gol
385 -gstatement-frontiers -gno-statement-frontiers @gol
386 -gvariable-location-views -gno-variable-location-views @gol
387 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
388 -ginline-points -gno-inline-points @gol
389 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
390 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
391 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
392 -fno-eliminate-unused-debug-types @gol
393 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
394 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
395 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
396 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
397 -fvar-tracking -fvar-tracking-assignments}
398
399 @item Optimization Options
400 @xref{Optimize Options,,Options that Control Optimization}.
401 @gccoptlist{-faggressive-loop-optimizations @gol
402 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
403 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
404 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
405 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
406 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
407 -fauto-inc-dec -fbranch-probabilities @gol
408 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
409 -fbtr-bb-exclusive -fcaller-saves @gol
410 -fcombine-stack-adjustments -fconserve-stack @gol
411 -fcompare-elim -fcprop-registers -fcrossjumping @gol
412 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
413 -fcx-limited-range @gol
414 -fdata-sections -fdce -fdelayed-branch @gol
415 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
416 -fdevirtualize-at-ltrans -fdse @gol
417 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
418 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
419 -ffinite-loops @gol
420 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
421 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
422 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
423 -fif-conversion2 -findirect-inlining @gol
424 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
425 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
426 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
427 -fipa-reference -fipa-reference-addressable @gol
428 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
429 -flive-patching=@var{level} @gol
430 -fira-region=@var{region} -fira-hoist-pressure @gol
431 -fira-loop-pressure -fno-ira-share-save-slots @gol
432 -fno-ira-share-spill-slots @gol
433 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
434 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
435 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
436 -floop-block -floop-interchange -floop-strip-mine @gol
437 -floop-unroll-and-jam -floop-nest-optimize @gol
438 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
439 -flto-partition=@var{alg} -fmerge-all-constants @gol
440 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
441 -fmove-loop-invariants -fno-branch-count-reg @gol
442 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
443 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
444 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
445 -fno-sched-spec -fno-signed-zeros @gol
446 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
447 -fomit-frame-pointer -foptimize-sibling-calls @gol
448 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
449 -fprefetch-loop-arrays @gol
450 -fprofile-correction @gol
451 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
452 -fprofile-reorder-functions @gol
453 -freciprocal-math -free -frename-registers -freorder-blocks @gol
454 -freorder-blocks-algorithm=@var{algorithm} @gol
455 -freorder-blocks-and-partition -freorder-functions @gol
456 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
457 -frounding-math -fsave-optimization-record @gol
458 -fsched2-use-superblocks -fsched-pressure @gol
459 -fsched-spec-load -fsched-spec-load-dangerous @gol
460 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
461 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
462 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
463 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
464 -fschedule-fusion @gol
465 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
466 -fselective-scheduling -fselective-scheduling2 @gol
467 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
468 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
469 -fsignaling-nans @gol
470 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
471 -fsplit-paths @gol
472 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
473 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
474 -fthread-jumps -ftracer -ftree-bit-ccp @gol
475 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
476 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
477 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
478 -ftree-loop-if-convert -ftree-loop-im @gol
479 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
480 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
481 -ftree-loop-vectorize @gol
482 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
483 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
484 -ftree-switch-conversion -ftree-tail-merge @gol
485 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
486 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
487 -funsafe-math-optimizations -funswitch-loops @gol
488 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
489 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
490 --param @var{name}=@var{value}
491 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
492
493 @item Program Instrumentation Options
494 @xref{Instrumentation Options,,Program Instrumentation Options}.
495 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
496 -fprofile-abs-path @gol
497 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
498 -fprofile-note=@var{path} -fprofile-update=@var{method} @gol
499 -fprofile-filter-files=@var{regex} -fprofile-exclude-files=@var{regex} @gol
500 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
501 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
502 -fsanitize-undefined-trap-on-error -fbounds-check @gol
503 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
504 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
505 -fstack-protector-explicit -fstack-check @gol
506 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
507 -fno-stack-limit -fsplit-stack @gol
508 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
509 -fvtv-counts -fvtv-debug @gol
510 -finstrument-functions @gol
511 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
512 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
513
514 @item Preprocessor Options
515 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
516 @gccoptlist{-A@var{question}=@var{answer} @gol
517 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
518 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
519 -dD -dI -dM -dN -dU @gol
520 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
521 -fexec-charset=@var{charset} -fextended-identifiers @gol
522 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
523 -fmax-include-depth=@var{depth} @gol
524 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
525 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
526 -fwide-exec-charset=@var{charset} -fworking-directory @gol
527 -H -imacros @var{file} -include @var{file} @gol
528 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
529 -no-integrated-cpp -P -pthread -remap @gol
530 -traditional -traditional-cpp -trigraphs @gol
531 -U@var{macro} -undef @gol
532 -Wp,@var{option} -Xpreprocessor @var{option}}
533
534 @item Assembler Options
535 @xref{Assembler Options,,Passing Options to the Assembler}.
536 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
537
538 @item Linker Options
539 @xref{Link Options,,Options for Linking}.
540 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
541 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
542 -e @var{entry} --entry=@var{entry} @gol
543 -pie -pthread -r -rdynamic @gol
544 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
545 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
546 -shared -shared-libgcc -symbolic @gol
547 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
548 -u @var{symbol} -z @var{keyword}}
549
550 @item Directory Options
551 @xref{Directory Options,,Options for Directory Search}.
552 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
553 -idirafter @var{dir} @gol
554 -imacros @var{file} -imultilib @var{dir} @gol
555 -iplugindir=@var{dir} -iprefix @var{file} @gol
556 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
557 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
558 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
559 -nostdinc -nostdinc++ --sysroot=@var{dir}}
560
561 @item Code Generation Options
562 @xref{Code Gen Options,,Options for Code Generation Conventions}.
563 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
564 -ffixed-@var{reg} -fexceptions @gol
565 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
566 -fasynchronous-unwind-tables @gol
567 -fno-gnu-unique @gol
568 -finhibit-size-directive -fno-common -fno-ident @gol
569 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
570 -fno-jump-tables @gol
571 -frecord-gcc-switches @gol
572 -freg-struct-return -fshort-enums -fshort-wchar @gol
573 -fverbose-asm -fpack-struct[=@var{n}] @gol
574 -fleading-underscore -ftls-model=@var{model} @gol
575 -fstack-reuse=@var{reuse_level} @gol
576 -ftrampolines -ftrapv -fwrapv @gol
577 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
578 -fstrict-volatile-bitfields -fsync-libcalls}
579
580 @item Developer Options
581 @xref{Developer Options,,GCC Developer Options}.
582 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
583 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
584 -fdbg-cnt=@var{counter-value-list} @gol
585 -fdisable-ipa-@var{pass_name} @gol
586 -fdisable-rtl-@var{pass_name} @gol
587 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
588 -fdisable-tree-@var{pass_name} @gol
589 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
590 -fdump-debug -fdump-earlydebug @gol
591 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
592 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
593 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
594 -fdump-lang-all @gol
595 -fdump-lang-@var{switch} @gol
596 -fdump-lang-@var{switch}-@var{options} @gol
597 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
598 -fdump-passes @gol
599 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
600 -fdump-statistics @gol
601 -fdump-tree-all @gol
602 -fdump-tree-@var{switch} @gol
603 -fdump-tree-@var{switch}-@var{options} @gol
604 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
605 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
606 -fenable-@var{kind}-@var{pass} @gol
607 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
608 -fira-verbose=@var{n} @gol
609 -flto-report -flto-report-wpa -fmem-report-wpa @gol
610 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
611 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
612 -fprofile-report @gol
613 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
614 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
615 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
616 -fvar-tracking-assignments-toggle -gtoggle @gol
617 -print-file-name=@var{library} -print-libgcc-file-name @gol
618 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
619 -print-prog-name=@var{program} -print-search-dirs -Q @gol
620 -print-sysroot -print-sysroot-headers-suffix @gol
621 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
622
623 @item Machine-Dependent Options
624 @xref{Submodel Options,,Machine-Dependent Options}.
625 @c This list is ordered alphanumerically by subsection name.
626 @c Try and put the significant identifier (CPU or system) first,
627 @c so users have a clue at guessing where the ones they want will be.
628
629 @emph{AArch64 Options}
630 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
631 -mgeneral-regs-only @gol
632 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
633 -mstrict-align -mno-strict-align @gol
634 -momit-leaf-frame-pointer @gol
635 -mtls-dialect=desc -mtls-dialect=traditional @gol
636 -mtls-size=@var{size} @gol
637 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
638 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
639 -mpc-relative-literal-loads @gol
640 -msign-return-address=@var{scope} @gol
641 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
642 +@var{b-key}]|@var{bti} @gol
643 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
644 -moverride=@var{string} -mverbose-cost-dump @gol
645 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
646 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation }
647
648 @emph{Adapteva Epiphany Options}
649 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
650 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
651 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
652 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
653 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
654 -msplit-vecmove-early -m1reg-@var{reg}}
655
656 @emph{AMD GCN Options}
657 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
658
659 @emph{ARC Options}
660 @gccoptlist{-mbarrel-shifter -mjli-always @gol
661 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
662 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
663 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
664 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
665 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
666 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
667 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
668 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
669 -mvolatile-cache -mtp-regno=@var{regno} @gol
670 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
671 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
672 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
673 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
674 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
675 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
676 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
677 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
678
679 @emph{ARM Options}
680 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
681 -mabi=@var{name} @gol
682 -mapcs-stack-check -mno-apcs-stack-check @gol
683 -mapcs-reentrant -mno-apcs-reentrant @gol
684 -mgeneral-regs-only @gol
685 -msched-prolog -mno-sched-prolog @gol
686 -mlittle-endian -mbig-endian @gol
687 -mbe8 -mbe32 @gol
688 -mfloat-abi=@var{name} @gol
689 -mfp16-format=@var{name}
690 -mthumb-interwork -mno-thumb-interwork @gol
691 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
692 -mtune=@var{name} -mprint-tune-info @gol
693 -mstructure-size-boundary=@var{n} @gol
694 -mabort-on-noreturn @gol
695 -mlong-calls -mno-long-calls @gol
696 -msingle-pic-base -mno-single-pic-base @gol
697 -mpic-register=@var{reg} @gol
698 -mnop-fun-dllimport @gol
699 -mpoke-function-name @gol
700 -mthumb -marm -mflip-thumb @gol
701 -mtpcs-frame -mtpcs-leaf-frame @gol
702 -mcaller-super-interworking -mcallee-super-interworking @gol
703 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
704 -mword-relocations @gol
705 -mfix-cortex-m3-ldrd @gol
706 -munaligned-access @gol
707 -mneon-for-64bits @gol
708 -mslow-flash-data @gol
709 -masm-syntax-unified @gol
710 -mrestrict-it @gol
711 -mverbose-cost-dump @gol
712 -mpure-code @gol
713 -mcmse}
714
715 @emph{AVR Options}
716 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
717 -mbranch-cost=@var{cost} @gol
718 -mcall-prologues -mgas-isr-prologues -mint8 @gol
719 -mn_flash=@var{size} -mno-interrupts @gol
720 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
721 -mfract-convert-truncate @gol
722 -mshort-calls -nodevicelib @gol
723 -Waddr-space-convert -Wmisspelled-isr}
724
725 @emph{Blackfin Options}
726 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
727 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
728 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
729 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
730 -mno-id-shared-library -mshared-library-id=@var{n} @gol
731 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
732 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
733 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
734 -micplb}
735
736 @emph{C6X Options}
737 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
738 -msim -msdata=@var{sdata-type}}
739
740 @emph{CRIS Options}
741 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
742 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
743 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
744 -mstack-align -mdata-align -mconst-align @gol
745 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
746 -melf -maout -melinux -mlinux -sim -sim2 @gol
747 -mmul-bug-workaround -mno-mul-bug-workaround}
748
749 @emph{CR16 Options}
750 @gccoptlist{-mmac @gol
751 -mcr16cplus -mcr16c @gol
752 -msim -mint32 -mbit-ops
753 -mdata-model=@var{model}}
754
755 @emph{C-SKY Options}
756 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
757 -mbig-endian -EB -mlittle-endian -EL @gol
758 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
759 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
760 -mdsp -medsp -mvdsp @gol
761 -mdiv -msmart -mhigh-registers -manchor @gol
762 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
763 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
764
765 @emph{Darwin Options}
766 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
767 -arch_only -bind_at_load -bundle -bundle_loader @gol
768 -client_name -compatibility_version -current_version @gol
769 -dead_strip @gol
770 -dependency-file -dylib_file -dylinker_install_name @gol
771 -dynamic -dynamiclib -exported_symbols_list @gol
772 -filelist -flat_namespace -force_cpusubtype_ALL @gol
773 -force_flat_namespace -headerpad_max_install_names @gol
774 -iframework @gol
775 -image_base -init -install_name -keep_private_externs @gol
776 -multi_module -multiply_defined -multiply_defined_unused @gol
777 -noall_load -no_dead_strip_inits_and_terms @gol
778 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
779 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
780 -private_bundle -read_only_relocs -sectalign @gol
781 -sectobjectsymbols -whyload -seg1addr @gol
782 -sectcreate -sectobjectsymbols -sectorder @gol
783 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
784 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
785 -segprot -segs_read_only_addr -segs_read_write_addr @gol
786 -single_module -static -sub_library -sub_umbrella @gol
787 -twolevel_namespace -umbrella -undefined @gol
788 -unexported_symbols_list -weak_reference_mismatches @gol
789 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
790 -mkernel -mone-byte-bool}
791
792 @emph{DEC Alpha Options}
793 @gccoptlist{-mno-fp-regs -msoft-float @gol
794 -mieee -mieee-with-inexact -mieee-conformant @gol
795 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
796 -mtrap-precision=@var{mode} -mbuild-constants @gol
797 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
798 -mbwx -mmax -mfix -mcix @gol
799 -mfloat-vax -mfloat-ieee @gol
800 -mexplicit-relocs -msmall-data -mlarge-data @gol
801 -msmall-text -mlarge-text @gol
802 -mmemory-latency=@var{time}}
803
804 @emph{FR30 Options}
805 @gccoptlist{-msmall-model -mno-lsim}
806
807 @emph{FT32 Options}
808 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
809
810 @emph{FRV Options}
811 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
812 -mhard-float -msoft-float @gol
813 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
814 -mdouble -mno-double @gol
815 -mmedia -mno-media -mmuladd -mno-muladd @gol
816 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
817 -mlinked-fp -mlong-calls -malign-labels @gol
818 -mlibrary-pic -macc-4 -macc-8 @gol
819 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
820 -moptimize-membar -mno-optimize-membar @gol
821 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
822 -mvliw-branch -mno-vliw-branch @gol
823 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
824 -mno-nested-cond-exec -mtomcat-stats @gol
825 -mTLS -mtls @gol
826 -mcpu=@var{cpu}}
827
828 @emph{GNU/Linux Options}
829 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
830 -tno-android-cc -tno-android-ld}
831
832 @emph{H8/300 Options}
833 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
834
835 @emph{HPPA Options}
836 @gccoptlist{-march=@var{architecture-type} @gol
837 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
838 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
839 -mfixed-range=@var{register-range} @gol
840 -mjump-in-delay -mlinker-opt -mlong-calls @gol
841 -mlong-load-store -mno-disable-fpregs @gol
842 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
843 -mno-jump-in-delay -mno-long-load-store @gol
844 -mno-portable-runtime -mno-soft-float @gol
845 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
846 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
847 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
848 -munix=@var{unix-std} -nolibdld -static -threads}
849
850 @emph{IA-64 Options}
851 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
852 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
853 -mconstant-gp -mauto-pic -mfused-madd @gol
854 -minline-float-divide-min-latency @gol
855 -minline-float-divide-max-throughput @gol
856 -mno-inline-float-divide @gol
857 -minline-int-divide-min-latency @gol
858 -minline-int-divide-max-throughput @gol
859 -mno-inline-int-divide @gol
860 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
861 -mno-inline-sqrt @gol
862 -mdwarf2-asm -mearly-stop-bits @gol
863 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
864 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
865 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
866 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
867 -msched-spec-ldc -msched-spec-control-ldc @gol
868 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
869 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
870 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
871 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
872
873 @emph{LM32 Options}
874 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
875 -msign-extend-enabled -muser-enabled}
876
877 @emph{M32R/D Options}
878 @gccoptlist{-m32r2 -m32rx -m32r @gol
879 -mdebug @gol
880 -malign-loops -mno-align-loops @gol
881 -missue-rate=@var{number} @gol
882 -mbranch-cost=@var{number} @gol
883 -mmodel=@var{code-size-model-type} @gol
884 -msdata=@var{sdata-type} @gol
885 -mno-flush-func -mflush-func=@var{name} @gol
886 -mno-flush-trap -mflush-trap=@var{number} @gol
887 -G @var{num}}
888
889 @emph{M32C Options}
890 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
891
892 @emph{M680x0 Options}
893 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
894 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
895 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
896 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
897 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
898 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
899 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
900 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
901 -mxgot -mno-xgot -mlong-jump-table-offsets}
902
903 @emph{MCore Options}
904 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
905 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
906 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
907 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
908 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
909
910 @emph{MeP Options}
911 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
912 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
913 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
914 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
915 -mtiny=@var{n}}
916
917 @emph{MicroBlaze Options}
918 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
919 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
920 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
921 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
922 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
923 -mpic-data-is-text-relative}
924
925 @emph{MIPS Options}
926 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
927 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
928 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
929 -mips16 -mno-mips16 -mflip-mips16 @gol
930 -minterlink-compressed -mno-interlink-compressed @gol
931 -minterlink-mips16 -mno-interlink-mips16 @gol
932 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
933 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
934 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
935 -mno-float -msingle-float -mdouble-float @gol
936 -modd-spreg -mno-odd-spreg @gol
937 -mabs=@var{mode} -mnan=@var{encoding} @gol
938 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
939 -mmcu -mmno-mcu @gol
940 -meva -mno-eva @gol
941 -mvirt -mno-virt @gol
942 -mxpa -mno-xpa @gol
943 -mcrc -mno-crc @gol
944 -mginv -mno-ginv @gol
945 -mmicromips -mno-micromips @gol
946 -mmsa -mno-msa @gol
947 -mloongson-mmi -mno-loongson-mmi @gol
948 -mloongson-ext -mno-loongson-ext @gol
949 -mloongson-ext2 -mno-loongson-ext2 @gol
950 -mfpu=@var{fpu-type} @gol
951 -msmartmips -mno-smartmips @gol
952 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
953 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
954 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
955 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
956 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
957 -membedded-data -mno-embedded-data @gol
958 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
959 -mcode-readable=@var{setting} @gol
960 -msplit-addresses -mno-split-addresses @gol
961 -mexplicit-relocs -mno-explicit-relocs @gol
962 -mcheck-zero-division -mno-check-zero-division @gol
963 -mdivide-traps -mdivide-breaks @gol
964 -mload-store-pairs -mno-load-store-pairs @gol
965 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
966 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
967 -mfix-24k -mno-fix-24k @gol
968 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
969 -mfix-r5900 -mno-fix-r5900 @gol
970 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
971 -mfix-vr4120 -mno-fix-vr4120 @gol
972 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
973 -mflush-func=@var{func} -mno-flush-func @gol
974 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
975 -mcompact-branches=@var{policy} @gol
976 -mfp-exceptions -mno-fp-exceptions @gol
977 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
978 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
979 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
980 -mframe-header-opt -mno-frame-header-opt}
981
982 @emph{MMIX Options}
983 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
984 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
985 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
986 -mno-base-addresses -msingle-exit -mno-single-exit}
987
988 @emph{MN10300 Options}
989 @gccoptlist{-mmult-bug -mno-mult-bug @gol
990 -mno-am33 -mam33 -mam33-2 -mam34 @gol
991 -mtune=@var{cpu-type} @gol
992 -mreturn-pointer-on-d0 @gol
993 -mno-crt0 -mrelax -mliw -msetlb}
994
995 @emph{Moxie Options}
996 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
997
998 @emph{MSP430 Options}
999 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1000 -mwarn-mcu @gol
1001 -mcode-region= -mdata-region= @gol
1002 -msilicon-errata= -msilicon-errata-warn= @gol
1003 -mhwmult= -minrt}
1004
1005 @emph{NDS32 Options}
1006 @gccoptlist{-mbig-endian -mlittle-endian @gol
1007 -mreduced-regs -mfull-regs @gol
1008 -mcmov -mno-cmov @gol
1009 -mext-perf -mno-ext-perf @gol
1010 -mext-perf2 -mno-ext-perf2 @gol
1011 -mext-string -mno-ext-string @gol
1012 -mv3push -mno-v3push @gol
1013 -m16bit -mno-16bit @gol
1014 -misr-vector-size=@var{num} @gol
1015 -mcache-block-size=@var{num} @gol
1016 -march=@var{arch} @gol
1017 -mcmodel=@var{code-model} @gol
1018 -mctor-dtor -mrelax}
1019
1020 @emph{Nios II Options}
1021 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1022 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1023 -mel -meb @gol
1024 -mno-bypass-cache -mbypass-cache @gol
1025 -mno-cache-volatile -mcache-volatile @gol
1026 -mno-fast-sw-div -mfast-sw-div @gol
1027 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1028 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1029 -mcustom-fpu-cfg=@var{name} @gol
1030 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1031 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1032
1033 @emph{Nvidia PTX Options}
1034 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1035
1036 @emph{OpenRISC Options}
1037 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1038 -msoft-mul -msoft-div @gol
1039 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1040 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1041
1042 @emph{PDP-11 Options}
1043 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1044 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1045 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1046
1047 @emph{picoChip Options}
1048 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1049 -msymbol-as-address -mno-inefficient-warnings}
1050
1051 @emph{PowerPC Options}
1052 See RS/6000 and PowerPC Options.
1053
1054 @emph{PRU Options}
1055 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1056 -mabi=@var{variant} @gol}
1057
1058 @emph{RISC-V Options}
1059 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1060 -mplt -mno-plt @gol
1061 -mabi=@var{ABI-string} @gol
1062 -mfdiv -mno-fdiv @gol
1063 -mdiv -mno-div @gol
1064 -march=@var{ISA-string} @gol
1065 -mtune=@var{processor-string} @gol
1066 -mpreferred-stack-boundary=@var{num} @gol
1067 -msmall-data-limit=@var{N-bytes} @gol
1068 -msave-restore -mno-save-restore @gol
1069 -mstrict-align -mno-strict-align @gol
1070 -mcmodel=medlow -mcmodel=medany @gol
1071 -mexplicit-relocs -mno-explicit-relocs @gol
1072 -mrelax -mno-relax @gol
1073 -mriscv-attribute -mmo-riscv-attribute @gol
1074 -malign-data=@var{type}}
1075
1076 @emph{RL78 Options}
1077 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1078 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1079 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1080
1081 @emph{RS/6000 and PowerPC Options}
1082 @gccoptlist{-mcpu=@var{cpu-type} @gol
1083 -mtune=@var{cpu-type} @gol
1084 -mcmodel=@var{code-model} @gol
1085 -mpowerpc64 @gol
1086 -maltivec -mno-altivec @gol
1087 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1088 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1089 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1090 -mfprnd -mno-fprnd @gol
1091 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1092 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1093 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1094 -malign-power -malign-natural @gol
1095 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1096 -mupdate -mno-update @gol
1097 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1098 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1099 -mstrict-align -mno-strict-align -mrelocatable @gol
1100 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1101 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1102 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1103 -mprioritize-restricted-insns=@var{priority} @gol
1104 -msched-costly-dep=@var{dependence_type} @gol
1105 -minsert-sched-nops=@var{scheme} @gol
1106 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1107 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1108 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1109 -mtraceback=@var{traceback_type} @gol
1110 -maix-struct-return -msvr4-struct-return @gol
1111 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1112 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1113 -mblock-move-inline-limit=@var{num} @gol
1114 -mblock-compare-inline-limit=@var{num} @gol
1115 -mblock-compare-inline-loop-limit=@var{num} @gol
1116 -mstring-compare-inline-limit=@var{num} @gol
1117 -misel -mno-isel @gol
1118 -mvrsave -mno-vrsave @gol
1119 -mmulhw -mno-mulhw @gol
1120 -mdlmzb -mno-dlmzb @gol
1121 -mprototype -mno-prototype @gol
1122 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1123 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1124 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1125 -mno-recip-precision @gol
1126 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1127 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1128 -msave-toc-indirect -mno-save-toc-indirect @gol
1129 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1130 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1131 -mquad-memory -mno-quad-memory @gol
1132 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1133 -mcompat-align-parm -mno-compat-align-parm @gol
1134 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1135 -mgnu-attribute -mno-gnu-attribute @gol
1136 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1137 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1138
1139 @emph{RX Options}
1140 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1141 -mcpu=@gol
1142 -mbig-endian-data -mlittle-endian-data @gol
1143 -msmall-data @gol
1144 -msim -mno-sim@gol
1145 -mas100-syntax -mno-as100-syntax@gol
1146 -mrelax@gol
1147 -mmax-constant-size=@gol
1148 -mint-register=@gol
1149 -mpid@gol
1150 -mallow-string-insns -mno-allow-string-insns@gol
1151 -mjsr@gol
1152 -mno-warn-multiple-fast-interrupts@gol
1153 -msave-acc-in-interrupts}
1154
1155 @emph{S/390 and zSeries Options}
1156 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1157 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1158 -mlong-double-64 -mlong-double-128 @gol
1159 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1160 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1161 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1162 -mhtm -mvx -mzvector @gol
1163 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1164 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1165 -mhotpatch=@var{halfwords},@var{halfwords}}
1166
1167 @emph{Score Options}
1168 @gccoptlist{-meb -mel @gol
1169 -mnhwloop @gol
1170 -muls @gol
1171 -mmac @gol
1172 -mscore5 -mscore5u -mscore7 -mscore7d}
1173
1174 @emph{SH Options}
1175 @gccoptlist{-m1 -m2 -m2e @gol
1176 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1177 -m3 -m3e @gol
1178 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1179 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1180 -mb -ml -mdalign -mrelax @gol
1181 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1182 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1183 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1184 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1185 -maccumulate-outgoing-args @gol
1186 -matomic-model=@var{atomic-model} @gol
1187 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1188 -mcbranch-force-delay-slot @gol
1189 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1190 -mpretend-cmove -mtas}
1191
1192 @emph{Solaris 2 Options}
1193 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1194 -pthreads}
1195
1196 @emph{SPARC Options}
1197 @gccoptlist{-mcpu=@var{cpu-type} @gol
1198 -mtune=@var{cpu-type} @gol
1199 -mcmodel=@var{code-model} @gol
1200 -mmemory-model=@var{mem-model} @gol
1201 -m32 -m64 -mapp-regs -mno-app-regs @gol
1202 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1203 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1204 -mhard-quad-float -msoft-quad-float @gol
1205 -mstack-bias -mno-stack-bias @gol
1206 -mstd-struct-return -mno-std-struct-return @gol
1207 -munaligned-doubles -mno-unaligned-doubles @gol
1208 -muser-mode -mno-user-mode @gol
1209 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1210 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1211 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1212 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1213 -mpopc -mno-popc -msubxc -mno-subxc @gol
1214 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1215 -mlra -mno-lra}
1216
1217 @emph{System V Options}
1218 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1219
1220 @emph{TILE-Gx Options}
1221 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1222 -mcmodel=@var{code-model}}
1223
1224 @emph{TILEPro Options}
1225 @gccoptlist{-mcpu=@var{cpu} -m32}
1226
1227 @emph{V850 Options}
1228 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1229 -mprolog-function -mno-prolog-function -mspace @gol
1230 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1231 -mapp-regs -mno-app-regs @gol
1232 -mdisable-callt -mno-disable-callt @gol
1233 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1234 -mv850e -mv850 -mv850e3v5 @gol
1235 -mloop @gol
1236 -mrelax @gol
1237 -mlong-jumps @gol
1238 -msoft-float @gol
1239 -mhard-float @gol
1240 -mgcc-abi @gol
1241 -mrh850-abi @gol
1242 -mbig-switch}
1243
1244 @emph{VAX Options}
1245 @gccoptlist{-mg -mgnu -munix}
1246
1247 @emph{Visium Options}
1248 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1249 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1250
1251 @emph{VMS Options}
1252 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1253 -mpointer-size=@var{size}}
1254
1255 @emph{VxWorks Options}
1256 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1257 -Xbind-lazy -Xbind-now}
1258
1259 @emph{x86 Options}
1260 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1261 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1262 -mfpmath=@var{unit} @gol
1263 -masm=@var{dialect} -mno-fancy-math-387 @gol
1264 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1265 -mno-wide-multiply -mrtd -malign-double @gol
1266 -mpreferred-stack-boundary=@var{num} @gol
1267 -mincoming-stack-boundary=@var{num} @gol
1268 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1269 -mrecip -mrecip=@var{opt} @gol
1270 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1271 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1272 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1273 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1274 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1275 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1276 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1277 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1278 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1279 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1280 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1281 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1282 -mrdseed -msgx -mavx512vp2intersect@gol
1283 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1284 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1285 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1286 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1287 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1288 -mregparm=@var{num} -msseregparm @gol
1289 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1290 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1291 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1292 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1293 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1294 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1295 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1296 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1297 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1298 -mstack-protector-guard-reg=@var{reg} @gol
1299 -mstack-protector-guard-offset=@var{offset} @gol
1300 -mstack-protector-guard-symbol=@var{symbol} @gol
1301 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1302 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1303 -mindirect-branch-register}
1304
1305 @emph{x86 Windows Options}
1306 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1307 -mnop-fun-dllimport -mthread @gol
1308 -municode -mwin32 -mwindows -fno-set-stack-executable}
1309
1310 @emph{Xstormy16 Options}
1311 @gccoptlist{-msim}
1312
1313 @emph{Xtensa Options}
1314 @gccoptlist{-mconst16 -mno-const16 @gol
1315 -mfused-madd -mno-fused-madd @gol
1316 -mforce-no-pic @gol
1317 -mserialize-volatile -mno-serialize-volatile @gol
1318 -mtext-section-literals -mno-text-section-literals @gol
1319 -mauto-litpools -mno-auto-litpools @gol
1320 -mtarget-align -mno-target-align @gol
1321 -mlongcalls -mno-longcalls}
1322
1323 @emph{zSeries Options}
1324 See S/390 and zSeries Options.
1325 @end table
1326
1327
1328 @node Overall Options
1329 @section Options Controlling the Kind of Output
1330
1331 Compilation can involve up to four stages: preprocessing, compilation
1332 proper, assembly and linking, always in that order. GCC is capable of
1333 preprocessing and compiling several files either into several
1334 assembler input files, or into one assembler input file; then each
1335 assembler input file produces an object file, and linking combines all
1336 the object files (those newly compiled, and those specified as input)
1337 into an executable file.
1338
1339 @cindex file name suffix
1340 For any given input file, the file name suffix determines what kind of
1341 compilation is done:
1342
1343 @table @gcctabopt
1344 @item @var{file}.c
1345 C source code that must be preprocessed.
1346
1347 @item @var{file}.i
1348 C source code that should not be preprocessed.
1349
1350 @item @var{file}.ii
1351 C++ source code that should not be preprocessed.
1352
1353 @item @var{file}.m
1354 Objective-C source code. Note that you must link with the @file{libobjc}
1355 library to make an Objective-C program work.
1356
1357 @item @var{file}.mi
1358 Objective-C source code that should not be preprocessed.
1359
1360 @item @var{file}.mm
1361 @itemx @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. Note that @samp{.M} refers
1364 to a literal capital M@.
1365
1366 @item @var{file}.mii
1367 Objective-C++ source code that should not be preprocessed.
1368
1369 @item @var{file}.h
1370 C, C++, Objective-C or Objective-C++ header file to be turned into a
1371 precompiled header (default), or C, C++ header file to be turned into an
1372 Ada spec (via the @option{-fdump-ada-spec} switch).
1373
1374 @item @var{file}.cc
1375 @itemx @var{file}.cp
1376 @itemx @var{file}.cxx
1377 @itemx @var{file}.cpp
1378 @itemx @var{file}.CPP
1379 @itemx @var{file}.c++
1380 @itemx @var{file}.C
1381 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1382 the last two letters must both be literally @samp{x}. Likewise,
1383 @samp{.C} refers to a literal capital C@.
1384
1385 @item @var{file}.mm
1386 @itemx @var{file}.M
1387 Objective-C++ source code that must be preprocessed.
1388
1389 @item @var{file}.mii
1390 Objective-C++ source code that should not be preprocessed.
1391
1392 @item @var{file}.hh
1393 @itemx @var{file}.H
1394 @itemx @var{file}.hp
1395 @itemx @var{file}.hxx
1396 @itemx @var{file}.hpp
1397 @itemx @var{file}.HPP
1398 @itemx @var{file}.h++
1399 @itemx @var{file}.tcc
1400 C++ header file to be turned into a precompiled header or Ada spec.
1401
1402 @item @var{file}.f
1403 @itemx @var{file}.for
1404 @itemx @var{file}.ftn
1405 Fixed form Fortran source code that should not be preprocessed.
1406
1407 @item @var{file}.F
1408 @itemx @var{file}.FOR
1409 @itemx @var{file}.fpp
1410 @itemx @var{file}.FPP
1411 @itemx @var{file}.FTN
1412 Fixed form Fortran source code that must be preprocessed (with the traditional
1413 preprocessor).
1414
1415 @item @var{file}.f90
1416 @itemx @var{file}.f95
1417 @itemx @var{file}.f03
1418 @itemx @var{file}.f08
1419 Free form Fortran source code that should not be preprocessed.
1420
1421 @item @var{file}.F90
1422 @itemx @var{file}.F95
1423 @itemx @var{file}.F03
1424 @itemx @var{file}.F08
1425 Free form Fortran source code that must be preprocessed (with the
1426 traditional preprocessor).
1427
1428 @item @var{file}.go
1429 Go source code.
1430
1431 @item @var{file}.brig
1432 BRIG files (binary representation of HSAIL).
1433
1434 @item @var{file}.d
1435 D source code.
1436
1437 @item @var{file}.di
1438 D interface file.
1439
1440 @item @var{file}.dd
1441 D documentation code (Ddoc).
1442
1443 @item @var{file}.ads
1444 Ada source code file that contains a library unit declaration (a
1445 declaration of a package, subprogram, or generic, or a generic
1446 instantiation), or a library unit renaming declaration (a package,
1447 generic, or subprogram renaming declaration). Such files are also
1448 called @dfn{specs}.
1449
1450 @item @var{file}.adb
1451 Ada source code file containing a library unit body (a subprogram or
1452 package body). Such files are also called @dfn{bodies}.
1453
1454 @c GCC also knows about some suffixes for languages not yet included:
1455 @c Ratfor:
1456 @c @var{file}.r
1457
1458 @item @var{file}.s
1459 Assembler code.
1460
1461 @item @var{file}.S
1462 @itemx @var{file}.sx
1463 Assembler code that must be preprocessed.
1464
1465 @item @var{other}
1466 An object file to be fed straight into linking.
1467 Any file name with no recognized suffix is treated this way.
1468 @end table
1469
1470 @opindex x
1471 You can specify the input language explicitly with the @option{-x} option:
1472
1473 @table @gcctabopt
1474 @item -x @var{language}
1475 Specify explicitly the @var{language} for the following input files
1476 (rather than letting the compiler choose a default based on the file
1477 name suffix). This option applies to all following input files until
1478 the next @option{-x} option. Possible values for @var{language} are:
1479 @smallexample
1480 c c-header cpp-output
1481 c++ c++-header c++-cpp-output
1482 objective-c objective-c-header objective-c-cpp-output
1483 objective-c++ objective-c++-header objective-c++-cpp-output
1484 assembler assembler-with-cpp
1485 ada
1486 d
1487 f77 f77-cpp-input f95 f95-cpp-input
1488 go
1489 brig
1490 @end smallexample
1491
1492 @item -x none
1493 Turn off any specification of a language, so that subsequent files are
1494 handled according to their file name suffixes (as they are if @option{-x}
1495 has not been used at all).
1496 @end table
1497
1498 If you only want some of the stages of compilation, you can use
1499 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1500 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1501 @command{gcc} is to stop. Note that some combinations (for example,
1502 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1503
1504 @table @gcctabopt
1505 @item -c
1506 @opindex c
1507 Compile or assemble the source files, but do not link. The linking
1508 stage simply is not done. The ultimate output is in the form of an
1509 object file for each source file.
1510
1511 By default, the object file name for a source file is made by replacing
1512 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1513
1514 Unrecognized input files, not requiring compilation or assembly, are
1515 ignored.
1516
1517 @item -S
1518 @opindex S
1519 Stop after the stage of compilation proper; do not assemble. The output
1520 is in the form of an assembler code file for each non-assembler input
1521 file specified.
1522
1523 By default, the assembler file name for a source file is made by
1524 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1525
1526 Input files that don't require compilation are ignored.
1527
1528 @item -E
1529 @opindex E
1530 Stop after the preprocessing stage; do not run the compiler proper. The
1531 output is in the form of preprocessed source code, which is sent to the
1532 standard output.
1533
1534 Input files that don't require preprocessing are ignored.
1535
1536 @cindex output file option
1537 @item -o @var{file}
1538 @opindex o
1539 Place output in file @var{file}. This applies to whatever
1540 sort of output is being produced, whether it be an executable file,
1541 an object file, an assembler file or preprocessed C code.
1542
1543 If @option{-o} is not specified, the default is to put an executable
1544 file in @file{a.out}, the object file for
1545 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1546 assembler file in @file{@var{source}.s}, a precompiled header file in
1547 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1548 standard output.
1549
1550 @item -v
1551 @opindex v
1552 Print (on standard error output) the commands executed to run the stages
1553 of compilation. Also print the version number of the compiler driver
1554 program and of the preprocessor and the compiler proper.
1555
1556 @item -###
1557 @opindex ###
1558 Like @option{-v} except the commands are not executed and arguments
1559 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1560 This is useful for shell scripts to capture the driver-generated command lines.
1561
1562 @item --help
1563 @opindex help
1564 Print (on the standard output) a description of the command-line options
1565 understood by @command{gcc}. If the @option{-v} option is also specified
1566 then @option{--help} is also passed on to the various processes
1567 invoked by @command{gcc}, so that they can display the command-line options
1568 they accept. If the @option{-Wextra} option has also been specified
1569 (prior to the @option{--help} option), then command-line options that
1570 have no documentation associated with them are also displayed.
1571
1572 @item --target-help
1573 @opindex target-help
1574 Print (on the standard output) a description of target-specific command-line
1575 options for each tool. For some targets extra target-specific
1576 information may also be printed.
1577
1578 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1579 Print (on the standard output) a description of the command-line
1580 options understood by the compiler that fit into all specified classes
1581 and qualifiers. These are the supported classes:
1582
1583 @table @asis
1584 @item @samp{optimizers}
1585 Display all of the optimization options supported by the
1586 compiler.
1587
1588 @item @samp{warnings}
1589 Display all of the options controlling warning messages
1590 produced by the compiler.
1591
1592 @item @samp{target}
1593 Display target-specific options. Unlike the
1594 @option{--target-help} option however, target-specific options of the
1595 linker and assembler are not displayed. This is because those
1596 tools do not currently support the extended @option{--help=} syntax.
1597
1598 @item @samp{params}
1599 Display the values recognized by the @option{--param}
1600 option.
1601
1602 @item @var{language}
1603 Display the options supported for @var{language}, where
1604 @var{language} is the name of one of the languages supported in this
1605 version of GCC@.
1606
1607 @item @samp{common}
1608 Display the options that are common to all languages.
1609 @end table
1610
1611 These are the supported qualifiers:
1612
1613 @table @asis
1614 @item @samp{undocumented}
1615 Display only those options that are undocumented.
1616
1617 @item @samp{joined}
1618 Display options taking an argument that appears after an equal
1619 sign in the same continuous piece of text, such as:
1620 @samp{--help=target}.
1621
1622 @item @samp{separate}
1623 Display options taking an argument that appears as a separate word
1624 following the original option, such as: @samp{-o output-file}.
1625 @end table
1626
1627 Thus for example to display all the undocumented target-specific
1628 switches supported by the compiler, use:
1629
1630 @smallexample
1631 --help=target,undocumented
1632 @end smallexample
1633
1634 The sense of a qualifier can be inverted by prefixing it with the
1635 @samp{^} character, so for example to display all binary warning
1636 options (i.e., ones that are either on or off and that do not take an
1637 argument) that have a description, use:
1638
1639 @smallexample
1640 --help=warnings,^joined,^undocumented
1641 @end smallexample
1642
1643 The argument to @option{--help=} should not consist solely of inverted
1644 qualifiers.
1645
1646 Combining several classes is possible, although this usually
1647 restricts the output so much that there is nothing to display. One
1648 case where it does work, however, is when one of the classes is
1649 @var{target}. For example, to display all the target-specific
1650 optimization options, use:
1651
1652 @smallexample
1653 --help=target,optimizers
1654 @end smallexample
1655
1656 The @option{--help=} option can be repeated on the command line. Each
1657 successive use displays its requested class of options, skipping
1658 those that have already been displayed. If @option{--help} is also
1659 specified anywhere on the command line then this takes precedence
1660 over any @option{--help=} option.
1661
1662 If the @option{-Q} option appears on the command line before the
1663 @option{--help=} option, then the descriptive text displayed by
1664 @option{--help=} is changed. Instead of describing the displayed
1665 options, an indication is given as to whether the option is enabled,
1666 disabled or set to a specific value (assuming that the compiler
1667 knows this at the point where the @option{--help=} option is used).
1668
1669 Here is a truncated example from the ARM port of @command{gcc}:
1670
1671 @smallexample
1672 % gcc -Q -mabi=2 --help=target -c
1673 The following options are target specific:
1674 -mabi= 2
1675 -mabort-on-noreturn [disabled]
1676 -mapcs [disabled]
1677 @end smallexample
1678
1679 The output is sensitive to the effects of previous command-line
1680 options, so for example it is possible to find out which optimizations
1681 are enabled at @option{-O2} by using:
1682
1683 @smallexample
1684 -Q -O2 --help=optimizers
1685 @end smallexample
1686
1687 Alternatively you can discover which binary optimizations are enabled
1688 by @option{-O3} by using:
1689
1690 @smallexample
1691 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1692 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1693 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1694 @end smallexample
1695
1696 @item --version
1697 @opindex version
1698 Display the version number and copyrights of the invoked GCC@.
1699
1700 @item -pass-exit-codes
1701 @opindex pass-exit-codes
1702 Normally the @command{gcc} program exits with the code of 1 if any
1703 phase of the compiler returns a non-success return code. If you specify
1704 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1705 the numerically highest error produced by any phase returning an error
1706 indication. The C, C++, and Fortran front ends return 4 if an internal
1707 compiler error is encountered.
1708
1709 @item -pipe
1710 @opindex pipe
1711 Use pipes rather than temporary files for communication between the
1712 various stages of compilation. This fails to work on some systems where
1713 the assembler is unable to read from a pipe; but the GNU assembler has
1714 no trouble.
1715
1716 @item -specs=@var{file}
1717 @opindex specs
1718 Process @var{file} after the compiler reads in the standard @file{specs}
1719 file, in order to override the defaults which the @command{gcc} driver
1720 program uses when determining what switches to pass to @command{cc1},
1721 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1722 @option{-specs=@var{file}} can be specified on the command line, and they
1723 are processed in order, from left to right. @xref{Spec Files}, for
1724 information about the format of the @var{file}.
1725
1726 @item -wrapper
1727 @opindex wrapper
1728 Invoke all subcommands under a wrapper program. The name of the
1729 wrapper program and its parameters are passed as a comma separated
1730 list.
1731
1732 @smallexample
1733 gcc -c t.c -wrapper gdb,--args
1734 @end smallexample
1735
1736 @noindent
1737 This invokes all subprograms of @command{gcc} under
1738 @samp{gdb --args}, thus the invocation of @command{cc1} is
1739 @samp{gdb --args cc1 @dots{}}.
1740
1741 @item -ffile-prefix-map=@var{old}=@var{new}
1742 @opindex ffile-prefix-map
1743 When compiling files residing in directory @file{@var{old}}, record
1744 any references to them in the result of the compilation as if the
1745 files resided in directory @file{@var{new}} instead. Specifying this
1746 option is equivalent to specifying all the individual
1747 @option{-f*-prefix-map} options. This can be used to make reproducible
1748 builds that are location independent. See also
1749 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1750
1751 @item -fplugin=@var{name}.so
1752 @opindex fplugin
1753 Load the plugin code in file @var{name}.so, assumed to be a
1754 shared object to be dlopen'd by the compiler. The base name of
1755 the shared object file is used to identify the plugin for the
1756 purposes of argument parsing (See
1757 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1758 Each plugin should define the callback functions specified in the
1759 Plugins API.
1760
1761 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1762 @opindex fplugin-arg
1763 Define an argument called @var{key} with a value of @var{value}
1764 for the plugin called @var{name}.
1765
1766 @item -fdump-ada-spec@r{[}-slim@r{]}
1767 @opindex fdump-ada-spec
1768 For C and C++ source and include files, generate corresponding Ada specs.
1769 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1770 GNAT User's Guide}, which provides detailed documentation on this feature.
1771
1772 @item -fada-spec-parent=@var{unit}
1773 @opindex fada-spec-parent
1774 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1775 Ada specs as child units of parent @var{unit}.
1776
1777 @item -fdump-go-spec=@var{file}
1778 @opindex fdump-go-spec
1779 For input files in any language, generate corresponding Go
1780 declarations in @var{file}. This generates Go @code{const},
1781 @code{type}, @code{var}, and @code{func} declarations which may be a
1782 useful way to start writing a Go interface to code written in some
1783 other language.
1784
1785 @include @value{srcdir}/../libiberty/at-file.texi
1786 @end table
1787
1788 @node Invoking G++
1789 @section Compiling C++ Programs
1790
1791 @cindex suffixes for C++ source
1792 @cindex C++ source file suffixes
1793 C++ source files conventionally use one of the suffixes @samp{.C},
1794 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1795 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1796 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1797 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1798 files with these names and compiles them as C++ programs even if you
1799 call the compiler the same way as for compiling C programs (usually
1800 with the name @command{gcc}).
1801
1802 @findex g++
1803 @findex c++
1804 However, the use of @command{gcc} does not add the C++ library.
1805 @command{g++} is a program that calls GCC and automatically specifies linking
1806 against the C++ library. It treats @samp{.c},
1807 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1808 files unless @option{-x} is used. This program is also useful when
1809 precompiling a C header file with a @samp{.h} extension for use in C++
1810 compilations. On many systems, @command{g++} is also installed with
1811 the name @command{c++}.
1812
1813 @cindex invoking @command{g++}
1814 When you compile C++ programs, you may specify many of the same
1815 command-line options that you use for compiling programs in any
1816 language; or command-line options meaningful for C and related
1817 languages; or options that are meaningful only for C++ programs.
1818 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1819 explanations of options for languages related to C@.
1820 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1821 explanations of options that are meaningful only for C++ programs.
1822
1823 @node C Dialect Options
1824 @section Options Controlling C Dialect
1825 @cindex dialect options
1826 @cindex language dialect options
1827 @cindex options, dialect
1828
1829 The following options control the dialect of C (or languages derived
1830 from C, such as C++, Objective-C and Objective-C++) that the compiler
1831 accepts:
1832
1833 @table @gcctabopt
1834 @cindex ANSI support
1835 @cindex ISO support
1836 @item -ansi
1837 @opindex ansi
1838 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1839 equivalent to @option{-std=c++98}.
1840
1841 This turns off certain features of GCC that are incompatible with ISO
1842 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1843 such as the @code{asm} and @code{typeof} keywords, and
1844 predefined macros such as @code{unix} and @code{vax} that identify the
1845 type of system you are using. It also enables the undesirable and
1846 rarely used ISO trigraph feature. For the C compiler,
1847 it disables recognition of C++ style @samp{//} comments as well as
1848 the @code{inline} keyword.
1849
1850 The alternate keywords @code{__asm__}, @code{__extension__},
1851 @code{__inline__} and @code{__typeof__} continue to work despite
1852 @option{-ansi}. You would not want to use them in an ISO C program, of
1853 course, but it is useful to put them in header files that might be included
1854 in compilations done with @option{-ansi}. Alternate predefined macros
1855 such as @code{__unix__} and @code{__vax__} are also available, with or
1856 without @option{-ansi}.
1857
1858 The @option{-ansi} option does not cause non-ISO programs to be
1859 rejected gratuitously. For that, @option{-Wpedantic} is required in
1860 addition to @option{-ansi}. @xref{Warning Options}.
1861
1862 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1863 option is used. Some header files may notice this macro and refrain
1864 from declaring certain functions or defining certain macros that the
1865 ISO standard doesn't call for; this is to avoid interfering with any
1866 programs that might use these names for other things.
1867
1868 Functions that are normally built in but do not have semantics
1869 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1870 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1871 built-in functions provided by GCC}, for details of the functions
1872 affected.
1873
1874 @item -std=
1875 @opindex std
1876 Determine the language standard. @xref{Standards,,Language Standards
1877 Supported by GCC}, for details of these standard versions. This option
1878 is currently only supported when compiling C or C++.
1879
1880 The compiler can accept several base standards, such as @samp{c90} or
1881 @samp{c++98}, and GNU dialects of those standards, such as
1882 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1883 compiler accepts all programs following that standard plus those
1884 using GNU extensions that do not contradict it. For example,
1885 @option{-std=c90} turns off certain features of GCC that are
1886 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1887 keywords, but not other GNU extensions that do not have a meaning in
1888 ISO C90, such as omitting the middle term of a @code{?:}
1889 expression. On the other hand, when a GNU dialect of a standard is
1890 specified, all features supported by the compiler are enabled, even when
1891 those features change the meaning of the base standard. As a result, some
1892 strict-conforming programs may be rejected. The particular standard
1893 is used by @option{-Wpedantic} to identify which features are GNU
1894 extensions given that version of the standard. For example
1895 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1896 comments, while @option{-std=gnu99 -Wpedantic} does not.
1897
1898 A value for this option must be provided; possible values are
1899
1900 @table @samp
1901 @item c90
1902 @itemx c89
1903 @itemx iso9899:1990
1904 Support all ISO C90 programs (certain GNU extensions that conflict
1905 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1906
1907 @item iso9899:199409
1908 ISO C90 as modified in amendment 1.
1909
1910 @item c99
1911 @itemx c9x
1912 @itemx iso9899:1999
1913 @itemx iso9899:199x
1914 ISO C99. This standard is substantially completely supported, modulo
1915 bugs and floating-point issues
1916 (mainly but not entirely relating to optional C99 features from
1917 Annexes F and G). See
1918 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1919 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1920
1921 @item c11
1922 @itemx c1x
1923 @itemx iso9899:2011
1924 ISO C11, the 2011 revision of the ISO C standard. This standard is
1925 substantially completely supported, modulo bugs, floating-point issues
1926 (mainly but not entirely relating to optional C11 features from
1927 Annexes F and G) and the optional Annexes K (Bounds-checking
1928 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1929
1930 @item c17
1931 @itemx c18
1932 @itemx iso9899:2017
1933 @itemx iso9899:2018
1934 ISO C17, the 2017 revision of the ISO C standard
1935 (published in 2018). This standard is
1936 same as C11 except for corrections of defects (all of which are also
1937 applied with @option{-std=c11}) and a new value of
1938 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1939
1940 @item c2x
1941 The next version of the ISO C standard, still under development. The
1942 support for this version is experimental and incomplete.
1943
1944 @item gnu90
1945 @itemx gnu89
1946 GNU dialect of ISO C90 (including some C99 features).
1947
1948 @item gnu99
1949 @itemx gnu9x
1950 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1951
1952 @item gnu11
1953 @itemx gnu1x
1954 GNU dialect of ISO C11.
1955 The name @samp{gnu1x} is deprecated.
1956
1957 @item gnu17
1958 @itemx gnu18
1959 GNU dialect of ISO C17. This is the default for C code.
1960
1961 @item gnu2x
1962 The next version of the ISO C standard, still under development, plus
1963 GNU extensions. The support for this version is experimental and
1964 incomplete.
1965
1966 @item c++98
1967 @itemx c++03
1968 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1969 additional defect reports. Same as @option{-ansi} for C++ code.
1970
1971 @item gnu++98
1972 @itemx gnu++03
1973 GNU dialect of @option{-std=c++98}.
1974
1975 @item c++11
1976 @itemx c++0x
1977 The 2011 ISO C++ standard plus amendments.
1978 The name @samp{c++0x} is deprecated.
1979
1980 @item gnu++11
1981 @itemx gnu++0x
1982 GNU dialect of @option{-std=c++11}.
1983 The name @samp{gnu++0x} is deprecated.
1984
1985 @item c++14
1986 @itemx c++1y
1987 The 2014 ISO C++ standard plus amendments.
1988 The name @samp{c++1y} is deprecated.
1989
1990 @item gnu++14
1991 @itemx gnu++1y
1992 GNU dialect of @option{-std=c++14}.
1993 This is the default for C++ code.
1994 The name @samp{gnu++1y} is deprecated.
1995
1996 @item c++17
1997 @itemx c++1z
1998 The 2017 ISO C++ standard plus amendments.
1999 The name @samp{c++1z} is deprecated.
2000
2001 @item gnu++17
2002 @itemx gnu++1z
2003 GNU dialect of @option{-std=c++17}.
2004 The name @samp{gnu++1z} is deprecated.
2005
2006 @item c++2a
2007 The next revision of the ISO C++ standard, tentatively planned for
2008 2020. Support is highly experimental, and will almost certainly
2009 change in incompatible ways in future releases.
2010
2011 @item gnu++2a
2012 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2013 and will almost certainly change in incompatible ways in future
2014 releases.
2015 @end table
2016
2017 @item -fgnu89-inline
2018 @opindex fgnu89-inline
2019 The option @option{-fgnu89-inline} tells GCC to use the traditional
2020 GNU semantics for @code{inline} functions when in C99 mode.
2021 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2022 Using this option is roughly equivalent to adding the
2023 @code{gnu_inline} function attribute to all inline functions
2024 (@pxref{Function Attributes}).
2025
2026 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2027 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2028 specifies the default behavior).
2029 This option is not supported in @option{-std=c90} or
2030 @option{-std=gnu90} mode.
2031
2032 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2033 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2034 in effect for @code{inline} functions. @xref{Common Predefined
2035 Macros,,,cpp,The C Preprocessor}.
2036
2037 @item -fpermitted-flt-eval-methods=@var{style}
2038 @opindex fpermitted-flt-eval-methods
2039 @opindex fpermitted-flt-eval-methods=c11
2040 @opindex fpermitted-flt-eval-methods=ts-18661-3
2041 ISO/IEC TS 18661-3 defines new permissible values for
2042 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2043 a semantic type that is an interchange or extended format should be
2044 evaluated to the precision and range of that type. These new values are
2045 a superset of those permitted under C99/C11, which does not specify the
2046 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2047 conforming to C11 may not have been written expecting the possibility of
2048 the new values.
2049
2050 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2051 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2052 or the extended set of values specified in ISO/IEC TS 18661-3.
2053
2054 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2055
2056 The default when in a standards compliant mode (@option{-std=c11} or similar)
2057 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2058 dialect (@option{-std=gnu11} or similar) is
2059 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2060
2061 @item -aux-info @var{filename}
2062 @opindex aux-info
2063 Output to the given filename prototyped declarations for all functions
2064 declared and/or defined in a translation unit, including those in header
2065 files. This option is silently ignored in any language other than C@.
2066
2067 Besides declarations, the file indicates, in comments, the origin of
2068 each declaration (source file and line), whether the declaration was
2069 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2070 @samp{O} for old, respectively, in the first character after the line
2071 number and the colon), and whether it came from a declaration or a
2072 definition (@samp{C} or @samp{F}, respectively, in the following
2073 character). In the case of function definitions, a K&R-style list of
2074 arguments followed by their declarations is also provided, inside
2075 comments, after the declaration.
2076
2077 @item -fallow-parameterless-variadic-functions
2078 @opindex fallow-parameterless-variadic-functions
2079 Accept variadic functions without named parameters.
2080
2081 Although it is possible to define such a function, this is not very
2082 useful as it is not possible to read the arguments. This is only
2083 supported for C as this construct is allowed by C++.
2084
2085 @item -fno-asm
2086 @opindex fno-asm
2087 @opindex fasm
2088 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2089 keyword, so that code can use these words as identifiers. You can use
2090 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2091 instead. @option{-ansi} implies @option{-fno-asm}.
2092
2093 In C++, this switch only affects the @code{typeof} keyword, since
2094 @code{asm} and @code{inline} are standard keywords. You may want to
2095 use the @option{-fno-gnu-keywords} flag instead, which has the same
2096 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2097 switch only affects the @code{asm} and @code{typeof} keywords, since
2098 @code{inline} is a standard keyword in ISO C99.
2099
2100 @item -fno-builtin
2101 @itemx -fno-builtin-@var{function}
2102 @opindex fno-builtin
2103 @opindex fbuiltin
2104 @cindex built-in functions
2105 Don't recognize built-in functions that do not begin with
2106 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2107 functions provided by GCC}, for details of the functions affected,
2108 including those which are not built-in functions when @option{-ansi} or
2109 @option{-std} options for strict ISO C conformance are used because they
2110 do not have an ISO standard meaning.
2111
2112 GCC normally generates special code to handle certain built-in functions
2113 more efficiently; for instance, calls to @code{alloca} may become single
2114 instructions which adjust the stack directly, and calls to @code{memcpy}
2115 may become inline copy loops. The resulting code is often both smaller
2116 and faster, but since the function calls no longer appear as such, you
2117 cannot set a breakpoint on those calls, nor can you change the behavior
2118 of the functions by linking with a different library. In addition,
2119 when a function is recognized as a built-in function, GCC may use
2120 information about that function to warn about problems with calls to
2121 that function, or to generate more efficient code, even if the
2122 resulting code still contains calls to that function. For example,
2123 warnings are given with @option{-Wformat} for bad calls to
2124 @code{printf} when @code{printf} is built in and @code{strlen} is
2125 known not to modify global memory.
2126
2127 With the @option{-fno-builtin-@var{function}} option
2128 only the built-in function @var{function} is
2129 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2130 function is named that is not built-in in this version of GCC, this
2131 option is ignored. There is no corresponding
2132 @option{-fbuiltin-@var{function}} option; if you wish to enable
2133 built-in functions selectively when using @option{-fno-builtin} or
2134 @option{-ffreestanding}, you may define macros such as:
2135
2136 @smallexample
2137 #define abs(n) __builtin_abs ((n))
2138 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2139 @end smallexample
2140
2141 @item -fgimple
2142 @opindex fgimple
2143
2144 Enable parsing of function definitions marked with @code{__GIMPLE}.
2145 This is an experimental feature that allows unit testing of GIMPLE
2146 passes.
2147
2148 @item -fhosted
2149 @opindex fhosted
2150 @cindex hosted environment
2151
2152 Assert that compilation targets a hosted environment. This implies
2153 @option{-fbuiltin}. A hosted environment is one in which the
2154 entire standard library is available, and in which @code{main} has a return
2155 type of @code{int}. Examples are nearly everything except a kernel.
2156 This is equivalent to @option{-fno-freestanding}.
2157
2158 @item -ffreestanding
2159 @opindex ffreestanding
2160 @cindex hosted environment
2161
2162 Assert that compilation targets a freestanding environment. This
2163 implies @option{-fno-builtin}. A freestanding environment
2164 is one in which the standard library may not exist, and program startup may
2165 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2166 This is equivalent to @option{-fno-hosted}.
2167
2168 @xref{Standards,,Language Standards Supported by GCC}, for details of
2169 freestanding and hosted environments.
2170
2171 @item -fopenacc
2172 @opindex fopenacc
2173 @cindex OpenACC accelerator programming
2174 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2175 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2176 compiler generates accelerated code according to the OpenACC Application
2177 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2178 implies @option{-pthread}, and thus is only supported on targets that
2179 have support for @option{-pthread}.
2180
2181 @item -fopenacc-dim=@var{geom}
2182 @opindex fopenacc-dim
2183 @cindex OpenACC accelerator programming
2184 Specify default compute dimensions for parallel offload regions that do
2185 not explicitly specify. The @var{geom} value is a triple of
2186 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2187 can be omitted, to use a target-specific default value.
2188
2189 @item -fopenmp
2190 @opindex fopenmp
2191 @cindex OpenMP parallel
2192 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2193 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2194 compiler generates parallel code according to the OpenMP Application
2195 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2196 implies @option{-pthread}, and thus is only supported on targets that
2197 have support for @option{-pthread}. @option{-fopenmp} implies
2198 @option{-fopenmp-simd}.
2199
2200 @item -fopenmp-simd
2201 @opindex fopenmp-simd
2202 @cindex OpenMP SIMD
2203 @cindex SIMD
2204 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2205 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2206 are ignored.
2207
2208 @item -fgnu-tm
2209 @opindex fgnu-tm
2210 When the option @option{-fgnu-tm} is specified, the compiler
2211 generates code for the Linux variant of Intel's current Transactional
2212 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2213 an experimental feature whose interface may change in future versions
2214 of GCC, as the official specification changes. Please note that not
2215 all architectures are supported for this feature.
2216
2217 For more information on GCC's support for transactional memory,
2218 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2219 Transactional Memory Library}.
2220
2221 Note that the transactional memory feature is not supported with
2222 non-call exceptions (@option{-fnon-call-exceptions}).
2223
2224 @item -fms-extensions
2225 @opindex fms-extensions
2226 Accept some non-standard constructs used in Microsoft header files.
2227
2228 In C++ code, this allows member names in structures to be similar
2229 to previous types declarations.
2230
2231 @smallexample
2232 typedef int UOW;
2233 struct ABC @{
2234 UOW UOW;
2235 @};
2236 @end smallexample
2237
2238 Some cases of unnamed fields in structures and unions are only
2239 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2240 fields within structs/unions}, for details.
2241
2242 Note that this option is off for all targets except for x86
2243 targets using ms-abi.
2244
2245 @item -fplan9-extensions
2246 @opindex fplan9-extensions
2247 Accept some non-standard constructs used in Plan 9 code.
2248
2249 This enables @option{-fms-extensions}, permits passing pointers to
2250 structures with anonymous fields to functions that expect pointers to
2251 elements of the type of the field, and permits referring to anonymous
2252 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2253 struct/union fields within structs/unions}, for details. This is only
2254 supported for C, not C++.
2255
2256 @item -fcond-mismatch
2257 @opindex fcond-mismatch
2258 Allow conditional expressions with mismatched types in the second and
2259 third arguments. The value of such an expression is void. This option
2260 is not supported for C++.
2261
2262 @item -flax-vector-conversions
2263 @opindex flax-vector-conversions
2264 Allow implicit conversions between vectors with differing numbers of
2265 elements and/or incompatible element types. This option should not be
2266 used for new code.
2267
2268 @item -funsigned-char
2269 @opindex funsigned-char
2270 Let the type @code{char} be unsigned, like @code{unsigned char}.
2271
2272 Each kind of machine has a default for what @code{char} should
2273 be. It is either like @code{unsigned char} by default or like
2274 @code{signed char} by default.
2275
2276 Ideally, a portable program should always use @code{signed char} or
2277 @code{unsigned char} when it depends on the signedness of an object.
2278 But many programs have been written to use plain @code{char} and
2279 expect it to be signed, or expect it to be unsigned, depending on the
2280 machines they were written for. This option, and its inverse, let you
2281 make such a program work with the opposite default.
2282
2283 The type @code{char} is always a distinct type from each of
2284 @code{signed char} or @code{unsigned char}, even though its behavior
2285 is always just like one of those two.
2286
2287 @item -fsigned-char
2288 @opindex fsigned-char
2289 Let the type @code{char} be signed, like @code{signed char}.
2290
2291 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2292 the negative form of @option{-funsigned-char}. Likewise, the option
2293 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2294
2295 @item -fsigned-bitfields
2296 @itemx -funsigned-bitfields
2297 @itemx -fno-signed-bitfields
2298 @itemx -fno-unsigned-bitfields
2299 @opindex fsigned-bitfields
2300 @opindex funsigned-bitfields
2301 @opindex fno-signed-bitfields
2302 @opindex fno-unsigned-bitfields
2303 These options control whether a bit-field is signed or unsigned, when the
2304 declaration does not use either @code{signed} or @code{unsigned}. By
2305 default, such a bit-field is signed, because this is consistent: the
2306 basic integer types such as @code{int} are signed types.
2307
2308 @item -fsso-struct=@var{endianness}
2309 @opindex fsso-struct
2310 Set the default scalar storage order of structures and unions to the
2311 specified endianness. The accepted values are @samp{big-endian},
2312 @samp{little-endian} and @samp{native} for the native endianness of
2313 the target (the default). This option is not supported for C++.
2314
2315 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2316 code that is not binary compatible with code generated without it if the
2317 specified endianness is not the native endianness of the target.
2318 @end table
2319
2320 @node C++ Dialect Options
2321 @section Options Controlling C++ Dialect
2322
2323 @cindex compiler options, C++
2324 @cindex C++ options, command-line
2325 @cindex options, C++
2326 This section describes the command-line options that are only meaningful
2327 for C++ programs. You can also use most of the GNU compiler options
2328 regardless of what language your program is in. For example, you
2329 might compile a file @file{firstClass.C} like this:
2330
2331 @smallexample
2332 g++ -g -fstrict-enums -O -c firstClass.C
2333 @end smallexample
2334
2335 @noindent
2336 In this example, only @option{-fstrict-enums} is an option meant
2337 only for C++ programs; you can use the other options with any
2338 language supported by GCC@.
2339
2340 Some options for compiling C programs, such as @option{-std}, are also
2341 relevant for C++ programs.
2342 @xref{C Dialect Options,,Options Controlling C Dialect}.
2343
2344 Here is a list of options that are @emph{only} for compiling C++ programs:
2345
2346 @table @gcctabopt
2347
2348 @item -fabi-version=@var{n}
2349 @opindex fabi-version
2350 Use version @var{n} of the C++ ABI@. The default is version 0.
2351
2352 Version 0 refers to the version conforming most closely to
2353 the C++ ABI specification. Therefore, the ABI obtained using version 0
2354 will change in different versions of G++ as ABI bugs are fixed.
2355
2356 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2357
2358 Version 2 is the version of the C++ ABI that first appeared in G++
2359 3.4, and was the default through G++ 4.9.
2360
2361 Version 3 corrects an error in mangling a constant address as a
2362 template argument.
2363
2364 Version 4, which first appeared in G++ 4.5, implements a standard
2365 mangling for vector types.
2366
2367 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2368 attribute const/volatile on function pointer types, decltype of a
2369 plain decl, and use of a function parameter in the declaration of
2370 another parameter.
2371
2372 Version 6, which first appeared in G++ 4.7, corrects the promotion
2373 behavior of C++11 scoped enums and the mangling of template argument
2374 packs, const/static_cast, prefix ++ and --, and a class scope function
2375 used as a template argument.
2376
2377 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2378 builtin type and corrects the mangling of lambdas in default argument
2379 scope.
2380
2381 Version 8, which first appeared in G++ 4.9, corrects the substitution
2382 behavior of function types with function-cv-qualifiers.
2383
2384 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2385 @code{nullptr_t}.
2386
2387 Version 10, which first appeared in G++ 6.1, adds mangling of
2388 attributes that affect type identity, such as ia32 calling convention
2389 attributes (e.g.@: @samp{stdcall}).
2390
2391 Version 11, which first appeared in G++ 7, corrects the mangling of
2392 sizeof... expressions and operator names. For multiple entities with
2393 the same name within a function, that are declared in different scopes,
2394 the mangling now changes starting with the twelfth occurrence. It also
2395 implies @option{-fnew-inheriting-ctors}.
2396
2397 Version 12, which first appeared in G++ 8, corrects the calling
2398 conventions for empty classes on the x86_64 target and for classes
2399 with only deleted copy/move constructors. It accidentally changes the
2400 calling convention for classes with a deleted copy constructor and a
2401 trivial move constructor.
2402
2403 Version 13, which first appeared in G++ 8.2, fixes the accidental
2404 change in version 12.
2405
2406 See also @option{-Wabi}.
2407
2408 @item -fabi-compat-version=@var{n}
2409 @opindex fabi-compat-version
2410 On targets that support strong aliases, G++
2411 works around mangling changes by creating an alias with the correct
2412 mangled name when defining a symbol with an incorrect mangled name.
2413 This switch specifies which ABI version to use for the alias.
2414
2415 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2416 compatibility). If another ABI version is explicitly selected, this
2417 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2418 use @option{-fabi-compat-version=2}.
2419
2420 If this option is not provided but @option{-Wabi=@var{n}} is, that
2421 version is used for compatibility aliases. If this option is provided
2422 along with @option{-Wabi} (without the version), the version from this
2423 option is used for the warning.
2424
2425 @item -fno-access-control
2426 @opindex fno-access-control
2427 @opindex faccess-control
2428 Turn off all access checking. This switch is mainly useful for working
2429 around bugs in the access control code.
2430
2431 @item -faligned-new
2432 @opindex faligned-new
2433 Enable support for C++17 @code{new} of types that require more
2434 alignment than @code{void* ::operator new(std::size_t)} provides. A
2435 numeric argument such as @code{-faligned-new=32} can be used to
2436 specify how much alignment (in bytes) is provided by that function,
2437 but few users will need to override the default of
2438 @code{alignof(std::max_align_t)}.
2439
2440 This flag is enabled by default for @option{-std=c++17}.
2441
2442 @item -fchar8_t
2443 @itemx -fno-char8_t
2444 @opindex fchar8_t
2445 @opindex fno-char8_t
2446 Enable support for @code{char8_t} as adopted for C++2a. This includes
2447 the addition of a new @code{char8_t} fundamental type, changes to the
2448 types of UTF-8 string and character literals, new signatures for
2449 user-defined literals, associated standard library updates, and new
2450 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2451
2452 This option enables functions to be overloaded for ordinary and UTF-8
2453 strings:
2454
2455 @smallexample
2456 int f(const char *); // #1
2457 int f(const char8_t *); // #2
2458 int v1 = f("text"); // Calls #1
2459 int v2 = f(u8"text"); // Calls #2
2460 @end smallexample
2461
2462 @noindent
2463 and introduces new signatures for user-defined literals:
2464
2465 @smallexample
2466 int operator""_udl1(char8_t);
2467 int v3 = u8'x'_udl1;
2468 int operator""_udl2(const char8_t*, std::size_t);
2469 int v4 = u8"text"_udl2;
2470 template<typename T, T...> int operator""_udl3();
2471 int v5 = u8"text"_udl3;
2472 @end smallexample
2473
2474 @noindent
2475 The change to the types of UTF-8 string and character literals introduces
2476 incompatibilities with ISO C++11 and later standards. For example, the
2477 following code is well-formed under ISO C++11, but is ill-formed when
2478 @option{-fchar8_t} is specified.
2479
2480 @smallexample
2481 char ca[] = u8"xx"; // error: char-array initialized from wide
2482 // string
2483 const char *cp = u8"xx";// error: invalid conversion from
2484 // `const char8_t*' to `const char*'
2485 int f(const char*);
2486 auto v = f(u8"xx"); // error: invalid conversion from
2487 // `const char8_t*' to `const char*'
2488 std::string s@{u8"xx"@}; // error: no matching function for call to
2489 // `std::basic_string<char>::basic_string()'
2490 using namespace std::literals;
2491 s = u8"xx"s; // error: conversion from
2492 // `basic_string<char8_t>' to non-scalar
2493 // type `basic_string<char>' requested
2494 @end smallexample
2495
2496 @item -fcheck-new
2497 @opindex fcheck-new
2498 Check that the pointer returned by @code{operator new} is non-null
2499 before attempting to modify the storage allocated. This check is
2500 normally unnecessary because the C++ standard specifies that
2501 @code{operator new} only returns @code{0} if it is declared
2502 @code{throw()}, in which case the compiler always checks the
2503 return value even without this option. In all other cases, when
2504 @code{operator new} has a non-empty exception specification, memory
2505 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2506 @samp{new (nothrow)}.
2507
2508 @item -fconcepts
2509 @opindex fconcepts
2510 Enable support for the C++ Extensions for Concepts Technical
2511 Specification, ISO 19217 (2015), which allows code like
2512
2513 @smallexample
2514 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2515 template <Addable T> T add (T a, T b) @{ return a + b; @}
2516 @end smallexample
2517
2518 @item -fconstexpr-depth=@var{n}
2519 @opindex fconstexpr-depth
2520 Set the maximum nested evaluation depth for C++11 constexpr functions
2521 to @var{n}. A limit is needed to detect endless recursion during
2522 constant expression evaluation. The minimum specified by the standard
2523 is 512.
2524
2525 @item -fconstexpr-cache-depth=@var{n}
2526 @opindex fconstexpr-cache-depth
2527 Set the maximum level of nested evaluation depth for C++11 constexpr
2528 functions that will be cached to @var{n}. This is a heuristic that
2529 trades off compilation speed (when the cache avoids repeated
2530 calculations) against memory consumption (when the cache grows very
2531 large from highly recursive evaluations). The default is 8. Very few
2532 users are likely to want to adjust it, but if your code does heavy
2533 constexpr calculations you might want to experiment to find which
2534 value works best for you.
2535
2536 @item -fconstexpr-loop-limit=@var{n}
2537 @opindex fconstexpr-loop-limit
2538 Set the maximum number of iterations for a loop in C++14 constexpr functions
2539 to @var{n}. A limit is needed to detect infinite loops during
2540 constant expression evaluation. The default is 262144 (1<<18).
2541
2542 @item -fconstexpr-ops-limit=@var{n}
2543 @opindex fconstexpr-ops-limit
2544 Set the maximum number of operations during a single constexpr evaluation.
2545 Even when number of iterations of a single loop is limited with the above limit,
2546 if there are several nested loops and each of them has many iterations but still
2547 smaller than the above limit, or if in a body of some loop or even outside
2548 of a loop too many expressions need to be evaluated, the resulting constexpr
2549 evaluation might take too long.
2550 The default is 33554432 (1<<25).
2551
2552 @item -fdeduce-init-list
2553 @opindex fdeduce-init-list
2554 Enable deduction of a template type parameter as
2555 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2556
2557 @smallexample
2558 template <class T> auto forward(T t) -> decltype (realfn (t))
2559 @{
2560 return realfn (t);
2561 @}
2562
2563 void f()
2564 @{
2565 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2566 @}
2567 @end smallexample
2568
2569 This deduction was implemented as a possible extension to the
2570 originally proposed semantics for the C++11 standard, but was not part
2571 of the final standard, so it is disabled by default. This option is
2572 deprecated, and may be removed in a future version of G++.
2573
2574 @item -fno-elide-constructors
2575 @opindex fno-elide-constructors
2576 @opindex felide-constructors
2577 The C++ standard allows an implementation to omit creating a temporary
2578 that is only used to initialize another object of the same type.
2579 Specifying this option disables that optimization, and forces G++ to
2580 call the copy constructor in all cases. This option also causes G++
2581 to call trivial member functions which otherwise would be expanded inline.
2582
2583 In C++17, the compiler is required to omit these temporaries, but this
2584 option still affects trivial member functions.
2585
2586 @item -fno-enforce-eh-specs
2587 @opindex fno-enforce-eh-specs
2588 @opindex fenforce-eh-specs
2589 Don't generate code to check for violation of exception specifications
2590 at run time. This option violates the C++ standard, but may be useful
2591 for reducing code size in production builds, much like defining
2592 @code{NDEBUG}. This does not give user code permission to throw
2593 exceptions in violation of the exception specifications; the compiler
2594 still optimizes based on the specifications, so throwing an
2595 unexpected exception results in undefined behavior at run time.
2596
2597 @item -fextern-tls-init
2598 @itemx -fno-extern-tls-init
2599 @opindex fextern-tls-init
2600 @opindex fno-extern-tls-init
2601 The C++11 and OpenMP standards allow @code{thread_local} and
2602 @code{threadprivate} variables to have dynamic (runtime)
2603 initialization. To support this, any use of such a variable goes
2604 through a wrapper function that performs any necessary initialization.
2605 When the use and definition of the variable are in the same
2606 translation unit, this overhead can be optimized away, but when the
2607 use is in a different translation unit there is significant overhead
2608 even if the variable doesn't actually need dynamic initialization. If
2609 the programmer can be sure that no use of the variable in a
2610 non-defining TU needs to trigger dynamic initialization (either
2611 because the variable is statically initialized, or a use of the
2612 variable in the defining TU will be executed before any uses in
2613 another TU), they can avoid this overhead with the
2614 @option{-fno-extern-tls-init} option.
2615
2616 On targets that support symbol aliases, the default is
2617 @option{-fextern-tls-init}. On targets that do not support symbol
2618 aliases, the default is @option{-fno-extern-tls-init}.
2619
2620 @item -fno-gnu-keywords
2621 @opindex fno-gnu-keywords
2622 @opindex fgnu-keywords
2623 Do not recognize @code{typeof} as a keyword, so that code can use this
2624 word as an identifier. You can use the keyword @code{__typeof__} instead.
2625 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2626 @option{-std=c++98}, @option{-std=c++11}, etc.
2627
2628 @item -fno-implicit-templates
2629 @opindex fno-implicit-templates
2630 @opindex fimplicit-templates
2631 Never emit code for non-inline templates that are instantiated
2632 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2633 If you use this option, you must take care to structure your code to
2634 include all the necessary explicit instantiations to avoid getting
2635 undefined symbols at link time.
2636 @xref{Template Instantiation}, for more information.
2637
2638 @item -fno-implicit-inline-templates
2639 @opindex fno-implicit-inline-templates
2640 @opindex fimplicit-inline-templates
2641 Don't emit code for implicit instantiations of inline templates, either.
2642 The default is to handle inlines differently so that compiles with and
2643 without optimization need the same set of explicit instantiations.
2644
2645 @item -fno-implement-inlines
2646 @opindex fno-implement-inlines
2647 @opindex fimplement-inlines
2648 To save space, do not emit out-of-line copies of inline functions
2649 controlled by @code{#pragma implementation}. This causes linker
2650 errors if these functions are not inlined everywhere they are called.
2651
2652 @item -fms-extensions
2653 @opindex fms-extensions
2654 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2655 int and getting a pointer to member function via non-standard syntax.
2656
2657 @item -fnew-inheriting-ctors
2658 @opindex fnew-inheriting-ctors
2659 Enable the P0136 adjustment to the semantics of C++11 constructor
2660 inheritance. This is part of C++17 but also considered to be a Defect
2661 Report against C++11 and C++14. This flag is enabled by default
2662 unless @option{-fabi-version=10} or lower is specified.
2663
2664 @item -fnew-ttp-matching
2665 @opindex fnew-ttp-matching
2666 Enable the P0522 resolution to Core issue 150, template template
2667 parameters and default arguments: this allows a template with default
2668 template arguments as an argument for a template template parameter
2669 with fewer template parameters. This flag is enabled by default for
2670 @option{-std=c++17}.
2671
2672 @item -fno-nonansi-builtins
2673 @opindex fno-nonansi-builtins
2674 @opindex fnonansi-builtins
2675 Disable built-in declarations of functions that are not mandated by
2676 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2677 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2678
2679 @item -fnothrow-opt
2680 @opindex fnothrow-opt
2681 Treat a @code{throw()} exception specification as if it were a
2682 @code{noexcept} specification to reduce or eliminate the text size
2683 overhead relative to a function with no exception specification. If
2684 the function has local variables of types with non-trivial
2685 destructors, the exception specification actually makes the
2686 function smaller because the EH cleanups for those variables can be
2687 optimized away. The semantic effect is that an exception thrown out of
2688 a function with such an exception specification results in a call
2689 to @code{terminate} rather than @code{unexpected}.
2690
2691 @item -fno-operator-names
2692 @opindex fno-operator-names
2693 @opindex foperator-names
2694 Do not treat the operator name keywords @code{and}, @code{bitand},
2695 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2696 synonyms as keywords.
2697
2698 @item -fno-optional-diags
2699 @opindex fno-optional-diags
2700 @opindex foptional-diags
2701 Disable diagnostics that the standard says a compiler does not need to
2702 issue. Currently, the only such diagnostic issued by G++ is the one for
2703 a name having multiple meanings within a class.
2704
2705 @item -fpermissive
2706 @opindex fpermissive
2707 Downgrade some diagnostics about nonconformant code from errors to
2708 warnings. Thus, using @option{-fpermissive} allows some
2709 nonconforming code to compile.
2710
2711 @item -fno-pretty-templates
2712 @opindex fno-pretty-templates
2713 @opindex fpretty-templates
2714 When an error message refers to a specialization of a function
2715 template, the compiler normally prints the signature of the
2716 template followed by the template arguments and any typedefs or
2717 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2718 rather than @code{void f(int)}) so that it's clear which template is
2719 involved. When an error message refers to a specialization of a class
2720 template, the compiler omits any template arguments that match
2721 the default template arguments for that template. If either of these
2722 behaviors make it harder to understand the error message rather than
2723 easier, you can use @option{-fno-pretty-templates} to disable them.
2724
2725 @item -frepo
2726 @opindex frepo
2727 Enable automatic template instantiation at link time. This option also
2728 implies @option{-fno-implicit-templates}. @xref{Template
2729 Instantiation}, for more information.
2730
2731 @item -fno-rtti
2732 @opindex fno-rtti
2733 @opindex frtti
2734 Disable generation of information about every class with virtual
2735 functions for use by the C++ run-time type identification features
2736 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2737 of the language, you can save some space by using this flag. Note that
2738 exception handling uses the same information, but G++ generates it as
2739 needed. The @code{dynamic_cast} operator can still be used for casts that
2740 do not require run-time type information, i.e.@: casts to @code{void *} or to
2741 unambiguous base classes.
2742
2743 Mixing code compiled with @option{-frtti} with that compiled with
2744 @option{-fno-rtti} may not work. For example, programs may
2745 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2746 for a class compiled with @option{-frtti}.
2747
2748 @item -fsized-deallocation
2749 @opindex fsized-deallocation
2750 Enable the built-in global declarations
2751 @smallexample
2752 void operator delete (void *, std::size_t) noexcept;
2753 void operator delete[] (void *, std::size_t) noexcept;
2754 @end smallexample
2755 as introduced in C++14. This is useful for user-defined replacement
2756 deallocation functions that, for example, use the size of the object
2757 to make deallocation faster. Enabled by default under
2758 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2759 warns about places that might want to add a definition.
2760
2761 @item -fstrict-enums
2762 @opindex fstrict-enums
2763 Allow the compiler to optimize using the assumption that a value of
2764 enumerated type can only be one of the values of the enumeration (as
2765 defined in the C++ standard; basically, a value that can be
2766 represented in the minimum number of bits needed to represent all the
2767 enumerators). This assumption may not be valid if the program uses a
2768 cast to convert an arbitrary integer value to the enumerated type.
2769
2770 @item -fstrong-eval-order
2771 @opindex fstrong-eval-order
2772 Evaluate member access, array subscripting, and shift expressions in
2773 left-to-right order, and evaluate assignment in right-to-left order,
2774 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2775 @option{-fstrong-eval-order=some} enables just the ordering of member
2776 access and shift expressions, and is the default without
2777 @option{-std=c++17}.
2778
2779 @item -ftemplate-backtrace-limit=@var{n}
2780 @opindex ftemplate-backtrace-limit
2781 Set the maximum number of template instantiation notes for a single
2782 warning or error to @var{n}. The default value is 10.
2783
2784 @item -ftemplate-depth=@var{n}
2785 @opindex ftemplate-depth
2786 Set the maximum instantiation depth for template classes to @var{n}.
2787 A limit on the template instantiation depth is needed to detect
2788 endless recursions during template class instantiation. ANSI/ISO C++
2789 conforming programs must not rely on a maximum depth greater than 17
2790 (changed to 1024 in C++11). The default value is 900, as the compiler
2791 can run out of stack space before hitting 1024 in some situations.
2792
2793 @item -fno-threadsafe-statics
2794 @opindex fno-threadsafe-statics
2795 @opindex fthreadsafe-statics
2796 Do not emit the extra code to use the routines specified in the C++
2797 ABI for thread-safe initialization of local statics. You can use this
2798 option to reduce code size slightly in code that doesn't need to be
2799 thread-safe.
2800
2801 @item -fuse-cxa-atexit
2802 @opindex fuse-cxa-atexit
2803 Register destructors for objects with static storage duration with the
2804 @code{__cxa_atexit} function rather than the @code{atexit} function.
2805 This option is required for fully standards-compliant handling of static
2806 destructors, but only works if your C library supports
2807 @code{__cxa_atexit}.
2808
2809 @item -fno-use-cxa-get-exception-ptr
2810 @opindex fno-use-cxa-get-exception-ptr
2811 @opindex fuse-cxa-get-exception-ptr
2812 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2813 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2814 if the runtime routine is not available.
2815
2816 @item -fvisibility-inlines-hidden
2817 @opindex fvisibility-inlines-hidden
2818 This switch declares that the user does not attempt to compare
2819 pointers to inline functions or methods where the addresses of the two functions
2820 are taken in different shared objects.
2821
2822 The effect of this is that GCC may, effectively, mark inline methods with
2823 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2824 appear in the export table of a DSO and do not require a PLT indirection
2825 when used within the DSO@. Enabling this option can have a dramatic effect
2826 on load and link times of a DSO as it massively reduces the size of the
2827 dynamic export table when the library makes heavy use of templates.
2828
2829 The behavior of this switch is not quite the same as marking the
2830 methods as hidden directly, because it does not affect static variables
2831 local to the function or cause the compiler to deduce that
2832 the function is defined in only one shared object.
2833
2834 You may mark a method as having a visibility explicitly to negate the
2835 effect of the switch for that method. For example, if you do want to
2836 compare pointers to a particular inline method, you might mark it as
2837 having default visibility. Marking the enclosing class with explicit
2838 visibility has no effect.
2839
2840 Explicitly instantiated inline methods are unaffected by this option
2841 as their linkage might otherwise cross a shared library boundary.
2842 @xref{Template Instantiation}.
2843
2844 @item -fvisibility-ms-compat
2845 @opindex fvisibility-ms-compat
2846 This flag attempts to use visibility settings to make GCC's C++
2847 linkage model compatible with that of Microsoft Visual Studio.
2848
2849 The flag makes these changes to GCC's linkage model:
2850
2851 @enumerate
2852 @item
2853 It sets the default visibility to @code{hidden}, like
2854 @option{-fvisibility=hidden}.
2855
2856 @item
2857 Types, but not their members, are not hidden by default.
2858
2859 @item
2860 The One Definition Rule is relaxed for types without explicit
2861 visibility specifications that are defined in more than one
2862 shared object: those declarations are permitted if they are
2863 permitted when this option is not used.
2864 @end enumerate
2865
2866 In new code it is better to use @option{-fvisibility=hidden} and
2867 export those classes that are intended to be externally visible.
2868 Unfortunately it is possible for code to rely, perhaps accidentally,
2869 on the Visual Studio behavior.
2870
2871 Among the consequences of these changes are that static data members
2872 of the same type with the same name but defined in different shared
2873 objects are different, so changing one does not change the other;
2874 and that pointers to function members defined in different shared
2875 objects may not compare equal. When this flag is given, it is a
2876 violation of the ODR to define types with the same name differently.
2877
2878 @item -fno-weak
2879 @opindex fno-weak
2880 @opindex fweak
2881 Do not use weak symbol support, even if it is provided by the linker.
2882 By default, G++ uses weak symbols if they are available. This
2883 option exists only for testing, and should not be used by end-users;
2884 it results in inferior code and has no benefits. This option may
2885 be removed in a future release of G++.
2886
2887 @item -nostdinc++
2888 @opindex nostdinc++
2889 Do not search for header files in the standard directories specific to
2890 C++, but do still search the other standard directories. (This option
2891 is used when building the C++ library.)
2892 @end table
2893
2894 In addition, these optimization, warning, and code generation options
2895 have meanings only for C++ programs:
2896
2897 @table @gcctabopt
2898 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2899 @opindex Wabi
2900 @opindex Wno-abi
2901 Warn when G++ it generates code that is probably not compatible with
2902 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2903 ABI with each major release, normally @option{-Wabi} will warn only if
2904 there is a check added later in a release series for an ABI issue
2905 discovered since the initial release. @option{-Wabi} will warn about
2906 more things if an older ABI version is selected (with
2907 @option{-fabi-version=@var{n}}).
2908
2909 @option{-Wabi} can also be used with an explicit version number to
2910 warn about compatibility with a particular @option{-fabi-version}
2911 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2912 @option{-fabi-version=2}.
2913
2914 If an explicit version number is provided and
2915 @option{-fabi-compat-version} is not specified, the version number
2916 from this option is used for compatibility aliases. If no explicit
2917 version number is provided with this option, but
2918 @option{-fabi-compat-version} is specified, that version number is
2919 used for ABI warnings.
2920
2921 Although an effort has been made to warn about
2922 all such cases, there are probably some cases that are not warned about,
2923 even though G++ is generating incompatible code. There may also be
2924 cases where warnings are emitted even though the code that is generated
2925 is compatible.
2926
2927 You should rewrite your code to avoid these warnings if you are
2928 concerned about the fact that code generated by G++ may not be binary
2929 compatible with code generated by other compilers.
2930
2931 Known incompatibilities in @option{-fabi-version=2} (which was the
2932 default from GCC 3.4 to 4.9) include:
2933
2934 @itemize @bullet
2935
2936 @item
2937 A template with a non-type template parameter of reference type was
2938 mangled incorrectly:
2939 @smallexample
2940 extern int N;
2941 template <int &> struct S @{@};
2942 void n (S<N>) @{2@}
2943 @end smallexample
2944
2945 This was fixed in @option{-fabi-version=3}.
2946
2947 @item
2948 SIMD vector types declared using @code{__attribute ((vector_size))} were
2949 mangled in a non-standard way that does not allow for overloading of
2950 functions taking vectors of different sizes.
2951
2952 The mangling was changed in @option{-fabi-version=4}.
2953
2954 @item
2955 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2956 qualifiers, and @code{decltype} of a plain declaration was folded away.
2957
2958 These mangling issues were fixed in @option{-fabi-version=5}.
2959
2960 @item
2961 Scoped enumerators passed as arguments to a variadic function are
2962 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2963 On most targets this does not actually affect the parameter passing
2964 ABI, as there is no way to pass an argument smaller than @code{int}.
2965
2966 Also, the ABI changed the mangling of template argument packs,
2967 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2968 a class scope function used as a template argument.
2969
2970 These issues were corrected in @option{-fabi-version=6}.
2971
2972 @item
2973 Lambdas in default argument scope were mangled incorrectly, and the
2974 ABI changed the mangling of @code{nullptr_t}.
2975
2976 These issues were corrected in @option{-fabi-version=7}.
2977
2978 @item
2979 When mangling a function type with function-cv-qualifiers, the
2980 un-qualified function type was incorrectly treated as a substitution
2981 candidate.
2982
2983 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2984
2985 @item
2986 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2987 unaligned accesses. Note that this did not affect the ABI of a
2988 function with a @code{nullptr_t} parameter, as parameters have a
2989 minimum alignment.
2990
2991 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2992
2993 @item
2994 Target-specific attributes that affect the identity of a type, such as
2995 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2996 did not affect the mangled name, leading to name collisions when
2997 function pointers were used as template arguments.
2998
2999 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
3000
3001 @end itemize
3002
3003 It also warns about psABI-related changes. The known psABI changes at this
3004 point include:
3005
3006 @itemize @bullet
3007
3008 @item
3009 For SysV/x86-64, unions with @code{long double} members are
3010 passed in memory as specified in psABI. For example:
3011
3012 @smallexample
3013 union U @{
3014 long double ld;
3015 int i;
3016 @};
3017 @end smallexample
3018
3019 @noindent
3020 @code{union U} is always passed in memory.
3021
3022 @end itemize
3023
3024 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3025 @opindex Wabi-tag
3026 @opindex Wabi-tag
3027 Warn when a type with an ABI tag is used in a context that does not
3028 have that ABI tag. See @ref{C++ Attributes} for more information
3029 about ABI tags.
3030
3031 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3032 @opindex Wcomma-subscript
3033 @opindex Wno-comma-subscript
3034 Warn about uses of a comma expression within a subscripting expression.
3035 This usage was deprecated in C++2a. However, a comma expression wrapped
3036 in @code{( )} is not deprecated. Example:
3037
3038 @smallexample
3039 @group
3040 void f(int *a, int b, int c) @{
3041 a[b,c]; // deprecated
3042 a[(b,c)]; // OK
3043 @}
3044 @end group
3045 @end smallexample
3046
3047 Enabled by default with @option{-std=c++2a}.
3048
3049 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3050 @opindex Wctor-dtor-privacy
3051 @opindex Wno-ctor-dtor-privacy
3052 Warn when a class seems unusable because all the constructors or
3053 destructors in that class are private, and it has neither friends nor
3054 public static member functions. Also warn if there are no non-private
3055 methods, and there's at least one private member function that isn't
3056 a constructor or destructor.
3057
3058 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3059 @opindex Wdelete-non-virtual-dtor
3060 @opindex Wno-delete-non-virtual-dtor
3061 Warn when @code{delete} is used to destroy an instance of a class that
3062 has virtual functions and non-virtual destructor. It is unsafe to delete
3063 an instance of a derived class through a pointer to a base class if the
3064 base class does not have a virtual destructor. This warning is enabled
3065 by @option{-Wall}.
3066
3067 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3068 @opindex Wdeprecated-copy
3069 @opindex Wno-deprecated-copy
3070 Warn that the implicit declaration of a copy constructor or copy
3071 assignment operator is deprecated if the class has a user-provided
3072 copy constructor or copy assignment operator, in C++11 and up. This
3073 warning is enabled by @option{-Wextra}. With
3074 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3075 user-provided destructor.
3076
3077 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3078 @opindex Winit-list-lifetime
3079 @opindex Wno-init-list-lifetime
3080 Do not warn about uses of @code{std::initializer_list} that are likely
3081 to result in dangling pointers. Since the underlying array for an
3082 @code{initializer_list} is handled like a normal C++ temporary object,
3083 it is easy to inadvertently keep a pointer to the array past the end
3084 of the array's lifetime. For example:
3085
3086 @itemize @bullet
3087 @item
3088 If a function returns a temporary @code{initializer_list}, or a local
3089 @code{initializer_list} variable, the array's lifetime ends at the end
3090 of the return statement, so the value returned has a dangling pointer.
3091
3092 @item
3093 If a new-expression creates an @code{initializer_list}, the array only
3094 lives until the end of the enclosing full-expression, so the
3095 @code{initializer_list} in the heap has a dangling pointer.
3096
3097 @item
3098 When an @code{initializer_list} variable is assigned from a
3099 brace-enclosed initializer list, the temporary array created for the
3100 right side of the assignment only lives until the end of the
3101 full-expression, so at the next statement the @code{initializer_list}
3102 variable has a dangling pointer.
3103
3104 @smallexample
3105 // li's initial underlying array lives as long as li
3106 std::initializer_list<int> li = @{ 1,2,3 @};
3107 // assignment changes li to point to a temporary array
3108 li = @{ 4, 5 @};
3109 // now the temporary is gone and li has a dangling pointer
3110 int i = li.begin()[0] // undefined behavior
3111 @end smallexample
3112
3113 @item
3114 When a list constructor stores the @code{begin} pointer from the
3115 @code{initializer_list} argument, this doesn't extend the lifetime of
3116 the array, so if a class variable is constructed from a temporary
3117 @code{initializer_list}, the pointer is left dangling by the end of
3118 the variable declaration statement.
3119
3120 @end itemize
3121
3122 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3123 @opindex Wliteral-suffix
3124 @opindex Wno-literal-suffix
3125 Warn when a string or character literal is followed by a ud-suffix which does
3126 not begin with an underscore. As a conforming extension, GCC treats such
3127 suffixes as separate preprocessing tokens in order to maintain backwards
3128 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3129 For example:
3130
3131 @smallexample
3132 #define __STDC_FORMAT_MACROS
3133 #include <inttypes.h>
3134 #include <stdio.h>
3135
3136 int main() @{
3137 int64_t i64 = 123;
3138 printf("My int64: %" PRId64"\n", i64);
3139 @}
3140 @end smallexample
3141
3142 In this case, @code{PRId64} is treated as a separate preprocessing token.
3143
3144 Additionally, warn when a user-defined literal operator is declared with
3145 a literal suffix identifier that doesn't begin with an underscore. Literal
3146 suffix identifiers that don't begin with an underscore are reserved for
3147 future standardization.
3148
3149 This warning is enabled by default.
3150
3151 @item -Wlto-type-mismatch
3152 @opindex Wlto-type-mismatch
3153 @opindex Wno-lto-type-mismatch
3154
3155 During the link-time optimization warn about type mismatches in
3156 global declarations from different compilation units.
3157 Requires @option{-flto} to be enabled. Enabled by default.
3158
3159 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3160 @opindex Wnarrowing
3161 @opindex Wno-narrowing
3162 For C++11 and later standards, narrowing conversions are diagnosed by default,
3163 as required by the standard. A narrowing conversion from a constant produces
3164 an error, and a narrowing conversion from a non-constant produces a warning,
3165 but @option{-Wno-narrowing} suppresses the diagnostic.
3166 Note that this does not affect the meaning of well-formed code;
3167 narrowing conversions are still considered ill-formed in SFINAE contexts.
3168
3169 With @option{-Wnarrowing} in C++98, warn when a narrowing
3170 conversion prohibited by C++11 occurs within
3171 @samp{@{ @}}, e.g.
3172
3173 @smallexample
3174 int i = @{ 2.2 @}; // error: narrowing from double to int
3175 @end smallexample
3176
3177 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3178
3179 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3180 @opindex Wnoexcept
3181 @opindex Wno-noexcept
3182 Warn when a noexcept-expression evaluates to false because of a call
3183 to a function that does not have a non-throwing exception
3184 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3185 the compiler to never throw an exception.
3186
3187 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3188 @opindex Wnoexcept-type
3189 @opindex Wno-noexcept-type
3190 Warn if the C++17 feature making @code{noexcept} part of a function
3191 type changes the mangled name of a symbol relative to C++14. Enabled
3192 by @option{-Wabi} and @option{-Wc++17-compat}.
3193
3194 As an example:
3195
3196 @smallexample
3197 template <class T> void f(T t) @{ t(); @};
3198 void g() noexcept;
3199 void h() @{ f(g); @}
3200 @end smallexample
3201
3202 @noindent
3203 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3204 C++17 it calls @code{f<void(*)()noexcept>}.
3205
3206 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3207 @opindex Wclass-memaccess
3208 @opindex Wno-class-memaccess
3209 Warn when the destination of a call to a raw memory function such as
3210 @code{memset} or @code{memcpy} is an object of class type, and when writing
3211 into such an object might bypass the class non-trivial or deleted constructor
3212 or copy assignment, violate const-correctness or encapsulation, or corrupt
3213 virtual table pointers. Modifying the representation of such objects may
3214 violate invariants maintained by member functions of the class. For example,
3215 the call to @code{memset} below is undefined because it modifies a non-trivial
3216 class object and is, therefore, diagnosed. The safe way to either initialize
3217 or clear the storage of objects of such types is by using the appropriate
3218 constructor or assignment operator, if one is available.
3219 @smallexample
3220 std::string str = "abc";
3221 memset (&str, 0, sizeof str);
3222 @end smallexample
3223 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3224 Explicitly casting the pointer to the class object to @code{void *} or
3225 to a type that can be safely accessed by the raw memory function suppresses
3226 the warning.
3227
3228 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3229 @opindex Wnon-virtual-dtor
3230 @opindex Wno-non-virtual-dtor
3231 Warn when a class has virtual functions and an accessible non-virtual
3232 destructor itself or in an accessible polymorphic base class, in which
3233 case it is possible but unsafe to delete an instance of a derived
3234 class through a pointer to the class itself or base class. This
3235 warning is automatically enabled if @option{-Weffc++} is specified.
3236
3237 @item -Wregister @r{(C++ and Objective-C++ only)}
3238 @opindex Wregister
3239 @opindex Wno-register
3240 Warn on uses of the @code{register} storage class specifier, except
3241 when it is part of the GNU @ref{Explicit Register Variables} extension.
3242 The use of the @code{register} keyword as storage class specifier has
3243 been deprecated in C++11 and removed in C++17.
3244 Enabled by default with @option{-std=c++17}.
3245
3246 @item -Wreorder @r{(C++ and Objective-C++ only)}
3247 @opindex Wreorder
3248 @opindex Wno-reorder
3249 @cindex reordering, warning
3250 @cindex warning for reordering of member initializers
3251 Warn when the order of member initializers given in the code does not
3252 match the order in which they must be executed. For instance:
3253
3254 @smallexample
3255 struct A @{
3256 int i;
3257 int j;
3258 A(): j (0), i (1) @{ @}
3259 @};
3260 @end smallexample
3261
3262 @noindent
3263 The compiler rearranges the member initializers for @code{i}
3264 and @code{j} to match the declaration order of the members, emitting
3265 a warning to that effect. This warning is enabled by @option{-Wall}.
3266
3267 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3268 @opindex Wpessimizing-move
3269 @opindex Wno-pessimizing-move
3270 This warning warns when a call to @code{std::move} prevents copy
3271 elision. A typical scenario when copy elision can occur is when returning in
3272 a function with a class return type, when the expression being returned is the
3273 name of a non-volatile automatic object, and is not a function parameter, and
3274 has the same type as the function return type.
3275
3276 @smallexample
3277 struct T @{
3278 @dots{}
3279 @};
3280 T fn()
3281 @{
3282 T t;
3283 @dots{}
3284 return std::move (t);
3285 @}
3286 @end smallexample
3287
3288 But in this example, the @code{std::move} call prevents copy elision.
3289
3290 This warning is enabled by @option{-Wall}.
3291
3292 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3293 @opindex Wredundant-move
3294 @opindex Wno-redundant-move
3295 This warning warns about redundant calls to @code{std::move}; that is, when
3296 a move operation would have been performed even without the @code{std::move}
3297 call. This happens because the compiler is forced to treat the object as if
3298 it were an rvalue in certain situations such as returning a local variable,
3299 where copy elision isn't applicable. Consider:
3300
3301 @smallexample
3302 struct T @{
3303 @dots{}
3304 @};
3305 T fn(T t)
3306 @{
3307 @dots{}
3308 return std::move (t);
3309 @}
3310 @end smallexample
3311
3312 Here, the @code{std::move} call is redundant. Because G++ implements Core
3313 Issue 1579, another example is:
3314
3315 @smallexample
3316 struct T @{ // convertible to U
3317 @dots{}
3318 @};
3319 struct U @{
3320 @dots{}
3321 @};
3322 U fn()
3323 @{
3324 T t;
3325 @dots{}
3326 return std::move (t);
3327 @}
3328 @end smallexample
3329 In this example, copy elision isn't applicable because the type of the
3330 expression being returned and the function return type differ, yet G++
3331 treats the return value as if it were designated by an rvalue.
3332
3333 This warning is enabled by @option{-Wextra}.
3334
3335 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3336 @opindex fext-numeric-literals
3337 @opindex fno-ext-numeric-literals
3338 Accept imaginary, fixed-point, or machine-defined
3339 literal number suffixes as GNU extensions.
3340 When this option is turned off these suffixes are treated
3341 as C++11 user-defined literal numeric suffixes.
3342 This is on by default for all pre-C++11 dialects and all GNU dialects:
3343 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3344 @option{-std=gnu++14}.
3345 This option is off by default
3346 for ISO C++11 onwards (@option{-std=c++11}, ...).
3347 @end table
3348
3349 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3350
3351 @table @gcctabopt
3352 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3353 @opindex Weffc++
3354 @opindex Wno-effc++
3355 Warn about violations of the following style guidelines from Scott Meyers'
3356 @cite{Effective C++} series of books:
3357
3358 @itemize @bullet
3359 @item
3360 Define a copy constructor and an assignment operator for classes
3361 with dynamically-allocated memory.
3362
3363 @item
3364 Prefer initialization to assignment in constructors.
3365
3366 @item
3367 Have @code{operator=} return a reference to @code{*this}.
3368
3369 @item
3370 Don't try to return a reference when you must return an object.
3371
3372 @item
3373 Distinguish between prefix and postfix forms of increment and
3374 decrement operators.
3375
3376 @item
3377 Never overload @code{&&}, @code{||}, or @code{,}.
3378
3379 @end itemize
3380
3381 This option also enables @option{-Wnon-virtual-dtor}, which is also
3382 one of the effective C++ recommendations. However, the check is
3383 extended to warn about the lack of virtual destructor in accessible
3384 non-polymorphic bases classes too.
3385
3386 When selecting this option, be aware that the standard library
3387 headers do not obey all of these guidelines; use @samp{grep -v}
3388 to filter out those warnings.
3389
3390 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3391 @opindex Wstrict-null-sentinel
3392 @opindex Wno-strict-null-sentinel
3393 Warn about the use of an uncasted @code{NULL} as sentinel. When
3394 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3395 to @code{__null}. Although it is a null pointer constant rather than a
3396 null pointer, it is guaranteed to be of the same size as a pointer.
3397 But this use is not portable across different compilers.
3398
3399 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3400 @opindex Wno-non-template-friend
3401 @opindex Wnon-template-friend
3402 Disable warnings when non-template friend functions are declared
3403 within a template. In very old versions of GCC that predate implementation
3404 of the ISO standard, declarations such as
3405 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3406 could be interpreted as a particular specialization of a template
3407 function; the warning exists to diagnose compatibility problems,
3408 and is enabled by default.
3409
3410 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3411 @opindex Wold-style-cast
3412 @opindex Wno-old-style-cast
3413 Warn if an old-style (C-style) cast to a non-void type is used within
3414 a C++ program. The new-style casts (@code{dynamic_cast},
3415 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3416 less vulnerable to unintended effects and much easier to search for.
3417
3418 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3419 @opindex Woverloaded-virtual
3420 @opindex Wno-overloaded-virtual
3421 @cindex overloaded virtual function, warning
3422 @cindex warning for overloaded virtual function
3423 Warn when a function declaration hides virtual functions from a
3424 base class. For example, in:
3425
3426 @smallexample
3427 struct A @{
3428 virtual void f();
3429 @};
3430
3431 struct B: public A @{
3432 void f(int);
3433 @};
3434 @end smallexample
3435
3436 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3437 like:
3438
3439 @smallexample
3440 B* b;
3441 b->f();
3442 @end smallexample
3443
3444 @noindent
3445 fails to compile.
3446
3447 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3448 @opindex Wno-pmf-conversions
3449 @opindex Wpmf-conversions
3450 Disable the diagnostic for converting a bound pointer to member function
3451 to a plain pointer.
3452
3453 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3454 @opindex Wsign-promo
3455 @opindex Wno-sign-promo
3456 Warn when overload resolution chooses a promotion from unsigned or
3457 enumerated type to a signed type, over a conversion to an unsigned type of
3458 the same size. Previous versions of G++ tried to preserve
3459 unsignedness, but the standard mandates the current behavior.
3460
3461 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3462 @opindex Wtemplates
3463 @opindex Wno-templates
3464 Warn when a primary template declaration is encountered. Some coding
3465 rules disallow templates, and this may be used to enforce that rule.
3466 The warning is inactive inside a system header file, such as the STL, so
3467 one can still use the STL. One may also instantiate or specialize
3468 templates.
3469
3470 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3471 @opindex Wmultiple-inheritance
3472 @opindex Wno-multiple-inheritance
3473 Warn when a class is defined with multiple direct base classes. Some
3474 coding rules disallow multiple inheritance, and this may be used to
3475 enforce that rule. The warning is inactive inside a system header file,
3476 such as the STL, so one can still use the STL. One may also define
3477 classes that indirectly use multiple inheritance.
3478
3479 @item -Wvirtual-inheritance
3480 @opindex Wvirtual-inheritance
3481 @opindex Wno-virtual-inheritance
3482 Warn when a class is defined with a virtual direct base class. Some
3483 coding rules disallow multiple inheritance, and this may be used to
3484 enforce that rule. The warning is inactive inside a system header file,
3485 such as the STL, so one can still use the STL. One may also define
3486 classes that indirectly use virtual inheritance.
3487
3488 @item -Wnamespaces
3489 @opindex Wnamespaces
3490 @opindex Wno-namespaces
3491 Warn when a namespace definition is opened. Some coding rules disallow
3492 namespaces, and this may be used to enforce that rule. The warning is
3493 inactive inside a system header file, such as the STL, so one can still
3494 use the STL. One may also use using directives and qualified names.
3495
3496 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3497 @opindex Wterminate
3498 @opindex Wno-terminate
3499 Disable the warning about a throw-expression that will immediately
3500 result in a call to @code{terminate}.
3501
3502 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3503 @opindex Wno-class-conversion
3504 @opindex Wclass-conversion
3505 Disable the warning about the case when a conversion function converts an
3506 object to the same type, to a base class of that type, or to void; such
3507 a conversion function will never be called.
3508
3509 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3510 @opindex Wvolatile
3511 @opindex Wno-volatile
3512 Warn about deprecated uses of the @code{volatile} qualifier. This includes
3513 postfix and prefix @code{++} and @code{--} expressions of
3514 @code{volatile}-qualified types, using simple assignments where the left
3515 operand is a @code{volatile}-qualified non-class type for their value,
3516 compound assignments where the left operand is a @code{volatile}-qualified
3517 non-class type, @code{volatile}-qualified function return type,
3518 @code{volatile}-qualified parameter type, and structured bindings of a
3519 @code{volatile}-qualified type. This usage was deprecated in C++20.
3520
3521 Enabled by default with @option{-std=c++2a}.
3522 @end table
3523
3524 @node Objective-C and Objective-C++ Dialect Options
3525 @section Options Controlling Objective-C and Objective-C++ Dialects
3526
3527 @cindex compiler options, Objective-C and Objective-C++
3528 @cindex Objective-C and Objective-C++ options, command-line
3529 @cindex options, Objective-C and Objective-C++
3530 (NOTE: This manual does not describe the Objective-C and Objective-C++
3531 languages themselves. @xref{Standards,,Language Standards
3532 Supported by GCC}, for references.)
3533
3534 This section describes the command-line options that are only meaningful
3535 for Objective-C and Objective-C++ programs. You can also use most of
3536 the language-independent GNU compiler options.
3537 For example, you might compile a file @file{some_class.m} like this:
3538
3539 @smallexample
3540 gcc -g -fgnu-runtime -O -c some_class.m
3541 @end smallexample
3542
3543 @noindent
3544 In this example, @option{-fgnu-runtime} is an option meant only for
3545 Objective-C and Objective-C++ programs; you can use the other options with
3546 any language supported by GCC@.
3547
3548 Note that since Objective-C is an extension of the C language, Objective-C
3549 compilations may also use options specific to the C front-end (e.g.,
3550 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3551 C++-specific options (e.g., @option{-Wabi}).
3552
3553 Here is a list of options that are @emph{only} for compiling Objective-C
3554 and Objective-C++ programs:
3555
3556 @table @gcctabopt
3557 @item -fconstant-string-class=@var{class-name}
3558 @opindex fconstant-string-class
3559 Use @var{class-name} as the name of the class to instantiate for each
3560 literal string specified with the syntax @code{@@"@dots{}"}. The default
3561 class name is @code{NXConstantString} if the GNU runtime is being used, and
3562 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3563 @option{-fconstant-cfstrings} option, if also present, overrides the
3564 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3565 to be laid out as constant CoreFoundation strings.
3566
3567 @item -fgnu-runtime
3568 @opindex fgnu-runtime
3569 Generate object code compatible with the standard GNU Objective-C
3570 runtime. This is the default for most types of systems.
3571
3572 @item -fnext-runtime
3573 @opindex fnext-runtime
3574 Generate output compatible with the NeXT runtime. This is the default
3575 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3576 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3577 used.
3578
3579 @item -fno-nil-receivers
3580 @opindex fno-nil-receivers
3581 @opindex fnil-receivers
3582 Assume that all Objective-C message dispatches (@code{[receiver
3583 message:arg]}) in this translation unit ensure that the receiver is
3584 not @code{nil}. This allows for more efficient entry points in the
3585 runtime to be used. This option is only available in conjunction with
3586 the NeXT runtime and ABI version 0 or 1.
3587
3588 @item -fobjc-abi-version=@var{n}
3589 @opindex fobjc-abi-version
3590 Use version @var{n} of the Objective-C ABI for the selected runtime.
3591 This option is currently supported only for the NeXT runtime. In that
3592 case, Version 0 is the traditional (32-bit) ABI without support for
3593 properties and other Objective-C 2.0 additions. Version 1 is the
3594 traditional (32-bit) ABI with support for properties and other
3595 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3596 nothing is specified, the default is Version 0 on 32-bit target
3597 machines, and Version 2 on 64-bit target machines.
3598
3599 @item -fobjc-call-cxx-cdtors
3600 @opindex fobjc-call-cxx-cdtors
3601 For each Objective-C class, check if any of its instance variables is a
3602 C++ object with a non-trivial default constructor. If so, synthesize a
3603 special @code{- (id) .cxx_construct} instance method which runs
3604 non-trivial default constructors on any such instance variables, in order,
3605 and then return @code{self}. Similarly, check if any instance variable
3606 is a C++ object with a non-trivial destructor, and if so, synthesize a
3607 special @code{- (void) .cxx_destruct} method which runs
3608 all such default destructors, in reverse order.
3609
3610 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3611 methods thusly generated only operate on instance variables
3612 declared in the current Objective-C class, and not those inherited
3613 from superclasses. It is the responsibility of the Objective-C
3614 runtime to invoke all such methods in an object's inheritance
3615 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3616 by the runtime immediately after a new object instance is allocated;
3617 the @code{- (void) .cxx_destruct} methods are invoked immediately
3618 before the runtime deallocates an object instance.
3619
3620 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3621 support for invoking the @code{- (id) .cxx_construct} and
3622 @code{- (void) .cxx_destruct} methods.
3623
3624 @item -fobjc-direct-dispatch
3625 @opindex fobjc-direct-dispatch
3626 Allow fast jumps to the message dispatcher. On Darwin this is
3627 accomplished via the comm page.
3628
3629 @item -fobjc-exceptions
3630 @opindex fobjc-exceptions
3631 Enable syntactic support for structured exception handling in
3632 Objective-C, similar to what is offered by C++. This option
3633 is required to use the Objective-C keywords @code{@@try},
3634 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3635 @code{@@synchronized}. This option is available with both the GNU
3636 runtime and the NeXT runtime (but not available in conjunction with
3637 the NeXT runtime on Mac OS X 10.2 and earlier).
3638
3639 @item -fobjc-gc
3640 @opindex fobjc-gc
3641 Enable garbage collection (GC) in Objective-C and Objective-C++
3642 programs. This option is only available with the NeXT runtime; the
3643 GNU runtime has a different garbage collection implementation that
3644 does not require special compiler flags.
3645
3646 @item -fobjc-nilcheck
3647 @opindex fobjc-nilcheck
3648 For the NeXT runtime with version 2 of the ABI, check for a nil
3649 receiver in method invocations before doing the actual method call.
3650 This is the default and can be disabled using
3651 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3652 checked for nil in this way no matter what this flag is set to.
3653 Currently this flag does nothing when the GNU runtime, or an older
3654 version of the NeXT runtime ABI, is used.
3655
3656 @item -fobjc-std=objc1
3657 @opindex fobjc-std
3658 Conform to the language syntax of Objective-C 1.0, the language
3659 recognized by GCC 4.0. This only affects the Objective-C additions to
3660 the C/C++ language; it does not affect conformance to C/C++ standards,
3661 which is controlled by the separate C/C++ dialect option flags. When
3662 this option is used with the Objective-C or Objective-C++ compiler,
3663 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3664 This is useful if you need to make sure that your Objective-C code can
3665 be compiled with older versions of GCC@.
3666
3667 @item -freplace-objc-classes
3668 @opindex freplace-objc-classes
3669 Emit a special marker instructing @command{ld(1)} not to statically link in
3670 the resulting object file, and allow @command{dyld(1)} to load it in at
3671 run time instead. This is used in conjunction with the Fix-and-Continue
3672 debugging mode, where the object file in question may be recompiled and
3673 dynamically reloaded in the course of program execution, without the need
3674 to restart the program itself. Currently, Fix-and-Continue functionality
3675 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3676 and later.
3677
3678 @item -fzero-link
3679 @opindex fzero-link
3680 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3681 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3682 compile time) with static class references that get initialized at load time,
3683 which improves run-time performance. Specifying the @option{-fzero-link} flag
3684 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3685 to be retained. This is useful in Zero-Link debugging mode, since it allows
3686 for individual class implementations to be modified during program execution.
3687 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3688 regardless of command-line options.
3689
3690 @item -fno-local-ivars
3691 @opindex fno-local-ivars
3692 @opindex flocal-ivars
3693 By default instance variables in Objective-C can be accessed as if
3694 they were local variables from within the methods of the class they're
3695 declared in. This can lead to shadowing between instance variables
3696 and other variables declared either locally inside a class method or
3697 globally with the same name. Specifying the @option{-fno-local-ivars}
3698 flag disables this behavior thus avoiding variable shadowing issues.
3699
3700 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3701 @opindex fivar-visibility
3702 Set the default instance variable visibility to the specified option
3703 so that instance variables declared outside the scope of any access
3704 modifier directives default to the specified visibility.
3705
3706 @item -gen-decls
3707 @opindex gen-decls
3708 Dump interface declarations for all classes seen in the source file to a
3709 file named @file{@var{sourcename}.decl}.
3710
3711 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3712 @opindex Wassign-intercept
3713 @opindex Wno-assign-intercept
3714 Warn whenever an Objective-C assignment is being intercepted by the
3715 garbage collector.
3716
3717 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3718 @opindex Wno-protocol
3719 @opindex Wprotocol
3720 If a class is declared to implement a protocol, a warning is issued for
3721 every method in the protocol that is not implemented by the class. The
3722 default behavior is to issue a warning for every method not explicitly
3723 implemented in the class, even if a method implementation is inherited
3724 from the superclass. If you use the @option{-Wno-protocol} option, then
3725 methods inherited from the superclass are considered to be implemented,
3726 and no warning is issued for them.
3727
3728 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3729 @opindex Wselector
3730 @opindex Wno-selector
3731 Warn if multiple methods of different types for the same selector are
3732 found during compilation. The check is performed on the list of methods
3733 in the final stage of compilation. Additionally, a check is performed
3734 for each selector appearing in a @code{@@selector(@dots{})}
3735 expression, and a corresponding method for that selector has been found
3736 during compilation. Because these checks scan the method table only at
3737 the end of compilation, these warnings are not produced if the final
3738 stage of compilation is not reached, for example because an error is
3739 found during compilation, or because the @option{-fsyntax-only} option is
3740 being used.
3741
3742 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3743 @opindex Wstrict-selector-match
3744 @opindex Wno-strict-selector-match
3745 Warn if multiple methods with differing argument and/or return types are
3746 found for a given selector when attempting to send a message using this
3747 selector to a receiver of type @code{id} or @code{Class}. When this flag
3748 is off (which is the default behavior), the compiler omits such warnings
3749 if any differences found are confined to types that share the same size
3750 and alignment.
3751
3752 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3753 @opindex Wundeclared-selector
3754 @opindex Wno-undeclared-selector
3755 Warn if a @code{@@selector(@dots{})} expression referring to an
3756 undeclared selector is found. A selector is considered undeclared if no
3757 method with that name has been declared before the
3758 @code{@@selector(@dots{})} expression, either explicitly in an
3759 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3760 an @code{@@implementation} section. This option always performs its
3761 checks as soon as a @code{@@selector(@dots{})} expression is found,
3762 while @option{-Wselector} only performs its checks in the final stage of
3763 compilation. This also enforces the coding style convention
3764 that methods and selectors must be declared before being used.
3765
3766 @item -print-objc-runtime-info
3767 @opindex print-objc-runtime-info
3768 Generate C header describing the largest structure that is passed by
3769 value, if any.
3770
3771 @end table
3772
3773 @node Diagnostic Message Formatting Options
3774 @section Options to Control Diagnostic Messages Formatting
3775 @cindex options to control diagnostics formatting
3776 @cindex diagnostic messages
3777 @cindex message formatting
3778
3779 Traditionally, diagnostic messages have been formatted irrespective of
3780 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3781 options described below
3782 to control the formatting algorithm for diagnostic messages,
3783 e.g.@: how many characters per line, how often source location
3784 information should be reported. Note that some language front ends may not
3785 honor these options.
3786
3787 @table @gcctabopt
3788 @item -fmessage-length=@var{n}
3789 @opindex fmessage-length
3790 Try to format error messages so that they fit on lines of about
3791 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3792 done; each error message appears on a single line. This is the
3793 default for all front ends.
3794
3795 Note - this option also affects the display of the @samp{#error} and
3796 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3797 function/type/variable attribute. It does not however affect the
3798 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3799
3800 @item -fdiagnostics-show-location=once
3801 @opindex fdiagnostics-show-location
3802 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3803 reporter to emit source location information @emph{once}; that is, in
3804 case the message is too long to fit on a single physical line and has to
3805 be wrapped, the source location won't be emitted (as prefix) again,
3806 over and over, in subsequent continuation lines. This is the default
3807 behavior.
3808
3809 @item -fdiagnostics-show-location=every-line
3810 Only meaningful in line-wrapping mode. Instructs the diagnostic
3811 messages reporter to emit the same source location information (as
3812 prefix) for physical lines that result from the process of breaking
3813 a message which is too long to fit on a single line.
3814
3815 @item -fdiagnostics-color[=@var{WHEN}]
3816 @itemx -fno-diagnostics-color
3817 @opindex fdiagnostics-color
3818 @cindex highlight, color
3819 @vindex GCC_COLORS @r{environment variable}
3820 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3821 or @samp{auto}. The default depends on how the compiler has been configured,
3822 it can be any of the above @var{WHEN} options or also @samp{never}
3823 if @env{GCC_COLORS} environment variable isn't present in the environment,
3824 and @samp{auto} otherwise.
3825 @samp{auto} means to use color only when the standard error is a terminal.
3826 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3827 aliases for @option{-fdiagnostics-color=always} and
3828 @option{-fdiagnostics-color=never}, respectively.
3829
3830 The colors are defined by the environment variable @env{GCC_COLORS}.
3831 Its value is a colon-separated list of capabilities and Select Graphic
3832 Rendition (SGR) substrings. SGR commands are interpreted by the
3833 terminal or terminal emulator. (See the section in the documentation
3834 of your text terminal for permitted values and their meanings as
3835 character attributes.) These substring values are integers in decimal
3836 representation and can be concatenated with semicolons.
3837 Common values to concatenate include
3838 @samp{1} for bold,
3839 @samp{4} for underline,
3840 @samp{5} for blink,
3841 @samp{7} for inverse,
3842 @samp{39} for default foreground color,
3843 @samp{30} to @samp{37} for foreground colors,
3844 @samp{90} to @samp{97} for 16-color mode foreground colors,
3845 @samp{38;5;0} to @samp{38;5;255}
3846 for 88-color and 256-color modes foreground colors,
3847 @samp{49} for default background color,
3848 @samp{40} to @samp{47} for background colors,
3849 @samp{100} to @samp{107} for 16-color mode background colors,
3850 and @samp{48;5;0} to @samp{48;5;255}
3851 for 88-color and 256-color modes background colors.
3852
3853 The default @env{GCC_COLORS} is
3854 @smallexample
3855 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3856 quote=01:fixit-insert=32:fixit-delete=31:\
3857 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3858 type-diff=01;32
3859 @end smallexample
3860 @noindent
3861 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3862 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3863 @samp{01} is bold, and @samp{31} is red.
3864 Setting @env{GCC_COLORS} to the empty string disables colors.
3865 Supported capabilities are as follows.
3866
3867 @table @code
3868 @item error=
3869 @vindex error GCC_COLORS @r{capability}
3870 SGR substring for error: markers.
3871
3872 @item warning=
3873 @vindex warning GCC_COLORS @r{capability}
3874 SGR substring for warning: markers.
3875
3876 @item note=
3877 @vindex note GCC_COLORS @r{capability}
3878 SGR substring for note: markers.
3879
3880 @item range1=
3881 @vindex range1 GCC_COLORS @r{capability}
3882 SGR substring for first additional range.
3883
3884 @item range2=
3885 @vindex range2 GCC_COLORS @r{capability}
3886 SGR substring for second additional range.
3887
3888 @item locus=
3889 @vindex locus GCC_COLORS @r{capability}
3890 SGR substring for location information, @samp{file:line} or
3891 @samp{file:line:column} etc.
3892
3893 @item quote=
3894 @vindex quote GCC_COLORS @r{capability}
3895 SGR substring for information printed within quotes.
3896
3897 @item fixit-insert=
3898 @vindex fixit-insert GCC_COLORS @r{capability}
3899 SGR substring for fix-it hints suggesting text to
3900 be inserted or replaced.
3901
3902 @item fixit-delete=
3903 @vindex fixit-delete GCC_COLORS @r{capability}
3904 SGR substring for fix-it hints suggesting text to
3905 be deleted.
3906
3907 @item diff-filename=
3908 @vindex diff-filename GCC_COLORS @r{capability}
3909 SGR substring for filename headers within generated patches.
3910
3911 @item diff-hunk=
3912 @vindex diff-hunk GCC_COLORS @r{capability}
3913 SGR substring for the starts of hunks within generated patches.
3914
3915 @item diff-delete=
3916 @vindex diff-delete GCC_COLORS @r{capability}
3917 SGR substring for deleted lines within generated patches.
3918
3919 @item diff-insert=
3920 @vindex diff-insert GCC_COLORS @r{capability}
3921 SGR substring for inserted lines within generated patches.
3922
3923 @item type-diff=
3924 @vindex type-diff GCC_COLORS @r{capability}
3925 SGR substring for highlighting mismatching types within template
3926 arguments in the C++ frontend.
3927 @end table
3928
3929 @item -fno-diagnostics-show-option
3930 @opindex fno-diagnostics-show-option
3931 @opindex fdiagnostics-show-option
3932 By default, each diagnostic emitted includes text indicating the
3933 command-line option that directly controls the diagnostic (if such an
3934 option is known to the diagnostic machinery). Specifying the
3935 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3936
3937 @item -fno-diagnostics-show-caret
3938 @opindex fno-diagnostics-show-caret
3939 @opindex fdiagnostics-show-caret
3940 By default, each diagnostic emitted includes the original source line
3941 and a caret @samp{^} indicating the column. This option suppresses this
3942 information. The source line is truncated to @var{n} characters, if
3943 the @option{-fmessage-length=n} option is given. When the output is done
3944 to the terminal, the width is limited to the width given by the
3945 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3946
3947 @item -fno-diagnostics-show-labels
3948 @opindex fno-diagnostics-show-labels
3949 @opindex fdiagnostics-show-labels
3950 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3951 diagnostics can label ranges of source code with pertinent information, such
3952 as the types of expressions:
3953
3954 @smallexample
3955 printf ("foo %s bar", long_i + long_j);
3956 ~^ ~~~~~~~~~~~~~~~
3957 | |
3958 char * long int
3959 @end smallexample
3960
3961 This option suppresses the printing of these labels (in the example above,
3962 the vertical bars and the ``char *'' and ``long int'' text).
3963
3964 @item -fno-diagnostics-show-line-numbers
3965 @opindex fno-diagnostics-show-line-numbers
3966 @opindex fdiagnostics-show-line-numbers
3967 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3968 a left margin is printed, showing line numbers. This option suppresses this
3969 left margin.
3970
3971 @item -fdiagnostics-minimum-margin-width=@var{width}
3972 @opindex fdiagnostics-minimum-margin-width
3973 This option controls the minimum width of the left margin printed by
3974 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3975
3976 @item -fdiagnostics-parseable-fixits
3977 @opindex fdiagnostics-parseable-fixits
3978 Emit fix-it hints in a machine-parseable format, suitable for consumption
3979 by IDEs. For each fix-it, a line will be printed after the relevant
3980 diagnostic, starting with the string ``fix-it:''. For example:
3981
3982 @smallexample
3983 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3984 @end smallexample
3985
3986 The location is expressed as a half-open range, expressed as a count of
3987 bytes, starting at byte 1 for the initial column. In the above example,
3988 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3989 given string:
3990
3991 @smallexample
3992 00000000011111111112222222222
3993 12345678901234567890123456789
3994 gtk_widget_showall (dlg);
3995 ^^^^^^^^^^^^^^^^^^
3996 gtk_widget_show_all
3997 @end smallexample
3998
3999 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4000 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4001 (e.g. vertical tab as ``\013'').
4002
4003 An empty replacement string indicates that the given range is to be removed.
4004 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4005 be inserted at the given position.
4006
4007 @item -fdiagnostics-generate-patch
4008 @opindex fdiagnostics-generate-patch
4009 Print fix-it hints to stderr in unified diff format, after any diagnostics
4010 are printed. For example:
4011
4012 @smallexample
4013 --- test.c
4014 +++ test.c
4015 @@ -42,5 +42,5 @@
4016
4017 void show_cb(GtkDialog *dlg)
4018 @{
4019 - gtk_widget_showall(dlg);
4020 + gtk_widget_show_all(dlg);
4021 @}
4022
4023 @end smallexample
4024
4025 The diff may or may not be colorized, following the same rules
4026 as for diagnostics (see @option{-fdiagnostics-color}).
4027
4028 @item -fdiagnostics-show-template-tree
4029 @opindex fdiagnostics-show-template-tree
4030
4031 In the C++ frontend, when printing diagnostics showing mismatching
4032 template types, such as:
4033
4034 @smallexample
4035 could not convert 'std::map<int, std::vector<double> >()'
4036 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4037 @end smallexample
4038
4039 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4040 tree-like structure showing the common and differing parts of the types,
4041 such as:
4042
4043 @smallexample
4044 map<
4045 [...],
4046 vector<
4047 [double != float]>>
4048 @end smallexample
4049
4050 The parts that differ are highlighted with color (``double'' and
4051 ``float'' in this case).
4052
4053 @item -fno-elide-type
4054 @opindex fno-elide-type
4055 @opindex felide-type
4056 By default when the C++ frontend prints diagnostics showing mismatching
4057 template types, common parts of the types are printed as ``[...]'' to
4058 simplify the error message. For example:
4059
4060 @smallexample
4061 could not convert 'std::map<int, std::vector<double> >()'
4062 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4063 @end smallexample
4064
4065 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4066 This flag also affects the output of the
4067 @option{-fdiagnostics-show-template-tree} flag.
4068
4069 @item -fno-show-column
4070 @opindex fno-show-column
4071 @opindex fshow-column
4072 Do not print column numbers in diagnostics. This may be necessary if
4073 diagnostics are being scanned by a program that does not understand the
4074 column numbers, such as @command{dejagnu}.
4075
4076 @item -fdiagnostics-format=@var{FORMAT}
4077 @opindex fdiagnostics-format
4078 Select a different format for printing diagnostics.
4079 @var{FORMAT} is @samp{text} or @samp{json}.
4080 The default is @samp{text}.
4081
4082 The @samp{json} format consists of a top-level JSON array containing JSON
4083 objects representing the diagnostics.
4084
4085 The JSON is emitted as one line, without formatting; the examples below
4086 have been formatted for clarity.
4087
4088 Diagnostics can have child diagnostics. For example, this error and note:
4089
4090 @smallexample
4091 misleading-indentation.c:15:3: warning: this 'if' clause does not
4092 guard... [-Wmisleading-indentation]
4093 15 | if (flag)
4094 | ^~
4095 misleading-indentation.c:17:5: note: ...this statement, but the latter
4096 is misleadingly indented as if it were guarded by the 'if'
4097 17 | y = 2;
4098 | ^
4099 @end smallexample
4100
4101 @noindent
4102 might be printed in JSON form (after formatting) like this:
4103
4104 @smallexample
4105 [
4106 @{
4107 "kind": "warning",
4108 "locations": [
4109 @{
4110 "caret": @{
4111 "column": 3,
4112 "file": "misleading-indentation.c",
4113 "line": 15
4114 @},
4115 "finish": @{
4116 "column": 4,
4117 "file": "misleading-indentation.c",
4118 "line": 15
4119 @}
4120 @}
4121 ],
4122 "message": "this \u2018if\u2019 clause does not guard...",
4123 "option": "-Wmisleading-indentation",
4124 "children": [
4125 @{
4126 "kind": "note",
4127 "locations": [
4128 @{
4129 "caret": @{
4130 "column": 5,
4131 "file": "misleading-indentation.c",
4132 "line": 17
4133 @}
4134 @}
4135 ],
4136 "message": "...this statement, but the latter is @dots{}"
4137 @}
4138 ]
4139 @},
4140 @dots{}
4141 ]
4142 @end smallexample
4143
4144 @noindent
4145 where the @code{note} is a child of the @code{warning}.
4146
4147 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4148 an @code{option} key describing the command-line option controlling the
4149 warning.
4150
4151 A diagnostic can contain zero or more locations. Each location has up
4152 to three positions within it: a @code{caret} position and optional
4153 @code{start} and @code{finish} positions. A location can also have
4154 an optional @code{label} string. For example, this error:
4155
4156 @smallexample
4157 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4158 'struct s'@} and 'T' @{aka 'struct t'@})
4159 64 | return callee_4a () + callee_4b ();
4160 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4161 | | |
4162 | | T @{aka struct t@}
4163 | S @{aka struct s@}
4164 @end smallexample
4165
4166 @noindent
4167 has three locations. Its primary location is at the ``+'' token at column
4168 23. It has two secondary locations, describing the left and right-hand sides
4169 of the expression, which have labels. It might be printed in JSON form as:
4170
4171 @smallexample
4172 @{
4173 "children": [],
4174 "kind": "error",
4175 "locations": [
4176 @{
4177 "caret": @{
4178 "column": 23, "file": "bad-binary-ops.c", "line": 64
4179 @}
4180 @},
4181 @{
4182 "caret": @{
4183 "column": 10, "file": "bad-binary-ops.c", "line": 64
4184 @},
4185 "finish": @{
4186 "column": 21, "file": "bad-binary-ops.c", "line": 64
4187 @},
4188 "label": "S @{aka struct s@}"
4189 @},
4190 @{
4191 "caret": @{
4192 "column": 25, "file": "bad-binary-ops.c", "line": 64
4193 @},
4194 "finish": @{
4195 "column": 36, "file": "bad-binary-ops.c", "line": 64
4196 @},
4197 "label": "T @{aka struct t@}"
4198 @}
4199 ],
4200 "message": "invalid operands to binary + @dots{}"
4201 @}
4202 @end smallexample
4203
4204 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4205 consisting of half-open intervals, similar to the output of
4206 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4207 with a replacement fix-it hint:
4208
4209 @smallexample
4210 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4211 mean 'color'?
4212 8 | return ptr->colour;
4213 | ^~~~~~
4214 | color
4215 @end smallexample
4216
4217 @noindent
4218 might be printed in JSON form as:
4219
4220 @smallexample
4221 @{
4222 "children": [],
4223 "fixits": [
4224 @{
4225 "next": @{
4226 "column": 21,
4227 "file": "demo.c",
4228 "line": 8
4229 @},
4230 "start": @{
4231 "column": 15,
4232 "file": "demo.c",
4233 "line": 8
4234 @},
4235 "string": "color"
4236 @}
4237 ],
4238 "kind": "error",
4239 "locations": [
4240 @{
4241 "caret": @{
4242 "column": 15,
4243 "file": "demo.c",
4244 "line": 8
4245 @},
4246 "finish": @{
4247 "column": 20,
4248 "file": "demo.c",
4249 "line": 8
4250 @}
4251 @}
4252 ],
4253 "message": "\u2018struct s\u2019 has no member named @dots{}"
4254 @}
4255 @end smallexample
4256
4257 @noindent
4258 where the fix-it hint suggests replacing the text from @code{start} up
4259 to but not including @code{next} with @code{string}'s value. Deletions
4260 are expressed via an empty value for @code{string}, insertions by
4261 having @code{start} equal @code{next}.
4262
4263 @end table
4264
4265 @node Warning Options
4266 @section Options to Request or Suppress Warnings
4267 @cindex options to control warnings
4268 @cindex warning messages
4269 @cindex messages, warning
4270 @cindex suppressing warnings
4271
4272 Warnings are diagnostic messages that report constructions that
4273 are not inherently erroneous but that are risky or suggest there
4274 may have been an error.
4275
4276 The following language-independent options do not enable specific
4277 warnings but control the kinds of diagnostics produced by GCC@.
4278
4279 @table @gcctabopt
4280 @cindex syntax checking
4281 @item -fsyntax-only
4282 @opindex fsyntax-only
4283 Check the code for syntax errors, but don't do anything beyond that.
4284
4285 @item -fmax-errors=@var{n}
4286 @opindex fmax-errors
4287 Limits the maximum number of error messages to @var{n}, at which point
4288 GCC bails out rather than attempting to continue processing the source
4289 code. If @var{n} is 0 (the default), there is no limit on the number
4290 of error messages produced. If @option{-Wfatal-errors} is also
4291 specified, then @option{-Wfatal-errors} takes precedence over this
4292 option.
4293
4294 @item -w
4295 @opindex w
4296 Inhibit all warning messages.
4297
4298 @item -Werror
4299 @opindex Werror
4300 @opindex Wno-error
4301 Make all warnings into errors.
4302
4303 @item -Werror=
4304 @opindex Werror=
4305 @opindex Wno-error=
4306 Make the specified warning into an error. The specifier for a warning
4307 is appended; for example @option{-Werror=switch} turns the warnings
4308 controlled by @option{-Wswitch} into errors. This switch takes a
4309 negative form, to be used to negate @option{-Werror} for specific
4310 warnings; for example @option{-Wno-error=switch} makes
4311 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4312 is in effect.
4313
4314 The warning message for each controllable warning includes the
4315 option that controls the warning. That option can then be used with
4316 @option{-Werror=} and @option{-Wno-error=} as described above.
4317 (Printing of the option in the warning message can be disabled using the
4318 @option{-fno-diagnostics-show-option} flag.)
4319
4320 Note that specifying @option{-Werror=}@var{foo} automatically implies
4321 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4322 imply anything.
4323
4324 @item -Wfatal-errors
4325 @opindex Wfatal-errors
4326 @opindex Wno-fatal-errors
4327 This option causes the compiler to abort compilation on the first error
4328 occurred rather than trying to keep going and printing further error
4329 messages.
4330
4331 @end table
4332
4333 You can request many specific warnings with options beginning with
4334 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4335 implicit declarations. Each of these specific warning options also
4336 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4337 example, @option{-Wno-implicit}. This manual lists only one of the
4338 two forms, whichever is not the default. For further
4339 language-specific options also refer to @ref{C++ Dialect Options} and
4340 @ref{Objective-C and Objective-C++ Dialect Options}.
4341
4342 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4343 options, such as @option{-Wunused}, which may turn on further options,
4344 such as @option{-Wunused-value}. The combined effect of positive and
4345 negative forms is that more specific options have priority over less
4346 specific ones, independently of their position in the command-line. For
4347 options of the same specificity, the last one takes effect. Options
4348 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4349 as if they appeared at the end of the command-line.
4350
4351 When an unrecognized warning option is requested (e.g.,
4352 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4353 that the option is not recognized. However, if the @option{-Wno-} form
4354 is used, the behavior is slightly different: no diagnostic is
4355 produced for @option{-Wno-unknown-warning} unless other diagnostics
4356 are being produced. This allows the use of new @option{-Wno-} options
4357 with old compilers, but if something goes wrong, the compiler
4358 warns that an unrecognized option is present.
4359
4360 @table @gcctabopt
4361 @item -Wpedantic
4362 @itemx -pedantic
4363 @opindex pedantic
4364 @opindex Wpedantic
4365 @opindex Wno-pedantic
4366 Issue all the warnings demanded by strict ISO C and ISO C++;
4367 reject all programs that use forbidden extensions, and some other
4368 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4369 version of the ISO C standard specified by any @option{-std} option used.
4370
4371 Valid ISO C and ISO C++ programs should compile properly with or without
4372 this option (though a rare few require @option{-ansi} or a
4373 @option{-std} option specifying the required version of ISO C)@. However,
4374 without this option, certain GNU extensions and traditional C and C++
4375 features are supported as well. With this option, they are rejected.
4376
4377 @option{-Wpedantic} does not cause warning messages for use of the
4378 alternate keywords whose names begin and end with @samp{__}. This alternate
4379 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4380 i.e. @samp{__intN__}.
4381 Pedantic warnings are also disabled in the expression that follows
4382 @code{__extension__}. However, only system header files should use
4383 these escape routes; application programs should avoid them.
4384 @xref{Alternate Keywords}.
4385
4386 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4387 C conformance. They soon find that it does not do quite what they want:
4388 it finds some non-ISO practices, but not all---only those for which
4389 ISO C @emph{requires} a diagnostic, and some others for which
4390 diagnostics have been added.
4391
4392 A feature to report any failure to conform to ISO C might be useful in
4393 some instances, but would require considerable additional work and would
4394 be quite different from @option{-Wpedantic}. We don't have plans to
4395 support such a feature in the near future.
4396
4397 Where the standard specified with @option{-std} represents a GNU
4398 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4399 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4400 extended dialect is based. Warnings from @option{-Wpedantic} are given
4401 where they are required by the base standard. (It does not make sense
4402 for such warnings to be given only for features not in the specified GNU
4403 C dialect, since by definition the GNU dialects of C include all
4404 features the compiler supports with the given option, and there would be
4405 nothing to warn about.)
4406
4407 @item -pedantic-errors
4408 @opindex pedantic-errors
4409 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4410 requires a diagnostic, in some cases where there is undefined behavior
4411 at compile-time and in some other cases that do not prevent compilation
4412 of programs that are valid according to the standard. This is not
4413 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4414 by this option and not enabled by the latter and vice versa.
4415
4416 @item -Wall
4417 @opindex Wall
4418 @opindex Wno-all
4419 This enables all the warnings about constructions that some users
4420 consider questionable, and that are easy to avoid (or modify to
4421 prevent the warning), even in conjunction with macros. This also
4422 enables some language-specific warnings described in @ref{C++ Dialect
4423 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4424
4425 @option{-Wall} turns on the following warning flags:
4426
4427 @gccoptlist{-Waddress @gol
4428 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4429 -Wbool-compare @gol
4430 -Wbool-operation @gol
4431 -Wc++11-compat -Wc++14-compat @gol
4432 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4433 -Wchar-subscripts @gol
4434 -Wcomment @gol
4435 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4436 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4437 -Wformat @gol
4438 -Wint-in-bool-context @gol
4439 -Wimplicit @r{(C and Objective-C only)} @gol
4440 -Wimplicit-int @r{(C and Objective-C only)} @gol
4441 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4442 -Winit-self @r{(only for C++)} @gol
4443 -Wlogical-not-parentheses @gol
4444 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4445 -Wmaybe-uninitialized @gol
4446 -Wmemset-elt-size @gol
4447 -Wmemset-transposed-args @gol
4448 -Wmisleading-indentation @r{(only for C/C++)} @gol
4449 -Wmissing-attributes @gol
4450 -Wmissing-braces @r{(only for C/ObjC)} @gol
4451 -Wmultistatement-macros @gol
4452 -Wnarrowing @r{(only for C++)} @gol
4453 -Wnonnull @gol
4454 -Wnonnull-compare @gol
4455 -Wopenmp-simd @gol
4456 -Wparentheses @gol
4457 -Wpessimizing-move @r{(only for C++)} @gol
4458 -Wpointer-sign @gol
4459 -Wreorder @gol
4460 -Wrestrict @gol
4461 -Wreturn-type @gol
4462 -Wsequence-point @gol
4463 -Wsign-compare @r{(only in C++)} @gol
4464 -Wsizeof-pointer-div @gol
4465 -Wsizeof-pointer-memaccess @gol
4466 -Wstrict-aliasing @gol
4467 -Wstrict-overflow=1 @gol
4468 -Wswitch @gol
4469 -Wtautological-compare @gol
4470 -Wtrigraphs @gol
4471 -Wuninitialized @gol
4472 -Wunknown-pragmas @gol
4473 -Wunused-function @gol
4474 -Wunused-label @gol
4475 -Wunused-value @gol
4476 -Wunused-variable @gol
4477 -Wvolatile-register-var}
4478
4479 Note that some warning flags are not implied by @option{-Wall}. Some of
4480 them warn about constructions that users generally do not consider
4481 questionable, but which occasionally you might wish to check for;
4482 others warn about constructions that are necessary or hard to avoid in
4483 some cases, and there is no simple way to modify the code to suppress
4484 the warning. Some of them are enabled by @option{-Wextra} but many of
4485 them must be enabled individually.
4486
4487 @item -Wextra
4488 @opindex W
4489 @opindex Wextra
4490 @opindex Wno-extra
4491 This enables some extra warning flags that are not enabled by
4492 @option{-Wall}. (This option used to be called @option{-W}. The older
4493 name is still supported, but the newer name is more descriptive.)
4494
4495 @gccoptlist{-Wclobbered @gol
4496 -Wcast-function-type @gol
4497 -Wdeprecated-copy @r{(C++ only)} @gol
4498 -Wempty-body @gol
4499 -Wignored-qualifiers @gol
4500 -Wimplicit-fallthrough=3 @gol
4501 -Wmissing-field-initializers @gol
4502 -Wmissing-parameter-type @r{(C only)} @gol
4503 -Wold-style-declaration @r{(C only)} @gol
4504 -Woverride-init @gol
4505 -Wsign-compare @r{(C only)} @gol
4506 -Wredundant-move @r{(only for C++)} @gol
4507 -Wtype-limits @gol
4508 -Wuninitialized @gol
4509 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4510 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4511 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4512
4513
4514 The option @option{-Wextra} also prints warning messages for the
4515 following cases:
4516
4517 @itemize @bullet
4518
4519 @item
4520 A pointer is compared against integer zero with @code{<}, @code{<=},
4521 @code{>}, or @code{>=}.
4522
4523 @item
4524 (C++ only) An enumerator and a non-enumerator both appear in a
4525 conditional expression.
4526
4527 @item
4528 (C++ only) Ambiguous virtual bases.
4529
4530 @item
4531 (C++ only) Subscripting an array that has been declared @code{register}.
4532
4533 @item
4534 (C++ only) Taking the address of a variable that has been declared
4535 @code{register}.
4536
4537 @item
4538 (C++ only) A base class is not initialized in the copy constructor
4539 of a derived class.
4540
4541 @end itemize
4542
4543 @item -Wchar-subscripts
4544 @opindex Wchar-subscripts
4545 @opindex Wno-char-subscripts
4546 Warn if an array subscript has type @code{char}. This is a common cause
4547 of error, as programmers often forget that this type is signed on some
4548 machines.
4549 This warning is enabled by @option{-Wall}.
4550
4551 @item -Wno-coverage-mismatch
4552 @opindex Wno-coverage-mismatch
4553 @opindex Wcoverage-mismatch
4554 Warn if feedback profiles do not match when using the
4555 @option{-fprofile-use} option.
4556 If a source file is changed between compiling with @option{-fprofile-generate}
4557 and with @option{-fprofile-use}, the files with the profile feedback can fail
4558 to match the source file and GCC cannot use the profile feedback
4559 information. By default, this warning is enabled and is treated as an
4560 error. @option{-Wno-coverage-mismatch} can be used to disable the
4561 warning or @option{-Wno-error=coverage-mismatch} can be used to
4562 disable the error. Disabling the error for this warning can result in
4563 poorly optimized code and is useful only in the
4564 case of very minor changes such as bug fixes to an existing code-base.
4565 Completely disabling the warning is not recommended.
4566
4567 @item -Wno-cpp
4568 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4569
4570 Suppress warning messages emitted by @code{#warning} directives.
4571
4572 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4573 @opindex Wdouble-promotion
4574 @opindex Wno-double-promotion
4575 Give a warning when a value of type @code{float} is implicitly
4576 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4577 floating-point unit implement @code{float} in hardware, but emulate
4578 @code{double} in software. On such a machine, doing computations
4579 using @code{double} values is much more expensive because of the
4580 overhead required for software emulation.
4581
4582 It is easy to accidentally do computations with @code{double} because
4583 floating-point literals are implicitly of type @code{double}. For
4584 example, in:
4585 @smallexample
4586 @group
4587 float area(float radius)
4588 @{
4589 return 3.14159 * radius * radius;
4590 @}
4591 @end group
4592 @end smallexample
4593 the compiler performs the entire computation with @code{double}
4594 because the floating-point literal is a @code{double}.
4595
4596 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4597 @opindex Wduplicate-decl-specifier
4598 @opindex Wno-duplicate-decl-specifier
4599 Warn if a declaration has duplicate @code{const}, @code{volatile},
4600 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4601 @option{-Wall}.
4602
4603 @item -Wformat
4604 @itemx -Wformat=@var{n}
4605 @opindex Wformat
4606 @opindex Wno-format
4607 @opindex ffreestanding
4608 @opindex fno-builtin
4609 @opindex Wformat=
4610 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4611 the arguments supplied have types appropriate to the format string
4612 specified, and that the conversions specified in the format string make
4613 sense. This includes standard functions, and others specified by format
4614 attributes (@pxref{Function Attributes}), in the @code{printf},
4615 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4616 not in the C standard) families (or other target-specific families).
4617 Which functions are checked without format attributes having been
4618 specified depends on the standard version selected, and such checks of
4619 functions without the attribute specified are disabled by
4620 @option{-ffreestanding} or @option{-fno-builtin}.
4621
4622 The formats are checked against the format features supported by GNU
4623 libc version 2.2. These include all ISO C90 and C99 features, as well
4624 as features from the Single Unix Specification and some BSD and GNU
4625 extensions. Other library implementations may not support all these
4626 features; GCC does not support warning about features that go beyond a
4627 particular library's limitations. However, if @option{-Wpedantic} is used
4628 with @option{-Wformat}, warnings are given about format features not
4629 in the selected standard version (but not for @code{strfmon} formats,
4630 since those are not in any version of the C standard). @xref{C Dialect
4631 Options,,Options Controlling C Dialect}.
4632
4633 @table @gcctabopt
4634 @item -Wformat=1
4635 @itemx -Wformat
4636 @opindex Wformat
4637 @opindex Wformat=1
4638 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4639 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4640 @option{-Wformat} also checks for null format arguments for several
4641 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4642 aspects of this level of format checking can be disabled by the
4643 options: @option{-Wno-format-contains-nul},
4644 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4645 @option{-Wformat} is enabled by @option{-Wall}.
4646
4647 @item -Wno-format-contains-nul
4648 @opindex Wno-format-contains-nul
4649 @opindex Wformat-contains-nul
4650 If @option{-Wformat} is specified, do not warn about format strings that
4651 contain NUL bytes.
4652
4653 @item -Wno-format-extra-args
4654 @opindex Wno-format-extra-args
4655 @opindex Wformat-extra-args
4656 If @option{-Wformat} is specified, do not warn about excess arguments to a
4657 @code{printf} or @code{scanf} format function. The C standard specifies
4658 that such arguments are ignored.
4659
4660 Where the unused arguments lie between used arguments that are
4661 specified with @samp{$} operand number specifications, normally
4662 warnings are still given, since the implementation could not know what
4663 type to pass to @code{va_arg} to skip the unused arguments. However,
4664 in the case of @code{scanf} formats, this option suppresses the
4665 warning if the unused arguments are all pointers, since the Single
4666 Unix Specification says that such unused arguments are allowed.
4667
4668 @item -Wformat-overflow
4669 @itemx -Wformat-overflow=@var{level}
4670 @opindex Wformat-overflow
4671 @opindex Wno-format-overflow
4672 Warn about calls to formatted input/output functions such as @code{sprintf}
4673 and @code{vsprintf} that might overflow the destination buffer. When the
4674 exact number of bytes written by a format directive cannot be determined
4675 at compile-time it is estimated based on heuristics that depend on the
4676 @var{level} argument and on optimization. While enabling optimization
4677 will in most cases improve the accuracy of the warning, it may also
4678 result in false positives.
4679
4680 @table @gcctabopt
4681 @item -Wformat-overflow
4682 @itemx -Wformat-overflow=1
4683 @opindex Wformat-overflow
4684 @opindex Wno-format-overflow
4685 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4686 employs a conservative approach that warns only about calls that most
4687 likely overflow the buffer. At this level, numeric arguments to format
4688 directives with unknown values are assumed to have the value of one, and
4689 strings of unknown length to be empty. Numeric arguments that are known
4690 to be bounded to a subrange of their type, or string arguments whose output
4691 is bounded either by their directive's precision or by a finite set of
4692 string literals, are assumed to take on the value within the range that
4693 results in the most bytes on output. For example, the call to @code{sprintf}
4694 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4695 the terminating NUL character (@code{'\0'}) appended by the function
4696 to the destination buffer will be written past its end. Increasing
4697 the size of the buffer by a single byte is sufficient to avoid the
4698 warning, though it may not be sufficient to avoid the overflow.
4699
4700 @smallexample
4701 void f (int a, int b)
4702 @{
4703 char buf [13];
4704 sprintf (buf, "a = %i, b = %i\n", a, b);
4705 @}
4706 @end smallexample
4707
4708 @item -Wformat-overflow=2
4709 Level @var{2} warns also about calls that might overflow the destination
4710 buffer given an argument of sufficient length or magnitude. At level
4711 @var{2}, unknown numeric arguments are assumed to have the minimum
4712 representable value for signed types with a precision greater than 1, and
4713 the maximum representable value otherwise. Unknown string arguments whose
4714 length cannot be assumed to be bounded either by the directive's precision,
4715 or by a finite set of string literals they may evaluate to, or the character
4716 array they may point to, are assumed to be 1 character long.
4717
4718 At level @var{2}, the call in the example above is again diagnosed, but
4719 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4720 @code{%i} directive will write some of its digits beyond the end of
4721 the destination buffer. To make the call safe regardless of the values
4722 of the two variables, the size of the destination buffer must be increased
4723 to at least 34 bytes. GCC includes the minimum size of the buffer in
4724 an informational note following the warning.
4725
4726 An alternative to increasing the size of the destination buffer is to
4727 constrain the range of formatted values. The maximum length of string
4728 arguments can be bounded by specifying the precision in the format
4729 directive. When numeric arguments of format directives can be assumed
4730 to be bounded by less than the precision of their type, choosing
4731 an appropriate length modifier to the format specifier will reduce
4732 the required buffer size. For example, if @var{a} and @var{b} in the
4733 example above can be assumed to be within the precision of
4734 the @code{short int} type then using either the @code{%hi} format
4735 directive or casting the argument to @code{short} reduces the maximum
4736 required size of the buffer to 24 bytes.
4737
4738 @smallexample
4739 void f (int a, int b)
4740 @{
4741 char buf [23];
4742 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4743 @}
4744 @end smallexample
4745 @end table
4746
4747 @item -Wno-format-zero-length
4748 @opindex Wno-format-zero-length
4749 @opindex Wformat-zero-length
4750 If @option{-Wformat} is specified, do not warn about zero-length formats.
4751 The C standard specifies that zero-length formats are allowed.
4752
4753
4754 @item -Wformat=2
4755 @opindex Wformat=2
4756 Enable @option{-Wformat} plus additional format checks. Currently
4757 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4758 -Wformat-y2k}.
4759
4760 @item -Wformat-nonliteral
4761 @opindex Wformat-nonliteral
4762 @opindex Wno-format-nonliteral
4763 If @option{-Wformat} is specified, also warn if the format string is not a
4764 string literal and so cannot be checked, unless the format function
4765 takes its format arguments as a @code{va_list}.
4766
4767 @item -Wformat-security
4768 @opindex Wformat-security
4769 @opindex Wno-format-security
4770 If @option{-Wformat} is specified, also warn about uses of format
4771 functions that represent possible security problems. At present, this
4772 warns about calls to @code{printf} and @code{scanf} functions where the
4773 format string is not a string literal and there are no format arguments,
4774 as in @code{printf (foo);}. This may be a security hole if the format
4775 string came from untrusted input and contains @samp{%n}. (This is
4776 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4777 in future warnings may be added to @option{-Wformat-security} that are not
4778 included in @option{-Wformat-nonliteral}.)
4779
4780 @item -Wformat-signedness
4781 @opindex Wformat-signedness
4782 @opindex Wno-format-signedness
4783 If @option{-Wformat} is specified, also warn if the format string
4784 requires an unsigned argument and the argument is signed and vice versa.
4785
4786 @item -Wformat-truncation
4787 @itemx -Wformat-truncation=@var{level}
4788 @opindex Wformat-truncation
4789 @opindex Wno-format-truncation
4790 Warn about calls to formatted input/output functions such as @code{snprintf}
4791 and @code{vsnprintf} that might result in output truncation. When the exact
4792 number of bytes written by a format directive cannot be determined at
4793 compile-time it is estimated based on heuristics that depend on
4794 the @var{level} argument and on optimization. While enabling optimization
4795 will in most cases improve the accuracy of the warning, it may also result
4796 in false positives. Except as noted otherwise, the option uses the same
4797 logic @option{-Wformat-overflow}.
4798
4799 @table @gcctabopt
4800 @item -Wformat-truncation
4801 @itemx -Wformat-truncation=1
4802 @opindex Wformat-truncation
4803 @opindex Wno-format-truncation
4804 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4805 employs a conservative approach that warns only about calls to bounded
4806 functions whose return value is unused and that will most likely result
4807 in output truncation.
4808
4809 @item -Wformat-truncation=2
4810 Level @var{2} warns also about calls to bounded functions whose return
4811 value is used and that might result in truncation given an argument of
4812 sufficient length or magnitude.
4813 @end table
4814
4815 @item -Wformat-y2k
4816 @opindex Wformat-y2k
4817 @opindex Wno-format-y2k
4818 If @option{-Wformat} is specified, also warn about @code{strftime}
4819 formats that may yield only a two-digit year.
4820 @end table
4821
4822 @item -Wnonnull
4823 @opindex Wnonnull
4824 @opindex Wno-nonnull
4825 Warn about passing a null pointer for arguments marked as
4826 requiring a non-null value by the @code{nonnull} function attribute.
4827
4828 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4829 can be disabled with the @option{-Wno-nonnull} option.
4830
4831 @item -Wnonnull-compare
4832 @opindex Wnonnull-compare
4833 @opindex Wno-nonnull-compare
4834 Warn when comparing an argument marked with the @code{nonnull}
4835 function attribute against null inside the function.
4836
4837 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4838 can be disabled with the @option{-Wno-nonnull-compare} option.
4839
4840 @item -Wnull-dereference
4841 @opindex Wnull-dereference
4842 @opindex Wno-null-dereference
4843 Warn if the compiler detects paths that trigger erroneous or
4844 undefined behavior due to dereferencing a null pointer. This option
4845 is only active when @option{-fdelete-null-pointer-checks} is active,
4846 which is enabled by optimizations in most targets. The precision of
4847 the warnings depends on the optimization options used.
4848
4849 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4850 @opindex Winaccessible-base
4851 @opindex Wno-inaccessible-base
4852 Warn when a base class is inaccessible in a class derived from it due to
4853 ambiguity. The warning is enabled by default. Note the warning for virtual
4854 bases is enabled by the @option{-Wextra} option.
4855 @smallexample
4856 @group
4857 struct A @{ int a; @};
4858
4859 struct B : A @{ @};
4860
4861 struct C : B, A @{ @};
4862 @end group
4863 @end smallexample
4864
4865 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4866 @opindex Winit-self
4867 @opindex Wno-init-self
4868 Warn about uninitialized variables that are initialized with themselves.
4869 Note this option can only be used with the @option{-Wuninitialized} option.
4870
4871 For example, GCC warns about @code{i} being uninitialized in the
4872 following snippet only when @option{-Winit-self} has been specified:
4873 @smallexample
4874 @group
4875 int f()
4876 @{
4877 int i = i;
4878 return i;
4879 @}
4880 @end group
4881 @end smallexample
4882
4883 This warning is enabled by @option{-Wall} in C++.
4884
4885 @item -Wimplicit-int @r{(C and Objective-C only)}
4886 @opindex Wimplicit-int
4887 @opindex Wno-implicit-int
4888 Warn when a declaration does not specify a type.
4889 This warning is enabled by @option{-Wall}.
4890
4891 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4892 @opindex Wimplicit-function-declaration
4893 @opindex Wno-implicit-function-declaration
4894 Give a warning whenever a function is used before being declared. In
4895 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4896 enabled by default and it is made into an error by
4897 @option{-pedantic-errors}. This warning is also enabled by
4898 @option{-Wall}.
4899
4900 @item -Wimplicit @r{(C and Objective-C only)}
4901 @opindex Wimplicit
4902 @opindex Wno-implicit
4903 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4904 This warning is enabled by @option{-Wall}.
4905
4906 @item -Wimplicit-fallthrough
4907 @opindex Wimplicit-fallthrough
4908 @opindex Wno-implicit-fallthrough
4909 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4910 and @option{-Wno-implicit-fallthrough} is the same as
4911 @option{-Wimplicit-fallthrough=0}.
4912
4913 @item -Wimplicit-fallthrough=@var{n}
4914 @opindex Wimplicit-fallthrough=
4915 Warn when a switch case falls through. For example:
4916
4917 @smallexample
4918 @group
4919 switch (cond)
4920 @{
4921 case 1:
4922 a = 1;
4923 break;
4924 case 2:
4925 a = 2;
4926 case 3:
4927 a = 3;
4928 break;
4929 @}
4930 @end group
4931 @end smallexample
4932
4933 This warning does not warn when the last statement of a case cannot
4934 fall through, e.g. when there is a return statement or a call to function
4935 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4936 also takes into account control flow statements, such as ifs, and only
4937 warns when appropriate. E.g.@:
4938
4939 @smallexample
4940 @group
4941 switch (cond)
4942 @{
4943 case 1:
4944 if (i > 3) @{
4945 bar (5);
4946 break;
4947 @} else if (i < 1) @{
4948 bar (0);
4949 @} else
4950 return;
4951 default:
4952 @dots{}
4953 @}
4954 @end group
4955 @end smallexample
4956
4957 Since there are occasions where a switch case fall through is desirable,
4958 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4959 to be used along with a null statement to suppress this warning that
4960 would normally occur:
4961
4962 @smallexample
4963 @group
4964 switch (cond)
4965 @{
4966 case 1:
4967 bar (0);
4968 __attribute__ ((fallthrough));
4969 default:
4970 @dots{}
4971 @}
4972 @end group
4973 @end smallexample
4974
4975 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4976 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4977 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4978 Instead of these attributes, it is also possible to add a fallthrough comment
4979 to silence the warning. The whole body of the C or C++ style comment should
4980 match the given regular expressions listed below. The option argument @var{n}
4981 specifies what kind of comments are accepted:
4982
4983 @itemize @bullet
4984
4985 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4986
4987 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4988 expression, any comment is used as fallthrough comment.
4989
4990 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4991 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4992
4993 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4994 following regular expressions:
4995
4996 @itemize @bullet
4997
4998 @item @code{-fallthrough}
4999
5000 @item @code{@@fallthrough@@}
5001
5002 @item @code{lint -fallthrough[ \t]*}
5003
5004 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5005
5006 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5007
5008 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5009
5010 @end itemize
5011
5012 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5013 following regular expressions:
5014
5015 @itemize @bullet
5016
5017 @item @code{-fallthrough}
5018
5019 @item @code{@@fallthrough@@}
5020
5021 @item @code{lint -fallthrough[ \t]*}
5022
5023 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5024
5025 @end itemize
5026
5027 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5028 fallthrough comments, only attributes disable the warning.
5029
5030 @end itemize
5031
5032 The comment needs to be followed after optional whitespace and other comments
5033 by @code{case} or @code{default} keywords or by a user label that precedes some
5034 @code{case} or @code{default} label.
5035
5036 @smallexample
5037 @group
5038 switch (cond)
5039 @{
5040 case 1:
5041 bar (0);
5042 /* FALLTHRU */
5043 default:
5044 @dots{}
5045 @}
5046 @end group
5047 @end smallexample
5048
5049 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5050
5051 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5052 @opindex Wif-not-aligned
5053 @opindex Wno-if-not-aligned
5054 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5055 should be issued. This is enabled by default.
5056 Use @option{-Wno-if-not-aligned} to disable it.
5057
5058 @item -Wignored-qualifiers @r{(C and C++ only)}
5059 @opindex Wignored-qualifiers
5060 @opindex Wno-ignored-qualifiers
5061 Warn if the return type of a function has a type qualifier
5062 such as @code{const}. For ISO C such a type qualifier has no effect,
5063 since the value returned by a function is not an lvalue.
5064 For C++, the warning is only emitted for scalar types or @code{void}.
5065 ISO C prohibits qualified @code{void} return types on function
5066 definitions, so such return types always receive a warning
5067 even without this option.
5068
5069 This warning is also enabled by @option{-Wextra}.
5070
5071 @item -Wignored-attributes @r{(C and C++ only)}
5072 @opindex Wignored-attributes
5073 @opindex Wno-ignored-attributes
5074 Warn when an attribute is ignored. This is different from the
5075 @option{-Wattributes} option in that it warns whenever the compiler decides
5076 to drop an attribute, not that the attribute is either unknown, used in a
5077 wrong place, etc. This warning is enabled by default.
5078
5079 @item -Wmain
5080 @opindex Wmain
5081 @opindex Wno-main
5082 Warn if the type of @code{main} is suspicious. @code{main} should be
5083 a function with external linkage, returning int, taking either zero
5084 arguments, two, or three arguments of appropriate types. This warning
5085 is enabled by default in C++ and is enabled by either @option{-Wall}
5086 or @option{-Wpedantic}.
5087
5088 @item -Wmisleading-indentation @r{(C and C++ only)}
5089 @opindex Wmisleading-indentation
5090 @opindex Wno-misleading-indentation
5091 Warn when the indentation of the code does not reflect the block structure.
5092 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5093 @code{for} clauses with a guarded statement that does not use braces,
5094 followed by an unguarded statement with the same indentation.
5095
5096 In the following example, the call to ``bar'' is misleadingly indented as
5097 if it were guarded by the ``if'' conditional.
5098
5099 @smallexample
5100 if (some_condition ())
5101 foo ();
5102 bar (); /* Gotcha: this is not guarded by the "if". */
5103 @end smallexample
5104
5105 In the case of mixed tabs and spaces, the warning uses the
5106 @option{-ftabstop=} option to determine if the statements line up
5107 (defaulting to 8).
5108
5109 The warning is not issued for code involving multiline preprocessor logic
5110 such as the following example.
5111
5112 @smallexample
5113 if (flagA)
5114 foo (0);
5115 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5116 if (flagB)
5117 #endif
5118 foo (1);
5119 @end smallexample
5120
5121 The warning is not issued after a @code{#line} directive, since this
5122 typically indicates autogenerated code, and no assumptions can be made
5123 about the layout of the file that the directive references.
5124
5125 This warning is enabled by @option{-Wall} in C and C++.
5126
5127 @item -Wmissing-attributes
5128 @opindex Wmissing-attributes
5129 @opindex Wno-missing-attributes
5130 Warn when a declaration of a function is missing one or more attributes
5131 that a related function is declared with and whose absence may adversely
5132 affect the correctness or efficiency of generated code. For example,
5133 the warning is issued for declarations of aliases that use attributes
5134 to specify less restrictive requirements than those of their targets.
5135 This typically represents a potential optimization opportunity.
5136 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5137 issued when the alias is more restrictive than the target, which could
5138 lead to incorrect code generation.
5139 Attributes considered include @code{alloc_align}, @code{alloc_size},
5140 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5141 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5142 @code{returns_nonnull}, and @code{returns_twice}.
5143
5144 In C++, the warning is issued when an explicit specialization of a primary
5145 template declared with attribute @code{alloc_align}, @code{alloc_size},
5146 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5147 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5148 @code{error}, and @code{warning} suppress the warning.
5149 (@pxref{Function Attributes}).
5150
5151 You can use the @code{copy} attribute to apply the same
5152 set of attributes to a declaration as that on another declaration without
5153 explicitly enumerating the attributes. This attribute can be applied
5154 to declarations of functions (@pxref{Common Function Attributes}),
5155 variables (@pxref{Common Variable Attributes}), or types
5156 (@pxref{Common Type Attributes}).
5157
5158 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5159
5160 For example, since the declaration of the primary function template
5161 below makes use of both attribute @code{malloc} and @code{alloc_size}
5162 the declaration of the explicit specialization of the template is
5163 diagnosed because it is missing one of the attributes.
5164
5165 @smallexample
5166 template <class T>
5167 T* __attribute__ ((malloc, alloc_size (1)))
5168 allocate (size_t);
5169
5170 template <>
5171 void* __attribute__ ((malloc)) // missing alloc_size
5172 allocate<void> (size_t);
5173 @end smallexample
5174
5175 @item -Wmissing-braces
5176 @opindex Wmissing-braces
5177 @opindex Wno-missing-braces
5178 Warn if an aggregate or union initializer is not fully bracketed. In
5179 the following example, the initializer for @code{a} is not fully
5180 bracketed, but that for @code{b} is fully bracketed. This warning is
5181 enabled by @option{-Wall} in C.
5182
5183 @smallexample
5184 int a[2][2] = @{ 0, 1, 2, 3 @};
5185 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5186 @end smallexample
5187
5188 This warning is enabled by @option{-Wall}.
5189
5190 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5191 @opindex Wmissing-include-dirs
5192 @opindex Wno-missing-include-dirs
5193 Warn if a user-supplied include directory does not exist.
5194
5195 @item -Wmissing-profile
5196 @opindex Wmissing-profile
5197 @opindex Wno-missing-profile
5198 Warn if feedback profiles are missing when using the
5199 @option{-fprofile-use} option.
5200 This option diagnoses those cases where a new function or a new file is added
5201 to the user code between compiling with @option{-fprofile-generate} and with
5202 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5203 profile feedback data files do not contain any profile feedback information for
5204 the newly added function or file respectively. Also, in the case when profile
5205 count data (.gcda) files are removed, GCC cannot use any profile feedback
5206 information. In all these cases, warnings are issued to inform the user that a
5207 profile generation step is due. @option{-Wno-missing-profile} can be used to
5208 disable the warning. Ignoring the warning can result in poorly optimized code.
5209 Completely disabling the warning is not recommended and should be done only
5210 when non-existent profile data is justified.
5211
5212 @item -Wmultistatement-macros
5213 @opindex Wmultistatement-macros
5214 @opindex Wno-multistatement-macros
5215 Warn about unsafe multiple statement macros that appear to be guarded
5216 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5217 @code{while}, in which only the first statement is actually guarded after
5218 the macro is expanded.
5219
5220 For example:
5221
5222 @smallexample
5223 #define DOIT x++; y++
5224 if (c)
5225 DOIT;
5226 @end smallexample
5227
5228 will increment @code{y} unconditionally, not just when @code{c} holds.
5229 The can usually be fixed by wrapping the macro in a do-while loop:
5230 @smallexample
5231 #define DOIT do @{ x++; y++; @} while (0)
5232 if (c)
5233 DOIT;
5234 @end smallexample
5235
5236 This warning is enabled by @option{-Wall} in C and C++.
5237
5238 @item -Wparentheses
5239 @opindex Wparentheses
5240 @opindex Wno-parentheses
5241 Warn if parentheses are omitted in certain contexts, such
5242 as when there is an assignment in a context where a truth value
5243 is expected, or when operators are nested whose precedence people
5244 often get confused about.
5245
5246 Also warn if a comparison like @code{x<=y<=z} appears; this is
5247 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5248 interpretation from that of ordinary mathematical notation.
5249
5250 Also warn for dangerous uses of the GNU extension to
5251 @code{?:} with omitted middle operand. When the condition
5252 in the @code{?}: operator is a boolean expression, the omitted value is
5253 always 1. Often programmers expect it to be a value computed
5254 inside the conditional expression instead.
5255
5256 For C++ this also warns for some cases of unnecessary parentheses in
5257 declarations, which can indicate an attempt at a function call instead
5258 of a declaration:
5259 @smallexample
5260 @{
5261 // Declares a local variable called mymutex.
5262 std::unique_lock<std::mutex> (mymutex);
5263 // User meant std::unique_lock<std::mutex> lock (mymutex);
5264 @}
5265 @end smallexample
5266
5267 This warning is enabled by @option{-Wall}.
5268
5269 @item -Wsequence-point
5270 @opindex Wsequence-point
5271 @opindex Wno-sequence-point
5272 Warn about code that may have undefined semantics because of violations
5273 of sequence point rules in the C and C++ standards.
5274
5275 The C and C++ standards define the order in which expressions in a C/C++
5276 program are evaluated in terms of @dfn{sequence points}, which represent
5277 a partial ordering between the execution of parts of the program: those
5278 executed before the sequence point, and those executed after it. These
5279 occur after the evaluation of a full expression (one which is not part
5280 of a larger expression), after the evaluation of the first operand of a
5281 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5282 function is called (but after the evaluation of its arguments and the
5283 expression denoting the called function), and in certain other places.
5284 Other than as expressed by the sequence point rules, the order of
5285 evaluation of subexpressions of an expression is not specified. All
5286 these rules describe only a partial order rather than a total order,
5287 since, for example, if two functions are called within one expression
5288 with no sequence point between them, the order in which the functions
5289 are called is not specified. However, the standards committee have
5290 ruled that function calls do not overlap.
5291
5292 It is not specified when between sequence points modifications to the
5293 values of objects take effect. Programs whose behavior depends on this
5294 have undefined behavior; the C and C++ standards specify that ``Between
5295 the previous and next sequence point an object shall have its stored
5296 value modified at most once by the evaluation of an expression.
5297 Furthermore, the prior value shall be read only to determine the value
5298 to be stored.''. If a program breaks these rules, the results on any
5299 particular implementation are entirely unpredictable.
5300
5301 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5302 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5303 diagnosed by this option, and it may give an occasional false positive
5304 result, but in general it has been found fairly effective at detecting
5305 this sort of problem in programs.
5306
5307 The C++17 standard will define the order of evaluation of operands in
5308 more cases: in particular it requires that the right-hand side of an
5309 assignment be evaluated before the left-hand side, so the above
5310 examples are no longer undefined. But this warning will still warn
5311 about them, to help people avoid writing code that is undefined in C
5312 and earlier revisions of C++.
5313
5314 The standard is worded confusingly, therefore there is some debate
5315 over the precise meaning of the sequence point rules in subtle cases.
5316 Links to discussions of the problem, including proposed formal
5317 definitions, may be found on the GCC readings page, at
5318 @uref{http://gcc.gnu.org/@/readings.html}.
5319
5320 This warning is enabled by @option{-Wall} for C and C++.
5321
5322 @item -Wno-return-local-addr
5323 @opindex Wno-return-local-addr
5324 @opindex Wreturn-local-addr
5325 Do not warn about returning a pointer (or in C++, a reference) to a
5326 variable that goes out of scope after the function returns.
5327
5328 @item -Wreturn-type
5329 @opindex Wreturn-type
5330 @opindex Wno-return-type
5331 Warn whenever a function is defined with a return type that defaults
5332 to @code{int}. Also warn about any @code{return} statement with no
5333 return value in a function whose return type is not @code{void}
5334 (falling off the end of the function body is considered returning
5335 without a value).
5336
5337 For C only, warn about a @code{return} statement with an expression in a
5338 function whose return type is @code{void}, unless the expression type is
5339 also @code{void}. As a GNU extension, the latter case is accepted
5340 without a warning unless @option{-Wpedantic} is used. Attempting
5341 to use the return value of a non-@code{void} function other than @code{main}
5342 that flows off the end by reaching the closing curly brace that terminates
5343 the function is undefined.
5344
5345 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5346 than @code{main} results in undefined behavior even when the value of
5347 the function is not used.
5348
5349 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5350
5351 @item -Wshift-count-negative
5352 @opindex Wshift-count-negative
5353 @opindex Wno-shift-count-negative
5354 Warn if shift count is negative. This warning is enabled by default.
5355
5356 @item -Wshift-count-overflow
5357 @opindex Wshift-count-overflow
5358 @opindex Wno-shift-count-overflow
5359 Warn if shift count >= width of type. This warning is enabled by default.
5360
5361 @item -Wshift-negative-value
5362 @opindex Wshift-negative-value
5363 @opindex Wno-shift-negative-value
5364 Warn if left shifting a negative value. This warning is enabled by
5365 @option{-Wextra} in C99 and C++11 modes (and newer).
5366
5367 @item -Wshift-overflow
5368 @itemx -Wshift-overflow=@var{n}
5369 @opindex Wshift-overflow
5370 @opindex Wno-shift-overflow
5371 Warn about left shift overflows. This warning is enabled by
5372 default in C99 and C++11 modes (and newer).
5373
5374 @table @gcctabopt
5375 @item -Wshift-overflow=1
5376 This is the warning level of @option{-Wshift-overflow} and is enabled
5377 by default in C99 and C++11 modes (and newer). This warning level does
5378 not warn about left-shifting 1 into the sign bit. (However, in C, such
5379 an overflow is still rejected in contexts where an integer constant expression
5380 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5381 shifts always wrap.
5382
5383 @item -Wshift-overflow=2
5384 This warning level also warns about left-shifting 1 into the sign bit,
5385 unless C++14 mode (or newer) is active.
5386 @end table
5387
5388 @item -Wswitch
5389 @opindex Wswitch
5390 @opindex Wno-switch
5391 Warn whenever a @code{switch} statement has an index of enumerated type
5392 and lacks a @code{case} for one or more of the named codes of that
5393 enumeration. (The presence of a @code{default} label prevents this
5394 warning.) @code{case} labels outside the enumeration range also
5395 provoke warnings when this option is used (even if there is a
5396 @code{default} label).
5397 This warning is enabled by @option{-Wall}.
5398
5399 @item -Wswitch-default
5400 @opindex Wswitch-default
5401 @opindex Wno-switch-default
5402 Warn whenever a @code{switch} statement does not have a @code{default}
5403 case.
5404
5405 @item -Wswitch-enum
5406 @opindex Wswitch-enum
5407 @opindex Wno-switch-enum
5408 Warn whenever a @code{switch} statement has an index of enumerated type
5409 and lacks a @code{case} for one or more of the named codes of that
5410 enumeration. @code{case} labels outside the enumeration range also
5411 provoke warnings when this option is used. The only difference
5412 between @option{-Wswitch} and this option is that this option gives a
5413 warning about an omitted enumeration code even if there is a
5414 @code{default} label.
5415
5416 @item -Wswitch-bool
5417 @opindex Wswitch-bool
5418 @opindex Wno-switch-bool
5419 Warn whenever a @code{switch} statement has an index of boolean type
5420 and the case values are outside the range of a boolean type.
5421 It is possible to suppress this warning by casting the controlling
5422 expression to a type other than @code{bool}. For example:
5423 @smallexample
5424 @group
5425 switch ((int) (a == 4))
5426 @{
5427 @dots{}
5428 @}
5429 @end group
5430 @end smallexample
5431 This warning is enabled by default for C and C++ programs.
5432
5433 @item -Wswitch-outside-range
5434 @opindex Wswitch-outside-range
5435 @opindex Wno-switch-outside-range
5436 Warn whenever a @code{switch} case has a value that is outside of its
5437 respective type range. This warning is enabled by default for
5438 C and C++ programs.
5439
5440 @item -Wswitch-unreachable
5441 @opindex Wswitch-unreachable
5442 @opindex Wno-switch-unreachable
5443 Warn whenever a @code{switch} statement contains statements between the
5444 controlling expression and the first case label, which will never be
5445 executed. For example:
5446 @smallexample
5447 @group
5448 switch (cond)
5449 @{
5450 i = 15;
5451 @dots{}
5452 case 5:
5453 @dots{}
5454 @}
5455 @end group
5456 @end smallexample
5457 @option{-Wswitch-unreachable} does not warn if the statement between the
5458 controlling expression and the first case label is just a declaration:
5459 @smallexample
5460 @group
5461 switch (cond)
5462 @{
5463 int i;
5464 @dots{}
5465 case 5:
5466 i = 5;
5467 @dots{}
5468 @}
5469 @end group
5470 @end smallexample
5471 This warning is enabled by default for C and C++ programs.
5472
5473 @item -Wsync-nand @r{(C and C++ only)}
5474 @opindex Wsync-nand
5475 @opindex Wno-sync-nand
5476 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5477 built-in functions are used. These functions changed semantics in GCC 4.4.
5478
5479 @item -Wunused-but-set-parameter
5480 @opindex Wunused-but-set-parameter
5481 @opindex Wno-unused-but-set-parameter
5482 Warn whenever a function parameter is assigned to, but otherwise unused
5483 (aside from its declaration).
5484
5485 To suppress this warning use the @code{unused} attribute
5486 (@pxref{Variable Attributes}).
5487
5488 This warning is also enabled by @option{-Wunused} together with
5489 @option{-Wextra}.
5490
5491 @item -Wunused-but-set-variable
5492 @opindex Wunused-but-set-variable
5493 @opindex Wno-unused-but-set-variable
5494 Warn whenever a local variable is assigned to, but otherwise unused
5495 (aside from its declaration).
5496 This warning is enabled by @option{-Wall}.
5497
5498 To suppress this warning use the @code{unused} attribute
5499 (@pxref{Variable Attributes}).
5500
5501 This warning is also enabled by @option{-Wunused}, which is enabled
5502 by @option{-Wall}.
5503
5504 @item -Wunused-function
5505 @opindex Wunused-function
5506 @opindex Wno-unused-function
5507 Warn whenever a static function is declared but not defined or a
5508 non-inline static function is unused.
5509 This warning is enabled by @option{-Wall}.
5510
5511 @item -Wunused-label
5512 @opindex Wunused-label
5513 @opindex Wno-unused-label
5514 Warn whenever a label is declared but not used.
5515 This warning is enabled by @option{-Wall}.
5516
5517 To suppress this warning use the @code{unused} attribute
5518 (@pxref{Variable Attributes}).
5519
5520 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5521 @opindex Wunused-local-typedefs
5522 @opindex Wno-unused-local-typedefs
5523 Warn when a typedef locally defined in a function is not used.
5524 This warning is enabled by @option{-Wall}.
5525
5526 @item -Wunused-parameter
5527 @opindex Wunused-parameter
5528 @opindex Wno-unused-parameter
5529 Warn whenever a function parameter is unused aside from its declaration.
5530
5531 To suppress this warning use the @code{unused} attribute
5532 (@pxref{Variable Attributes}).
5533
5534 @item -Wno-unused-result
5535 @opindex Wunused-result
5536 @opindex Wno-unused-result
5537 Do not warn if a caller of a function marked with attribute
5538 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5539 its return value. The default is @option{-Wunused-result}.
5540
5541 @item -Wunused-variable
5542 @opindex Wunused-variable
5543 @opindex Wno-unused-variable
5544 Warn whenever a local or static variable is unused aside from its
5545 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5546 but not for C++. This warning is enabled by @option{-Wall}.
5547
5548 To suppress this warning use the @code{unused} attribute
5549 (@pxref{Variable Attributes}).
5550
5551 @item -Wunused-const-variable
5552 @itemx -Wunused-const-variable=@var{n}
5553 @opindex Wunused-const-variable
5554 @opindex Wno-unused-const-variable
5555 Warn whenever a constant static variable is unused aside from its declaration.
5556 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5557 for C, but not for C++. In C this declares variable storage, but in C++ this
5558 is not an error since const variables take the place of @code{#define}s.
5559
5560 To suppress this warning use the @code{unused} attribute
5561 (@pxref{Variable Attributes}).
5562
5563 @table @gcctabopt
5564 @item -Wunused-const-variable=1
5565 This is the warning level that is enabled by @option{-Wunused-variable} for
5566 C. It warns only about unused static const variables defined in the main
5567 compilation unit, but not about static const variables declared in any
5568 header included.
5569
5570 @item -Wunused-const-variable=2
5571 This warning level also warns for unused constant static variables in
5572 headers (excluding system headers). This is the warning level of
5573 @option{-Wunused-const-variable} and must be explicitly requested since
5574 in C++ this isn't an error and in C it might be harder to clean up all
5575 headers included.
5576 @end table
5577
5578 @item -Wunused-value
5579 @opindex Wunused-value
5580 @opindex Wno-unused-value
5581 Warn whenever a statement computes a result that is explicitly not
5582 used. To suppress this warning cast the unused expression to
5583 @code{void}. This includes an expression-statement or the left-hand
5584 side of a comma expression that contains no side effects. For example,
5585 an expression such as @code{x[i,j]} causes a warning, while
5586 @code{x[(void)i,j]} does not.
5587
5588 This warning is enabled by @option{-Wall}.
5589
5590 @item -Wunused
5591 @opindex Wunused
5592 @opindex Wno-unused
5593 All the above @option{-Wunused} options combined.
5594
5595 In order to get a warning about an unused function parameter, you must
5596 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5597 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5598
5599 @item -Wuninitialized
5600 @opindex Wuninitialized
5601 @opindex Wno-uninitialized
5602 Warn if an automatic variable is used without first being initialized
5603 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5604 warn if a non-static reference or non-static @code{const} member
5605 appears in a class without constructors.
5606
5607 If you want to warn about code that uses the uninitialized value of the
5608 variable in its own initializer, use the @option{-Winit-self} option.
5609
5610 These warnings occur for individual uninitialized or clobbered
5611 elements of structure, union or array variables as well as for
5612 variables that are uninitialized or clobbered as a whole. They do
5613 not occur for variables or elements declared @code{volatile}. Because
5614 these warnings depend on optimization, the exact variables or elements
5615 for which there are warnings depends on the precise optimization
5616 options and version of GCC used.
5617
5618 Note that there may be no warning about a variable that is used only
5619 to compute a value that itself is never used, because such
5620 computations may be deleted by data flow analysis before the warnings
5621 are printed.
5622
5623 @item -Winvalid-memory-model
5624 @opindex Winvalid-memory-model
5625 @opindex Wno-invalid-memory-model
5626 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5627 and the C11 atomic generic functions with a memory consistency argument
5628 that is either invalid for the operation or outside the range of values
5629 of the @code{memory_order} enumeration. For example, since the
5630 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5631 defined for the relaxed, release, and sequentially consistent memory
5632 orders the following code is diagnosed:
5633
5634 @smallexample
5635 void store (int *i)
5636 @{
5637 __atomic_store_n (i, 0, memory_order_consume);
5638 @}
5639 @end smallexample
5640
5641 @option{-Winvalid-memory-model} is enabled by default.
5642
5643 @item -Wmaybe-uninitialized
5644 @opindex Wmaybe-uninitialized
5645 @opindex Wno-maybe-uninitialized
5646 For an automatic (i.e.@: local) variable, if there exists a path from the
5647 function entry to a use of the variable that is initialized, but there exist
5648 some other paths for which the variable is not initialized, the compiler
5649 emits a warning if it cannot prove the uninitialized paths are not
5650 executed at run time.
5651
5652 These warnings are only possible in optimizing compilation, because otherwise
5653 GCC does not keep track of the state of variables.
5654
5655 These warnings are made optional because GCC may not be able to determine when
5656 the code is correct in spite of appearing to have an error. Here is one
5657 example of how this can happen:
5658
5659 @smallexample
5660 @group
5661 @{
5662 int x;
5663 switch (y)
5664 @{
5665 case 1: x = 1;
5666 break;
5667 case 2: x = 4;
5668 break;
5669 case 3: x = 5;
5670 @}
5671 foo (x);
5672 @}
5673 @end group
5674 @end smallexample
5675
5676 @noindent
5677 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5678 always initialized, but GCC doesn't know this. To suppress the
5679 warning, you need to provide a default case with assert(0) or
5680 similar code.
5681
5682 @cindex @code{longjmp} warnings
5683 This option also warns when a non-volatile automatic variable might be
5684 changed by a call to @code{longjmp}.
5685 The compiler sees only the calls to @code{setjmp}. It cannot know
5686 where @code{longjmp} will be called; in fact, a signal handler could
5687 call it at any point in the code. As a result, you may get a warning
5688 even when there is in fact no problem because @code{longjmp} cannot
5689 in fact be called at the place that would cause a problem.
5690
5691 Some spurious warnings can be avoided if you declare all the functions
5692 you use that never return as @code{noreturn}. @xref{Function
5693 Attributes}.
5694
5695 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5696
5697 @item -Wunknown-pragmas
5698 @opindex Wunknown-pragmas
5699 @opindex Wno-unknown-pragmas
5700 @cindex warning for unknown pragmas
5701 @cindex unknown pragmas, warning
5702 @cindex pragmas, warning of unknown
5703 Warn when a @code{#pragma} directive is encountered that is not understood by
5704 GCC@. If this command-line option is used, warnings are even issued
5705 for unknown pragmas in system header files. This is not the case if
5706 the warnings are only enabled by the @option{-Wall} command-line option.
5707
5708 @item -Wno-pragmas
5709 @opindex Wno-pragmas
5710 @opindex Wpragmas
5711 Do not warn about misuses of pragmas, such as incorrect parameters,
5712 invalid syntax, or conflicts between pragmas. See also
5713 @option{-Wunknown-pragmas}.
5714
5715 @item -Wno-prio-ctor-dtor
5716 @opindex Wno-prio-ctor-dtor
5717 @opindex Wprio-ctor-dtor
5718 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5719 The use of constructor and destructor attributes allow you to assign a
5720 priority to the constructor/destructor to control its order of execution
5721 before @code{main} is called or after it returns. The priority values must be
5722 greater than 100 as the compiler reserves priority values between 0--100 for
5723 the implementation.
5724
5725 @item -Wstrict-aliasing
5726 @opindex Wstrict-aliasing
5727 @opindex Wno-strict-aliasing
5728 This option is only active when @option{-fstrict-aliasing} is active.
5729 It warns about code that might break the strict aliasing rules that the
5730 compiler is using for optimization. The warning does not catch all
5731 cases, but does attempt to catch the more common pitfalls. It is
5732 included in @option{-Wall}.
5733 It is equivalent to @option{-Wstrict-aliasing=3}
5734
5735 @item -Wstrict-aliasing=n
5736 @opindex Wstrict-aliasing=n
5737 This option is only active when @option{-fstrict-aliasing} is active.
5738 It warns about code that might break the strict aliasing rules that the
5739 compiler is using for optimization.
5740 Higher levels correspond to higher accuracy (fewer false positives).
5741 Higher levels also correspond to more effort, similar to the way @option{-O}
5742 works.
5743 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5744
5745 Level 1: Most aggressive, quick, least accurate.
5746 Possibly useful when higher levels
5747 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5748 false negatives. However, it has many false positives.
5749 Warns for all pointer conversions between possibly incompatible types,
5750 even if never dereferenced. Runs in the front end only.
5751
5752 Level 2: Aggressive, quick, not too precise.
5753 May still have many false positives (not as many as level 1 though),
5754 and few false negatives (but possibly more than level 1).
5755 Unlike level 1, it only warns when an address is taken. Warns about
5756 incomplete types. Runs in the front end only.
5757
5758 Level 3 (default for @option{-Wstrict-aliasing}):
5759 Should have very few false positives and few false
5760 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5761 Takes care of the common pun+dereference pattern in the front end:
5762 @code{*(int*)&some_float}.
5763 If optimization is enabled, it also runs in the back end, where it deals
5764 with multiple statement cases using flow-sensitive points-to information.
5765 Only warns when the converted pointer is dereferenced.
5766 Does not warn about incomplete types.
5767
5768 @item -Wstrict-overflow
5769 @itemx -Wstrict-overflow=@var{n}
5770 @opindex Wstrict-overflow
5771 @opindex Wno-strict-overflow
5772 This option is only active when signed overflow is undefined.
5773 It warns about cases where the compiler optimizes based on the
5774 assumption that signed overflow does not occur. Note that it does not
5775 warn about all cases where the code might overflow: it only warns
5776 about cases where the compiler implements some optimization. Thus
5777 this warning depends on the optimization level.
5778
5779 An optimization that assumes that signed overflow does not occur is
5780 perfectly safe if the values of the variables involved are such that
5781 overflow never does, in fact, occur. Therefore this warning can
5782 easily give a false positive: a warning about code that is not
5783 actually a problem. To help focus on important issues, several
5784 warning levels are defined. No warnings are issued for the use of
5785 undefined signed overflow when estimating how many iterations a loop
5786 requires, in particular when determining whether a loop will be
5787 executed at all.
5788
5789 @table @gcctabopt
5790 @item -Wstrict-overflow=1
5791 Warn about cases that are both questionable and easy to avoid. For
5792 example the compiler simplifies
5793 @code{x + 1 > x} to @code{1}. This level of
5794 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5795 are not, and must be explicitly requested.
5796
5797 @item -Wstrict-overflow=2
5798 Also warn about other cases where a comparison is simplified to a
5799 constant. For example: @code{abs (x) >= 0}. This can only be
5800 simplified when signed integer overflow is undefined, because
5801 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5802 zero. @option{-Wstrict-overflow} (with no level) is the same as
5803 @option{-Wstrict-overflow=2}.
5804
5805 @item -Wstrict-overflow=3
5806 Also warn about other cases where a comparison is simplified. For
5807 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5808
5809 @item -Wstrict-overflow=4
5810 Also warn about other simplifications not covered by the above cases.
5811 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5812
5813 @item -Wstrict-overflow=5
5814 Also warn about cases where the compiler reduces the magnitude of a
5815 constant involved in a comparison. For example: @code{x + 2 > y} is
5816 simplified to @code{x + 1 >= y}. This is reported only at the
5817 highest warning level because this simplification applies to many
5818 comparisons, so this warning level gives a very large number of
5819 false positives.
5820 @end table
5821
5822 @item -Wstringop-overflow
5823 @itemx -Wstringop-overflow=@var{type}
5824 @opindex Wstringop-overflow
5825 @opindex Wno-stringop-overflow
5826 Warn for calls to string manipulation functions such as @code{memcpy} and
5827 @code{strcpy} that are determined to overflow the destination buffer. The
5828 optional argument is one greater than the type of Object Size Checking to
5829 perform to determine the size of the destination. @xref{Object Size Checking}.
5830 The argument is meaningful only for functions that operate on character arrays
5831 but not for raw memory functions like @code{memcpy} which always make use
5832 of Object Size type-0. The option also warns for calls that specify a size
5833 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5834 The option produces the best results with optimization enabled but can detect
5835 a small subset of simple buffer overflows even without optimization in
5836 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5837 correspond to the standard functions. In any case, the option warns about
5838 just a subset of buffer overflows detected by the corresponding overflow
5839 checking built-ins. For example, the option will issue a warning for
5840 the @code{strcpy} call below because it copies at least 5 characters
5841 (the string @code{"blue"} including the terminating NUL) into the buffer
5842 of size 4.
5843
5844 @smallexample
5845 enum Color @{ blue, purple, yellow @};
5846 const char* f (enum Color clr)
5847 @{
5848 static char buf [4];
5849 const char *str;
5850 switch (clr)
5851 @{
5852 case blue: str = "blue"; break;
5853 case purple: str = "purple"; break;
5854 case yellow: str = "yellow"; break;
5855 @}
5856
5857 return strcpy (buf, str); // warning here
5858 @}
5859 @end smallexample
5860
5861 Option @option{-Wstringop-overflow=2} is enabled by default.
5862
5863 @table @gcctabopt
5864 @item -Wstringop-overflow
5865 @itemx -Wstringop-overflow=1
5866 @opindex Wstringop-overflow
5867 @opindex Wno-stringop-overflow
5868 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5869 to determine the sizes of destination objects. This is the default setting
5870 of the option. At this setting the option will not warn for writes past
5871 the end of subobjects of larger objects accessed by pointers unless the
5872 size of the largest surrounding object is known. When the destination may
5873 be one of several objects it is assumed to be the largest one of them. On
5874 Linux systems, when optimization is enabled at this setting the option warns
5875 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5876 a non-zero value.
5877
5878 @item -Wstringop-overflow=2
5879 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5880 to determine the sizes of destination objects. At this setting the option
5881 will warn about overflows when writing to members of the largest complete
5882 objects whose exact size is known. It will, however, not warn for excessive
5883 writes to the same members of unknown objects referenced by pointers since
5884 they may point to arrays containing unknown numbers of elements.
5885
5886 @item -Wstringop-overflow=3
5887 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5888 to determine the sizes of destination objects. At this setting the option
5889 warns about overflowing the smallest object or data member. This is the
5890 most restrictive setting of the option that may result in warnings for safe
5891 code.
5892
5893 @item -Wstringop-overflow=4
5894 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5895 to determine the sizes of destination objects. At this setting the option
5896 will warn about overflowing any data members, and when the destination is
5897 one of several objects it uses the size of the largest of them to decide
5898 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5899 setting of the option may result in warnings for benign code.
5900 @end table
5901
5902 @item -Wstringop-truncation
5903 @opindex Wstringop-truncation
5904 @opindex Wno-stringop-truncation
5905 Warn for calls to bounded string manipulation functions such as @code{strncat},
5906 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5907 or leave the destination unchanged.
5908
5909 In the following example, the call to @code{strncat} specifies a bound that
5910 is less than the length of the source string. As a result, the copy of
5911 the source will be truncated and so the call is diagnosed. To avoid the
5912 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5913
5914 @smallexample
5915 void append (char *buf, size_t bufsize)
5916 @{
5917 strncat (buf, ".txt", 3);
5918 @}
5919 @end smallexample
5920
5921 As another example, the following call to @code{strncpy} results in copying
5922 to @code{d} just the characters preceding the terminating NUL, without
5923 appending the NUL to the end. Assuming the result of @code{strncpy} is
5924 necessarily a NUL-terminated string is a common mistake, and so the call
5925 is diagnosed. To avoid the warning when the result is not expected to be
5926 NUL-terminated, call @code{memcpy} instead.
5927
5928 @smallexample
5929 void copy (char *d, const char *s)
5930 @{
5931 strncpy (d, s, strlen (s));
5932 @}
5933 @end smallexample
5934
5935 In the following example, the call to @code{strncpy} specifies the size
5936 of the destination buffer as the bound. If the length of the source
5937 string is equal to or greater than this size the result of the copy will
5938 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5939 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5940 element of the buffer to @code{NUL}.
5941
5942 @smallexample
5943 void copy (const char *s)
5944 @{
5945 char buf[80];
5946 strncpy (buf, s, sizeof buf);
5947 @dots{}
5948 @}
5949 @end smallexample
5950
5951 In situations where a character array is intended to store a sequence
5952 of bytes with no terminating @code{NUL} such an array may be annotated
5953 with attribute @code{nonstring} to avoid this warning. Such arrays,
5954 however, are not suitable arguments to functions that expect
5955 @code{NUL}-terminated strings. To help detect accidental misuses of
5956 such arrays GCC issues warnings unless it can prove that the use is
5957 safe. @xref{Common Variable Attributes}.
5958
5959 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5960 @opindex Wsuggest-attribute=
5961 @opindex Wno-suggest-attribute=
5962 Warn for cases where adding an attribute may be beneficial. The
5963 attributes currently supported are listed below.
5964
5965 @table @gcctabopt
5966 @item -Wsuggest-attribute=pure
5967 @itemx -Wsuggest-attribute=const
5968 @itemx -Wsuggest-attribute=noreturn
5969 @itemx -Wmissing-noreturn
5970 @itemx -Wsuggest-attribute=malloc
5971 @opindex Wsuggest-attribute=pure
5972 @opindex Wno-suggest-attribute=pure
5973 @opindex Wsuggest-attribute=const
5974 @opindex Wno-suggest-attribute=const
5975 @opindex Wsuggest-attribute=noreturn
5976 @opindex Wno-suggest-attribute=noreturn
5977 @opindex Wmissing-noreturn
5978 @opindex Wno-missing-noreturn
5979 @opindex Wsuggest-attribute=malloc
5980 @opindex Wno-suggest-attribute=malloc
5981
5982 Warn about functions that might be candidates for attributes
5983 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5984 only warns for functions visible in other compilation units or (in the case of
5985 @code{pure} and @code{const}) if it cannot prove that the function returns
5986 normally. A function returns normally if it doesn't contain an infinite loop or
5987 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5988 requires option @option{-fipa-pure-const}, which is enabled by default at
5989 @option{-O} and higher. Higher optimization levels improve the accuracy
5990 of the analysis.
5991
5992 @item -Wsuggest-attribute=format
5993 @itemx -Wmissing-format-attribute
5994 @opindex Wsuggest-attribute=format
5995 @opindex Wmissing-format-attribute
5996 @opindex Wno-suggest-attribute=format
5997 @opindex Wno-missing-format-attribute
5998 @opindex Wformat
5999 @opindex Wno-format
6000
6001 Warn about function pointers that might be candidates for @code{format}
6002 attributes. Note these are only possible candidates, not absolute ones.
6003 GCC guesses that function pointers with @code{format} attributes that
6004 are used in assignment, initialization, parameter passing or return
6005 statements should have a corresponding @code{format} attribute in the
6006 resulting type. I.e.@: the left-hand side of the assignment or
6007 initialization, the type of the parameter variable, or the return type
6008 of the containing function respectively should also have a @code{format}
6009 attribute to avoid the warning.
6010
6011 GCC also warns about function definitions that might be
6012 candidates for @code{format} attributes. Again, these are only
6013 possible candidates. GCC guesses that @code{format} attributes
6014 might be appropriate for any function that calls a function like
6015 @code{vprintf} or @code{vscanf}, but this might not always be the
6016 case, and some functions for which @code{format} attributes are
6017 appropriate may not be detected.
6018
6019 @item -Wsuggest-attribute=cold
6020 @opindex Wsuggest-attribute=cold
6021 @opindex Wno-suggest-attribute=cold
6022
6023 Warn about functions that might be candidates for @code{cold} attribute. This
6024 is based on static detection and generally will only warn about functions which
6025 always leads to a call to another @code{cold} function such as wrappers of
6026 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6027 @end table
6028
6029 @item -Wsuggest-final-types
6030 @opindex Wno-suggest-final-types
6031 @opindex Wsuggest-final-types
6032 Warn about types with virtual methods where code quality would be improved
6033 if the type were declared with the C++11 @code{final} specifier,
6034 or, if possible,
6035 declared in an anonymous namespace. This allows GCC to more aggressively
6036 devirtualize the polymorphic calls. This warning is more effective with
6037 link-time optimization,
6038 where the information about the class hierarchy graph is
6039 more complete.
6040
6041 @item -Wsuggest-final-methods
6042 @opindex Wno-suggest-final-methods
6043 @opindex Wsuggest-final-methods
6044 Warn about virtual methods where code quality would be improved if the method
6045 were declared with the C++11 @code{final} specifier,
6046 or, if possible, its type were
6047 declared in an anonymous namespace or with the @code{final} specifier.
6048 This warning is
6049 more effective with link-time optimization, where the information about the
6050 class hierarchy graph is more complete. It is recommended to first consider
6051 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6052 annotations.
6053
6054 @item -Wsuggest-override
6055 Warn about overriding virtual functions that are not marked with the override
6056 keyword.
6057
6058 @item -Walloc-zero
6059 @opindex Wno-alloc-zero
6060 @opindex Walloc-zero
6061 Warn about calls to allocation functions decorated with attribute
6062 @code{alloc_size} that specify zero bytes, including those to the built-in
6063 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6064 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6065 when called with a zero size differs among implementations (and in the case
6066 of @code{realloc} has been deprecated) relying on it may result in subtle
6067 portability bugs and should be avoided.
6068
6069 @item -Walloc-size-larger-than=@var{byte-size}
6070 @opindex Walloc-size-larger-than=
6071 @opindex Wno-alloc-size-larger-than
6072 Warn about calls to functions decorated with attribute @code{alloc_size}
6073 that attempt to allocate objects larger than the specified number of bytes,
6074 or where the result of the size computation in an integer type with infinite
6075 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6076 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6077 Warnings controlled by the option can be disabled either by specifying
6078 @var{byte-size} of @samp{SIZE_MAX} or more or by
6079 @option{-Wno-alloc-size-larger-than}.
6080 @xref{Function Attributes}.
6081
6082 @item -Wno-alloc-size-larger-than
6083 @opindex Wno-alloc-size-larger-than
6084 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6085 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6086 larger.
6087
6088 @item -Walloca
6089 @opindex Wno-alloca
6090 @opindex Walloca
6091 This option warns on all uses of @code{alloca} in the source.
6092
6093 @item -Walloca-larger-than=@var{byte-size}
6094 @opindex Walloca-larger-than=
6095 @opindex Wno-alloca-larger-than
6096 This option warns on calls to @code{alloca} with an integer argument whose
6097 value is either zero, or that is not bounded by a controlling predicate
6098 that limits its value to at most @var{byte-size}. It also warns for calls
6099 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6100 types are considered unbounded even if they appear to be constrained to
6101 the expected range.
6102
6103 For example, a bounded case of @code{alloca} could be:
6104
6105 @smallexample
6106 void func (size_t n)
6107 @{
6108 void *p;
6109 if (n <= 1000)
6110 p = alloca (n);
6111 else
6112 p = malloc (n);
6113 f (p);
6114 @}
6115 @end smallexample
6116
6117 In the above example, passing @code{-Walloca-larger-than=1000} would not
6118 issue a warning because the call to @code{alloca} is known to be at most
6119 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6120 the compiler would emit a warning.
6121
6122 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6123 controlling predicate constraining its integer argument. For example:
6124
6125 @smallexample
6126 void func ()
6127 @{
6128 void *p = alloca (n);
6129 f (p);
6130 @}
6131 @end smallexample
6132
6133 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6134 a warning, but this time because of the lack of bounds checking.
6135
6136 Note, that even seemingly correct code involving signed integers could
6137 cause a warning:
6138
6139 @smallexample
6140 void func (signed int n)
6141 @{
6142 if (n < 500)
6143 @{
6144 p = alloca (n);
6145 f (p);
6146 @}
6147 @}
6148 @end smallexample
6149
6150 In the above example, @var{n} could be negative, causing a larger than
6151 expected argument to be implicitly cast into the @code{alloca} call.
6152
6153 This option also warns when @code{alloca} is used in a loop.
6154
6155 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6156 but is usually only effective when @option{-ftree-vrp} is active (default
6157 for @option{-O2} and above).
6158
6159 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6160
6161 @item -Wno-alloca-larger-than
6162 @opindex Wno-alloca-larger-than
6163 Disable @option{-Walloca-larger-than=} warnings. The option is
6164 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6165
6166 @item -Warray-bounds
6167 @itemx -Warray-bounds=@var{n}
6168 @opindex Wno-array-bounds
6169 @opindex Warray-bounds
6170 This option is only active when @option{-ftree-vrp} is active
6171 (default for @option{-O2} and above). It warns about subscripts to arrays
6172 that are always out of bounds. This warning is enabled by @option{-Wall}.
6173
6174 @table @gcctabopt
6175 @item -Warray-bounds=1
6176 This is the warning level of @option{-Warray-bounds} and is enabled
6177 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6178
6179 @item -Warray-bounds=2
6180 This warning level also warns about out of bounds access for
6181 arrays at the end of a struct and for arrays accessed through
6182 pointers. This warning level may give a larger number of
6183 false positives and is deactivated by default.
6184 @end table
6185
6186 @item -Wattribute-alias=@var{n}
6187 @itemx -Wno-attribute-alias
6188 @opindex Wattribute-alias
6189 @opindex Wno-attribute-alias
6190 Warn about declarations using the @code{alias} and similar attributes whose
6191 target is incompatible with the type of the alias.
6192 @xref{Function Attributes,,Declaring Attributes of Functions}.
6193
6194 @table @gcctabopt
6195 @item -Wattribute-alias=1
6196 The default warning level of the @option{-Wattribute-alias} option diagnoses
6197 incompatibilities between the type of the alias declaration and that of its
6198 target. Such incompatibilities are typically indicative of bugs.
6199
6200 @item -Wattribute-alias=2
6201
6202 At this level @option{-Wattribute-alias} also diagnoses cases where
6203 the attributes of the alias declaration are more restrictive than the
6204 attributes applied to its target. These mismatches can potentially
6205 result in incorrect code generation. In other cases they may be
6206 benign and could be resolved simply by adding the missing attribute to
6207 the target. For comparison, see the @option{-Wmissing-attributes}
6208 option, which controls diagnostics when the alias declaration is less
6209 restrictive than the target, rather than more restrictive.
6210
6211 Attributes considered include @code{alloc_align}, @code{alloc_size},
6212 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6213 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6214 @code{returns_nonnull}, and @code{returns_twice}.
6215 @end table
6216
6217 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6218 This is the default. You can disable these warnings with either
6219 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6220
6221 @item -Wbool-compare
6222 @opindex Wno-bool-compare
6223 @opindex Wbool-compare
6224 Warn about boolean expression compared with an integer value different from
6225 @code{true}/@code{false}. For instance, the following comparison is
6226 always false:
6227 @smallexample
6228 int n = 5;
6229 @dots{}
6230 if ((n > 1) == 2) @{ @dots{} @}
6231 @end smallexample
6232 This warning is enabled by @option{-Wall}.
6233
6234 @item -Wbool-operation
6235 @opindex Wno-bool-operation
6236 @opindex Wbool-operation
6237 Warn about suspicious operations on expressions of a boolean type. For
6238 instance, bitwise negation of a boolean is very likely a bug in the program.
6239 For C, this warning also warns about incrementing or decrementing a boolean,
6240 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6241 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6242
6243 This warning is enabled by @option{-Wall}.
6244
6245 @item -Wduplicated-branches
6246 @opindex Wno-duplicated-branches
6247 @opindex Wduplicated-branches
6248 Warn when an if-else has identical branches. This warning detects cases like
6249 @smallexample
6250 if (p != NULL)
6251 return 0;
6252 else
6253 return 0;
6254 @end smallexample
6255 It doesn't warn when both branches contain just a null statement. This warning
6256 also warn for conditional operators:
6257 @smallexample
6258 int i = x ? *p : *p;
6259 @end smallexample
6260
6261 @item -Wduplicated-cond
6262 @opindex Wno-duplicated-cond
6263 @opindex Wduplicated-cond
6264 Warn about duplicated conditions in an if-else-if chain. For instance,
6265 warn for the following code:
6266 @smallexample
6267 if (p->q != NULL) @{ @dots{} @}
6268 else if (p->q != NULL) @{ @dots{} @}
6269 @end smallexample
6270
6271 @item -Wframe-address
6272 @opindex Wno-frame-address
6273 @opindex Wframe-address
6274 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6275 is called with an argument greater than 0. Such calls may return indeterminate
6276 values or crash the program. The warning is included in @option{-Wall}.
6277
6278 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6279 @opindex Wno-discarded-qualifiers
6280 @opindex Wdiscarded-qualifiers
6281 Do not warn if type qualifiers on pointers are being discarded.
6282 Typically, the compiler warns if a @code{const char *} variable is
6283 passed to a function that takes a @code{char *} parameter. This option
6284 can be used to suppress such a warning.
6285
6286 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6287 @opindex Wno-discarded-array-qualifiers
6288 @opindex Wdiscarded-array-qualifiers
6289 Do not warn if type qualifiers on arrays which are pointer targets
6290 are being discarded. Typically, the compiler warns if a
6291 @code{const int (*)[]} variable is passed to a function that
6292 takes a @code{int (*)[]} parameter. This option can be used to
6293 suppress such a warning.
6294
6295 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6296 @opindex Wno-incompatible-pointer-types
6297 @opindex Wincompatible-pointer-types
6298 Do not warn when there is a conversion between pointers that have incompatible
6299 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6300 which warns for pointer argument passing or assignment with different
6301 signedness.
6302
6303 @item -Wno-int-conversion @r{(C and Objective-C only)}
6304 @opindex Wno-int-conversion
6305 @opindex Wint-conversion
6306 Do not warn about incompatible integer to pointer and pointer to integer
6307 conversions. This warning is about implicit conversions; for explicit
6308 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6309 @option{-Wno-pointer-to-int-cast} may be used.
6310
6311 @item -Wno-div-by-zero
6312 @opindex Wno-div-by-zero
6313 @opindex Wdiv-by-zero
6314 Do not warn about compile-time integer division by zero. Floating-point
6315 division by zero is not warned about, as it can be a legitimate way of
6316 obtaining infinities and NaNs.
6317
6318 @item -Wsystem-headers
6319 @opindex Wsystem-headers
6320 @opindex Wno-system-headers
6321 @cindex warnings from system headers
6322 @cindex system headers, warnings from
6323 Print warning messages for constructs found in system header files.
6324 Warnings from system headers are normally suppressed, on the assumption
6325 that they usually do not indicate real problems and would only make the
6326 compiler output harder to read. Using this command-line option tells
6327 GCC to emit warnings from system headers as if they occurred in user
6328 code. However, note that using @option{-Wall} in conjunction with this
6329 option does @emph{not} warn about unknown pragmas in system
6330 headers---for that, @option{-Wunknown-pragmas} must also be used.
6331
6332 @item -Wtautological-compare
6333 @opindex Wtautological-compare
6334 @opindex Wno-tautological-compare
6335 Warn if a self-comparison always evaluates to true or false. This
6336 warning detects various mistakes such as:
6337 @smallexample
6338 int i = 1;
6339 @dots{}
6340 if (i > i) @{ @dots{} @}
6341 @end smallexample
6342
6343 This warning also warns about bitwise comparisons that always evaluate
6344 to true or false, for instance:
6345 @smallexample
6346 if ((a & 16) == 10) @{ @dots{} @}
6347 @end smallexample
6348 will always be false.
6349
6350 This warning is enabled by @option{-Wall}.
6351
6352 @item -Wtrampolines
6353 @opindex Wtrampolines
6354 @opindex Wno-trampolines
6355 Warn about trampolines generated for pointers to nested functions.
6356 A trampoline is a small piece of data or code that is created at run
6357 time on the stack when the address of a nested function is taken, and is
6358 used to call the nested function indirectly. For some targets, it is
6359 made up of data only and thus requires no special treatment. But, for
6360 most targets, it is made up of code and thus requires the stack to be
6361 made executable in order for the program to work properly.
6362
6363 @item -Wfloat-equal
6364 @opindex Wfloat-equal
6365 @opindex Wno-float-equal
6366 Warn if floating-point values are used in equality comparisons.
6367
6368 The idea behind this is that sometimes it is convenient (for the
6369 programmer) to consider floating-point values as approximations to
6370 infinitely precise real numbers. If you are doing this, then you need
6371 to compute (by analyzing the code, or in some other way) the maximum or
6372 likely maximum error that the computation introduces, and allow for it
6373 when performing comparisons (and when producing output, but that's a
6374 different problem). In particular, instead of testing for equality, you
6375 should check to see whether the two values have ranges that overlap; and
6376 this is done with the relational operators, so equality comparisons are
6377 probably mistaken.
6378
6379 @item -Wtraditional @r{(C and Objective-C only)}
6380 @opindex Wtraditional
6381 @opindex Wno-traditional
6382 Warn about certain constructs that behave differently in traditional and
6383 ISO C@. Also warn about ISO C constructs that have no traditional C
6384 equivalent, and/or problematic constructs that should be avoided.
6385
6386 @itemize @bullet
6387 @item
6388 Macro parameters that appear within string literals in the macro body.
6389 In traditional C macro replacement takes place within string literals,
6390 but in ISO C it does not.
6391
6392 @item
6393 In traditional C, some preprocessor directives did not exist.
6394 Traditional preprocessors only considered a line to be a directive
6395 if the @samp{#} appeared in column 1 on the line. Therefore
6396 @option{-Wtraditional} warns about directives that traditional C
6397 understands but ignores because the @samp{#} does not appear as the
6398 first character on the line. It also suggests you hide directives like
6399 @code{#pragma} not understood by traditional C by indenting them. Some
6400 traditional implementations do not recognize @code{#elif}, so this option
6401 suggests avoiding it altogether.
6402
6403 @item
6404 A function-like macro that appears without arguments.
6405
6406 @item
6407 The unary plus operator.
6408
6409 @item
6410 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6411 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6412 constants.) Note, these suffixes appear in macros defined in the system
6413 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6414 Use of these macros in user code might normally lead to spurious
6415 warnings, however GCC's integrated preprocessor has enough context to
6416 avoid warning in these cases.
6417
6418 @item
6419 A function declared external in one block and then used after the end of
6420 the block.
6421
6422 @item
6423 A @code{switch} statement has an operand of type @code{long}.
6424
6425 @item
6426 A non-@code{static} function declaration follows a @code{static} one.
6427 This construct is not accepted by some traditional C compilers.
6428
6429 @item
6430 The ISO type of an integer constant has a different width or
6431 signedness from its traditional type. This warning is only issued if
6432 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6433 typically represent bit patterns, are not warned about.
6434
6435 @item
6436 Usage of ISO string concatenation is detected.
6437
6438 @item
6439 Initialization of automatic aggregates.
6440
6441 @item
6442 Identifier conflicts with labels. Traditional C lacks a separate
6443 namespace for labels.
6444
6445 @item
6446 Initialization of unions. If the initializer is zero, the warning is
6447 omitted. This is done under the assumption that the zero initializer in
6448 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6449 initializer warnings and relies on default initialization to zero in the
6450 traditional C case.
6451
6452 @item
6453 Conversions by prototypes between fixed/floating-point values and vice
6454 versa. The absence of these prototypes when compiling with traditional
6455 C causes serious problems. This is a subset of the possible
6456 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6457
6458 @item
6459 Use of ISO C style function definitions. This warning intentionally is
6460 @emph{not} issued for prototype declarations or variadic functions
6461 because these ISO C features appear in your code when using
6462 libiberty's traditional C compatibility macros, @code{PARAMS} and
6463 @code{VPARAMS}. This warning is also bypassed for nested functions
6464 because that feature is already a GCC extension and thus not relevant to
6465 traditional C compatibility.
6466 @end itemize
6467
6468 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6469 @opindex Wtraditional-conversion
6470 @opindex Wno-traditional-conversion
6471 Warn if a prototype causes a type conversion that is different from what
6472 would happen to the same argument in the absence of a prototype. This
6473 includes conversions of fixed point to floating and vice versa, and
6474 conversions changing the width or signedness of a fixed-point argument
6475 except when the same as the default promotion.
6476
6477 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6478 @opindex Wdeclaration-after-statement
6479 @opindex Wno-declaration-after-statement
6480 Warn when a declaration is found after a statement in a block. This
6481 construct, known from C++, was introduced with ISO C99 and is by default
6482 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6483
6484 @item -Wshadow
6485 @opindex Wshadow
6486 @opindex Wno-shadow
6487 Warn whenever a local variable or type declaration shadows another
6488 variable, parameter, type, class member (in C++), or instance variable
6489 (in Objective-C) or whenever a built-in function is shadowed. Note
6490 that in C++, the compiler warns if a local variable shadows an
6491 explicit typedef, but not if it shadows a struct/class/enum.
6492 Same as @option{-Wshadow=global}.
6493
6494 @item -Wno-shadow-ivar @r{(Objective-C only)}
6495 @opindex Wno-shadow-ivar
6496 @opindex Wshadow-ivar
6497 Do not warn whenever a local variable shadows an instance variable in an
6498 Objective-C method.
6499
6500 @item -Wshadow=global
6501 @opindex Wshadow=local
6502 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6503
6504 @item -Wshadow=local
6505 @opindex Wshadow=local
6506 Warn when a local variable shadows another local variable or parameter.
6507 This warning is enabled by @option{-Wshadow=global}.
6508
6509 @item -Wshadow=compatible-local
6510 @opindex Wshadow=compatible-local
6511 Warn when a local variable shadows another local variable or parameter
6512 whose type is compatible with that of the shadowing variable. In C++,
6513 type compatibility here means the type of the shadowing variable can be
6514 converted to that of the shadowed variable. The creation of this flag
6515 (in addition to @option{-Wshadow=local}) is based on the idea that when
6516 a local variable shadows another one of incompatible type, it is most
6517 likely intentional, not a bug or typo, as shown in the following example:
6518
6519 @smallexample
6520 @group
6521 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6522 @{
6523 for (int i = 0; i < N; ++i)
6524 @{
6525 ...
6526 @}
6527 ...
6528 @}
6529 @end group
6530 @end smallexample
6531
6532 Since the two variable @code{i} in the example above have incompatible types,
6533 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6534 Because their types are incompatible, if a programmer accidentally uses one
6535 in place of the other, type checking will catch that and emit an error or
6536 warning. So not warning (about shadowing) in this case will not lead to
6537 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6538 possibly reduce the number of warnings triggered by intentional shadowing.
6539
6540 This warning is enabled by @option{-Wshadow=local}.
6541
6542 @item -Wlarger-than=@var{byte-size}
6543 @opindex Wlarger-than=
6544 @opindex Wlarger-than-@var{byte-size}
6545 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6546 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6547 Warnings controlled by the option can be disabled either by specifying
6548 @var{byte-size} of @samp{SIZE_MAX} or more or by
6549 @option{-Wno-larger-than}.
6550
6551 @item -Wno-larger-than
6552 @opindex Wno-larger-than
6553 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6554 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6555
6556 @item -Wframe-larger-than=@var{byte-size}
6557 @opindex Wframe-larger-than=
6558 @opindex Wno-frame-larger-than
6559 Warn if the size of a function frame exceeds @var{byte-size}.
6560 The computation done to determine the stack frame size is approximate
6561 and not conservative.
6562 The actual requirements may be somewhat greater than @var{byte-size}
6563 even if you do not get a warning. In addition, any space allocated
6564 via @code{alloca}, variable-length arrays, or related constructs
6565 is not included by the compiler when determining
6566 whether or not to issue a warning.
6567 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6568 Warnings controlled by the option can be disabled either by specifying
6569 @var{byte-size} of @samp{SIZE_MAX} or more or by
6570 @option{-Wno-frame-larger-than}.
6571
6572 @item -Wno-frame-larger-than
6573 @opindex Wno-frame-larger-than
6574 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6575 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6576
6577 @item -Wno-free-nonheap-object
6578 @opindex Wno-free-nonheap-object
6579 @opindex Wfree-nonheap-object
6580 Do not warn when attempting to free an object that was not allocated
6581 on the heap.
6582
6583 @item -Wstack-usage=@var{byte-size}
6584 @opindex Wstack-usage
6585 @opindex Wno-stack-usage
6586 Warn if the stack usage of a function might exceed @var{byte-size}.
6587 The computation done to determine the stack usage is conservative.
6588 Any space allocated via @code{alloca}, variable-length arrays, or related
6589 constructs is included by the compiler when determining whether or not to
6590 issue a warning.
6591
6592 The message is in keeping with the output of @option{-fstack-usage}.
6593
6594 @itemize
6595 @item
6596 If the stack usage is fully static but exceeds the specified amount, it's:
6597
6598 @smallexample
6599 warning: stack usage is 1120 bytes
6600 @end smallexample
6601 @item
6602 If the stack usage is (partly) dynamic but bounded, it's:
6603
6604 @smallexample
6605 warning: stack usage might be 1648 bytes
6606 @end smallexample
6607 @item
6608 If the stack usage is (partly) dynamic and not bounded, it's:
6609
6610 @smallexample
6611 warning: stack usage might be unbounded
6612 @end smallexample
6613 @end itemize
6614
6615 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6616 Warnings controlled by the option can be disabled either by specifying
6617 @var{byte-size} of @samp{SIZE_MAX} or more or by
6618 @option{-Wno-stack-usage}.
6619
6620 @item -Wno-stack-usage
6621 @opindex Wno-stack-usage
6622 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6623 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6624
6625 @item -Wunsafe-loop-optimizations
6626 @opindex Wunsafe-loop-optimizations
6627 @opindex Wno-unsafe-loop-optimizations
6628 Warn if the loop cannot be optimized because the compiler cannot
6629 assume anything on the bounds of the loop indices. With
6630 @option{-funsafe-loop-optimizations} warn if the compiler makes
6631 such assumptions.
6632
6633 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6634 @opindex Wno-pedantic-ms-format
6635 @opindex Wpedantic-ms-format
6636 When used in combination with @option{-Wformat}
6637 and @option{-pedantic} without GNU extensions, this option
6638 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6639 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6640 which depend on the MS runtime.
6641
6642 @item -Waligned-new
6643 @opindex Waligned-new
6644 @opindex Wno-aligned-new
6645 Warn about a new-expression of a type that requires greater alignment
6646 than the @code{alignof(std::max_align_t)} but uses an allocation
6647 function without an explicit alignment parameter. This option is
6648 enabled by @option{-Wall}.
6649
6650 Normally this only warns about global allocation functions, but
6651 @option{-Waligned-new=all} also warns about class member allocation
6652 functions.
6653
6654 @item -Wplacement-new
6655 @itemx -Wplacement-new=@var{n}
6656 @opindex Wplacement-new
6657 @opindex Wno-placement-new
6658 Warn about placement new expressions with undefined behavior, such as
6659 constructing an object in a buffer that is smaller than the type of
6660 the object. For example, the placement new expression below is diagnosed
6661 because it attempts to construct an array of 64 integers in a buffer only
6662 64 bytes large.
6663 @smallexample
6664 char buf [64];
6665 new (buf) int[64];
6666 @end smallexample
6667 This warning is enabled by default.
6668
6669 @table @gcctabopt
6670 @item -Wplacement-new=1
6671 This is the default warning level of @option{-Wplacement-new}. At this
6672 level the warning is not issued for some strictly undefined constructs that
6673 GCC allows as extensions for compatibility with legacy code. For example,
6674 the following @code{new} expression is not diagnosed at this level even
6675 though it has undefined behavior according to the C++ standard because
6676 it writes past the end of the one-element array.
6677 @smallexample
6678 struct S @{ int n, a[1]; @};
6679 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6680 new (s->a)int [32]();
6681 @end smallexample
6682
6683 @item -Wplacement-new=2
6684 At this level, in addition to diagnosing all the same constructs as at level
6685 1, a diagnostic is also issued for placement new expressions that construct
6686 an object in the last member of structure whose type is an array of a single
6687 element and whose size is less than the size of the object being constructed.
6688 While the previous example would be diagnosed, the following construct makes
6689 use of the flexible member array extension to avoid the warning at level 2.
6690 @smallexample
6691 struct S @{ int n, a[]; @};
6692 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6693 new (s->a)int [32]();
6694 @end smallexample
6695
6696 @end table
6697
6698 @item -Wpointer-arith
6699 @opindex Wpointer-arith
6700 @opindex Wno-pointer-arith
6701 Warn about anything that depends on the ``size of'' a function type or
6702 of @code{void}. GNU C assigns these types a size of 1, for
6703 convenience in calculations with @code{void *} pointers and pointers
6704 to functions. In C++, warn also when an arithmetic operation involves
6705 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6706
6707 @item -Wpointer-compare
6708 @opindex Wpointer-compare
6709 @opindex Wno-pointer-compare
6710 Warn if a pointer is compared with a zero character constant. This usually
6711 means that the pointer was meant to be dereferenced. For example:
6712
6713 @smallexample
6714 const char *p = foo ();
6715 if (p == '\0')
6716 return 42;
6717 @end smallexample
6718
6719 Note that the code above is invalid in C++11.
6720
6721 This warning is enabled by default.
6722
6723 @item -Wtype-limits
6724 @opindex Wtype-limits
6725 @opindex Wno-type-limits
6726 Warn if a comparison is always true or always false due to the limited
6727 range of the data type, but do not warn for constant expressions. For
6728 example, warn if an unsigned variable is compared against zero with
6729 @code{<} or @code{>=}. This warning is also enabled by
6730 @option{-Wextra}.
6731
6732 @item -Wabsolute-value @r{(C and Objective-C only)}
6733 @opindex Wabsolute-value
6734 @opindex Wno-absolute-value
6735 Warn for calls to standard functions that compute the absolute value
6736 of an argument when a more appropriate standard function is available.
6737 For example, calling @code{abs(3.14)} triggers the warning because the
6738 appropriate function to call to compute the absolute value of a double
6739 argument is @code{fabs}. The option also triggers warnings when the
6740 argument in a call to such a function has an unsigned type. This
6741 warning can be suppressed with an explicit type cast and it is also
6742 enabled by @option{-Wextra}.
6743
6744 @include cppwarnopts.texi
6745
6746 @item -Wbad-function-cast @r{(C and Objective-C only)}
6747 @opindex Wbad-function-cast
6748 @opindex Wno-bad-function-cast
6749 Warn when a function call is cast to a non-matching type.
6750 For example, warn if a call to a function returning an integer type
6751 is cast to a pointer type.
6752
6753 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6754 @opindex Wc90-c99-compat
6755 @opindex Wno-c90-c99-compat
6756 Warn about features not present in ISO C90, but present in ISO C99.
6757 For instance, warn about use of variable length arrays, @code{long long}
6758 type, @code{bool} type, compound literals, designated initializers, and so
6759 on. This option is independent of the standards mode. Warnings are disabled
6760 in the expression that follows @code{__extension__}.
6761
6762 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6763 @opindex Wc99-c11-compat
6764 @opindex Wno-c99-c11-compat
6765 Warn about features not present in ISO C99, but present in ISO C11.
6766 For instance, warn about use of anonymous structures and unions,
6767 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6768 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6769 and so on. This option is independent of the standards mode. Warnings are
6770 disabled in the expression that follows @code{__extension__}.
6771
6772 @item -Wc++-compat @r{(C and Objective-C only)}
6773 @opindex Wc++-compat
6774 @opindex Wno-c++-compat
6775 Warn about ISO C constructs that are outside of the common subset of
6776 ISO C and ISO C++, e.g.@: request for implicit conversion from
6777 @code{void *} to a pointer to non-@code{void} type.
6778
6779 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6780 @opindex Wc++11-compat
6781 @opindex Wno-c++11-compat
6782 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6783 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6784 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6785 enabled by @option{-Wall}.
6786
6787 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6788 @opindex Wc++14-compat
6789 @opindex Wno-c++14-compat
6790 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6791 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6792
6793 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6794 @opindex Wc++17-compat
6795 @opindex Wno-c++17-compat
6796 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6797 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6798
6799 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
6800 @opindex Wc++20-compat
6801 @opindex Wno-c++20-compat
6802 Warn about C++ constructs whose meaning differs between ISO C++ 2017
6803 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
6804
6805 @item -Wcast-qual
6806 @opindex Wcast-qual
6807 @opindex Wno-cast-qual
6808 Warn whenever a pointer is cast so as to remove a type qualifier from
6809 the target type. For example, warn if a @code{const char *} is cast
6810 to an ordinary @code{char *}.
6811
6812 Also warn when making a cast that introduces a type qualifier in an
6813 unsafe way. For example, casting @code{char **} to @code{const char **}
6814 is unsafe, as in this example:
6815
6816 @smallexample
6817 /* p is char ** value. */
6818 const char **q = (const char **) p;
6819 /* Assignment of readonly string to const char * is OK. */
6820 *q = "string";
6821 /* Now char** pointer points to read-only memory. */
6822 **p = 'b';
6823 @end smallexample
6824
6825 @item -Wcast-align
6826 @opindex Wcast-align
6827 @opindex Wno-cast-align
6828 Warn whenever a pointer is cast such that the required alignment of the
6829 target is increased. For example, warn if a @code{char *} is cast to
6830 an @code{int *} on machines where integers can only be accessed at
6831 two- or four-byte boundaries.
6832
6833 @item -Wcast-align=strict
6834 @opindex Wcast-align=strict
6835 Warn whenever a pointer is cast such that the required alignment of the
6836 target is increased. For example, warn if a @code{char *} is cast to
6837 an @code{int *} regardless of the target machine.
6838
6839 @item -Wcast-function-type
6840 @opindex Wcast-function-type
6841 @opindex Wno-cast-function-type
6842 Warn when a function pointer is cast to an incompatible function pointer.
6843 In a cast involving function types with a variable argument list only
6844 the types of initial arguments that are provided are considered.
6845 Any parameter of pointer-type matches any other pointer-type. Any benign
6846 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6847 on ILP32 targets. Likewise type qualifiers are ignored. The function
6848 type @code{void (*) (void)} is special and matches everything, which can
6849 be used to suppress this warning.
6850 In a cast involving pointer to member types this warning warns whenever
6851 the type cast is changing the pointer to member type.
6852 This warning is enabled by @option{-Wextra}.
6853
6854 @item -Wwrite-strings
6855 @opindex Wwrite-strings
6856 @opindex Wno-write-strings
6857 When compiling C, give string constants the type @code{const
6858 char[@var{length}]} so that copying the address of one into a
6859 non-@code{const} @code{char *} pointer produces a warning. These
6860 warnings help you find at compile time code that can try to write
6861 into a string constant, but only if you have been very careful about
6862 using @code{const} in declarations and prototypes. Otherwise, it is
6863 just a nuisance. This is why we did not make @option{-Wall} request
6864 these warnings.
6865
6866 When compiling C++, warn about the deprecated conversion from string
6867 literals to @code{char *}. This warning is enabled by default for C++
6868 programs.
6869
6870 @item -Wcatch-value
6871 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6872 @opindex Wcatch-value
6873 @opindex Wno-catch-value
6874 Warn about catch handlers that do not catch via reference.
6875 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6876 warn about polymorphic class types that are caught by value.
6877 With @option{-Wcatch-value=2} warn about all class types that are caught
6878 by value. With @option{-Wcatch-value=3} warn about all types that are
6879 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6880
6881 @item -Wclobbered
6882 @opindex Wclobbered
6883 @opindex Wno-clobbered
6884 Warn for variables that might be changed by @code{longjmp} or
6885 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6886
6887 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6888 @opindex Wconditionally-supported
6889 @opindex Wno-conditionally-supported
6890 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6891
6892 @item -Wconversion
6893 @opindex Wconversion
6894 @opindex Wno-conversion
6895 Warn for implicit conversions that may alter a value. This includes
6896 conversions between real and integer, like @code{abs (x)} when
6897 @code{x} is @code{double}; conversions between signed and unsigned,
6898 like @code{unsigned ui = -1}; and conversions to smaller types, like
6899 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6900 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6901 changed by the conversion like in @code{abs (2.0)}. Warnings about
6902 conversions between signed and unsigned integers can be disabled by
6903 using @option{-Wno-sign-conversion}.
6904
6905 For C++, also warn for confusing overload resolution for user-defined
6906 conversions; and conversions that never use a type conversion
6907 operator: conversions to @code{void}, the same type, a base class or a
6908 reference to them. Warnings about conversions between signed and
6909 unsigned integers are disabled by default in C++ unless
6910 @option{-Wsign-conversion} is explicitly enabled.
6911
6912 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6913 @opindex Wconversion-null
6914 @opindex Wno-conversion-null
6915 Do not warn for conversions between @code{NULL} and non-pointer
6916 types. @option{-Wconversion-null} is enabled by default.
6917
6918 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6919 @opindex Wzero-as-null-pointer-constant
6920 @opindex Wno-zero-as-null-pointer-constant
6921 Warn when a literal @samp{0} is used as null pointer constant. This can
6922 be useful to facilitate the conversion to @code{nullptr} in C++11.
6923
6924 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6925 @opindex Wsubobject-linkage
6926 @opindex Wno-subobject-linkage
6927 Warn if a class type has a base or a field whose type uses the anonymous
6928 namespace or depends on a type with no linkage. If a type A depends on
6929 a type B with no or internal linkage, defining it in multiple
6930 translation units would be an ODR violation because the meaning of B
6931 is different in each translation unit. If A only appears in a single
6932 translation unit, the best way to silence the warning is to give it
6933 internal linkage by putting it in an anonymous namespace as well. The
6934 compiler doesn't give this warning for types defined in the main .C
6935 file, as those are unlikely to have multiple definitions.
6936 @option{-Wsubobject-linkage} is enabled by default.
6937
6938 @item -Wdangling-else
6939 @opindex Wdangling-else
6940 @opindex Wno-dangling-else
6941 Warn about constructions where there may be confusion to which
6942 @code{if} statement an @code{else} branch belongs. Here is an example of
6943 such a case:
6944
6945 @smallexample
6946 @group
6947 @{
6948 if (a)
6949 if (b)
6950 foo ();
6951 else
6952 bar ();
6953 @}
6954 @end group
6955 @end smallexample
6956
6957 In C/C++, every @code{else} branch belongs to the innermost possible
6958 @code{if} statement, which in this example is @code{if (b)}. This is
6959 often not what the programmer expected, as illustrated in the above
6960 example by indentation the programmer chose. When there is the
6961 potential for this confusion, GCC issues a warning when this flag
6962 is specified. To eliminate the warning, add explicit braces around
6963 the innermost @code{if} statement so there is no way the @code{else}
6964 can belong to the enclosing @code{if}. The resulting code
6965 looks like this:
6966
6967 @smallexample
6968 @group
6969 @{
6970 if (a)
6971 @{
6972 if (b)
6973 foo ();
6974 else
6975 bar ();
6976 @}
6977 @}
6978 @end group
6979 @end smallexample
6980
6981 This warning is enabled by @option{-Wparentheses}.
6982
6983 @item -Wdate-time
6984 @opindex Wdate-time
6985 @opindex Wno-date-time
6986 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6987 are encountered as they might prevent bit-wise-identical reproducible
6988 compilations.
6989
6990 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6991 @opindex Wdelete-incomplete
6992 @opindex Wno-delete-incomplete
6993 Warn when deleting a pointer to incomplete type, which may cause
6994 undefined behavior at runtime. This warning is enabled by default.
6995
6996 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6997 @opindex Wuseless-cast
6998 @opindex Wno-useless-cast
6999 Warn when an expression is casted to its own type.
7000
7001 @item -Wempty-body
7002 @opindex Wempty-body
7003 @opindex Wno-empty-body
7004 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
7005 while} statement. This warning is also enabled by @option{-Wextra}.
7006
7007 @item -Wenum-compare
7008 @opindex Wenum-compare
7009 @opindex Wno-enum-compare
7010 Warn about a comparison between values of different enumerated types.
7011 In C++ enumerated type mismatches in conditional expressions are also
7012 diagnosed and the warning is enabled by default. In C this warning is
7013 enabled by @option{-Wall}.
7014
7015 @item -Wextra-semi @r{(C++, Objective-C++ only)}
7016 @opindex Wextra-semi
7017 @opindex Wno-extra-semi
7018 Warn about redundant semicolon after in-class function definition.
7019
7020 @item -Wjump-misses-init @r{(C, Objective-C only)}
7021 @opindex Wjump-misses-init
7022 @opindex Wno-jump-misses-init
7023 Warn if a @code{goto} statement or a @code{switch} statement jumps
7024 forward across the initialization of a variable, or jumps backward to a
7025 label after the variable has been initialized. This only warns about
7026 variables that are initialized when they are declared. This warning is
7027 only supported for C and Objective-C; in C++ this sort of branch is an
7028 error in any case.
7029
7030 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7031 can be disabled with the @option{-Wno-jump-misses-init} option.
7032
7033 @item -Wsign-compare
7034 @opindex Wsign-compare
7035 @opindex Wno-sign-compare
7036 @cindex warning for comparison of signed and unsigned values
7037 @cindex comparison of signed and unsigned values, warning
7038 @cindex signed and unsigned values, comparison warning
7039 Warn when a comparison between signed and unsigned values could produce
7040 an incorrect result when the signed value is converted to unsigned.
7041 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7042 also enabled by @option{-Wextra}.
7043
7044 @item -Wsign-conversion
7045 @opindex Wsign-conversion
7046 @opindex Wno-sign-conversion
7047 Warn for implicit conversions that may change the sign of an integer
7048 value, like assigning a signed integer expression to an unsigned
7049 integer variable. An explicit cast silences the warning. In C, this
7050 option is enabled also by @option{-Wconversion}.
7051
7052 @item -Wfloat-conversion
7053 @opindex Wfloat-conversion
7054 @opindex Wno-float-conversion
7055 Warn for implicit conversions that reduce the precision of a real value.
7056 This includes conversions from real to integer, and from higher precision
7057 real to lower precision real values. This option is also enabled by
7058 @option{-Wconversion}.
7059
7060 @item -Wno-scalar-storage-order
7061 @opindex Wno-scalar-storage-order
7062 @opindex Wscalar-storage-order
7063 Do not warn on suspicious constructs involving reverse scalar storage order.
7064
7065 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7066 @opindex Wsized-deallocation
7067 @opindex Wno-sized-deallocation
7068 Warn about a definition of an unsized deallocation function
7069 @smallexample
7070 void operator delete (void *) noexcept;
7071 void operator delete[] (void *) noexcept;
7072 @end smallexample
7073 without a definition of the corresponding sized deallocation function
7074 @smallexample
7075 void operator delete (void *, std::size_t) noexcept;
7076 void operator delete[] (void *, std::size_t) noexcept;
7077 @end smallexample
7078 or vice versa. Enabled by @option{-Wextra} along with
7079 @option{-fsized-deallocation}.
7080
7081 @item -Wsizeof-pointer-div
7082 @opindex Wsizeof-pointer-div
7083 @opindex Wno-sizeof-pointer-div
7084 Warn for suspicious divisions of two sizeof expressions that divide
7085 the pointer size by the element size, which is the usual way to compute
7086 the array size but won't work out correctly with pointers. This warning
7087 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7088 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7089
7090 @item -Wsizeof-pointer-memaccess
7091 @opindex Wsizeof-pointer-memaccess
7092 @opindex Wno-sizeof-pointer-memaccess
7093 Warn for suspicious length parameters to certain string and memory built-in
7094 functions if the argument uses @code{sizeof}. This warning triggers for
7095 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7096 an array, but a pointer, and suggests a possible fix, or about
7097 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7098 also warns about calls to bounded string copy functions like @code{strncat}
7099 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7100 the source array. For example, in the following function the call to
7101 @code{strncat} specifies the size of the source string as the bound. That
7102 is almost certainly a mistake and so the call is diagnosed.
7103 @smallexample
7104 void make_file (const char *name)
7105 @{
7106 char path[PATH_MAX];
7107 strncpy (path, name, sizeof path - 1);
7108 strncat (path, ".text", sizeof ".text");
7109 @dots{}
7110 @}
7111 @end smallexample
7112
7113 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7114
7115 @item -Wsizeof-array-argument
7116 @opindex Wsizeof-array-argument
7117 @opindex Wno-sizeof-array-argument
7118 Warn when the @code{sizeof} operator is applied to a parameter that is
7119 declared as an array in a function definition. This warning is enabled by
7120 default for C and C++ programs.
7121
7122 @item -Wmemset-elt-size
7123 @opindex Wmemset-elt-size
7124 @opindex Wno-memset-elt-size
7125 Warn for suspicious calls to the @code{memset} built-in function, if the
7126 first argument references an array, and the third argument is a number
7127 equal to the number of elements, but not equal to the size of the array
7128 in memory. This indicates that the user has omitted a multiplication by
7129 the element size. This warning is enabled by @option{-Wall}.
7130
7131 @item -Wmemset-transposed-args
7132 @opindex Wmemset-transposed-args
7133 @opindex Wno-memset-transposed-args
7134 Warn for suspicious calls to the @code{memset} built-in function where
7135 the second argument is not zero and the third argument is zero. For
7136 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7137 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7138 is only emitted if the third argument is a literal zero. Otherwise, if
7139 it is an expression that is folded to zero, or a cast of zero to some
7140 type, it is far less likely that the arguments have been mistakenly
7141 transposed and no warning is emitted. This warning is enabled
7142 by @option{-Wall}.
7143
7144 @item -Waddress
7145 @opindex Waddress
7146 @opindex Wno-address
7147 Warn about suspicious uses of memory addresses. These include using
7148 the address of a function in a conditional expression, such as
7149 @code{void func(void); if (func)}, and comparisons against the memory
7150 address of a string literal, such as @code{if (x == "abc")}. Such
7151 uses typically indicate a programmer error: the address of a function
7152 always evaluates to true, so their use in a conditional usually
7153 indicate that the programmer forgot the parentheses in a function
7154 call; and comparisons against string literals result in unspecified
7155 behavior and are not portable in C, so they usually indicate that the
7156 programmer intended to use @code{strcmp}. This warning is enabled by
7157 @option{-Wall}.
7158
7159 @item -Waddress-of-packed-member
7160 @opindex Waddress-of-packed-member
7161 @opindex Wno-address-of-packed-member
7162 Warn when the address of packed member of struct or union is taken,
7163 which usually results in an unaligned pointer value. This is
7164 enabled by default.
7165
7166 @item -Wlogical-op
7167 @opindex Wlogical-op
7168 @opindex Wno-logical-op
7169 Warn about suspicious uses of logical operators in expressions.
7170 This includes using logical operators in contexts where a
7171 bit-wise operator is likely to be expected. Also warns when
7172 the operands of a logical operator are the same:
7173 @smallexample
7174 extern int a;
7175 if (a < 0 && a < 0) @{ @dots{} @}
7176 @end smallexample
7177
7178 @item -Wlogical-not-parentheses
7179 @opindex Wlogical-not-parentheses
7180 @opindex Wno-logical-not-parentheses
7181 Warn about logical not used on the left hand side operand of a comparison.
7182 This option does not warn if the right operand is considered to be a boolean
7183 expression. Its purpose is to detect suspicious code like the following:
7184 @smallexample
7185 int a;
7186 @dots{}
7187 if (!a > 1) @{ @dots{} @}
7188 @end smallexample
7189
7190 It is possible to suppress the warning by wrapping the LHS into
7191 parentheses:
7192 @smallexample
7193 if ((!a) > 1) @{ @dots{} @}
7194 @end smallexample
7195
7196 This warning is enabled by @option{-Wall}.
7197
7198 @item -Waggregate-return
7199 @opindex Waggregate-return
7200 @opindex Wno-aggregate-return
7201 Warn if any functions that return structures or unions are defined or
7202 called. (In languages where you can return an array, this also elicits
7203 a warning.)
7204
7205 @item -Wno-aggressive-loop-optimizations
7206 @opindex Wno-aggressive-loop-optimizations
7207 @opindex Waggressive-loop-optimizations
7208 Warn if in a loop with constant number of iterations the compiler detects
7209 undefined behavior in some statement during one or more of the iterations.
7210
7211 @item -Wno-attributes
7212 @opindex Wno-attributes
7213 @opindex Wattributes
7214 Do not warn if an unexpected @code{__attribute__} is used, such as
7215 unrecognized attributes, function attributes applied to variables,
7216 etc. This does not stop errors for incorrect use of supported
7217 attributes.
7218
7219 @item -Wno-builtin-declaration-mismatch
7220 @opindex Wno-builtin-declaration-mismatch
7221 @opindex Wbuiltin-declaration-mismatch
7222 Warn if a built-in function is declared with an incompatible signature
7223 or as a non-function, or when a built-in function declared with a type
7224 that does not include a prototype is called with arguments whose promoted
7225 types do not match those expected by the function. When @option{-Wextra}
7226 is specified, also warn when a built-in function that takes arguments is
7227 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7228 warning is enabled by default. To avoid the warning include the appropriate
7229 header to bring the prototypes of built-in functions into scope.
7230
7231 For example, the call to @code{memset} below is diagnosed by the warning
7232 because the function expects a value of type @code{size_t} as its argument
7233 but the type of @code{32} is @code{int}. With @option{-Wextra},
7234 the declaration of the function is diagnosed as well.
7235 @smallexample
7236 extern void* memset ();
7237 void f (void *d)
7238 @{
7239 memset (d, '\0', 32);
7240 @}
7241 @end smallexample
7242
7243 @item -Wno-builtin-macro-redefined
7244 @opindex Wno-builtin-macro-redefined
7245 @opindex Wbuiltin-macro-redefined
7246 Do not warn if certain built-in macros are redefined. This suppresses
7247 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7248 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7249
7250 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7251 @opindex Wstrict-prototypes
7252 @opindex Wno-strict-prototypes
7253 Warn if a function is declared or defined without specifying the
7254 argument types. (An old-style function definition is permitted without
7255 a warning if preceded by a declaration that specifies the argument
7256 types.)
7257
7258 @item -Wold-style-declaration @r{(C and Objective-C only)}
7259 @opindex Wold-style-declaration
7260 @opindex Wno-old-style-declaration
7261 Warn for obsolescent usages, according to the C Standard, in a
7262 declaration. For example, warn if storage-class specifiers like
7263 @code{static} are not the first things in a declaration. This warning
7264 is also enabled by @option{-Wextra}.
7265
7266 @item -Wold-style-definition @r{(C and Objective-C only)}
7267 @opindex Wold-style-definition
7268 @opindex Wno-old-style-definition
7269 Warn if an old-style function definition is used. A warning is given
7270 even if there is a previous prototype.
7271
7272 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7273 @opindex Wmissing-parameter-type
7274 @opindex Wno-missing-parameter-type
7275 A function parameter is declared without a type specifier in K&R-style
7276 functions:
7277
7278 @smallexample
7279 void foo(bar) @{ @}
7280 @end smallexample
7281
7282 This warning is also enabled by @option{-Wextra}.
7283
7284 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7285 @opindex Wmissing-prototypes
7286 @opindex Wno-missing-prototypes
7287 Warn if a global function is defined without a previous prototype
7288 declaration. This warning is issued even if the definition itself
7289 provides a prototype. Use this option to detect global functions
7290 that do not have a matching prototype declaration in a header file.
7291 This option is not valid for C++ because all function declarations
7292 provide prototypes and a non-matching declaration declares an
7293 overload rather than conflict with an earlier declaration.
7294 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7295
7296 @item -Wmissing-declarations
7297 @opindex Wmissing-declarations
7298 @opindex Wno-missing-declarations
7299 Warn if a global function is defined without a previous declaration.
7300 Do so even if the definition itself provides a prototype.
7301 Use this option to detect global functions that are not declared in
7302 header files. In C, no warnings are issued for functions with previous
7303 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7304 missing prototypes. In C++, no warnings are issued for function templates,
7305 or for inline functions, or for functions in anonymous namespaces.
7306
7307 @item -Wmissing-field-initializers
7308 @opindex Wmissing-field-initializers
7309 @opindex Wno-missing-field-initializers
7310 @opindex W
7311 @opindex Wextra
7312 @opindex Wno-extra
7313 Warn if a structure's initializer has some fields missing. For
7314 example, the following code causes such a warning, because
7315 @code{x.h} is implicitly zero:
7316
7317 @smallexample
7318 struct s @{ int f, g, h; @};
7319 struct s x = @{ 3, 4 @};
7320 @end smallexample
7321
7322 This option does not warn about designated initializers, so the following
7323 modification does not trigger a warning:
7324
7325 @smallexample
7326 struct s @{ int f, g, h; @};
7327 struct s x = @{ .f = 3, .g = 4 @};
7328 @end smallexample
7329
7330 In C this option does not warn about the universal zero initializer
7331 @samp{@{ 0 @}}:
7332
7333 @smallexample
7334 struct s @{ int f, g, h; @};
7335 struct s x = @{ 0 @};
7336 @end smallexample
7337
7338 Likewise, in C++ this option does not warn about the empty @{ @}
7339 initializer, for example:
7340
7341 @smallexample
7342 struct s @{ int f, g, h; @};
7343 s x = @{ @};
7344 @end smallexample
7345
7346 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7347 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7348
7349 @item -Wno-multichar
7350 @opindex Wno-multichar
7351 @opindex Wmultichar
7352 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7353 Usually they indicate a typo in the user's code, as they have
7354 implementation-defined values, and should not be used in portable code.
7355
7356 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7357 @opindex Wnormalized=
7358 @opindex Wnormalized
7359 @opindex Wno-normalized
7360 @cindex NFC
7361 @cindex NFKC
7362 @cindex character set, input normalization
7363 In ISO C and ISO C++, two identifiers are different if they are
7364 different sequences of characters. However, sometimes when characters
7365 outside the basic ASCII character set are used, you can have two
7366 different character sequences that look the same. To avoid confusion,
7367 the ISO 10646 standard sets out some @dfn{normalization rules} which
7368 when applied ensure that two sequences that look the same are turned into
7369 the same sequence. GCC can warn you if you are using identifiers that
7370 have not been normalized; this option controls that warning.
7371
7372 There are four levels of warning supported by GCC@. The default is
7373 @option{-Wnormalized=nfc}, which warns about any identifier that is
7374 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7375 recommended form for most uses. It is equivalent to
7376 @option{-Wnormalized}.
7377
7378 Unfortunately, there are some characters allowed in identifiers by
7379 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7380 identifiers. That is, there's no way to use these symbols in portable
7381 ISO C or C++ and have all your identifiers in NFC@.
7382 @option{-Wnormalized=id} suppresses the warning for these characters.
7383 It is hoped that future versions of the standards involved will correct
7384 this, which is why this option is not the default.
7385
7386 You can switch the warning off for all characters by writing
7387 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7388 only do this if you are using some other normalization scheme (like
7389 ``D''), because otherwise you can easily create bugs that are
7390 literally impossible to see.
7391
7392 Some characters in ISO 10646 have distinct meanings but look identical
7393 in some fonts or display methodologies, especially once formatting has
7394 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7395 LETTER N'', displays just like a regular @code{n} that has been
7396 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7397 normalization scheme to convert all these into a standard form as
7398 well, and GCC warns if your code is not in NFKC if you use
7399 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7400 about every identifier that contains the letter O because it might be
7401 confused with the digit 0, and so is not the default, but may be
7402 useful as a local coding convention if the programming environment
7403 cannot be fixed to display these characters distinctly.
7404
7405 @item -Wno-attribute-warning
7406 @opindex Wno-attribute-warning
7407 @opindex Wattribute-warning
7408 Do not warn about usage of functions (@pxref{Function Attributes})
7409 declared with @code{warning} attribute. By default, this warning is
7410 enabled. @option{-Wno-attribute-warning} can be used to disable the
7411 warning or @option{-Wno-error=attribute-warning} can be used to
7412 disable the error when compiled with @option{-Werror} flag.
7413
7414 @item -Wno-deprecated
7415 @opindex Wno-deprecated
7416 @opindex Wdeprecated
7417 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7418
7419 @item -Wno-deprecated-declarations
7420 @opindex Wno-deprecated-declarations
7421 @opindex Wdeprecated-declarations
7422 Do not warn about uses of functions (@pxref{Function Attributes}),
7423 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7424 Attributes}) marked as deprecated by using the @code{deprecated}
7425 attribute.
7426
7427 @item -Wno-overflow
7428 @opindex Wno-overflow
7429 @opindex Woverflow
7430 Do not warn about compile-time overflow in constant expressions.
7431
7432 @item -Wno-odr
7433 @opindex Wno-odr
7434 @opindex Wodr
7435 Warn about One Definition Rule violations during link-time optimization.
7436 Enabled by default.
7437
7438 @item -Wopenmp-simd
7439 @opindex Wopenmp-simd
7440 @opindex Wno-openmp-simd
7441 Warn if the vectorizer cost model overrides the OpenMP
7442 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7443 option can be used to relax the cost model.
7444
7445 @item -Woverride-init @r{(C and Objective-C only)}
7446 @opindex Woverride-init
7447 @opindex Wno-override-init
7448 @opindex W
7449 @opindex Wextra
7450 @opindex Wno-extra
7451 Warn if an initialized field without side effects is overridden when
7452 using designated initializers (@pxref{Designated Inits, , Designated
7453 Initializers}).
7454
7455 This warning is included in @option{-Wextra}. To get other
7456 @option{-Wextra} warnings without this one, use @option{-Wextra
7457 -Wno-override-init}.
7458
7459 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7460 @opindex Woverride-init-side-effects
7461 @opindex Wno-override-init-side-effects
7462 Warn if an initialized field with side effects is overridden when
7463 using designated initializers (@pxref{Designated Inits, , Designated
7464 Initializers}). This warning is enabled by default.
7465
7466 @item -Wpacked
7467 @opindex Wpacked
7468 @opindex Wno-packed
7469 Warn if a structure is given the packed attribute, but the packed
7470 attribute has no effect on the layout or size of the structure.
7471 Such structures may be mis-aligned for little benefit. For
7472 instance, in this code, the variable @code{f.x} in @code{struct bar}
7473 is misaligned even though @code{struct bar} does not itself
7474 have the packed attribute:
7475
7476 @smallexample
7477 @group
7478 struct foo @{
7479 int x;
7480 char a, b, c, d;
7481 @} __attribute__((packed));
7482 struct bar @{
7483 char z;
7484 struct foo f;
7485 @};
7486 @end group
7487 @end smallexample
7488
7489 @item -Wpacked-bitfield-compat
7490 @opindex Wpacked-bitfield-compat
7491 @opindex Wno-packed-bitfield-compat
7492 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7493 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7494 the change can lead to differences in the structure layout. GCC
7495 informs you when the offset of such a field has changed in GCC 4.4.
7496 For example there is no longer a 4-bit padding between field @code{a}
7497 and @code{b} in this structure:
7498
7499 @smallexample
7500 struct foo
7501 @{
7502 char a:4;
7503 char b:8;
7504 @} __attribute__ ((packed));
7505 @end smallexample
7506
7507 This warning is enabled by default. Use
7508 @option{-Wno-packed-bitfield-compat} to disable this warning.
7509
7510 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7511 @opindex Wpacked-not-aligned
7512 @opindex Wno-packed-not-aligned
7513 Warn if a structure field with explicitly specified alignment in a
7514 packed struct or union is misaligned. For example, a warning will
7515 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7516 'struct S' is less than 8}, in this code:
7517
7518 @smallexample
7519 @group
7520 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7521 struct __attribute__ ((packed)) S @{
7522 struct S8 s8;
7523 @};
7524 @end group
7525 @end smallexample
7526
7527 This warning is enabled by @option{-Wall}.
7528
7529 @item -Wpadded
7530 @opindex Wpadded
7531 @opindex Wno-padded
7532 Warn if padding is included in a structure, either to align an element
7533 of the structure or to align the whole structure. Sometimes when this
7534 happens it is possible to rearrange the fields of the structure to
7535 reduce the padding and so make the structure smaller.
7536
7537 @item -Wredundant-decls
7538 @opindex Wredundant-decls
7539 @opindex Wno-redundant-decls
7540 Warn if anything is declared more than once in the same scope, even in
7541 cases where multiple declaration is valid and changes nothing.
7542
7543 @item -Wno-restrict
7544 @opindex Wrestrict
7545 @opindex Wno-restrict
7546 Warn when an object referenced by a @code{restrict}-qualified parameter
7547 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7548 argument, or when copies between such objects overlap. For example,
7549 the call to the @code{strcpy} function below attempts to truncate the string
7550 by replacing its initial characters with the last four. However, because
7551 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7552 the call is diagnosed.
7553
7554 @smallexample
7555 void foo (void)
7556 @{
7557 char a[] = "abcd1234";
7558 strcpy (a, a + 4);
7559 @dots{}
7560 @}
7561 @end smallexample
7562 The @option{-Wrestrict} option detects some instances of simple overlap
7563 even without optimization but works best at @option{-O2} and above. It
7564 is included in @option{-Wall}.
7565
7566 @item -Wnested-externs @r{(C and Objective-C only)}
7567 @opindex Wnested-externs
7568 @opindex Wno-nested-externs
7569 Warn if an @code{extern} declaration is encountered within a function.
7570
7571 @item -Wno-inherited-variadic-ctor
7572 @opindex Winherited-variadic-ctor
7573 @opindex Wno-inherited-variadic-ctor
7574 Suppress warnings about use of C++11 inheriting constructors when the
7575 base class inherited from has a C variadic constructor; the warning is
7576 on by default because the ellipsis is not inherited.
7577
7578 @item -Winline
7579 @opindex Winline
7580 @opindex Wno-inline
7581 Warn if a function that is declared as inline cannot be inlined.
7582 Even with this option, the compiler does not warn about failures to
7583 inline functions declared in system headers.
7584
7585 The compiler uses a variety of heuristics to determine whether or not
7586 to inline a function. For example, the compiler takes into account
7587 the size of the function being inlined and the amount of inlining
7588 that has already been done in the current function. Therefore,
7589 seemingly insignificant changes in the source program can cause the
7590 warnings produced by @option{-Winline} to appear or disappear.
7591
7592 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7593 @opindex Wno-invalid-offsetof
7594 @opindex Winvalid-offsetof
7595 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7596 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7597 to a non-standard-layout type is undefined. In existing C++ implementations,
7598 however, @code{offsetof} typically gives meaningful results.
7599 This flag is for users who are aware that they are
7600 writing nonportable code and who have deliberately chosen to ignore the
7601 warning about it.
7602
7603 The restrictions on @code{offsetof} may be relaxed in a future version
7604 of the C++ standard.
7605
7606 @item -Wint-in-bool-context
7607 @opindex Wint-in-bool-context
7608 @opindex Wno-int-in-bool-context
7609 Warn for suspicious use of integer values where boolean values are expected,
7610 such as conditional expressions (?:) using non-boolean integer constants in
7611 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7612 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7613 for all kinds of multiplications regardless of the data type.
7614 This warning is enabled by @option{-Wall}.
7615
7616 @item -Wno-int-to-pointer-cast
7617 @opindex Wno-int-to-pointer-cast
7618 @opindex Wint-to-pointer-cast
7619 Suppress warnings from casts to pointer type of an integer of a
7620 different size. In C++, casting to a pointer type of smaller size is
7621 an error. @option{Wint-to-pointer-cast} is enabled by default.
7622
7623
7624 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7625 @opindex Wno-pointer-to-int-cast
7626 @opindex Wpointer-to-int-cast
7627 Suppress warnings from casts from a pointer to an integer type of a
7628 different size.
7629
7630 @item -Winvalid-pch
7631 @opindex Winvalid-pch
7632 @opindex Wno-invalid-pch
7633 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7634 the search path but cannot be used.
7635
7636 @item -Wlong-long
7637 @opindex Wlong-long
7638 @opindex Wno-long-long
7639 Warn if @code{long long} type is used. This is enabled by either
7640 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7641 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7642
7643 @item -Wvariadic-macros
7644 @opindex Wvariadic-macros
7645 @opindex Wno-variadic-macros
7646 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7647 alternate syntax is used in ISO C99 mode. This is enabled by either
7648 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7649 messages, use @option{-Wno-variadic-macros}.
7650
7651 @item -Wvarargs
7652 @opindex Wvarargs
7653 @opindex Wno-varargs
7654 Warn upon questionable usage of the macros used to handle variable
7655 arguments like @code{va_start}. This is default. To inhibit the
7656 warning messages, use @option{-Wno-varargs}.
7657
7658 @item -Wvector-operation-performance
7659 @opindex Wvector-operation-performance
7660 @opindex Wno-vector-operation-performance
7661 Warn if vector operation is not implemented via SIMD capabilities of the
7662 architecture. Mainly useful for the performance tuning.
7663 Vector operation can be implemented @code{piecewise}, which means that the
7664 scalar operation is performed on every vector element;
7665 @code{in parallel}, which means that the vector operation is implemented
7666 using scalars of wider type, which normally is more performance efficient;
7667 and @code{as a single scalar}, which means that vector fits into a
7668 scalar type.
7669
7670 @item -Wno-virtual-move-assign
7671 @opindex Wvirtual-move-assign
7672 @opindex Wno-virtual-move-assign
7673 Suppress warnings about inheriting from a virtual base with a
7674 non-trivial C++11 move assignment operator. This is dangerous because
7675 if the virtual base is reachable along more than one path, it is
7676 moved multiple times, which can mean both objects end up in the
7677 moved-from state. If the move assignment operator is written to avoid
7678 moving from a moved-from object, this warning can be disabled.
7679
7680 @item -Wvla
7681 @opindex Wvla
7682 @opindex Wno-vla
7683 Warn if a variable-length array is used in the code.
7684 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7685 the variable-length array.
7686
7687 @item -Wvla-larger-than=@var{byte-size}
7688 @opindex Wvla-larger-than=
7689 @opindex Wno-vla-larger-than
7690 If this option is used, the compiler will warn for declarations of
7691 variable-length arrays whose size is either unbounded, or bounded
7692 by an argument that allows the array size to exceed @var{byte-size}
7693 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7694 works, but with variable-length arrays.
7695
7696 Note that GCC may optimize small variable-length arrays of a known
7697 value into plain arrays, so this warning may not get triggered for
7698 such arrays.
7699
7700 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7701 is typically only effective when @option{-ftree-vrp} is active (default
7702 for @option{-O2} and above).
7703
7704 See also @option{-Walloca-larger-than=@var{byte-size}}.
7705
7706 @item -Wno-vla-larger-than
7707 @opindex Wno-vla-larger-than
7708 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7709 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7710
7711 @item -Wvolatile-register-var
7712 @opindex Wvolatile-register-var
7713 @opindex Wno-volatile-register-var
7714 Warn if a register variable is declared volatile. The volatile
7715 modifier does not inhibit all optimizations that may eliminate reads
7716 and/or writes to register variables. This warning is enabled by
7717 @option{-Wall}.
7718
7719 @item -Wdisabled-optimization
7720 @opindex Wdisabled-optimization
7721 @opindex Wno-disabled-optimization
7722 Warn if a requested optimization pass is disabled. This warning does
7723 not generally indicate that there is anything wrong with your code; it
7724 merely indicates that GCC's optimizers are unable to handle the code
7725 effectively. Often, the problem is that your code is too big or too
7726 complex; GCC refuses to optimize programs when the optimization
7727 itself is likely to take inordinate amounts of time.
7728
7729 @item -Wpointer-sign @r{(C and Objective-C only)}
7730 @opindex Wpointer-sign
7731 @opindex Wno-pointer-sign
7732 Warn for pointer argument passing or assignment with different signedness.
7733 This option is only supported for C and Objective-C@. It is implied by
7734 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7735 @option{-Wno-pointer-sign}.
7736
7737 @item -Wstack-protector
7738 @opindex Wstack-protector
7739 @opindex Wno-stack-protector
7740 This option is only active when @option{-fstack-protector} is active. It
7741 warns about functions that are not protected against stack smashing.
7742
7743 @item -Woverlength-strings
7744 @opindex Woverlength-strings
7745 @opindex Wno-overlength-strings
7746 Warn about string constants that are longer than the ``minimum
7747 maximum'' length specified in the C standard. Modern compilers
7748 generally allow string constants that are much longer than the
7749 standard's minimum limit, but very portable programs should avoid
7750 using longer strings.
7751
7752 The limit applies @emph{after} string constant concatenation, and does
7753 not count the trailing NUL@. In C90, the limit was 509 characters; in
7754 C99, it was raised to 4095. C++98 does not specify a normative
7755 minimum maximum, so we do not diagnose overlength strings in C++@.
7756
7757 This option is implied by @option{-Wpedantic}, and can be disabled with
7758 @option{-Wno-overlength-strings}.
7759
7760 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7761 @opindex Wunsuffixed-float-constants
7762 @opindex Wno-unsuffixed-float-constants
7763
7764 Issue a warning for any floating constant that does not have
7765 a suffix. When used together with @option{-Wsystem-headers} it
7766 warns about such constants in system header files. This can be useful
7767 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7768 from the decimal floating-point extension to C99.
7769
7770 @item -Wno-designated-init @r{(C and Objective-C only)}
7771 Suppress warnings when a positional initializer is used to initialize
7772 a structure that has been marked with the @code{designated_init}
7773 attribute.
7774
7775 @item -Whsa
7776 Issue a warning when HSAIL cannot be emitted for the compiled function or
7777 OpenMP construct.
7778
7779 @end table
7780
7781 @node Debugging Options
7782 @section Options for Debugging Your Program
7783 @cindex options, debugging
7784 @cindex debugging information options
7785
7786 To tell GCC to emit extra information for use by a debugger, in almost
7787 all cases you need only to add @option{-g} to your other options.
7788
7789 GCC allows you to use @option{-g} with
7790 @option{-O}. The shortcuts taken by optimized code may occasionally
7791 be surprising: some variables you declared may not exist
7792 at all; flow of control may briefly move where you did not expect it;
7793 some statements may not be executed because they compute constant
7794 results or their values are already at hand; some statements may
7795 execute in different places because they have been moved out of loops.
7796 Nevertheless it is possible to debug optimized output. This makes
7797 it reasonable to use the optimizer for programs that might have bugs.
7798
7799 If you are not using some other optimization option, consider
7800 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7801 With no @option{-O} option at all, some compiler passes that collect
7802 information useful for debugging do not run at all, so that
7803 @option{-Og} may result in a better debugging experience.
7804
7805 @table @gcctabopt
7806 @item -g
7807 @opindex g
7808 Produce debugging information in the operating system's native format
7809 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7810 information.
7811
7812 On most systems that use stabs format, @option{-g} enables use of extra
7813 debugging information that only GDB can use; this extra information
7814 makes debugging work better in GDB but probably makes other debuggers
7815 crash or
7816 refuse to read the program. If you want to control for certain whether
7817 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7818 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7819
7820 @item -ggdb
7821 @opindex ggdb
7822 Produce debugging information for use by GDB@. This means to use the
7823 most expressive format available (DWARF, stabs, or the native format
7824 if neither of those are supported), including GDB extensions if at all
7825 possible.
7826
7827 @item -gdwarf
7828 @itemx -gdwarf-@var{version}
7829 @opindex gdwarf
7830 Produce debugging information in DWARF format (if that is supported).
7831 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7832 for most targets is 4. DWARF Version 5 is only experimental.
7833
7834 Note that with DWARF Version 2, some ports require and always
7835 use some non-conflicting DWARF 3 extensions in the unwind tables.
7836
7837 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7838 for maximum benefit.
7839
7840 GCC no longer supports DWARF Version 1, which is substantially
7841 different than Version 2 and later. For historical reasons, some
7842 other DWARF-related options such as
7843 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7844 in their names, but apply to all currently-supported versions of DWARF.
7845
7846 @item -gstabs
7847 @opindex gstabs
7848 Produce debugging information in stabs format (if that is supported),
7849 without GDB extensions. This is the format used by DBX on most BSD
7850 systems. On MIPS, Alpha and System V Release 4 systems this option
7851 produces stabs debugging output that is not understood by DBX@.
7852 On System V Release 4 systems this option requires the GNU assembler.
7853
7854 @item -gstabs+
7855 @opindex gstabs+
7856 Produce debugging information in stabs format (if that is supported),
7857 using GNU extensions understood only by the GNU debugger (GDB)@. The
7858 use of these extensions is likely to make other debuggers crash or
7859 refuse to read the program.
7860
7861 @item -gxcoff
7862 @opindex gxcoff
7863 Produce debugging information in XCOFF format (if that is supported).
7864 This is the format used by the DBX debugger on IBM RS/6000 systems.
7865
7866 @item -gxcoff+
7867 @opindex gxcoff+
7868 Produce debugging information in XCOFF format (if that is supported),
7869 using GNU extensions understood only by the GNU debugger (GDB)@. The
7870 use of these extensions is likely to make other debuggers crash or
7871 refuse to read the program, and may cause assemblers other than the GNU
7872 assembler (GAS) to fail with an error.
7873
7874 @item -gvms
7875 @opindex gvms
7876 Produce debugging information in Alpha/VMS debug format (if that is
7877 supported). This is the format used by DEBUG on Alpha/VMS systems.
7878
7879 @item -g@var{level}
7880 @itemx -ggdb@var{level}
7881 @itemx -gstabs@var{level}
7882 @itemx -gxcoff@var{level}
7883 @itemx -gvms@var{level}
7884 Request debugging information and also use @var{level} to specify how
7885 much information. The default level is 2.
7886
7887 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7888 @option{-g}.
7889
7890 Level 1 produces minimal information, enough for making backtraces in
7891 parts of the program that you don't plan to debug. This includes
7892 descriptions of functions and external variables, and line number
7893 tables, but no information about local variables.
7894
7895 Level 3 includes extra information, such as all the macro definitions
7896 present in the program. Some debuggers support macro expansion when
7897 you use @option{-g3}.
7898
7899 If you use multiple @option{-g} options, with or without level numbers,
7900 the last such option is the one that is effective.
7901
7902 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7903 confusion with @option{-gdwarf-@var{level}}.
7904 Instead use an additional @option{-g@var{level}} option to change the
7905 debug level for DWARF.
7906
7907 @item -fno-eliminate-unused-debug-symbols
7908 @opindex feliminate-unused-debug-symbols
7909 @opindex fno-eliminate-unused-debug-symbols
7910 By default, no debug information is produced for symbols that are not actually
7911 used. Use this option if you want debug information for all symbols.
7912
7913 @item -femit-class-debug-always
7914 @opindex femit-class-debug-always
7915 Instead of emitting debugging information for a C++ class in only one
7916 object file, emit it in all object files using the class. This option
7917 should be used only with debuggers that are unable to handle the way GCC
7918 normally emits debugging information for classes because using this
7919 option increases the size of debugging information by as much as a
7920 factor of two.
7921
7922 @item -fno-merge-debug-strings
7923 @opindex fmerge-debug-strings
7924 @opindex fno-merge-debug-strings
7925 Direct the linker to not merge together strings in the debugging
7926 information that are identical in different object files. Merging is
7927 not supported by all assemblers or linkers. Merging decreases the size
7928 of the debug information in the output file at the cost of increasing
7929 link processing time. Merging is enabled by default.
7930
7931 @item -fdebug-prefix-map=@var{old}=@var{new}
7932 @opindex fdebug-prefix-map
7933 When compiling files residing in directory @file{@var{old}}, record
7934 debugging information describing them as if the files resided in
7935 directory @file{@var{new}} instead. This can be used to replace a
7936 build-time path with an install-time path in the debug info. It can
7937 also be used to change an absolute path to a relative path by using
7938 @file{.} for @var{new}. This can give more reproducible builds, which
7939 are location independent, but may require an extra command to tell GDB
7940 where to find the source files. See also @option{-ffile-prefix-map}.
7941
7942 @item -fvar-tracking
7943 @opindex fvar-tracking
7944 Run variable tracking pass. It computes where variables are stored at each
7945 position in code. Better debugging information is then generated
7946 (if the debugging information format supports this information).
7947
7948 It is enabled by default when compiling with optimization (@option{-Os},
7949 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7950 the debug info format supports it.
7951
7952 @item -fvar-tracking-assignments
7953 @opindex fvar-tracking-assignments
7954 @opindex fno-var-tracking-assignments
7955 Annotate assignments to user variables early in the compilation and
7956 attempt to carry the annotations over throughout the compilation all the
7957 way to the end, in an attempt to improve debug information while
7958 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7959
7960 It can be enabled even if var-tracking is disabled, in which case
7961 annotations are created and maintained, but discarded at the end.
7962 By default, this flag is enabled together with @option{-fvar-tracking},
7963 except when selective scheduling is enabled.
7964
7965 @item -gsplit-dwarf
7966 @opindex gsplit-dwarf
7967 Separate as much DWARF debugging information as possible into a
7968 separate output file with the extension @file{.dwo}. This option allows
7969 the build system to avoid linking files with debug information. To
7970 be useful, this option requires a debugger capable of reading @file{.dwo}
7971 files.
7972
7973 @item -gdescribe-dies
7974 @opindex gdescribe-dies
7975 Add description attributes to some DWARF DIEs that have no name attribute,
7976 such as artificial variables, external references and call site
7977 parameter DIEs.
7978
7979 @item -gpubnames
7980 @opindex gpubnames
7981 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7982
7983 @item -ggnu-pubnames
7984 @opindex ggnu-pubnames
7985 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7986 suitable for conversion into a GDB@ index. This option is only useful
7987 with a linker that can produce GDB@ index version 7.
7988
7989 @item -fdebug-types-section
7990 @opindex fdebug-types-section
7991 @opindex fno-debug-types-section
7992 When using DWARF Version 4 or higher, type DIEs can be put into
7993 their own @code{.debug_types} section instead of making them part of the
7994 @code{.debug_info} section. It is more efficient to put them in a separate
7995 comdat section since the linker can then remove duplicates.
7996 But not all DWARF consumers support @code{.debug_types} sections yet
7997 and on some objects @code{.debug_types} produces larger instead of smaller
7998 debugging information.
7999
8000 @item -grecord-gcc-switches
8001 @itemx -gno-record-gcc-switches
8002 @opindex grecord-gcc-switches
8003 @opindex gno-record-gcc-switches
8004 This switch causes the command-line options used to invoke the
8005 compiler that may affect code generation to be appended to the
8006 DW_AT_producer attribute in DWARF debugging information. The options
8007 are concatenated with spaces separating them from each other and from
8008 the compiler version.
8009 It is enabled by default.
8010 See also @option{-frecord-gcc-switches} for another
8011 way of storing compiler options into the object file.
8012
8013 @item -gstrict-dwarf
8014 @opindex gstrict-dwarf
8015 Disallow using extensions of later DWARF standard version than selected
8016 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
8017 DWARF extensions from later standard versions is allowed.
8018
8019 @item -gno-strict-dwarf
8020 @opindex gno-strict-dwarf
8021 Allow using extensions of later DWARF standard version than selected with
8022 @option{-gdwarf-@var{version}}.
8023
8024 @item -gas-loc-support
8025 @opindex gas-loc-support
8026 Inform the compiler that the assembler supports @code{.loc} directives.
8027 It may then use them for the assembler to generate DWARF2+ line number
8028 tables.
8029
8030 This is generally desirable, because assembler-generated line-number
8031 tables are a lot more compact than those the compiler can generate
8032 itself.
8033
8034 This option will be enabled by default if, at GCC configure time, the
8035 assembler was found to support such directives.
8036
8037 @item -gno-as-loc-support
8038 @opindex gno-as-loc-support
8039 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8040 line number tables are to be generated.
8041
8042 @item -gas-locview-support
8043 @opindex gas-locview-support
8044 Inform the compiler that the assembler supports @code{view} assignment
8045 and reset assertion checking in @code{.loc} directives.
8046
8047 This option will be enabled by default if, at GCC configure time, the
8048 assembler was found to support them.
8049
8050 @item -gno-as-locview-support
8051 Force GCC to assign view numbers internally, if
8052 @option{-gvariable-location-views} are explicitly requested.
8053
8054 @item -gcolumn-info
8055 @itemx -gno-column-info
8056 @opindex gcolumn-info
8057 @opindex gno-column-info
8058 Emit location column information into DWARF debugging information, rather
8059 than just file and line.
8060 This option is enabled by default.
8061
8062 @item -gstatement-frontiers
8063 @itemx -gno-statement-frontiers
8064 @opindex gstatement-frontiers
8065 @opindex gno-statement-frontiers
8066 This option causes GCC to create markers in the internal representation
8067 at the beginning of statements, and to keep them roughly in place
8068 throughout compilation, using them to guide the output of @code{is_stmt}
8069 markers in the line number table. This is enabled by default when
8070 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8071 @dots{}), and outputting DWARF 2 debug information at the normal level.
8072
8073 @item -gvariable-location-views
8074 @itemx -gvariable-location-views=incompat5
8075 @itemx -gno-variable-location-views
8076 @opindex gvariable-location-views
8077 @opindex gvariable-location-views=incompat5
8078 @opindex gno-variable-location-views
8079 Augment variable location lists with progressive view numbers implied
8080 from the line number table. This enables debug information consumers to
8081 inspect state at certain points of the program, even if no instructions
8082 associated with the corresponding source locations are present at that
8083 point. If the assembler lacks support for view numbers in line number
8084 tables, this will cause the compiler to emit the line number table,
8085 which generally makes them somewhat less compact. The augmented line
8086 number tables and location lists are fully backward-compatible, so they
8087 can be consumed by debug information consumers that are not aware of
8088 these augmentations, but they won't derive any benefit from them either.
8089
8090 This is enabled by default when outputting DWARF 2 debug information at
8091 the normal level, as long as there is assembler support,
8092 @option{-fvar-tracking-assignments} is enabled and
8093 @option{-gstrict-dwarf} is not. When assembler support is not
8094 available, this may still be enabled, but it will force GCC to output
8095 internal line number tables, and if
8096 @option{-ginternal-reset-location-views} is not enabled, that will most
8097 certainly lead to silently mismatching location views.
8098
8099 There is a proposed representation for view numbers that is not backward
8100 compatible with the location list format introduced in DWARF 5, that can
8101 be enabled with @option{-gvariable-location-views=incompat5}. This
8102 option may be removed in the future, is only provided as a reference
8103 implementation of the proposed representation. Debug information
8104 consumers are not expected to support this extended format, and they
8105 would be rendered unable to decode location lists using it.
8106
8107 @item -ginternal-reset-location-views
8108 @itemx -gnointernal-reset-location-views
8109 @opindex ginternal-reset-location-views
8110 @opindex gno-internal-reset-location-views
8111 Attempt to determine location views that can be omitted from location
8112 view lists. This requires the compiler to have very accurate insn
8113 length estimates, which isn't always the case, and it may cause
8114 incorrect view lists to be generated silently when using an assembler
8115 that does not support location view lists. The GNU assembler will flag
8116 any such error as a @code{view number mismatch}. This is only enabled
8117 on ports that define a reliable estimation function.
8118
8119 @item -ginline-points
8120 @itemx -gno-inline-points
8121 @opindex ginline-points
8122 @opindex gno-inline-points
8123 Generate extended debug information for inlined functions. Location
8124 view tracking markers are inserted at inlined entry points, so that
8125 address and view numbers can be computed and output in debug
8126 information. This can be enabled independently of location views, in
8127 which case the view numbers won't be output, but it can only be enabled
8128 along with statement frontiers, and it is only enabled by default if
8129 location views are enabled.
8130
8131 @item -gz@r{[}=@var{type}@r{]}
8132 @opindex gz
8133 Produce compressed debug sections in DWARF format, if that is supported.
8134 If @var{type} is not given, the default type depends on the capabilities
8135 of the assembler and linker used. @var{type} may be one of
8136 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8137 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8138 compression in traditional GNU format). If the linker doesn't support
8139 writing compressed debug sections, the option is rejected. Otherwise,
8140 if the assembler does not support them, @option{-gz} is silently ignored
8141 when producing object files.
8142
8143 @item -femit-struct-debug-baseonly
8144 @opindex femit-struct-debug-baseonly
8145 Emit debug information for struct-like types
8146 only when the base name of the compilation source file
8147 matches the base name of file in which the struct is defined.
8148
8149 This option substantially reduces the size of debugging information,
8150 but at significant potential loss in type information to the debugger.
8151 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8152 See @option{-femit-struct-debug-detailed} for more detailed control.
8153
8154 This option works only with DWARF debug output.
8155
8156 @item -femit-struct-debug-reduced
8157 @opindex femit-struct-debug-reduced
8158 Emit debug information for struct-like types
8159 only when the base name of the compilation source file
8160 matches the base name of file in which the type is defined,
8161 unless the struct is a template or defined in a system header.
8162
8163 This option significantly reduces the size of debugging information,
8164 with some potential loss in type information to the debugger.
8165 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8166 See @option{-femit-struct-debug-detailed} for more detailed control.
8167
8168 This option works only with DWARF debug output.
8169
8170 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8171 @opindex femit-struct-debug-detailed
8172 Specify the struct-like types
8173 for which the compiler generates debug information.
8174 The intent is to reduce duplicate struct debug information
8175 between different object files within the same program.
8176
8177 This option is a detailed version of
8178 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8179 which serves for most needs.
8180
8181 A specification has the syntax@*
8182 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8183
8184 The optional first word limits the specification to
8185 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8186 A struct type is used directly when it is the type of a variable, member.
8187 Indirect uses arise through pointers to structs.
8188 That is, when use of an incomplete struct is valid, the use is indirect.
8189 An example is
8190 @samp{struct one direct; struct two * indirect;}.
8191
8192 The optional second word limits the specification to
8193 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8194 Generic structs are a bit complicated to explain.
8195 For C++, these are non-explicit specializations of template classes,
8196 or non-template classes within the above.
8197 Other programming languages have generics,
8198 but @option{-femit-struct-debug-detailed} does not yet implement them.
8199
8200 The third word specifies the source files for those
8201 structs for which the compiler should emit debug information.
8202 The values @samp{none} and @samp{any} have the normal meaning.
8203 The value @samp{base} means that
8204 the base of name of the file in which the type declaration appears
8205 must match the base of the name of the main compilation file.
8206 In practice, this means that when compiling @file{foo.c}, debug information
8207 is generated for types declared in that file and @file{foo.h},
8208 but not other header files.
8209 The value @samp{sys} means those types satisfying @samp{base}
8210 or declared in system or compiler headers.
8211
8212 You may need to experiment to determine the best settings for your application.
8213
8214 The default is @option{-femit-struct-debug-detailed=all}.
8215
8216 This option works only with DWARF debug output.
8217
8218 @item -fno-dwarf2-cfi-asm
8219 @opindex fdwarf2-cfi-asm
8220 @opindex fno-dwarf2-cfi-asm
8221 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8222 instead of using GAS @code{.cfi_*} directives.
8223
8224 @item -fno-eliminate-unused-debug-types
8225 @opindex feliminate-unused-debug-types
8226 @opindex fno-eliminate-unused-debug-types
8227 Normally, when producing DWARF output, GCC avoids producing debug symbol
8228 output for types that are nowhere used in the source file being compiled.
8229 Sometimes it is useful to have GCC emit debugging
8230 information for all types declared in a compilation
8231 unit, regardless of whether or not they are actually used
8232 in that compilation unit, for example
8233 if, in the debugger, you want to cast a value to a type that is
8234 not actually used in your program (but is declared). More often,
8235 however, this results in a significant amount of wasted space.
8236 @end table
8237
8238 @node Optimize Options
8239 @section Options That Control Optimization
8240 @cindex optimize options
8241 @cindex options, optimization
8242
8243 These options control various sorts of optimizations.
8244
8245 Without any optimization option, the compiler's goal is to reduce the
8246 cost of compilation and to make debugging produce the expected
8247 results. Statements are independent: if you stop the program with a
8248 breakpoint between statements, you can then assign a new value to any
8249 variable or change the program counter to any other statement in the
8250 function and get exactly the results you expect from the source
8251 code.
8252
8253 Turning on optimization flags makes the compiler attempt to improve
8254 the performance and/or code size at the expense of compilation time
8255 and possibly the ability to debug the program.
8256
8257 The compiler performs optimization based on the knowledge it has of the
8258 program. Compiling multiple files at once to a single output file mode allows
8259 the compiler to use information gained from all of the files when compiling
8260 each of them.
8261
8262 Not all optimizations are controlled directly by a flag. Only
8263 optimizations that have a flag are listed in this section.
8264
8265 Most optimizations are completely disabled at @option{-O0} or if an
8266 @option{-O} level is not set on the command line, even if individual
8267 optimization flags are specified. Similarly, @option{-Og} suppresses
8268 many optimization passes.
8269
8270 Depending on the target and how GCC was configured, a slightly different
8271 set of optimizations may be enabled at each @option{-O} level than
8272 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8273 to find out the exact set of optimizations that are enabled at each level.
8274 @xref{Overall Options}, for examples.
8275
8276 @table @gcctabopt
8277 @item -O
8278 @itemx -O1
8279 @opindex O
8280 @opindex O1
8281 Optimize. Optimizing compilation takes somewhat more time, and a lot
8282 more memory for a large function.
8283
8284 With @option{-O}, the compiler tries to reduce code size and execution
8285 time, without performing any optimizations that take a great deal of
8286 compilation time.
8287
8288 @c Note that in addition to the default_options_table list in opts.c,
8289 @c several optimization flags default to true but control optimization
8290 @c passes that are explicitly disabled at -O0.
8291
8292 @option{-O} turns on the following optimization flags:
8293
8294 @c Please keep the following list alphabetized.
8295 @gccoptlist{-fauto-inc-dec @gol
8296 -fbranch-count-reg @gol
8297 -fcombine-stack-adjustments @gol
8298 -fcompare-elim @gol
8299 -fcprop-registers @gol
8300 -fdce @gol
8301 -fdefer-pop @gol
8302 -fdelayed-branch @gol
8303 -fdse @gol
8304 -fforward-propagate @gol
8305 -fguess-branch-probability @gol
8306 -fif-conversion @gol
8307 -fif-conversion2 @gol
8308 -finline-functions-called-once @gol
8309 -fipa-profile @gol
8310 -fipa-pure-const @gol
8311 -fipa-reference @gol
8312 -fipa-reference-addressable @gol
8313 -fmerge-constants @gol
8314 -fmove-loop-invariants @gol
8315 -fomit-frame-pointer @gol
8316 -freorder-blocks @gol
8317 -fshrink-wrap @gol
8318 -fshrink-wrap-separate @gol
8319 -fsplit-wide-types @gol
8320 -fssa-backprop @gol
8321 -fssa-phiopt @gol
8322 -ftree-bit-ccp @gol
8323 -ftree-ccp @gol
8324 -ftree-ch @gol
8325 -ftree-coalesce-vars @gol
8326 -ftree-copy-prop @gol
8327 -ftree-dce @gol
8328 -ftree-dominator-opts @gol
8329 -ftree-dse @gol
8330 -ftree-forwprop @gol
8331 -ftree-fre @gol
8332 -ftree-phiprop @gol
8333 -ftree-pta @gol
8334 -ftree-scev-cprop @gol
8335 -ftree-sink @gol
8336 -ftree-slsr @gol
8337 -ftree-sra @gol
8338 -ftree-ter @gol
8339 -funit-at-a-time}
8340
8341 @item -O2
8342 @opindex O2
8343 Optimize even more. GCC performs nearly all supported optimizations
8344 that do not involve a space-speed tradeoff.
8345 As compared to @option{-O}, this option increases both compilation time
8346 and the performance of the generated code.
8347
8348 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8349 also turns on the following optimization flags:
8350
8351 @c Please keep the following list alphabetized!
8352 @gccoptlist{-falign-functions -falign-jumps @gol
8353 -falign-labels -falign-loops @gol
8354 -fcaller-saves @gol
8355 -fcode-hoisting @gol
8356 -fcrossjumping @gol
8357 -fcse-follow-jumps -fcse-skip-blocks @gol
8358 -fdelete-null-pointer-checks @gol
8359 -fdevirtualize -fdevirtualize-speculatively @gol
8360 -fexpensive-optimizations @gol
8361 -ffinite-loops @gol
8362 -fgcse -fgcse-lm @gol
8363 -fhoist-adjacent-loads @gol
8364 -finline-small-functions @gol
8365 -findirect-inlining @gol
8366 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8367 -fipa-ra -fipa-sra -fipa-vrp @gol
8368 -fisolate-erroneous-paths-dereference @gol
8369 -flra-remat @gol
8370 -foptimize-sibling-calls @gol
8371 -foptimize-strlen @gol
8372 -fpartial-inlining @gol
8373 -fpeephole2 @gol
8374 -freorder-blocks-algorithm=stc @gol
8375 -freorder-blocks-and-partition -freorder-functions @gol
8376 -frerun-cse-after-loop @gol
8377 -fschedule-insns -fschedule-insns2 @gol
8378 -fsched-interblock -fsched-spec @gol
8379 -fstore-merging @gol
8380 -fstrict-aliasing @gol
8381 -fthread-jumps @gol
8382 -ftree-builtin-call-dce @gol
8383 -ftree-pre @gol
8384 -ftree-switch-conversion -ftree-tail-merge @gol
8385 -ftree-vrp}
8386
8387 Please note the warning under @option{-fgcse} about
8388 invoking @option{-O2} on programs that use computed gotos.
8389
8390 @item -O3
8391 @opindex O3
8392 Optimize yet more. @option{-O3} turns on all optimizations specified
8393 by @option{-O2} and also turns on the following optimization flags:
8394
8395 @c Please keep the following list alphabetized!
8396 @gccoptlist{-fgcse-after-reload @gol
8397 -finline-functions @gol
8398 -fipa-cp-clone
8399 -floop-interchange @gol
8400 -floop-unroll-and-jam @gol
8401 -fpeel-loops @gol
8402 -fpredictive-commoning @gol
8403 -fsplit-paths @gol
8404 -ftree-loop-distribute-patterns @gol
8405 -ftree-loop-distribution @gol
8406 -ftree-loop-vectorize @gol
8407 -ftree-partial-pre @gol
8408 -ftree-slp-vectorize @gol
8409 -funswitch-loops @gol
8410 -fvect-cost-model @gol
8411 -fversion-loops-for-strides}
8412
8413 @item -O0
8414 @opindex O0
8415 Reduce compilation time and make debugging produce the expected
8416 results. This is the default.
8417
8418 @item -Os
8419 @opindex Os
8420 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8421 except those that often increase code size:
8422
8423 @gccoptlist{-falign-functions -falign-jumps @gol
8424 -falign-labels -falign-loops @gol
8425 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8426
8427 It also enables @option{-finline-functions}, causes the compiler to tune for
8428 code size rather than execution speed, and performs further optimizations
8429 designed to reduce code size.
8430
8431 @item -Ofast
8432 @opindex Ofast
8433 Disregard strict standards compliance. @option{-Ofast} enables all
8434 @option{-O3} optimizations. It also enables optimizations that are not
8435 valid for all standard-compliant programs.
8436 It turns on @option{-ffast-math} and the Fortran-specific
8437 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8438 specified, and @option{-fno-protect-parens}.
8439
8440 @item -Og
8441 @opindex Og
8442 Optimize debugging experience. @option{-Og} should be the optimization
8443 level of choice for the standard edit-compile-debug cycle, offering
8444 a reasonable level of optimization while maintaining fast compilation
8445 and a good debugging experience. It is a better choice than @option{-O0}
8446 for producing debuggable code because some compiler passes
8447 that collect debug information are disabled at @option{-O0}.
8448
8449 Like @option{-O0}, @option{-Og} completely disables a number of
8450 optimization passes so that individual options controlling them have
8451 no effect. Otherwise @option{-Og} enables all @option{-O1}
8452 optimization flags except for those that may interfere with debugging:
8453
8454 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8455 -fdse -fif-conversion -fif-conversion2 @gol
8456 -finline-functions-called-once @gol
8457 -fmove-loop-invariants -fssa-phiopt @gol
8458 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
8459
8460 @end table
8461
8462 If you use multiple @option{-O} options, with or without level numbers,
8463 the last such option is the one that is effective.
8464
8465 Options of the form @option{-f@var{flag}} specify machine-independent
8466 flags. Most flags have both positive and negative forms; the negative
8467 form of @option{-ffoo} is @option{-fno-foo}. In the table
8468 below, only one of the forms is listed---the one you typically
8469 use. You can figure out the other form by either removing @samp{no-}
8470 or adding it.
8471
8472 The following options control specific optimizations. They are either
8473 activated by @option{-O} options or are related to ones that are. You
8474 can use the following flags in the rare cases when ``fine-tuning'' of
8475 optimizations to be performed is desired.
8476
8477 @table @gcctabopt
8478 @item -fno-defer-pop
8479 @opindex fno-defer-pop
8480 @opindex fdefer-pop
8481 For machines that must pop arguments after a function call, always pop
8482 the arguments as soon as each function returns.
8483 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8484 this allows the compiler to let arguments accumulate on the stack for several
8485 function calls and pop them all at once.
8486
8487 @item -fforward-propagate
8488 @opindex fforward-propagate
8489 Perform a forward propagation pass on RTL@. The pass tries to combine two
8490 instructions and checks if the result can be simplified. If loop unrolling
8491 is active, two passes are performed and the second is scheduled after
8492 loop unrolling.
8493
8494 This option is enabled by default at optimization levels @option{-O},
8495 @option{-O2}, @option{-O3}, @option{-Os}.
8496
8497 @item -ffp-contract=@var{style}
8498 @opindex ffp-contract
8499 @option{-ffp-contract=off} disables floating-point expression contraction.
8500 @option{-ffp-contract=fast} enables floating-point expression contraction
8501 such as forming of fused multiply-add operations if the target has
8502 native support for them.
8503 @option{-ffp-contract=on} enables floating-point expression contraction
8504 if allowed by the language standard. This is currently not implemented
8505 and treated equal to @option{-ffp-contract=off}.
8506
8507 The default is @option{-ffp-contract=fast}.
8508
8509 @item -fomit-frame-pointer
8510 @opindex fomit-frame-pointer
8511 Omit the frame pointer in functions that don't need one. This avoids the
8512 instructions to save, set up and restore the frame pointer; on many targets
8513 it also makes an extra register available.
8514
8515 On some targets this flag has no effect because the standard calling sequence
8516 always uses a frame pointer, so it cannot be omitted.
8517
8518 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8519 is used in all functions. Several targets always omit the frame pointer in
8520 leaf functions.
8521
8522 Enabled by default at @option{-O} and higher.
8523
8524 @item -foptimize-sibling-calls
8525 @opindex foptimize-sibling-calls
8526 Optimize sibling and tail recursive calls.
8527
8528 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8529
8530 @item -foptimize-strlen
8531 @opindex foptimize-strlen
8532 Optimize various standard C string functions (e.g.@: @code{strlen},
8533 @code{strchr} or @code{strcpy}) and
8534 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8535
8536 Enabled at levels @option{-O2}, @option{-O3}.
8537
8538 @item -fno-inline
8539 @opindex fno-inline
8540 @opindex finline
8541 Do not expand any functions inline apart from those marked with
8542 the @code{always_inline} attribute. This is the default when not
8543 optimizing.
8544
8545 Single functions can be exempted from inlining by marking them
8546 with the @code{noinline} attribute.
8547
8548 @item -finline-small-functions
8549 @opindex finline-small-functions
8550 Integrate functions into their callers when their body is smaller than expected
8551 function call code (so overall size of program gets smaller). The compiler
8552 heuristically decides which functions are simple enough to be worth integrating
8553 in this way. This inlining applies to all functions, even those not declared
8554 inline.
8555
8556 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8557
8558 @item -findirect-inlining
8559 @opindex findirect-inlining
8560 Inline also indirect calls that are discovered to be known at compile
8561 time thanks to previous inlining. This option has any effect only
8562 when inlining itself is turned on by the @option{-finline-functions}
8563 or @option{-finline-small-functions} options.
8564
8565 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8566
8567 @item -finline-functions
8568 @opindex finline-functions
8569 Consider all functions for inlining, even if they are not declared inline.
8570 The compiler heuristically decides which functions are worth integrating
8571 in this way.
8572
8573 If all calls to a given function are integrated, and the function is
8574 declared @code{static}, then the function is normally not output as
8575 assembler code in its own right.
8576
8577 Enabled at levels @option{-O3}, @option{-Os}. Also enabled
8578 by @option{-fprofile-use} and @option{-fauto-profile}.
8579
8580 @item -finline-functions-called-once
8581 @opindex finline-functions-called-once
8582 Consider all @code{static} functions called once for inlining into their
8583 caller even if they are not marked @code{inline}. If a call to a given
8584 function is integrated, then the function is not output as assembler code
8585 in its own right.
8586
8587 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8588 but not @option{-Og}.
8589
8590 @item -fearly-inlining
8591 @opindex fearly-inlining
8592 Inline functions marked by @code{always_inline} and functions whose body seems
8593 smaller than the function call overhead early before doing
8594 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8595 makes profiling significantly cheaper and usually inlining faster on programs
8596 having large chains of nested wrapper functions.
8597
8598 Enabled by default.
8599
8600 @item -fipa-sra
8601 @opindex fipa-sra
8602 Perform interprocedural scalar replacement of aggregates, removal of
8603 unused parameters and replacement of parameters passed by reference
8604 by parameters passed by value.
8605
8606 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8607
8608 @item -finline-limit=@var{n}
8609 @opindex finline-limit
8610 By default, GCC limits the size of functions that can be inlined. This flag
8611 allows coarse control of this limit. @var{n} is the size of functions that
8612 can be inlined in number of pseudo instructions.
8613
8614 Inlining is actually controlled by a number of parameters, which may be
8615 specified individually by using @option{--param @var{name}=@var{value}}.
8616 The @option{-finline-limit=@var{n}} option sets some of these parameters
8617 as follows:
8618
8619 @table @gcctabopt
8620 @item max-inline-insns-single
8621 is set to @var{n}/2.
8622 @item max-inline-insns-auto
8623 is set to @var{n}/2.
8624 @end table
8625
8626 See below for a documentation of the individual
8627 parameters controlling inlining and for the defaults of these parameters.
8628
8629 @emph{Note:} there may be no value to @option{-finline-limit} that results
8630 in default behavior.
8631
8632 @emph{Note:} pseudo instruction represents, in this particular context, an
8633 abstract measurement of function's size. In no way does it represent a count
8634 of assembly instructions and as such its exact meaning might change from one
8635 release to an another.
8636
8637 @item -fno-keep-inline-dllexport
8638 @opindex fno-keep-inline-dllexport
8639 @opindex fkeep-inline-dllexport
8640 This is a more fine-grained version of @option{-fkeep-inline-functions},
8641 which applies only to functions that are declared using the @code{dllexport}
8642 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8643 Functions}.
8644
8645 @item -fkeep-inline-functions
8646 @opindex fkeep-inline-functions
8647 In C, emit @code{static} functions that are declared @code{inline}
8648 into the object file, even if the function has been inlined into all
8649 of its callers. This switch does not affect functions using the
8650 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8651 inline functions into the object file.
8652
8653 @item -fkeep-static-functions
8654 @opindex fkeep-static-functions
8655 Emit @code{static} functions into the object file, even if the function
8656 is never used.
8657
8658 @item -fkeep-static-consts
8659 @opindex fkeep-static-consts
8660 Emit variables declared @code{static const} when optimization isn't turned
8661 on, even if the variables aren't referenced.
8662
8663 GCC enables this option by default. If you want to force the compiler to
8664 check if a variable is referenced, regardless of whether or not
8665 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8666
8667 @item -fmerge-constants
8668 @opindex fmerge-constants
8669 Attempt to merge identical constants (string constants and floating-point
8670 constants) across compilation units.
8671
8672 This option is the default for optimized compilation if the assembler and
8673 linker support it. Use @option{-fno-merge-constants} to inhibit this
8674 behavior.
8675
8676 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8677
8678 @item -fmerge-all-constants
8679 @opindex fmerge-all-constants
8680 Attempt to merge identical constants and identical variables.
8681
8682 This option implies @option{-fmerge-constants}. In addition to
8683 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8684 arrays or initialized constant variables with integral or floating-point
8685 types. Languages like C or C++ require each variable, including multiple
8686 instances of the same variable in recursive calls, to have distinct locations,
8687 so using this option results in non-conforming
8688 behavior.
8689
8690 @item -fmodulo-sched
8691 @opindex fmodulo-sched
8692 Perform swing modulo scheduling immediately before the first scheduling
8693 pass. This pass looks at innermost loops and reorders their
8694 instructions by overlapping different iterations.
8695
8696 @item -fmodulo-sched-allow-regmoves
8697 @opindex fmodulo-sched-allow-regmoves
8698 Perform more aggressive SMS-based modulo scheduling with register moves
8699 allowed. By setting this flag certain anti-dependences edges are
8700 deleted, which triggers the generation of reg-moves based on the
8701 life-range analysis. This option is effective only with
8702 @option{-fmodulo-sched} enabled.
8703
8704 @item -fno-branch-count-reg
8705 @opindex fno-branch-count-reg
8706 @opindex fbranch-count-reg
8707 Disable the optimization pass that scans for opportunities to use
8708 ``decrement and branch'' instructions on a count register instead of
8709 instruction sequences that decrement a register, compare it against zero, and
8710 then branch based upon the result. This option is only meaningful on
8711 architectures that support such instructions, which include x86, PowerPC,
8712 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8713 doesn't remove the decrement and branch instructions from the generated
8714 instruction stream introduced by other optimization passes.
8715
8716 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8717 except for @option{-Og}.
8718
8719 @item -fno-function-cse
8720 @opindex fno-function-cse
8721 @opindex ffunction-cse
8722 Do not put function addresses in registers; make each instruction that
8723 calls a constant function contain the function's address explicitly.
8724
8725 This option results in less efficient code, but some strange hacks
8726 that alter the assembler output may be confused by the optimizations
8727 performed when this option is not used.
8728
8729 The default is @option{-ffunction-cse}
8730
8731 @item -fno-zero-initialized-in-bss
8732 @opindex fno-zero-initialized-in-bss
8733 @opindex fzero-initialized-in-bss
8734 If the target supports a BSS section, GCC by default puts variables that
8735 are initialized to zero into BSS@. This can save space in the resulting
8736 code.
8737
8738 This option turns off this behavior because some programs explicitly
8739 rely on variables going to the data section---e.g., so that the
8740 resulting executable can find the beginning of that section and/or make
8741 assumptions based on that.
8742
8743 The default is @option{-fzero-initialized-in-bss}.
8744
8745 @item -fthread-jumps
8746 @opindex fthread-jumps
8747 Perform optimizations that check to see if a jump branches to a
8748 location where another comparison subsumed by the first is found. If
8749 so, the first branch is redirected to either the destination of the
8750 second branch or a point immediately following it, depending on whether
8751 the condition is known to be true or false.
8752
8753 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8754
8755 @item -fsplit-wide-types
8756 @opindex fsplit-wide-types
8757 When using a type that occupies multiple registers, such as @code{long
8758 long} on a 32-bit system, split the registers apart and allocate them
8759 independently. This normally generates better code for those types,
8760 but may make debugging more difficult.
8761
8762 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8763 @option{-Os}.
8764
8765 @item -fsplit-wide-types-early
8766 @opindex fsplit-wide-types-early
8767 Fully split wide types early, instead of very late.
8768 This option has no effect unless @option{-fsplit-wide-types} is turned on.
8769
8770 This is the default on some targets.
8771
8772 @item -fcse-follow-jumps
8773 @opindex fcse-follow-jumps
8774 In common subexpression elimination (CSE), scan through jump instructions
8775 when the target of the jump is not reached by any other path. For
8776 example, when CSE encounters an @code{if} statement with an
8777 @code{else} clause, CSE follows the jump when the condition
8778 tested is false.
8779
8780 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8781
8782 @item -fcse-skip-blocks
8783 @opindex fcse-skip-blocks
8784 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8785 follow jumps that conditionally skip over blocks. When CSE
8786 encounters a simple @code{if} statement with no else clause,
8787 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8788 body of the @code{if}.
8789
8790 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8791
8792 @item -frerun-cse-after-loop
8793 @opindex frerun-cse-after-loop
8794 Re-run common subexpression elimination after loop optimizations are
8795 performed.
8796
8797 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8798
8799 @item -fgcse
8800 @opindex fgcse
8801 Perform a global common subexpression elimination pass.
8802 This pass also performs global constant and copy propagation.
8803
8804 @emph{Note:} When compiling a program using computed gotos, a GCC
8805 extension, you may get better run-time performance if you disable
8806 the global common subexpression elimination pass by adding
8807 @option{-fno-gcse} to the command line.
8808
8809 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8810
8811 @item -fgcse-lm
8812 @opindex fgcse-lm
8813 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8814 attempts to move loads that are only killed by stores into themselves. This
8815 allows a loop containing a load/store sequence to be changed to a load outside
8816 the loop, and a copy/store within the loop.
8817
8818 Enabled by default when @option{-fgcse} is enabled.
8819
8820 @item -fgcse-sm
8821 @opindex fgcse-sm
8822 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8823 global common subexpression elimination. This pass attempts to move
8824 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8825 loops containing a load/store sequence can be changed to a load before
8826 the loop and a store after the loop.
8827
8828 Not enabled at any optimization level.
8829
8830 @item -fgcse-las
8831 @opindex fgcse-las
8832 When @option{-fgcse-las} is enabled, the global common subexpression
8833 elimination pass eliminates redundant loads that come after stores to the
8834 same memory location (both partial and full redundancies).
8835
8836 Not enabled at any optimization level.
8837
8838 @item -fgcse-after-reload
8839 @opindex fgcse-after-reload
8840 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8841 pass is performed after reload. The purpose of this pass is to clean up
8842 redundant spilling.
8843
8844 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8845
8846 @item -faggressive-loop-optimizations
8847 @opindex faggressive-loop-optimizations
8848 This option tells the loop optimizer to use language constraints to
8849 derive bounds for the number of iterations of a loop. This assumes that
8850 loop code does not invoke undefined behavior by for example causing signed
8851 integer overflows or out-of-bound array accesses. The bounds for the
8852 number of iterations of a loop are used to guide loop unrolling and peeling
8853 and loop exit test optimizations.
8854 This option is enabled by default.
8855
8856 @item -funconstrained-commons
8857 @opindex funconstrained-commons
8858 This option tells the compiler that variables declared in common blocks
8859 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8860 prevents certain optimizations that depend on knowing the array bounds.
8861
8862 @item -fcrossjumping
8863 @opindex fcrossjumping
8864 Perform cross-jumping transformation.
8865 This transformation unifies equivalent code and saves code size. The
8866 resulting code may or may not perform better than without cross-jumping.
8867
8868 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8869
8870 @item -fauto-inc-dec
8871 @opindex fauto-inc-dec
8872 Combine increments or decrements of addresses with memory accesses.
8873 This pass is always skipped on architectures that do not have
8874 instructions to support this. Enabled by default at @option{-O} and
8875 higher on architectures that support this.
8876
8877 @item -fdce
8878 @opindex fdce
8879 Perform dead code elimination (DCE) on RTL@.
8880 Enabled by default at @option{-O} and higher.
8881
8882 @item -fdse
8883 @opindex fdse
8884 Perform dead store elimination (DSE) on RTL@.
8885 Enabled by default at @option{-O} and higher.
8886
8887 @item -fif-conversion
8888 @opindex fif-conversion
8889 Attempt to transform conditional jumps into branch-less equivalents. This
8890 includes use of conditional moves, min, max, set flags and abs instructions, and
8891 some tricks doable by standard arithmetics. The use of conditional execution
8892 on chips where it is available is controlled by @option{-fif-conversion2}.
8893
8894 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8895 not with @option{-Og}.
8896
8897 @item -fif-conversion2
8898 @opindex fif-conversion2
8899 Use conditional execution (where available) to transform conditional jumps into
8900 branch-less equivalents.
8901
8902 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8903 not with @option{-Og}.
8904
8905 @item -fdeclone-ctor-dtor
8906 @opindex fdeclone-ctor-dtor
8907 The C++ ABI requires multiple entry points for constructors and
8908 destructors: one for a base subobject, one for a complete object, and
8909 one for a virtual destructor that calls operator delete afterwards.
8910 For a hierarchy with virtual bases, the base and complete variants are
8911 clones, which means two copies of the function. With this option, the
8912 base and complete variants are changed to be thunks that call a common
8913 implementation.
8914
8915 Enabled by @option{-Os}.
8916
8917 @item -fdelete-null-pointer-checks
8918 @opindex fdelete-null-pointer-checks
8919 Assume that programs cannot safely dereference null pointers, and that
8920 no code or data element resides at address zero.
8921 This option enables simple constant
8922 folding optimizations at all optimization levels. In addition, other
8923 optimization passes in GCC use this flag to control global dataflow
8924 analyses that eliminate useless checks for null pointers; these assume
8925 that a memory access to address zero always results in a trap, so
8926 that if a pointer is checked after it has already been dereferenced,
8927 it cannot be null.
8928
8929 Note however that in some environments this assumption is not true.
8930 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8931 for programs that depend on that behavior.
8932
8933 This option is enabled by default on most targets. On Nios II ELF, it
8934 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8935
8936 Passes that use the dataflow information
8937 are enabled independently at different optimization levels.
8938
8939 @item -fdevirtualize
8940 @opindex fdevirtualize
8941 Attempt to convert calls to virtual functions to direct calls. This
8942 is done both within a procedure and interprocedurally as part of
8943 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8944 propagation (@option{-fipa-cp}).
8945 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8946
8947 @item -fdevirtualize-speculatively
8948 @opindex fdevirtualize-speculatively
8949 Attempt to convert calls to virtual functions to speculative direct calls.
8950 Based on the analysis of the type inheritance graph, determine for a given call
8951 the set of likely targets. If the set is small, preferably of size 1, change
8952 the call into a conditional deciding between direct and indirect calls. The
8953 speculative calls enable more optimizations, such as inlining. When they seem
8954 useless after further optimization, they are converted back into original form.
8955
8956 @item -fdevirtualize-at-ltrans
8957 @opindex fdevirtualize-at-ltrans
8958 Stream extra information needed for aggressive devirtualization when running
8959 the link-time optimizer in local transformation mode.
8960 This option enables more devirtualization but
8961 significantly increases the size of streamed data. For this reason it is
8962 disabled by default.
8963
8964 @item -fexpensive-optimizations
8965 @opindex fexpensive-optimizations
8966 Perform a number of minor optimizations that are relatively expensive.
8967
8968 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8969
8970 @item -free
8971 @opindex free
8972 Attempt to remove redundant extension instructions. This is especially
8973 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8974 registers after writing to their lower 32-bit half.
8975
8976 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8977 @option{-O3}, @option{-Os}.
8978
8979 @item -fno-lifetime-dse
8980 @opindex fno-lifetime-dse
8981 @opindex flifetime-dse
8982 In C++ the value of an object is only affected by changes within its
8983 lifetime: when the constructor begins, the object has an indeterminate
8984 value, and any changes during the lifetime of the object are dead when
8985 the object is destroyed. Normally dead store elimination will take
8986 advantage of this; if your code relies on the value of the object
8987 storage persisting beyond the lifetime of the object, you can use this
8988 flag to disable this optimization. To preserve stores before the
8989 constructor starts (e.g.@: because your operator new clears the object
8990 storage) but still treat the object as dead after the destructor you,
8991 can use @option{-flifetime-dse=1}. The default behavior can be
8992 explicitly selected with @option{-flifetime-dse=2}.
8993 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8994
8995 @item -flive-range-shrinkage
8996 @opindex flive-range-shrinkage
8997 Attempt to decrease register pressure through register live range
8998 shrinkage. This is helpful for fast processors with small or moderate
8999 size register sets.
9000
9001 @item -fira-algorithm=@var{algorithm}
9002 @opindex fira-algorithm
9003 Use the specified coloring algorithm for the integrated register
9004 allocator. The @var{algorithm} argument can be @samp{priority}, which
9005 specifies Chow's priority coloring, or @samp{CB}, which specifies
9006 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
9007 for all architectures, but for those targets that do support it, it is
9008 the default because it generates better code.
9009
9010 @item -fira-region=@var{region}
9011 @opindex fira-region
9012 Use specified regions for the integrated register allocator. The
9013 @var{region} argument should be one of the following:
9014
9015 @table @samp
9016
9017 @item all
9018 Use all loops as register allocation regions.
9019 This can give the best results for machines with a small and/or
9020 irregular register set.
9021
9022 @item mixed
9023 Use all loops except for loops with small register pressure
9024 as the regions. This value usually gives
9025 the best results in most cases and for most architectures,
9026 and is enabled by default when compiling with optimization for speed
9027 (@option{-O}, @option{-O2}, @dots{}).
9028
9029 @item one
9030 Use all functions as a single region.
9031 This typically results in the smallest code size, and is enabled by default for
9032 @option{-Os} or @option{-O0}.
9033
9034 @end table
9035
9036 @item -fira-hoist-pressure
9037 @opindex fira-hoist-pressure
9038 Use IRA to evaluate register pressure in the code hoisting pass for
9039 decisions to hoist expressions. This option usually results in smaller
9040 code, but it can slow the compiler down.
9041
9042 This option is enabled at level @option{-Os} for all targets.
9043
9044 @item -fira-loop-pressure
9045 @opindex fira-loop-pressure
9046 Use IRA to evaluate register pressure in loops for decisions to move
9047 loop invariants. This option usually results in generation
9048 of faster and smaller code on machines with large register files (>= 32
9049 registers), but it can slow the compiler down.
9050
9051 This option is enabled at level @option{-O3} for some targets.
9052
9053 @item -fno-ira-share-save-slots
9054 @opindex fno-ira-share-save-slots
9055 @opindex fira-share-save-slots
9056 Disable sharing of stack slots used for saving call-used hard
9057 registers living through a call. Each hard register gets a
9058 separate stack slot, and as a result function stack frames are
9059 larger.
9060
9061 @item -fno-ira-share-spill-slots
9062 @opindex fno-ira-share-spill-slots
9063 @opindex fira-share-spill-slots
9064 Disable sharing of stack slots allocated for pseudo-registers. Each
9065 pseudo-register that does not get a hard register gets a separate
9066 stack slot, and as a result function stack frames are larger.
9067
9068 @item -flra-remat
9069 @opindex flra-remat
9070 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9071 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9072 values if it is profitable.
9073
9074 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9075
9076 @item -fdelayed-branch
9077 @opindex fdelayed-branch
9078 If supported for the target machine, attempt to reorder instructions
9079 to exploit instruction slots available after delayed branch
9080 instructions.
9081
9082 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9083 but not at @option{-Og}.
9084
9085 @item -fschedule-insns
9086 @opindex fschedule-insns
9087 If supported for the target machine, attempt to reorder instructions to
9088 eliminate execution stalls due to required data being unavailable. This
9089 helps machines that have slow floating point or memory load instructions
9090 by allowing other instructions to be issued until the result of the load
9091 or floating-point instruction is required.
9092
9093 Enabled at levels @option{-O2}, @option{-O3}.
9094
9095 @item -fschedule-insns2
9096 @opindex fschedule-insns2
9097 Similar to @option{-fschedule-insns}, but requests an additional pass of
9098 instruction scheduling after register allocation has been done. This is
9099 especially useful on machines with a relatively small number of
9100 registers and where memory load instructions take more than one cycle.
9101
9102 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9103
9104 @item -fno-sched-interblock
9105 @opindex fno-sched-interblock
9106 @opindex fsched-interblock
9107 Disable instruction scheduling across basic blocks, which
9108 is normally enabled when scheduling before register allocation, i.e.@:
9109 with @option{-fschedule-insns} or at @option{-O2} or higher.
9110
9111 @item -fno-sched-spec
9112 @opindex fno-sched-spec
9113 @opindex fsched-spec
9114 Disable speculative motion of non-load instructions, which
9115 is normally enabled when scheduling before register allocation, i.e.@:
9116 with @option{-fschedule-insns} or at @option{-O2} or higher.
9117
9118 @item -fsched-pressure
9119 @opindex fsched-pressure
9120 Enable register pressure sensitive insn scheduling before register
9121 allocation. This only makes sense when scheduling before register
9122 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9123 @option{-O2} or higher. Usage of this option can improve the
9124 generated code and decrease its size by preventing register pressure
9125 increase above the number of available hard registers and subsequent
9126 spills in register allocation.
9127
9128 @item -fsched-spec-load
9129 @opindex fsched-spec-load
9130 Allow speculative motion of some load instructions. This only makes
9131 sense when scheduling before register allocation, i.e.@: with
9132 @option{-fschedule-insns} or at @option{-O2} or higher.
9133
9134 @item -fsched-spec-load-dangerous
9135 @opindex fsched-spec-load-dangerous
9136 Allow speculative motion of more load instructions. This only makes
9137 sense when scheduling before register allocation, i.e.@: with
9138 @option{-fschedule-insns} or at @option{-O2} or higher.
9139
9140 @item -fsched-stalled-insns
9141 @itemx -fsched-stalled-insns=@var{n}
9142 @opindex fsched-stalled-insns
9143 Define how many insns (if any) can be moved prematurely from the queue
9144 of stalled insns into the ready list during the second scheduling pass.
9145 @option{-fno-sched-stalled-insns} means that no insns are moved
9146 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9147 on how many queued insns can be moved prematurely.
9148 @option{-fsched-stalled-insns} without a value is equivalent to
9149 @option{-fsched-stalled-insns=1}.
9150
9151 @item -fsched-stalled-insns-dep
9152 @itemx -fsched-stalled-insns-dep=@var{n}
9153 @opindex fsched-stalled-insns-dep
9154 Define how many insn groups (cycles) are examined for a dependency
9155 on a stalled insn that is a candidate for premature removal from the queue
9156 of stalled insns. This has an effect only during the second scheduling pass,
9157 and only if @option{-fsched-stalled-insns} is used.
9158 @option{-fno-sched-stalled-insns-dep} is equivalent to
9159 @option{-fsched-stalled-insns-dep=0}.
9160 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9161 @option{-fsched-stalled-insns-dep=1}.
9162
9163 @item -fsched2-use-superblocks
9164 @opindex fsched2-use-superblocks
9165 When scheduling after register allocation, use superblock scheduling.
9166 This allows motion across basic block boundaries,
9167 resulting in faster schedules. This option is experimental, as not all machine
9168 descriptions used by GCC model the CPU closely enough to avoid unreliable
9169 results from the algorithm.
9170
9171 This only makes sense when scheduling after register allocation, i.e.@: with
9172 @option{-fschedule-insns2} or at @option{-O2} or higher.
9173
9174 @item -fsched-group-heuristic
9175 @opindex fsched-group-heuristic
9176 Enable the group heuristic in the scheduler. This heuristic favors
9177 the instruction that belongs to a schedule group. This is enabled
9178 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9179 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9180
9181 @item -fsched-critical-path-heuristic
9182 @opindex fsched-critical-path-heuristic
9183 Enable the critical-path heuristic in the scheduler. This heuristic favors
9184 instructions on the critical path. This is enabled by default when
9185 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9186 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9187
9188 @item -fsched-spec-insn-heuristic
9189 @opindex fsched-spec-insn-heuristic
9190 Enable the speculative instruction heuristic in the scheduler. This
9191 heuristic favors speculative instructions with greater dependency weakness.
9192 This is enabled by default when scheduling is enabled, i.e.@:
9193 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9194 or at @option{-O2} or higher.
9195
9196 @item -fsched-rank-heuristic
9197 @opindex fsched-rank-heuristic
9198 Enable the rank heuristic in the scheduler. This heuristic favors
9199 the instruction belonging to a basic block with greater size or frequency.
9200 This is enabled by default when scheduling is enabled, i.e.@:
9201 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9202 at @option{-O2} or higher.
9203
9204 @item -fsched-last-insn-heuristic
9205 @opindex fsched-last-insn-heuristic
9206 Enable the last-instruction heuristic in the scheduler. This heuristic
9207 favors the instruction that is less dependent on the last instruction
9208 scheduled. This is enabled by default when scheduling is enabled,
9209 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9210 at @option{-O2} or higher.
9211
9212 @item -fsched-dep-count-heuristic
9213 @opindex fsched-dep-count-heuristic
9214 Enable the dependent-count heuristic in the scheduler. This heuristic
9215 favors the instruction that has more instructions depending on it.
9216 This is enabled by default when scheduling is enabled, i.e.@:
9217 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9218 at @option{-O2} or higher.
9219
9220 @item -freschedule-modulo-scheduled-loops
9221 @opindex freschedule-modulo-scheduled-loops
9222 Modulo scheduling is performed before traditional scheduling. If a loop
9223 is modulo scheduled, later scheduling passes may change its schedule.
9224 Use this option to control that behavior.
9225
9226 @item -fselective-scheduling
9227 @opindex fselective-scheduling
9228 Schedule instructions using selective scheduling algorithm. Selective
9229 scheduling runs instead of the first scheduler pass.
9230
9231 @item -fselective-scheduling2
9232 @opindex fselective-scheduling2
9233 Schedule instructions using selective scheduling algorithm. Selective
9234 scheduling runs instead of the second scheduler pass.
9235
9236 @item -fsel-sched-pipelining
9237 @opindex fsel-sched-pipelining
9238 Enable software pipelining of innermost loops during selective scheduling.
9239 This option has no effect unless one of @option{-fselective-scheduling} or
9240 @option{-fselective-scheduling2} is turned on.
9241
9242 @item -fsel-sched-pipelining-outer-loops
9243 @opindex fsel-sched-pipelining-outer-loops
9244 When pipelining loops during selective scheduling, also pipeline outer loops.
9245 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9246
9247 @item -fsemantic-interposition
9248 @opindex fsemantic-interposition
9249 Some object formats, like ELF, allow interposing of symbols by the
9250 dynamic linker.
9251 This means that for symbols exported from the DSO, the compiler cannot perform
9252 interprocedural propagation, inlining and other optimizations in anticipation
9253 that the function or variable in question may change. While this feature is
9254 useful, for example, to rewrite memory allocation functions by a debugging
9255 implementation, it is expensive in the terms of code quality.
9256 With @option{-fno-semantic-interposition} the compiler assumes that
9257 if interposition happens for functions the overwriting function will have
9258 precisely the same semantics (and side effects).
9259 Similarly if interposition happens
9260 for variables, the constructor of the variable will be the same. The flag
9261 has no effect for functions explicitly declared inline
9262 (where it is never allowed for interposition to change semantics)
9263 and for symbols explicitly declared weak.
9264
9265 @item -fshrink-wrap
9266 @opindex fshrink-wrap
9267 Emit function prologues only before parts of the function that need it,
9268 rather than at the top of the function. This flag is enabled by default at
9269 @option{-O} and higher.
9270
9271 @item -fshrink-wrap-separate
9272 @opindex fshrink-wrap-separate
9273 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9274 those parts are only executed when needed.
9275 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9276 is also turned on and the target supports this.
9277
9278 @item -fcaller-saves
9279 @opindex fcaller-saves
9280 Enable allocation of values to registers that are clobbered by
9281 function calls, by emitting extra instructions to save and restore the
9282 registers around such calls. Such allocation is done only when it
9283 seems to result in better code.
9284
9285 This option is always enabled by default on certain machines, usually
9286 those which have no call-preserved registers to use instead.
9287
9288 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9289
9290 @item -fcombine-stack-adjustments
9291 @opindex fcombine-stack-adjustments
9292 Tracks stack adjustments (pushes and pops) and stack memory references
9293 and then tries to find ways to combine them.
9294
9295 Enabled by default at @option{-O1} and higher.
9296
9297 @item -fipa-ra
9298 @opindex fipa-ra
9299 Use caller save registers for allocation if those registers are not used by
9300 any called function. In that case it is not necessary to save and restore
9301 them around calls. This is only possible if called functions are part of
9302 same compilation unit as current function and they are compiled before it.
9303
9304 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9305 is disabled if generated code will be instrumented for profiling
9306 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9307 exactly (this happens on targets that do not expose prologues
9308 and epilogues in RTL).
9309
9310 @item -fconserve-stack
9311 @opindex fconserve-stack
9312 Attempt to minimize stack usage. The compiler attempts to use less
9313 stack space, even if that makes the program slower. This option
9314 implies setting the @option{large-stack-frame} parameter to 100
9315 and the @option{large-stack-frame-growth} parameter to 400.
9316
9317 @item -ftree-reassoc
9318 @opindex ftree-reassoc
9319 Perform reassociation on trees. This flag is enabled by default
9320 at @option{-O} and higher.
9321
9322 @item -fcode-hoisting
9323 @opindex fcode-hoisting
9324 Perform code hoisting. Code hoisting tries to move the
9325 evaluation of expressions executed on all paths to the function exit
9326 as early as possible. This is especially useful as a code size
9327 optimization, but it often helps for code speed as well.
9328 This flag is enabled by default at @option{-O2} and higher.
9329
9330 @item -ftree-pre
9331 @opindex ftree-pre
9332 Perform partial redundancy elimination (PRE) on trees. This flag is
9333 enabled by default at @option{-O2} and @option{-O3}.
9334
9335 @item -ftree-partial-pre
9336 @opindex ftree-partial-pre
9337 Make partial redundancy elimination (PRE) more aggressive. This flag is
9338 enabled by default at @option{-O3}.
9339
9340 @item -ftree-forwprop
9341 @opindex ftree-forwprop
9342 Perform forward propagation on trees. This flag is enabled by default
9343 at @option{-O} and higher.
9344
9345 @item -ftree-fre
9346 @opindex ftree-fre
9347 Perform full redundancy elimination (FRE) on trees. The difference
9348 between FRE and PRE is that FRE only considers expressions
9349 that are computed on all paths leading to the redundant computation.
9350 This analysis is faster than PRE, though it exposes fewer redundancies.
9351 This flag is enabled by default at @option{-O} and higher.
9352
9353 @item -ftree-phiprop
9354 @opindex ftree-phiprop
9355 Perform hoisting of loads from conditional pointers on trees. This
9356 pass is enabled by default at @option{-O} and higher.
9357
9358 @item -fhoist-adjacent-loads
9359 @opindex fhoist-adjacent-loads
9360 Speculatively hoist loads from both branches of an if-then-else if the
9361 loads are from adjacent locations in the same structure and the target
9362 architecture has a conditional move instruction. This flag is enabled
9363 by default at @option{-O2} and higher.
9364
9365 @item -ftree-copy-prop
9366 @opindex ftree-copy-prop
9367 Perform copy propagation on trees. This pass eliminates unnecessary
9368 copy operations. This flag is enabled by default at @option{-O} and
9369 higher.
9370
9371 @item -fipa-pure-const
9372 @opindex fipa-pure-const
9373 Discover which functions are pure or constant.
9374 Enabled by default at @option{-O} and higher.
9375
9376 @item -fipa-reference
9377 @opindex fipa-reference
9378 Discover which static variables do not escape the
9379 compilation unit.
9380 Enabled by default at @option{-O} and higher.
9381
9382 @item -fipa-reference-addressable
9383 @opindex fipa-reference-addressable
9384 Discover read-only, write-only and non-addressable static variables.
9385 Enabled by default at @option{-O} and higher.
9386
9387 @item -fipa-stack-alignment
9388 @opindex fipa-stack-alignment
9389 Reduce stack alignment on call sites if possible.
9390 Enabled by default.
9391
9392 @item -fipa-pta
9393 @opindex fipa-pta
9394 Perform interprocedural pointer analysis and interprocedural modification
9395 and reference analysis. This option can cause excessive memory and
9396 compile-time usage on large compilation units. It is not enabled by
9397 default at any optimization level.
9398
9399 @item -fipa-profile
9400 @opindex fipa-profile
9401 Perform interprocedural profile propagation. The functions called only from
9402 cold functions are marked as cold. Also functions executed once (such as
9403 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9404 functions and loop less parts of functions executed once are then optimized for
9405 size.
9406 Enabled by default at @option{-O} and higher.
9407
9408 @item -fipa-cp
9409 @opindex fipa-cp
9410 Perform interprocedural constant propagation.
9411 This optimization analyzes the program to determine when values passed
9412 to functions are constants and then optimizes accordingly.
9413 This optimization can substantially increase performance
9414 if the application has constants passed to functions.
9415 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9416 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9417
9418 @item -fipa-cp-clone
9419 @opindex fipa-cp-clone
9420 Perform function cloning to make interprocedural constant propagation stronger.
9421 When enabled, interprocedural constant propagation performs function cloning
9422 when externally visible function can be called with constant arguments.
9423 Because this optimization can create multiple copies of functions,
9424 it may significantly increase code size
9425 (see @option{--param ipcp-unit-growth=@var{value}}).
9426 This flag is enabled by default at @option{-O3}.
9427 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9428
9429 @item -fipa-bit-cp
9430 @opindex fipa-bit-cp
9431 When enabled, perform interprocedural bitwise constant
9432 propagation. This flag is enabled by default at @option{-O2} and
9433 by @option{-fprofile-use} and @option{-fauto-profile}.
9434 It requires that @option{-fipa-cp} is enabled.
9435
9436 @item -fipa-vrp
9437 @opindex fipa-vrp
9438 When enabled, perform interprocedural propagation of value
9439 ranges. This flag is enabled by default at @option{-O2}. It requires
9440 that @option{-fipa-cp} is enabled.
9441
9442 @item -fipa-icf
9443 @opindex fipa-icf
9444 Perform Identical Code Folding for functions and read-only variables.
9445 The optimization reduces code size and may disturb unwind stacks by replacing
9446 a function by equivalent one with a different name. The optimization works
9447 more effectively with link-time optimization enabled.
9448
9449 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9450 works on different levels and thus the optimizations are not same - there are
9451 equivalences that are found only by GCC and equivalences found only by Gold.
9452
9453 This flag is enabled by default at @option{-O2} and @option{-Os}.
9454
9455 @item -flive-patching=@var{level}
9456 @opindex flive-patching
9457 Control GCC's optimizations to produce output suitable for live-patching.
9458
9459 If the compiler's optimization uses a function's body or information extracted
9460 from its body to optimize/change another function, the latter is called an
9461 impacted function of the former. If a function is patched, its impacted
9462 functions should be patched too.
9463
9464 The impacted functions are determined by the compiler's interprocedural
9465 optimizations. For example, a caller is impacted when inlining a function
9466 into its caller,
9467 cloning a function and changing its caller to call this new clone,
9468 or extracting a function's pureness/constness information to optimize
9469 its direct or indirect callers, etc.
9470
9471 Usually, the more IPA optimizations enabled, the larger the number of
9472 impacted functions for each function. In order to control the number of
9473 impacted functions and more easily compute the list of impacted function,
9474 IPA optimizations can be partially enabled at two different levels.
9475
9476 The @var{level} argument should be one of the following:
9477
9478 @table @samp
9479
9480 @item inline-clone
9481
9482 Only enable inlining and cloning optimizations, which includes inlining,
9483 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9484 As a result, when patching a function, all its callers and its clones'
9485 callers are impacted, therefore need to be patched as well.
9486
9487 @option{-flive-patching=inline-clone} disables the following optimization flags:
9488 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9489 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9490 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9491 -fipa-stack-alignment}
9492
9493 @item inline-only-static
9494
9495 Only enable inlining of static functions.
9496 As a result, when patching a static function, all its callers are impacted
9497 and so need to be patched as well.
9498
9499 In addition to all the flags that @option{-flive-patching=inline-clone}
9500 disables,
9501 @option{-flive-patching=inline-only-static} disables the following additional
9502 optimization flags:
9503 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9504
9505 @end table
9506
9507 When @option{-flive-patching} is specified without any value, the default value
9508 is @var{inline-clone}.
9509
9510 This flag is disabled by default.
9511
9512 Note that @option{-flive-patching} is not supported with link-time optimization
9513 (@option{-flto}).
9514
9515 @item -fisolate-erroneous-paths-dereference
9516 @opindex fisolate-erroneous-paths-dereference
9517 Detect paths that trigger erroneous or undefined behavior due to
9518 dereferencing a null pointer. Isolate those paths from the main control
9519 flow and turn the statement with erroneous or undefined behavior into a trap.
9520 This flag is enabled by default at @option{-O2} and higher and depends on
9521 @option{-fdelete-null-pointer-checks} also being enabled.
9522
9523 @item -fisolate-erroneous-paths-attribute
9524 @opindex fisolate-erroneous-paths-attribute
9525 Detect paths that trigger erroneous or undefined behavior due to a null value
9526 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9527 attribute. Isolate those paths from the main control flow and turn the
9528 statement with erroneous or undefined behavior into a trap. This is not
9529 currently enabled, but may be enabled by @option{-O2} in the future.
9530
9531 @item -ftree-sink
9532 @opindex ftree-sink
9533 Perform forward store motion on trees. This flag is
9534 enabled by default at @option{-O} and higher.
9535
9536 @item -ftree-bit-ccp
9537 @opindex ftree-bit-ccp
9538 Perform sparse conditional bit constant propagation on trees and propagate
9539 pointer alignment information.
9540 This pass only operates on local scalar variables and is enabled by default
9541 at @option{-O1} and higher, except for @option{-Og}.
9542 It requires that @option{-ftree-ccp} is enabled.
9543
9544 @item -ftree-ccp
9545 @opindex ftree-ccp
9546 Perform sparse conditional constant propagation (CCP) on trees. This
9547 pass only operates on local scalar variables and is enabled by default
9548 at @option{-O} and higher.
9549
9550 @item -fssa-backprop
9551 @opindex fssa-backprop
9552 Propagate information about uses of a value up the definition chain
9553 in order to simplify the definitions. For example, this pass strips
9554 sign operations if the sign of a value never matters. The flag is
9555 enabled by default at @option{-O} and higher.
9556
9557 @item -fssa-phiopt
9558 @opindex fssa-phiopt
9559 Perform pattern matching on SSA PHI nodes to optimize conditional
9560 code. This pass is enabled by default at @option{-O1} and higher,
9561 except for @option{-Og}.
9562
9563 @item -ftree-switch-conversion
9564 @opindex ftree-switch-conversion
9565 Perform conversion of simple initializations in a switch to
9566 initializations from a scalar array. This flag is enabled by default
9567 at @option{-O2} and higher.
9568
9569 @item -ftree-tail-merge
9570 @opindex ftree-tail-merge
9571 Look for identical code sequences. When found, replace one with a jump to the
9572 other. This optimization is known as tail merging or cross jumping. This flag
9573 is enabled by default at @option{-O2} and higher. The compilation time
9574 in this pass can
9575 be limited using @option{max-tail-merge-comparisons} parameter and
9576 @option{max-tail-merge-iterations} parameter.
9577
9578 @item -ftree-dce
9579 @opindex ftree-dce
9580 Perform dead code elimination (DCE) on trees. This flag is enabled by
9581 default at @option{-O} and higher.
9582
9583 @item -ftree-builtin-call-dce
9584 @opindex ftree-builtin-call-dce
9585 Perform conditional dead code elimination (DCE) for calls to built-in functions
9586 that may set @code{errno} but are otherwise free of side effects. This flag is
9587 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9588 specified.
9589
9590 @item -ffinite-loops
9591 @opindex ffinite-loops
9592 @opindex fno-finite-loops
9593 Assume that a loop with an exit will eventually take the exit and not loop
9594 indefinitely. This allows the compiler to remove loops that otherwise have
9595 no side-effects, not considering eventual endless looping as such.
9596
9597 This option is enabled by default at @option{-O2}.
9598
9599 @item -ftree-dominator-opts
9600 @opindex ftree-dominator-opts
9601 Perform a variety of simple scalar cleanups (constant/copy
9602 propagation, redundancy elimination, range propagation and expression
9603 simplification) based on a dominator tree traversal. This also
9604 performs jump threading (to reduce jumps to jumps). This flag is
9605 enabled by default at @option{-O} and higher.
9606
9607 @item -ftree-dse
9608 @opindex ftree-dse
9609 Perform dead store elimination (DSE) on trees. A dead store is a store into
9610 a memory location that is later overwritten by another store without
9611 any intervening loads. In this case the earlier store can be deleted. This
9612 flag is enabled by default at @option{-O} and higher.
9613
9614 @item -ftree-ch
9615 @opindex ftree-ch
9616 Perform loop header copying on trees. This is beneficial since it increases
9617 effectiveness of code motion optimizations. It also saves one jump. This flag
9618 is enabled by default at @option{-O} and higher. It is not enabled
9619 for @option{-Os}, since it usually increases code size.
9620
9621 @item -ftree-loop-optimize
9622 @opindex ftree-loop-optimize
9623 Perform loop optimizations on trees. This flag is enabled by default
9624 at @option{-O} and higher.
9625
9626 @item -ftree-loop-linear
9627 @itemx -floop-strip-mine
9628 @itemx -floop-block
9629 @opindex ftree-loop-linear
9630 @opindex floop-strip-mine
9631 @opindex floop-block
9632 Perform loop nest optimizations. Same as
9633 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9634 to be configured with @option{--with-isl} to enable the Graphite loop
9635 transformation infrastructure.
9636
9637 @item -fgraphite-identity
9638 @opindex fgraphite-identity
9639 Enable the identity transformation for graphite. For every SCoP we generate
9640 the polyhedral representation and transform it back to gimple. Using
9641 @option{-fgraphite-identity} we can check the costs or benefits of the
9642 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9643 are also performed by the code generator isl, like index splitting and
9644 dead code elimination in loops.
9645
9646 @item -floop-nest-optimize
9647 @opindex floop-nest-optimize
9648 Enable the isl based loop nest optimizer. This is a generic loop nest
9649 optimizer based on the Pluto optimization algorithms. It calculates a loop
9650 structure optimized for data-locality and parallelism. This option
9651 is experimental.
9652
9653 @item -floop-parallelize-all
9654 @opindex floop-parallelize-all
9655 Use the Graphite data dependence analysis to identify loops that can
9656 be parallelized. Parallelize all the loops that can be analyzed to
9657 not contain loop carried dependences without checking that it is
9658 profitable to parallelize the loops.
9659
9660 @item -ftree-coalesce-vars
9661 @opindex ftree-coalesce-vars
9662 While transforming the program out of the SSA representation, attempt to
9663 reduce copying by coalescing versions of different user-defined
9664 variables, instead of just compiler temporaries. This may severely
9665 limit the ability to debug an optimized program compiled with
9666 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9667 prevents SSA coalescing of user variables. This option is enabled by
9668 default if optimization is enabled, and it does very little otherwise.
9669
9670 @item -ftree-loop-if-convert
9671 @opindex ftree-loop-if-convert
9672 Attempt to transform conditional jumps in the innermost loops to
9673 branch-less equivalents. The intent is to remove control-flow from
9674 the innermost loops in order to improve the ability of the
9675 vectorization pass to handle these loops. This is enabled by default
9676 if vectorization is enabled.
9677
9678 @item -ftree-loop-distribution
9679 @opindex ftree-loop-distribution
9680 Perform loop distribution. This flag can improve cache performance on
9681 big loop bodies and allow further loop optimizations, like
9682 parallelization or vectorization, to take place. For example, the loop
9683 @smallexample
9684 DO I = 1, N
9685 A(I) = B(I) + C
9686 D(I) = E(I) * F
9687 ENDDO
9688 @end smallexample
9689 is transformed to
9690 @smallexample
9691 DO I = 1, N
9692 A(I) = B(I) + C
9693 ENDDO
9694 DO I = 1, N
9695 D(I) = E(I) * F
9696 ENDDO
9697 @end smallexample
9698 This flag is enabled by default at @option{-O3}.
9699 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9700
9701 @item -ftree-loop-distribute-patterns
9702 @opindex ftree-loop-distribute-patterns
9703 Perform loop distribution of patterns that can be code generated with
9704 calls to a library. This flag is enabled by default at @option{-O3}, and
9705 by @option{-fprofile-use} and @option{-fauto-profile}.
9706
9707 This pass distributes the initialization loops and generates a call to
9708 memset zero. For example, the loop
9709 @smallexample
9710 DO I = 1, N
9711 A(I) = 0
9712 B(I) = A(I) + I
9713 ENDDO
9714 @end smallexample
9715 is transformed to
9716 @smallexample
9717 DO I = 1, N
9718 A(I) = 0
9719 ENDDO
9720 DO I = 1, N
9721 B(I) = A(I) + I
9722 ENDDO
9723 @end smallexample
9724 and the initialization loop is transformed into a call to memset zero.
9725 This flag is enabled by default at @option{-O3}.
9726 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9727
9728 @item -floop-interchange
9729 @opindex floop-interchange
9730 Perform loop interchange outside of graphite. This flag can improve cache
9731 performance on loop nest and allow further loop optimizations, like
9732 vectorization, to take place. For example, the loop
9733 @smallexample
9734 for (int i = 0; i < N; i++)
9735 for (int j = 0; j < N; j++)
9736 for (int k = 0; k < N; k++)
9737 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9738 @end smallexample
9739 is transformed to
9740 @smallexample
9741 for (int i = 0; i < N; i++)
9742 for (int k = 0; k < N; k++)
9743 for (int j = 0; j < N; j++)
9744 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9745 @end smallexample
9746 This flag is enabled by default at @option{-O3}.
9747 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9748
9749 @item -floop-unroll-and-jam
9750 @opindex floop-unroll-and-jam
9751 Apply unroll and jam transformations on feasible loops. In a loop
9752 nest this unrolls the outer loop by some factor and fuses the resulting
9753 multiple inner loops. This flag is enabled by default at @option{-O3}.
9754 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9755
9756 @item -ftree-loop-im
9757 @opindex ftree-loop-im
9758 Perform loop invariant motion on trees. This pass moves only invariants that
9759 are hard to handle at RTL level (function calls, operations that expand to
9760 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9761 operands of conditions that are invariant out of the loop, so that we can use
9762 just trivial invariantness analysis in loop unswitching. The pass also includes
9763 store motion.
9764
9765 @item -ftree-loop-ivcanon
9766 @opindex ftree-loop-ivcanon
9767 Create a canonical counter for number of iterations in loops for which
9768 determining number of iterations requires complicated analysis. Later
9769 optimizations then may determine the number easily. Useful especially
9770 in connection with unrolling.
9771
9772 @item -ftree-scev-cprop
9773 @opindex ftree-scev-cprop
9774 Perform final value replacement. If a variable is modified in a loop
9775 in such a way that its value when exiting the loop can be determined using
9776 only its initial value and the number of loop iterations, replace uses of
9777 the final value by such a computation, provided it is sufficiently cheap.
9778 This reduces data dependencies and may allow further simplifications.
9779 Enabled by default at @option{-O} and higher.
9780
9781 @item -fivopts
9782 @opindex fivopts
9783 Perform induction variable optimizations (strength reduction, induction
9784 variable merging and induction variable elimination) on trees.
9785
9786 @item -ftree-parallelize-loops=n
9787 @opindex ftree-parallelize-loops
9788 Parallelize loops, i.e., split their iteration space to run in n threads.
9789 This is only possible for loops whose iterations are independent
9790 and can be arbitrarily reordered. The optimization is only
9791 profitable on multiprocessor machines, for loops that are CPU-intensive,
9792 rather than constrained e.g.@: by memory bandwidth. This option
9793 implies @option{-pthread}, and thus is only supported on targets
9794 that have support for @option{-pthread}.
9795
9796 @item -ftree-pta
9797 @opindex ftree-pta
9798 Perform function-local points-to analysis on trees. This flag is
9799 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9800
9801 @item -ftree-sra
9802 @opindex ftree-sra
9803 Perform scalar replacement of aggregates. This pass replaces structure
9804 references with scalars to prevent committing structures to memory too
9805 early. This flag is enabled by default at @option{-O1} and higher,
9806 except for @option{-Og}.
9807
9808 @item -fstore-merging
9809 @opindex fstore-merging
9810 Perform merging of narrow stores to consecutive memory addresses. This pass
9811 merges contiguous stores of immediate values narrower than a word into fewer
9812 wider stores to reduce the number of instructions. This is enabled by default
9813 at @option{-O2} and higher as well as @option{-Os}.
9814
9815 @item -ftree-ter
9816 @opindex ftree-ter
9817 Perform temporary expression replacement during the SSA->normal phase. Single
9818 use/single def temporaries are replaced at their use location with their
9819 defining expression. This results in non-GIMPLE code, but gives the expanders
9820 much more complex trees to work on resulting in better RTL generation. This is
9821 enabled by default at @option{-O} and higher.
9822
9823 @item -ftree-slsr
9824 @opindex ftree-slsr
9825 Perform straight-line strength reduction on trees. This recognizes related
9826 expressions involving multiplications and replaces them by less expensive
9827 calculations when possible. This is enabled by default at @option{-O} and
9828 higher.
9829
9830 @item -ftree-vectorize
9831 @opindex ftree-vectorize
9832 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9833 and @option{-ftree-slp-vectorize} if not explicitly specified.
9834
9835 @item -ftree-loop-vectorize
9836 @opindex ftree-loop-vectorize
9837 Perform loop vectorization on trees. This flag is enabled by default at
9838 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9839 and @option{-fauto-profile}.
9840
9841 @item -ftree-slp-vectorize
9842 @opindex ftree-slp-vectorize
9843 Perform basic block vectorization on trees. This flag is enabled by default at
9844 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9845 and @option{-fauto-profile}.
9846
9847 @item -fvect-cost-model=@var{model}
9848 @opindex fvect-cost-model
9849 Alter the cost model used for vectorization. The @var{model} argument
9850 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9851 With the @samp{unlimited} model the vectorized code-path is assumed
9852 to be profitable while with the @samp{dynamic} model a runtime check
9853 guards the vectorized code-path to enable it only for iteration
9854 counts that will likely execute faster than when executing the original
9855 scalar loop. The @samp{cheap} model disables vectorization of
9856 loops where doing so would be cost prohibitive for example due to
9857 required runtime checks for data dependence or alignment but otherwise
9858 is equal to the @samp{dynamic} model.
9859 The default cost model depends on other optimization flags and is
9860 either @samp{dynamic} or @samp{cheap}.
9861
9862 @item -fsimd-cost-model=@var{model}
9863 @opindex fsimd-cost-model
9864 Alter the cost model used for vectorization of loops marked with the OpenMP
9865 simd directive. The @var{model} argument should be one of
9866 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9867 have the same meaning as described in @option{-fvect-cost-model} and by
9868 default a cost model defined with @option{-fvect-cost-model} is used.
9869
9870 @item -ftree-vrp
9871 @opindex ftree-vrp
9872 Perform Value Range Propagation on trees. This is similar to the
9873 constant propagation pass, but instead of values, ranges of values are
9874 propagated. This allows the optimizers to remove unnecessary range
9875 checks like array bound checks and null pointer checks. This is
9876 enabled by default at @option{-O2} and higher. Null pointer check
9877 elimination is only done if @option{-fdelete-null-pointer-checks} is
9878 enabled.
9879
9880 @item -fsplit-paths
9881 @opindex fsplit-paths
9882 Split paths leading to loop backedges. This can improve dead code
9883 elimination and common subexpression elimination. This is enabled by
9884 default at @option{-O3} and above.
9885
9886 @item -fsplit-ivs-in-unroller
9887 @opindex fsplit-ivs-in-unroller
9888 Enables expression of values of induction variables in later iterations
9889 of the unrolled loop using the value in the first iteration. This breaks
9890 long dependency chains, thus improving efficiency of the scheduling passes.
9891
9892 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9893 same effect. However, that is not reliable in cases where the loop body
9894 is more complicated than a single basic block. It also does not work at all
9895 on some architectures due to restrictions in the CSE pass.
9896
9897 This optimization is enabled by default.
9898
9899 @item -fvariable-expansion-in-unroller
9900 @opindex fvariable-expansion-in-unroller
9901 With this option, the compiler creates multiple copies of some
9902 local variables when unrolling a loop, which can result in superior code.
9903
9904 This optimization is enabled by default for PowerPC targets, but disabled
9905 by default otherwise.
9906
9907 @item -fpartial-inlining
9908 @opindex fpartial-inlining
9909 Inline parts of functions. This option has any effect only
9910 when inlining itself is turned on by the @option{-finline-functions}
9911 or @option{-finline-small-functions} options.
9912
9913 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9914
9915 @item -fpredictive-commoning
9916 @opindex fpredictive-commoning
9917 Perform predictive commoning optimization, i.e., reusing computations
9918 (especially memory loads and stores) performed in previous
9919 iterations of loops.
9920
9921 This option is enabled at level @option{-O3}.
9922 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9923
9924 @item -fprefetch-loop-arrays
9925 @opindex fprefetch-loop-arrays
9926 If supported by the target machine, generate instructions to prefetch
9927 memory to improve the performance of loops that access large arrays.
9928
9929 This option may generate better or worse code; results are highly
9930 dependent on the structure of loops within the source code.
9931
9932 Disabled at level @option{-Os}.
9933
9934 @item -fno-printf-return-value
9935 @opindex fno-printf-return-value
9936 @opindex fprintf-return-value
9937 Do not substitute constants for known return value of formatted output
9938 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9939 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9940 transformation allows GCC to optimize or even eliminate branches based
9941 on the known return value of these functions called with arguments that
9942 are either constant, or whose values are known to be in a range that
9943 makes determining the exact return value possible. For example, when
9944 @option{-fprintf-return-value} is in effect, both the branch and the
9945 body of the @code{if} statement (but not the call to @code{snprint})
9946 can be optimized away when @code{i} is a 32-bit or smaller integer
9947 because the return value is guaranteed to be at most 8.
9948
9949 @smallexample
9950 char buf[9];
9951 if (snprintf (buf, "%08x", i) >= sizeof buf)
9952 @dots{}
9953 @end smallexample
9954
9955 The @option{-fprintf-return-value} option relies on other optimizations
9956 and yields best results with @option{-O2} and above. It works in tandem
9957 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9958 options. The @option{-fprintf-return-value} option is enabled by default.
9959
9960 @item -fno-peephole
9961 @itemx -fno-peephole2
9962 @opindex fno-peephole
9963 @opindex fpeephole
9964 @opindex fno-peephole2
9965 @opindex fpeephole2
9966 Disable any machine-specific peephole optimizations. The difference
9967 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9968 are implemented in the compiler; some targets use one, some use the
9969 other, a few use both.
9970
9971 @option{-fpeephole} is enabled by default.
9972 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9973
9974 @item -fno-guess-branch-probability
9975 @opindex fno-guess-branch-probability
9976 @opindex fguess-branch-probability
9977 Do not guess branch probabilities using heuristics.
9978
9979 GCC uses heuristics to guess branch probabilities if they are
9980 not provided by profiling feedback (@option{-fprofile-arcs}). These
9981 heuristics are based on the control flow graph. If some branch probabilities
9982 are specified by @code{__builtin_expect}, then the heuristics are
9983 used to guess branch probabilities for the rest of the control flow graph,
9984 taking the @code{__builtin_expect} info into account. The interactions
9985 between the heuristics and @code{__builtin_expect} can be complex, and in
9986 some cases, it may be useful to disable the heuristics so that the effects
9987 of @code{__builtin_expect} are easier to understand.
9988
9989 It is also possible to specify expected probability of the expression
9990 with @code{__builtin_expect_with_probability} built-in function.
9991
9992 The default is @option{-fguess-branch-probability} at levels
9993 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9994
9995 @item -freorder-blocks
9996 @opindex freorder-blocks
9997 Reorder basic blocks in the compiled function in order to reduce number of
9998 taken branches and improve code locality.
9999
10000 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10001
10002 @item -freorder-blocks-algorithm=@var{algorithm}
10003 @opindex freorder-blocks-algorithm
10004 Use the specified algorithm for basic block reordering. The
10005 @var{algorithm} argument can be @samp{simple}, which does not increase
10006 code size (except sometimes due to secondary effects like alignment),
10007 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
10008 put all often executed code together, minimizing the number of branches
10009 executed by making extra copies of code.
10010
10011 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
10012 @samp{stc} at levels @option{-O2}, @option{-O3}.
10013
10014 @item -freorder-blocks-and-partition
10015 @opindex freorder-blocks-and-partition
10016 In addition to reordering basic blocks in the compiled function, in order
10017 to reduce number of taken branches, partitions hot and cold basic blocks
10018 into separate sections of the assembly and @file{.o} files, to improve
10019 paging and cache locality performance.
10020
10021 This optimization is automatically turned off in the presence of
10022 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10023 section attribute and on any architecture that does not support named
10024 sections. When @option{-fsplit-stack} is used this option is not
10025 enabled by default (to avoid linker errors), but may be enabled
10026 explicitly (if using a working linker).
10027
10028 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10029
10030 @item -freorder-functions
10031 @opindex freorder-functions
10032 Reorder functions in the object file in order to
10033 improve code locality. This is implemented by using special
10034 subsections @code{.text.hot} for most frequently executed functions and
10035 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10036 the linker so object file format must support named sections and linker must
10037 place them in a reasonable way.
10038
10039 This option isn't effective unless you either provide profile feedback
10040 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10041 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10042
10043 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10044
10045 @item -fstrict-aliasing
10046 @opindex fstrict-aliasing
10047 Allow the compiler to assume the strictest aliasing rules applicable to
10048 the language being compiled. For C (and C++), this activates
10049 optimizations based on the type of expressions. In particular, an
10050 object of one type is assumed never to reside at the same address as an
10051 object of a different type, unless the types are almost the same. For
10052 example, an @code{unsigned int} can alias an @code{int}, but not a
10053 @code{void*} or a @code{double}. A character type may alias any other
10054 type.
10055
10056 @anchor{Type-punning}Pay special attention to code like this:
10057 @smallexample
10058 union a_union @{
10059 int i;
10060 double d;
10061 @};
10062
10063 int f() @{
10064 union a_union t;
10065 t.d = 3.0;
10066 return t.i;
10067 @}
10068 @end smallexample
10069 The practice of reading from a different union member than the one most
10070 recently written to (called ``type-punning'') is common. Even with
10071 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10072 is accessed through the union type. So, the code above works as
10073 expected. @xref{Structures unions enumerations and bit-fields
10074 implementation}. However, this code might not:
10075 @smallexample
10076 int f() @{
10077 union a_union t;
10078 int* ip;
10079 t.d = 3.0;
10080 ip = &t.i;
10081 return *ip;
10082 @}
10083 @end smallexample
10084
10085 Similarly, access by taking the address, casting the resulting pointer
10086 and dereferencing the result has undefined behavior, even if the cast
10087 uses a union type, e.g.:
10088 @smallexample
10089 int f() @{
10090 double d = 3.0;
10091 return ((union a_union *) &d)->i;
10092 @}
10093 @end smallexample
10094
10095 The @option{-fstrict-aliasing} option is enabled at levels
10096 @option{-O2}, @option{-O3}, @option{-Os}.
10097
10098 @item -falign-functions
10099 @itemx -falign-functions=@var{n}
10100 @itemx -falign-functions=@var{n}:@var{m}
10101 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10102 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10103 @opindex falign-functions
10104 Align the start of functions to the next power-of-two greater than
10105 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10106 the first @var{m} bytes of the function can be fetched by the CPU
10107 without crossing an @var{n}-byte alignment boundary.
10108
10109 If @var{m} is not specified, it defaults to @var{n}.
10110
10111 Examples: @option{-falign-functions=32} aligns functions to the next
10112 32-byte boundary, @option{-falign-functions=24} aligns to the next
10113 32-byte boundary only if this can be done by skipping 23 bytes or less,
10114 @option{-falign-functions=32:7} aligns to the next
10115 32-byte boundary only if this can be done by skipping 6 bytes or less.
10116
10117 The second pair of @var{n2}:@var{m2} values allows you to specify
10118 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10119 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10120 otherwise aligns to the next 32-byte boundary if this can be done
10121 by skipping 2 bytes or less.
10122 If @var{m2} is not specified, it defaults to @var{n2}.
10123
10124 Some assemblers only support this flag when @var{n} is a power of two;
10125 in that case, it is rounded up.
10126
10127 @option{-fno-align-functions} and @option{-falign-functions=1} are
10128 equivalent and mean that functions are not aligned.
10129
10130 If @var{n} is not specified or is zero, use a machine-dependent default.
10131 The maximum allowed @var{n} option value is 65536.
10132
10133 Enabled at levels @option{-O2}, @option{-O3}.
10134
10135 @item -flimit-function-alignment
10136 If this option is enabled, the compiler tries to avoid unnecessarily
10137 overaligning functions. It attempts to instruct the assembler to align
10138 by the amount specified by @option{-falign-functions}, but not to
10139 skip more bytes than the size of the function.
10140
10141 @item -falign-labels
10142 @itemx -falign-labels=@var{n}
10143 @itemx -falign-labels=@var{n}:@var{m}
10144 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10145 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10146 @opindex falign-labels
10147 Align all branch targets to a power-of-two boundary.
10148
10149 Parameters of this option are analogous to the @option{-falign-functions} option.
10150 @option{-fno-align-labels} and @option{-falign-labels=1} are
10151 equivalent and mean that labels are not aligned.
10152
10153 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10154 are greater than this value, then their values are used instead.
10155
10156 If @var{n} is not specified or is zero, use a machine-dependent default
10157 which is very likely to be @samp{1}, meaning no alignment.
10158 The maximum allowed @var{n} option value is 65536.
10159
10160 Enabled at levels @option{-O2}, @option{-O3}.
10161
10162 @item -falign-loops
10163 @itemx -falign-loops=@var{n}
10164 @itemx -falign-loops=@var{n}:@var{m}
10165 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10166 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10167 @opindex falign-loops
10168 Align loops to a power-of-two boundary. If the loops are executed
10169 many times, this makes up for any execution of the dummy padding
10170 instructions.
10171
10172 Parameters of this option are analogous to the @option{-falign-functions} option.
10173 @option{-fno-align-loops} and @option{-falign-loops=1} are
10174 equivalent and mean that loops are not aligned.
10175 The maximum allowed @var{n} option value is 65536.
10176
10177 If @var{n} is not specified or is zero, use a machine-dependent default.
10178
10179 Enabled at levels @option{-O2}, @option{-O3}.
10180
10181 @item -falign-jumps
10182 @itemx -falign-jumps=@var{n}
10183 @itemx -falign-jumps=@var{n}:@var{m}
10184 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10185 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10186 @opindex falign-jumps
10187 Align branch targets to a power-of-two boundary, for branch targets
10188 where the targets can only be reached by jumping. In this case,
10189 no dummy operations need be executed.
10190
10191 Parameters of this option are analogous to the @option{-falign-functions} option.
10192 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10193 equivalent and mean that loops are not aligned.
10194
10195 If @var{n} is not specified or is zero, use a machine-dependent default.
10196 The maximum allowed @var{n} option value is 65536.
10197
10198 Enabled at levels @option{-O2}, @option{-O3}.
10199
10200 @item -funit-at-a-time
10201 @opindex funit-at-a-time
10202 This option is left for compatibility reasons. @option{-funit-at-a-time}
10203 has no effect, while @option{-fno-unit-at-a-time} implies
10204 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10205
10206 Enabled by default.
10207
10208 @item -fno-toplevel-reorder
10209 @opindex fno-toplevel-reorder
10210 @opindex ftoplevel-reorder
10211 Do not reorder top-level functions, variables, and @code{asm}
10212 statements. Output them in the same order that they appear in the
10213 input file. When this option is used, unreferenced static variables
10214 are not removed. This option is intended to support existing code
10215 that relies on a particular ordering. For new code, it is better to
10216 use attributes when possible.
10217
10218 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10219 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10220 Additionally @option{-fno-toplevel-reorder} implies
10221 @option{-fno-section-anchors}.
10222
10223 @item -fweb
10224 @opindex fweb
10225 Constructs webs as commonly used for register allocation purposes and assign
10226 each web individual pseudo register. This allows the register allocation pass
10227 to operate on pseudos directly, but also strengthens several other optimization
10228 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10229 however, make debugging impossible, since variables no longer stay in a
10230 ``home register''.
10231
10232 Enabled by default with @option{-funroll-loops}.
10233
10234 @item -fwhole-program
10235 @opindex fwhole-program
10236 Assume that the current compilation unit represents the whole program being
10237 compiled. All public functions and variables with the exception of @code{main}
10238 and those merged by attribute @code{externally_visible} become static functions
10239 and in effect are optimized more aggressively by interprocedural optimizers.
10240
10241 This option should not be used in combination with @option{-flto}.
10242 Instead relying on a linker plugin should provide safer and more precise
10243 information.
10244
10245 @item -flto[=@var{n}]
10246 @opindex flto
10247 This option runs the standard link-time optimizer. When invoked
10248 with source code, it generates GIMPLE (one of GCC's internal
10249 representations) and writes it to special ELF sections in the object
10250 file. When the object files are linked together, all the function
10251 bodies are read from these ELF sections and instantiated as if they
10252 had been part of the same translation unit.
10253
10254 To use the link-time optimizer, @option{-flto} and optimization
10255 options should be specified at compile time and during the final link.
10256 It is recommended that you compile all the files participating in the
10257 same link with the same options and also specify those options at
10258 link time.
10259 For example:
10260
10261 @smallexample
10262 gcc -c -O2 -flto foo.c
10263 gcc -c -O2 -flto bar.c
10264 gcc -o myprog -flto -O2 foo.o bar.o
10265 @end smallexample
10266
10267 The first two invocations to GCC save a bytecode representation
10268 of GIMPLE into special ELF sections inside @file{foo.o} and
10269 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10270 @file{foo.o} and @file{bar.o}, merges the two files into a single
10271 internal image, and compiles the result as usual. Since both
10272 @file{foo.o} and @file{bar.o} are merged into a single image, this
10273 causes all the interprocedural analyses and optimizations in GCC to
10274 work across the two files as if they were a single one. This means,
10275 for example, that the inliner is able to inline functions in
10276 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10277
10278 Another (simpler) way to enable link-time optimization is:
10279
10280 @smallexample
10281 gcc -o myprog -flto -O2 foo.c bar.c
10282 @end smallexample
10283
10284 The above generates bytecode for @file{foo.c} and @file{bar.c},
10285 merges them together into a single GIMPLE representation and optimizes
10286 them as usual to produce @file{myprog}.
10287
10288 The important thing to keep in mind is that to enable link-time
10289 optimizations you need to use the GCC driver to perform the link step.
10290 GCC automatically performs link-time optimization if any of the
10291 objects involved were compiled with the @option{-flto} command-line option.
10292 You can always override
10293 the automatic decision to do link-time optimization
10294 by passing @option{-fno-lto} to the link command.
10295
10296 To make whole program optimization effective, it is necessary to make
10297 certain whole program assumptions. The compiler needs to know
10298 what functions and variables can be accessed by libraries and runtime
10299 outside of the link-time optimized unit. When supported by the linker,
10300 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10301 to the compiler about used and externally visible symbols. When
10302 the linker plugin is not available, @option{-fwhole-program} should be
10303 used to allow the compiler to make these assumptions, which leads
10304 to more aggressive optimization decisions.
10305
10306 When a file is compiled with @option{-flto} without
10307 @option{-fuse-linker-plugin}, the generated object file is larger than
10308 a regular object file because it contains GIMPLE bytecodes and the usual
10309 final code (see @option{-ffat-lto-objects}. This means that
10310 object files with LTO information can be linked as normal object
10311 files; if @option{-fno-lto} is passed to the linker, no
10312 interprocedural optimizations are applied. Note that when
10313 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10314 but you cannot perform a regular, non-LTO link on them.
10315
10316 When producing the final binary, GCC only
10317 applies link-time optimizations to those files that contain bytecode.
10318 Therefore, you can mix and match object files and libraries with
10319 GIMPLE bytecodes and final object code. GCC automatically selects
10320 which files to optimize in LTO mode and which files to link without
10321 further processing.
10322
10323 Generally, options specified at link time override those
10324 specified at compile time, although in some cases GCC attempts to infer
10325 link-time options from the settings used to compile the input files.
10326
10327 If you do not specify an optimization level option @option{-O} at
10328 link time, then GCC uses the highest optimization level
10329 used when compiling the object files. Note that it is generally
10330 ineffective to specify an optimization level option only at link time and
10331 not at compile time, for two reasons. First, compiling without
10332 optimization suppresses compiler passes that gather information
10333 needed for effective optimization at link time. Second, some early
10334 optimization passes can be performed only at compile time and
10335 not at link time.
10336
10337 There are some code generation flags preserved by GCC when
10338 generating bytecodes, as they need to be used during the final link.
10339 Currently, the following options and their settings are taken from
10340 the first object file that explicitly specifies them:
10341 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10342 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10343 and all the @option{-m} target flags.
10344
10345 Certain ABI-changing flags are required to match in all compilation units,
10346 and trying to override this at link time with a conflicting value
10347 is ignored. This includes options such as @option{-freg-struct-return}
10348 and @option{-fpcc-struct-return}.
10349
10350 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10351 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10352 are passed through to the link stage and merged conservatively for
10353 conflicting translation units. Specifically
10354 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10355 precedence; and for example @option{-ffp-contract=off} takes precedence
10356 over @option{-ffp-contract=fast}. You can override them at link time.
10357
10358 If LTO encounters objects with C linkage declared with incompatible
10359 types in separate translation units to be linked together (undefined
10360 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10361 issued. The behavior is still undefined at run time. Similar
10362 diagnostics may be raised for other languages.
10363
10364 Another feature of LTO is that it is possible to apply interprocedural
10365 optimizations on files written in different languages:
10366
10367 @smallexample
10368 gcc -c -flto foo.c
10369 g++ -c -flto bar.cc
10370 gfortran -c -flto baz.f90
10371 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10372 @end smallexample
10373
10374 Notice that the final link is done with @command{g++} to get the C++
10375 runtime libraries and @option{-lgfortran} is added to get the Fortran
10376 runtime libraries. In general, when mixing languages in LTO mode, you
10377 should use the same link command options as when mixing languages in a
10378 regular (non-LTO) compilation.
10379
10380 If object files containing GIMPLE bytecode are stored in a library archive, say
10381 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10382 are using a linker with plugin support. To create static libraries suitable
10383 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10384 and @command{ranlib};
10385 to show the symbols of object files with GIMPLE bytecode, use
10386 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10387 and @command{nm} have been compiled with plugin support. At link time, use the
10388 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10389 the LTO optimization process:
10390
10391 @smallexample
10392 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10393 @end smallexample
10394
10395 With the linker plugin enabled, the linker extracts the needed
10396 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10397 to make them part of the aggregated GIMPLE image to be optimized.
10398
10399 If you are not using a linker with plugin support and/or do not
10400 enable the linker plugin, then the objects inside @file{libfoo.a}
10401 are extracted and linked as usual, but they do not participate
10402 in the LTO optimization process. In order to make a static library suitable
10403 for both LTO optimization and usual linkage, compile its object files with
10404 @option{-flto} @option{-ffat-lto-objects}.
10405
10406 Link-time optimizations do not require the presence of the whole program to
10407 operate. If the program does not require any symbols to be exported, it is
10408 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10409 the interprocedural optimizers to use more aggressive assumptions which may
10410 lead to improved optimization opportunities.
10411 Use of @option{-fwhole-program} is not needed when linker plugin is
10412 active (see @option{-fuse-linker-plugin}).
10413
10414 The current implementation of LTO makes no
10415 attempt to generate bytecode that is portable between different
10416 types of hosts. The bytecode files are versioned and there is a
10417 strict version check, so bytecode files generated in one version of
10418 GCC do not work with an older or newer version of GCC.
10419
10420 Link-time optimization does not work well with generation of debugging
10421 information on systems other than those using a combination of ELF and
10422 DWARF.
10423
10424 If you specify the optional @var{n}, the optimization and code
10425 generation done at link time is executed in parallel using @var{n}
10426 parallel jobs by utilizing an installed @command{make} program. The
10427 environment variable @env{MAKE} may be used to override the program
10428 used.
10429
10430 You can also specify @option{-flto=jobserver} to use GNU make's
10431 job server mode to determine the number of parallel jobs. This
10432 is useful when the Makefile calling GCC is already executing in parallel.
10433 You must prepend a @samp{+} to the command recipe in the parent Makefile
10434 for this to work. This option likely only works if @env{MAKE} is
10435 GNU make. Even without the option value, GCC tries to automatically
10436 detect a running GNU make's job server.
10437
10438 Use @option{-flto=auto} to use GNU make's job server, if available,
10439 or otherwise fall back to autodetection of the number of CPU threads
10440 present in your system.
10441
10442 @item -flto-partition=@var{alg}
10443 @opindex flto-partition
10444 Specify the partitioning algorithm used by the link-time optimizer.
10445 The value is either @samp{1to1} to specify a partitioning mirroring
10446 the original source files or @samp{balanced} to specify partitioning
10447 into equally sized chunks (whenever possible) or @samp{max} to create
10448 new partition for every symbol where possible. Specifying @samp{none}
10449 as an algorithm disables partitioning and streaming completely.
10450 The default value is @samp{balanced}. While @samp{1to1} can be used
10451 as an workaround for various code ordering issues, the @samp{max}
10452 partitioning is intended for internal testing only.
10453 The value @samp{one} specifies that exactly one partition should be
10454 used while the value @samp{none} bypasses partitioning and executes
10455 the link-time optimization step directly from the WPA phase.
10456
10457 @item -flto-compression-level=@var{n}
10458 @opindex flto-compression-level
10459 This option specifies the level of compression used for intermediate
10460 language written to LTO object files, and is only meaningful in
10461 conjunction with LTO mode (@option{-flto}). Valid
10462 values are 0 (no compression) to 9 (maximum compression). Values
10463 outside this range are clamped to either 0 or 9. If the option is not
10464 given, a default balanced compression setting is used.
10465
10466 @item -fuse-linker-plugin
10467 @opindex fuse-linker-plugin
10468 Enables the use of a linker plugin during link-time optimization. This
10469 option relies on plugin support in the linker, which is available in gold
10470 or in GNU ld 2.21 or newer.
10471
10472 This option enables the extraction of object files with GIMPLE bytecode out
10473 of library archives. This improves the quality of optimization by exposing
10474 more code to the link-time optimizer. This information specifies what
10475 symbols can be accessed externally (by non-LTO object or during dynamic
10476 linking). Resulting code quality improvements on binaries (and shared
10477 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10478 See @option{-flto} for a description of the effect of this flag and how to
10479 use it.
10480
10481 This option is enabled by default when LTO support in GCC is enabled
10482 and GCC was configured for use with
10483 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10484
10485 @item -ffat-lto-objects
10486 @opindex ffat-lto-objects
10487 Fat LTO objects are object files that contain both the intermediate language
10488 and the object code. This makes them usable for both LTO linking and normal
10489 linking. This option is effective only when compiling with @option{-flto}
10490 and is ignored at link time.
10491
10492 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10493 requires the complete toolchain to be aware of LTO. It requires a linker with
10494 linker plugin support for basic functionality. Additionally,
10495 @command{nm}, @command{ar} and @command{ranlib}
10496 need to support linker plugins to allow a full-featured build environment
10497 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10498 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10499 to these tools. With non fat LTO makefiles need to be modified to use them.
10500
10501 Note that modern binutils provide plugin auto-load mechanism.
10502 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10503 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10504 @command{gcc-ranlib}).
10505
10506 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10507 support.
10508
10509 @item -fcompare-elim
10510 @opindex fcompare-elim
10511 After register allocation and post-register allocation instruction splitting,
10512 identify arithmetic instructions that compute processor flags similar to a
10513 comparison operation based on that arithmetic. If possible, eliminate the
10514 explicit comparison operation.
10515
10516 This pass only applies to certain targets that cannot explicitly represent
10517 the comparison operation before register allocation is complete.
10518
10519 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10520
10521 @item -fcprop-registers
10522 @opindex fcprop-registers
10523 After register allocation and post-register allocation instruction splitting,
10524 perform a copy-propagation pass to try to reduce scheduling dependencies
10525 and occasionally eliminate the copy.
10526
10527 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10528
10529 @item -fprofile-correction
10530 @opindex fprofile-correction
10531 Profiles collected using an instrumented binary for multi-threaded programs may
10532 be inconsistent due to missed counter updates. When this option is specified,
10533 GCC uses heuristics to correct or smooth out such inconsistencies. By
10534 default, GCC emits an error message when an inconsistent profile is detected.
10535
10536 This option is enabled by @option{-fauto-profile}.
10537
10538 @item -fprofile-use
10539 @itemx -fprofile-use=@var{path}
10540 @opindex fprofile-use
10541 Enable profile feedback-directed optimizations,
10542 and the following optimizations, many of which
10543 are generally profitable only with profile feedback available:
10544
10545 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10546 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10547 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10548 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10549 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10550 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10551 -fprofile-reorder-functions}
10552
10553 Before you can use this option, you must first generate profiling information.
10554 @xref{Instrumentation Options}, for information about the
10555 @option{-fprofile-generate} option.
10556
10557 By default, GCC emits an error message if the feedback profiles do not
10558 match the source code. This error can be turned into a warning by using
10559 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10560 optimized code. Additionally, by default, GCC also emits a warning message if
10561 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10562
10563 If @var{path} is specified, GCC looks at the @var{path} to find
10564 the profile feedback data files. See @option{-fprofile-dir}.
10565
10566 @item -fauto-profile
10567 @itemx -fauto-profile=@var{path}
10568 @opindex fauto-profile
10569 Enable sampling-based feedback-directed optimizations,
10570 and the following optimizations,
10571 many of which are generally profitable only with profile feedback available:
10572
10573 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10574 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10575 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10576 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10577 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10578 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10579 -fprofile-correction}
10580
10581 @var{path} is the name of a file containing AutoFDO profile information.
10582 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10583
10584 Producing an AutoFDO profile data file requires running your program
10585 with the @command{perf} utility on a supported GNU/Linux target system.
10586 For more information, see @uref{https://perf.wiki.kernel.org/}.
10587
10588 E.g.
10589 @smallexample
10590 perf record -e br_inst_retired:near_taken -b -o perf.data \
10591 -- your_program
10592 @end smallexample
10593
10594 Then use the @command{create_gcov} tool to convert the raw profile data
10595 to a format that can be used by GCC.@ You must also supply the
10596 unstripped binary for your program to this tool.
10597 See @uref{https://github.com/google/autofdo}.
10598
10599 E.g.
10600 @smallexample
10601 create_gcov --binary=your_program.unstripped --profile=perf.data \
10602 --gcov=profile.afdo
10603 @end smallexample
10604 @end table
10605
10606 The following options control compiler behavior regarding floating-point
10607 arithmetic. These options trade off between speed and
10608 correctness. All must be specifically enabled.
10609
10610 @table @gcctabopt
10611 @item -ffloat-store
10612 @opindex ffloat-store
10613 Do not store floating-point variables in registers, and inhibit other
10614 options that might change whether a floating-point value is taken from a
10615 register or memory.
10616
10617 @cindex floating-point precision
10618 This option prevents undesirable excess precision on machines such as
10619 the 68000 where the floating registers (of the 68881) keep more
10620 precision than a @code{double} is supposed to have. Similarly for the
10621 x86 architecture. For most programs, the excess precision does only
10622 good, but a few programs rely on the precise definition of IEEE floating
10623 point. Use @option{-ffloat-store} for such programs, after modifying
10624 them to store all pertinent intermediate computations into variables.
10625
10626 @item -fexcess-precision=@var{style}
10627 @opindex fexcess-precision
10628 This option allows further control over excess precision on machines
10629 where floating-point operations occur in a format with more precision or
10630 range than the IEEE standard and interchange floating-point types. By
10631 default, @option{-fexcess-precision=fast} is in effect; this means that
10632 operations may be carried out in a wider precision than the types specified
10633 in the source if that would result in faster code, and it is unpredictable
10634 when rounding to the types specified in the source code takes place.
10635 When compiling C, if @option{-fexcess-precision=standard} is specified then
10636 excess precision follows the rules specified in ISO C99; in particular,
10637 both casts and assignments cause values to be rounded to their
10638 semantic types (whereas @option{-ffloat-store} only affects
10639 assignments). This option is enabled by default for C if a strict
10640 conformance option such as @option{-std=c99} is used.
10641 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10642 regardless of whether a strict conformance option is used.
10643
10644 @opindex mfpmath
10645 @option{-fexcess-precision=standard} is not implemented for languages
10646 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10647 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10648 semantics apply without excess precision, and in the latter, rounding
10649 is unpredictable.
10650
10651 @item -ffast-math
10652 @opindex ffast-math
10653 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10654 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10655 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10656 @option{-fexcess-precision=fast}.
10657
10658 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10659
10660 This option is not turned on by any @option{-O} option besides
10661 @option{-Ofast} since it can result in incorrect output for programs
10662 that depend on an exact implementation of IEEE or ISO rules/specifications
10663 for math functions. It may, however, yield faster code for programs
10664 that do not require the guarantees of these specifications.
10665
10666 @item -fno-math-errno
10667 @opindex fno-math-errno
10668 @opindex fmath-errno
10669 Do not set @code{errno} after calling math functions that are executed
10670 with a single instruction, e.g., @code{sqrt}. A program that relies on
10671 IEEE exceptions for math error handling may want to use this flag
10672 for speed while maintaining IEEE arithmetic compatibility.
10673
10674 This option is not turned on by any @option{-O} option since
10675 it can result in incorrect output for programs that depend on
10676 an exact implementation of IEEE or ISO rules/specifications for
10677 math functions. It may, however, yield faster code for programs
10678 that do not require the guarantees of these specifications.
10679
10680 The default is @option{-fmath-errno}.
10681
10682 On Darwin systems, the math library never sets @code{errno}. There is
10683 therefore no reason for the compiler to consider the possibility that
10684 it might, and @option{-fno-math-errno} is the default.
10685
10686 @item -funsafe-math-optimizations
10687 @opindex funsafe-math-optimizations
10688
10689 Allow optimizations for floating-point arithmetic that (a) assume
10690 that arguments and results are valid and (b) may violate IEEE or
10691 ANSI standards. When used at link time, it may include libraries
10692 or startup files that change the default FPU control word or other
10693 similar optimizations.
10694
10695 This option is not turned on by any @option{-O} option since
10696 it can result in incorrect output for programs that depend on
10697 an exact implementation of IEEE or ISO rules/specifications for
10698 math functions. It may, however, yield faster code for programs
10699 that do not require the guarantees of these specifications.
10700 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10701 @option{-fassociative-math} and @option{-freciprocal-math}.
10702
10703 The default is @option{-fno-unsafe-math-optimizations}.
10704
10705 @item -fassociative-math
10706 @opindex fassociative-math
10707
10708 Allow re-association of operands in series of floating-point operations.
10709 This violates the ISO C and C++ language standard by possibly changing
10710 computation result. NOTE: re-ordering may change the sign of zero as
10711 well as ignore NaNs and inhibit or create underflow or overflow (and
10712 thus cannot be used on code that relies on rounding behavior like
10713 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10714 and thus may not be used when ordered comparisons are required.
10715 This option requires that both @option{-fno-signed-zeros} and
10716 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10717 much sense with @option{-frounding-math}. For Fortran the option
10718 is automatically enabled when both @option{-fno-signed-zeros} and
10719 @option{-fno-trapping-math} are in effect.
10720
10721 The default is @option{-fno-associative-math}.
10722
10723 @item -freciprocal-math
10724 @opindex freciprocal-math
10725
10726 Allow the reciprocal of a value to be used instead of dividing by
10727 the value if this enables optimizations. For example @code{x / y}
10728 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10729 is subject to common subexpression elimination. Note that this loses
10730 precision and increases the number of flops operating on the value.
10731
10732 The default is @option{-fno-reciprocal-math}.
10733
10734 @item -ffinite-math-only
10735 @opindex ffinite-math-only
10736 Allow optimizations for floating-point arithmetic that assume
10737 that arguments and results are not NaNs or +-Infs.
10738
10739 This option is not turned on by any @option{-O} option since
10740 it can result in incorrect output for programs that depend on
10741 an exact implementation of IEEE or ISO rules/specifications for
10742 math functions. It may, however, yield faster code for programs
10743 that do not require the guarantees of these specifications.
10744
10745 The default is @option{-fno-finite-math-only}.
10746
10747 @item -fno-signed-zeros
10748 @opindex fno-signed-zeros
10749 @opindex fsigned-zeros
10750 Allow optimizations for floating-point arithmetic that ignore the
10751 signedness of zero. IEEE arithmetic specifies the behavior of
10752 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10753 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10754 This option implies that the sign of a zero result isn't significant.
10755
10756 The default is @option{-fsigned-zeros}.
10757
10758 @item -fno-trapping-math
10759 @opindex fno-trapping-math
10760 @opindex ftrapping-math
10761 Compile code assuming that floating-point operations cannot generate
10762 user-visible traps. These traps include division by zero, overflow,
10763 underflow, inexact result and invalid operation. This option requires
10764 that @option{-fno-signaling-nans} be in effect. Setting this option may
10765 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10766
10767 This option should never be turned on by any @option{-O} option since
10768 it can result in incorrect output for programs that depend on
10769 an exact implementation of IEEE or ISO rules/specifications for
10770 math functions.
10771
10772 The default is @option{-ftrapping-math}.
10773
10774 @item -frounding-math
10775 @opindex frounding-math
10776 Disable transformations and optimizations that assume default floating-point
10777 rounding behavior. This is round-to-zero for all floating point
10778 to integer conversions, and round-to-nearest for all other arithmetic
10779 truncations. This option should be specified for programs that change
10780 the FP rounding mode dynamically, or that may be executed with a
10781 non-default rounding mode. This option disables constant folding of
10782 floating-point expressions at compile time (which may be affected by
10783 rounding mode) and arithmetic transformations that are unsafe in the
10784 presence of sign-dependent rounding modes.
10785
10786 The default is @option{-fno-rounding-math}.
10787
10788 This option is experimental and does not currently guarantee to
10789 disable all GCC optimizations that are affected by rounding mode.
10790 Future versions of GCC may provide finer control of this setting
10791 using C99's @code{FENV_ACCESS} pragma. This command-line option
10792 will be used to specify the default state for @code{FENV_ACCESS}.
10793
10794 @item -fsignaling-nans
10795 @opindex fsignaling-nans
10796 Compile code assuming that IEEE signaling NaNs may generate user-visible
10797 traps during floating-point operations. Setting this option disables
10798 optimizations that may change the number of exceptions visible with
10799 signaling NaNs. This option implies @option{-ftrapping-math}.
10800
10801 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10802 be defined.
10803
10804 The default is @option{-fno-signaling-nans}.
10805
10806 This option is experimental and does not currently guarantee to
10807 disable all GCC optimizations that affect signaling NaN behavior.
10808
10809 @item -fno-fp-int-builtin-inexact
10810 @opindex fno-fp-int-builtin-inexact
10811 @opindex ffp-int-builtin-inexact
10812 Do not allow the built-in functions @code{ceil}, @code{floor},
10813 @code{round} and @code{trunc}, and their @code{float} and @code{long
10814 double} variants, to generate code that raises the ``inexact''
10815 floating-point exception for noninteger arguments. ISO C99 and C11
10816 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10817 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10818 functions to do so.
10819
10820 The default is @option{-ffp-int-builtin-inexact}, allowing the
10821 exception to be raised. This option does nothing unless
10822 @option{-ftrapping-math} is in effect.
10823
10824 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10825 generate a call to a library function then the ``inexact'' exception
10826 may be raised if the library implementation does not follow TS 18661.
10827
10828 @item -fsingle-precision-constant
10829 @opindex fsingle-precision-constant
10830 Treat floating-point constants as single precision instead of
10831 implicitly converting them to double-precision constants.
10832
10833 @item -fcx-limited-range
10834 @opindex fcx-limited-range
10835 When enabled, this option states that a range reduction step is not
10836 needed when performing complex division. Also, there is no checking
10837 whether the result of a complex multiplication or division is @code{NaN
10838 + I*NaN}, with an attempt to rescue the situation in that case. The
10839 default is @option{-fno-cx-limited-range}, but is enabled by
10840 @option{-ffast-math}.
10841
10842 This option controls the default setting of the ISO C99
10843 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10844 all languages.
10845
10846 @item -fcx-fortran-rules
10847 @opindex fcx-fortran-rules
10848 Complex multiplication and division follow Fortran rules. Range
10849 reduction is done as part of complex division, but there is no checking
10850 whether the result of a complex multiplication or division is @code{NaN
10851 + I*NaN}, with an attempt to rescue the situation in that case.
10852
10853 The default is @option{-fno-cx-fortran-rules}.
10854
10855 @end table
10856
10857 The following options control optimizations that may improve
10858 performance, but are not enabled by any @option{-O} options. This
10859 section includes experimental options that may produce broken code.
10860
10861 @table @gcctabopt
10862 @item -fbranch-probabilities
10863 @opindex fbranch-probabilities
10864 After running a program compiled with @option{-fprofile-arcs}
10865 (@pxref{Instrumentation Options}),
10866 you can compile it a second time using
10867 @option{-fbranch-probabilities}, to improve optimizations based on
10868 the number of times each branch was taken. When a program
10869 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10870 counts to a file called @file{@var{sourcename}.gcda} for each source
10871 file. The information in this data file is very dependent on the
10872 structure of the generated code, so you must use the same source code
10873 and the same optimization options for both compilations.
10874
10875 With @option{-fbranch-probabilities}, GCC puts a
10876 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10877 These can be used to improve optimization. Currently, they are only
10878 used in one place: in @file{reorg.c}, instead of guessing which path a
10879 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10880 exactly determine which path is taken more often.
10881
10882 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10883
10884 @item -fprofile-values
10885 @opindex fprofile-values
10886 If combined with @option{-fprofile-arcs}, it adds code so that some
10887 data about values of expressions in the program is gathered.
10888
10889 With @option{-fbranch-probabilities}, it reads back the data gathered
10890 from profiling values of expressions for usage in optimizations.
10891
10892 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10893 @option{-fauto-profile}.
10894
10895 @item -fprofile-reorder-functions
10896 @opindex fprofile-reorder-functions
10897 Function reordering based on profile instrumentation collects
10898 first time of execution of a function and orders these functions
10899 in ascending order.
10900
10901 Enabled with @option{-fprofile-use}.
10902
10903 @item -fvpt
10904 @opindex fvpt
10905 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10906 to add code to gather information about values of expressions.
10907
10908 With @option{-fbranch-probabilities}, it reads back the data gathered
10909 and actually performs the optimizations based on them.
10910 Currently the optimizations include specialization of division operations
10911 using the knowledge about the value of the denominator.
10912
10913 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10914
10915 @item -frename-registers
10916 @opindex frename-registers
10917 Attempt to avoid false dependencies in scheduled code by making use
10918 of registers left over after register allocation. This optimization
10919 most benefits processors with lots of registers. Depending on the
10920 debug information format adopted by the target, however, it can
10921 make debugging impossible, since variables no longer stay in
10922 a ``home register''.
10923
10924 Enabled by default with @option{-funroll-loops}.
10925
10926 @item -fschedule-fusion
10927 @opindex fschedule-fusion
10928 Performs a target dependent pass over the instruction stream to schedule
10929 instructions of same type together because target machine can execute them
10930 more efficiently if they are adjacent to each other in the instruction flow.
10931
10932 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10933
10934 @item -ftracer
10935 @opindex ftracer
10936 Perform tail duplication to enlarge superblock size. This transformation
10937 simplifies the control flow of the function allowing other optimizations to do
10938 a better job.
10939
10940 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10941
10942 @item -funroll-loops
10943 @opindex funroll-loops
10944 Unroll loops whose number of iterations can be determined at compile time or
10945 upon entry to the loop. @option{-funroll-loops} implies
10946 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10947 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10948 a small constant number of iterations). This option makes code larger, and may
10949 or may not make it run faster.
10950
10951 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10952
10953 @item -funroll-all-loops
10954 @opindex funroll-all-loops
10955 Unroll all loops, even if their number of iterations is uncertain when
10956 the loop is entered. This usually makes programs run more slowly.
10957 @option{-funroll-all-loops} implies the same options as
10958 @option{-funroll-loops}.
10959
10960 @item -fpeel-loops
10961 @opindex fpeel-loops
10962 Peels loops for which there is enough information that they do not
10963 roll much (from profile feedback or static analysis). It also turns on
10964 complete loop peeling (i.e.@: complete removal of loops with small constant
10965 number of iterations).
10966
10967 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10968
10969 @item -fmove-loop-invariants
10970 @opindex fmove-loop-invariants
10971 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10972 at level @option{-O1} and higher, except for @option{-Og}.
10973
10974 @item -fsplit-loops
10975 @opindex fsplit-loops
10976 Split a loop into two if it contains a condition that's always true
10977 for one side of the iteration space and false for the other.
10978
10979 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10980
10981 @item -funswitch-loops
10982 @opindex funswitch-loops
10983 Move branches with loop invariant conditions out of the loop, with duplicates
10984 of the loop on both branches (modified according to result of the condition).
10985
10986 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10987
10988 @item -fversion-loops-for-strides
10989 @opindex fversion-loops-for-strides
10990 If a loop iterates over an array with a variable stride, create another
10991 version of the loop that assumes the stride is always one. For example:
10992
10993 @smallexample
10994 for (int i = 0; i < n; ++i)
10995 x[i * stride] = @dots{};
10996 @end smallexample
10997
10998 becomes:
10999
11000 @smallexample
11001 if (stride == 1)
11002 for (int i = 0; i < n; ++i)
11003 x[i] = @dots{};
11004 else
11005 for (int i = 0; i < n; ++i)
11006 x[i * stride] = @dots{};
11007 @end smallexample
11008
11009 This is particularly useful for assumed-shape arrays in Fortran where
11010 (for example) it allows better vectorization assuming contiguous accesses.
11011 This flag is enabled by default at @option{-O3}.
11012 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11013
11014 @item -ffunction-sections
11015 @itemx -fdata-sections
11016 @opindex ffunction-sections
11017 @opindex fdata-sections
11018 Place each function or data item into its own section in the output
11019 file if the target supports arbitrary sections. The name of the
11020 function or the name of the data item determines the section's name
11021 in the output file.
11022
11023 Use these options on systems where the linker can perform optimizations to
11024 improve locality of reference in the instruction space. Most systems using the
11025 ELF object format have linkers with such optimizations. On AIX, the linker
11026 rearranges sections (CSECTs) based on the call graph. The performance impact
11027 varies.
11028
11029 Together with a linker garbage collection (linker @option{--gc-sections}
11030 option) these options may lead to smaller statically-linked executables (after
11031 stripping).
11032
11033 On ELF/DWARF systems these options do not degenerate the quality of the debug
11034 information. There could be issues with other object files/debug info formats.
11035
11036 Only use these options when there are significant benefits from doing so. When
11037 you specify these options, the assembler and linker create larger object and
11038 executable files and are also slower. These options affect code generation.
11039 They prevent optimizations by the compiler and assembler using relative
11040 locations inside a translation unit since the locations are unknown until
11041 link time. An example of such an optimization is relaxing calls to short call
11042 instructions.
11043
11044 @item -fbranch-target-load-optimize
11045 @opindex fbranch-target-load-optimize
11046 Perform branch target register load optimization before prologue / epilogue
11047 threading.
11048 The use of target registers can typically be exposed only during reload,
11049 thus hoisting loads out of loops and doing inter-block scheduling needs
11050 a separate optimization pass.
11051
11052 @item -fbranch-target-load-optimize2
11053 @opindex fbranch-target-load-optimize2
11054 Perform branch target register load optimization after prologue / epilogue
11055 threading.
11056
11057 @item -fbtr-bb-exclusive
11058 @opindex fbtr-bb-exclusive
11059 When performing branch target register load optimization, don't reuse
11060 branch target registers within any basic block.
11061
11062 @item -fstdarg-opt
11063 @opindex fstdarg-opt
11064 Optimize the prologue of variadic argument functions with respect to usage of
11065 those arguments.
11066
11067 @item -fsection-anchors
11068 @opindex fsection-anchors
11069 Try to reduce the number of symbolic address calculations by using
11070 shared ``anchor'' symbols to address nearby objects. This transformation
11071 can help to reduce the number of GOT entries and GOT accesses on some
11072 targets.
11073
11074 For example, the implementation of the following function @code{foo}:
11075
11076 @smallexample
11077 static int a, b, c;
11078 int foo (void) @{ return a + b + c; @}
11079 @end smallexample
11080
11081 @noindent
11082 usually calculates the addresses of all three variables, but if you
11083 compile it with @option{-fsection-anchors}, it accesses the variables
11084 from a common anchor point instead. The effect is similar to the
11085 following pseudocode (which isn't valid C):
11086
11087 @smallexample
11088 int foo (void)
11089 @{
11090 register int *xr = &x;
11091 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11092 @}
11093 @end smallexample
11094
11095 Not all targets support this option.
11096
11097 @item --param @var{name}=@var{value}
11098 @opindex param
11099 In some places, GCC uses various constants to control the amount of
11100 optimization that is done. For example, GCC does not inline functions
11101 that contain more than a certain number of instructions. You can
11102 control some of these constants on the command line using the
11103 @option{--param} option.
11104
11105 The names of specific parameters, and the meaning of the values, are
11106 tied to the internals of the compiler, and are subject to change
11107 without notice in future releases.
11108
11109 In order to get minimal, maximal and default value of a parameter,
11110 one can use @option{--help=param -Q} options.
11111
11112 In each case, the @var{value} is an integer. The allowable choices for
11113 @var{name} are:
11114
11115 @table @gcctabopt
11116 @item predictable-branch-outcome
11117 When branch is predicted to be taken with probability lower than this threshold
11118 (in percent), then it is considered well predictable.
11119
11120 @item max-rtl-if-conversion-insns
11121 RTL if-conversion tries to remove conditional branches around a block and
11122 replace them with conditionally executed instructions. This parameter
11123 gives the maximum number of instructions in a block which should be
11124 considered for if-conversion. The compiler will
11125 also use other heuristics to decide whether if-conversion is likely to be
11126 profitable.
11127
11128 @item max-rtl-if-conversion-predictable-cost
11129 @itemx max-rtl-if-conversion-unpredictable-cost
11130 RTL if-conversion will try to remove conditional branches around a block
11131 and replace them with conditionally executed instructions. These parameters
11132 give the maximum permissible cost for the sequence that would be generated
11133 by if-conversion depending on whether the branch is statically determined
11134 to be predictable or not. The units for this parameter are the same as
11135 those for the GCC internal seq_cost metric. The compiler will try to
11136 provide a reasonable default for this parameter using the BRANCH_COST
11137 target macro.
11138
11139 @item max-crossjump-edges
11140 The maximum number of incoming edges to consider for cross-jumping.
11141 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11142 the number of edges incoming to each block. Increasing values mean
11143 more aggressive optimization, making the compilation time increase with
11144 probably small improvement in executable size.
11145
11146 @item min-crossjump-insns
11147 The minimum number of instructions that must be matched at the end
11148 of two blocks before cross-jumping is performed on them. This
11149 value is ignored in the case where all instructions in the block being
11150 cross-jumped from are matched.
11151
11152 @item max-grow-copy-bb-insns
11153 The maximum code size expansion factor when copying basic blocks
11154 instead of jumping. The expansion is relative to a jump instruction.
11155
11156 @item max-goto-duplication-insns
11157 The maximum number of instructions to duplicate to a block that jumps
11158 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11159 passes, GCC factors computed gotos early in the compilation process,
11160 and unfactors them as late as possible. Only computed jumps at the
11161 end of a basic blocks with no more than max-goto-duplication-insns are
11162 unfactored.
11163
11164 @item max-delay-slot-insn-search
11165 The maximum number of instructions to consider when looking for an
11166 instruction to fill a delay slot. If more than this arbitrary number of
11167 instructions are searched, the time savings from filling the delay slot
11168 are minimal, so stop searching. Increasing values mean more
11169 aggressive optimization, making the compilation time increase with probably
11170 small improvement in execution time.
11171
11172 @item max-delay-slot-live-search
11173 When trying to fill delay slots, the maximum number of instructions to
11174 consider when searching for a block with valid live register
11175 information. Increasing this arbitrarily chosen value means more
11176 aggressive optimization, increasing the compilation time. This parameter
11177 should be removed when the delay slot code is rewritten to maintain the
11178 control-flow graph.
11179
11180 @item max-gcse-memory
11181 The approximate maximum amount of memory that can be allocated in
11182 order to perform the global common subexpression elimination
11183 optimization. If more memory than specified is required, the
11184 optimization is not done.
11185
11186 @item max-gcse-insertion-ratio
11187 If the ratio of expression insertions to deletions is larger than this value
11188 for any expression, then RTL PRE inserts or removes the expression and thus
11189 leaves partially redundant computations in the instruction stream.
11190
11191 @item max-pending-list-length
11192 The maximum number of pending dependencies scheduling allows
11193 before flushing the current state and starting over. Large functions
11194 with few branches or calls can create excessively large lists which
11195 needlessly consume memory and resources.
11196
11197 @item max-modulo-backtrack-attempts
11198 The maximum number of backtrack attempts the scheduler should make
11199 when modulo scheduling a loop. Larger values can exponentially increase
11200 compilation time.
11201
11202 @item max-inline-insns-single
11203 Several parameters control the tree inliner used in GCC@.
11204 This number sets the maximum number of instructions (counted in GCC's
11205 internal representation) in a single function that the tree inliner
11206 considers for inlining. This only affects functions declared
11207 inline and methods implemented in a class declaration (C++).
11208
11209 @item max-inline-insns-auto
11210 When you use @option{-finline-functions} (included in @option{-O3}),
11211 a lot of functions that would otherwise not be considered for inlining
11212 by the compiler are investigated. To those functions, a different
11213 (more restrictive) limit compared to functions declared inline can
11214 be applied.
11215
11216 @item max-inline-insns-small
11217 This is bound applied to calls which are considered relevant with
11218 @option{-finline-small-functions}.
11219
11220 @item max-inline-insns-size
11221 This is bound applied to calls which are optimized for size. Small growth
11222 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11223
11224 @item uninlined-function-insns
11225 Number of instructions accounted by inliner for function overhead such as
11226 function prologue and epilogue.
11227
11228 @item uninlined-function-time
11229 Extra time accounted by inliner for function overhead such as time needed to
11230 execute function prologue and epilogue
11231
11232 @item uninlined-thunk-insns
11233 @item uninlined-thunk-time
11234 Same as @option{--param uninlined-function-insns} and
11235 @option{--param uninlined-function-time} but applied to function thunks
11236
11237 @item inline-min-speedup
11238 When estimated performance improvement of caller + callee runtime exceeds this
11239 threshold (in percent), the function can be inlined regardless of the limit on
11240 @option{--param max-inline-insns-single} and @option{--param
11241 max-inline-insns-auto}.
11242
11243 @item large-function-insns
11244 The limit specifying really large functions. For functions larger than this
11245 limit after inlining, inlining is constrained by
11246 @option{--param large-function-growth}. This parameter is useful primarily
11247 to avoid extreme compilation time caused by non-linear algorithms used by the
11248 back end.
11249
11250 @item large-function-growth
11251 Specifies maximal growth of large function caused by inlining in percents.
11252 For example, parameter value 100 limits large function growth to 2.0 times
11253 the original size.
11254
11255 @item large-unit-insns
11256 The limit specifying large translation unit. Growth caused by inlining of
11257 units larger than this limit is limited by @option{--param inline-unit-growth}.
11258 For small units this might be too tight.
11259 For example, consider a unit consisting of function A
11260 that is inline and B that just calls A three times. If B is small relative to
11261 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11262 large units consisting of small inlineable functions, however, the overall unit
11263 growth limit is needed to avoid exponential explosion of code size. Thus for
11264 smaller units, the size is increased to @option{--param large-unit-insns}
11265 before applying @option{--param inline-unit-growth}.
11266
11267 @item inline-unit-growth
11268 Specifies maximal overall growth of the compilation unit caused by inlining.
11269 For example, parameter value 20 limits unit growth to 1.2 times the original
11270 size. Cold functions (either marked cold via an attribute or by profile
11271 feedback) are not accounted into the unit size.
11272
11273 @item ipcp-unit-growth
11274 Specifies maximal overall growth of the compilation unit caused by
11275 interprocedural constant propagation. For example, parameter value 10 limits
11276 unit growth to 1.1 times the original size.
11277
11278 @item large-stack-frame
11279 The limit specifying large stack frames. While inlining the algorithm is trying
11280 to not grow past this limit too much.
11281
11282 @item large-stack-frame-growth
11283 Specifies maximal growth of large stack frames caused by inlining in percents.
11284 For example, parameter value 1000 limits large stack frame growth to 11 times
11285 the original size.
11286
11287 @item max-inline-insns-recursive
11288 @itemx max-inline-insns-recursive-auto
11289 Specifies the maximum number of instructions an out-of-line copy of a
11290 self-recursive inline
11291 function can grow into by performing recursive inlining.
11292
11293 @option{--param max-inline-insns-recursive} applies to functions
11294 declared inline.
11295 For functions not declared inline, recursive inlining
11296 happens only when @option{-finline-functions} (included in @option{-O3}) is
11297 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11298
11299 @item max-inline-recursive-depth
11300 @itemx max-inline-recursive-depth-auto
11301 Specifies the maximum recursion depth used for recursive inlining.
11302
11303 @option{--param max-inline-recursive-depth} applies to functions
11304 declared inline. For functions not declared inline, recursive inlining
11305 happens only when @option{-finline-functions} (included in @option{-O3}) is
11306 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11307
11308 @item min-inline-recursive-probability
11309 Recursive inlining is profitable only for function having deep recursion
11310 in average and can hurt for function having little recursion depth by
11311 increasing the prologue size or complexity of function body to other
11312 optimizers.
11313
11314 When profile feedback is available (see @option{-fprofile-generate}) the actual
11315 recursion depth can be guessed from the probability that function recurses
11316 via a given call expression. This parameter limits inlining only to call
11317 expressions whose probability exceeds the given threshold (in percents).
11318
11319 @item early-inlining-insns
11320 Specify growth that the early inliner can make. In effect it increases
11321 the amount of inlining for code having a large abstraction penalty.
11322
11323 @item max-early-inliner-iterations
11324 Limit of iterations of the early inliner. This basically bounds
11325 the number of nested indirect calls the early inliner can resolve.
11326 Deeper chains are still handled by late inlining.
11327
11328 @item comdat-sharing-probability
11329 Probability (in percent) that C++ inline function with comdat visibility
11330 are shared across multiple compilation units.
11331
11332 @item profile-func-internal-id
11333 A parameter to control whether to use function internal id in profile
11334 database lookup. If the value is 0, the compiler uses an id that
11335 is based on function assembler name and filename, which makes old profile
11336 data more tolerant to source changes such as function reordering etc.
11337
11338 @item min-vect-loop-bound
11339 The minimum number of iterations under which loops are not vectorized
11340 when @option{-ftree-vectorize} is used. The number of iterations after
11341 vectorization needs to be greater than the value specified by this option
11342 to allow vectorization.
11343
11344 @item gcse-cost-distance-ratio
11345 Scaling factor in calculation of maximum distance an expression
11346 can be moved by GCSE optimizations. This is currently supported only in the
11347 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11348 is with simple expressions, i.e., the expressions that have cost
11349 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11350 hoisting of simple expressions.
11351
11352 @item gcse-unrestricted-cost
11353 Cost, roughly measured as the cost of a single typical machine
11354 instruction, at which GCSE optimizations do not constrain
11355 the distance an expression can travel. This is currently
11356 supported only in the code hoisting pass. The lesser the cost,
11357 the more aggressive code hoisting is. Specifying 0
11358 allows all expressions to travel unrestricted distances.
11359
11360 @item max-hoist-depth
11361 The depth of search in the dominator tree for expressions to hoist.
11362 This is used to avoid quadratic behavior in hoisting algorithm.
11363 The value of 0 does not limit on the search, but may slow down compilation
11364 of huge functions.
11365
11366 @item max-tail-merge-comparisons
11367 The maximum amount of similar bbs to compare a bb with. This is used to
11368 avoid quadratic behavior in tree tail merging.
11369
11370 @item max-tail-merge-iterations
11371 The maximum amount of iterations of the pass over the function. This is used to
11372 limit compilation time in tree tail merging.
11373
11374 @item store-merging-allow-unaligned
11375 Allow the store merging pass to introduce unaligned stores if it is legal to
11376 do so.
11377
11378 @item max-stores-to-merge
11379 The maximum number of stores to attempt to merge into wider stores in the store
11380 merging pass.
11381
11382 @item max-unrolled-insns
11383 The maximum number of instructions that a loop may have to be unrolled.
11384 If a loop is unrolled, this parameter also determines how many times
11385 the loop code is unrolled.
11386
11387 @item max-average-unrolled-insns
11388 The maximum number of instructions biased by probabilities of their execution
11389 that a loop may have to be unrolled. If a loop is unrolled,
11390 this parameter also determines how many times the loop code is unrolled.
11391
11392 @item max-unroll-times
11393 The maximum number of unrollings of a single loop.
11394
11395 @item max-peeled-insns
11396 The maximum number of instructions that a loop may have to be peeled.
11397 If a loop is peeled, this parameter also determines how many times
11398 the loop code is peeled.
11399
11400 @item max-peel-times
11401 The maximum number of peelings of a single loop.
11402
11403 @item max-peel-branches
11404 The maximum number of branches on the hot path through the peeled sequence.
11405
11406 @item max-completely-peeled-insns
11407 The maximum number of insns of a completely peeled loop.
11408
11409 @item max-completely-peel-times
11410 The maximum number of iterations of a loop to be suitable for complete peeling.
11411
11412 @item max-completely-peel-loop-nest-depth
11413 The maximum depth of a loop nest suitable for complete peeling.
11414
11415 @item max-unswitch-insns
11416 The maximum number of insns of an unswitched loop.
11417
11418 @item max-unswitch-level
11419 The maximum number of branches unswitched in a single loop.
11420
11421 @item lim-expensive
11422 The minimum cost of an expensive expression in the loop invariant motion.
11423
11424 @item iv-consider-all-candidates-bound
11425 Bound on number of candidates for induction variables, below which
11426 all candidates are considered for each use in induction variable
11427 optimizations. If there are more candidates than this,
11428 only the most relevant ones are considered to avoid quadratic time complexity.
11429
11430 @item iv-max-considered-uses
11431 The induction variable optimizations give up on loops that contain more
11432 induction variable uses.
11433
11434 @item iv-always-prune-cand-set-bound
11435 If the number of candidates in the set is smaller than this value,
11436 always try to remove unnecessary ivs from the set
11437 when adding a new one.
11438
11439 @item avg-loop-niter
11440 Average number of iterations of a loop.
11441
11442 @item dse-max-object-size
11443 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11444 Larger values may result in larger compilation times.
11445
11446 @item dse-max-alias-queries-per-store
11447 Maximum number of queries into the alias oracle per store.
11448 Larger values result in larger compilation times and may result in more
11449 removed dead stores.
11450
11451 @item scev-max-expr-size
11452 Bound on size of expressions used in the scalar evolutions analyzer.
11453 Large expressions slow the analyzer.
11454
11455 @item scev-max-expr-complexity
11456 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11457 Complex expressions slow the analyzer.
11458
11459 @item max-tree-if-conversion-phi-args
11460 Maximum number of arguments in a PHI supported by TREE if conversion
11461 unless the loop is marked with simd pragma.
11462
11463 @item vect-max-version-for-alignment-checks
11464 The maximum number of run-time checks that can be performed when
11465 doing loop versioning for alignment in the vectorizer.
11466
11467 @item vect-max-version-for-alias-checks
11468 The maximum number of run-time checks that can be performed when
11469 doing loop versioning for alias in the vectorizer.
11470
11471 @item vect-max-peeling-for-alignment
11472 The maximum number of loop peels to enhance access alignment
11473 for vectorizer. Value -1 means no limit.
11474
11475 @item max-iterations-to-track
11476 The maximum number of iterations of a loop the brute-force algorithm
11477 for analysis of the number of iterations of the loop tries to evaluate.
11478
11479 @item hot-bb-count-fraction
11480 The denominator n of fraction 1/n of the maximal execution count of a
11481 basic block in the entire program that a basic block needs to at least
11482 have in order to be considered hot. The default is 10000, which means
11483 that a basic block is considered hot if its execution count is greater
11484 than 1/10000 of the maximal execution count. 0 means that it is never
11485 considered hot. Used in non-LTO mode.
11486
11487 @item hot-bb-count-ws-permille
11488 The number of most executed permilles, ranging from 0 to 1000, of the
11489 profiled execution of the entire program to which the execution count
11490 of a basic block must be part of in order to be considered hot. The
11491 default is 990, which means that a basic block is considered hot if
11492 its execution count contributes to the upper 990 permilles, or 99.0%,
11493 of the profiled execution of the entire program. 0 means that it is
11494 never considered hot. Used in LTO mode.
11495
11496 @item hot-bb-frequency-fraction
11497 The denominator n of fraction 1/n of the execution frequency of the
11498 entry block of a function that a basic block of this function needs
11499 to at least have in order to be considered hot. The default is 1000,
11500 which means that a basic block is considered hot in a function if it
11501 is executed more frequently than 1/1000 of the frequency of the entry
11502 block of the function. 0 means that it is never considered hot.
11503
11504 @item unlikely-bb-count-fraction
11505 The denominator n of fraction 1/n of the number of profiled runs of
11506 the entire program below which the execution count of a basic block
11507 must be in order for the basic block to be considered unlikely executed.
11508 The default is 20, which means that a basic block is considered unlikely
11509 executed if it is executed in fewer than 1/20, or 5%, of the runs of
11510 the program. 0 means that it is always considered unlikely executed.
11511
11512 @item max-predicted-iterations
11513 The maximum number of loop iterations we predict statically. This is useful
11514 in cases where a function contains a single loop with known bound and
11515 another loop with unknown bound.
11516 The known number of iterations is predicted correctly, while
11517 the unknown number of iterations average to roughly 10. This means that the
11518 loop without bounds appears artificially cold relative to the other one.
11519
11520 @item builtin-expect-probability
11521 Control the probability of the expression having the specified value. This
11522 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11523
11524 @item builtin-string-cmp-inline-length
11525 The maximum length of a constant string for a builtin string cmp call
11526 eligible for inlining.
11527
11528 @item align-threshold
11529
11530 Select fraction of the maximal frequency of executions of a basic block in
11531 a function to align the basic block.
11532
11533 @item align-loop-iterations
11534
11535 A loop expected to iterate at least the selected number of iterations is
11536 aligned.
11537
11538 @item tracer-dynamic-coverage
11539 @itemx tracer-dynamic-coverage-feedback
11540
11541 This value is used to limit superblock formation once the given percentage of
11542 executed instructions is covered. This limits unnecessary code size
11543 expansion.
11544
11545 The @option{tracer-dynamic-coverage-feedback} parameter
11546 is used only when profile
11547 feedback is available. The real profiles (as opposed to statically estimated
11548 ones) are much less balanced allowing the threshold to be larger value.
11549
11550 @item tracer-max-code-growth
11551 Stop tail duplication once code growth has reached given percentage. This is
11552 a rather artificial limit, as most of the duplicates are eliminated later in
11553 cross jumping, so it may be set to much higher values than is the desired code
11554 growth.
11555
11556 @item tracer-min-branch-ratio
11557
11558 Stop reverse growth when the reverse probability of best edge is less than this
11559 threshold (in percent).
11560
11561 @item tracer-min-branch-probability
11562 @itemx tracer-min-branch-probability-feedback
11563
11564 Stop forward growth if the best edge has probability lower than this
11565 threshold.
11566
11567 Similarly to @option{tracer-dynamic-coverage} two parameters are
11568 provided. @option{tracer-min-branch-probability-feedback} is used for
11569 compilation with profile feedback and @option{tracer-min-branch-probability}
11570 compilation without. The value for compilation with profile feedback
11571 needs to be more conservative (higher) in order to make tracer
11572 effective.
11573
11574 @item stack-clash-protection-guard-size
11575 Specify the size of the operating system provided stack guard as
11576 2 raised to @var{num} bytes. Higher values may reduce the
11577 number of explicit probes, but a value larger than the operating system
11578 provided guard will leave code vulnerable to stack clash style attacks.
11579
11580 @item stack-clash-protection-probe-interval
11581 Stack clash protection involves probing stack space as it is allocated. This
11582 param controls the maximum distance between probes into the stack as 2 raised
11583 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11584 larger than the operating system provided guard will leave code vulnerable to
11585 stack clash style attacks.
11586
11587 @item max-cse-path-length
11588
11589 The maximum number of basic blocks on path that CSE considers.
11590
11591 @item max-cse-insns
11592 The maximum number of instructions CSE processes before flushing.
11593
11594 @item ggc-min-expand
11595
11596 GCC uses a garbage collector to manage its own memory allocation. This
11597 parameter specifies the minimum percentage by which the garbage
11598 collector's heap should be allowed to expand between collections.
11599 Tuning this may improve compilation speed; it has no effect on code
11600 generation.
11601
11602 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11603 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11604 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11605 GCC is not able to calculate RAM on a particular platform, the lower
11606 bound of 30% is used. Setting this parameter and
11607 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11608 every opportunity. This is extremely slow, but can be useful for
11609 debugging.
11610
11611 @item ggc-min-heapsize
11612
11613 Minimum size of the garbage collector's heap before it begins bothering
11614 to collect garbage. The first collection occurs after the heap expands
11615 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11616 tuning this may improve compilation speed, and has no effect on code
11617 generation.
11618
11619 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11620 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11621 with a lower bound of 4096 (four megabytes) and an upper bound of
11622 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11623 particular platform, the lower bound is used. Setting this parameter
11624 very large effectively disables garbage collection. Setting this
11625 parameter and @option{ggc-min-expand} to zero causes a full collection
11626 to occur at every opportunity.
11627
11628 @item max-reload-search-insns
11629 The maximum number of instruction reload should look backward for equivalent
11630 register. Increasing values mean more aggressive optimization, making the
11631 compilation time increase with probably slightly better performance.
11632
11633 @item max-cselib-memory-locations
11634 The maximum number of memory locations cselib should take into account.
11635 Increasing values mean more aggressive optimization, making the compilation time
11636 increase with probably slightly better performance.
11637
11638 @item max-sched-ready-insns
11639 The maximum number of instructions ready to be issued the scheduler should
11640 consider at any given time during the first scheduling pass. Increasing
11641 values mean more thorough searches, making the compilation time increase
11642 with probably little benefit.
11643
11644 @item max-sched-region-blocks
11645 The maximum number of blocks in a region to be considered for
11646 interblock scheduling.
11647
11648 @item max-pipeline-region-blocks
11649 The maximum number of blocks in a region to be considered for
11650 pipelining in the selective scheduler.
11651
11652 @item max-sched-region-insns
11653 The maximum number of insns in a region to be considered for
11654 interblock scheduling.
11655
11656 @item max-pipeline-region-insns
11657 The maximum number of insns in a region to be considered for
11658 pipelining in the selective scheduler.
11659
11660 @item min-spec-prob
11661 The minimum probability (in percents) of reaching a source block
11662 for interblock speculative scheduling.
11663
11664 @item max-sched-extend-regions-iters
11665 The maximum number of iterations through CFG to extend regions.
11666 A value of 0 disables region extensions.
11667
11668 @item max-sched-insn-conflict-delay
11669 The maximum conflict delay for an insn to be considered for speculative motion.
11670
11671 @item sched-spec-prob-cutoff
11672 The minimal probability of speculation success (in percents), so that
11673 speculative insns are scheduled.
11674
11675 @item sched-state-edge-prob-cutoff
11676 The minimum probability an edge must have for the scheduler to save its
11677 state across it.
11678
11679 @item sched-mem-true-dep-cost
11680 Minimal distance (in CPU cycles) between store and load targeting same
11681 memory locations.
11682
11683 @item selsched-max-lookahead
11684 The maximum size of the lookahead window of selective scheduling. It is a
11685 depth of search for available instructions.
11686
11687 @item selsched-max-sched-times
11688 The maximum number of times that an instruction is scheduled during
11689 selective scheduling. This is the limit on the number of iterations
11690 through which the instruction may be pipelined.
11691
11692 @item selsched-insns-to-rename
11693 The maximum number of best instructions in the ready list that are considered
11694 for renaming in the selective scheduler.
11695
11696 @item sms-min-sc
11697 The minimum value of stage count that swing modulo scheduler
11698 generates.
11699
11700 @item max-last-value-rtl
11701 The maximum size measured as number of RTLs that can be recorded in an expression
11702 in combiner for a pseudo register as last known value of that register.
11703
11704 @item max-combine-insns
11705 The maximum number of instructions the RTL combiner tries to combine.
11706
11707 @item integer-share-limit
11708 Small integer constants can use a shared data structure, reducing the
11709 compiler's memory usage and increasing its speed. This sets the maximum
11710 value of a shared integer constant.
11711
11712 @item ssp-buffer-size
11713 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11714 protection when @option{-fstack-protection} is used.
11715
11716 @item min-size-for-stack-sharing
11717 The minimum size of variables taking part in stack slot sharing when not
11718 optimizing.
11719
11720 @item max-jump-thread-duplication-stmts
11721 Maximum number of statements allowed in a block that needs to be
11722 duplicated when threading jumps.
11723
11724 @item max-fields-for-field-sensitive
11725 Maximum number of fields in a structure treated in
11726 a field sensitive manner during pointer analysis.
11727
11728 @item prefetch-latency
11729 Estimate on average number of instructions that are executed before
11730 prefetch finishes. The distance prefetched ahead is proportional
11731 to this constant. Increasing this number may also lead to less
11732 streams being prefetched (see @option{simultaneous-prefetches}).
11733
11734 @item simultaneous-prefetches
11735 Maximum number of prefetches that can run at the same time.
11736
11737 @item l1-cache-line-size
11738 The size of cache line in L1 data cache, in bytes.
11739
11740 @item l1-cache-size
11741 The size of L1 data cache, in kilobytes.
11742
11743 @item l2-cache-size
11744 The size of L2 data cache, in kilobytes.
11745
11746 @item prefetch-dynamic-strides
11747 Whether the loop array prefetch pass should issue software prefetch hints
11748 for strides that are non-constant. In some cases this may be
11749 beneficial, though the fact the stride is non-constant may make it
11750 hard to predict when there is clear benefit to issuing these hints.
11751
11752 Set to 1 if the prefetch hints should be issued for non-constant
11753 strides. Set to 0 if prefetch hints should be issued only for strides that
11754 are known to be constant and below @option{prefetch-minimum-stride}.
11755
11756 @item prefetch-minimum-stride
11757 Minimum constant stride, in bytes, to start using prefetch hints for. If
11758 the stride is less than this threshold, prefetch hints will not be issued.
11759
11760 This setting is useful for processors that have hardware prefetchers, in
11761 which case there may be conflicts between the hardware prefetchers and
11762 the software prefetchers. If the hardware prefetchers have a maximum
11763 stride they can handle, it should be used here to improve the use of
11764 software prefetchers.
11765
11766 A value of -1 means we don't have a threshold and therefore
11767 prefetch hints can be issued for any constant stride.
11768
11769 This setting is only useful for strides that are known and constant.
11770
11771 @item loop-interchange-max-num-stmts
11772 The maximum number of stmts in a loop to be interchanged.
11773
11774 @item loop-interchange-stride-ratio
11775 The minimum ratio between stride of two loops for interchange to be profitable.
11776
11777 @item min-insn-to-prefetch-ratio
11778 The minimum ratio between the number of instructions and the
11779 number of prefetches to enable prefetching in a loop.
11780
11781 @item prefetch-min-insn-to-mem-ratio
11782 The minimum ratio between the number of instructions and the
11783 number of memory references to enable prefetching in a loop.
11784
11785 @item use-canonical-types
11786 Whether the compiler should use the ``canonical'' type system.
11787 Should always be 1, which uses a more efficient internal
11788 mechanism for comparing types in C++ and Objective-C++. However, if
11789 bugs in the canonical type system are causing compilation failures,
11790 set this value to 0 to disable canonical types.
11791
11792 @item switch-conversion-max-branch-ratio
11793 Switch initialization conversion refuses to create arrays that are
11794 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11795 branches in the switch.
11796
11797 @item max-partial-antic-length
11798 Maximum length of the partial antic set computed during the tree
11799 partial redundancy elimination optimization (@option{-ftree-pre}) when
11800 optimizing at @option{-O3} and above. For some sorts of source code
11801 the enhanced partial redundancy elimination optimization can run away,
11802 consuming all of the memory available on the host machine. This
11803 parameter sets a limit on the length of the sets that are computed,
11804 which prevents the runaway behavior. Setting a value of 0 for
11805 this parameter allows an unlimited set length.
11806
11807 @item rpo-vn-max-loop-depth
11808 Maximum loop depth that is value-numbered optimistically.
11809 When the limit hits the innermost
11810 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11811 loop nest are value-numbered optimistically and the remaining ones not.
11812
11813 @item sccvn-max-alias-queries-per-access
11814 Maximum number of alias-oracle queries we perform when looking for
11815 redundancies for loads and stores. If this limit is hit the search
11816 is aborted and the load or store is not considered redundant. The
11817 number of queries is algorithmically limited to the number of
11818 stores on all paths from the load to the function entry.
11819
11820 @item ira-max-loops-num
11821 IRA uses regional register allocation by default. If a function
11822 contains more loops than the number given by this parameter, only at most
11823 the given number of the most frequently-executed loops form regions
11824 for regional register allocation.
11825
11826 @item ira-max-conflict-table-size
11827 Although IRA uses a sophisticated algorithm to compress the conflict
11828 table, the table can still require excessive amounts of memory for
11829 huge functions. If the conflict table for a function could be more
11830 than the size in MB given by this parameter, the register allocator
11831 instead uses a faster, simpler, and lower-quality
11832 algorithm that does not require building a pseudo-register conflict table.
11833
11834 @item ira-loop-reserved-regs
11835 IRA can be used to evaluate more accurate register pressure in loops
11836 for decisions to move loop invariants (see @option{-O3}). The number
11837 of available registers reserved for some other purposes is given
11838 by this parameter. Default of the parameter
11839 is the best found from numerous experiments.
11840
11841 @item lra-inheritance-ebb-probability-cutoff
11842 LRA tries to reuse values reloaded in registers in subsequent insns.
11843 This optimization is called inheritance. EBB is used as a region to
11844 do this optimization. The parameter defines a minimal fall-through
11845 edge probability in percentage used to add BB to inheritance EBB in
11846 LRA. The default value was chosen
11847 from numerous runs of SPEC2000 on x86-64.
11848
11849 @item loop-invariant-max-bbs-in-loop
11850 Loop invariant motion can be very expensive, both in compilation time and
11851 in amount of needed compile-time memory, with very large loops. Loops
11852 with more basic blocks than this parameter won't have loop invariant
11853 motion optimization performed on them.
11854
11855 @item loop-max-datarefs-for-datadeps
11856 Building data dependencies is expensive for very large loops. This
11857 parameter limits the number of data references in loops that are
11858 considered for data dependence analysis. These large loops are no
11859 handled by the optimizations using loop data dependencies.
11860
11861 @item max-vartrack-size
11862 Sets a maximum number of hash table slots to use during variable
11863 tracking dataflow analysis of any function. If this limit is exceeded
11864 with variable tracking at assignments enabled, analysis for that
11865 function is retried without it, after removing all debug insns from
11866 the function. If the limit is exceeded even without debug insns, var
11867 tracking analysis is completely disabled for the function. Setting
11868 the parameter to zero makes it unlimited.
11869
11870 @item max-vartrack-expr-depth
11871 Sets a maximum number of recursion levels when attempting to map
11872 variable names or debug temporaries to value expressions. This trades
11873 compilation time for more complete debug information. If this is set too
11874 low, value expressions that are available and could be represented in
11875 debug information may end up not being used; setting this higher may
11876 enable the compiler to find more complex debug expressions, but compile
11877 time and memory use may grow.
11878
11879 @item max-debug-marker-count
11880 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11881 markers) to avoid complexity explosion at inlining or expanding to RTL.
11882 If a function has more such gimple stmts than the set limit, such stmts
11883 will be dropped from the inlined copy of a function, and from its RTL
11884 expansion.
11885
11886 @item min-nondebug-insn-uid
11887 Use uids starting at this parameter for nondebug insns. The range below
11888 the parameter is reserved exclusively for debug insns created by
11889 @option{-fvar-tracking-assignments}, but debug insns may get
11890 (non-overlapping) uids above it if the reserved range is exhausted.
11891
11892 @item ipa-sra-ptr-growth-factor
11893 IPA-SRA replaces a pointer to an aggregate with one or more new
11894 parameters only when their cumulative size is less or equal to
11895 @option{ipa-sra-ptr-growth-factor} times the size of the original
11896 pointer parameter.
11897
11898 @item sra-max-scalarization-size-Ospeed
11899 @itemx sra-max-scalarization-size-Osize
11900 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11901 replace scalar parts of aggregates with uses of independent scalar
11902 variables. These parameters control the maximum size, in storage units,
11903 of aggregate which is considered for replacement when compiling for
11904 speed
11905 (@option{sra-max-scalarization-size-Ospeed}) or size
11906 (@option{sra-max-scalarization-size-Osize}) respectively.
11907
11908 @item tm-max-aggregate-size
11909 When making copies of thread-local variables in a transaction, this
11910 parameter specifies the size in bytes after which variables are
11911 saved with the logging functions as opposed to save/restore code
11912 sequence pairs. This option only applies when using
11913 @option{-fgnu-tm}.
11914
11915 @item graphite-max-nb-scop-params
11916 To avoid exponential effects in the Graphite loop transforms, the
11917 number of parameters in a Static Control Part (SCoP) is bounded.
11918 A value of zero can be used to lift
11919 the bound. A variable whose value is unknown at compilation time and
11920 defined outside a SCoP is a parameter of the SCoP.
11921
11922 @item loop-block-tile-size
11923 Loop blocking or strip mining transforms, enabled with
11924 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11925 loop in the loop nest by a given number of iterations. The strip
11926 length can be changed using the @option{loop-block-tile-size}
11927 parameter.
11928
11929 @item ipa-cp-value-list-size
11930 IPA-CP attempts to track all possible values and types passed to a function's
11931 parameter in order to propagate them and perform devirtualization.
11932 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11933 stores per one formal parameter of a function.
11934
11935 @item ipa-cp-eval-threshold
11936 IPA-CP calculates its own score of cloning profitability heuristics
11937 and performs those cloning opportunities with scores that exceed
11938 @option{ipa-cp-eval-threshold}.
11939
11940 @item ipa-cp-recursion-penalty
11941 Percentage penalty the recursive functions will receive when they
11942 are evaluated for cloning.
11943
11944 @item ipa-cp-single-call-penalty
11945 Percentage penalty functions containing a single call to another
11946 function will receive when they are evaluated for cloning.
11947
11948 @item ipa-max-agg-items
11949 IPA-CP is also capable to propagate a number of scalar values passed
11950 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11951 number of such values per one parameter.
11952
11953 @item ipa-cp-loop-hint-bonus
11954 When IPA-CP determines that a cloning candidate would make the number
11955 of iterations of a loop known, it adds a bonus of
11956 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11957 the candidate.
11958
11959 @item ipa-max-aa-steps
11960 During its analysis of function bodies, IPA-CP employs alias analysis
11961 in order to track values pointed to by function parameters. In order
11962 not spend too much time analyzing huge functions, it gives up and
11963 consider all memory clobbered after examining
11964 @option{ipa-max-aa-steps} statements modifying memory.
11965
11966 @item lto-partitions
11967 Specify desired number of partitions produced during WHOPR compilation.
11968 The number of partitions should exceed the number of CPUs used for compilation.
11969
11970 @item lto-min-partition
11971 Size of minimal partition for WHOPR (in estimated instructions).
11972 This prevents expenses of splitting very small programs into too many
11973 partitions.
11974
11975 @item lto-max-partition
11976 Size of max partition for WHOPR (in estimated instructions).
11977 to provide an upper bound for individual size of partition.
11978 Meant to be used only with balanced partitioning.
11979
11980 @item lto-max-streaming-parallelism
11981 Maximal number of parallel processes used for LTO streaming.
11982
11983 @item cxx-max-namespaces-for-diagnostic-help
11984 The maximum number of namespaces to consult for suggestions when C++
11985 name lookup fails for an identifier.
11986
11987 @item sink-frequency-threshold
11988 The maximum relative execution frequency (in percents) of the target block
11989 relative to a statement's original block to allow statement sinking of a
11990 statement. Larger numbers result in more aggressive statement sinking.
11991 A small positive adjustment is applied for
11992 statements with memory operands as those are even more profitable so sink.
11993
11994 @item max-stores-to-sink
11995 The maximum number of conditional store pairs that can be sunk. Set to 0
11996 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11997 (@option{-ftree-loop-if-convert}) is disabled.
11998
11999 @item allow-store-data-races
12000 Allow optimizers to introduce new data races on stores.
12001 Set to 1 to allow, otherwise to 0.
12002
12003 @item case-values-threshold
12004 The smallest number of different values for which it is best to use a
12005 jump-table instead of a tree of conditional branches. If the value is
12006 0, use the default for the machine.
12007
12008 @item jump-table-max-growth-ratio-for-size
12009 The maximum code size growth ratio when expanding
12010 into a jump table (in percent). The parameter is used when
12011 optimizing for size.
12012
12013 @item jump-table-max-growth-ratio-for-speed
12014 The maximum code size growth ratio when expanding
12015 into a jump table (in percent). The parameter is used when
12016 optimizing for speed.
12017
12018 @item tree-reassoc-width
12019 Set the maximum number of instructions executed in parallel in
12020 reassociated tree. This parameter overrides target dependent
12021 heuristics used by default if has non zero value.
12022
12023 @item sched-pressure-algorithm
12024 Choose between the two available implementations of
12025 @option{-fsched-pressure}. Algorithm 1 is the original implementation
12026 and is the more likely to prevent instructions from being reordered.
12027 Algorithm 2 was designed to be a compromise between the relatively
12028 conservative approach taken by algorithm 1 and the rather aggressive
12029 approach taken by the default scheduler. It relies more heavily on
12030 having a regular register file and accurate register pressure classes.
12031 See @file{haifa-sched.c} in the GCC sources for more details.
12032
12033 The default choice depends on the target.
12034
12035 @item max-slsr-cand-scan
12036 Set the maximum number of existing candidates that are considered when
12037 seeking a basis for a new straight-line strength reduction candidate.
12038
12039 @item asan-globals
12040 Enable buffer overflow detection for global objects. This kind
12041 of protection is enabled by default if you are using
12042 @option{-fsanitize=address} option.
12043 To disable global objects protection use @option{--param asan-globals=0}.
12044
12045 @item asan-stack
12046 Enable buffer overflow detection for stack objects. This kind of
12047 protection is enabled by default when using @option{-fsanitize=address}.
12048 To disable stack protection use @option{--param asan-stack=0} option.
12049
12050 @item asan-instrument-reads
12051 Enable buffer overflow detection for memory reads. This kind of
12052 protection is enabled by default when using @option{-fsanitize=address}.
12053 To disable memory reads protection use
12054 @option{--param asan-instrument-reads=0}.
12055
12056 @item asan-instrument-writes
12057 Enable buffer overflow detection for memory writes. This kind of
12058 protection is enabled by default when using @option{-fsanitize=address}.
12059 To disable memory writes protection use
12060 @option{--param asan-instrument-writes=0} option.
12061
12062 @item asan-memintrin
12063 Enable detection for built-in functions. This kind of protection
12064 is enabled by default when using @option{-fsanitize=address}.
12065 To disable built-in functions protection use
12066 @option{--param asan-memintrin=0}.
12067
12068 @item asan-use-after-return
12069 Enable detection of use-after-return. This kind of protection
12070 is enabled by default when using the @option{-fsanitize=address} option.
12071 To disable it use @option{--param asan-use-after-return=0}.
12072
12073 Note: By default the check is disabled at run time. To enable it,
12074 add @code{detect_stack_use_after_return=1} to the environment variable
12075 @env{ASAN_OPTIONS}.
12076
12077 @item asan-instrumentation-with-call-threshold
12078 If number of memory accesses in function being instrumented
12079 is greater or equal to this number, use callbacks instead of inline checks.
12080 E.g. to disable inline code use
12081 @option{--param asan-instrumentation-with-call-threshold=0}.
12082
12083 @item use-after-scope-direct-emission-threshold
12084 If the size of a local variable in bytes is smaller or equal to this
12085 number, directly poison (or unpoison) shadow memory instead of using
12086 run-time callbacks.
12087
12088 @item max-fsm-thread-path-insns
12089 Maximum number of instructions to copy when duplicating blocks on a
12090 finite state automaton jump thread path.
12091
12092 @item max-fsm-thread-length
12093 Maximum number of basic blocks on a finite state automaton jump thread
12094 path.
12095
12096 @item max-fsm-thread-paths
12097 Maximum number of new jump thread paths to create for a finite state
12098 automaton.
12099
12100 @item parloops-chunk-size
12101 Chunk size of omp schedule for loops parallelized by parloops.
12102
12103 @item parloops-schedule
12104 Schedule type of omp schedule for loops parallelized by parloops (static,
12105 dynamic, guided, auto, runtime).
12106
12107 @item parloops-min-per-thread
12108 The minimum number of iterations per thread of an innermost parallelized
12109 loop for which the parallelized variant is preferred over the single threaded
12110 one. Note that for a parallelized loop nest the
12111 minimum number of iterations of the outermost loop per thread is two.
12112
12113 @item max-ssa-name-query-depth
12114 Maximum depth of recursion when querying properties of SSA names in things
12115 like fold routines. One level of recursion corresponds to following a
12116 use-def chain.
12117
12118 @item hsa-gen-debug-stores
12119 Enable emission of special debug stores within HSA kernels which are
12120 then read and reported by libgomp plugin. Generation of these stores
12121 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12122 enable it.
12123
12124 @item max-speculative-devirt-maydefs
12125 The maximum number of may-defs we analyze when looking for a must-def
12126 specifying the dynamic type of an object that invokes a virtual call
12127 we may be able to devirtualize speculatively.
12128
12129 @item max-vrp-switch-assertions
12130 The maximum number of assertions to add along the default edge of a switch
12131 statement during VRP.
12132
12133 @item unroll-jam-min-percent
12134 The minimum percentage of memory references that must be optimized
12135 away for the unroll-and-jam transformation to be considered profitable.
12136
12137 @item unroll-jam-max-unroll
12138 The maximum number of times the outer loop should be unrolled by
12139 the unroll-and-jam transformation.
12140
12141 @item max-rtl-if-conversion-unpredictable-cost
12142 Maximum permissible cost for the sequence that would be generated
12143 by the RTL if-conversion pass for a branch that is considered unpredictable.
12144
12145 @item max-variable-expansions-in-unroller
12146 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12147 of times that an individual variable will be expanded during loop unrolling.
12148
12149 @item tracer-min-branch-probability-feedback
12150 Stop forward growth if the probability of best edge is less than
12151 this threshold (in percent). Used when profile feedback is available.
12152
12153 @item partial-inlining-entry-probability
12154 Maximum probability of the entry BB of split region
12155 (in percent relative to entry BB of the function)
12156 to make partial inlining happen.
12157
12158 @item max-tracked-strlens
12159 Maximum number of strings for which strlen optimization pass will
12160 track string lengths.
12161
12162 @item gcse-after-reload-partial-fraction
12163 The threshold ratio for performing partial redundancy
12164 elimination after reload.
12165
12166 @item gcse-after-reload-critical-fraction
12167 The threshold ratio of critical edges execution count that
12168 permit performing redundancy elimination after reload.
12169
12170 @item max-loop-header-insns
12171 The maximum number of insns in loop header duplicated
12172 by the copy loop headers pass.
12173
12174 @item vect-epilogues-nomask
12175 Enable loop epilogue vectorization using smaller vector size.
12176
12177 @item slp-max-insns-in-bb
12178 Maximum number of instructions in basic block to be
12179 considered for SLP vectorization.
12180
12181 @item avoid-fma-max-bits
12182 Maximum number of bits for which we avoid creating FMAs.
12183
12184 @item sms-loop-average-count-threshold
12185 A threshold on the average loop count considered by the swing modulo scheduler.
12186
12187 @item sms-dfa-history
12188 The number of cycles the swing modulo scheduler considers when checking
12189 conflicts using DFA.
12190
12191 @item max-inline-insns-recursive-auto
12192 The maximum number of instructions non-inline function
12193 can grow to via recursive inlining.
12194
12195 @item graphite-allow-codegen-errors
12196 Whether codegen errors should be ICEs when @option{-fchecking}.
12197
12198 @item sms-max-ii-factor
12199 A factor for tuning the upper bound that swing modulo scheduler
12200 uses for scheduling a loop.
12201
12202 @item lra-max-considered-reload-pseudos
12203 The max number of reload pseudos which are considered during
12204 spilling a non-reload pseudo.
12205
12206 @item max-pow-sqrt-depth
12207 Maximum depth of sqrt chains to use when synthesizing exponentiation
12208 by a real constant.
12209
12210 @item max-dse-active-local-stores
12211 Maximum number of active local stores in RTL dead store elimination.
12212
12213 @item asan-instrument-allocas
12214 Enable asan allocas/VLAs protection.
12215
12216 @item max-iterations-computation-cost
12217 Bound on the cost of an expression to compute the number of iterations.
12218
12219 @item max-isl-operations
12220 Maximum number of isl operations, 0 means unlimited.
12221
12222 @item graphite-max-arrays-per-scop
12223 Maximum number of arrays per scop.
12224
12225 @item max-vartrack-reverse-op-size
12226 Max. size of loc list for which reverse ops should be added.
12227
12228 @item tracer-dynamic-coverage-feedback
12229 The percentage of function, weighted by execution frequency,
12230 that must be covered by trace formation.
12231 Used when profile feedback is available.
12232
12233 @item max-inline-recursive-depth-auto
12234 The maximum depth of recursive inlining for non-inline functions.
12235
12236 @item fsm-scale-path-stmts
12237 Scale factor to apply to the number of statements in a threading path
12238 when comparing to the number of (scaled) blocks.
12239
12240 @item fsm-maximum-phi-arguments
12241 Maximum number of arguments a PHI may have before the FSM threader
12242 will not try to thread through its block.
12243
12244 @item uninit-control-dep-attempts
12245 Maximum number of nested calls to search for control dependencies
12246 during uninitialized variable analysis.
12247
12248 @item max-once-peeled-insns
12249 The maximum number of insns of a peeled loop that rolls only once.
12250
12251 @item sra-max-scalarization-size-Osize
12252 Maximum size, in storage units, of an aggregate
12253 which should be considered for scalarization when compiling for size.
12254
12255 @item fsm-scale-path-blocks
12256 Scale factor to apply to the number of blocks in a threading path
12257 when comparing to the number of (scaled) statements.
12258
12259 @item sched-autopref-queue-depth
12260 Hardware autoprefetcher scheduler model control flag.
12261 Number of lookahead cycles the model looks into; at '
12262 ' only enable instruction sorting heuristic.
12263
12264 @item loop-versioning-max-inner-insns
12265 The maximum number of instructions that an inner loop can have
12266 before the loop versioning pass considers it too big to copy.
12267
12268 @item loop-versioning-max-outer-insns
12269 The maximum number of instructions that an outer loop can have
12270 before the loop versioning pass considers it too big to copy,
12271 discounting any instructions in inner loops that directly benefit
12272 from versioning.
12273
12274 @item ssa-name-def-chain-limit
12275 The maximum number of SSA_NAME assignments to follow in determining
12276 a property of a variable such as its value. This limits the number
12277 of iterations or recursive calls GCC performs when optimizing certain
12278 statements or when determining their validity prior to issuing
12279 diagnostics.
12280
12281 @end table
12282 @end table
12283
12284 @node Instrumentation Options
12285 @section Program Instrumentation Options
12286 @cindex instrumentation options
12287 @cindex program instrumentation options
12288 @cindex run-time error checking options
12289 @cindex profiling options
12290 @cindex options, program instrumentation
12291 @cindex options, run-time error checking
12292 @cindex options, profiling
12293
12294 GCC supports a number of command-line options that control adding
12295 run-time instrumentation to the code it normally generates.
12296 For example, one purpose of instrumentation is collect profiling
12297 statistics for use in finding program hot spots, code coverage
12298 analysis, or profile-guided optimizations.
12299 Another class of program instrumentation is adding run-time checking
12300 to detect programming errors like invalid pointer
12301 dereferences or out-of-bounds array accesses, as well as deliberately
12302 hostile attacks such as stack smashing or C++ vtable hijacking.
12303 There is also a general hook which can be used to implement other
12304 forms of tracing or function-level instrumentation for debug or
12305 program analysis purposes.
12306
12307 @table @gcctabopt
12308 @cindex @command{prof}
12309 @cindex @command{gprof}
12310 @item -p
12311 @itemx -pg
12312 @opindex p
12313 @opindex pg
12314 Generate extra code to write profile information suitable for the
12315 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12316 (for @option{-pg}). You must use this option when compiling
12317 the source files you want data about, and you must also use it when
12318 linking.
12319
12320 You can use the function attribute @code{no_instrument_function} to
12321 suppress profiling of individual functions when compiling with these options.
12322 @xref{Common Function Attributes}.
12323
12324 @item -fprofile-arcs
12325 @opindex fprofile-arcs
12326 Add code so that program flow @dfn{arcs} are instrumented. During
12327 execution the program records how many times each branch and call is
12328 executed and how many times it is taken or returns. On targets that support
12329 constructors with priority support, profiling properly handles constructors,
12330 destructors and C++ constructors (and destructors) of classes which are used
12331 as a type of a global variable.
12332
12333 When the compiled
12334 program exits it saves this data to a file called
12335 @file{@var{auxname}.gcda} for each source file. The data may be used for
12336 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12337 test coverage analysis (@option{-ftest-coverage}). Each object file's
12338 @var{auxname} is generated from the name of the output file, if
12339 explicitly specified and it is not the final executable, otherwise it is
12340 the basename of the source file. In both cases any suffix is removed
12341 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12342 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12343 @xref{Cross-profiling}.
12344
12345 @cindex @command{gcov}
12346 @item --coverage
12347 @opindex coverage
12348
12349 This option is used to compile and link code instrumented for coverage
12350 analysis. The option is a synonym for @option{-fprofile-arcs}
12351 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12352 linking). See the documentation for those options for more details.
12353
12354 @itemize
12355
12356 @item
12357 Compile the source files with @option{-fprofile-arcs} plus optimization
12358 and code generation options. For test coverage analysis, use the
12359 additional @option{-ftest-coverage} option. You do not need to profile
12360 every source file in a program.
12361
12362 @item
12363 Compile the source files additionally with @option{-fprofile-abs-path}
12364 to create absolute path names in the @file{.gcno} files. This allows
12365 @command{gcov} to find the correct sources in projects where compilations
12366 occur with different working directories.
12367
12368 @item
12369 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12370 (the latter implies the former).
12371
12372 @item
12373 Run the program on a representative workload to generate the arc profile
12374 information. This may be repeated any number of times. You can run
12375 concurrent instances of your program, and provided that the file system
12376 supports locking, the data files will be correctly updated. Unless
12377 a strict ISO C dialect option is in effect, @code{fork} calls are
12378 detected and correctly handled without double counting.
12379
12380 @item
12381 For profile-directed optimizations, compile the source files again with
12382 the same optimization and code generation options plus
12383 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12384 Control Optimization}).
12385
12386 @item
12387 For test coverage analysis, use @command{gcov} to produce human readable
12388 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12389 @command{gcov} documentation for further information.
12390
12391 @end itemize
12392
12393 With @option{-fprofile-arcs}, for each function of your program GCC
12394 creates a program flow graph, then finds a spanning tree for the graph.
12395 Only arcs that are not on the spanning tree have to be instrumented: the
12396 compiler adds code to count the number of times that these arcs are
12397 executed. When an arc is the only exit or only entrance to a block, the
12398 instrumentation code can be added to the block; otherwise, a new basic
12399 block must be created to hold the instrumentation code.
12400
12401 @need 2000
12402 @item -ftest-coverage
12403 @opindex ftest-coverage
12404 Produce a notes file that the @command{gcov} code-coverage utility
12405 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12406 show program coverage. Each source file's note file is called
12407 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12408 above for a description of @var{auxname} and instructions on how to
12409 generate test coverage data. Coverage data matches the source files
12410 more closely if you do not optimize.
12411
12412 @item -fprofile-abs-path
12413 @opindex fprofile-abs-path
12414 Automatically convert relative source file names to absolute path names
12415 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12416 sources in projects where compilations occur with different working
12417 directories.
12418
12419 @item -fprofile-dir=@var{path}
12420 @opindex fprofile-dir
12421
12422 Set the directory to search for the profile data files in to @var{path}.
12423 This option affects only the profile data generated by
12424 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12425 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12426 and its related options. Both absolute and relative paths can be used.
12427 By default, GCC uses the current directory as @var{path}, thus the
12428 profile data file appears in the same directory as the object file.
12429 In order to prevent the file name clashing, if the object file name is
12430 not an absolute path, we mangle the absolute path of the
12431 @file{@var{sourcename}.gcda} file and use it as the file name of a
12432 @file{.gcda} file. See similar option @option{-fprofile-note}.
12433
12434 When an executable is run in a massive parallel environment, it is recommended
12435 to save profile to different folders. That can be done with variables
12436 in @var{path} that are exported during run-time:
12437
12438 @table @gcctabopt
12439
12440 @item %p
12441 process ID.
12442
12443 @item %q@{VAR@}
12444 value of environment variable @var{VAR}
12445
12446 @end table
12447
12448 @item -fprofile-generate
12449 @itemx -fprofile-generate=@var{path}
12450 @opindex fprofile-generate
12451
12452 Enable options usually used for instrumenting application to produce
12453 profile useful for later recompilation with profile feedback based
12454 optimization. You must use @option{-fprofile-generate} both when
12455 compiling and when linking your program.
12456
12457 The following options are enabled:
12458 @option{-fprofile-arcs}, @option{-fprofile-values},
12459 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12460
12461 If @var{path} is specified, GCC looks at the @var{path} to find
12462 the profile feedback data files. See @option{-fprofile-dir}.
12463
12464 To optimize the program based on the collected profile information, use
12465 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12466
12467 @item -fprofile-note=@var{path}
12468 @opindex fprofile-note
12469
12470 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
12471 location. If you combine the option with multiple source files,
12472 the @file{.gcno} file will be overwritten.
12473
12474 @item -fprofile-update=@var{method}
12475 @opindex fprofile-update
12476
12477 Alter the update method for an application instrumented for profile
12478 feedback based optimization. The @var{method} argument should be one of
12479 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12480 The first one is useful for single-threaded applications,
12481 while the second one prevents profile corruption by emitting thread-safe code.
12482
12483 @strong{Warning:} When an application does not properly join all threads
12484 (or creates an detached thread), a profile file can be still corrupted.
12485
12486 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12487 when supported by a target, or to @samp{single} otherwise. The GCC driver
12488 automatically selects @samp{prefer-atomic} when @option{-pthread}
12489 is present in the command line.
12490
12491 @item -fprofile-filter-files=@var{regex}
12492 @opindex fprofile-filter-files
12493
12494 Instrument only functions from files where names match
12495 any regular expression (separated by a semi-colon).
12496
12497 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12498 only @file{main.c} and all C files starting with 'module'.
12499
12500 @item -fprofile-exclude-files=@var{regex}
12501 @opindex fprofile-exclude-files
12502
12503 Instrument only functions from files where names do not match
12504 all the regular expressions (separated by a semi-colon).
12505
12506 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12507 of all files that are located in @file{/usr/} folder.
12508
12509 @item -fsanitize=address
12510 @opindex fsanitize=address
12511 Enable AddressSanitizer, a fast memory error detector.
12512 Memory access instructions are instrumented to detect
12513 out-of-bounds and use-after-free bugs.
12514 The option enables @option{-fsanitize-address-use-after-scope}.
12515 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12516 more details. The run-time behavior can be influenced using the
12517 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12518 the available options are shown at startup of the instrumented program. See
12519 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12520 for a list of supported options.
12521 The option cannot be combined with @option{-fsanitize=thread}.
12522
12523 @item -fsanitize=kernel-address
12524 @opindex fsanitize=kernel-address
12525 Enable AddressSanitizer for Linux kernel.
12526 See @uref{https://github.com/google/kasan/wiki} for more details.
12527
12528 @item -fsanitize=pointer-compare
12529 @opindex fsanitize=pointer-compare
12530 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12531 The option must be combined with either @option{-fsanitize=kernel-address} or
12532 @option{-fsanitize=address}
12533 The option cannot be combined with @option{-fsanitize=thread}.
12534 Note: By default the check is disabled at run time. To enable it,
12535 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12536 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12537 invalid operation only when both pointers are non-null.
12538
12539 @item -fsanitize=pointer-subtract
12540 @opindex fsanitize=pointer-subtract
12541 Instrument subtraction with pointer operands.
12542 The option must be combined with either @option{-fsanitize=kernel-address} or
12543 @option{-fsanitize=address}
12544 The option cannot be combined with @option{-fsanitize=thread}.
12545 Note: By default the check is disabled at run time. To enable it,
12546 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12547 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12548 invalid operation only when both pointers are non-null.
12549
12550 @item -fsanitize=thread
12551 @opindex fsanitize=thread
12552 Enable ThreadSanitizer, a fast data race detector.
12553 Memory access instructions are instrumented to detect
12554 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12555 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12556 environment variable; see
12557 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12558 supported options.
12559 The option cannot be combined with @option{-fsanitize=address},
12560 @option{-fsanitize=leak}.
12561
12562 Note that sanitized atomic builtins cannot throw exceptions when
12563 operating on invalid memory addresses with non-call exceptions
12564 (@option{-fnon-call-exceptions}).
12565
12566 @item -fsanitize=leak
12567 @opindex fsanitize=leak
12568 Enable LeakSanitizer, a memory leak detector.
12569 This option only matters for linking of executables and
12570 the executable is linked against a library that overrides @code{malloc}
12571 and other allocator functions. See
12572 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12573 details. The run-time behavior can be influenced using the
12574 @env{LSAN_OPTIONS} environment variable.
12575 The option cannot be combined with @option{-fsanitize=thread}.
12576
12577 @item -fsanitize=undefined
12578 @opindex fsanitize=undefined
12579 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12580 Various computations are instrumented to detect undefined behavior
12581 at runtime. Current suboptions are:
12582
12583 @table @gcctabopt
12584
12585 @item -fsanitize=shift
12586 @opindex fsanitize=shift
12587 This option enables checking that the result of a shift operation is
12588 not undefined. Note that what exactly is considered undefined differs
12589 slightly between C and C++, as well as between ISO C90 and C99, etc.
12590 This option has two suboptions, @option{-fsanitize=shift-base} and
12591 @option{-fsanitize=shift-exponent}.
12592
12593 @item -fsanitize=shift-exponent
12594 @opindex fsanitize=shift-exponent
12595 This option enables checking that the second argument of a shift operation
12596 is not negative and is smaller than the precision of the promoted first
12597 argument.
12598
12599 @item -fsanitize=shift-base
12600 @opindex fsanitize=shift-base
12601 If the second argument of a shift operation is within range, check that the
12602 result of a shift operation is not undefined. Note that what exactly is
12603 considered undefined differs slightly between C and C++, as well as between
12604 ISO C90 and C99, etc.
12605
12606 @item -fsanitize=integer-divide-by-zero
12607 @opindex fsanitize=integer-divide-by-zero
12608 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12609
12610 @item -fsanitize=unreachable
12611 @opindex fsanitize=unreachable
12612 With this option, the compiler turns the @code{__builtin_unreachable}
12613 call into a diagnostics message call instead. When reaching the
12614 @code{__builtin_unreachable} call, the behavior is undefined.
12615
12616 @item -fsanitize=vla-bound
12617 @opindex fsanitize=vla-bound
12618 This option instructs the compiler to check that the size of a variable
12619 length array is positive.
12620
12621 @item -fsanitize=null
12622 @opindex fsanitize=null
12623 This option enables pointer checking. Particularly, the application
12624 built with this option turned on will issue an error message when it
12625 tries to dereference a NULL pointer, or if a reference (possibly an
12626 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12627 on an object pointed by a NULL pointer.
12628
12629 @item -fsanitize=return
12630 @opindex fsanitize=return
12631 This option enables return statement checking. Programs
12632 built with this option turned on will issue an error message
12633 when the end of a non-void function is reached without actually
12634 returning a value. This option works in C++ only.
12635
12636 @item -fsanitize=signed-integer-overflow
12637 @opindex fsanitize=signed-integer-overflow
12638 This option enables signed integer overflow checking. We check that
12639 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12640 does not overflow in the signed arithmetics. Note, integer promotion
12641 rules must be taken into account. That is, the following is not an
12642 overflow:
12643 @smallexample
12644 signed char a = SCHAR_MAX;
12645 a++;
12646 @end smallexample
12647
12648 @item -fsanitize=bounds
12649 @opindex fsanitize=bounds
12650 This option enables instrumentation of array bounds. Various out of bounds
12651 accesses are detected. Flexible array members, flexible array member-like
12652 arrays, and initializers of variables with static storage are not instrumented.
12653
12654 @item -fsanitize=bounds-strict
12655 @opindex fsanitize=bounds-strict
12656 This option enables strict instrumentation of array bounds. Most out of bounds
12657 accesses are detected, including flexible array members and flexible array
12658 member-like arrays. Initializers of variables with static storage are not
12659 instrumented.
12660
12661 @item -fsanitize=alignment
12662 @opindex fsanitize=alignment
12663
12664 This option enables checking of alignment of pointers when they are
12665 dereferenced, or when a reference is bound to insufficiently aligned target,
12666 or when a method or constructor is invoked on insufficiently aligned object.
12667
12668 @item -fsanitize=object-size
12669 @opindex fsanitize=object-size
12670 This option enables instrumentation of memory references using the
12671 @code{__builtin_object_size} function. Various out of bounds pointer
12672 accesses are detected.
12673
12674 @item -fsanitize=float-divide-by-zero
12675 @opindex fsanitize=float-divide-by-zero
12676 Detect floating-point division by zero. Unlike other similar options,
12677 @option{-fsanitize=float-divide-by-zero} is not enabled by
12678 @option{-fsanitize=undefined}, since floating-point division by zero can
12679 be a legitimate way of obtaining infinities and NaNs.
12680
12681 @item -fsanitize=float-cast-overflow
12682 @opindex fsanitize=float-cast-overflow
12683 This option enables floating-point type to integer conversion checking.
12684 We check that the result of the conversion does not overflow.
12685 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12686 not enabled by @option{-fsanitize=undefined}.
12687 This option does not work well with @code{FE_INVALID} exceptions enabled.
12688
12689 @item -fsanitize=nonnull-attribute
12690 @opindex fsanitize=nonnull-attribute
12691
12692 This option enables instrumentation of calls, checking whether null values
12693 are not passed to arguments marked as requiring a non-null value by the
12694 @code{nonnull} function attribute.
12695
12696 @item -fsanitize=returns-nonnull-attribute
12697 @opindex fsanitize=returns-nonnull-attribute
12698
12699 This option enables instrumentation of return statements in functions
12700 marked with @code{returns_nonnull} function attribute, to detect returning
12701 of null values from such functions.
12702
12703 @item -fsanitize=bool
12704 @opindex fsanitize=bool
12705
12706 This option enables instrumentation of loads from bool. If a value other
12707 than 0/1 is loaded, a run-time error is issued.
12708
12709 @item -fsanitize=enum
12710 @opindex fsanitize=enum
12711
12712 This option enables instrumentation of loads from an enum type. If
12713 a value outside the range of values for the enum type is loaded,
12714 a run-time error is issued.
12715
12716 @item -fsanitize=vptr
12717 @opindex fsanitize=vptr
12718
12719 This option enables instrumentation of C++ member function calls, member
12720 accesses and some conversions between pointers to base and derived classes,
12721 to verify the referenced object has the correct dynamic type.
12722
12723 @item -fsanitize=pointer-overflow
12724 @opindex fsanitize=pointer-overflow
12725
12726 This option enables instrumentation of pointer arithmetics. If the pointer
12727 arithmetics overflows, a run-time error is issued.
12728
12729 @item -fsanitize=builtin
12730 @opindex fsanitize=builtin
12731
12732 This option enables instrumentation of arguments to selected builtin
12733 functions. If an invalid value is passed to such arguments, a run-time
12734 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12735 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12736 by this option.
12737
12738 @end table
12739
12740 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12741 @option{-fsanitize=undefined} gives a diagnostic message.
12742 This currently works only for the C family of languages.
12743
12744 @item -fno-sanitize=all
12745 @opindex fno-sanitize=all
12746
12747 This option disables all previously enabled sanitizers.
12748 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12749 together.
12750
12751 @item -fasan-shadow-offset=@var{number}
12752 @opindex fasan-shadow-offset
12753 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12754 It is useful for experimenting with different shadow memory layouts in
12755 Kernel AddressSanitizer.
12756
12757 @item -fsanitize-sections=@var{s1},@var{s2},...
12758 @opindex fsanitize-sections
12759 Sanitize global variables in selected user-defined sections. @var{si} may
12760 contain wildcards.
12761
12762 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12763 @opindex fsanitize-recover
12764 @opindex fno-sanitize-recover
12765 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12766 mentioned in comma-separated list of @var{opts}. Enabling this option
12767 for a sanitizer component causes it to attempt to continue
12768 running the program as if no error happened. This means multiple
12769 runtime errors can be reported in a single program run, and the exit
12770 code of the program may indicate success even when errors
12771 have been reported. The @option{-fno-sanitize-recover=} option
12772 can be used to alter
12773 this behavior: only the first detected error is reported
12774 and program then exits with a non-zero exit code.
12775
12776 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12777 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12778 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12779 @option{-fsanitize=bounds-strict},
12780 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12781 For these sanitizers error recovery is turned on by default,
12782 except @option{-fsanitize=address}, for which this feature is experimental.
12783 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12784 accepted, the former enables recovery for all sanitizers that support it,
12785 the latter disables recovery for all sanitizers that support it.
12786
12787 Even if a recovery mode is turned on the compiler side, it needs to be also
12788 enabled on the runtime library side, otherwise the failures are still fatal.
12789 The runtime library defaults to @code{halt_on_error=0} for
12790 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12791 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12792 setting the @code{halt_on_error} flag in the corresponding environment variable.
12793
12794 Syntax without an explicit @var{opts} parameter is deprecated. It is
12795 equivalent to specifying an @var{opts} list of:
12796
12797 @smallexample
12798 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12799 @end smallexample
12800
12801 @item -fsanitize-address-use-after-scope
12802 @opindex fsanitize-address-use-after-scope
12803 Enable sanitization of local variables to detect use-after-scope bugs.
12804 The option sets @option{-fstack-reuse} to @samp{none}.
12805
12806 @item -fsanitize-undefined-trap-on-error
12807 @opindex fsanitize-undefined-trap-on-error
12808 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12809 report undefined behavior using @code{__builtin_trap} rather than
12810 a @code{libubsan} library routine. The advantage of this is that the
12811 @code{libubsan} library is not needed and is not linked in, so this
12812 is usable even in freestanding environments.
12813
12814 @item -fsanitize-coverage=trace-pc
12815 @opindex fsanitize-coverage=trace-pc
12816 Enable coverage-guided fuzzing code instrumentation.
12817 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12818
12819 @item -fsanitize-coverage=trace-cmp
12820 @opindex fsanitize-coverage=trace-cmp
12821 Enable dataflow guided fuzzing code instrumentation.
12822 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12823 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12824 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12825 variable or @code{__sanitizer_cov_trace_const_cmp1},
12826 @code{__sanitizer_cov_trace_const_cmp2},
12827 @code{__sanitizer_cov_trace_const_cmp4} or
12828 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12829 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12830 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12831 @code{__sanitizer_cov_trace_switch} for switch statements.
12832
12833 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12834 @opindex fcf-protection
12835 Enable code instrumentation of control-flow transfers to increase
12836 program security by checking that target addresses of control-flow
12837 transfer instructions (such as indirect function call, function return,
12838 indirect jump) are valid. This prevents diverting the flow of control
12839 to an unexpected target. This is intended to protect against such
12840 threats as Return-oriented Programming (ROP), and similarly
12841 call/jmp-oriented programming (COP/JOP).
12842
12843 The value @code{branch} tells the compiler to implement checking of
12844 validity of control-flow transfer at the point of indirect branch
12845 instructions, i.e.@: call/jmp instructions. The value @code{return}
12846 implements checking of validity at the point of returning from a
12847 function. The value @code{full} is an alias for specifying both
12848 @code{branch} and @code{return}. The value @code{none} turns off
12849 instrumentation.
12850
12851 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12852 used. The first bit of @code{__CET__} is set to 1 for the value
12853 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12854 the @code{return}.
12855
12856 You can also use the @code{nocf_check} attribute to identify
12857 which functions and calls should be skipped from instrumentation
12858 (@pxref{Function Attributes}).
12859
12860 Currently the x86 GNU/Linux target provides an implementation based
12861 on Intel Control-flow Enforcement Technology (CET).
12862
12863 @item -fstack-protector
12864 @opindex fstack-protector
12865 Emit extra code to check for buffer overflows, such as stack smashing
12866 attacks. This is done by adding a guard variable to functions with
12867 vulnerable objects. This includes functions that call @code{alloca}, and
12868 functions with buffers larger than 8 bytes. The guards are initialized
12869 when a function is entered and then checked when the function exits.
12870 If a guard check fails, an error message is printed and the program exits.
12871
12872 @item -fstack-protector-all
12873 @opindex fstack-protector-all
12874 Like @option{-fstack-protector} except that all functions are protected.
12875
12876 @item -fstack-protector-strong
12877 @opindex fstack-protector-strong
12878 Like @option{-fstack-protector} but includes additional functions to
12879 be protected --- those that have local array definitions, or have
12880 references to local frame addresses.
12881
12882 @item -fstack-protector-explicit
12883 @opindex fstack-protector-explicit
12884 Like @option{-fstack-protector} but only protects those functions which
12885 have the @code{stack_protect} attribute.
12886
12887 @item -fstack-check
12888 @opindex fstack-check
12889 Generate code to verify that you do not go beyond the boundary of the
12890 stack. You should specify this flag if you are running in an
12891 environment with multiple threads, but you only rarely need to specify it in
12892 a single-threaded environment since stack overflow is automatically
12893 detected on nearly all systems if there is only one stack.
12894
12895 Note that this switch does not actually cause checking to be done; the
12896 operating system or the language runtime must do that. The switch causes
12897 generation of code to ensure that they see the stack being extended.
12898
12899 You can additionally specify a string parameter: @samp{no} means no
12900 checking, @samp{generic} means force the use of old-style checking,
12901 @samp{specific} means use the best checking method and is equivalent
12902 to bare @option{-fstack-check}.
12903
12904 Old-style checking is a generic mechanism that requires no specific
12905 target support in the compiler but comes with the following drawbacks:
12906
12907 @enumerate
12908 @item
12909 Modified allocation strategy for large objects: they are always
12910 allocated dynamically if their size exceeds a fixed threshold. Note this
12911 may change the semantics of some code.
12912
12913 @item
12914 Fixed limit on the size of the static frame of functions: when it is
12915 topped by a particular function, stack checking is not reliable and
12916 a warning is issued by the compiler.
12917
12918 @item
12919 Inefficiency: because of both the modified allocation strategy and the
12920 generic implementation, code performance is hampered.
12921 @end enumerate
12922
12923 Note that old-style stack checking is also the fallback method for
12924 @samp{specific} if no target support has been added in the compiler.
12925
12926 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12927 and stack overflows. @samp{specific} is an excellent choice when compiling
12928 Ada code. It is not generally sufficient to protect against stack-clash
12929 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12930
12931 @item -fstack-clash-protection
12932 @opindex fstack-clash-protection
12933 Generate code to prevent stack clash style attacks. When this option is
12934 enabled, the compiler will only allocate one page of stack space at a time
12935 and each page is accessed immediately after allocation. Thus, it prevents
12936 allocations from jumping over any stack guard page provided by the
12937 operating system.
12938
12939 Most targets do not fully support stack clash protection. However, on
12940 those targets @option{-fstack-clash-protection} will protect dynamic stack
12941 allocations. @option{-fstack-clash-protection} may also provide limited
12942 protection for static stack allocations if the target supports
12943 @option{-fstack-check=specific}.
12944
12945 @item -fstack-limit-register=@var{reg}
12946 @itemx -fstack-limit-symbol=@var{sym}
12947 @itemx -fno-stack-limit
12948 @opindex fstack-limit-register
12949 @opindex fstack-limit-symbol
12950 @opindex fno-stack-limit
12951 Generate code to ensure that the stack does not grow beyond a certain value,
12952 either the value of a register or the address of a symbol. If a larger
12953 stack is required, a signal is raised at run time. For most targets,
12954 the signal is raised before the stack overruns the boundary, so
12955 it is possible to catch the signal without taking special precautions.
12956
12957 For instance, if the stack starts at absolute address @samp{0x80000000}
12958 and grows downwards, you can use the flags
12959 @option{-fstack-limit-symbol=__stack_limit} and
12960 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12961 of 128KB@. Note that this may only work with the GNU linker.
12962
12963 You can locally override stack limit checking by using the
12964 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12965
12966 @item -fsplit-stack
12967 @opindex fsplit-stack
12968 Generate code to automatically split the stack before it overflows.
12969 The resulting program has a discontiguous stack which can only
12970 overflow if the program is unable to allocate any more memory. This
12971 is most useful when running threaded programs, as it is no longer
12972 necessary to calculate a good stack size to use for each thread. This
12973 is currently only implemented for the x86 targets running
12974 GNU/Linux.
12975
12976 When code compiled with @option{-fsplit-stack} calls code compiled
12977 without @option{-fsplit-stack}, there may not be much stack space
12978 available for the latter code to run. If compiling all code,
12979 including library code, with @option{-fsplit-stack} is not an option,
12980 then the linker can fix up these calls so that the code compiled
12981 without @option{-fsplit-stack} always has a large stack. Support for
12982 this is implemented in the gold linker in GNU binutils release 2.21
12983 and later.
12984
12985 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12986 @opindex fvtable-verify
12987 This option is only available when compiling C++ code.
12988 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12989 feature that verifies at run time, for every virtual call, that
12990 the vtable pointer through which the call is made is valid for the type of
12991 the object, and has not been corrupted or overwritten. If an invalid vtable
12992 pointer is detected at run time, an error is reported and execution of the
12993 program is immediately halted.
12994
12995 This option causes run-time data structures to be built at program startup,
12996 which are used for verifying the vtable pointers.
12997 The options @samp{std} and @samp{preinit}
12998 control the timing of when these data structures are built. In both cases the
12999 data structures are built before execution reaches @code{main}. Using
13000 @option{-fvtable-verify=std} causes the data structures to be built after
13001 shared libraries have been loaded and initialized.
13002 @option{-fvtable-verify=preinit} causes them to be built before shared
13003 libraries have been loaded and initialized.
13004
13005 If this option appears multiple times in the command line with different
13006 values specified, @samp{none} takes highest priority over both @samp{std} and
13007 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
13008
13009 @item -fvtv-debug
13010 @opindex fvtv-debug
13011 When used in conjunction with @option{-fvtable-verify=std} or
13012 @option{-fvtable-verify=preinit}, causes debug versions of the
13013 runtime functions for the vtable verification feature to be called.
13014 This flag also causes the compiler to log information about which
13015 vtable pointers it finds for each class.
13016 This information is written to a file named @file{vtv_set_ptr_data.log}
13017 in the directory named by the environment variable @env{VTV_LOGS_DIR}
13018 if that is defined or the current working directory otherwise.
13019
13020 Note: This feature @emph{appends} data to the log file. If you want a fresh log
13021 file, be sure to delete any existing one.
13022
13023 @item -fvtv-counts
13024 @opindex fvtv-counts
13025 This is a debugging flag. When used in conjunction with
13026 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
13027 causes the compiler to keep track of the total number of virtual calls
13028 it encounters and the number of verifications it inserts. It also
13029 counts the number of calls to certain run-time library functions
13030 that it inserts and logs this information for each compilation unit.
13031 The compiler writes this information to a file named
13032 @file{vtv_count_data.log} in the directory named by the environment
13033 variable @env{VTV_LOGS_DIR} if that is defined or the current working
13034 directory otherwise. It also counts the size of the vtable pointer sets
13035 for each class, and writes this information to @file{vtv_class_set_sizes.log}
13036 in the same directory.
13037
13038 Note: This feature @emph{appends} data to the log files. To get fresh log
13039 files, be sure to delete any existing ones.
13040
13041 @item -finstrument-functions
13042 @opindex finstrument-functions
13043 Generate instrumentation calls for entry and exit to functions. Just
13044 after function entry and just before function exit, the following
13045 profiling functions are called with the address of the current
13046 function and its call site. (On some platforms,
13047 @code{__builtin_return_address} does not work beyond the current
13048 function, so the call site information may not be available to the
13049 profiling functions otherwise.)
13050
13051 @smallexample
13052 void __cyg_profile_func_enter (void *this_fn,
13053 void *call_site);
13054 void __cyg_profile_func_exit (void *this_fn,
13055 void *call_site);
13056 @end smallexample
13057
13058 The first argument is the address of the start of the current function,
13059 which may be looked up exactly in the symbol table.
13060
13061 This instrumentation is also done for functions expanded inline in other
13062 functions. The profiling calls indicate where, conceptually, the
13063 inline function is entered and exited. This means that addressable
13064 versions of such functions must be available. If all your uses of a
13065 function are expanded inline, this may mean an additional expansion of
13066 code size. If you use @code{extern inline} in your C code, an
13067 addressable version of such functions must be provided. (This is
13068 normally the case anyway, but if you get lucky and the optimizer always
13069 expands the functions inline, you might have gotten away without
13070 providing static copies.)
13071
13072 A function may be given the attribute @code{no_instrument_function}, in
13073 which case this instrumentation is not done. This can be used, for
13074 example, for the profiling functions listed above, high-priority
13075 interrupt routines, and any functions from which the profiling functions
13076 cannot safely be called (perhaps signal handlers, if the profiling
13077 routines generate output or allocate memory).
13078 @xref{Common Function Attributes}.
13079
13080 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13081 @opindex finstrument-functions-exclude-file-list
13082
13083 Set the list of functions that are excluded from instrumentation (see
13084 the description of @option{-finstrument-functions}). If the file that
13085 contains a function definition matches with one of @var{file}, then
13086 that function is not instrumented. The match is done on substrings:
13087 if the @var{file} parameter is a substring of the file name, it is
13088 considered to be a match.
13089
13090 For example:
13091
13092 @smallexample
13093 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13094 @end smallexample
13095
13096 @noindent
13097 excludes any inline function defined in files whose pathnames
13098 contain @file{/bits/stl} or @file{include/sys}.
13099
13100 If, for some reason, you want to include letter @samp{,} in one of
13101 @var{sym}, write @samp{\,}. For example,
13102 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13103 (note the single quote surrounding the option).
13104
13105 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13106 @opindex finstrument-functions-exclude-function-list
13107
13108 This is similar to @option{-finstrument-functions-exclude-file-list},
13109 but this option sets the list of function names to be excluded from
13110 instrumentation. The function name to be matched is its user-visible
13111 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13112 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13113 match is done on substrings: if the @var{sym} parameter is a substring
13114 of the function name, it is considered to be a match. For C99 and C++
13115 extended identifiers, the function name must be given in UTF-8, not
13116 using universal character names.
13117
13118 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13119 @opindex fpatchable-function-entry
13120 Generate @var{N} NOPs right at the beginning
13121 of each function, with the function entry point before the @var{M}th NOP.
13122 If @var{M} is omitted, it defaults to @code{0} so the
13123 function entry points to the address just at the first NOP.
13124 The NOP instructions reserve extra space which can be used to patch in
13125 any desired instrumentation at run time, provided that the code segment
13126 is writable. The amount of space is controllable indirectly via
13127 the number of NOPs; the NOP instruction used corresponds to the instruction
13128 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13129 is target-specific and may also depend on the architecture variant and/or
13130 other compilation options.
13131
13132 For run-time identification, the starting addresses of these areas,
13133 which correspond to their respective function entries minus @var{M},
13134 are additionally collected in the @code{__patchable_function_entries}
13135 section of the resulting binary.
13136
13137 Note that the value of @code{__attribute__ ((patchable_function_entry
13138 (N,M)))} takes precedence over command-line option
13139 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13140 the area size or to remove it completely on a single function.
13141 If @code{N=0}, no pad location is recorded.
13142
13143 The NOP instructions are inserted at---and maybe before, depending on
13144 @var{M}---the function entry address, even before the prologue.
13145
13146 @end table
13147
13148
13149 @node Preprocessor Options
13150 @section Options Controlling the Preprocessor
13151 @cindex preprocessor options
13152 @cindex options, preprocessor
13153
13154 These options control the C preprocessor, which is run on each C source
13155 file before actual compilation.
13156
13157 If you use the @option{-E} option, nothing is done except preprocessing.
13158 Some of these options make sense only together with @option{-E} because
13159 they cause the preprocessor output to be unsuitable for actual
13160 compilation.
13161
13162 In addition to the options listed here, there are a number of options
13163 to control search paths for include files documented in
13164 @ref{Directory Options}.
13165 Options to control preprocessor diagnostics are listed in
13166 @ref{Warning Options}.
13167
13168 @table @gcctabopt
13169 @include cppopts.texi
13170
13171 @item -Wp,@var{option}
13172 @opindex Wp
13173 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13174 and pass @var{option} directly through to the preprocessor. If
13175 @var{option} contains commas, it is split into multiple options at the
13176 commas. However, many options are modified, translated or interpreted
13177 by the compiler driver before being passed to the preprocessor, and
13178 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13179 interface is undocumented and subject to change, so whenever possible
13180 you should avoid using @option{-Wp} and let the driver handle the
13181 options instead.
13182
13183 @item -Xpreprocessor @var{option}
13184 @opindex Xpreprocessor
13185 Pass @var{option} as an option to the preprocessor. You can use this to
13186 supply system-specific preprocessor options that GCC does not
13187 recognize.
13188
13189 If you want to pass an option that takes an argument, you must use
13190 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13191
13192 @item -no-integrated-cpp
13193 @opindex no-integrated-cpp
13194 Perform preprocessing as a separate pass before compilation.
13195 By default, GCC performs preprocessing as an integrated part of
13196 input tokenization and parsing.
13197 If this option is provided, the appropriate language front end
13198 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13199 and Objective-C, respectively) is instead invoked twice,
13200 once for preprocessing only and once for actual compilation
13201 of the preprocessed input.
13202 This option may be useful in conjunction with the @option{-B} or
13203 @option{-wrapper} options to specify an alternate preprocessor or
13204 perform additional processing of the program source between
13205 normal preprocessing and compilation.
13206
13207 @end table
13208
13209 @node Assembler Options
13210 @section Passing Options to the Assembler
13211
13212 @c prevent bad page break with this line
13213 You can pass options to the assembler.
13214
13215 @table @gcctabopt
13216 @item -Wa,@var{option}
13217 @opindex Wa
13218 Pass @var{option} as an option to the assembler. If @var{option}
13219 contains commas, it is split into multiple options at the commas.
13220
13221 @item -Xassembler @var{option}
13222 @opindex Xassembler
13223 Pass @var{option} as an option to the assembler. You can use this to
13224 supply system-specific assembler options that GCC does not
13225 recognize.
13226
13227 If you want to pass an option that takes an argument, you must use
13228 @option{-Xassembler} twice, once for the option and once for the argument.
13229
13230 @end table
13231
13232 @node Link Options
13233 @section Options for Linking
13234 @cindex link options
13235 @cindex options, linking
13236
13237 These options come into play when the compiler links object files into
13238 an executable output file. They are meaningless if the compiler is
13239 not doing a link step.
13240
13241 @table @gcctabopt
13242 @cindex file names
13243 @item @var{object-file-name}
13244 A file name that does not end in a special recognized suffix is
13245 considered to name an object file or library. (Object files are
13246 distinguished from libraries by the linker according to the file
13247 contents.) If linking is done, these object files are used as input
13248 to the linker.
13249
13250 @item -c
13251 @itemx -S
13252 @itemx -E
13253 @opindex c
13254 @opindex S
13255 @opindex E
13256 If any of these options is used, then the linker is not run, and
13257 object file names should not be used as arguments. @xref{Overall
13258 Options}.
13259
13260 @item -flinker-output=@var{type}
13261 @opindex flinker-output
13262 This option controls code generation of the link-time optimizer. By
13263 default the linker output is automatically determined by the linker
13264 plugin. For debugging the compiler and if incremental linking with a
13265 non-LTO object file is desired, it may be useful to control the type
13266 manually.
13267
13268 If @var{type} is @samp{exec}, code generation produces a static
13269 binary. In this case @option{-fpic} and @option{-fpie} are both
13270 disabled.
13271
13272 If @var{type} is @samp{dyn}, code generation produces a shared
13273 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13274 but not enabled automatically. This allows to build shared libraries
13275 without position-independent code on architectures where this is
13276 possible, i.e.@: on x86.
13277
13278 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
13279 executable. This results in similar optimizations as @samp{exec}
13280 except that @option{-fpie} is not disabled if specified at compilation
13281 time.
13282
13283 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
13284 done. The sections containing intermediate code for link-time optimization are
13285 merged, pre-optimized, and output to the resulting object file. In addition, if
13286 @option{-ffat-lto-objects} is specified, binary code is produced for future
13287 non-LTO linking. The object file produced by incremental linking is smaller
13288 than a static library produced from the same object files. At link time the
13289 result of incremental linking also loads faster than a static
13290 library assuming that the majority of objects in the library are used.
13291
13292 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13293 code generation is forced, a final binary is produced, and the intermediate
13294 code for later link-time optimization is stripped. When multiple object files
13295 are linked together the resulting code is better optimized than with
13296 link-time optimizations disabled (for example, cross-module inlining
13297 happens), but most of benefits of whole program optimizations are lost.
13298
13299 During the incremental link (by @option{-r}) the linker plugin defaults to
13300 @option{rel}. With current interfaces to GNU Binutils it is however not
13301 possible to incrementally link LTO objects and non-LTO objects into a single
13302 mixed object file. If any of object files in incremental link cannot
13303 be used for link-time optimization, the linker plugin issues a warning and
13304 uses @samp{nolto-rel}. To maintain whole program optimization, it is
13305 recommended to link such objects into static library instead. Alternatively it
13306 is possible to use H.J. Lu's binutils with support for mixed objects.
13307
13308 @item -fuse-ld=bfd
13309 @opindex fuse-ld=bfd
13310 Use the @command{bfd} linker instead of the default linker.
13311
13312 @item -fuse-ld=gold
13313 @opindex fuse-ld=gold
13314 Use the @command{gold} linker instead of the default linker.
13315
13316 @item -fuse-ld=lld
13317 @opindex fuse-ld=lld
13318 Use the LLVM @command{lld} linker instead of the default linker.
13319
13320 @cindex Libraries
13321 @item -l@var{library}
13322 @itemx -l @var{library}
13323 @opindex l
13324 Search the library named @var{library} when linking. (The second
13325 alternative with the library as a separate argument is only for
13326 POSIX compliance and is not recommended.)
13327
13328 The @option{-l} option is passed directly to the linker by GCC. Refer
13329 to your linker documentation for exact details. The general
13330 description below applies to the GNU linker.
13331
13332 The linker searches a standard list of directories for the library.
13333 The directories searched include several standard system directories
13334 plus any that you specify with @option{-L}.
13335
13336 Static libraries are archives of object files, and have file names
13337 like @file{lib@var{library}.a}. Some targets also support shared
13338 libraries, which typically have names like @file{lib@var{library}.so}.
13339 If both static and shared libraries are found, the linker gives
13340 preference to linking with the shared library unless the
13341 @option{-static} option is used.
13342
13343 It makes a difference where in the command you write this option; the
13344 linker searches and processes libraries and object files in the order they
13345 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13346 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13347 to functions in @samp{z}, those functions may not be loaded.
13348
13349 @item -lobjc
13350 @opindex lobjc
13351 You need this special case of the @option{-l} option in order to
13352 link an Objective-C or Objective-C++ program.
13353
13354 @item -nostartfiles
13355 @opindex nostartfiles
13356 Do not use the standard system startup files when linking.
13357 The standard system libraries are used normally, unless @option{-nostdlib},
13358 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13359
13360 @item -nodefaultlibs
13361 @opindex nodefaultlibs
13362 Do not use the standard system libraries when linking.
13363 Only the libraries you specify are passed to the linker, and options
13364 specifying linkage of the system libraries, such as @option{-static-libgcc}
13365 or @option{-shared-libgcc}, are ignored.
13366 The standard startup files are used normally, unless @option{-nostartfiles}
13367 is used.
13368
13369 The compiler may generate calls to @code{memcmp},
13370 @code{memset}, @code{memcpy} and @code{memmove}.
13371 These entries are usually resolved by entries in
13372 libc. These entry points should be supplied through some other
13373 mechanism when this option is specified.
13374
13375 @item -nolibc
13376 @opindex nolibc
13377 Do not use the C library or system libraries tightly coupled with it when
13378 linking. Still link with the startup files, @file{libgcc} or toolchain
13379 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13380 or @file{libstdc++} unless options preventing their inclusion are used as
13381 well. This typically removes @option{-lc} from the link command line, as well
13382 as system libraries that normally go with it and become meaningless when
13383 absence of a C library is assumed, for example @option{-lpthread} or
13384 @option{-lm} in some configurations. This is intended for bare-board
13385 targets when there is indeed no C library available.
13386
13387 @item -nostdlib
13388 @opindex nostdlib
13389 Do not use the standard system startup files or libraries when linking.
13390 No startup files and only the libraries you specify are passed to
13391 the linker, and options specifying linkage of the system libraries, such as
13392 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13393
13394 The compiler may generate calls to @code{memcmp}, @code{memset},
13395 @code{memcpy} and @code{memmove}.
13396 These entries are usually resolved by entries in
13397 libc. These entry points should be supplied through some other
13398 mechanism when this option is specified.
13399
13400 @cindex @option{-lgcc}, use with @option{-nostdlib}
13401 @cindex @option{-nostdlib} and unresolved references
13402 @cindex unresolved references and @option{-nostdlib}
13403 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13404 @cindex @option{-nodefaultlibs} and unresolved references
13405 @cindex unresolved references and @option{-nodefaultlibs}
13406 One of the standard libraries bypassed by @option{-nostdlib} and
13407 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13408 which GCC uses to overcome shortcomings of particular machines, or special
13409 needs for some languages.
13410 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13411 Collection (GCC) Internals},
13412 for more discussion of @file{libgcc.a}.)
13413 In most cases, you need @file{libgcc.a} even when you want to avoid
13414 other standard libraries. In other words, when you specify @option{-nostdlib}
13415 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13416 This ensures that you have no unresolved references to internal GCC
13417 library subroutines.
13418 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13419 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13420 GNU Compiler Collection (GCC) Internals}.)
13421
13422 @item -e @var{entry}
13423 @itemx --entry=@var{entry}
13424 @opindex e
13425 @opindex entry
13426
13427 Specify that the program entry point is @var{entry}. The argument is
13428 interpreted by the linker; the GNU linker accepts either a symbol name
13429 or an address.
13430
13431 @item -pie
13432 @opindex pie
13433 Produce a dynamically linked position independent executable on targets
13434 that support it. For predictable results, you must also specify the same
13435 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13436 or model suboptions) when you specify this linker option.
13437
13438 @item -no-pie
13439 @opindex no-pie
13440 Don't produce a dynamically linked position independent executable.
13441
13442 @item -static-pie
13443 @opindex static-pie
13444 Produce a static position independent executable on targets that support
13445 it. A static position independent executable is similar to a static
13446 executable, but can be loaded at any address without a dynamic linker.
13447 For predictable results, you must also specify the same set of options
13448 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13449 suboptions) when you specify this linker option.
13450
13451 @item -pthread
13452 @opindex pthread
13453 Link with the POSIX threads library. This option is supported on
13454 GNU/Linux targets, most other Unix derivatives, and also on
13455 x86 Cygwin and MinGW targets. On some targets this option also sets
13456 flags for the preprocessor, so it should be used consistently for both
13457 compilation and linking.
13458
13459 @item -r
13460 @opindex r
13461 Produce a relocatable object as output. This is also known as partial
13462 linking.
13463
13464 @item -rdynamic
13465 @opindex rdynamic
13466 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13467 that support it. This instructs the linker to add all symbols, not
13468 only used ones, to the dynamic symbol table. This option is needed
13469 for some uses of @code{dlopen} or to allow obtaining backtraces
13470 from within a program.
13471
13472 @item -s
13473 @opindex s
13474 Remove all symbol table and relocation information from the executable.
13475
13476 @item -static
13477 @opindex static
13478 On systems that support dynamic linking, this overrides @option{-pie}
13479 and prevents linking with the shared libraries. On other systems, this
13480 option has no effect.
13481
13482 @item -shared
13483 @opindex shared
13484 Produce a shared object which can then be linked with other objects to
13485 form an executable. Not all systems support this option. For predictable
13486 results, you must also specify the same set of options used for compilation
13487 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13488 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13489 needs to build supplementary stub code for constructors to work. On
13490 multi-libbed systems, @samp{gcc -shared} must select the correct support
13491 libraries to link against. Failing to supply the correct flags may lead
13492 to subtle defects. Supplying them in cases where they are not necessary
13493 is innocuous.}
13494
13495 @item -shared-libgcc
13496 @itemx -static-libgcc
13497 @opindex shared-libgcc
13498 @opindex static-libgcc
13499 On systems that provide @file{libgcc} as a shared library, these options
13500 force the use of either the shared or static version, respectively.
13501 If no shared version of @file{libgcc} was built when the compiler was
13502 configured, these options have no effect.
13503
13504 There are several situations in which an application should use the
13505 shared @file{libgcc} instead of the static version. The most common
13506 of these is when the application wishes to throw and catch exceptions
13507 across different shared libraries. In that case, each of the libraries
13508 as well as the application itself should use the shared @file{libgcc}.
13509
13510 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13511 whenever you build a shared library or a main executable, because C++
13512 programs typically use exceptions, so this is the right thing to do.
13513
13514 If, instead, you use the GCC driver to create shared libraries, you may
13515 find that they are not always linked with the shared @file{libgcc}.
13516 If GCC finds, at its configuration time, that you have a non-GNU linker
13517 or a GNU linker that does not support option @option{--eh-frame-hdr},
13518 it links the shared version of @file{libgcc} into shared libraries
13519 by default. Otherwise, it takes advantage of the linker and optimizes
13520 away the linking with the shared version of @file{libgcc}, linking with
13521 the static version of libgcc by default. This allows exceptions to
13522 propagate through such shared libraries, without incurring relocation
13523 costs at library load time.
13524
13525 However, if a library or main executable is supposed to throw or catch
13526 exceptions, you must link it using the G++ driver, or using the option
13527 @option{-shared-libgcc}, such that it is linked with the shared
13528 @file{libgcc}.
13529
13530 @item -static-libasan
13531 @opindex static-libasan
13532 When the @option{-fsanitize=address} option is used to link a program,
13533 the GCC driver automatically links against @option{libasan}. If
13534 @file{libasan} is available as a shared library, and the @option{-static}
13535 option is not used, then this links against the shared version of
13536 @file{libasan}. The @option{-static-libasan} option directs the GCC
13537 driver to link @file{libasan} statically, without necessarily linking
13538 other libraries statically.
13539
13540 @item -static-libtsan
13541 @opindex static-libtsan
13542 When the @option{-fsanitize=thread} option is used to link a program,
13543 the GCC driver automatically links against @option{libtsan}. If
13544 @file{libtsan} is available as a shared library, and the @option{-static}
13545 option is not used, then this links against the shared version of
13546 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13547 driver to link @file{libtsan} statically, without necessarily linking
13548 other libraries statically.
13549
13550 @item -static-liblsan
13551 @opindex static-liblsan
13552 When the @option{-fsanitize=leak} option is used to link a program,
13553 the GCC driver automatically links against @option{liblsan}. If
13554 @file{liblsan} is available as a shared library, and the @option{-static}
13555 option is not used, then this links against the shared version of
13556 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13557 driver to link @file{liblsan} statically, without necessarily linking
13558 other libraries statically.
13559
13560 @item -static-libubsan
13561 @opindex static-libubsan
13562 When the @option{-fsanitize=undefined} option is used to link a program,
13563 the GCC driver automatically links against @option{libubsan}. If
13564 @file{libubsan} is available as a shared library, and the @option{-static}
13565 option is not used, then this links against the shared version of
13566 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13567 driver to link @file{libubsan} statically, without necessarily linking
13568 other libraries statically.
13569
13570 @item -static-libstdc++
13571 @opindex static-libstdc++
13572 When the @command{g++} program is used to link a C++ program, it
13573 normally automatically links against @option{libstdc++}. If
13574 @file{libstdc++} is available as a shared library, and the
13575 @option{-static} option is not used, then this links against the
13576 shared version of @file{libstdc++}. That is normally fine. However, it
13577 is sometimes useful to freeze the version of @file{libstdc++} used by
13578 the program without going all the way to a fully static link. The
13579 @option{-static-libstdc++} option directs the @command{g++} driver to
13580 link @file{libstdc++} statically, without necessarily linking other
13581 libraries statically.
13582
13583 @item -symbolic
13584 @opindex symbolic
13585 Bind references to global symbols when building a shared object. Warn
13586 about any unresolved references (unless overridden by the link editor
13587 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13588 this option.
13589
13590 @item -T @var{script}
13591 @opindex T
13592 @cindex linker script
13593 Use @var{script} as the linker script. This option is supported by most
13594 systems using the GNU linker. On some targets, such as bare-board
13595 targets without an operating system, the @option{-T} option may be required
13596 when linking to avoid references to undefined symbols.
13597
13598 @item -Xlinker @var{option}
13599 @opindex Xlinker
13600 Pass @var{option} as an option to the linker. You can use this to
13601 supply system-specific linker options that GCC does not recognize.
13602
13603 If you want to pass an option that takes a separate argument, you must use
13604 @option{-Xlinker} twice, once for the option and once for the argument.
13605 For example, to pass @option{-assert definitions}, you must write
13606 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13607 @option{-Xlinker "-assert definitions"}, because this passes the entire
13608 string as a single argument, which is not what the linker expects.
13609
13610 When using the GNU linker, it is usually more convenient to pass
13611 arguments to linker options using the @option{@var{option}=@var{value}}
13612 syntax than as separate arguments. For example, you can specify
13613 @option{-Xlinker -Map=output.map} rather than
13614 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13615 this syntax for command-line options.
13616
13617 @item -Wl,@var{option}
13618 @opindex Wl
13619 Pass @var{option} as an option to the linker. If @var{option} contains
13620 commas, it is split into multiple options at the commas. You can use this
13621 syntax to pass an argument to the option.
13622 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13623 linker. When using the GNU linker, you can also get the same effect with
13624 @option{-Wl,-Map=output.map}.
13625
13626 @item -u @var{symbol}
13627 @opindex u
13628 Pretend the symbol @var{symbol} is undefined, to force linking of
13629 library modules to define it. You can use @option{-u} multiple times with
13630 different symbols to force loading of additional library modules.
13631
13632 @item -z @var{keyword}
13633 @opindex z
13634 @option{-z} is passed directly on to the linker along with the keyword
13635 @var{keyword}. See the section in the documentation of your linker for
13636 permitted values and their meanings.
13637 @end table
13638
13639 @node Directory Options
13640 @section Options for Directory Search
13641 @cindex directory options
13642 @cindex options, directory search
13643 @cindex search path
13644
13645 These options specify directories to search for header files, for
13646 libraries and for parts of the compiler:
13647
13648 @table @gcctabopt
13649 @include cppdiropts.texi
13650
13651 @item -iplugindir=@var{dir}
13652 @opindex iplugindir=
13653 Set the directory to search for plugins that are passed
13654 by @option{-fplugin=@var{name}} instead of
13655 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13656 to be used by the user, but only passed by the driver.
13657
13658 @item -L@var{dir}
13659 @opindex L
13660 Add directory @var{dir} to the list of directories to be searched
13661 for @option{-l}.
13662
13663 @item -B@var{prefix}
13664 @opindex B
13665 This option specifies where to find the executables, libraries,
13666 include files, and data files of the compiler itself.
13667
13668 The compiler driver program runs one or more of the subprograms
13669 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13670 @var{prefix} as a prefix for each program it tries to run, both with and
13671 without @samp{@var{machine}/@var{version}/} for the corresponding target
13672 machine and compiler version.
13673
13674 For each subprogram to be run, the compiler driver first tries the
13675 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13676 is not specified, the driver tries two standard prefixes,
13677 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13678 those results in a file name that is found, the unmodified program
13679 name is searched for using the directories specified in your
13680 @env{PATH} environment variable.
13681
13682 The compiler checks to see if the path provided by @option{-B}
13683 refers to a directory, and if necessary it adds a directory
13684 separator character at the end of the path.
13685
13686 @option{-B} prefixes that effectively specify directory names also apply
13687 to libraries in the linker, because the compiler translates these
13688 options into @option{-L} options for the linker. They also apply to
13689 include files in the preprocessor, because the compiler translates these
13690 options into @option{-isystem} options for the preprocessor. In this case,
13691 the compiler appends @samp{include} to the prefix.
13692
13693 The runtime support file @file{libgcc.a} can also be searched for using
13694 the @option{-B} prefix, if needed. If it is not found there, the two
13695 standard prefixes above are tried, and that is all. The file is left
13696 out of the link if it is not found by those means.
13697
13698 Another way to specify a prefix much like the @option{-B} prefix is to use
13699 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13700 Variables}.
13701
13702 As a special kludge, if the path provided by @option{-B} is
13703 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13704 9, then it is replaced by @file{[dir/]include}. This is to help
13705 with boot-strapping the compiler.
13706
13707 @item -no-canonical-prefixes
13708 @opindex no-canonical-prefixes
13709 Do not expand any symbolic links, resolve references to @samp{/../}
13710 or @samp{/./}, or make the path absolute when generating a relative
13711 prefix.
13712
13713 @item --sysroot=@var{dir}
13714 @opindex sysroot
13715 Use @var{dir} as the logical root directory for headers and libraries.
13716 For example, if the compiler normally searches for headers in
13717 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13718 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13719
13720 If you use both this option and the @option{-isysroot} option, then
13721 the @option{--sysroot} option applies to libraries, but the
13722 @option{-isysroot} option applies to header files.
13723
13724 The GNU linker (beginning with version 2.16) has the necessary support
13725 for this option. If your linker does not support this option, the
13726 header file aspect of @option{--sysroot} still works, but the
13727 library aspect does not.
13728
13729 @item --no-sysroot-suffix
13730 @opindex no-sysroot-suffix
13731 For some targets, a suffix is added to the root directory specified
13732 with @option{--sysroot}, depending on the other options used, so that
13733 headers may for example be found in
13734 @file{@var{dir}/@var{suffix}/usr/include} instead of
13735 @file{@var{dir}/usr/include}. This option disables the addition of
13736 such a suffix.
13737
13738 @end table
13739
13740 @node Code Gen Options
13741 @section Options for Code Generation Conventions
13742 @cindex code generation conventions
13743 @cindex options, code generation
13744 @cindex run-time options
13745
13746 These machine-independent options control the interface conventions
13747 used in code generation.
13748
13749 Most of them have both positive and negative forms; the negative form
13750 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13751 one of the forms is listed---the one that is not the default. You
13752 can figure out the other form by either removing @samp{no-} or adding
13753 it.
13754
13755 @table @gcctabopt
13756 @item -fstack-reuse=@var{reuse-level}
13757 @opindex fstack_reuse
13758 This option controls stack space reuse for user declared local/auto variables
13759 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13760 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13761 local variables and temporaries, @samp{named_vars} enables the reuse only for
13762 user defined local variables with names, and @samp{none} disables stack reuse
13763 completely. The default value is @samp{all}. The option is needed when the
13764 program extends the lifetime of a scoped local variable or a compiler generated
13765 temporary beyond the end point defined by the language. When a lifetime of
13766 a variable ends, and if the variable lives in memory, the optimizing compiler
13767 has the freedom to reuse its stack space with other temporaries or scoped
13768 local variables whose live range does not overlap with it. Legacy code extending
13769 local lifetime is likely to break with the stack reuse optimization.
13770
13771 For example,
13772
13773 @smallexample
13774 int *p;
13775 @{
13776 int local1;
13777
13778 p = &local1;
13779 local1 = 10;
13780 ....
13781 @}
13782 @{
13783 int local2;
13784 local2 = 20;
13785 ...
13786 @}
13787
13788 if (*p == 10) // out of scope use of local1
13789 @{
13790
13791 @}
13792 @end smallexample
13793
13794 Another example:
13795 @smallexample
13796
13797 struct A
13798 @{
13799 A(int k) : i(k), j(k) @{ @}
13800 int i;
13801 int j;
13802 @};
13803
13804 A *ap;
13805
13806 void foo(const A& ar)
13807 @{
13808 ap = &ar;
13809 @}
13810
13811 void bar()
13812 @{
13813 foo(A(10)); // temp object's lifetime ends when foo returns
13814
13815 @{
13816 A a(20);
13817 ....
13818 @}
13819 ap->i+= 10; // ap references out of scope temp whose space
13820 // is reused with a. What is the value of ap->i?
13821 @}
13822
13823 @end smallexample
13824
13825 The lifetime of a compiler generated temporary is well defined by the C++
13826 standard. When a lifetime of a temporary ends, and if the temporary lives
13827 in memory, the optimizing compiler has the freedom to reuse its stack
13828 space with other temporaries or scoped local variables whose live range
13829 does not overlap with it. However some of the legacy code relies on
13830 the behavior of older compilers in which temporaries' stack space is
13831 not reused, the aggressive stack reuse can lead to runtime errors. This
13832 option is used to control the temporary stack reuse optimization.
13833
13834 @item -ftrapv
13835 @opindex ftrapv
13836 This option generates traps for signed overflow on addition, subtraction,
13837 multiplication operations.
13838 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13839 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13840 @option{-fwrapv} being effective. Note that only active options override, so
13841 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13842 results in @option{-ftrapv} being effective.
13843
13844 @item -fwrapv
13845 @opindex fwrapv
13846 This option instructs the compiler to assume that signed arithmetic
13847 overflow of addition, subtraction and multiplication wraps around
13848 using twos-complement representation. This flag enables some optimizations
13849 and disables others.
13850 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13851 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13852 @option{-fwrapv} being effective. Note that only active options override, so
13853 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13854 results in @option{-ftrapv} being effective.
13855
13856 @item -fwrapv-pointer
13857 @opindex fwrapv-pointer
13858 This option instructs the compiler to assume that pointer arithmetic
13859 overflow on addition and subtraction wraps around using twos-complement
13860 representation. This flag disables some optimizations which assume
13861 pointer overflow is invalid.
13862
13863 @item -fstrict-overflow
13864 @opindex fstrict-overflow
13865 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13866 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13867
13868 @item -fexceptions
13869 @opindex fexceptions
13870 Enable exception handling. Generates extra code needed to propagate
13871 exceptions. For some targets, this implies GCC generates frame
13872 unwind information for all functions, which can produce significant data
13873 size overhead, although it does not affect execution. If you do not
13874 specify this option, GCC enables it by default for languages like
13875 C++ that normally require exception handling, and disables it for
13876 languages like C that do not normally require it. However, you may need
13877 to enable this option when compiling C code that needs to interoperate
13878 properly with exception handlers written in C++. You may also wish to
13879 disable this option if you are compiling older C++ programs that don't
13880 use exception handling.
13881
13882 @item -fnon-call-exceptions
13883 @opindex fnon-call-exceptions
13884 Generate code that allows trapping instructions to throw exceptions.
13885 Note that this requires platform-specific runtime support that does
13886 not exist everywhere. Moreover, it only allows @emph{trapping}
13887 instructions to throw exceptions, i.e.@: memory references or floating-point
13888 instructions. It does not allow exceptions to be thrown from
13889 arbitrary signal handlers such as @code{SIGALRM}.
13890
13891 @item -fdelete-dead-exceptions
13892 @opindex fdelete-dead-exceptions
13893 Consider that instructions that may throw exceptions but don't otherwise
13894 contribute to the execution of the program can be optimized away.
13895 This option is enabled by default for the Ada front end, as permitted by
13896 the Ada language specification.
13897 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13898
13899 @item -funwind-tables
13900 @opindex funwind-tables
13901 Similar to @option{-fexceptions}, except that it just generates any needed
13902 static data, but does not affect the generated code in any other way.
13903 You normally do not need to enable this option; instead, a language processor
13904 that needs this handling enables it on your behalf.
13905
13906 @item -fasynchronous-unwind-tables
13907 @opindex fasynchronous-unwind-tables
13908 Generate unwind table in DWARF format, if supported by target machine. The
13909 table is exact at each instruction boundary, so it can be used for stack
13910 unwinding from asynchronous events (such as debugger or garbage collector).
13911
13912 @item -fno-gnu-unique
13913 @opindex fno-gnu-unique
13914 @opindex fgnu-unique
13915 On systems with recent GNU assembler and C library, the C++ compiler
13916 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13917 of template static data members and static local variables in inline
13918 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13919 is necessary to avoid problems with a library used by two different
13920 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13921 therefore disagreeing with the other one about the binding of the
13922 symbol. But this causes @code{dlclose} to be ignored for affected
13923 DSOs; if your program relies on reinitialization of a DSO via
13924 @code{dlclose} and @code{dlopen}, you can use
13925 @option{-fno-gnu-unique}.
13926
13927 @item -fpcc-struct-return
13928 @opindex fpcc-struct-return
13929 Return ``short'' @code{struct} and @code{union} values in memory like
13930 longer ones, rather than in registers. This convention is less
13931 efficient, but it has the advantage of allowing intercallability between
13932 GCC-compiled files and files compiled with other compilers, particularly
13933 the Portable C Compiler (pcc).
13934
13935 The precise convention for returning structures in memory depends
13936 on the target configuration macros.
13937
13938 Short structures and unions are those whose size and alignment match
13939 that of some integer type.
13940
13941 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13942 switch is not binary compatible with code compiled with the
13943 @option{-freg-struct-return} switch.
13944 Use it to conform to a non-default application binary interface.
13945
13946 @item -freg-struct-return
13947 @opindex freg-struct-return
13948 Return @code{struct} and @code{union} values in registers when possible.
13949 This is more efficient for small structures than
13950 @option{-fpcc-struct-return}.
13951
13952 If you specify neither @option{-fpcc-struct-return} nor
13953 @option{-freg-struct-return}, GCC defaults to whichever convention is
13954 standard for the target. If there is no standard convention, GCC
13955 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13956 the principal compiler. In those cases, we can choose the standard, and
13957 we chose the more efficient register return alternative.
13958
13959 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13960 switch is not binary compatible with code compiled with the
13961 @option{-fpcc-struct-return} switch.
13962 Use it to conform to a non-default application binary interface.
13963
13964 @item -fshort-enums
13965 @opindex fshort-enums
13966 Allocate to an @code{enum} type only as many bytes as it needs for the
13967 declared range of possible values. Specifically, the @code{enum} type
13968 is equivalent to the smallest integer type that has enough room.
13969
13970 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13971 code that is not binary compatible with code generated without that switch.
13972 Use it to conform to a non-default application binary interface.
13973
13974 @item -fshort-wchar
13975 @opindex fshort-wchar
13976 Override the underlying type for @code{wchar_t} to be @code{short
13977 unsigned int} instead of the default for the target. This option is
13978 useful for building programs to run under WINE@.
13979
13980 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13981 code that is not binary compatible with code generated without that switch.
13982 Use it to conform to a non-default application binary interface.
13983
13984 @item -fno-common
13985 @opindex fno-common
13986 @opindex fcommon
13987 @cindex tentative definitions
13988 In C code, this option controls the placement of global variables
13989 defined without an initializer, known as @dfn{tentative definitions}
13990 in the C standard. Tentative definitions are distinct from declarations
13991 of a variable with the @code{extern} keyword, which do not allocate storage.
13992
13993 Unix C compilers have traditionally allocated storage for
13994 uninitialized global variables in a common block. This allows the
13995 linker to resolve all tentative definitions of the same variable
13996 in different compilation units to the same object, or to a non-tentative
13997 definition.
13998 This is the behavior specified by @option{-fcommon}, and is the default for
13999 GCC on most targets.
14000 On the other hand, this behavior is not required by ISO
14001 C, and on some targets may carry a speed or code size penalty on
14002 variable references.
14003
14004 The @option{-fno-common} option specifies that the compiler should instead
14005 place uninitialized global variables in the BSS section of the object file.
14006 This inhibits the merging of tentative definitions by the linker so
14007 you get a multiple-definition error if the same
14008 variable is defined in more than one compilation unit.
14009 Compiling with @option{-fno-common} is useful on targets for which
14010 it provides better performance, or if you wish to verify that the
14011 program will work on other systems that always treat uninitialized
14012 variable definitions this way.
14013
14014 @item -fno-ident
14015 @opindex fno-ident
14016 @opindex fident
14017 Ignore the @code{#ident} directive.
14018
14019 @item -finhibit-size-directive
14020 @opindex finhibit-size-directive
14021 Don't output a @code{.size} assembler directive, or anything else that
14022 would cause trouble if the function is split in the middle, and the
14023 two halves are placed at locations far apart in memory. This option is
14024 used when compiling @file{crtstuff.c}; you should not need to use it
14025 for anything else.
14026
14027 @item -fverbose-asm
14028 @opindex fverbose-asm
14029 Put extra commentary information in the generated assembly code to
14030 make it more readable. This option is generally only of use to those
14031 who actually need to read the generated assembly code (perhaps while
14032 debugging the compiler itself).
14033
14034 @option{-fno-verbose-asm}, the default, causes the
14035 extra information to be omitted and is useful when comparing two assembler
14036 files.
14037
14038 The added comments include:
14039
14040 @itemize @bullet
14041
14042 @item
14043 information on the compiler version and command-line options,
14044
14045 @item
14046 the source code lines associated with the assembly instructions,
14047 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14048
14049 @item
14050 hints on which high-level expressions correspond to
14051 the various assembly instruction operands.
14052
14053 @end itemize
14054
14055 For example, given this C source file:
14056
14057 @smallexample
14058 int test (int n)
14059 @{
14060 int i;
14061 int total = 0;
14062
14063 for (i = 0; i < n; i++)
14064 total += i * i;
14065
14066 return total;
14067 @}
14068 @end smallexample
14069
14070 compiling to (x86_64) assembly via @option{-S} and emitting the result
14071 direct to stdout via @option{-o} @option{-}
14072
14073 @smallexample
14074 gcc -S test.c -fverbose-asm -Os -o -
14075 @end smallexample
14076
14077 gives output similar to this:
14078
14079 @smallexample
14080 .file "test.c"
14081 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14082 [...snip...]
14083 # options passed:
14084 [...snip...]
14085
14086 .text
14087 .globl test
14088 .type test, @@function
14089 test:
14090 .LFB0:
14091 .cfi_startproc
14092 # test.c:4: int total = 0;
14093 xorl %eax, %eax # <retval>
14094 # test.c:6: for (i = 0; i < n; i++)
14095 xorl %edx, %edx # i
14096 .L2:
14097 # test.c:6: for (i = 0; i < n; i++)
14098 cmpl %edi, %edx # n, i
14099 jge .L5 #,
14100 # test.c:7: total += i * i;
14101 movl %edx, %ecx # i, tmp92
14102 imull %edx, %ecx # i, tmp92
14103 # test.c:6: for (i = 0; i < n; i++)
14104 incl %edx # i
14105 # test.c:7: total += i * i;
14106 addl %ecx, %eax # tmp92, <retval>
14107 jmp .L2 #
14108 .L5:
14109 # test.c:10: @}
14110 ret
14111 .cfi_endproc
14112 .LFE0:
14113 .size test, .-test
14114 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14115 .section .note.GNU-stack,"",@@progbits
14116 @end smallexample
14117
14118 The comments are intended for humans rather than machines and hence the
14119 precise format of the comments is subject to change.
14120
14121 @item -frecord-gcc-switches
14122 @opindex frecord-gcc-switches
14123 This switch causes the command line used to invoke the
14124 compiler to be recorded into the object file that is being created.
14125 This switch is only implemented on some targets and the exact format
14126 of the recording is target and binary file format dependent, but it
14127 usually takes the form of a section containing ASCII text. This
14128 switch is related to the @option{-fverbose-asm} switch, but that
14129 switch only records information in the assembler output file as
14130 comments, so it never reaches the object file.
14131 See also @option{-grecord-gcc-switches} for another
14132 way of storing compiler options into the object file.
14133
14134 @item -fpic
14135 @opindex fpic
14136 @cindex global offset table
14137 @cindex PIC
14138 Generate position-independent code (PIC) suitable for use in a shared
14139 library, if supported for the target machine. Such code accesses all
14140 constant addresses through a global offset table (GOT)@. The dynamic
14141 loader resolves the GOT entries when the program starts (the dynamic
14142 loader is not part of GCC; it is part of the operating system). If
14143 the GOT size for the linked executable exceeds a machine-specific
14144 maximum size, you get an error message from the linker indicating that
14145 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14146 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14147 on the m68k and RS/6000. The x86 has no such limit.)
14148
14149 Position-independent code requires special support, and therefore works
14150 only on certain machines. For the x86, GCC supports PIC for System V
14151 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14152 position-independent.
14153
14154 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14155 are defined to 1.
14156
14157 @item -fPIC
14158 @opindex fPIC
14159 If supported for the target machine, emit position-independent code,
14160 suitable for dynamic linking and avoiding any limit on the size of the
14161 global offset table. This option makes a difference on AArch64, m68k,
14162 PowerPC and SPARC@.
14163
14164 Position-independent code requires special support, and therefore works
14165 only on certain machines.
14166
14167 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14168 are defined to 2.
14169
14170 @item -fpie
14171 @itemx -fPIE
14172 @opindex fpie
14173 @opindex fPIE
14174 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14175 generated position-independent code can be only linked into executables.
14176 Usually these options are used to compile code that will be linked using
14177 the @option{-pie} GCC option.
14178
14179 @option{-fpie} and @option{-fPIE} both define the macros
14180 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14181 for @option{-fpie} and 2 for @option{-fPIE}.
14182
14183 @item -fno-plt
14184 @opindex fno-plt
14185 @opindex fplt
14186 Do not use the PLT for external function calls in position-independent code.
14187 Instead, load the callee address at call sites from the GOT and branch to it.
14188 This leads to more efficient code by eliminating PLT stubs and exposing
14189 GOT loads to optimizations. On architectures such as 32-bit x86 where
14190 PLT stubs expect the GOT pointer in a specific register, this gives more
14191 register allocation freedom to the compiler.
14192 Lazy binding requires use of the PLT;
14193 with @option{-fno-plt} all external symbols are resolved at load time.
14194
14195 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14196 through the PLT for specific external functions.
14197
14198 In position-dependent code, a few targets also convert calls to
14199 functions that are marked to not use the PLT to use the GOT instead.
14200
14201 @item -fno-jump-tables
14202 @opindex fno-jump-tables
14203 @opindex fjump-tables
14204 Do not use jump tables for switch statements even where it would be
14205 more efficient than other code generation strategies. This option is
14206 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14207 building code that forms part of a dynamic linker and cannot
14208 reference the address of a jump table. On some targets, jump tables
14209 do not require a GOT and this option is not needed.
14210
14211 @item -ffixed-@var{reg}
14212 @opindex ffixed
14213 Treat the register named @var{reg} as a fixed register; generated code
14214 should never refer to it (except perhaps as a stack pointer, frame
14215 pointer or in some other fixed role).
14216
14217 @var{reg} must be the name of a register. The register names accepted
14218 are machine-specific and are defined in the @code{REGISTER_NAMES}
14219 macro in the machine description macro file.
14220
14221 This flag does not have a negative form, because it specifies a
14222 three-way choice.
14223
14224 @item -fcall-used-@var{reg}
14225 @opindex fcall-used
14226 Treat the register named @var{reg} as an allocable register that is
14227 clobbered by function calls. It may be allocated for temporaries or
14228 variables that do not live across a call. Functions compiled this way
14229 do not save and restore the register @var{reg}.
14230
14231 It is an error to use this flag with the frame pointer or stack pointer.
14232 Use of this flag for other registers that have fixed pervasive roles in
14233 the machine's execution model produces disastrous results.
14234
14235 This flag does not have a negative form, because it specifies a
14236 three-way choice.
14237
14238 @item -fcall-saved-@var{reg}
14239 @opindex fcall-saved
14240 Treat the register named @var{reg} as an allocable register saved by
14241 functions. It may be allocated even for temporaries or variables that
14242 live across a call. Functions compiled this way save and restore
14243 the register @var{reg} if they use it.
14244
14245 It is an error to use this flag with the frame pointer or stack pointer.
14246 Use of this flag for other registers that have fixed pervasive roles in
14247 the machine's execution model produces disastrous results.
14248
14249 A different sort of disaster results from the use of this flag for
14250 a register in which function values may be returned.
14251
14252 This flag does not have a negative form, because it specifies a
14253 three-way choice.
14254
14255 @item -fpack-struct[=@var{n}]
14256 @opindex fpack-struct
14257 Without a value specified, pack all structure members together without
14258 holes. When a value is specified (which must be a small power of two), pack
14259 structure members according to this value, representing the maximum
14260 alignment (that is, objects with default alignment requirements larger than
14261 this are output potentially unaligned at the next fitting location.
14262
14263 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14264 code that is not binary compatible with code generated without that switch.
14265 Additionally, it makes the code suboptimal.
14266 Use it to conform to a non-default application binary interface.
14267
14268 @item -fleading-underscore
14269 @opindex fleading-underscore
14270 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14271 change the way C symbols are represented in the object file. One use
14272 is to help link with legacy assembly code.
14273
14274 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14275 generate code that is not binary compatible with code generated without that
14276 switch. Use it to conform to a non-default application binary interface.
14277 Not all targets provide complete support for this switch.
14278
14279 @item -ftls-model=@var{model}
14280 @opindex ftls-model
14281 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14282 The @var{model} argument should be one of @samp{global-dynamic},
14283 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14284 Note that the choice is subject to optimization: the compiler may use
14285 a more efficient model for symbols not visible outside of the translation
14286 unit, or if @option{-fpic} is not given on the command line.
14287
14288 The default without @option{-fpic} is @samp{initial-exec}; with
14289 @option{-fpic} the default is @samp{global-dynamic}.
14290
14291 @item -ftrampolines
14292 @opindex ftrampolines
14293 For targets that normally need trampolines for nested functions, always
14294 generate them instead of using descriptors. Otherwise, for targets that
14295 do not need them, like for example HP-PA or IA-64, do nothing.
14296
14297 A trampoline is a small piece of code that is created at run time on the
14298 stack when the address of a nested function is taken, and is used to call
14299 the nested function indirectly. Therefore, it requires the stack to be
14300 made executable in order for the program to work properly.
14301
14302 @option{-fno-trampolines} is enabled by default on a language by language
14303 basis to let the compiler avoid generating them, if it computes that this
14304 is safe, and replace them with descriptors. Descriptors are made up of data
14305 only, but the generated code must be prepared to deal with them. As of this
14306 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14307
14308 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14309 @option{-fno-trampolines} are not binary compatible if nested functions are
14310 present. This option must therefore be used on a program-wide basis and be
14311 manipulated with extreme care.
14312
14313 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14314 @opindex fvisibility
14315 Set the default ELF image symbol visibility to the specified option---all
14316 symbols are marked with this unless overridden within the code.
14317 Using this feature can very substantially improve linking and
14318 load times of shared object libraries, produce more optimized
14319 code, provide near-perfect API export and prevent symbol clashes.
14320 It is @strong{strongly} recommended that you use this in any shared objects
14321 you distribute.
14322
14323 Despite the nomenclature, @samp{default} always means public; i.e.,
14324 available to be linked against from outside the shared object.
14325 @samp{protected} and @samp{internal} are pretty useless in real-world
14326 usage so the only other commonly used option is @samp{hidden}.
14327 The default if @option{-fvisibility} isn't specified is
14328 @samp{default}, i.e., make every symbol public.
14329
14330 A good explanation of the benefits offered by ensuring ELF
14331 symbols have the correct visibility is given by ``How To Write
14332 Shared Libraries'' by Ulrich Drepper (which can be found at
14333 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14334 solution made possible by this option to marking things hidden when
14335 the default is public is to make the default hidden and mark things
14336 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14337 and @code{__attribute__ ((visibility("default")))} instead of
14338 @code{__declspec(dllexport)} you get almost identical semantics with
14339 identical syntax. This is a great boon to those working with
14340 cross-platform projects.
14341
14342 For those adding visibility support to existing code, you may find
14343 @code{#pragma GCC visibility} of use. This works by you enclosing
14344 the declarations you wish to set visibility for with (for example)
14345 @code{#pragma GCC visibility push(hidden)} and
14346 @code{#pragma GCC visibility pop}.
14347 Bear in mind that symbol visibility should be viewed @strong{as
14348 part of the API interface contract} and thus all new code should
14349 always specify visibility when it is not the default; i.e., declarations
14350 only for use within the local DSO should @strong{always} be marked explicitly
14351 as hidden as so to avoid PLT indirection overheads---making this
14352 abundantly clear also aids readability and self-documentation of the code.
14353 Note that due to ISO C++ specification requirements, @code{operator new} and
14354 @code{operator delete} must always be of default visibility.
14355
14356 Be aware that headers from outside your project, in particular system
14357 headers and headers from any other library you use, may not be
14358 expecting to be compiled with visibility other than the default. You
14359 may need to explicitly say @code{#pragma GCC visibility push(default)}
14360 before including any such headers.
14361
14362 @code{extern} declarations are not affected by @option{-fvisibility}, so
14363 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14364 no modifications. However, this means that calls to @code{extern}
14365 functions with no explicit visibility use the PLT, so it is more
14366 effective to use @code{__attribute ((visibility))} and/or
14367 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14368 declarations should be treated as hidden.
14369
14370 Note that @option{-fvisibility} does affect C++ vague linkage
14371 entities. This means that, for instance, an exception class that is
14372 be thrown between DSOs must be explicitly marked with default
14373 visibility so that the @samp{type_info} nodes are unified between
14374 the DSOs.
14375
14376 An overview of these techniques, their benefits and how to use them
14377 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14378
14379 @item -fstrict-volatile-bitfields
14380 @opindex fstrict-volatile-bitfields
14381 This option should be used if accesses to volatile bit-fields (or other
14382 structure fields, although the compiler usually honors those types
14383 anyway) should use a single access of the width of the
14384 field's type, aligned to a natural alignment if possible. For
14385 example, targets with memory-mapped peripheral registers might require
14386 all such accesses to be 16 bits wide; with this flag you can
14387 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14388 is 16 bits on these targets) to force GCC to use 16-bit accesses
14389 instead of, perhaps, a more efficient 32-bit access.
14390
14391 If this option is disabled, the compiler uses the most efficient
14392 instruction. In the previous example, that might be a 32-bit load
14393 instruction, even though that accesses bytes that do not contain
14394 any portion of the bit-field, or memory-mapped registers unrelated to
14395 the one being updated.
14396
14397 In some cases, such as when the @code{packed} attribute is applied to a
14398 structure field, it may not be possible to access the field with a single
14399 read or write that is correctly aligned for the target machine. In this
14400 case GCC falls back to generating multiple accesses rather than code that
14401 will fault or truncate the result at run time.
14402
14403 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14404 not allowed to touch non bit-field members. It is therefore recommended
14405 to define all bits of the field's type as bit-field members.
14406
14407 The default value of this option is determined by the application binary
14408 interface for the target processor.
14409
14410 @item -fsync-libcalls
14411 @opindex fsync-libcalls
14412 This option controls whether any out-of-line instance of the @code{__sync}
14413 family of functions may be used to implement the C++11 @code{__atomic}
14414 family of functions.
14415
14416 The default value of this option is enabled, thus the only useful form
14417 of the option is @option{-fno-sync-libcalls}. This option is used in
14418 the implementation of the @file{libatomic} runtime library.
14419
14420 @end table
14421
14422 @node Developer Options
14423 @section GCC Developer Options
14424 @cindex developer options
14425 @cindex debugging GCC
14426 @cindex debug dump options
14427 @cindex dump options
14428 @cindex compilation statistics
14429
14430 This section describes command-line options that are primarily of
14431 interest to GCC developers, including options to support compiler
14432 testing and investigation of compiler bugs and compile-time
14433 performance problems. This includes options that produce debug dumps
14434 at various points in the compilation; that print statistics such as
14435 memory use and execution time; and that print information about GCC's
14436 configuration, such as where it searches for libraries. You should
14437 rarely need to use any of these options for ordinary compilation and
14438 linking tasks.
14439
14440 Many developer options that cause GCC to dump output to a file take an
14441 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14442 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14443 error.
14444
14445 If @samp{=@var{filename}} is omitted, a default dump file name is
14446 constructed by concatenating the base dump file name, a pass number,
14447 phase letter, and pass name. The base dump file name is the name of
14448 output file produced by the compiler if explicitly specified and not
14449 an executable; otherwise it is the source file name.
14450 The pass number is determined by the order passes are registered with
14451 the compiler's pass manager.
14452 This is generally the same as the order of execution, but passes
14453 registered by plugins, target-specific passes, or passes that are
14454 otherwise registered late are numbered higher than the pass named
14455 @samp{final}, even if they are executed earlier. The phase letter is
14456 one of @samp{i} (inter-procedural analysis), @samp{l}
14457 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14458 The files are created in the directory of the output file.
14459
14460 @table @gcctabopt
14461
14462 @item -d@var{letters}
14463 @itemx -fdump-rtl-@var{pass}
14464 @itemx -fdump-rtl-@var{pass}=@var{filename}
14465 @opindex d
14466 @opindex fdump-rtl-@var{pass}
14467 Says to make debugging dumps during compilation at times specified by
14468 @var{letters}. This is used for debugging the RTL-based passes of the
14469 compiler.
14470
14471 Some @option{-d@var{letters}} switches have different meaning when
14472 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14473 for information about preprocessor-specific dump options.
14474
14475 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14476 @option{-d} option @var{letters}. Here are the possible
14477 letters for use in @var{pass} and @var{letters}, and their meanings:
14478
14479 @table @gcctabopt
14480
14481 @item -fdump-rtl-alignments
14482 @opindex fdump-rtl-alignments
14483 Dump after branch alignments have been computed.
14484
14485 @item -fdump-rtl-asmcons
14486 @opindex fdump-rtl-asmcons
14487 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14488
14489 @item -fdump-rtl-auto_inc_dec
14490 @opindex fdump-rtl-auto_inc_dec
14491 Dump after auto-inc-dec discovery. This pass is only run on
14492 architectures that have auto inc or auto dec instructions.
14493
14494 @item -fdump-rtl-barriers
14495 @opindex fdump-rtl-barriers
14496 Dump after cleaning up the barrier instructions.
14497
14498 @item -fdump-rtl-bbpart
14499 @opindex fdump-rtl-bbpart
14500 Dump after partitioning hot and cold basic blocks.
14501
14502 @item -fdump-rtl-bbro
14503 @opindex fdump-rtl-bbro
14504 Dump after block reordering.
14505
14506 @item -fdump-rtl-btl1
14507 @itemx -fdump-rtl-btl2
14508 @opindex fdump-rtl-btl2
14509 @opindex fdump-rtl-btl2
14510 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14511 after the two branch
14512 target load optimization passes.
14513
14514 @item -fdump-rtl-bypass
14515 @opindex fdump-rtl-bypass
14516 Dump after jump bypassing and control flow optimizations.
14517
14518 @item -fdump-rtl-combine
14519 @opindex fdump-rtl-combine
14520 Dump after the RTL instruction combination pass.
14521
14522 @item -fdump-rtl-compgotos
14523 @opindex fdump-rtl-compgotos
14524 Dump after duplicating the computed gotos.
14525
14526 @item -fdump-rtl-ce1
14527 @itemx -fdump-rtl-ce2
14528 @itemx -fdump-rtl-ce3
14529 @opindex fdump-rtl-ce1
14530 @opindex fdump-rtl-ce2
14531 @opindex fdump-rtl-ce3
14532 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14533 @option{-fdump-rtl-ce3} enable dumping after the three
14534 if conversion passes.
14535
14536 @item -fdump-rtl-cprop_hardreg
14537 @opindex fdump-rtl-cprop_hardreg
14538 Dump after hard register copy propagation.
14539
14540 @item -fdump-rtl-csa
14541 @opindex fdump-rtl-csa
14542 Dump after combining stack adjustments.
14543
14544 @item -fdump-rtl-cse1
14545 @itemx -fdump-rtl-cse2
14546 @opindex fdump-rtl-cse1
14547 @opindex fdump-rtl-cse2
14548 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14549 the two common subexpression elimination passes.
14550
14551 @item -fdump-rtl-dce
14552 @opindex fdump-rtl-dce
14553 Dump after the standalone dead code elimination passes.
14554
14555 @item -fdump-rtl-dbr
14556 @opindex fdump-rtl-dbr
14557 Dump after delayed branch scheduling.
14558
14559 @item -fdump-rtl-dce1
14560 @itemx -fdump-rtl-dce2
14561 @opindex fdump-rtl-dce1
14562 @opindex fdump-rtl-dce2
14563 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14564 the two dead store elimination passes.
14565
14566 @item -fdump-rtl-eh
14567 @opindex fdump-rtl-eh
14568 Dump after finalization of EH handling code.
14569
14570 @item -fdump-rtl-eh_ranges
14571 @opindex fdump-rtl-eh_ranges
14572 Dump after conversion of EH handling range regions.
14573
14574 @item -fdump-rtl-expand
14575 @opindex fdump-rtl-expand
14576 Dump after RTL generation.
14577
14578 @item -fdump-rtl-fwprop1
14579 @itemx -fdump-rtl-fwprop2
14580 @opindex fdump-rtl-fwprop1
14581 @opindex fdump-rtl-fwprop2
14582 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14583 dumping after the two forward propagation passes.
14584
14585 @item -fdump-rtl-gcse1
14586 @itemx -fdump-rtl-gcse2
14587 @opindex fdump-rtl-gcse1
14588 @opindex fdump-rtl-gcse2
14589 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14590 after global common subexpression elimination.
14591
14592 @item -fdump-rtl-init-regs
14593 @opindex fdump-rtl-init-regs
14594 Dump after the initialization of the registers.
14595
14596 @item -fdump-rtl-initvals
14597 @opindex fdump-rtl-initvals
14598 Dump after the computation of the initial value sets.
14599
14600 @item -fdump-rtl-into_cfglayout
14601 @opindex fdump-rtl-into_cfglayout
14602 Dump after converting to cfglayout mode.
14603
14604 @item -fdump-rtl-ira
14605 @opindex fdump-rtl-ira
14606 Dump after iterated register allocation.
14607
14608 @item -fdump-rtl-jump
14609 @opindex fdump-rtl-jump
14610 Dump after the second jump optimization.
14611
14612 @item -fdump-rtl-loop2
14613 @opindex fdump-rtl-loop2
14614 @option{-fdump-rtl-loop2} enables dumping after the rtl
14615 loop optimization passes.
14616
14617 @item -fdump-rtl-mach
14618 @opindex fdump-rtl-mach
14619 Dump after performing the machine dependent reorganization pass, if that
14620 pass exists.
14621
14622 @item -fdump-rtl-mode_sw
14623 @opindex fdump-rtl-mode_sw
14624 Dump after removing redundant mode switches.
14625
14626 @item -fdump-rtl-rnreg
14627 @opindex fdump-rtl-rnreg
14628 Dump after register renumbering.
14629
14630 @item -fdump-rtl-outof_cfglayout
14631 @opindex fdump-rtl-outof_cfglayout
14632 Dump after converting from cfglayout mode.
14633
14634 @item -fdump-rtl-peephole2
14635 @opindex fdump-rtl-peephole2
14636 Dump after the peephole pass.
14637
14638 @item -fdump-rtl-postreload
14639 @opindex fdump-rtl-postreload
14640 Dump after post-reload optimizations.
14641
14642 @item -fdump-rtl-pro_and_epilogue
14643 @opindex fdump-rtl-pro_and_epilogue
14644 Dump after generating the function prologues and epilogues.
14645
14646 @item -fdump-rtl-sched1
14647 @itemx -fdump-rtl-sched2
14648 @opindex fdump-rtl-sched1
14649 @opindex fdump-rtl-sched2
14650 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14651 after the basic block scheduling passes.
14652
14653 @item -fdump-rtl-ree
14654 @opindex fdump-rtl-ree
14655 Dump after sign/zero extension elimination.
14656
14657 @item -fdump-rtl-seqabstr
14658 @opindex fdump-rtl-seqabstr
14659 Dump after common sequence discovery.
14660
14661 @item -fdump-rtl-shorten
14662 @opindex fdump-rtl-shorten
14663 Dump after shortening branches.
14664
14665 @item -fdump-rtl-sibling
14666 @opindex fdump-rtl-sibling
14667 Dump after sibling call optimizations.
14668
14669 @item -fdump-rtl-split1
14670 @itemx -fdump-rtl-split2
14671 @itemx -fdump-rtl-split3
14672 @itemx -fdump-rtl-split4
14673 @itemx -fdump-rtl-split5
14674 @opindex fdump-rtl-split1
14675 @opindex fdump-rtl-split2
14676 @opindex fdump-rtl-split3
14677 @opindex fdump-rtl-split4
14678 @opindex fdump-rtl-split5
14679 These options enable dumping after five rounds of
14680 instruction splitting.
14681
14682 @item -fdump-rtl-sms
14683 @opindex fdump-rtl-sms
14684 Dump after modulo scheduling. This pass is only run on some
14685 architectures.
14686
14687 @item -fdump-rtl-stack
14688 @opindex fdump-rtl-stack
14689 Dump after conversion from GCC's ``flat register file'' registers to the
14690 x87's stack-like registers. This pass is only run on x86 variants.
14691
14692 @item -fdump-rtl-subreg1
14693 @itemx -fdump-rtl-subreg2
14694 @opindex fdump-rtl-subreg1
14695 @opindex fdump-rtl-subreg2
14696 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14697 the two subreg expansion passes.
14698
14699 @item -fdump-rtl-unshare
14700 @opindex fdump-rtl-unshare
14701 Dump after all rtl has been unshared.
14702
14703 @item -fdump-rtl-vartrack
14704 @opindex fdump-rtl-vartrack
14705 Dump after variable tracking.
14706
14707 @item -fdump-rtl-vregs
14708 @opindex fdump-rtl-vregs
14709 Dump after converting virtual registers to hard registers.
14710
14711 @item -fdump-rtl-web
14712 @opindex fdump-rtl-web
14713 Dump after live range splitting.
14714
14715 @item -fdump-rtl-regclass
14716 @itemx -fdump-rtl-subregs_of_mode_init
14717 @itemx -fdump-rtl-subregs_of_mode_finish
14718 @itemx -fdump-rtl-dfinit
14719 @itemx -fdump-rtl-dfinish
14720 @opindex fdump-rtl-regclass
14721 @opindex fdump-rtl-subregs_of_mode_init
14722 @opindex fdump-rtl-subregs_of_mode_finish
14723 @opindex fdump-rtl-dfinit
14724 @opindex fdump-rtl-dfinish
14725 These dumps are defined but always produce empty files.
14726
14727 @item -da
14728 @itemx -fdump-rtl-all
14729 @opindex da
14730 @opindex fdump-rtl-all
14731 Produce all the dumps listed above.
14732
14733 @item -dA
14734 @opindex dA
14735 Annotate the assembler output with miscellaneous debugging information.
14736
14737 @item -dD
14738 @opindex dD
14739 Dump all macro definitions, at the end of preprocessing, in addition to
14740 normal output.
14741
14742 @item -dH
14743 @opindex dH
14744 Produce a core dump whenever an error occurs.
14745
14746 @item -dp
14747 @opindex dp
14748 Annotate the assembler output with a comment indicating which
14749 pattern and alternative is used. The length and cost of each instruction are
14750 also printed.
14751
14752 @item -dP
14753 @opindex dP
14754 Dump the RTL in the assembler output as a comment before each instruction.
14755 Also turns on @option{-dp} annotation.
14756
14757 @item -dx
14758 @opindex dx
14759 Just generate RTL for a function instead of compiling it. Usually used
14760 with @option{-fdump-rtl-expand}.
14761 @end table
14762
14763 @item -fdump-debug
14764 @opindex fdump-debug
14765 Dump debugging information generated during the debug
14766 generation phase.
14767
14768 @item -fdump-earlydebug
14769 @opindex fdump-earlydebug
14770 Dump debugging information generated during the early debug
14771 generation phase.
14772
14773 @item -fdump-noaddr
14774 @opindex fdump-noaddr
14775 When doing debugging dumps, suppress address output. This makes it more
14776 feasible to use diff on debugging dumps for compiler invocations with
14777 different compiler binaries and/or different
14778 text / bss / data / heap / stack / dso start locations.
14779
14780 @item -freport-bug
14781 @opindex freport-bug
14782 Collect and dump debug information into a temporary file if an
14783 internal compiler error (ICE) occurs.
14784
14785 @item -fdump-unnumbered
14786 @opindex fdump-unnumbered
14787 When doing debugging dumps, suppress instruction numbers and address output.
14788 This makes it more feasible to use diff on debugging dumps for compiler
14789 invocations with different options, in particular with and without
14790 @option{-g}.
14791
14792 @item -fdump-unnumbered-links
14793 @opindex fdump-unnumbered-links
14794 When doing debugging dumps (see @option{-d} option above), suppress
14795 instruction numbers for the links to the previous and next instructions
14796 in a sequence.
14797
14798 @item -fdump-ipa-@var{switch}
14799 @itemx -fdump-ipa-@var{switch}-@var{options}
14800 @opindex fdump-ipa
14801 Control the dumping at various stages of inter-procedural analysis
14802 language tree to a file. The file name is generated by appending a
14803 switch specific suffix to the source file name, and the file is created
14804 in the same directory as the output file. The following dumps are
14805 possible:
14806
14807 @table @samp
14808 @item all
14809 Enables all inter-procedural analysis dumps.
14810
14811 @item cgraph
14812 Dumps information about call-graph optimization, unused function removal,
14813 and inlining decisions.
14814
14815 @item inline
14816 Dump after function inlining.
14817
14818 @end table
14819
14820 Additionally, the options @option{-optimized}, @option{-missed},
14821 @option{-note}, and @option{-all} can be provided, with the same meaning
14822 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14823
14824 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14825 information on callsites that were inlined, along with callsites
14826 that were not inlined.
14827
14828 By default, the dump will contain messages about successful
14829 optimizations (equivalent to @option{-optimized}) together with
14830 low-level details about the analysis.
14831
14832 @item -fdump-lang-all
14833 @itemx -fdump-lang-@var{switch}
14834 @itemx -fdump-lang-@var{switch}-@var{options}
14835 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14836 @opindex fdump-lang-all
14837 @opindex fdump-lang
14838 Control the dumping of language-specific information. The @var{options}
14839 and @var{filename} portions behave as described in the
14840 @option{-fdump-tree} option. The following @var{switch} values are
14841 accepted:
14842
14843 @table @samp
14844 @item all
14845
14846 Enable all language-specific dumps.
14847
14848 @item class
14849 Dump class hierarchy information. Virtual table information is emitted
14850 unless '@option{slim}' is specified. This option is applicable to C++ only.
14851
14852 @item raw
14853 Dump the raw internal tree data. This option is applicable to C++ only.
14854
14855 @end table
14856
14857 @item -fdump-passes
14858 @opindex fdump-passes
14859 Print on @file{stderr} the list of optimization passes that are turned
14860 on and off by the current command-line options.
14861
14862 @item -fdump-statistics-@var{option}
14863 @opindex fdump-statistics
14864 Enable and control dumping of pass statistics in a separate file. The
14865 file name is generated by appending a suffix ending in
14866 @samp{.statistics} to the source file name, and the file is created in
14867 the same directory as the output file. If the @samp{-@var{option}}
14868 form is used, @samp{-stats} causes counters to be summed over the
14869 whole compilation unit while @samp{-details} dumps every event as
14870 the passes generate them. The default with no option is to sum
14871 counters for each function compiled.
14872
14873 @item -fdump-tree-all
14874 @itemx -fdump-tree-@var{switch}
14875 @itemx -fdump-tree-@var{switch}-@var{options}
14876 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14877 @opindex fdump-tree-all
14878 @opindex fdump-tree
14879 Control the dumping at various stages of processing the intermediate
14880 language tree to a file. If the @samp{-@var{options}}
14881 form is used, @var{options} is a list of @samp{-} separated options
14882 which control the details of the dump. Not all options are applicable
14883 to all dumps; those that are not meaningful are ignored. The
14884 following options are available
14885
14886 @table @samp
14887 @item address
14888 Print the address of each node. Usually this is not meaningful as it
14889 changes according to the environment and source file. Its primary use
14890 is for tying up a dump file with a debug environment.
14891 @item asmname
14892 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14893 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14894 use working backward from mangled names in the assembly file.
14895 @item slim
14896 When dumping front-end intermediate representations, inhibit dumping
14897 of members of a scope or body of a function merely because that scope
14898 has been reached. Only dump such items when they are directly reachable
14899 by some other path.
14900
14901 When dumping pretty-printed trees, this option inhibits dumping the
14902 bodies of control structures.
14903
14904 When dumping RTL, print the RTL in slim (condensed) form instead of
14905 the default LISP-like representation.
14906 @item raw
14907 Print a raw representation of the tree. By default, trees are
14908 pretty-printed into a C-like representation.
14909 @item details
14910 Enable more detailed dumps (not honored by every dump option). Also
14911 include information from the optimization passes.
14912 @item stats
14913 Enable dumping various statistics about the pass (not honored by every dump
14914 option).
14915 @item blocks
14916 Enable showing basic block boundaries (disabled in raw dumps).
14917 @item graph
14918 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14919 dump a representation of the control flow graph suitable for viewing with
14920 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14921 the file is pretty-printed as a subgraph, so that GraphViz can render them
14922 all in a single plot.
14923
14924 This option currently only works for RTL dumps, and the RTL is always
14925 dumped in slim form.
14926 @item vops
14927 Enable showing virtual operands for every statement.
14928 @item lineno
14929 Enable showing line numbers for statements.
14930 @item uid
14931 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14932 @item verbose
14933 Enable showing the tree dump for each statement.
14934 @item eh
14935 Enable showing the EH region number holding each statement.
14936 @item scev
14937 Enable showing scalar evolution analysis details.
14938 @item optimized
14939 Enable showing optimization information (only available in certain
14940 passes).
14941 @item missed
14942 Enable showing missed optimization information (only available in certain
14943 passes).
14944 @item note
14945 Enable other detailed optimization information (only available in
14946 certain passes).
14947 @item all
14948 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14949 and @option{lineno}.
14950 @item optall
14951 Turn on all optimization options, i.e., @option{optimized},
14952 @option{missed}, and @option{note}.
14953 @end table
14954
14955 To determine what tree dumps are available or find the dump for a pass
14956 of interest follow the steps below.
14957
14958 @enumerate
14959 @item
14960 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14961 look for a code that corresponds to the pass you are interested in.
14962 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14963 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14964 The number at the end distinguishes distinct invocations of the same pass.
14965 @item
14966 To enable the creation of the dump file, append the pass code to
14967 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14968 to enable the dump from the Early Value Range Propagation pass, invoke
14969 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14970 specify the name of the dump file. If you don't specify one, GCC
14971 creates as described below.
14972 @item
14973 Find the pass dump in a file whose name is composed of three components
14974 separated by a period: the name of the source file GCC was invoked to
14975 compile, a numeric suffix indicating the pass number followed by the
14976 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14977 and finally the pass code. For example, the Early VRP pass dump might
14978 be in a file named @file{myfile.c.038t.evrp} in the current working
14979 directory. Note that the numeric codes are not stable and may change
14980 from one version of GCC to another.
14981 @end enumerate
14982
14983 @item -fopt-info
14984 @itemx -fopt-info-@var{options}
14985 @itemx -fopt-info-@var{options}=@var{filename}
14986 @opindex fopt-info
14987 Controls optimization dumps from various optimization passes. If the
14988 @samp{-@var{options}} form is used, @var{options} is a list of
14989 @samp{-} separated option keywords to select the dump details and
14990 optimizations.
14991
14992 The @var{options} can be divided into three groups:
14993 @enumerate
14994 @item
14995 options describing what kinds of messages should be emitted,
14996 @item
14997 options describing the verbosity of the dump, and
14998 @item
14999 options describing which optimizations should be included.
15000 @end enumerate
15001 The options from each group can be freely mixed as they are
15002 non-overlapping. However, in case of any conflicts,
15003 the later options override the earlier options on the command
15004 line.
15005
15006 The following options control which kinds of messages should be emitted:
15007
15008 @table @samp
15009 @item optimized
15010 Print information when an optimization is successfully applied. It is
15011 up to a pass to decide which information is relevant. For example, the
15012 vectorizer passes print the source location of loops which are
15013 successfully vectorized.
15014 @item missed
15015 Print information about missed optimizations. Individual passes
15016 control which information to include in the output.
15017 @item note
15018 Print verbose information about optimizations, such as certain
15019 transformations, more detailed messages about decisions etc.
15020 @item all
15021 Print detailed optimization information. This includes
15022 @samp{optimized}, @samp{missed}, and @samp{note}.
15023 @end table
15024
15025 The following option controls the dump verbosity:
15026
15027 @table @samp
15028 @item internals
15029 By default, only ``high-level'' messages are emitted. This option enables
15030 additional, more detailed, messages, which are likely to only be of interest
15031 to GCC developers.
15032 @end table
15033
15034 One or more of the following option keywords can be used to describe a
15035 group of optimizations:
15036
15037 @table @samp
15038 @item ipa
15039 Enable dumps from all interprocedural optimizations.
15040 @item loop
15041 Enable dumps from all loop optimizations.
15042 @item inline
15043 Enable dumps from all inlining optimizations.
15044 @item omp
15045 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
15046 @item vec
15047 Enable dumps from all vectorization optimizations.
15048 @item optall
15049 Enable dumps from all optimizations. This is a superset of
15050 the optimization groups listed above.
15051 @end table
15052
15053 If @var{options} is
15054 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15055 about successful optimizations from all the passes, omitting messages
15056 that are treated as ``internals''.
15057
15058 If the @var{filename} is provided, then the dumps from all the
15059 applicable optimizations are concatenated into the @var{filename}.
15060 Otherwise the dump is output onto @file{stderr}. Though multiple
15061 @option{-fopt-info} options are accepted, only one of them can include
15062 a @var{filename}. If other filenames are provided then all but the
15063 first such option are ignored.
15064
15065 Note that the output @var{filename} is overwritten
15066 in case of multiple translation units. If a combined output from
15067 multiple translation units is desired, @file{stderr} should be used
15068 instead.
15069
15070 In the following example, the optimization info is output to
15071 @file{stderr}:
15072
15073 @smallexample
15074 gcc -O3 -fopt-info
15075 @end smallexample
15076
15077 This example:
15078 @smallexample
15079 gcc -O3 -fopt-info-missed=missed.all
15080 @end smallexample
15081
15082 @noindent
15083 outputs missed optimization report from all the passes into
15084 @file{missed.all}, and this one:
15085
15086 @smallexample
15087 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15088 @end smallexample
15089
15090 @noindent
15091 prints information about missed optimization opportunities from
15092 vectorization passes on @file{stderr}.
15093 Note that @option{-fopt-info-vec-missed} is equivalent to
15094 @option{-fopt-info-missed-vec}. The order of the optimization group
15095 names and message types listed after @option{-fopt-info} does not matter.
15096
15097 As another example,
15098 @smallexample
15099 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15100 @end smallexample
15101
15102 @noindent
15103 outputs information about missed optimizations as well as
15104 optimized locations from all the inlining passes into
15105 @file{inline.txt}.
15106
15107 Finally, consider:
15108
15109 @smallexample
15110 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15111 @end smallexample
15112
15113 @noindent
15114 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15115 in conflict since only one output file is allowed. In this case, only
15116 the first option takes effect and the subsequent options are
15117 ignored. Thus only @file{vec.miss} is produced which contains
15118 dumps from the vectorizer about missed opportunities.
15119
15120 @item -fsave-optimization-record
15121 @opindex fsave-optimization-record
15122 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15123 were performed, for those optimizations that support @option{-fopt-info}.
15124
15125 This option is experimental and the format of the data within the
15126 compressed JSON file is subject to change.
15127
15128 It is roughly equivalent to a machine-readable version of
15129 @option{-fopt-info-all}, as a collection of messages with source file,
15130 line number and column number, with the following additional data for
15131 each message:
15132
15133 @itemize @bullet
15134
15135 @item
15136 the execution count of the code being optimized, along with metadata about
15137 whether this was from actual profile data, or just an estimate, allowing
15138 consumers to prioritize messages by code hotness,
15139
15140 @item
15141 the function name of the code being optimized, where applicable,
15142
15143 @item
15144 the ``inlining chain'' for the code being optimized, so that when
15145 a function is inlined into several different places (which might
15146 themselves be inlined), the reader can distinguish between the copies,
15147
15148 @item
15149 objects identifying those parts of the message that refer to expressions,
15150 statements or symbol-table nodes, which of these categories they are, and,
15151 when available, their source code location,
15152
15153 @item
15154 the GCC pass that emitted the message, and
15155
15156 @item
15157 the location in GCC's own code from which the message was emitted
15158
15159 @end itemize
15160
15161 Additionally, some messages are logically nested within other
15162 messages, reflecting implementation details of the optimization
15163 passes.
15164
15165 @item -fsched-verbose=@var{n}
15166 @opindex fsched-verbose
15167 On targets that use instruction scheduling, this option controls the
15168 amount of debugging output the scheduler prints to the dump files.
15169
15170 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15171 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15172 For @var{n} greater than one, it also output basic block probabilities,
15173 detailed ready list information and unit/insn info. For @var{n} greater
15174 than two, it includes RTL at abort point, control-flow and regions info.
15175 And for @var{n} over four, @option{-fsched-verbose} also includes
15176 dependence info.
15177
15178
15179
15180 @item -fenable-@var{kind}-@var{pass}
15181 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15182 @opindex fdisable-
15183 @opindex fenable-
15184
15185 This is a set of options that are used to explicitly disable/enable
15186 optimization passes. These options are intended for use for debugging GCC.
15187 Compiler users should use regular options for enabling/disabling
15188 passes instead.
15189
15190 @table @gcctabopt
15191
15192 @item -fdisable-ipa-@var{pass}
15193 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15194 statically invoked in the compiler multiple times, the pass name should be
15195 appended with a sequential number starting from 1.
15196
15197 @item -fdisable-rtl-@var{pass}
15198 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15199 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15200 statically invoked in the compiler multiple times, the pass name should be
15201 appended with a sequential number starting from 1. @var{range-list} is a
15202 comma-separated list of function ranges or assembler names. Each range is a number
15203 pair separated by a colon. The range is inclusive in both ends. If the range
15204 is trivial, the number pair can be simplified as a single number. If the
15205 function's call graph node's @var{uid} falls within one of the specified ranges,
15206 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15207 function header of a dump file, and the pass names can be dumped by using
15208 option @option{-fdump-passes}.
15209
15210 @item -fdisable-tree-@var{pass}
15211 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15212 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15213 option arguments.
15214
15215 @item -fenable-ipa-@var{pass}
15216 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15217 statically invoked in the compiler multiple times, the pass name should be
15218 appended with a sequential number starting from 1.
15219
15220 @item -fenable-rtl-@var{pass}
15221 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15222 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15223 description and examples.
15224
15225 @item -fenable-tree-@var{pass}
15226 @itemx -fenable-tree-@var{pass}=@var{range-list}
15227 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15228 of option arguments.
15229
15230 @end table
15231
15232 Here are some examples showing uses of these options.
15233
15234 @smallexample
15235
15236 # disable ccp1 for all functions
15237 -fdisable-tree-ccp1
15238 # disable complete unroll for function whose cgraph node uid is 1
15239 -fenable-tree-cunroll=1
15240 # disable gcse2 for functions at the following ranges [1,1],
15241 # [300,400], and [400,1000]
15242 # disable gcse2 for functions foo and foo2
15243 -fdisable-rtl-gcse2=foo,foo2
15244 # disable early inlining
15245 -fdisable-tree-einline
15246 # disable ipa inlining
15247 -fdisable-ipa-inline
15248 # enable tree full unroll
15249 -fenable-tree-unroll
15250
15251 @end smallexample
15252
15253 @item -fchecking
15254 @itemx -fchecking=@var{n}
15255 @opindex fchecking
15256 @opindex fno-checking
15257 Enable internal consistency checking. The default depends on
15258 the compiler configuration. @option{-fchecking=2} enables further
15259 internal consistency checking that might affect code generation.
15260
15261 @item -frandom-seed=@var{string}
15262 @opindex frandom-seed
15263 This option provides a seed that GCC uses in place of
15264 random numbers in generating certain symbol names
15265 that have to be different in every compiled file. It is also used to
15266 place unique stamps in coverage data files and the object files that
15267 produce them. You can use the @option{-frandom-seed} option to produce
15268 reproducibly identical object files.
15269
15270 The @var{string} can either be a number (decimal, octal or hex) or an
15271 arbitrary string (in which case it's converted to a number by
15272 computing CRC32).
15273
15274 The @var{string} should be different for every file you compile.
15275
15276 @item -save-temps
15277 @itemx -save-temps=cwd
15278 @opindex save-temps
15279 Store the usual ``temporary'' intermediate files permanently; place them
15280 in the current directory and name them based on the source file. Thus,
15281 compiling @file{foo.c} with @option{-c -save-temps} produces files
15282 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15283 preprocessed @file{foo.i} output file even though the compiler now
15284 normally uses an integrated preprocessor.
15285
15286 When used in combination with the @option{-x} command-line option,
15287 @option{-save-temps} is sensible enough to avoid over writing an
15288 input source file with the same extension as an intermediate file.
15289 The corresponding intermediate file may be obtained by renaming the
15290 source file before using @option{-save-temps}.
15291
15292 If you invoke GCC in parallel, compiling several different source
15293 files that share a common base name in different subdirectories or the
15294 same source file compiled for multiple output destinations, it is
15295 likely that the different parallel compilers will interfere with each
15296 other, and overwrite the temporary files. For instance:
15297
15298 @smallexample
15299 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15300 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15301 @end smallexample
15302
15303 may result in @file{foo.i} and @file{foo.o} being written to
15304 simultaneously by both compilers.
15305
15306 @item -save-temps=obj
15307 @opindex save-temps=obj
15308 Store the usual ``temporary'' intermediate files permanently. If the
15309 @option{-o} option is used, the temporary files are based on the
15310 object file. If the @option{-o} option is not used, the
15311 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15312
15313 For example:
15314
15315 @smallexample
15316 gcc -save-temps=obj -c foo.c
15317 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15318 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15319 @end smallexample
15320
15321 @noindent
15322 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15323 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15324 @file{dir2/yfoobar.o}.
15325
15326 @item -time@r{[}=@var{file}@r{]}
15327 @opindex time
15328 Report the CPU time taken by each subprocess in the compilation
15329 sequence. For C source files, this is the compiler proper and assembler
15330 (plus the linker if linking is done).
15331
15332 Without the specification of an output file, the output looks like this:
15333
15334 @smallexample
15335 # cc1 0.12 0.01
15336 # as 0.00 0.01
15337 @end smallexample
15338
15339 The first number on each line is the ``user time'', that is time spent
15340 executing the program itself. The second number is ``system time'',
15341 time spent executing operating system routines on behalf of the program.
15342 Both numbers are in seconds.
15343
15344 With the specification of an output file, the output is appended to the
15345 named file, and it looks like this:
15346
15347 @smallexample
15348 0.12 0.01 cc1 @var{options}
15349 0.00 0.01 as @var{options}
15350 @end smallexample
15351
15352 The ``user time'' and the ``system time'' are moved before the program
15353 name, and the options passed to the program are displayed, so that one
15354 can later tell what file was being compiled, and with which options.
15355
15356 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15357 @opindex fdump-final-insns
15358 Dump the final internal representation (RTL) to @var{file}. If the
15359 optional argument is omitted (or if @var{file} is @code{.}), the name
15360 of the dump file is determined by appending @code{.gkd} to the
15361 compilation output file name.
15362
15363 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15364 @opindex fcompare-debug
15365 @opindex fno-compare-debug
15366 If no error occurs during compilation, run the compiler a second time,
15367 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15368 passed to the second compilation. Dump the final internal
15369 representation in both compilations, and print an error if they differ.
15370
15371 If the equal sign is omitted, the default @option{-gtoggle} is used.
15372
15373 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15374 and nonzero, implicitly enables @option{-fcompare-debug}. If
15375 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15376 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15377 is used.
15378
15379 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15380 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15381 of the final representation and the second compilation, preventing even
15382 @env{GCC_COMPARE_DEBUG} from taking effect.
15383
15384 To verify full coverage during @option{-fcompare-debug} testing, set
15385 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15386 which GCC rejects as an invalid option in any actual compilation
15387 (rather than preprocessing, assembly or linking). To get just a
15388 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15389 not overridden} will do.
15390
15391 @item -fcompare-debug-second
15392 @opindex fcompare-debug-second
15393 This option is implicitly passed to the compiler for the second
15394 compilation requested by @option{-fcompare-debug}, along with options to
15395 silence warnings, and omitting other options that would cause the compiler
15396 to produce output to files or to standard output as a side effect. Dump
15397 files and preserved temporary files are renamed so as to contain the
15398 @code{.gk} additional extension during the second compilation, to avoid
15399 overwriting those generated by the first.
15400
15401 When this option is passed to the compiler driver, it causes the
15402 @emph{first} compilation to be skipped, which makes it useful for little
15403 other than debugging the compiler proper.
15404
15405 @item -gtoggle
15406 @opindex gtoggle
15407 Turn off generation of debug info, if leaving out this option
15408 generates it, or turn it on at level 2 otherwise. The position of this
15409 argument in the command line does not matter; it takes effect after all
15410 other options are processed, and it does so only once, no matter how
15411 many times it is given. This is mainly intended to be used with
15412 @option{-fcompare-debug}.
15413
15414 @item -fvar-tracking-assignments-toggle
15415 @opindex fvar-tracking-assignments-toggle
15416 @opindex fno-var-tracking-assignments-toggle
15417 Toggle @option{-fvar-tracking-assignments}, in the same way that
15418 @option{-gtoggle} toggles @option{-g}.
15419
15420 @item -Q
15421 @opindex Q
15422 Makes the compiler print out each function name as it is compiled, and
15423 print some statistics about each pass when it finishes.
15424
15425 @item -ftime-report
15426 @opindex ftime-report
15427 Makes the compiler print some statistics about the time consumed by each
15428 pass when it finishes.
15429
15430 @item -ftime-report-details
15431 @opindex ftime-report-details
15432 Record the time consumed by infrastructure parts separately for each pass.
15433
15434 @item -fira-verbose=@var{n}
15435 @opindex fira-verbose
15436 Control the verbosity of the dump file for the integrated register allocator.
15437 The default value is 5. If the value @var{n} is greater or equal to 10,
15438 the dump output is sent to stderr using the same format as @var{n} minus 10.
15439
15440 @item -flto-report
15441 @opindex flto-report
15442 Prints a report with internal details on the workings of the link-time
15443 optimizer. The contents of this report vary from version to version.
15444 It is meant to be useful to GCC developers when processing object
15445 files in LTO mode (via @option{-flto}).
15446
15447 Disabled by default.
15448
15449 @item -flto-report-wpa
15450 @opindex flto-report-wpa
15451 Like @option{-flto-report}, but only print for the WPA phase of link-time
15452 optimization.
15453
15454 @item -fmem-report
15455 @opindex fmem-report
15456 Makes the compiler print some statistics about permanent memory
15457 allocation when it finishes.
15458
15459 @item -fmem-report-wpa
15460 @opindex fmem-report-wpa
15461 Makes the compiler print some statistics about permanent memory
15462 allocation for the WPA phase only.
15463
15464 @item -fpre-ipa-mem-report
15465 @opindex fpre-ipa-mem-report
15466 @item -fpost-ipa-mem-report
15467 @opindex fpost-ipa-mem-report
15468 Makes the compiler print some statistics about permanent memory
15469 allocation before or after interprocedural optimization.
15470
15471 @item -fprofile-report
15472 @opindex fprofile-report
15473 Makes the compiler print some statistics about consistency of the
15474 (estimated) profile and effect of individual passes.
15475
15476 @item -fstack-usage
15477 @opindex fstack-usage
15478 Makes the compiler output stack usage information for the program, on a
15479 per-function basis. The filename for the dump is made by appending
15480 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15481 the output file, if explicitly specified and it is not an executable,
15482 otherwise it is the basename of the source file. An entry is made up
15483 of three fields:
15484
15485 @itemize
15486 @item
15487 The name of the function.
15488 @item
15489 A number of bytes.
15490 @item
15491 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15492 @end itemize
15493
15494 The qualifier @code{static} means that the function manipulates the stack
15495 statically: a fixed number of bytes are allocated for the frame on function
15496 entry and released on function exit; no stack adjustments are otherwise made
15497 in the function. The second field is this fixed number of bytes.
15498
15499 The qualifier @code{dynamic} means that the function manipulates the stack
15500 dynamically: in addition to the static allocation described above, stack
15501 adjustments are made in the body of the function, for example to push/pop
15502 arguments around function calls. If the qualifier @code{bounded} is also
15503 present, the amount of these adjustments is bounded at compile time and
15504 the second field is an upper bound of the total amount of stack used by
15505 the function. If it is not present, the amount of these adjustments is
15506 not bounded at compile time and the second field only represents the
15507 bounded part.
15508
15509 @item -fstats
15510 @opindex fstats
15511 Emit statistics about front-end processing at the end of the compilation.
15512 This option is supported only by the C++ front end, and
15513 the information is generally only useful to the G++ development team.
15514
15515 @item -fdbg-cnt-list
15516 @opindex fdbg-cnt-list
15517 Print the name and the counter upper bound for all debug counters.
15518
15519
15520 @item -fdbg-cnt=@var{counter-value-list}
15521 @opindex fdbg-cnt
15522 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15523 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15524 tuples which sets the lower and the upper bound of each debug
15525 counter @var{name}. The @var{lower_bound} is optional and is zero
15526 initialized if not set.
15527 All debug counters have the initial upper bound of @code{UINT_MAX};
15528 thus @code{dbg_cnt} returns true always unless the upper bound
15529 is set by this option.
15530 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15531 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15532 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15533
15534 @item -print-file-name=@var{library}
15535 @opindex print-file-name
15536 Print the full absolute name of the library file @var{library} that
15537 would be used when linking---and don't do anything else. With this
15538 option, GCC does not compile or link anything; it just prints the
15539 file name.
15540
15541 @item -print-multi-directory
15542 @opindex print-multi-directory
15543 Print the directory name corresponding to the multilib selected by any
15544 other switches present in the command line. This directory is supposed
15545 to exist in @env{GCC_EXEC_PREFIX}.
15546
15547 @item -print-multi-lib
15548 @opindex print-multi-lib
15549 Print the mapping from multilib directory names to compiler switches
15550 that enable them. The directory name is separated from the switches by
15551 @samp{;}, and each switch starts with an @samp{@@} instead of the
15552 @samp{-}, without spaces between multiple switches. This is supposed to
15553 ease shell processing.
15554
15555 @item -print-multi-os-directory
15556 @opindex print-multi-os-directory
15557 Print the path to OS libraries for the selected
15558 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15559 present in the @file{lib} subdirectory and no multilibs are used, this is
15560 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15561 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15562 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15563 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15564
15565 @item -print-multiarch
15566 @opindex print-multiarch
15567 Print the path to OS libraries for the selected multiarch,
15568 relative to some @file{lib} subdirectory.
15569
15570 @item -print-prog-name=@var{program}
15571 @opindex print-prog-name
15572 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15573
15574 @item -print-libgcc-file-name
15575 @opindex print-libgcc-file-name
15576 Same as @option{-print-file-name=libgcc.a}.
15577
15578 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15579 but you do want to link with @file{libgcc.a}. You can do:
15580
15581 @smallexample
15582 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15583 @end smallexample
15584
15585 @item -print-search-dirs
15586 @opindex print-search-dirs
15587 Print the name of the configured installation directory and a list of
15588 program and library directories @command{gcc} searches---and don't do anything else.
15589
15590 This is useful when @command{gcc} prints the error message
15591 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15592 To resolve this you either need to put @file{cpp0} and the other compiler
15593 components where @command{gcc} expects to find them, or you can set the environment
15594 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15595 Don't forget the trailing @samp{/}.
15596 @xref{Environment Variables}.
15597
15598 @item -print-sysroot
15599 @opindex print-sysroot
15600 Print the target sysroot directory that is used during
15601 compilation. This is the target sysroot specified either at configure
15602 time or using the @option{--sysroot} option, possibly with an extra
15603 suffix that depends on compilation options. If no target sysroot is
15604 specified, the option prints nothing.
15605
15606 @item -print-sysroot-headers-suffix
15607 @opindex print-sysroot-headers-suffix
15608 Print the suffix added to the target sysroot when searching for
15609 headers, or give an error if the compiler is not configured with such
15610 a suffix---and don't do anything else.
15611
15612 @item -dumpmachine
15613 @opindex dumpmachine
15614 Print the compiler's target machine (for example,
15615 @samp{i686-pc-linux-gnu})---and don't do anything else.
15616
15617 @item -dumpversion
15618 @opindex dumpversion
15619 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15620 anything else. This is the compiler version used in filesystem paths and
15621 specs. Depending on how the compiler has been configured it can be just
15622 a single number (major version), two numbers separated by a dot (major and
15623 minor version) or three numbers separated by dots (major, minor and patchlevel
15624 version).
15625
15626 @item -dumpfullversion
15627 @opindex dumpfullversion
15628 Print the full compiler version---and don't do anything else. The output is
15629 always three numbers separated by dots, major, minor and patchlevel version.
15630
15631 @item -dumpspecs
15632 @opindex dumpspecs
15633 Print the compiler's built-in specs---and don't do anything else. (This
15634 is used when GCC itself is being built.) @xref{Spec Files}.
15635 @end table
15636
15637 @node Submodel Options
15638 @section Machine-Dependent Options
15639 @cindex submodel options
15640 @cindex specifying hardware config
15641 @cindex hardware models and configurations, specifying
15642 @cindex target-dependent options
15643 @cindex machine-dependent options
15644
15645 Each target machine supported by GCC can have its own options---for
15646 example, to allow you to compile for a particular processor variant or
15647 ABI, or to control optimizations specific to that machine. By
15648 convention, the names of machine-specific options start with
15649 @samp{-m}.
15650
15651 Some configurations of the compiler also support additional target-specific
15652 options, usually for compatibility with other compilers on the same
15653 platform.
15654
15655 @c This list is ordered alphanumerically by subsection name.
15656 @c It should be the same order and spelling as these options are listed
15657 @c in Machine Dependent Options
15658
15659 @menu
15660 * AArch64 Options::
15661 * Adapteva Epiphany Options::
15662 * AMD GCN Options::
15663 * ARC Options::
15664 * ARM Options::
15665 * AVR Options::
15666 * Blackfin Options::
15667 * C6X Options::
15668 * CRIS Options::
15669 * CR16 Options::
15670 * C-SKY Options::
15671 * Darwin Options::
15672 * DEC Alpha Options::
15673 * FR30 Options::
15674 * FT32 Options::
15675 * FRV Options::
15676 * GNU/Linux Options::
15677 * H8/300 Options::
15678 * HPPA Options::
15679 * IA-64 Options::
15680 * LM32 Options::
15681 * M32C Options::
15682 * M32R/D Options::
15683 * M680x0 Options::
15684 * MCore Options::
15685 * MeP Options::
15686 * MicroBlaze Options::
15687 * MIPS Options::
15688 * MMIX Options::
15689 * MN10300 Options::
15690 * Moxie Options::
15691 * MSP430 Options::
15692 * NDS32 Options::
15693 * Nios II Options::
15694 * Nvidia PTX Options::
15695 * OpenRISC Options::
15696 * PDP-11 Options::
15697 * picoChip Options::
15698 * PowerPC Options::
15699 * PRU Options::
15700 * RISC-V Options::
15701 * RL78 Options::
15702 * RS/6000 and PowerPC Options::
15703 * RX Options::
15704 * S/390 and zSeries Options::
15705 * Score Options::
15706 * SH Options::
15707 * Solaris 2 Options::
15708 * SPARC Options::
15709 * System V Options::
15710 * TILE-Gx Options::
15711 * TILEPro Options::
15712 * V850 Options::
15713 * VAX Options::
15714 * Visium Options::
15715 * VMS Options::
15716 * VxWorks Options::
15717 * x86 Options::
15718 * x86 Windows Options::
15719 * Xstormy16 Options::
15720 * Xtensa Options::
15721 * zSeries Options::
15722 @end menu
15723
15724 @node AArch64 Options
15725 @subsection AArch64 Options
15726 @cindex AArch64 Options
15727
15728 These options are defined for AArch64 implementations:
15729
15730 @table @gcctabopt
15731
15732 @item -mabi=@var{name}
15733 @opindex mabi
15734 Generate code for the specified data model. Permissible values
15735 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15736 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15737 but long int and pointers are 64 bits.
15738
15739 The default depends on the specific target configuration. Note that
15740 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15741 entire program with the same ABI, and link with a compatible set of libraries.
15742
15743 @item -mbig-endian
15744 @opindex mbig-endian
15745 Generate big-endian code. This is the default when GCC is configured for an
15746 @samp{aarch64_be-*-*} target.
15747
15748 @item -mgeneral-regs-only
15749 @opindex mgeneral-regs-only
15750 Generate code which uses only the general-purpose registers. This will prevent
15751 the compiler from using floating-point and Advanced SIMD registers but will not
15752 impose any restrictions on the assembler.
15753
15754 @item -mlittle-endian
15755 @opindex mlittle-endian
15756 Generate little-endian code. This is the default when GCC is configured for an
15757 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15758
15759 @item -mcmodel=tiny
15760 @opindex mcmodel=tiny
15761 Generate code for the tiny code model. The program and its statically defined
15762 symbols must be within 1MB of each other. Programs can be statically or
15763 dynamically linked.
15764
15765 @item -mcmodel=small
15766 @opindex mcmodel=small
15767 Generate code for the small code model. The program and its statically defined
15768 symbols must be within 4GB of each other. Programs can be statically or
15769 dynamically linked. This is the default code model.
15770
15771 @item -mcmodel=large
15772 @opindex mcmodel=large
15773 Generate code for the large code model. This makes no assumptions about
15774 addresses and sizes of sections. Programs can be statically linked only.
15775
15776 @item -mstrict-align
15777 @itemx -mno-strict-align
15778 @opindex mstrict-align
15779 @opindex mno-strict-align
15780 Avoid or allow generating memory accesses that may not be aligned on a natural
15781 object boundary as described in the architecture specification.
15782
15783 @item -momit-leaf-frame-pointer
15784 @itemx -mno-omit-leaf-frame-pointer
15785 @opindex momit-leaf-frame-pointer
15786 @opindex mno-omit-leaf-frame-pointer
15787 Omit or keep the frame pointer in leaf functions. The former behavior is the
15788 default.
15789
15790 @item -mstack-protector-guard=@var{guard}
15791 @itemx -mstack-protector-guard-reg=@var{reg}
15792 @itemx -mstack-protector-guard-offset=@var{offset}
15793 @opindex mstack-protector-guard
15794 @opindex mstack-protector-guard-reg
15795 @opindex mstack-protector-guard-offset
15796 Generate stack protection code using canary at @var{guard}. Supported
15797 locations are @samp{global} for a global canary or @samp{sysreg} for a
15798 canary in an appropriate system register.
15799
15800 With the latter choice the options
15801 @option{-mstack-protector-guard-reg=@var{reg}} and
15802 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15803 which system register to use as base register for reading the canary,
15804 and from what offset from that base register. There is no default
15805 register or offset as this is entirely for use within the Linux
15806 kernel.
15807
15808 @item -mstack-protector-guard=@var{guard}
15809 @itemx -mstack-protector-guard-reg=@var{reg}
15810 @itemx -mstack-protector-guard-offset=@var{offset}
15811 @opindex mstack-protector-guard
15812 @opindex mstack-protector-guard-reg
15813 @opindex mstack-protector-guard-offset
15814 Generate stack protection code using canary at @var{guard}. Supported
15815 locations are @samp{global} for a global canary or @samp{sysreg} for a
15816 canary in an appropriate system register.
15817
15818 With the latter choice the options
15819 @option{-mstack-protector-guard-reg=@var{reg}} and
15820 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15821 which system register to use as base register for reading the canary,
15822 and from what offset from that base register. There is no default
15823 register or offset as this is entirely for use within the Linux
15824 kernel.
15825
15826 @item -mtls-dialect=desc
15827 @opindex mtls-dialect=desc
15828 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15829 of TLS variables. This is the default.
15830
15831 @item -mtls-dialect=traditional
15832 @opindex mtls-dialect=traditional
15833 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15834 of TLS variables.
15835
15836 @item -mtls-size=@var{size}
15837 @opindex mtls-size
15838 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15839 This option requires binutils 2.26 or newer.
15840
15841 @item -mfix-cortex-a53-835769
15842 @itemx -mno-fix-cortex-a53-835769
15843 @opindex mfix-cortex-a53-835769
15844 @opindex mno-fix-cortex-a53-835769
15845 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15846 This involves inserting a NOP instruction between memory instructions and
15847 64-bit integer multiply-accumulate instructions.
15848
15849 @item -mfix-cortex-a53-843419
15850 @itemx -mno-fix-cortex-a53-843419
15851 @opindex mfix-cortex-a53-843419
15852 @opindex mno-fix-cortex-a53-843419
15853 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15854 This erratum workaround is made at link time and this will only pass the
15855 corresponding flag to the linker.
15856
15857 @item -mlow-precision-recip-sqrt
15858 @itemx -mno-low-precision-recip-sqrt
15859 @opindex mlow-precision-recip-sqrt
15860 @opindex mno-low-precision-recip-sqrt
15861 Enable or disable the reciprocal square root approximation.
15862 This option only has an effect if @option{-ffast-math} or
15863 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15864 precision of reciprocal square root results to about 16 bits for
15865 single precision and to 32 bits for double precision.
15866
15867 @item -mlow-precision-sqrt
15868 @itemx -mno-low-precision-sqrt
15869 @opindex mlow-precision-sqrt
15870 @opindex mno-low-precision-sqrt
15871 Enable or disable the square root approximation.
15872 This option only has an effect if @option{-ffast-math} or
15873 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15874 precision of square root results to about 16 bits for
15875 single precision and to 32 bits for double precision.
15876 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15877
15878 @item -mlow-precision-div
15879 @itemx -mno-low-precision-div
15880 @opindex mlow-precision-div
15881 @opindex mno-low-precision-div
15882 Enable or disable the division approximation.
15883 This option only has an effect if @option{-ffast-math} or
15884 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15885 precision of division results to about 16 bits for
15886 single precision and to 32 bits for double precision.
15887
15888 @item -mtrack-speculation
15889 @itemx -mno-track-speculation
15890 Enable or disable generation of additional code to track speculative
15891 execution through conditional branches. The tracking state can then
15892 be used by the compiler when expanding calls to
15893 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15894 sequence to be generated.
15895
15896 @item -march=@var{name}
15897 @opindex march
15898 Specify the name of the target architecture and, optionally, one or
15899 more feature modifiers. This option has the form
15900 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15901
15902 The permissible values for @var{arch} are @samp{armv8-a},
15903 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15904 @samp{armv8.5-a} or @var{native}.
15905
15906 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15907 support for the ARMv8.5-A architecture extensions.
15908
15909 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15910 support for the ARMv8.4-A architecture extensions.
15911
15912 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15913 support for the ARMv8.3-A architecture extensions.
15914
15915 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15916 support for the ARMv8.2-A architecture extensions.
15917
15918 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15919 support for the ARMv8.1-A architecture extension. In particular, it
15920 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15921
15922 The value @samp{native} is available on native AArch64 GNU/Linux and
15923 causes the compiler to pick the architecture of the host system. This
15924 option has no effect if the compiler is unable to recognize the
15925 architecture of the host system,
15926
15927 The permissible values for @var{feature} are listed in the sub-section
15928 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15929 Feature Modifiers}. Where conflicting feature modifiers are
15930 specified, the right-most feature is used.
15931
15932 GCC uses @var{name} to determine what kind of instructions it can emit
15933 when generating assembly code. If @option{-march} is specified
15934 without either of @option{-mtune} or @option{-mcpu} also being
15935 specified, the code is tuned to perform well across a range of target
15936 processors implementing the target architecture.
15937
15938 @item -mtune=@var{name}
15939 @opindex mtune
15940 Specify the name of the target processor for which GCC should tune the
15941 performance of the code. Permissible values for this option are:
15942 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15943 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15944 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
15945 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
15946 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15947 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
15948 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
15949 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
15950 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15951 @samp{thunderxt83}, @samp{thunderx2t99},
15952 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15953 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15954 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15955 @samp{native}.
15956
15957 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15958 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15959 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15960 should tune for a big.LITTLE system.
15961
15962 Additionally on native AArch64 GNU/Linux systems the value
15963 @samp{native} tunes performance to the host system. This option has no effect
15964 if the compiler is unable to recognize the processor of the host system.
15965
15966 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15967 are specified, the code is tuned to perform well across a range
15968 of target processors.
15969
15970 This option cannot be suffixed by feature modifiers.
15971
15972 @item -mcpu=@var{name}
15973 @opindex mcpu
15974 Specify the name of the target processor, optionally suffixed by one
15975 or more feature modifiers. This option has the form
15976 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15977 the permissible values for @var{cpu} are the same as those available
15978 for @option{-mtune}. The permissible values for @var{feature} are
15979 documented in the sub-section on
15980 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15981 Feature Modifiers}. Where conflicting feature modifiers are
15982 specified, the right-most feature is used.
15983
15984 GCC uses @var{name} to determine what kind of instructions it can emit when
15985 generating assembly code (as if by @option{-march}) and to determine
15986 the target processor for which to tune for performance (as if
15987 by @option{-mtune}). Where this option is used in conjunction
15988 with @option{-march} or @option{-mtune}, those options take precedence
15989 over the appropriate part of this option.
15990
15991 @item -moverride=@var{string}
15992 @opindex moverride
15993 Override tuning decisions made by the back-end in response to a
15994 @option{-mtune=} switch. The syntax, semantics, and accepted values
15995 for @var{string} in this option are not guaranteed to be consistent
15996 across releases.
15997
15998 This option is only intended to be useful when developing GCC.
15999
16000 @item -mverbose-cost-dump
16001 @opindex mverbose-cost-dump
16002 Enable verbose cost model dumping in the debug dump files. This option is
16003 provided for use in debugging the compiler.
16004
16005 @item -mpc-relative-literal-loads
16006 @itemx -mno-pc-relative-literal-loads
16007 @opindex mpc-relative-literal-loads
16008 @opindex mno-pc-relative-literal-loads
16009 Enable or disable PC-relative literal loads. With this option literal pools are
16010 accessed using a single instruction and emitted after each function. This
16011 limits the maximum size of functions to 1MB. This is enabled by default for
16012 @option{-mcmodel=tiny}.
16013
16014 @item -msign-return-address=@var{scope}
16015 @opindex msign-return-address
16016 Select the function scope on which return address signing will be applied.
16017 Permissible values are @samp{none}, which disables return address signing,
16018 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
16019 functions, and @samp{all}, which enables pointer signing for all functions. The
16020 default value is @samp{none}. This option has been deprecated by
16021 -mbranch-protection.
16022
16023 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
16024 @opindex mbranch-protection
16025 Select the branch protection features to use.
16026 @samp{none} is the default and turns off all types of branch protection.
16027 @samp{standard} turns on all types of branch protection features. If a feature
16028 has additional tuning options, then @samp{standard} sets it to its standard
16029 level.
16030 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
16031 level: signing functions that save the return address to memory (non-leaf
16032 functions will practically always do this) using the a-key. The optional
16033 argument @samp{leaf} can be used to extend the signing to include leaf
16034 functions. The optional argument @samp{b-key} can be used to sign the functions
16035 with the B-key instead of the A-key.
16036 @samp{bti} turns on branch target identification mechanism.
16037
16038 @item -msve-vector-bits=@var{bits}
16039 @opindex msve-vector-bits
16040 Specify the number of bits in an SVE vector register. This option only has
16041 an effect when SVE is enabled.
16042
16043 GCC supports two forms of SVE code generation: ``vector-length
16044 agnostic'' output that works with any size of vector register and
16045 ``vector-length specific'' output that allows GCC to make assumptions
16046 about the vector length when it is useful for optimization reasons.
16047 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
16048 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
16049 Specifying @samp{scalable} selects vector-length agnostic
16050 output. At present @samp{-msve-vector-bits=128} also generates vector-length
16051 agnostic output. All other values generate vector-length specific code.
16052 The behavior of these values may change in future releases and no value except
16053 @samp{scalable} should be relied on for producing code that is portable across
16054 different hardware SVE vector lengths.
16055
16056 The default is @samp{-msve-vector-bits=scalable}, which produces
16057 vector-length agnostic code.
16058 @end table
16059
16060 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16061 @anchor{aarch64-feature-modifiers}
16062 @cindex @option{-march} feature modifiers
16063 @cindex @option{-mcpu} feature modifiers
16064 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16065 the following and their inverses @option{no@var{feature}}:
16066
16067 @table @samp
16068 @item crc
16069 Enable CRC extension. This is on by default for
16070 @option{-march=armv8.1-a}.
16071 @item crypto
16072 Enable Crypto extension. This also enables Advanced SIMD and floating-point
16073 instructions.
16074 @item fp
16075 Enable floating-point instructions. This is on by default for all possible
16076 values for options @option{-march} and @option{-mcpu}.
16077 @item simd
16078 Enable Advanced SIMD instructions. This also enables floating-point
16079 instructions. This is on by default for all possible values for options
16080 @option{-march} and @option{-mcpu}.
16081 @item sve
16082 Enable Scalable Vector Extension instructions. This also enables Advanced
16083 SIMD and floating-point instructions.
16084 @item lse
16085 Enable Large System Extension instructions. This is on by default for
16086 @option{-march=armv8.1-a}.
16087 @item rdma
16088 Enable Round Double Multiply Accumulate instructions. This is on by default
16089 for @option{-march=armv8.1-a}.
16090 @item fp16
16091 Enable FP16 extension. This also enables floating-point instructions.
16092 @item fp16fml
16093 Enable FP16 fmla extension. This also enables FP16 extensions and
16094 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.
16095
16096 @item rcpc
16097 Enable the RcPc extension. This does not change code generation from GCC,
16098 but is passed on to the assembler, enabling inline asm statements to use
16099 instructions from the RcPc extension.
16100 @item dotprod
16101 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16102 @item aes
16103 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16104 SIMD instructions.
16105 @item sha2
16106 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16107 @item sha3
16108 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16109 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16110 @item sm4
16111 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16112 Use of this option with architectures prior to Armv8.2-A is not supported.
16113 @item profile
16114 Enable the Statistical Profiling extension. This option is only to enable the
16115 extension at the assembler level and does not affect code generation.
16116 @item rng
16117 Enable the Armv8.5-a Random Number instructions. This option is only to
16118 enable the extension at the assembler level and does not affect code
16119 generation.
16120 @item memtag
16121 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16122 enable the extension at the assembler level and does not affect code
16123 generation.
16124 @item sb
16125 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16126 enable the extension at the assembler level and does not affect code
16127 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16128 @item ssbs
16129 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16130 is only to enable the extension at the assembler level and does not affect code
16131 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16132 @item predres
16133 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16134 This option is only to enable the extension at the assembler level and does
16135 not affect code generation. This option is enabled by default for
16136 @item sve2
16137 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16138 instructions.
16139 @item sve2-bitperm
16140 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16141 @item sve2-sm4
16142 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16143 @item sve2-aes
16144 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16145 @item sve2-sha3
16146 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16147 @option{-march=armv8.5-a}.
16148 @item tme
16149 Enable the Transactional Memory Extension.
16150
16151 @end table
16152
16153 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16154 which implies @option{fp}.
16155 Conversely, @option{nofp} implies @option{nosimd}, which implies
16156 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16157
16158 @node Adapteva Epiphany Options
16159 @subsection Adapteva Epiphany Options
16160
16161 These @samp{-m} options are defined for Adapteva Epiphany:
16162
16163 @table @gcctabopt
16164 @item -mhalf-reg-file
16165 @opindex mhalf-reg-file
16166 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16167 That allows code to run on hardware variants that lack these registers.
16168
16169 @item -mprefer-short-insn-regs
16170 @opindex mprefer-short-insn-regs
16171 Preferentially allocate registers that allow short instruction generation.
16172 This can result in increased instruction count, so this may either reduce or
16173 increase overall code size.
16174
16175 @item -mbranch-cost=@var{num}
16176 @opindex mbranch-cost
16177 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16178 This cost is only a heuristic and is not guaranteed to produce
16179 consistent results across releases.
16180
16181 @item -mcmove
16182 @opindex mcmove
16183 Enable the generation of conditional moves.
16184
16185 @item -mnops=@var{num}
16186 @opindex mnops
16187 Emit @var{num} NOPs before every other generated instruction.
16188
16189 @item -mno-soft-cmpsf
16190 @opindex mno-soft-cmpsf
16191 @opindex msoft-cmpsf
16192 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16193 and test the flags. This is faster than a software comparison, but can
16194 get incorrect results in the presence of NaNs, or when two different small
16195 numbers are compared such that their difference is calculated as zero.
16196 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16197 software comparisons.
16198
16199 @item -mstack-offset=@var{num}
16200 @opindex mstack-offset
16201 Set the offset between the top of the stack and the stack pointer.
16202 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16203 can be used by leaf functions without stack allocation.
16204 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16205 Note also that this option changes the ABI; compiling a program with a
16206 different stack offset than the libraries have been compiled with
16207 generally does not work.
16208 This option can be useful if you want to evaluate if a different stack
16209 offset would give you better code, but to actually use a different stack
16210 offset to build working programs, it is recommended to configure the
16211 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16212
16213 @item -mno-round-nearest
16214 @opindex mno-round-nearest
16215 @opindex mround-nearest
16216 Make the scheduler assume that the rounding mode has been set to
16217 truncating. The default is @option{-mround-nearest}.
16218
16219 @item -mlong-calls
16220 @opindex mlong-calls
16221 If not otherwise specified by an attribute, assume all calls might be beyond
16222 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16223 function address into a register before performing a (otherwise direct) call.
16224 This is the default.
16225
16226 @item -mshort-calls
16227 @opindex short-calls
16228 If not otherwise specified by an attribute, assume all direct calls are
16229 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16230 for direct calls. The default is @option{-mlong-calls}.
16231
16232 @item -msmall16
16233 @opindex msmall16
16234 Assume addresses can be loaded as 16-bit unsigned values. This does not
16235 apply to function addresses for which @option{-mlong-calls} semantics
16236 are in effect.
16237
16238 @item -mfp-mode=@var{mode}
16239 @opindex mfp-mode
16240 Set the prevailing mode of the floating-point unit.
16241 This determines the floating-point mode that is provided and expected
16242 at function call and return time. Making this mode match the mode you
16243 predominantly need at function start can make your programs smaller and
16244 faster by avoiding unnecessary mode switches.
16245
16246 @var{mode} can be set to one the following values:
16247
16248 @table @samp
16249 @item caller
16250 Any mode at function entry is valid, and retained or restored when
16251 the function returns, and when it calls other functions.
16252 This mode is useful for compiling libraries or other compilation units
16253 you might want to incorporate into different programs with different
16254 prevailing FPU modes, and the convenience of being able to use a single
16255 object file outweighs the size and speed overhead for any extra
16256 mode switching that might be needed, compared with what would be needed
16257 with a more specific choice of prevailing FPU mode.
16258
16259 @item truncate
16260 This is the mode used for floating-point calculations with
16261 truncating (i.e.@: round towards zero) rounding mode. That includes
16262 conversion from floating point to integer.
16263
16264 @item round-nearest
16265 This is the mode used for floating-point calculations with
16266 round-to-nearest-or-even rounding mode.
16267
16268 @item int
16269 This is the mode used to perform integer calculations in the FPU, e.g.@:
16270 integer multiply, or integer multiply-and-accumulate.
16271 @end table
16272
16273 The default is @option{-mfp-mode=caller}
16274
16275 @item -mno-split-lohi
16276 @itemx -mno-postinc
16277 @itemx -mno-postmodify
16278 @opindex mno-split-lohi
16279 @opindex msplit-lohi
16280 @opindex mno-postinc
16281 @opindex mpostinc
16282 @opindex mno-postmodify
16283 @opindex mpostmodify
16284 Code generation tweaks that disable, respectively, splitting of 32-bit
16285 loads, generation of post-increment addresses, and generation of
16286 post-modify addresses. The defaults are @option{msplit-lohi},
16287 @option{-mpost-inc}, and @option{-mpost-modify}.
16288
16289 @item -mnovect-double
16290 @opindex mno-vect-double
16291 @opindex mvect-double
16292 Change the preferred SIMD mode to SImode. The default is
16293 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16294
16295 @item -max-vect-align=@var{num}
16296 @opindex max-vect-align
16297 The maximum alignment for SIMD vector mode types.
16298 @var{num} may be 4 or 8. The default is 8.
16299 Note that this is an ABI change, even though many library function
16300 interfaces are unaffected if they don't use SIMD vector modes
16301 in places that affect size and/or alignment of relevant types.
16302
16303 @item -msplit-vecmove-early
16304 @opindex msplit-vecmove-early
16305 Split vector moves into single word moves before reload. In theory this
16306 can give better register allocation, but so far the reverse seems to be
16307 generally the case.
16308
16309 @item -m1reg-@var{reg}
16310 @opindex m1reg-
16311 Specify a register to hold the constant @minus{}1, which makes loading small negative
16312 constants and certain bitmasks faster.
16313 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16314 which specify use of that register as a fixed register,
16315 and @samp{none}, which means that no register is used for this
16316 purpose. The default is @option{-m1reg-none}.
16317
16318 @end table
16319
16320 @node AMD GCN Options
16321 @subsection AMD GCN Options
16322 @cindex AMD GCN Options
16323
16324 These options are defined specifically for the AMD GCN port.
16325
16326 @table @gcctabopt
16327
16328 @item -march=@var{gpu}
16329 @opindex march
16330 @itemx -mtune=@var{gpu}
16331 @opindex mtune
16332 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16333 are
16334
16335 @table @samp
16336 @opindex fiji
16337 @item fiji
16338 Compile for GCN3 Fiji devices (gfx803).
16339
16340 @item gfx900
16341 Compile for GCN5 Vega 10 devices (gfx900).
16342
16343 @item gfx906
16344 Compile for GCN5 Vega 20 devices (gfx906).
16345
16346 @end table
16347
16348 @item -mstack-size=@var{bytes}
16349 @opindex mstack-size
16350 Specify how many @var{bytes} of stack space will be requested for each GPU
16351 thread (wave-front). Beware that there may be many threads and limited memory
16352 available. The size of the stack allocation may also have an impact on
16353 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16354 1MB otherwise.
16355
16356 @end table
16357
16358 @node ARC Options
16359 @subsection ARC Options
16360 @cindex ARC options
16361
16362 The following options control the architecture variant for which code
16363 is being compiled:
16364
16365 @c architecture variants
16366 @table @gcctabopt
16367
16368 @item -mbarrel-shifter
16369 @opindex mbarrel-shifter
16370 Generate instructions supported by barrel shifter. This is the default
16371 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16372
16373 @item -mjli-always
16374 @opindex mjli-alawys
16375 Force to call a function using jli_s instruction. This option is
16376 valid only for ARCv2 architecture.
16377
16378 @item -mcpu=@var{cpu}
16379 @opindex mcpu
16380 Set architecture type, register usage, and instruction scheduling
16381 parameters for @var{cpu}. There are also shortcut alias options
16382 available for backward compatibility and convenience. Supported
16383 values for @var{cpu} are
16384
16385 @table @samp
16386 @opindex mA6
16387 @opindex mARC600
16388 @item arc600
16389 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16390
16391 @item arc601
16392 @opindex mARC601
16393 Compile for ARC601. Alias: @option{-mARC601}.
16394
16395 @item arc700
16396 @opindex mA7
16397 @opindex mARC700
16398 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16399 This is the default when configured with @option{--with-cpu=arc700}@.
16400
16401 @item arcem
16402 Compile for ARC EM.
16403
16404 @item archs
16405 Compile for ARC HS.
16406
16407 @item em
16408 Compile for ARC EM CPU with no hardware extensions.
16409
16410 @item em4
16411 Compile for ARC EM4 CPU.
16412
16413 @item em4_dmips
16414 Compile for ARC EM4 DMIPS CPU.
16415
16416 @item em4_fpus
16417 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16418 extension.
16419
16420 @item em4_fpuda
16421 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16422 double assist instructions.
16423
16424 @item hs
16425 Compile for ARC HS CPU with no hardware extensions except the atomic
16426 instructions.
16427
16428 @item hs34
16429 Compile for ARC HS34 CPU.
16430
16431 @item hs38
16432 Compile for ARC HS38 CPU.
16433
16434 @item hs38_linux
16435 Compile for ARC HS38 CPU with all hardware extensions on.
16436
16437 @item arc600_norm
16438 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16439
16440 @item arc600_mul32x16
16441 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16442 instructions enabled.
16443
16444 @item arc600_mul64
16445 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16446 instructions enabled.
16447
16448 @item arc601_norm
16449 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16450
16451 @item arc601_mul32x16
16452 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16453 instructions enabled.
16454
16455 @item arc601_mul64
16456 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16457 instructions enabled.
16458
16459 @item nps400
16460 Compile for ARC 700 on NPS400 chip.
16461
16462 @item em_mini
16463 Compile for ARC EM minimalist configuration featuring reduced register
16464 set.
16465
16466 @end table
16467
16468 @item -mdpfp
16469 @opindex mdpfp
16470 @itemx -mdpfp-compact
16471 @opindex mdpfp-compact
16472 Generate double-precision FPX instructions, tuned for the compact
16473 implementation.
16474
16475 @item -mdpfp-fast
16476 @opindex mdpfp-fast
16477 Generate double-precision FPX instructions, tuned for the fast
16478 implementation.
16479
16480 @item -mno-dpfp-lrsr
16481 @opindex mno-dpfp-lrsr
16482 Disable @code{lr} and @code{sr} instructions from using FPX extension
16483 aux registers.
16484
16485 @item -mea
16486 @opindex mea
16487 Generate extended arithmetic instructions. Currently only
16488 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16489 supported. This is always enabled for @option{-mcpu=ARC700}.
16490
16491 @item -mno-mpy
16492 @opindex mno-mpy
16493 @opindex mmpy
16494 Do not generate @code{mpy}-family instructions for ARC700. This option is
16495 deprecated.
16496
16497 @item -mmul32x16
16498 @opindex mmul32x16
16499 Generate 32x16-bit multiply and multiply-accumulate instructions.
16500
16501 @item -mmul64
16502 @opindex mmul64
16503 Generate @code{mul64} and @code{mulu64} instructions.
16504 Only valid for @option{-mcpu=ARC600}.
16505
16506 @item -mnorm
16507 @opindex mnorm
16508 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16509 is in effect.
16510
16511 @item -mspfp
16512 @opindex mspfp
16513 @itemx -mspfp-compact
16514 @opindex mspfp-compact
16515 Generate single-precision FPX instructions, tuned for the compact
16516 implementation.
16517
16518 @item -mspfp-fast
16519 @opindex mspfp-fast
16520 Generate single-precision FPX instructions, tuned for the fast
16521 implementation.
16522
16523 @item -msimd
16524 @opindex msimd
16525 Enable generation of ARC SIMD instructions via target-specific
16526 builtins. Only valid for @option{-mcpu=ARC700}.
16527
16528 @item -msoft-float
16529 @opindex msoft-float
16530 This option ignored; it is provided for compatibility purposes only.
16531 Software floating-point code is emitted by default, and this default
16532 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16533 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16534 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16535
16536 @item -mswap
16537 @opindex mswap
16538 Generate @code{swap} instructions.
16539
16540 @item -matomic
16541 @opindex matomic
16542 This enables use of the locked load/store conditional extension to implement
16543 atomic memory built-in functions. Not available for ARC 6xx or ARC
16544 EM cores.
16545
16546 @item -mdiv-rem
16547 @opindex mdiv-rem
16548 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16549
16550 @item -mcode-density
16551 @opindex mcode-density
16552 Enable code density instructions for ARC EM.
16553 This option is on by default for ARC HS.
16554
16555 @item -mll64
16556 @opindex mll64
16557 Enable double load/store operations for ARC HS cores.
16558
16559 @item -mtp-regno=@var{regno}
16560 @opindex mtp-regno
16561 Specify thread pointer register number.
16562
16563 @item -mmpy-option=@var{multo}
16564 @opindex mmpy-option
16565 Compile ARCv2 code with a multiplier design option. You can specify
16566 the option using either a string or numeric value for @var{multo}.
16567 @samp{wlh1} is the default value. The recognized values are:
16568
16569 @table @samp
16570 @item 0
16571 @itemx none
16572 No multiplier available.
16573
16574 @item 1
16575 @itemx w
16576 16x16 multiplier, fully pipelined.
16577 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16578
16579 @item 2
16580 @itemx wlh1
16581 32x32 multiplier, fully
16582 pipelined (1 stage). The following instructions are additionally
16583 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16584
16585 @item 3
16586 @itemx wlh2
16587 32x32 multiplier, fully pipelined
16588 (2 stages). The following instructions are additionally enabled: @code{mpy},
16589 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16590
16591 @item 4
16592 @itemx wlh3
16593 Two 16x16 multipliers, blocking,
16594 sequential. The following instructions are additionally enabled: @code{mpy},
16595 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16596
16597 @item 5
16598 @itemx wlh4
16599 One 16x16 multiplier, blocking,
16600 sequential. The following instructions are additionally enabled: @code{mpy},
16601 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16602
16603 @item 6
16604 @itemx wlh5
16605 One 32x4 multiplier, blocking,
16606 sequential. The following instructions are additionally enabled: @code{mpy},
16607 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16608
16609 @item 7
16610 @itemx plus_dmpy
16611 ARC HS SIMD support.
16612
16613 @item 8
16614 @itemx plus_macd
16615 ARC HS SIMD support.
16616
16617 @item 9
16618 @itemx plus_qmacw
16619 ARC HS SIMD support.
16620
16621 @end table
16622
16623 This option is only available for ARCv2 cores@.
16624
16625 @item -mfpu=@var{fpu}
16626 @opindex mfpu
16627 Enables support for specific floating-point hardware extensions for ARCv2
16628 cores. Supported values for @var{fpu} are:
16629
16630 @table @samp
16631
16632 @item fpus
16633 Enables support for single-precision floating-point hardware
16634 extensions@.
16635
16636 @item fpud
16637 Enables support for double-precision floating-point hardware
16638 extensions. The single-precision floating-point extension is also
16639 enabled. Not available for ARC EM@.
16640
16641 @item fpuda
16642 Enables support for double-precision floating-point hardware
16643 extensions using double-precision assist instructions. The single-precision
16644 floating-point extension is also enabled. This option is
16645 only available for ARC EM@.
16646
16647 @item fpuda_div
16648 Enables support for double-precision floating-point hardware
16649 extensions using double-precision assist instructions.
16650 The single-precision floating-point, square-root, and divide
16651 extensions are also enabled. This option is
16652 only available for ARC EM@.
16653
16654 @item fpuda_fma
16655 Enables support for double-precision floating-point hardware
16656 extensions using double-precision assist instructions.
16657 The single-precision floating-point and fused multiply and add
16658 hardware extensions are also enabled. This option is
16659 only available for ARC EM@.
16660
16661 @item fpuda_all
16662 Enables support for double-precision floating-point hardware
16663 extensions using double-precision assist instructions.
16664 All single-precision floating-point hardware extensions are also
16665 enabled. This option is only available for ARC EM@.
16666
16667 @item fpus_div
16668 Enables support for single-precision floating-point, square-root and divide
16669 hardware extensions@.
16670
16671 @item fpud_div
16672 Enables support for double-precision floating-point, square-root and divide
16673 hardware extensions. This option
16674 includes option @samp{fpus_div}. Not available for ARC EM@.
16675
16676 @item fpus_fma
16677 Enables support for single-precision floating-point and
16678 fused multiply and add hardware extensions@.
16679
16680 @item fpud_fma
16681 Enables support for double-precision floating-point and
16682 fused multiply and add hardware extensions. This option
16683 includes option @samp{fpus_fma}. Not available for ARC EM@.
16684
16685 @item fpus_all
16686 Enables support for all single-precision floating-point hardware
16687 extensions@.
16688
16689 @item fpud_all
16690 Enables support for all single- and double-precision floating-point
16691 hardware extensions. Not available for ARC EM@.
16692
16693 @end table
16694
16695 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16696 @opindex mirq-ctrl-saved
16697 Specifies general-purposes registers that the processor automatically
16698 saves/restores on interrupt entry and exit. @var{register-range} is
16699 specified as two registers separated by a dash. The register range
16700 always starts with @code{r0}, the upper limit is @code{fp} register.
16701 @var{blink} and @var{lp_count} are optional. This option is only
16702 valid for ARC EM and ARC HS cores.
16703
16704 @item -mrgf-banked-regs=@var{number}
16705 @opindex mrgf-banked-regs
16706 Specifies the number of registers replicated in second register bank
16707 on entry to fast interrupt. Fast interrupts are interrupts with the
16708 highest priority level P0. These interrupts save only PC and STATUS32
16709 registers to avoid memory transactions during interrupt entry and exit
16710 sequences. Use this option when you are using fast interrupts in an
16711 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16712
16713 @item -mlpc-width=@var{width}
16714 @opindex mlpc-width
16715 Specify the width of the @code{lp_count} register. Valid values for
16716 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16717 fixed to 32 bits. If the width is less than 32, the compiler does not
16718 attempt to transform loops in your program to use the zero-delay loop
16719 mechanism unless it is known that the @code{lp_count} register can
16720 hold the required loop-counter value. Depending on the width
16721 specified, the compiler and run-time library might continue to use the
16722 loop mechanism for various needs. This option defines macro
16723 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16724
16725 @item -mrf16
16726 @opindex mrf16
16727 This option instructs the compiler to generate code for a 16-entry
16728 register file. This option defines the @code{__ARC_RF16__}
16729 preprocessor macro.
16730
16731 @item -mbranch-index
16732 @opindex mbranch-index
16733 Enable use of @code{bi} or @code{bih} instructions to implement jump
16734 tables.
16735
16736 @end table
16737
16738 The following options are passed through to the assembler, and also
16739 define preprocessor macro symbols.
16740
16741 @c Flags used by the assembler, but for which we define preprocessor
16742 @c macro symbols as well.
16743 @table @gcctabopt
16744 @item -mdsp-packa
16745 @opindex mdsp-packa
16746 Passed down to the assembler to enable the DSP Pack A extensions.
16747 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16748 deprecated.
16749
16750 @item -mdvbf
16751 @opindex mdvbf
16752 Passed down to the assembler to enable the dual Viterbi butterfly
16753 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16754 option is deprecated.
16755
16756 @c ARC700 4.10 extension instruction
16757 @item -mlock
16758 @opindex mlock
16759 Passed down to the assembler to enable the locked load/store
16760 conditional extension. Also sets the preprocessor symbol
16761 @code{__Xlock}.
16762
16763 @item -mmac-d16
16764 @opindex mmac-d16
16765 Passed down to the assembler. Also sets the preprocessor symbol
16766 @code{__Xxmac_d16}. This option is deprecated.
16767
16768 @item -mmac-24
16769 @opindex mmac-24
16770 Passed down to the assembler. Also sets the preprocessor symbol
16771 @code{__Xxmac_24}. This option is deprecated.
16772
16773 @c ARC700 4.10 extension instruction
16774 @item -mrtsc
16775 @opindex mrtsc
16776 Passed down to the assembler to enable the 64-bit time-stamp counter
16777 extension instruction. Also sets the preprocessor symbol
16778 @code{__Xrtsc}. This option is deprecated.
16779
16780 @c ARC700 4.10 extension instruction
16781 @item -mswape
16782 @opindex mswape
16783 Passed down to the assembler to enable the swap byte ordering
16784 extension instruction. Also sets the preprocessor symbol
16785 @code{__Xswape}.
16786
16787 @item -mtelephony
16788 @opindex mtelephony
16789 Passed down to the assembler to enable dual- and single-operand
16790 instructions for telephony. Also sets the preprocessor symbol
16791 @code{__Xtelephony}. This option is deprecated.
16792
16793 @item -mxy
16794 @opindex mxy
16795 Passed down to the assembler to enable the XY memory extension. Also
16796 sets the preprocessor symbol @code{__Xxy}.
16797
16798 @end table
16799
16800 The following options control how the assembly code is annotated:
16801
16802 @c Assembly annotation options
16803 @table @gcctabopt
16804 @item -misize
16805 @opindex misize
16806 Annotate assembler instructions with estimated addresses.
16807
16808 @item -mannotate-align
16809 @opindex mannotate-align
16810 Explain what alignment considerations lead to the decision to make an
16811 instruction short or long.
16812
16813 @end table
16814
16815 The following options are passed through to the linker:
16816
16817 @c options passed through to the linker
16818 @table @gcctabopt
16819 @item -marclinux
16820 @opindex marclinux
16821 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16822 This option is enabled by default in tool chains built for
16823 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16824 when profiling is not requested.
16825
16826 @item -marclinux_prof
16827 @opindex marclinux_prof
16828 Passed through to the linker, to specify use of the
16829 @code{arclinux_prof} emulation. This option is enabled by default in
16830 tool chains built for @w{@code{arc-linux-uclibc}} and
16831 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16832
16833 @end table
16834
16835 The following options control the semantics of generated code:
16836
16837 @c semantically relevant code generation options
16838 @table @gcctabopt
16839 @item -mlong-calls
16840 @opindex mlong-calls
16841 Generate calls as register indirect calls, thus providing access
16842 to the full 32-bit address range.
16843
16844 @item -mmedium-calls
16845 @opindex mmedium-calls
16846 Don't use less than 25-bit addressing range for calls, which is the
16847 offset available for an unconditional branch-and-link
16848 instruction. Conditional execution of function calls is suppressed, to
16849 allow use of the 25-bit range, rather than the 21-bit range with
16850 conditional branch-and-link. This is the default for tool chains built
16851 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16852
16853 @item -G @var{num}
16854 @opindex G
16855 Put definitions of externally-visible data in a small data section if
16856 that data is no bigger than @var{num} bytes. The default value of
16857 @var{num} is 4 for any ARC configuration, or 8 when we have double
16858 load/store operations.
16859
16860 @item -mno-sdata
16861 @opindex mno-sdata
16862 @opindex msdata
16863 Do not generate sdata references. This is the default for tool chains
16864 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16865 targets.
16866
16867 @item -mvolatile-cache
16868 @opindex mvolatile-cache
16869 Use ordinarily cached memory accesses for volatile references. This is the
16870 default.
16871
16872 @item -mno-volatile-cache
16873 @opindex mno-volatile-cache
16874 @opindex mvolatile-cache
16875 Enable cache bypass for volatile references.
16876
16877 @end table
16878
16879 The following options fine tune code generation:
16880 @c code generation tuning options
16881 @table @gcctabopt
16882 @item -malign-call
16883 @opindex malign-call
16884 Do alignment optimizations for call instructions.
16885
16886 @item -mauto-modify-reg
16887 @opindex mauto-modify-reg
16888 Enable the use of pre/post modify with register displacement.
16889
16890 @item -mbbit-peephole
16891 @opindex mbbit-peephole
16892 Enable bbit peephole2.
16893
16894 @item -mno-brcc
16895 @opindex mno-brcc
16896 This option disables a target-specific pass in @file{arc_reorg} to
16897 generate compare-and-branch (@code{br@var{cc}}) instructions.
16898 It has no effect on
16899 generation of these instructions driven by the combiner pass.
16900
16901 @item -mcase-vector-pcrel
16902 @opindex mcase-vector-pcrel
16903 Use PC-relative switch case tables to enable case table shortening.
16904 This is the default for @option{-Os}.
16905
16906 @item -mcompact-casesi
16907 @opindex mcompact-casesi
16908 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16909 and only available for ARCv1 cores. This option is deprecated.
16910
16911 @item -mno-cond-exec
16912 @opindex mno-cond-exec
16913 Disable the ARCompact-specific pass to generate conditional
16914 execution instructions.
16915
16916 Due to delay slot scheduling and interactions between operand numbers,
16917 literal sizes, instruction lengths, and the support for conditional execution,
16918 the target-independent pass to generate conditional execution is often lacking,
16919 so the ARC port has kept a special pass around that tries to find more
16920 conditional execution generation opportunities after register allocation,
16921 branch shortening, and delay slot scheduling have been done. This pass
16922 generally, but not always, improves performance and code size, at the cost of
16923 extra compilation time, which is why there is an option to switch it off.
16924 If you have a problem with call instructions exceeding their allowable
16925 offset range because they are conditionalized, you should consider using
16926 @option{-mmedium-calls} instead.
16927
16928 @item -mearly-cbranchsi
16929 @opindex mearly-cbranchsi
16930 Enable pre-reload use of the @code{cbranchsi} pattern.
16931
16932 @item -mexpand-adddi
16933 @opindex mexpand-adddi
16934 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16935 @code{add.f}, @code{adc} etc. This option is deprecated.
16936
16937 @item -mindexed-loads
16938 @opindex mindexed-loads
16939 Enable the use of indexed loads. This can be problematic because some
16940 optimizers then assume that indexed stores exist, which is not
16941 the case.
16942
16943 @item -mlra
16944 @opindex mlra
16945 Enable Local Register Allocation. This is still experimental for ARC,
16946 so by default the compiler uses standard reload
16947 (i.e.@: @option{-mno-lra}).
16948
16949 @item -mlra-priority-none
16950 @opindex mlra-priority-none
16951 Don't indicate any priority for target registers.
16952
16953 @item -mlra-priority-compact
16954 @opindex mlra-priority-compact
16955 Indicate target register priority for r0..r3 / r12..r15.
16956
16957 @item -mlra-priority-noncompact
16958 @opindex mlra-priority-noncompact
16959 Reduce target register priority for r0..r3 / r12..r15.
16960
16961 @item -mmillicode
16962 @opindex mmillicode
16963 When optimizing for size (using @option{-Os}), prologues and epilogues
16964 that have to save or restore a large number of registers are often
16965 shortened by using call to a special function in libgcc; this is
16966 referred to as a @emph{millicode} call. As these calls can pose
16967 performance issues, and/or cause linking issues when linking in a
16968 nonstandard way, this option is provided to turn on or off millicode
16969 call generation.
16970
16971 @item -mcode-density-frame
16972 @opindex mcode-density-frame
16973 This option enable the compiler to emit @code{enter} and @code{leave}
16974 instructions. These instructions are only valid for CPUs with
16975 code-density feature.
16976
16977 @item -mmixed-code
16978 @opindex mmixed-code
16979 Tweak register allocation to help 16-bit instruction generation.
16980 This generally has the effect of decreasing the average instruction size
16981 while increasing the instruction count.
16982
16983 @item -mq-class
16984 @opindex mq-class
16985 Enable @samp{q} instruction alternatives.
16986 This is the default for @option{-Os}.
16987
16988 @item -mRcq
16989 @opindex mRcq
16990 Enable @samp{Rcq} constraint handling.
16991 Most short code generation depends on this.
16992 This is the default.
16993
16994 @item -mRcw
16995 @opindex mRcw
16996 Enable @samp{Rcw} constraint handling.
16997 Most ccfsm condexec mostly depends on this.
16998 This is the default.
16999
17000 @item -msize-level=@var{level}
17001 @opindex msize-level
17002 Fine-tune size optimization with regards to instruction lengths and alignment.
17003 The recognized values for @var{level} are:
17004 @table @samp
17005 @item 0
17006 No size optimization. This level is deprecated and treated like @samp{1}.
17007
17008 @item 1
17009 Short instructions are used opportunistically.
17010
17011 @item 2
17012 In addition, alignment of loops and of code after barriers are dropped.
17013
17014 @item 3
17015 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
17016
17017 @end table
17018
17019 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
17020 the behavior when this is not set is equivalent to level @samp{1}.
17021
17022 @item -mtune=@var{cpu}
17023 @opindex mtune
17024 Set instruction scheduling parameters for @var{cpu}, overriding any implied
17025 by @option{-mcpu=}.
17026
17027 Supported values for @var{cpu} are
17028
17029 @table @samp
17030 @item ARC600
17031 Tune for ARC600 CPU.
17032
17033 @item ARC601
17034 Tune for ARC601 CPU.
17035
17036 @item ARC700
17037 Tune for ARC700 CPU with standard multiplier block.
17038
17039 @item ARC700-xmac
17040 Tune for ARC700 CPU with XMAC block.
17041
17042 @item ARC725D
17043 Tune for ARC725D CPU.
17044
17045 @item ARC750D
17046 Tune for ARC750D CPU.
17047
17048 @end table
17049
17050 @item -mmultcost=@var{num}
17051 @opindex mmultcost
17052 Cost to assume for a multiply instruction, with @samp{4} being equal to a
17053 normal instruction.
17054
17055 @item -munalign-prob-threshold=@var{probability}
17056 @opindex munalign-prob-threshold
17057 Set probability threshold for unaligning branches.
17058 When tuning for @samp{ARC700} and optimizing for speed, branches without
17059 filled delay slot are preferably emitted unaligned and long, unless
17060 profiling indicates that the probability for the branch to be taken
17061 is below @var{probability}. @xref{Cross-profiling}.
17062 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17063
17064 @end table
17065
17066 The following options are maintained for backward compatibility, but
17067 are now deprecated and will be removed in a future release:
17068
17069 @c Deprecated options
17070 @table @gcctabopt
17071
17072 @item -margonaut
17073 @opindex margonaut
17074 Obsolete FPX.
17075
17076 @item -mbig-endian
17077 @opindex mbig-endian
17078 @itemx -EB
17079 @opindex EB
17080 Compile code for big-endian targets. Use of these options is now
17081 deprecated. Big-endian code is supported by configuring GCC to build
17082 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17083 for which big endian is the default.
17084
17085 @item -mlittle-endian
17086 @opindex mlittle-endian
17087 @itemx -EL
17088 @opindex EL
17089 Compile code for little-endian targets. Use of these options is now
17090 deprecated. Little-endian code is supported by configuring GCC to build
17091 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17092 for which little endian is the default.
17093
17094 @item -mbarrel_shifter
17095 @opindex mbarrel_shifter
17096 Replaced by @option{-mbarrel-shifter}.
17097
17098 @item -mdpfp_compact
17099 @opindex mdpfp_compact
17100 Replaced by @option{-mdpfp-compact}.
17101
17102 @item -mdpfp_fast
17103 @opindex mdpfp_fast
17104 Replaced by @option{-mdpfp-fast}.
17105
17106 @item -mdsp_packa
17107 @opindex mdsp_packa
17108 Replaced by @option{-mdsp-packa}.
17109
17110 @item -mEA
17111 @opindex mEA
17112 Replaced by @option{-mea}.
17113
17114 @item -mmac_24
17115 @opindex mmac_24
17116 Replaced by @option{-mmac-24}.
17117
17118 @item -mmac_d16
17119 @opindex mmac_d16
17120 Replaced by @option{-mmac-d16}.
17121
17122 @item -mspfp_compact
17123 @opindex mspfp_compact
17124 Replaced by @option{-mspfp-compact}.
17125
17126 @item -mspfp_fast
17127 @opindex mspfp_fast
17128 Replaced by @option{-mspfp-fast}.
17129
17130 @item -mtune=@var{cpu}
17131 @opindex mtune
17132 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17133 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17134 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17135
17136 @item -multcost=@var{num}
17137 @opindex multcost
17138 Replaced by @option{-mmultcost}.
17139
17140 @end table
17141
17142 @node ARM Options
17143 @subsection ARM Options
17144 @cindex ARM options
17145
17146 These @samp{-m} options are defined for the ARM port:
17147
17148 @table @gcctabopt
17149 @item -mabi=@var{name}
17150 @opindex mabi
17151 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17152 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17153
17154 @item -mapcs-frame
17155 @opindex mapcs-frame
17156 Generate a stack frame that is compliant with the ARM Procedure Call
17157 Standard for all functions, even if this is not strictly necessary for
17158 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17159 with this option causes the stack frames not to be generated for
17160 leaf functions. The default is @option{-mno-apcs-frame}.
17161 This option is deprecated.
17162
17163 @item -mapcs
17164 @opindex mapcs
17165 This is a synonym for @option{-mapcs-frame} and is deprecated.
17166
17167 @ignore
17168 @c not currently implemented
17169 @item -mapcs-stack-check
17170 @opindex mapcs-stack-check
17171 Generate code to check the amount of stack space available upon entry to
17172 every function (that actually uses some stack space). If there is
17173 insufficient space available then either the function
17174 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17175 called, depending upon the amount of stack space required. The runtime
17176 system is required to provide these functions. The default is
17177 @option{-mno-apcs-stack-check}, since this produces smaller code.
17178
17179 @c not currently implemented
17180 @item -mapcs-reentrant
17181 @opindex mapcs-reentrant
17182 Generate reentrant, position-independent code. The default is
17183 @option{-mno-apcs-reentrant}.
17184 @end ignore
17185
17186 @item -mthumb-interwork
17187 @opindex mthumb-interwork
17188 Generate code that supports calling between the ARM and Thumb
17189 instruction sets. Without this option, on pre-v5 architectures, the
17190 two instruction sets cannot be reliably used inside one program. The
17191 default is @option{-mno-thumb-interwork}, since slightly larger code
17192 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17193 configurations this option is meaningless.
17194
17195 @item -mno-sched-prolog
17196 @opindex mno-sched-prolog
17197 @opindex msched-prolog
17198 Prevent the reordering of instructions in the function prologue, or the
17199 merging of those instruction with the instructions in the function's
17200 body. This means that all functions start with a recognizable set
17201 of instructions (or in fact one of a choice from a small set of
17202 different function prologues), and this information can be used to
17203 locate the start of functions inside an executable piece of code. The
17204 default is @option{-msched-prolog}.
17205
17206 @item -mfloat-abi=@var{name}
17207 @opindex mfloat-abi
17208 Specifies which floating-point ABI to use. Permissible values
17209 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17210
17211 Specifying @samp{soft} causes GCC to generate output containing
17212 library calls for floating-point operations.
17213 @samp{softfp} allows the generation of code using hardware floating-point
17214 instructions, but still uses the soft-float calling conventions.
17215 @samp{hard} allows generation of floating-point instructions
17216 and uses FPU-specific calling conventions.
17217
17218 The default depends on the specific target configuration. Note that
17219 the hard-float and soft-float ABIs are not link-compatible; you must
17220 compile your entire program with the same ABI, and link with a
17221 compatible set of libraries.
17222
17223 @item -mgeneral-regs-only
17224 @opindex mgeneral-regs-only
17225 Generate code which uses only the general-purpose registers. This will prevent
17226 the compiler from using floating-point and Advanced SIMD registers but will not
17227 impose any restrictions on the assembler.
17228
17229 @item -mlittle-endian
17230 @opindex mlittle-endian
17231 Generate code for a processor running in little-endian mode. This is
17232 the default for all standard configurations.
17233
17234 @item -mbig-endian
17235 @opindex mbig-endian
17236 Generate code for a processor running in big-endian mode; the default is
17237 to compile code for a little-endian processor.
17238
17239 @item -mbe8
17240 @itemx -mbe32
17241 @opindex mbe8
17242 When linking a big-endian image select between BE8 and BE32 formats.
17243 The option has no effect for little-endian images and is ignored. The
17244 default is dependent on the selected target architecture. For ARMv6
17245 and later architectures the default is BE8, for older architectures
17246 the default is BE32. BE32 format has been deprecated by ARM.
17247
17248 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17249 @opindex march
17250 This specifies the name of the target ARM architecture. GCC uses this
17251 name to determine what kind of instructions it can emit when generating
17252 assembly code. This option can be used in conjunction with or instead
17253 of the @option{-mcpu=} option.
17254
17255 Permissible names are:
17256 @samp{armv4t},
17257 @samp{armv5t}, @samp{armv5te},
17258 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17259 @samp{armv6z}, @samp{armv6zk},
17260 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17261 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17262 @samp{armv8.4-a},
17263 @samp{armv8.5-a},
17264 @samp{armv7-r},
17265 @samp{armv8-r},
17266 @samp{armv6-m}, @samp{armv6s-m},
17267 @samp{armv7-m}, @samp{armv7e-m},
17268 @samp{armv8-m.base}, @samp{armv8-m.main},
17269 @samp{iwmmxt} and @samp{iwmmxt2}.
17270
17271 Additionally, the following architectures, which lack support for the
17272 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17273
17274 Many of the architectures support extensions. These can be added by
17275 appending @samp{+@var{extension}} to the architecture name. Extension
17276 options are processed in order and capabilities accumulate. An extension
17277 will also enable any necessary base extensions
17278 upon which it depends. For example, the @samp{+crypto} extension
17279 will always enable the @samp{+simd} extension. The exception to the
17280 additive construction is for extensions that are prefixed with
17281 @samp{+no@dots{}}: these extensions disable the specified option and
17282 any other extensions that may depend on the presence of that
17283 extension.
17284
17285 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17286 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17287 entirely disabled by the @samp{+nofp} option that follows it.
17288
17289 Most extension names are generically named, but have an effect that is
17290 dependent upon the architecture to which it is applied. For example,
17291 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17292 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17293 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17294 variant for @samp{armv8-a}.
17295
17296 The table below lists the supported extensions for each architecture.
17297 Architectures not mentioned do not support any extensions.
17298
17299 @table @samp
17300 @item armv5te
17301 @itemx armv6
17302 @itemx armv6j
17303 @itemx armv6k
17304 @itemx armv6kz
17305 @itemx armv6t2
17306 @itemx armv6z
17307 @itemx armv6zk
17308 @table @samp
17309 @item +fp
17310 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17311 used as an alias for this extension.
17312
17313 @item +nofp
17314 Disable the floating-point instructions.
17315 @end table
17316
17317 @item armv7
17318 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17319 @table @samp
17320 @item +fp
17321 The VFPv3 floating-point instructions, with 16 double-precision
17322 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17323 for this extension. Note that floating-point is not supported by the
17324 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17325 ARMv7-R architectures.
17326
17327 @item +nofp
17328 Disable the floating-point instructions.
17329 @end table
17330
17331 @item armv7-a
17332 @table @samp
17333 @item +mp
17334 The multiprocessing extension.
17335
17336 @item +sec
17337 The security extension.
17338
17339 @item +fp
17340 The VFPv3 floating-point instructions, with 16 double-precision
17341 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17342 for this extension.
17343
17344 @item +simd
17345 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17346 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17347 for this extension.
17348
17349 @item +vfpv3
17350 The VFPv3 floating-point instructions, with 32 double-precision
17351 registers.
17352
17353 @item +vfpv3-d16-fp16
17354 The VFPv3 floating-point instructions, with 16 double-precision
17355 registers and the half-precision floating-point conversion operations.
17356
17357 @item +vfpv3-fp16
17358 The VFPv3 floating-point instructions, with 32 double-precision
17359 registers and the half-precision floating-point conversion operations.
17360
17361 @item +vfpv4-d16
17362 The VFPv4 floating-point instructions, with 16 double-precision
17363 registers.
17364
17365 @item +vfpv4
17366 The VFPv4 floating-point instructions, with 32 double-precision
17367 registers.
17368
17369 @item +neon-fp16
17370 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17371 the half-precision floating-point conversion operations.
17372
17373 @item +neon-vfpv4
17374 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17375
17376 @item +nosimd
17377 Disable the Advanced SIMD instructions (does not disable floating point).
17378
17379 @item +nofp
17380 Disable the floating-point and Advanced SIMD instructions.
17381 @end table
17382
17383 @item armv7ve
17384 The extended version of the ARMv7-A architecture with support for
17385 virtualization.
17386 @table @samp
17387 @item +fp
17388 The VFPv4 floating-point instructions, with 16 double-precision registers.
17389 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17390
17391 @item +simd
17392 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17393 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17394
17395 @item +vfpv3-d16
17396 The VFPv3 floating-point instructions, with 16 double-precision
17397 registers.
17398
17399 @item +vfpv3
17400 The VFPv3 floating-point instructions, with 32 double-precision
17401 registers.
17402
17403 @item +vfpv3-d16-fp16
17404 The VFPv3 floating-point instructions, with 16 double-precision
17405 registers and the half-precision floating-point conversion operations.
17406
17407 @item +vfpv3-fp16
17408 The VFPv3 floating-point instructions, with 32 double-precision
17409 registers and the half-precision floating-point conversion operations.
17410
17411 @item +vfpv4-d16
17412 The VFPv4 floating-point instructions, with 16 double-precision
17413 registers.
17414
17415 @item +vfpv4
17416 The VFPv4 floating-point instructions, with 32 double-precision
17417 registers.
17418
17419 @item +neon
17420 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17421 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17422
17423 @item +neon-fp16
17424 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17425 the half-precision floating-point conversion operations.
17426
17427 @item +nosimd
17428 Disable the Advanced SIMD instructions (does not disable floating point).
17429
17430 @item +nofp
17431 Disable the floating-point and Advanced SIMD instructions.
17432 @end table
17433
17434 @item armv8-a
17435 @table @samp
17436 @item +crc
17437 The Cyclic Redundancy Check (CRC) instructions.
17438 @item +simd
17439 The ARMv8-A Advanced SIMD and floating-point instructions.
17440 @item +crypto
17441 The cryptographic instructions.
17442 @item +nocrypto
17443 Disable the cryptographic instructions.
17444 @item +nofp
17445 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17446 @item +sb
17447 Speculation Barrier Instruction.
17448 @item +predres
17449 Execution and Data Prediction Restriction Instructions.
17450 @end table
17451
17452 @item armv8.1-a
17453 @table @samp
17454 @item +simd
17455 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17456
17457 @item +crypto
17458 The cryptographic instructions. This also enables the Advanced SIMD and
17459 floating-point instructions.
17460
17461 @item +nocrypto
17462 Disable the cryptographic instructions.
17463
17464 @item +nofp
17465 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17466
17467 @item +sb
17468 Speculation Barrier Instruction.
17469
17470 @item +predres
17471 Execution and Data Prediction Restriction Instructions.
17472 @end table
17473
17474 @item armv8.2-a
17475 @itemx armv8.3-a
17476 @table @samp
17477 @item +fp16
17478 The half-precision floating-point data processing instructions.
17479 This also enables the Advanced SIMD and floating-point instructions.
17480
17481 @item +fp16fml
17482 The half-precision floating-point fmla extension. This also enables
17483 the half-precision floating-point extension and Advanced SIMD and
17484 floating-point instructions.
17485
17486 @item +simd
17487 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17488
17489 @item +crypto
17490 The cryptographic instructions. This also enables the Advanced SIMD and
17491 floating-point instructions.
17492
17493 @item +dotprod
17494 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17495
17496 @item +nocrypto
17497 Disable the cryptographic extension.
17498
17499 @item +nofp
17500 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17501
17502 @item +sb
17503 Speculation Barrier Instruction.
17504
17505 @item +predres
17506 Execution and Data Prediction Restriction Instructions.
17507 @end table
17508
17509 @item armv8.4-a
17510 @table @samp
17511 @item +fp16
17512 The half-precision floating-point data processing instructions.
17513 This also enables the Advanced SIMD and floating-point instructions as well
17514 as the Dot Product extension and the half-precision floating-point fmla
17515 extension.
17516
17517 @item +simd
17518 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17519 Dot Product extension.
17520
17521 @item +crypto
17522 The cryptographic instructions. This also enables the Advanced SIMD and
17523 floating-point instructions as well as the Dot Product extension.
17524
17525 @item +nocrypto
17526 Disable the cryptographic extension.
17527
17528 @item +nofp
17529 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17530
17531 @item +sb
17532 Speculation Barrier Instruction.
17533
17534 @item +predres
17535 Execution and Data Prediction Restriction Instructions.
17536 @end table
17537
17538 @item armv8.5-a
17539 @table @samp
17540 @item +fp16
17541 The half-precision floating-point data processing instructions.
17542 This also enables the Advanced SIMD and floating-point instructions as well
17543 as the Dot Product extension and the half-precision floating-point fmla
17544 extension.
17545
17546 @item +simd
17547 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17548 Dot Product extension.
17549
17550 @item +crypto
17551 The cryptographic instructions. This also enables the Advanced SIMD and
17552 floating-point instructions as well as the Dot Product extension.
17553
17554 @item +nocrypto
17555 Disable the cryptographic extension.
17556
17557 @item +nofp
17558 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17559 @end table
17560
17561 @item armv7-r
17562 @table @samp
17563 @item +fp.sp
17564 The single-precision VFPv3 floating-point instructions. The extension
17565 @samp{+vfpv3xd} can be used as an alias for this extension.
17566
17567 @item +fp
17568 The VFPv3 floating-point instructions with 16 double-precision registers.
17569 The extension +vfpv3-d16 can be used as an alias for this extension.
17570
17571 @item +vfpv3xd-d16-fp16
17572 The single-precision VFPv3 floating-point instructions with 16 double-precision
17573 registers and the half-precision floating-point conversion operations.
17574
17575 @item +vfpv3-d16-fp16
17576 The VFPv3 floating-point instructions with 16 double-precision
17577 registers and the half-precision floating-point conversion operations.
17578
17579 @item +nofp
17580 Disable the floating-point extension.
17581
17582 @item +idiv
17583 The ARM-state integer division instructions.
17584
17585 @item +noidiv
17586 Disable the ARM-state integer division extension.
17587 @end table
17588
17589 @item armv7e-m
17590 @table @samp
17591 @item +fp
17592 The single-precision VFPv4 floating-point instructions.
17593
17594 @item +fpv5
17595 The single-precision FPv5 floating-point instructions.
17596
17597 @item +fp.dp
17598 The single- and double-precision FPv5 floating-point instructions.
17599
17600 @item +nofp
17601 Disable the floating-point extensions.
17602 @end table
17603
17604 @item armv8-m.main
17605 @table @samp
17606 @item +dsp
17607 The DSP instructions.
17608
17609 @item +nodsp
17610 Disable the DSP extension.
17611
17612 @item +fp
17613 The single-precision floating-point instructions.
17614
17615 @item +fp.dp
17616 The single- and double-precision floating-point instructions.
17617
17618 @item +nofp
17619 Disable the floating-point extension.
17620 @end table
17621
17622 @item armv8-r
17623 @table @samp
17624 @item +crc
17625 The Cyclic Redundancy Check (CRC) instructions.
17626 @item +fp.sp
17627 The single-precision FPv5 floating-point instructions.
17628 @item +simd
17629 The ARMv8-A Advanced SIMD and floating-point instructions.
17630 @item +crypto
17631 The cryptographic instructions.
17632 @item +nocrypto
17633 Disable the cryptographic instructions.
17634 @item +nofp
17635 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17636 @end table
17637
17638 @end table
17639
17640 @option{-march=native} causes the compiler to auto-detect the architecture
17641 of the build computer. At present, this feature is only supported on
17642 GNU/Linux, and not all architectures are recognized. If the auto-detect
17643 is unsuccessful the option has no effect.
17644
17645 @item -mtune=@var{name}
17646 @opindex mtune
17647 This option specifies the name of the target ARM processor for
17648 which GCC should tune the performance of the code.
17649 For some ARM implementations better performance can be obtained by using
17650 this option.
17651 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17652 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17653 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17654 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17655 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17656 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17657 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17658 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17659 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17660 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17661 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17662 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17663 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17664 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
17665 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17666 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17667 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17668 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17669 @samp{cortex-m35p},
17670 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17671 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17672 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17673 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17674 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17675
17676 Additionally, this option can specify that GCC should tune the performance
17677 of the code for a big.LITTLE system. Permissible names are:
17678 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17679 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17680 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17681 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17682
17683 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17684 performance for a blend of processors within architecture @var{arch}.
17685 The aim is to generate code that run well on the current most popular
17686 processors, balancing between optimizations that benefit some CPUs in the
17687 range, and avoiding performance pitfalls of other CPUs. The effects of
17688 this option may change in future GCC versions as CPU models come and go.
17689
17690 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17691 the extension options do not affect the tuning of the generated code.
17692
17693 @option{-mtune=native} causes the compiler to auto-detect the CPU
17694 of the build computer. At present, this feature is only supported on
17695 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17696 unsuccessful the option has no effect.
17697
17698 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17699 @opindex mcpu
17700 This specifies the name of the target ARM processor. GCC uses this name
17701 to derive the name of the target ARM architecture (as if specified
17702 by @option{-march}) and the ARM processor type for which to tune for
17703 performance (as if specified by @option{-mtune}). Where this option
17704 is used in conjunction with @option{-march} or @option{-mtune},
17705 those options take precedence over the appropriate part of this option.
17706
17707 Many of the supported CPUs implement optional architectural
17708 extensions. Where this is so the architectural extensions are
17709 normally enabled by default. If implementations that lack the
17710 extension exist, then the extension syntax can be used to disable
17711 those extensions that have been omitted. For floating-point and
17712 Advanced SIMD (Neon) instructions, the settings of the options
17713 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17714 floating-point and Advanced SIMD instructions will only be used if
17715 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17716 @option{-mfpu} other than @samp{auto} will override the available
17717 floating-point and SIMD extension instructions.
17718
17719 For example, @samp{cortex-a9} can be found in three major
17720 configurations: integer only, with just a floating-point unit or with
17721 floating-point and Advanced SIMD. The default is to enable all the
17722 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17723 be used to disable just the SIMD or both the SIMD and floating-point
17724 instructions respectively.
17725
17726 Permissible names for this option are the same as those for
17727 @option{-mtune}.
17728
17729 The following extension options are common to the listed CPUs:
17730
17731 @table @samp
17732 @item +nodsp
17733 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
17734
17735 @item +nofp
17736 Disables the floating-point instructions on @samp{arm9e},
17737 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17738 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17739 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17740 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
17741 Disables the floating-point and SIMD instructions on
17742 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17743 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17744 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17745 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17746 @samp{cortex-a53} and @samp{cortex-a55}.
17747
17748 @item +nofp.dp
17749 Disables the double-precision component of the floating-point instructions
17750 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17751 @samp{cortex-m7}.
17752
17753 @item +nosimd
17754 Disables the SIMD (but not floating-point) instructions on
17755 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17756 and @samp{cortex-a9}.
17757
17758 @item +crypto
17759 Enables the cryptographic instructions on @samp{cortex-a32},
17760 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17761 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17762 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17763 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17764 @samp{cortex-a75.cortex-a55}.
17765 @end table
17766
17767 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17768 VFPv3 with 16 double-precision registers. It supports the following
17769 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17770 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17771 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17772 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17773 the extensions to @option{-march=armv7-a}.
17774
17775 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17776 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17777 See @option{-mtune} for more information.
17778
17779 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17780 of the build computer. At present, this feature is only supported on
17781 GNU/Linux, and not all architectures are recognized. If the auto-detect
17782 is unsuccessful the option has no effect.
17783
17784 @item -mfpu=@var{name}
17785 @opindex mfpu
17786 This specifies what floating-point hardware (or hardware emulation) is
17787 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17788 @samp{vfpv3},
17789 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17790 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17791 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17792 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17793 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17794 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17795 is an alias for @samp{vfpv2}.
17796
17797 The setting @samp{auto} is the default and is special. It causes the
17798 compiler to select the floating-point and Advanced SIMD instructions
17799 based on the settings of @option{-mcpu} and @option{-march}.
17800
17801 If the selected floating-point hardware includes the NEON extension
17802 (e.g.@: @option{-mfpu=neon}), note that floating-point
17803 operations are not generated by GCC's auto-vectorization pass unless
17804 @option{-funsafe-math-optimizations} is also specified. This is
17805 because NEON hardware does not fully implement the IEEE 754 standard for
17806 floating-point arithmetic (in particular denormal values are treated as
17807 zero), so the use of NEON instructions may lead to a loss of precision.
17808
17809 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}).
17810
17811 @item -mfp16-format=@var{name}
17812 @opindex mfp16-format
17813 Specify the format of the @code{__fp16} half-precision floating-point type.
17814 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17815 the default is @samp{none}, in which case the @code{__fp16} type is not
17816 defined. @xref{Half-Precision}, for more information.
17817
17818 @item -mstructure-size-boundary=@var{n}
17819 @opindex mstructure-size-boundary
17820 The sizes of all structures and unions are rounded up to a multiple
17821 of the number of bits set by this option. Permissible values are 8, 32
17822 and 64. The default value varies for different toolchains. For the COFF
17823 targeted toolchain the default value is 8. A value of 64 is only allowed
17824 if the underlying ABI supports it.
17825
17826 Specifying a larger number can produce faster, more efficient code, but
17827 can also increase the size of the program. Different values are potentially
17828 incompatible. Code compiled with one value cannot necessarily expect to
17829 work with code or libraries compiled with another value, if they exchange
17830 information using structures or unions.
17831
17832 This option is deprecated.
17833
17834 @item -mabort-on-noreturn
17835 @opindex mabort-on-noreturn
17836 Generate a call to the function @code{abort} at the end of a
17837 @code{noreturn} function. It is executed if the function tries to
17838 return.
17839
17840 @item -mlong-calls
17841 @itemx -mno-long-calls
17842 @opindex mlong-calls
17843 @opindex mno-long-calls
17844 Tells the compiler to perform function calls by first loading the
17845 address of the function into a register and then performing a subroutine
17846 call on this register. This switch is needed if the target function
17847 lies outside of the 64-megabyte addressing range of the offset-based
17848 version of subroutine call instruction.
17849
17850 Even if this switch is enabled, not all function calls are turned
17851 into long calls. The heuristic is that static functions, functions
17852 that have the @code{short_call} attribute, functions that are inside
17853 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17854 definitions have already been compiled within the current compilation
17855 unit are not turned into long calls. The exceptions to this rule are
17856 that weak function definitions, functions with the @code{long_call}
17857 attribute or the @code{section} attribute, and functions that are within
17858 the scope of a @code{#pragma long_calls} directive are always
17859 turned into long calls.
17860
17861 This feature is not enabled by default. Specifying
17862 @option{-mno-long-calls} restores the default behavior, as does
17863 placing the function calls within the scope of a @code{#pragma
17864 long_calls_off} directive. Note these switches have no effect on how
17865 the compiler generates code to handle function calls via function
17866 pointers.
17867
17868 @item -msingle-pic-base
17869 @opindex msingle-pic-base
17870 Treat the register used for PIC addressing as read-only, rather than
17871 loading it in the prologue for each function. The runtime system is
17872 responsible for initializing this register with an appropriate value
17873 before execution begins.
17874
17875 @item -mpic-register=@var{reg}
17876 @opindex mpic-register
17877 Specify the register to be used for PIC addressing.
17878 For standard PIC base case, the default is any suitable register
17879 determined by compiler. For single PIC base case, the default is
17880 @samp{R9} if target is EABI based or stack-checking is enabled,
17881 otherwise the default is @samp{R10}.
17882
17883 @item -mpic-data-is-text-relative
17884 @opindex mpic-data-is-text-relative
17885 Assume that the displacement between the text and data segments is fixed
17886 at static link time. This permits using PC-relative addressing
17887 operations to access data known to be in the data segment. For
17888 non-VxWorks RTP targets, this option is enabled by default. When
17889 disabled on such targets, it will enable @option{-msingle-pic-base} by
17890 default.
17891
17892 @item -mpoke-function-name
17893 @opindex mpoke-function-name
17894 Write the name of each function into the text section, directly
17895 preceding the function prologue. The generated code is similar to this:
17896
17897 @smallexample
17898 t0
17899 .ascii "arm_poke_function_name", 0
17900 .align
17901 t1
17902 .word 0xff000000 + (t1 - t0)
17903 arm_poke_function_name
17904 mov ip, sp
17905 stmfd sp!, @{fp, ip, lr, pc@}
17906 sub fp, ip, #4
17907 @end smallexample
17908
17909 When performing a stack backtrace, code can inspect the value of
17910 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17911 location @code{pc - 12} and the top 8 bits are set, then we know that
17912 there is a function name embedded immediately preceding this location
17913 and has length @code{((pc[-3]) & 0xff000000)}.
17914
17915 @item -mthumb
17916 @itemx -marm
17917 @opindex marm
17918 @opindex mthumb
17919
17920 Select between generating code that executes in ARM and Thumb
17921 states. The default for most configurations is to generate code
17922 that executes in ARM state, but the default can be changed by
17923 configuring GCC with the @option{--with-mode=}@var{state}
17924 configure option.
17925
17926 You can also override the ARM and Thumb mode for each function
17927 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17928 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17929
17930 @item -mflip-thumb
17931 @opindex mflip-thumb
17932 Switch ARM/Thumb modes on alternating functions.
17933 This option is provided for regression testing of mixed Thumb/ARM code
17934 generation, and is not intended for ordinary use in compiling code.
17935
17936 @item -mtpcs-frame
17937 @opindex mtpcs-frame
17938 Generate a stack frame that is compliant with the Thumb Procedure Call
17939 Standard for all non-leaf functions. (A leaf function is one that does
17940 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17941
17942 @item -mtpcs-leaf-frame
17943 @opindex mtpcs-leaf-frame
17944 Generate a stack frame that is compliant with the Thumb Procedure Call
17945 Standard for all leaf functions. (A leaf function is one that does
17946 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17947
17948 @item -mcallee-super-interworking
17949 @opindex mcallee-super-interworking
17950 Gives all externally visible functions in the file being compiled an ARM
17951 instruction set header which switches to Thumb mode before executing the
17952 rest of the function. This allows these functions to be called from
17953 non-interworking code. This option is not valid in AAPCS configurations
17954 because interworking is enabled by default.
17955
17956 @item -mcaller-super-interworking
17957 @opindex mcaller-super-interworking
17958 Allows calls via function pointers (including virtual functions) to
17959 execute correctly regardless of whether the target code has been
17960 compiled for interworking or not. There is a small overhead in the cost
17961 of executing a function pointer if this option is enabled. This option
17962 is not valid in AAPCS configurations because interworking is enabled
17963 by default.
17964
17965 @item -mtp=@var{name}
17966 @opindex mtp
17967 Specify the access model for the thread local storage pointer. The valid
17968 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17969 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17970 (supported in the arm6k architecture), and @samp{auto}, which uses the
17971 best available method for the selected processor. The default setting is
17972 @samp{auto}.
17973
17974 @item -mtls-dialect=@var{dialect}
17975 @opindex mtls-dialect
17976 Specify the dialect to use for accessing thread local storage. Two
17977 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17978 @samp{gnu} dialect selects the original GNU scheme for supporting
17979 local and global dynamic TLS models. The @samp{gnu2} dialect
17980 selects the GNU descriptor scheme, which provides better performance
17981 for shared libraries. The GNU descriptor scheme is compatible with
17982 the original scheme, but does require new assembler, linker and
17983 library support. Initial and local exec TLS models are unaffected by
17984 this option and always use the original scheme.
17985
17986 @item -mword-relocations
17987 @opindex mword-relocations
17988 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17989 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17990 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17991 is specified. This option conflicts with @option{-mslow-flash-data}.
17992
17993 @item -mfix-cortex-m3-ldrd
17994 @opindex mfix-cortex-m3-ldrd
17995 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17996 with overlapping destination and base registers are used. This option avoids
17997 generating these instructions. This option is enabled by default when
17998 @option{-mcpu=cortex-m3} is specified.
17999
18000 @item -munaligned-access
18001 @itemx -mno-unaligned-access
18002 @opindex munaligned-access
18003 @opindex mno-unaligned-access
18004 Enables (or disables) reading and writing of 16- and 32- bit values
18005 from addresses that are not 16- or 32- bit aligned. By default
18006 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18007 ARMv8-M Baseline architectures, and enabled for all other
18008 architectures. If unaligned access is not enabled then words in packed
18009 data structures are accessed a byte at a time.
18010
18011 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
18012 generated object file to either true or false, depending upon the
18013 setting of this option. If unaligned access is enabled then the
18014 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
18015 defined.
18016
18017 @item -mneon-for-64bits
18018 @opindex mneon-for-64bits
18019 This option is deprecated and has no effect.
18020
18021 @item -mslow-flash-data
18022 @opindex mslow-flash-data
18023 Assume loading data from flash is slower than fetching instruction.
18024 Therefore literal load is minimized for better performance.
18025 This option is only supported when compiling for ARMv7 M-profile and
18026 off by default. It conflicts with @option{-mword-relocations}.
18027
18028 @item -masm-syntax-unified
18029 @opindex masm-syntax-unified
18030 Assume inline assembler is using unified asm syntax. The default is
18031 currently off which implies divided syntax. This option has no impact
18032 on Thumb2. However, this may change in future releases of GCC.
18033 Divided syntax should be considered deprecated.
18034
18035 @item -mrestrict-it
18036 @opindex mrestrict-it
18037 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
18038 IT blocks can only contain a single 16-bit instruction from a select
18039 set of instructions. This option is on by default for ARMv8-A Thumb mode.
18040
18041 @item -mprint-tune-info
18042 @opindex mprint-tune-info
18043 Print CPU tuning information as comment in assembler file. This is
18044 an option used only for regression testing of the compiler and not
18045 intended for ordinary use in compiling code. This option is disabled
18046 by default.
18047
18048 @item -mverbose-cost-dump
18049 @opindex mverbose-cost-dump
18050 Enable verbose cost model dumping in the debug dump files. This option is
18051 provided for use in debugging the compiler.
18052
18053 @item -mpure-code
18054 @opindex mpure-code
18055 Do not allow constant data to be placed in code sections.
18056 Additionally, when compiling for ELF object format give all text sections the
18057 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
18058 is only available when generating non-pic code for M-profile targets with the
18059 MOVT instruction.
18060
18061 @item -mcmse
18062 @opindex mcmse
18063 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
18064 Development Tools Engineering Specification", which can be found on
18065 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
18066 @end table
18067
18068 @node AVR Options
18069 @subsection AVR Options
18070 @cindex AVR Options
18071
18072 These options are defined for AVR implementations:
18073
18074 @table @gcctabopt
18075 @item -mmcu=@var{mcu}
18076 @opindex mmcu
18077 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18078
18079 The default for this option is@tie{}@samp{avr2}.
18080
18081 GCC supports the following AVR devices and ISAs:
18082
18083 @include avr-mmcu.texi
18084
18085 @item -mabsdata
18086 @opindex mabsdata
18087
18088 Assume that all data in static storage can be accessed by LDS / STS
18089 instructions. This option has only an effect on reduced Tiny devices like
18090 ATtiny40. See also the @code{absdata}
18091 @ref{AVR Variable Attributes,variable attribute}.
18092
18093 @item -maccumulate-args
18094 @opindex maccumulate-args
18095 Accumulate outgoing function arguments and acquire/release the needed
18096 stack space for outgoing function arguments once in function
18097 prologue/epilogue. Without this option, outgoing arguments are pushed
18098 before calling a function and popped afterwards.
18099
18100 Popping the arguments after the function call can be expensive on
18101 AVR so that accumulating the stack space might lead to smaller
18102 executables because arguments need not be removed from the
18103 stack after such a function call.
18104
18105 This option can lead to reduced code size for functions that perform
18106 several calls to functions that get their arguments on the stack like
18107 calls to printf-like functions.
18108
18109 @item -mbranch-cost=@var{cost}
18110 @opindex mbranch-cost
18111 Set the branch costs for conditional branch instructions to
18112 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18113 integers. The default branch cost is 0.
18114
18115 @item -mcall-prologues
18116 @opindex mcall-prologues
18117 Functions prologues/epilogues are expanded as calls to appropriate
18118 subroutines. Code size is smaller.
18119
18120 @item -mgas-isr-prologues
18121 @opindex mgas-isr-prologues
18122 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18123 instruction supported by GNU Binutils.
18124 If this option is on, the feature can still be disabled for individual
18125 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18126 function attribute. This feature is activated per default
18127 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18128 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18129
18130 @item -mint8
18131 @opindex mint8
18132 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18133 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18134 and @code{long long} is 4 bytes. Please note that this option does not
18135 conform to the C standards, but it results in smaller code
18136 size.
18137
18138 @item -mmain-is-OS_task
18139 @opindex mmain-is-OS_task
18140 Do not save registers in @code{main}. The effect is the same like
18141 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18142 to @code{main}. It is activated per default if optimization is on.
18143
18144 @item -mn-flash=@var{num}
18145 @opindex mn-flash
18146 Assume that the flash memory has a size of
18147 @var{num} times 64@tie{}KiB.
18148
18149 @item -mno-interrupts
18150 @opindex mno-interrupts
18151 Generated code is not compatible with hardware interrupts.
18152 Code size is smaller.
18153
18154 @item -mrelax
18155 @opindex mrelax
18156 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18157 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18158 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18159 the assembler's command line and the @option{--relax} option to the
18160 linker's command line.
18161
18162 Jump relaxing is performed by the linker because jump offsets are not
18163 known before code is located. Therefore, the assembler code generated by the
18164 compiler is the same, but the instructions in the executable may
18165 differ from instructions in the assembler code.
18166
18167 Relaxing must be turned on if linker stubs are needed, see the
18168 section on @code{EIND} and linker stubs below.
18169
18170 @item -mrmw
18171 @opindex mrmw
18172 Assume that the device supports the Read-Modify-Write
18173 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18174
18175 @item -mshort-calls
18176 @opindex mshort-calls
18177
18178 Assume that @code{RJMP} and @code{RCALL} can target the whole
18179 program memory.
18180
18181 This option is used internally for multilib selection. It is
18182 not an optimization option, and you don't need to set it by hand.
18183
18184 @item -msp8
18185 @opindex msp8
18186 Treat the stack pointer register as an 8-bit register,
18187 i.e.@: assume the high byte of the stack pointer is zero.
18188 In general, you don't need to set this option by hand.
18189
18190 This option is used internally by the compiler to select and
18191 build multilibs for architectures @code{avr2} and @code{avr25}.
18192 These architectures mix devices with and without @code{SPH}.
18193 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18194 the compiler driver adds or removes this option from the compiler
18195 proper's command line, because the compiler then knows if the device
18196 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18197 register or not.
18198
18199 @item -mstrict-X
18200 @opindex mstrict-X
18201 Use address register @code{X} in a way proposed by the hardware. This means
18202 that @code{X} is only used in indirect, post-increment or
18203 pre-decrement addressing.
18204
18205 Without this option, the @code{X} register may be used in the same way
18206 as @code{Y} or @code{Z} which then is emulated by additional
18207 instructions.
18208 For example, loading a value with @code{X+const} addressing with a
18209 small non-negative @code{const < 64} to a register @var{Rn} is
18210 performed as
18211
18212 @example
18213 adiw r26, const ; X += const
18214 ld @var{Rn}, X ; @var{Rn} = *X
18215 sbiw r26, const ; X -= const
18216 @end example
18217
18218 @item -mtiny-stack
18219 @opindex mtiny-stack
18220 Only change the lower 8@tie{}bits of the stack pointer.
18221
18222 @item -mfract-convert-truncate
18223 @opindex mfract-convert-truncate
18224 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18225
18226 @item -nodevicelib
18227 @opindex nodevicelib
18228 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18229
18230 @item -Waddr-space-convert
18231 @opindex Waddr-space-convert
18232 @opindex Wno-addr-space-convert
18233 Warn about conversions between address spaces in the case where the
18234 resulting address space is not contained in the incoming address space.
18235
18236 @item -Wmisspelled-isr
18237 @opindex Wmisspelled-isr
18238 @opindex Wno-misspelled-isr
18239 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18240 Enabled by default.
18241 @end table
18242
18243 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18244 @cindex @code{EIND}
18245 Pointers in the implementation are 16@tie{}bits wide.
18246 The address of a function or label is represented as word address so
18247 that indirect jumps and calls can target any code address in the
18248 range of 64@tie{}Ki words.
18249
18250 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18251 bytes of program memory space, there is a special function register called
18252 @code{EIND} that serves as most significant part of the target address
18253 when @code{EICALL} or @code{EIJMP} instructions are used.
18254
18255 Indirect jumps and calls on these devices are handled as follows by
18256 the compiler and are subject to some limitations:
18257
18258 @itemize @bullet
18259
18260 @item
18261 The compiler never sets @code{EIND}.
18262
18263 @item
18264 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18265 instructions or might read @code{EIND} directly in order to emulate an
18266 indirect call/jump by means of a @code{RET} instruction.
18267
18268 @item
18269 The compiler assumes that @code{EIND} never changes during the startup
18270 code or during the application. In particular, @code{EIND} is not
18271 saved/restored in function or interrupt service routine
18272 prologue/epilogue.
18273
18274 @item
18275 For indirect calls to functions and computed goto, the linker
18276 generates @emph{stubs}. Stubs are jump pads sometimes also called
18277 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18278 The stub contains a direct jump to the desired address.
18279
18280 @item
18281 Linker relaxation must be turned on so that the linker generates
18282 the stubs correctly in all situations. See the compiler option
18283 @option{-mrelax} and the linker option @option{--relax}.
18284 There are corner cases where the linker is supposed to generate stubs
18285 but aborts without relaxation and without a helpful error message.
18286
18287 @item
18288 The default linker script is arranged for code with @code{EIND = 0}.
18289 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18290 linker script has to be used in order to place the sections whose
18291 name start with @code{.trampolines} into the segment where @code{EIND}
18292 points to.
18293
18294 @item
18295 The startup code from libgcc never sets @code{EIND}.
18296 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18297 For the impact of AVR-LibC on @code{EIND}, see the
18298 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18299
18300 @item
18301 It is legitimate for user-specific startup code to set up @code{EIND}
18302 early, for example by means of initialization code located in
18303 section @code{.init3}. Such code runs prior to general startup code
18304 that initializes RAM and calls constructors, but after the bit
18305 of startup code from AVR-LibC that sets @code{EIND} to the segment
18306 where the vector table is located.
18307 @example
18308 #include <avr/io.h>
18309
18310 static void
18311 __attribute__((section(".init3"),naked,used,no_instrument_function))
18312 init3_set_eind (void)
18313 @{
18314 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18315 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18316 @}
18317 @end example
18318
18319 @noindent
18320 The @code{__trampolines_start} symbol is defined in the linker script.
18321
18322 @item
18323 Stubs are generated automatically by the linker if
18324 the following two conditions are met:
18325 @itemize @minus
18326
18327 @item The address of a label is taken by means of the @code{gs} modifier
18328 (short for @emph{generate stubs}) like so:
18329 @example
18330 LDI r24, lo8(gs(@var{func}))
18331 LDI r25, hi8(gs(@var{func}))
18332 @end example
18333 @item The final location of that label is in a code segment
18334 @emph{outside} the segment where the stubs are located.
18335 @end itemize
18336
18337 @item
18338 The compiler emits such @code{gs} modifiers for code labels in the
18339 following situations:
18340 @itemize @minus
18341 @item Taking address of a function or code label.
18342 @item Computed goto.
18343 @item If prologue-save function is used, see @option{-mcall-prologues}
18344 command-line option.
18345 @item Switch/case dispatch tables. If you do not want such dispatch
18346 tables you can specify the @option{-fno-jump-tables} command-line option.
18347 @item C and C++ constructors/destructors called during startup/shutdown.
18348 @item If the tools hit a @code{gs()} modifier explained above.
18349 @end itemize
18350
18351 @item
18352 Jumping to non-symbolic addresses like so is @emph{not} supported:
18353
18354 @example
18355 int main (void)
18356 @{
18357 /* Call function at word address 0x2 */
18358 return ((int(*)(void)) 0x2)();
18359 @}
18360 @end example
18361
18362 Instead, a stub has to be set up, i.e.@: the function has to be called
18363 through a symbol (@code{func_4} in the example):
18364
18365 @example
18366 int main (void)
18367 @{
18368 extern int func_4 (void);
18369
18370 /* Call function at byte address 0x4 */
18371 return func_4();
18372 @}
18373 @end example
18374
18375 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18376 Alternatively, @code{func_4} can be defined in the linker script.
18377 @end itemize
18378
18379 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18380 @cindex @code{RAMPD}
18381 @cindex @code{RAMPX}
18382 @cindex @code{RAMPY}
18383 @cindex @code{RAMPZ}
18384 Some AVR devices support memories larger than the 64@tie{}KiB range
18385 that can be accessed with 16-bit pointers. To access memory locations
18386 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18387 register is used as high part of the address:
18388 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18389 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18390 register, respectively, to get a wide address. Similarly,
18391 @code{RAMPD} is used together with direct addressing.
18392
18393 @itemize
18394 @item
18395 The startup code initializes the @code{RAMP} special function
18396 registers with zero.
18397
18398 @item
18399 If a @ref{AVR Named Address Spaces,named address space} other than
18400 generic or @code{__flash} is used, then @code{RAMPZ} is set
18401 as needed before the operation.
18402
18403 @item
18404 If the device supports RAM larger than 64@tie{}KiB and the compiler
18405 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18406 is reset to zero after the operation.
18407
18408 @item
18409 If the device comes with a specific @code{RAMP} register, the ISR
18410 prologue/epilogue saves/restores that SFR and initializes it with
18411 zero in case the ISR code might (implicitly) use it.
18412
18413 @item
18414 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18415 If you use inline assembler to read from locations outside the
18416 16-bit address range and change one of the @code{RAMP} registers,
18417 you must reset it to zero after the access.
18418
18419 @end itemize
18420
18421 @subsubsection AVR Built-in Macros
18422
18423 GCC defines several built-in macros so that the user code can test
18424 for the presence or absence of features. Almost any of the following
18425 built-in macros are deduced from device capabilities and thus
18426 triggered by the @option{-mmcu=} command-line option.
18427
18428 For even more AVR-specific built-in macros see
18429 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18430
18431 @table @code
18432
18433 @item __AVR_ARCH__
18434 Build-in macro that resolves to a decimal number that identifies the
18435 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18436 Possible values are:
18437
18438 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18439 @code{4}, @code{5}, @code{51}, @code{6}
18440
18441 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18442 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18443
18444 respectively and
18445
18446 @code{100},
18447 @code{102}, @code{103}, @code{104},
18448 @code{105}, @code{106}, @code{107}
18449
18450 for @var{mcu}=@code{avrtiny},
18451 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18452 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18453 If @var{mcu} specifies a device, this built-in macro is set
18454 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18455 defined to @code{4}.
18456
18457 @item __AVR_@var{Device}__
18458 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18459 the device's name. For example, @option{-mmcu=atmega8} defines the
18460 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18461 @code{__AVR_ATtiny261A__}, etc.
18462
18463 The built-in macros' names follow
18464 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18465 the device name as from the AVR user manual. The difference between
18466 @var{Device} in the built-in macro and @var{device} in
18467 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18468
18469 If @var{device} is not a device but only a core architecture like
18470 @samp{avr51}, this macro is not defined.
18471
18472 @item __AVR_DEVICE_NAME__
18473 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18474 the device's name. For example, with @option{-mmcu=atmega8} the macro
18475 is defined to @code{atmega8}.
18476
18477 If @var{device} is not a device but only a core architecture like
18478 @samp{avr51}, this macro is not defined.
18479
18480 @item __AVR_XMEGA__
18481 The device / architecture belongs to the XMEGA family of devices.
18482
18483 @item __AVR_HAVE_ELPM__
18484 The device has the @code{ELPM} instruction.
18485
18486 @item __AVR_HAVE_ELPMX__
18487 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18488 R@var{n},Z+} instructions.
18489
18490 @item __AVR_HAVE_MOVW__
18491 The device has the @code{MOVW} instruction to perform 16-bit
18492 register-register moves.
18493
18494 @item __AVR_HAVE_LPMX__
18495 The device has the @code{LPM R@var{n},Z} and
18496 @code{LPM R@var{n},Z+} instructions.
18497
18498 @item __AVR_HAVE_MUL__
18499 The device has a hardware multiplier.
18500
18501 @item __AVR_HAVE_JMP_CALL__
18502 The device has the @code{JMP} and @code{CALL} instructions.
18503 This is the case for devices with more than 8@tie{}KiB of program
18504 memory.
18505
18506 @item __AVR_HAVE_EIJMP_EICALL__
18507 @itemx __AVR_3_BYTE_PC__
18508 The device has the @code{EIJMP} and @code{EICALL} instructions.
18509 This is the case for devices with more than 128@tie{}KiB of program memory.
18510 This also means that the program counter
18511 (PC) is 3@tie{}bytes wide.
18512
18513 @item __AVR_2_BYTE_PC__
18514 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18515 with up to 128@tie{}KiB of program memory.
18516
18517 @item __AVR_HAVE_8BIT_SP__
18518 @itemx __AVR_HAVE_16BIT_SP__
18519 The stack pointer (SP) register is treated as 8-bit respectively
18520 16-bit register by the compiler.
18521 The definition of these macros is affected by @option{-mtiny-stack}.
18522
18523 @item __AVR_HAVE_SPH__
18524 @itemx __AVR_SP8__
18525 The device has the SPH (high part of stack pointer) special function
18526 register or has an 8-bit stack pointer, respectively.
18527 The definition of these macros is affected by @option{-mmcu=} and
18528 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18529 by @option{-msp8}.
18530
18531 @item __AVR_HAVE_RAMPD__
18532 @itemx __AVR_HAVE_RAMPX__
18533 @itemx __AVR_HAVE_RAMPY__
18534 @itemx __AVR_HAVE_RAMPZ__
18535 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18536 @code{RAMPZ} special function register, respectively.
18537
18538 @item __NO_INTERRUPTS__
18539 This macro reflects the @option{-mno-interrupts} command-line option.
18540
18541 @item __AVR_ERRATA_SKIP__
18542 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18543 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18544 instructions because of a hardware erratum. Skip instructions are
18545 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18546 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18547 set.
18548
18549 @item __AVR_ISA_RMW__
18550 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18551
18552 @item __AVR_SFR_OFFSET__=@var{offset}
18553 Instructions that can address I/O special function registers directly
18554 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18555 address as if addressed by an instruction to access RAM like @code{LD}
18556 or @code{STS}. This offset depends on the device architecture and has
18557 to be subtracted from the RAM address in order to get the
18558 respective I/O@tie{}address.
18559
18560 @item __AVR_SHORT_CALLS__
18561 The @option{-mshort-calls} command line option is set.
18562
18563 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18564 Some devices support reading from flash memory by means of @code{LD*}
18565 instructions. The flash memory is seen in the data address space
18566 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18567 is not defined, this feature is not available. If defined,
18568 the address space is linear and there is no need to put
18569 @code{.rodata} into RAM. This is handled by the default linker
18570 description file, and is currently available for
18571 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18572 there is no need to use address spaces like @code{__flash} or
18573 features like attribute @code{progmem} and @code{pgm_read_*}.
18574
18575 @item __WITH_AVRLIBC__
18576 The compiler is configured to be used together with AVR-Libc.
18577 See the @option{--with-avrlibc} configure option.
18578
18579 @end table
18580
18581 @node Blackfin Options
18582 @subsection Blackfin Options
18583 @cindex Blackfin Options
18584
18585 @table @gcctabopt
18586 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18587 @opindex mcpu=
18588 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18589 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18590 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18591 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18592 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18593 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18594 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18595 @samp{bf561}, @samp{bf592}.
18596
18597 The optional @var{sirevision} specifies the silicon revision of the target
18598 Blackfin processor. Any workarounds available for the targeted silicon revision
18599 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18600 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18601 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18602 hexadecimal digits representing the major and minor numbers in the silicon
18603 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18604 is not defined. If @var{sirevision} is @samp{any}, the
18605 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18606 If this optional @var{sirevision} is not used, GCC assumes the latest known
18607 silicon revision of the targeted Blackfin processor.
18608
18609 GCC defines a preprocessor macro for the specified @var{cpu}.
18610 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18611 provided by libgloss to be linked in if @option{-msim} is not given.
18612
18613 Without this option, @samp{bf532} is used as the processor by default.
18614
18615 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18616 only the preprocessor macro is defined.
18617
18618 @item -msim
18619 @opindex msim
18620 Specifies that the program will be run on the simulator. This causes
18621 the simulator BSP provided by libgloss to be linked in. This option
18622 has effect only for @samp{bfin-elf} toolchain.
18623 Certain other options, such as @option{-mid-shared-library} and
18624 @option{-mfdpic}, imply @option{-msim}.
18625
18626 @item -momit-leaf-frame-pointer
18627 @opindex momit-leaf-frame-pointer
18628 Don't keep the frame pointer in a register for leaf functions. This
18629 avoids the instructions to save, set up and restore frame pointers and
18630 makes an extra register available in leaf functions.
18631
18632 @item -mspecld-anomaly
18633 @opindex mspecld-anomaly
18634 When enabled, the compiler ensures that the generated code does not
18635 contain speculative loads after jump instructions. If this option is used,
18636 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18637
18638 @item -mno-specld-anomaly
18639 @opindex mno-specld-anomaly
18640 @opindex mspecld-anomaly
18641 Don't generate extra code to prevent speculative loads from occurring.
18642
18643 @item -mcsync-anomaly
18644 @opindex mcsync-anomaly
18645 When enabled, the compiler ensures that the generated code does not
18646 contain CSYNC or SSYNC instructions too soon after conditional branches.
18647 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18648
18649 @item -mno-csync-anomaly
18650 @opindex mno-csync-anomaly
18651 @opindex mcsync-anomaly
18652 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18653 occurring too soon after a conditional branch.
18654
18655 @item -mlow64k
18656 @opindex mlow64k
18657 When enabled, the compiler is free to take advantage of the knowledge that
18658 the entire program fits into the low 64k of memory.
18659
18660 @item -mno-low64k
18661 @opindex mno-low64k
18662 Assume that the program is arbitrarily large. This is the default.
18663
18664 @item -mstack-check-l1
18665 @opindex mstack-check-l1
18666 Do stack checking using information placed into L1 scratchpad memory by the
18667 uClinux kernel.
18668
18669 @item -mid-shared-library
18670 @opindex mid-shared-library
18671 Generate code that supports shared libraries via the library ID method.
18672 This allows for execute in place and shared libraries in an environment
18673 without virtual memory management. This option implies @option{-fPIC}.
18674 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18675
18676 @item -mno-id-shared-library
18677 @opindex mno-id-shared-library
18678 @opindex mid-shared-library
18679 Generate code that doesn't assume ID-based shared libraries are being used.
18680 This is the default.
18681
18682 @item -mleaf-id-shared-library
18683 @opindex mleaf-id-shared-library
18684 Generate code that supports shared libraries via the library ID method,
18685 but assumes that this library or executable won't link against any other
18686 ID shared libraries. That allows the compiler to use faster code for jumps
18687 and calls.
18688
18689 @item -mno-leaf-id-shared-library
18690 @opindex mno-leaf-id-shared-library
18691 @opindex mleaf-id-shared-library
18692 Do not assume that the code being compiled won't link against any ID shared
18693 libraries. Slower code is generated for jump and call insns.
18694
18695 @item -mshared-library-id=n
18696 @opindex mshared-library-id
18697 Specifies the identification number of the ID-based shared library being
18698 compiled. Specifying a value of 0 generates more compact code; specifying
18699 other values forces the allocation of that number to the current
18700 library but is no more space- or time-efficient than omitting this option.
18701
18702 @item -msep-data
18703 @opindex msep-data
18704 Generate code that allows the data segment to be located in a different
18705 area of memory from the text segment. This allows for execute in place in
18706 an environment without virtual memory management by eliminating relocations
18707 against the text section.
18708
18709 @item -mno-sep-data
18710 @opindex mno-sep-data
18711 @opindex msep-data
18712 Generate code that assumes that the data segment follows the text segment.
18713 This is the default.
18714
18715 @item -mlong-calls
18716 @itemx -mno-long-calls
18717 @opindex mlong-calls
18718 @opindex mno-long-calls
18719 Tells the compiler to perform function calls by first loading the
18720 address of the function into a register and then performing a subroutine
18721 call on this register. This switch is needed if the target function
18722 lies outside of the 24-bit addressing range of the offset-based
18723 version of subroutine call instruction.
18724
18725 This feature is not enabled by default. Specifying
18726 @option{-mno-long-calls} restores the default behavior. Note these
18727 switches have no effect on how the compiler generates code to handle
18728 function calls via function pointers.
18729
18730 @item -mfast-fp
18731 @opindex mfast-fp
18732 Link with the fast floating-point library. This library relaxes some of
18733 the IEEE floating-point standard's rules for checking inputs against
18734 Not-a-Number (NAN), in the interest of performance.
18735
18736 @item -minline-plt
18737 @opindex minline-plt
18738 Enable inlining of PLT entries in function calls to functions that are
18739 not known to bind locally. It has no effect without @option{-mfdpic}.
18740
18741 @item -mmulticore
18742 @opindex mmulticore
18743 Build a standalone application for multicore Blackfin processors.
18744 This option causes proper start files and link scripts supporting
18745 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18746 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18747
18748 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18749 selects the one-application-per-core programming model. Without
18750 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18751 programming model is used. In this model, the main function of Core B
18752 should be named as @code{coreb_main}.
18753
18754 If this option is not used, the single-core application programming
18755 model is used.
18756
18757 @item -mcorea
18758 @opindex mcorea
18759 Build a standalone application for Core A of BF561 when using
18760 the one-application-per-core programming model. Proper start files
18761 and link scripts are used to support Core A, and the macro
18762 @code{__BFIN_COREA} is defined.
18763 This option can only be used in conjunction with @option{-mmulticore}.
18764
18765 @item -mcoreb
18766 @opindex mcoreb
18767 Build a standalone application for Core B of BF561 when using
18768 the one-application-per-core programming model. Proper start files
18769 and link scripts are used to support Core B, and the macro
18770 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18771 should be used instead of @code{main}.
18772 This option can only be used in conjunction with @option{-mmulticore}.
18773
18774 @item -msdram
18775 @opindex msdram
18776 Build a standalone application for SDRAM. Proper start files and
18777 link scripts are used to put the application into SDRAM, and the macro
18778 @code{__BFIN_SDRAM} is defined.
18779 The loader should initialize SDRAM before loading the application.
18780
18781 @item -micplb
18782 @opindex micplb
18783 Assume that ICPLBs are enabled at run time. This has an effect on certain
18784 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18785 are enabled; for standalone applications the default is off.
18786 @end table
18787
18788 @node C6X Options
18789 @subsection C6X Options
18790 @cindex C6X Options
18791
18792 @table @gcctabopt
18793 @item -march=@var{name}
18794 @opindex march
18795 This specifies the name of the target architecture. GCC uses this
18796 name to determine what kind of instructions it can emit when generating
18797 assembly code. Permissible names are: @samp{c62x},
18798 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18799
18800 @item -mbig-endian
18801 @opindex mbig-endian
18802 Generate code for a big-endian target.
18803
18804 @item -mlittle-endian
18805 @opindex mlittle-endian
18806 Generate code for a little-endian target. This is the default.
18807
18808 @item -msim
18809 @opindex msim
18810 Choose startup files and linker script suitable for the simulator.
18811
18812 @item -msdata=default
18813 @opindex msdata=default
18814 Put small global and static data in the @code{.neardata} section,
18815 which is pointed to by register @code{B14}. Put small uninitialized
18816 global and static data in the @code{.bss} section, which is adjacent
18817 to the @code{.neardata} section. Put small read-only data into the
18818 @code{.rodata} section. The corresponding sections used for large
18819 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18820
18821 @item -msdata=all
18822 @opindex msdata=all
18823 Put all data, not just small objects, into the sections reserved for
18824 small data, and use addressing relative to the @code{B14} register to
18825 access them.
18826
18827 @item -msdata=none
18828 @opindex msdata=none
18829 Make no use of the sections reserved for small data, and use absolute
18830 addresses to access all data. Put all initialized global and static
18831 data in the @code{.fardata} section, and all uninitialized data in the
18832 @code{.far} section. Put all constant data into the @code{.const}
18833 section.
18834 @end table
18835
18836 @node CRIS Options
18837 @subsection CRIS Options
18838 @cindex CRIS Options
18839
18840 These options are defined specifically for the CRIS ports.
18841
18842 @table @gcctabopt
18843 @item -march=@var{architecture-type}
18844 @itemx -mcpu=@var{architecture-type}
18845 @opindex march
18846 @opindex mcpu
18847 Generate code for the specified architecture. The choices for
18848 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18849 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18850 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18851 @samp{v10}.
18852
18853 @item -mtune=@var{architecture-type}
18854 @opindex mtune
18855 Tune to @var{architecture-type} everything applicable about the generated
18856 code, except for the ABI and the set of available instructions. The
18857 choices for @var{architecture-type} are the same as for
18858 @option{-march=@var{architecture-type}}.
18859
18860 @item -mmax-stack-frame=@var{n}
18861 @opindex mmax-stack-frame
18862 Warn when the stack frame of a function exceeds @var{n} bytes.
18863
18864 @item -metrax4
18865 @itemx -metrax100
18866 @opindex metrax4
18867 @opindex metrax100
18868 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18869 @option{-march=v3} and @option{-march=v8} respectively.
18870
18871 @item -mmul-bug-workaround
18872 @itemx -mno-mul-bug-workaround
18873 @opindex mmul-bug-workaround
18874 @opindex mno-mul-bug-workaround
18875 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18876 models where it applies. This option is active by default.
18877
18878 @item -mpdebug
18879 @opindex mpdebug
18880 Enable CRIS-specific verbose debug-related information in the assembly
18881 code. This option also has the effect of turning off the @samp{#NO_APP}
18882 formatted-code indicator to the assembler at the beginning of the
18883 assembly file.
18884
18885 @item -mcc-init
18886 @opindex mcc-init
18887 Do not use condition-code results from previous instruction; always emit
18888 compare and test instructions before use of condition codes.
18889
18890 @item -mno-side-effects
18891 @opindex mno-side-effects
18892 @opindex mside-effects
18893 Do not emit instructions with side effects in addressing modes other than
18894 post-increment.
18895
18896 @item -mstack-align
18897 @itemx -mno-stack-align
18898 @itemx -mdata-align
18899 @itemx -mno-data-align
18900 @itemx -mconst-align
18901 @itemx -mno-const-align
18902 @opindex mstack-align
18903 @opindex mno-stack-align
18904 @opindex mdata-align
18905 @opindex mno-data-align
18906 @opindex mconst-align
18907 @opindex mno-const-align
18908 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18909 stack frame, individual data and constants to be aligned for the maximum
18910 single data access size for the chosen CPU model. The default is to
18911 arrange for 32-bit alignment. ABI details such as structure layout are
18912 not affected by these options.
18913
18914 @item -m32-bit
18915 @itemx -m16-bit
18916 @itemx -m8-bit
18917 @opindex m32-bit
18918 @opindex m16-bit
18919 @opindex m8-bit
18920 Similar to the stack- data- and const-align options above, these options
18921 arrange for stack frame, writable data and constants to all be 32-bit,
18922 16-bit or 8-bit aligned. The default is 32-bit alignment.
18923
18924 @item -mno-prologue-epilogue
18925 @itemx -mprologue-epilogue
18926 @opindex mno-prologue-epilogue
18927 @opindex mprologue-epilogue
18928 With @option{-mno-prologue-epilogue}, the normal function prologue and
18929 epilogue which set up the stack frame are omitted and no return
18930 instructions or return sequences are generated in the code. Use this
18931 option only together with visual inspection of the compiled code: no
18932 warnings or errors are generated when call-saved registers must be saved,
18933 or storage for local variables needs to be allocated.
18934
18935 @item -mno-gotplt
18936 @itemx -mgotplt
18937 @opindex mno-gotplt
18938 @opindex mgotplt
18939 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18940 instruction sequences that load addresses for functions from the PLT part
18941 of the GOT rather than (traditional on other architectures) calls to the
18942 PLT@. The default is @option{-mgotplt}.
18943
18944 @item -melf
18945 @opindex melf
18946 Legacy no-op option only recognized with the cris-axis-elf and
18947 cris-axis-linux-gnu targets.
18948
18949 @item -mlinux
18950 @opindex mlinux
18951 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18952
18953 @item -sim
18954 @opindex sim
18955 This option, recognized for the cris-axis-elf, arranges
18956 to link with input-output functions from a simulator library. Code,
18957 initialized data and zero-initialized data are allocated consecutively.
18958
18959 @item -sim2
18960 @opindex sim2
18961 Like @option{-sim}, but pass linker options to locate initialized data at
18962 0x40000000 and zero-initialized data at 0x80000000.
18963 @end table
18964
18965 @node CR16 Options
18966 @subsection CR16 Options
18967 @cindex CR16 Options
18968
18969 These options are defined specifically for the CR16 ports.
18970
18971 @table @gcctabopt
18972
18973 @item -mmac
18974 @opindex mmac
18975 Enable the use of multiply-accumulate instructions. Disabled by default.
18976
18977 @item -mcr16cplus
18978 @itemx -mcr16c
18979 @opindex mcr16cplus
18980 @opindex mcr16c
18981 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18982 is default.
18983
18984 @item -msim
18985 @opindex msim
18986 Links the library libsim.a which is in compatible with simulator. Applicable
18987 to ELF compiler only.
18988
18989 @item -mint32
18990 @opindex mint32
18991 Choose integer type as 32-bit wide.
18992
18993 @item -mbit-ops
18994 @opindex mbit-ops
18995 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18996
18997 @item -mdata-model=@var{model}
18998 @opindex mdata-model
18999 Choose a data model. The choices for @var{model} are @samp{near},
19000 @samp{far} or @samp{medium}. @samp{medium} is default.
19001 However, @samp{far} is not valid with @option{-mcr16c}, as the
19002 CR16C architecture does not support the far data model.
19003 @end table
19004
19005 @node C-SKY Options
19006 @subsection C-SKY Options
19007 @cindex C-SKY Options
19008
19009 GCC supports these options when compiling for C-SKY V2 processors.
19010
19011 @table @gcctabopt
19012
19013 @item -march=@var{arch}
19014 @opindex march=
19015 Specify the C-SKY target architecture. Valid values for @var{arch} are:
19016 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
19017 The default is @samp{ck810}.
19018
19019 @item -mcpu=@var{cpu}
19020 @opindex mcpu=
19021 Specify the C-SKY target processor. Valid values for @var{cpu} are:
19022 @samp{ck801}, @samp{ck801t},
19023 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
19024 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
19025 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
19026 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
19027 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
19028 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
19029 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
19030 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
19031 @samp{ck803eftr1}, @samp{ck803efhtr1},
19032 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
19033 @samp{ck803sef}, @samp{ck803seft},
19034 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
19035 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
19036 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
19037 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
19038
19039 @item -mbig-endian
19040 @opindex mbig-endian
19041 @itemx -EB
19042 @opindex EB
19043 @itemx -mlittle-endian
19044 @opindex mlittle-endian
19045 @itemx -EL
19046 @opindex EL
19047
19048 Select big- or little-endian code. The default is little-endian.
19049
19050 @item -mhard-float
19051 @opindex mhard-float
19052 @itemx -msoft-float
19053 @opindex msoft-float
19054
19055 Select hardware or software floating-point implementations.
19056 The default is soft float.
19057
19058 @item -mdouble-float
19059 @itemx -mno-double-float
19060 @opindex mdouble-float
19061 When @option{-mhard-float} is in effect, enable generation of
19062 double-precision float instructions. This is the default except
19063 when compiling for CK803.
19064
19065 @item -mfdivdu
19066 @itemx -mno-fdivdu
19067 @opindex mfdivdu
19068 When @option{-mhard-float} is in effect, enable generation of
19069 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19070 This is the default except when compiling for CK803.
19071
19072 @item -mfpu=@var{fpu}
19073 @opindex mfpu=
19074 Select the floating-point processor. This option can only be used with
19075 @option{-mhard-float}.
19076 Values for @var{fpu} are
19077 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19078 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19079 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19080
19081 @item -melrw
19082 @itemx -mno-elrw
19083 @opindex melrw
19084 Enable the extended @code{lrw} instruction. This option defaults to on
19085 for CK801 and off otherwise.
19086
19087 @item -mistack
19088 @itemx -mno-istack
19089 @opindex mistack
19090 Enable interrupt stack instructions; the default is off.
19091
19092 The @option{-mistack} option is required to handle the
19093 @code{interrupt} and @code{isr} function attributes
19094 (@pxref{C-SKY Function Attributes}).
19095
19096 @item -mmp
19097 @opindex mmp
19098 Enable multiprocessor instructions; the default is off.
19099
19100 @item -mcp
19101 @opindex mcp
19102 Enable coprocessor instructions; the default is off.
19103
19104 @item -mcache
19105 @opindex mcache
19106 Enable coprocessor instructions; the default is off.
19107
19108 @item -msecurity
19109 @opindex msecurity
19110 Enable C-SKY security instructions; the default is off.
19111
19112 @item -mtrust
19113 @opindex mtrust
19114 Enable C-SKY trust instructions; the default is off.
19115
19116 @item -mdsp
19117 @opindex mdsp
19118 @itemx -medsp
19119 @opindex medsp
19120 @itemx -mvdsp
19121 @opindex mvdsp
19122 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19123 All of these options default to off.
19124
19125 @item -mdiv
19126 @itemx -mno-div
19127 @opindex mdiv
19128 Generate divide instructions. Default is off.
19129
19130 @item -msmart
19131 @itemx -mno-smart
19132 @opindex msmart
19133 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19134 use of 16-bit instructions. This option is ignored for CK801 where this
19135 is the required behavior, and it defaults to on for CK802.
19136 For other targets, the default is off.
19137
19138 @item -mhigh-registers
19139 @itemx -mno-high-registers
19140 @opindex mhigh-registers
19141 Generate code using the high registers numbered 16-31. This option
19142 is not supported on CK801, CK802, or CK803, and is enabled by default
19143 for other processors.
19144
19145 @item -manchor
19146 @itemx -mno-anchor
19147 @opindex manchor
19148 Generate code using global anchor symbol addresses.
19149
19150 @item -mpushpop
19151 @itemx -mno-pushpop
19152 @opindex mpushpop
19153 Generate code using @code{push} and @code{pop} instructions. This option
19154 defaults to on.
19155
19156 @item -mmultiple-stld
19157 @itemx -mstm
19158 @itemx -mno-multiple-stld
19159 @itemx -mno-stm
19160 @opindex mmultiple-stld
19161 Generate code using @code{stm} and @code{ldm} instructions. This option
19162 isn't supported on CK801 but is enabled by default on other processors.
19163
19164 @item -mconstpool
19165 @itemx -mno-constpool
19166 @opindex mconstpool
19167 Create constant pools in the compiler instead of deferring it to the
19168 assembler. This option is the default and required for correct code
19169 generation on CK801 and CK802, and is optional on other processors.
19170
19171 @item -mstack-size
19172 @item -mno-stack-size
19173 @opindex mstack-size
19174 Emit @code{.stack_size} directives for each function in the assembly
19175 output. This option defaults to off.
19176
19177 @item -mccrt
19178 @itemx -mno-ccrt
19179 @opindex mccrt
19180 Generate code for the C-SKY compiler runtime instead of libgcc. This
19181 option defaults to off.
19182
19183 @item -mbranch-cost=@var{n}
19184 @opindex mbranch-cost=
19185 Set the branch costs to roughly @code{n} instructions. The default is 1.
19186
19187 @item -msched-prolog
19188 @itemx -mno-sched-prolog
19189 @opindex msched-prolog
19190 Permit scheduling of function prologue and epilogue sequences. Using
19191 this option can result in code that is not compliant with the C-SKY V2 ABI
19192 prologue requirements and that cannot be debugged or backtraced.
19193 It is disabled by default.
19194
19195 @end table
19196
19197 @node Darwin Options
19198 @subsection Darwin Options
19199 @cindex Darwin options
19200
19201 These options are defined for all architectures running the Darwin operating
19202 system.
19203
19204 FSF GCC on Darwin does not create ``fat'' object files; it creates
19205 an object file for the single architecture that GCC was built to
19206 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19207 @option{-arch} options are used; it does so by running the compiler or
19208 linker multiple times and joining the results together with
19209 @file{lipo}.
19210
19211 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19212 @samp{i686}) is determined by the flags that specify the ISA
19213 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19214 @option{-force_cpusubtype_ALL} option can be used to override this.
19215
19216 The Darwin tools vary in their behavior when presented with an ISA
19217 mismatch. The assembler, @file{as}, only permits instructions to
19218 be used that are valid for the subtype of the file it is generating,
19219 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19220 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19221 and prints an error if asked to create a shared library with a less
19222 restrictive subtype than its input files (for instance, trying to put
19223 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19224 for executables, @command{ld}, quietly gives the executable the most
19225 restrictive subtype of any of its input files.
19226
19227 @table @gcctabopt
19228 @item -F@var{dir}
19229 @opindex F
19230 Add the framework directory @var{dir} to the head of the list of
19231 directories to be searched for header files. These directories are
19232 interleaved with those specified by @option{-I} options and are
19233 scanned in a left-to-right order.
19234
19235 A framework directory is a directory with frameworks in it. A
19236 framework is a directory with a @file{Headers} and/or
19237 @file{PrivateHeaders} directory contained directly in it that ends
19238 in @file{.framework}. The name of a framework is the name of this
19239 directory excluding the @file{.framework}. Headers associated with
19240 the framework are found in one of those two directories, with
19241 @file{Headers} being searched first. A subframework is a framework
19242 directory that is in a framework's @file{Frameworks} directory.
19243 Includes of subframework headers can only appear in a header of a
19244 framework that contains the subframework, or in a sibling subframework
19245 header. Two subframeworks are siblings if they occur in the same
19246 framework. A subframework should not have the same name as a
19247 framework; a warning is issued if this is violated. Currently a
19248 subframework cannot have subframeworks; in the future, the mechanism
19249 may be extended to support this. The standard frameworks can be found
19250 in @file{/System/Library/Frameworks} and
19251 @file{/Library/Frameworks}. An example include looks like
19252 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19253 the name of the framework and @file{header.h} is found in the
19254 @file{PrivateHeaders} or @file{Headers} directory.
19255
19256 @item -iframework@var{dir}
19257 @opindex iframework
19258 Like @option{-F} except the directory is a treated as a system
19259 directory. The main difference between this @option{-iframework} and
19260 @option{-F} is that with @option{-iframework} the compiler does not
19261 warn about constructs contained within header files found via
19262 @var{dir}. This option is valid only for the C family of languages.
19263
19264 @item -gused
19265 @opindex gused
19266 Emit debugging information for symbols that are used. For stabs
19267 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19268 This is by default ON@.
19269
19270 @item -gfull
19271 @opindex gfull
19272 Emit debugging information for all symbols and types.
19273
19274 @item -mmacosx-version-min=@var{version}
19275 The earliest version of MacOS X that this executable will run on
19276 is @var{version}. Typical values of @var{version} include @code{10.1},
19277 @code{10.2}, and @code{10.3.9}.
19278
19279 If the compiler was built to use the system's headers by default,
19280 then the default for this option is the system version on which the
19281 compiler is running, otherwise the default is to make choices that
19282 are compatible with as many systems and code bases as possible.
19283
19284 @item -mkernel
19285 @opindex mkernel
19286 Enable kernel development mode. The @option{-mkernel} option sets
19287 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19288 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19289 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19290 applicable. This mode also sets @option{-mno-altivec},
19291 @option{-msoft-float}, @option{-fno-builtin} and
19292 @option{-mlong-branch} for PowerPC targets.
19293
19294 @item -mone-byte-bool
19295 @opindex mone-byte-bool
19296 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19297 By default @code{sizeof(bool)} is @code{4} when compiling for
19298 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19299 option has no effect on x86.
19300
19301 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19302 to generate code that is not binary compatible with code generated
19303 without that switch. Using this switch may require recompiling all
19304 other modules in a program, including system libraries. Use this
19305 switch to conform to a non-default data model.
19306
19307 @item -mfix-and-continue
19308 @itemx -ffix-and-continue
19309 @itemx -findirect-data
19310 @opindex mfix-and-continue
19311 @opindex ffix-and-continue
19312 @opindex findirect-data
19313 Generate code suitable for fast turnaround development, such as to
19314 allow GDB to dynamically load @file{.o} files into already-running
19315 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19316 are provided for backwards compatibility.
19317
19318 @item -all_load
19319 @opindex all_load
19320 Loads all members of static archive libraries.
19321 See man ld(1) for more information.
19322
19323 @item -arch_errors_fatal
19324 @opindex arch_errors_fatal
19325 Cause the errors having to do with files that have the wrong architecture
19326 to be fatal.
19327
19328 @item -bind_at_load
19329 @opindex bind_at_load
19330 Causes the output file to be marked such that the dynamic linker will
19331 bind all undefined references when the file is loaded or launched.
19332
19333 @item -bundle
19334 @opindex bundle
19335 Produce a Mach-o bundle format file.
19336 See man ld(1) for more information.
19337
19338 @item -bundle_loader @var{executable}
19339 @opindex bundle_loader
19340 This option specifies the @var{executable} that will load the build
19341 output file being linked. See man ld(1) for more information.
19342
19343 @item -dynamiclib
19344 @opindex dynamiclib
19345 When passed this option, GCC produces a dynamic library instead of
19346 an executable when linking, using the Darwin @file{libtool} command.
19347
19348 @item -force_cpusubtype_ALL
19349 @opindex force_cpusubtype_ALL
19350 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19351 one controlled by the @option{-mcpu} or @option{-march} option.
19352
19353 @item -allowable_client @var{client_name}
19354 @itemx -client_name
19355 @itemx -compatibility_version
19356 @itemx -current_version
19357 @itemx -dead_strip
19358 @itemx -dependency-file
19359 @itemx -dylib_file
19360 @itemx -dylinker_install_name
19361 @itemx -dynamic
19362 @itemx -exported_symbols_list
19363 @itemx -filelist
19364 @need 800
19365 @itemx -flat_namespace
19366 @itemx -force_flat_namespace
19367 @itemx -headerpad_max_install_names
19368 @itemx -image_base
19369 @itemx -init
19370 @itemx -install_name
19371 @itemx -keep_private_externs
19372 @itemx -multi_module
19373 @itemx -multiply_defined
19374 @itemx -multiply_defined_unused
19375 @need 800
19376 @itemx -noall_load
19377 @itemx -no_dead_strip_inits_and_terms
19378 @itemx -nofixprebinding
19379 @itemx -nomultidefs
19380 @itemx -noprebind
19381 @itemx -noseglinkedit
19382 @itemx -pagezero_size
19383 @itemx -prebind
19384 @itemx -prebind_all_twolevel_modules
19385 @itemx -private_bundle
19386 @need 800
19387 @itemx -read_only_relocs
19388 @itemx -sectalign
19389 @itemx -sectobjectsymbols
19390 @itemx -whyload
19391 @itemx -seg1addr
19392 @itemx -sectcreate
19393 @itemx -sectobjectsymbols
19394 @itemx -sectorder
19395 @itemx -segaddr
19396 @itemx -segs_read_only_addr
19397 @need 800
19398 @itemx -segs_read_write_addr
19399 @itemx -seg_addr_table
19400 @itemx -seg_addr_table_filename
19401 @itemx -seglinkedit
19402 @itemx -segprot
19403 @itemx -segs_read_only_addr
19404 @itemx -segs_read_write_addr
19405 @itemx -single_module
19406 @itemx -static
19407 @itemx -sub_library
19408 @need 800
19409 @itemx -sub_umbrella
19410 @itemx -twolevel_namespace
19411 @itemx -umbrella
19412 @itemx -undefined
19413 @itemx -unexported_symbols_list
19414 @itemx -weak_reference_mismatches
19415 @itemx -whatsloaded
19416 @opindex allowable_client
19417 @opindex client_name
19418 @opindex compatibility_version
19419 @opindex current_version
19420 @opindex dead_strip
19421 @opindex dependency-file
19422 @opindex dylib_file
19423 @opindex dylinker_install_name
19424 @opindex dynamic
19425 @opindex exported_symbols_list
19426 @opindex filelist
19427 @opindex flat_namespace
19428 @opindex force_flat_namespace
19429 @opindex headerpad_max_install_names
19430 @opindex image_base
19431 @opindex init
19432 @opindex install_name
19433 @opindex keep_private_externs
19434 @opindex multi_module
19435 @opindex multiply_defined
19436 @opindex multiply_defined_unused
19437 @opindex noall_load
19438 @opindex no_dead_strip_inits_and_terms
19439 @opindex nofixprebinding
19440 @opindex nomultidefs
19441 @opindex noprebind
19442 @opindex noseglinkedit
19443 @opindex pagezero_size
19444 @opindex prebind
19445 @opindex prebind_all_twolevel_modules
19446 @opindex private_bundle
19447 @opindex read_only_relocs
19448 @opindex sectalign
19449 @opindex sectobjectsymbols
19450 @opindex whyload
19451 @opindex seg1addr
19452 @opindex sectcreate
19453 @opindex sectobjectsymbols
19454 @opindex sectorder
19455 @opindex segaddr
19456 @opindex segs_read_only_addr
19457 @opindex segs_read_write_addr
19458 @opindex seg_addr_table
19459 @opindex seg_addr_table_filename
19460 @opindex seglinkedit
19461 @opindex segprot
19462 @opindex segs_read_only_addr
19463 @opindex segs_read_write_addr
19464 @opindex single_module
19465 @opindex static
19466 @opindex sub_library
19467 @opindex sub_umbrella
19468 @opindex twolevel_namespace
19469 @opindex umbrella
19470 @opindex undefined
19471 @opindex unexported_symbols_list
19472 @opindex weak_reference_mismatches
19473 @opindex whatsloaded
19474 These options are passed to the Darwin linker. The Darwin linker man page
19475 describes them in detail.
19476 @end table
19477
19478 @node DEC Alpha Options
19479 @subsection DEC Alpha Options
19480
19481 These @samp{-m} options are defined for the DEC Alpha implementations:
19482
19483 @table @gcctabopt
19484 @item -mno-soft-float
19485 @itemx -msoft-float
19486 @opindex mno-soft-float
19487 @opindex msoft-float
19488 Use (do not use) the hardware floating-point instructions for
19489 floating-point operations. When @option{-msoft-float} is specified,
19490 functions in @file{libgcc.a} are used to perform floating-point
19491 operations. Unless they are replaced by routines that emulate the
19492 floating-point operations, or compiled in such a way as to call such
19493 emulations routines, these routines issue floating-point
19494 operations. If you are compiling for an Alpha without floating-point
19495 operations, you must ensure that the library is built so as not to call
19496 them.
19497
19498 Note that Alpha implementations without floating-point operations are
19499 required to have floating-point registers.
19500
19501 @item -mfp-reg
19502 @itemx -mno-fp-regs
19503 @opindex mfp-reg
19504 @opindex mno-fp-regs
19505 Generate code that uses (does not use) the floating-point register set.
19506 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19507 register set is not used, floating-point operands are passed in integer
19508 registers as if they were integers and floating-point results are passed
19509 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19510 so any function with a floating-point argument or return value called by code
19511 compiled with @option{-mno-fp-regs} must also be compiled with that
19512 option.
19513
19514 A typical use of this option is building a kernel that does not use,
19515 and hence need not save and restore, any floating-point registers.
19516
19517 @item -mieee
19518 @opindex mieee
19519 The Alpha architecture implements floating-point hardware optimized for
19520 maximum performance. It is mostly compliant with the IEEE floating-point
19521 standard. However, for full compliance, software assistance is
19522 required. This option generates code fully IEEE-compliant code
19523 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19524 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19525 defined during compilation. The resulting code is less efficient but is
19526 able to correctly support denormalized numbers and exceptional IEEE
19527 values such as not-a-number and plus/minus infinity. Other Alpha
19528 compilers call this option @option{-ieee_with_no_inexact}.
19529
19530 @item -mieee-with-inexact
19531 @opindex mieee-with-inexact
19532 This is like @option{-mieee} except the generated code also maintains
19533 the IEEE @var{inexact-flag}. Turning on this option causes the
19534 generated code to implement fully-compliant IEEE math. In addition to
19535 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19536 macro. On some Alpha implementations the resulting code may execute
19537 significantly slower than the code generated by default. Since there is
19538 very little code that depends on the @var{inexact-flag}, you should
19539 normally not specify this option. Other Alpha compilers call this
19540 option @option{-ieee_with_inexact}.
19541
19542 @item -mfp-trap-mode=@var{trap-mode}
19543 @opindex mfp-trap-mode
19544 This option controls what floating-point related traps are enabled.
19545 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19546 The trap mode can be set to one of four values:
19547
19548 @table @samp
19549 @item n
19550 This is the default (normal) setting. The only traps that are enabled
19551 are the ones that cannot be disabled in software (e.g., division by zero
19552 trap).
19553
19554 @item u
19555 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19556 as well.
19557
19558 @item su
19559 Like @samp{u}, but the instructions are marked to be safe for software
19560 completion (see Alpha architecture manual for details).
19561
19562 @item sui
19563 Like @samp{su}, but inexact traps are enabled as well.
19564 @end table
19565
19566 @item -mfp-rounding-mode=@var{rounding-mode}
19567 @opindex mfp-rounding-mode
19568 Selects the IEEE rounding mode. Other Alpha compilers call this option
19569 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19570 of:
19571
19572 @table @samp
19573 @item n
19574 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19575 the nearest machine number or towards the even machine number in case
19576 of a tie.
19577
19578 @item m
19579 Round towards minus infinity.
19580
19581 @item c
19582 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19583
19584 @item d
19585 Dynamic rounding mode. A field in the floating-point control register
19586 (@var{fpcr}, see Alpha architecture reference manual) controls the
19587 rounding mode in effect. The C library initializes this register for
19588 rounding towards plus infinity. Thus, unless your program modifies the
19589 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19590 @end table
19591
19592 @item -mtrap-precision=@var{trap-precision}
19593 @opindex mtrap-precision
19594 In the Alpha architecture, floating-point traps are imprecise. This
19595 means without software assistance it is impossible to recover from a
19596 floating trap and program execution normally needs to be terminated.
19597 GCC can generate code that can assist operating system trap handlers
19598 in determining the exact location that caused a floating-point trap.
19599 Depending on the requirements of an application, different levels of
19600 precisions can be selected:
19601
19602 @table @samp
19603 @item p
19604 Program precision. This option is the default and means a trap handler
19605 can only identify which program caused a floating-point exception.
19606
19607 @item f
19608 Function precision. The trap handler can determine the function that
19609 caused a floating-point exception.
19610
19611 @item i
19612 Instruction precision. The trap handler can determine the exact
19613 instruction that caused a floating-point exception.
19614 @end table
19615
19616 Other Alpha compilers provide the equivalent options called
19617 @option{-scope_safe} and @option{-resumption_safe}.
19618
19619 @item -mieee-conformant
19620 @opindex mieee-conformant
19621 This option marks the generated code as IEEE conformant. You must not
19622 use this option unless you also specify @option{-mtrap-precision=i} and either
19623 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19624 is to emit the line @samp{.eflag 48} in the function prologue of the
19625 generated assembly file.
19626
19627 @item -mbuild-constants
19628 @opindex mbuild-constants
19629 Normally GCC examines a 32- or 64-bit integer constant to
19630 see if it can construct it from smaller constants in two or three
19631 instructions. If it cannot, it outputs the constant as a literal and
19632 generates code to load it from the data segment at run time.
19633
19634 Use this option to require GCC to construct @emph{all} integer constants
19635 using code, even if it takes more instructions (the maximum is six).
19636
19637 You typically use this option to build a shared library dynamic
19638 loader. Itself a shared library, it must relocate itself in memory
19639 before it can find the variables and constants in its own data segment.
19640
19641 @item -mbwx
19642 @itemx -mno-bwx
19643 @itemx -mcix
19644 @itemx -mno-cix
19645 @itemx -mfix
19646 @itemx -mno-fix
19647 @itemx -mmax
19648 @itemx -mno-max
19649 @opindex mbwx
19650 @opindex mno-bwx
19651 @opindex mcix
19652 @opindex mno-cix
19653 @opindex mfix
19654 @opindex mno-fix
19655 @opindex mmax
19656 @opindex mno-max
19657 Indicate whether GCC should generate code to use the optional BWX,
19658 CIX, FIX and MAX instruction sets. The default is to use the instruction
19659 sets supported by the CPU type specified via @option{-mcpu=} option or that
19660 of the CPU on which GCC was built if none is specified.
19661
19662 @item -mfloat-vax
19663 @itemx -mfloat-ieee
19664 @opindex mfloat-vax
19665 @opindex mfloat-ieee
19666 Generate code that uses (does not use) VAX F and G floating-point
19667 arithmetic instead of IEEE single and double precision.
19668
19669 @item -mexplicit-relocs
19670 @itemx -mno-explicit-relocs
19671 @opindex mexplicit-relocs
19672 @opindex mno-explicit-relocs
19673 Older Alpha assemblers provided no way to generate symbol relocations
19674 except via assembler macros. Use of these macros does not allow
19675 optimal instruction scheduling. GNU binutils as of version 2.12
19676 supports a new syntax that allows the compiler to explicitly mark
19677 which relocations should apply to which instructions. This option
19678 is mostly useful for debugging, as GCC detects the capabilities of
19679 the assembler when it is built and sets the default accordingly.
19680
19681 @item -msmall-data
19682 @itemx -mlarge-data
19683 @opindex msmall-data
19684 @opindex mlarge-data
19685 When @option{-mexplicit-relocs} is in effect, static data is
19686 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19687 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19688 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19689 16-bit relocations off of the @code{$gp} register. This limits the
19690 size of the small data area to 64KB, but allows the variables to be
19691 directly accessed via a single instruction.
19692
19693 The default is @option{-mlarge-data}. With this option the data area
19694 is limited to just below 2GB@. Programs that require more than 2GB of
19695 data must use @code{malloc} or @code{mmap} to allocate the data in the
19696 heap instead of in the program's data segment.
19697
19698 When generating code for shared libraries, @option{-fpic} implies
19699 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19700
19701 @item -msmall-text
19702 @itemx -mlarge-text
19703 @opindex msmall-text
19704 @opindex mlarge-text
19705 When @option{-msmall-text} is used, the compiler assumes that the
19706 code of the entire program (or shared library) fits in 4MB, and is
19707 thus reachable with a branch instruction. When @option{-msmall-data}
19708 is used, the compiler can assume that all local symbols share the
19709 same @code{$gp} value, and thus reduce the number of instructions
19710 required for a function call from 4 to 1.
19711
19712 The default is @option{-mlarge-text}.
19713
19714 @item -mcpu=@var{cpu_type}
19715 @opindex mcpu
19716 Set the instruction set and instruction scheduling parameters for
19717 machine type @var{cpu_type}. You can specify either the @samp{EV}
19718 style name or the corresponding chip number. GCC supports scheduling
19719 parameters for the EV4, EV5 and EV6 family of processors and
19720 chooses the default values for the instruction set from the processor
19721 you specify. If you do not specify a processor type, GCC defaults
19722 to the processor on which the compiler was built.
19723
19724 Supported values for @var{cpu_type} are
19725
19726 @table @samp
19727 @item ev4
19728 @itemx ev45
19729 @itemx 21064
19730 Schedules as an EV4 and has no instruction set extensions.
19731
19732 @item ev5
19733 @itemx 21164
19734 Schedules as an EV5 and has no instruction set extensions.
19735
19736 @item ev56
19737 @itemx 21164a
19738 Schedules as an EV5 and supports the BWX extension.
19739
19740 @item pca56
19741 @itemx 21164pc
19742 @itemx 21164PC
19743 Schedules as an EV5 and supports the BWX and MAX extensions.
19744
19745 @item ev6
19746 @itemx 21264
19747 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19748
19749 @item ev67
19750 @itemx 21264a
19751 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19752 @end table
19753
19754 Native toolchains also support the value @samp{native},
19755 which selects the best architecture option for the host processor.
19756 @option{-mcpu=native} has no effect if GCC does not recognize
19757 the processor.
19758
19759 @item -mtune=@var{cpu_type}
19760 @opindex mtune
19761 Set only the instruction scheduling parameters for machine type
19762 @var{cpu_type}. The instruction set is not changed.
19763
19764 Native toolchains also support the value @samp{native},
19765 which selects the best architecture option for the host processor.
19766 @option{-mtune=native} has no effect if GCC does not recognize
19767 the processor.
19768
19769 @item -mmemory-latency=@var{time}
19770 @opindex mmemory-latency
19771 Sets the latency the scheduler should assume for typical memory
19772 references as seen by the application. This number is highly
19773 dependent on the memory access patterns used by the application
19774 and the size of the external cache on the machine.
19775
19776 Valid options for @var{time} are
19777
19778 @table @samp
19779 @item @var{number}
19780 A decimal number representing clock cycles.
19781
19782 @item L1
19783 @itemx L2
19784 @itemx L3
19785 @itemx main
19786 The compiler contains estimates of the number of clock cycles for
19787 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19788 (also called Dcache, Scache, and Bcache), as well as to main memory.
19789 Note that L3 is only valid for EV5.
19790
19791 @end table
19792 @end table
19793
19794 @node FR30 Options
19795 @subsection FR30 Options
19796 @cindex FR30 Options
19797
19798 These options are defined specifically for the FR30 port.
19799
19800 @table @gcctabopt
19801
19802 @item -msmall-model
19803 @opindex msmall-model
19804 Use the small address space model. This can produce smaller code, but
19805 it does assume that all symbolic values and addresses fit into a
19806 20-bit range.
19807
19808 @item -mno-lsim
19809 @opindex mno-lsim
19810 Assume that runtime support has been provided and so there is no need
19811 to include the simulator library (@file{libsim.a}) on the linker
19812 command line.
19813
19814 @end table
19815
19816 @node FT32 Options
19817 @subsection FT32 Options
19818 @cindex FT32 Options
19819
19820 These options are defined specifically for the FT32 port.
19821
19822 @table @gcctabopt
19823
19824 @item -msim
19825 @opindex msim
19826 Specifies that the program will be run on the simulator. This causes
19827 an alternate runtime startup and library to be linked.
19828 You must not use this option when generating programs that will run on
19829 real hardware; you must provide your own runtime library for whatever
19830 I/O functions are needed.
19831
19832 @item -mlra
19833 @opindex mlra
19834 Enable Local Register Allocation. This is still experimental for FT32,
19835 so by default the compiler uses standard reload.
19836
19837 @item -mnodiv
19838 @opindex mnodiv
19839 Do not use div and mod instructions.
19840
19841 @item -mft32b
19842 @opindex mft32b
19843 Enable use of the extended instructions of the FT32B processor.
19844
19845 @item -mcompress
19846 @opindex mcompress
19847 Compress all code using the Ft32B code compression scheme.
19848
19849 @item -mnopm
19850 @opindex mnopm
19851 Do not generate code that reads program memory.
19852
19853 @end table
19854
19855 @node FRV Options
19856 @subsection FRV Options
19857 @cindex FRV Options
19858
19859 @table @gcctabopt
19860 @item -mgpr-32
19861 @opindex mgpr-32
19862
19863 Only use the first 32 general-purpose registers.
19864
19865 @item -mgpr-64
19866 @opindex mgpr-64
19867
19868 Use all 64 general-purpose registers.
19869
19870 @item -mfpr-32
19871 @opindex mfpr-32
19872
19873 Use only the first 32 floating-point registers.
19874
19875 @item -mfpr-64
19876 @opindex mfpr-64
19877
19878 Use all 64 floating-point registers.
19879
19880 @item -mhard-float
19881 @opindex mhard-float
19882
19883 Use hardware instructions for floating-point operations.
19884
19885 @item -msoft-float
19886 @opindex msoft-float
19887
19888 Use library routines for floating-point operations.
19889
19890 @item -malloc-cc
19891 @opindex malloc-cc
19892
19893 Dynamically allocate condition code registers.
19894
19895 @item -mfixed-cc
19896 @opindex mfixed-cc
19897
19898 Do not try to dynamically allocate condition code registers, only
19899 use @code{icc0} and @code{fcc0}.
19900
19901 @item -mdword
19902 @opindex mdword
19903
19904 Change ABI to use double word insns.
19905
19906 @item -mno-dword
19907 @opindex mno-dword
19908 @opindex mdword
19909
19910 Do not use double word instructions.
19911
19912 @item -mdouble
19913 @opindex mdouble
19914
19915 Use floating-point double instructions.
19916
19917 @item -mno-double
19918 @opindex mno-double
19919
19920 Do not use floating-point double instructions.
19921
19922 @item -mmedia
19923 @opindex mmedia
19924
19925 Use media instructions.
19926
19927 @item -mno-media
19928 @opindex mno-media
19929
19930 Do not use media instructions.
19931
19932 @item -mmuladd
19933 @opindex mmuladd
19934
19935 Use multiply and add/subtract instructions.
19936
19937 @item -mno-muladd
19938 @opindex mno-muladd
19939
19940 Do not use multiply and add/subtract instructions.
19941
19942 @item -mfdpic
19943 @opindex mfdpic
19944
19945 Select the FDPIC ABI, which uses function descriptors to represent
19946 pointers to functions. Without any PIC/PIE-related options, it
19947 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19948 assumes GOT entries and small data are within a 12-bit range from the
19949 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19950 are computed with 32 bits.
19951 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19952
19953 @item -minline-plt
19954 @opindex minline-plt
19955
19956 Enable inlining of PLT entries in function calls to functions that are
19957 not known to bind locally. It has no effect without @option{-mfdpic}.
19958 It's enabled by default if optimizing for speed and compiling for
19959 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19960 optimization option such as @option{-O3} or above is present in the
19961 command line.
19962
19963 @item -mTLS
19964 @opindex mTLS
19965
19966 Assume a large TLS segment when generating thread-local code.
19967
19968 @item -mtls
19969 @opindex mtls
19970
19971 Do not assume a large TLS segment when generating thread-local code.
19972
19973 @item -mgprel-ro
19974 @opindex mgprel-ro
19975
19976 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19977 that is known to be in read-only sections. It's enabled by default,
19978 except for @option{-fpic} or @option{-fpie}: even though it may help
19979 make the global offset table smaller, it trades 1 instruction for 4.
19980 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19981 one of which may be shared by multiple symbols, and it avoids the need
19982 for a GOT entry for the referenced symbol, so it's more likely to be a
19983 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19984
19985 @item -multilib-library-pic
19986 @opindex multilib-library-pic
19987
19988 Link with the (library, not FD) pic libraries. It's implied by
19989 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19990 @option{-fpic} without @option{-mfdpic}. You should never have to use
19991 it explicitly.
19992
19993 @item -mlinked-fp
19994 @opindex mlinked-fp
19995
19996 Follow the EABI requirement of always creating a frame pointer whenever
19997 a stack frame is allocated. This option is enabled by default and can
19998 be disabled with @option{-mno-linked-fp}.
19999
20000 @item -mlong-calls
20001 @opindex mlong-calls
20002
20003 Use indirect addressing to call functions outside the current
20004 compilation unit. This allows the functions to be placed anywhere
20005 within the 32-bit address space.
20006
20007 @item -malign-labels
20008 @opindex malign-labels
20009
20010 Try to align labels to an 8-byte boundary by inserting NOPs into the
20011 previous packet. This option only has an effect when VLIW packing
20012 is enabled. It doesn't create new packets; it merely adds NOPs to
20013 existing ones.
20014
20015 @item -mlibrary-pic
20016 @opindex mlibrary-pic
20017
20018 Generate position-independent EABI code.
20019
20020 @item -macc-4
20021 @opindex macc-4
20022
20023 Use only the first four media accumulator registers.
20024
20025 @item -macc-8
20026 @opindex macc-8
20027
20028 Use all eight media accumulator registers.
20029
20030 @item -mpack
20031 @opindex mpack
20032
20033 Pack VLIW instructions.
20034
20035 @item -mno-pack
20036 @opindex mno-pack
20037
20038 Do not pack VLIW instructions.
20039
20040 @item -mno-eflags
20041 @opindex mno-eflags
20042
20043 Do not mark ABI switches in e_flags.
20044
20045 @item -mcond-move
20046 @opindex mcond-move
20047
20048 Enable the use of conditional-move instructions (default).
20049
20050 This switch is mainly for debugging the compiler and will likely be removed
20051 in a future version.
20052
20053 @item -mno-cond-move
20054 @opindex mno-cond-move
20055
20056 Disable the use of conditional-move instructions.
20057
20058 This switch is mainly for debugging the compiler and will likely be removed
20059 in a future version.
20060
20061 @item -mscc
20062 @opindex mscc
20063
20064 Enable the use of conditional set instructions (default).
20065
20066 This switch is mainly for debugging the compiler and will likely be removed
20067 in a future version.
20068
20069 @item -mno-scc
20070 @opindex mno-scc
20071
20072 Disable the use of conditional set instructions.
20073
20074 This switch is mainly for debugging the compiler and will likely be removed
20075 in a future version.
20076
20077 @item -mcond-exec
20078 @opindex mcond-exec
20079
20080 Enable the use of conditional execution (default).
20081
20082 This switch is mainly for debugging the compiler and will likely be removed
20083 in a future version.
20084
20085 @item -mno-cond-exec
20086 @opindex mno-cond-exec
20087
20088 Disable the use of conditional execution.
20089
20090 This switch is mainly for debugging the compiler and will likely be removed
20091 in a future version.
20092
20093 @item -mvliw-branch
20094 @opindex mvliw-branch
20095
20096 Run a pass to pack branches into VLIW instructions (default).
20097
20098 This switch is mainly for debugging the compiler and will likely be removed
20099 in a future version.
20100
20101 @item -mno-vliw-branch
20102 @opindex mno-vliw-branch
20103
20104 Do not run a pass to pack branches into VLIW instructions.
20105
20106 This switch is mainly for debugging the compiler and will likely be removed
20107 in a future version.
20108
20109 @item -mmulti-cond-exec
20110 @opindex mmulti-cond-exec
20111
20112 Enable optimization of @code{&&} and @code{||} in conditional execution
20113 (default).
20114
20115 This switch is mainly for debugging the compiler and will likely be removed
20116 in a future version.
20117
20118 @item -mno-multi-cond-exec
20119 @opindex mno-multi-cond-exec
20120
20121 Disable optimization of @code{&&} and @code{||} in conditional execution.
20122
20123 This switch is mainly for debugging the compiler and will likely be removed
20124 in a future version.
20125
20126 @item -mnested-cond-exec
20127 @opindex mnested-cond-exec
20128
20129 Enable nested conditional execution optimizations (default).
20130
20131 This switch is mainly for debugging the compiler and will likely be removed
20132 in a future version.
20133
20134 @item -mno-nested-cond-exec
20135 @opindex mno-nested-cond-exec
20136
20137 Disable nested conditional execution optimizations.
20138
20139 This switch is mainly for debugging the compiler and will likely be removed
20140 in a future version.
20141
20142 @item -moptimize-membar
20143 @opindex moptimize-membar
20144
20145 This switch removes redundant @code{membar} instructions from the
20146 compiler-generated code. It is enabled by default.
20147
20148 @item -mno-optimize-membar
20149 @opindex mno-optimize-membar
20150 @opindex moptimize-membar
20151
20152 This switch disables the automatic removal of redundant @code{membar}
20153 instructions from the generated code.
20154
20155 @item -mtomcat-stats
20156 @opindex mtomcat-stats
20157
20158 Cause gas to print out tomcat statistics.
20159
20160 @item -mcpu=@var{cpu}
20161 @opindex mcpu
20162
20163 Select the processor type for which to generate code. Possible values are
20164 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20165 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20166
20167 @end table
20168
20169 @node GNU/Linux Options
20170 @subsection GNU/Linux Options
20171
20172 These @samp{-m} options are defined for GNU/Linux targets:
20173
20174 @table @gcctabopt
20175 @item -mglibc
20176 @opindex mglibc
20177 Use the GNU C library. This is the default except
20178 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20179 @samp{*-*-linux-*android*} targets.
20180
20181 @item -muclibc
20182 @opindex muclibc
20183 Use uClibc C library. This is the default on
20184 @samp{*-*-linux-*uclibc*} targets.
20185
20186 @item -mmusl
20187 @opindex mmusl
20188 Use the musl C library. This is the default on
20189 @samp{*-*-linux-*musl*} targets.
20190
20191 @item -mbionic
20192 @opindex mbionic
20193 Use Bionic C library. This is the default on
20194 @samp{*-*-linux-*android*} targets.
20195
20196 @item -mandroid
20197 @opindex mandroid
20198 Compile code compatible with Android platform. This is the default on
20199 @samp{*-*-linux-*android*} targets.
20200
20201 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20202 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20203 this option makes the GCC driver pass Android-specific options to the linker.
20204 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20205 to be defined.
20206
20207 @item -tno-android-cc
20208 @opindex tno-android-cc
20209 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20210 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20211 @option{-fno-rtti} by default.
20212
20213 @item -tno-android-ld
20214 @opindex tno-android-ld
20215 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20216 linking options to the linker.
20217
20218 @end table
20219
20220 @node H8/300 Options
20221 @subsection H8/300 Options
20222
20223 These @samp{-m} options are defined for the H8/300 implementations:
20224
20225 @table @gcctabopt
20226 @item -mrelax
20227 @opindex mrelax
20228 Shorten some address references at link time, when possible; uses the
20229 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20230 ld, Using ld}, for a fuller description.
20231
20232 @item -mh
20233 @opindex mh
20234 Generate code for the H8/300H@.
20235
20236 @item -ms
20237 @opindex ms
20238 Generate code for the H8S@.
20239
20240 @item -mn
20241 @opindex mn
20242 Generate code for the H8S and H8/300H in the normal mode. This switch
20243 must be used either with @option{-mh} or @option{-ms}.
20244
20245 @item -ms2600
20246 @opindex ms2600
20247 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20248
20249 @item -mexr
20250 @opindex mexr
20251 Extended registers are stored on stack before execution of function
20252 with monitor attribute. Default option is @option{-mexr}.
20253 This option is valid only for H8S targets.
20254
20255 @item -mno-exr
20256 @opindex mno-exr
20257 @opindex mexr
20258 Extended registers are not stored on stack before execution of function
20259 with monitor attribute. Default option is @option{-mno-exr}.
20260 This option is valid only for H8S targets.
20261
20262 @item -mint32
20263 @opindex mint32
20264 Make @code{int} data 32 bits by default.
20265
20266 @item -malign-300
20267 @opindex malign-300
20268 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20269 The default for the H8/300H and H8S is to align longs and floats on
20270 4-byte boundaries.
20271 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20272 This option has no effect on the H8/300.
20273 @end table
20274
20275 @node HPPA Options
20276 @subsection HPPA Options
20277 @cindex HPPA Options
20278
20279 These @samp{-m} options are defined for the HPPA family of computers:
20280
20281 @table @gcctabopt
20282 @item -march=@var{architecture-type}
20283 @opindex march
20284 Generate code for the specified architecture. The choices for
20285 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20286 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20287 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20288 architecture option for your machine. Code compiled for lower numbered
20289 architectures runs on higher numbered architectures, but not the
20290 other way around.
20291
20292 @item -mpa-risc-1-0
20293 @itemx -mpa-risc-1-1
20294 @itemx -mpa-risc-2-0
20295 @opindex mpa-risc-1-0
20296 @opindex mpa-risc-1-1
20297 @opindex mpa-risc-2-0
20298 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20299
20300 @item -mcaller-copies
20301 @opindex mcaller-copies
20302 The caller copies function arguments passed by hidden reference. This
20303 option should be used with care as it is not compatible with the default
20304 32-bit runtime. However, only aggregates larger than eight bytes are
20305 passed by hidden reference and the option provides better compatibility
20306 with OpenMP.
20307
20308 @item -mjump-in-delay
20309 @opindex mjump-in-delay
20310 This option is ignored and provided for compatibility purposes only.
20311
20312 @item -mdisable-fpregs
20313 @opindex mdisable-fpregs
20314 Prevent floating-point registers from being used in any manner. This is
20315 necessary for compiling kernels that perform lazy context switching of
20316 floating-point registers. If you use this option and attempt to perform
20317 floating-point operations, the compiler aborts.
20318
20319 @item -mdisable-indexing
20320 @opindex mdisable-indexing
20321 Prevent the compiler from using indexing address modes. This avoids some
20322 rather obscure problems when compiling MIG generated code under MACH@.
20323
20324 @item -mno-space-regs
20325 @opindex mno-space-regs
20326 @opindex mspace-regs
20327 Generate code that assumes the target has no space registers. This allows
20328 GCC to generate faster indirect calls and use unscaled index address modes.
20329
20330 Such code is suitable for level 0 PA systems and kernels.
20331
20332 @item -mfast-indirect-calls
20333 @opindex mfast-indirect-calls
20334 Generate code that assumes calls never cross space boundaries. This
20335 allows GCC to emit code that performs faster indirect calls.
20336
20337 This option does not work in the presence of shared libraries or nested
20338 functions.
20339
20340 @item -mfixed-range=@var{register-range}
20341 @opindex mfixed-range
20342 Generate code treating the given register range as fixed registers.
20343 A fixed register is one that the register allocator cannot use. This is
20344 useful when compiling kernel code. A register range is specified as
20345 two registers separated by a dash. Multiple register ranges can be
20346 specified separated by a comma.
20347
20348 @item -mlong-load-store
20349 @opindex mlong-load-store
20350 Generate 3-instruction load and store sequences as sometimes required by
20351 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20352 the HP compilers.
20353
20354 @item -mportable-runtime
20355 @opindex mportable-runtime
20356 Use the portable calling conventions proposed by HP for ELF systems.
20357
20358 @item -mgas
20359 @opindex mgas
20360 Enable the use of assembler directives only GAS understands.
20361
20362 @item -mschedule=@var{cpu-type}
20363 @opindex mschedule
20364 Schedule code according to the constraints for the machine type
20365 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20366 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20367 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20368 proper scheduling option for your machine. The default scheduling is
20369 @samp{8000}.
20370
20371 @item -mlinker-opt
20372 @opindex mlinker-opt
20373 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20374 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20375 linkers in which they give bogus error messages when linking some programs.
20376
20377 @item -msoft-float
20378 @opindex msoft-float
20379 Generate output containing library calls for floating point.
20380 @strong{Warning:} the requisite libraries are not available for all HPPA
20381 targets. Normally the facilities of the machine's usual C compiler are
20382 used, but this cannot be done directly in cross-compilation. You must make
20383 your own arrangements to provide suitable library functions for
20384 cross-compilation.
20385
20386 @option{-msoft-float} changes the calling convention in the output file;
20387 therefore, it is only useful if you compile @emph{all} of a program with
20388 this option. In particular, you need to compile @file{libgcc.a}, the
20389 library that comes with GCC, with @option{-msoft-float} in order for
20390 this to work.
20391
20392 @item -msio
20393 @opindex msio
20394 Generate the predefine, @code{_SIO}, for server IO@. The default is
20395 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20396 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20397 options are available under HP-UX and HI-UX@.
20398
20399 @item -mgnu-ld
20400 @opindex mgnu-ld
20401 Use options specific to GNU @command{ld}.
20402 This passes @option{-shared} to @command{ld} when
20403 building a shared library. It is the default when GCC is configured,
20404 explicitly or implicitly, with the GNU linker. This option does not
20405 affect which @command{ld} is called; it only changes what parameters
20406 are passed to that @command{ld}.
20407 The @command{ld} that is called is determined by the
20408 @option{--with-ld} configure option, GCC's program search path, and
20409 finally by the user's @env{PATH}. The linker used by GCC can be printed
20410 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20411 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20412
20413 @item -mhp-ld
20414 @opindex mhp-ld
20415 Use options specific to HP @command{ld}.
20416 This passes @option{-b} to @command{ld} when building
20417 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20418 links. It is the default when GCC is configured, explicitly or
20419 implicitly, with the HP linker. This option does not affect
20420 which @command{ld} is called; it only changes what parameters are passed to that
20421 @command{ld}.
20422 The @command{ld} that is called is determined by the @option{--with-ld}
20423 configure option, GCC's program search path, and finally by the user's
20424 @env{PATH}. The linker used by GCC can be printed using @samp{which
20425 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20426 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20427
20428 @item -mlong-calls
20429 @opindex mno-long-calls
20430 @opindex mlong-calls
20431 Generate code that uses long call sequences. This ensures that a call
20432 is always able to reach linker generated stubs. The default is to generate
20433 long calls only when the distance from the call site to the beginning
20434 of the function or translation unit, as the case may be, exceeds a
20435 predefined limit set by the branch type being used. The limits for
20436 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20437 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20438 240,000 bytes.
20439
20440 Distances are measured from the beginning of functions when using the
20441 @option{-ffunction-sections} option, or when using the @option{-mgas}
20442 and @option{-mno-portable-runtime} options together under HP-UX with
20443 the SOM linker.
20444
20445 It is normally not desirable to use this option as it degrades
20446 performance. However, it may be useful in large applications,
20447 particularly when partial linking is used to build the application.
20448
20449 The types of long calls used depends on the capabilities of the
20450 assembler and linker, and the type of code being generated. The
20451 impact on systems that support long absolute calls, and long pic
20452 symbol-difference or pc-relative calls should be relatively small.
20453 However, an indirect call is used on 32-bit ELF systems in pic code
20454 and it is quite long.
20455
20456 @item -munix=@var{unix-std}
20457 @opindex march
20458 Generate compiler predefines and select a startfile for the specified
20459 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20460 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20461 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20462 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20463 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20464 and later.
20465
20466 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20467 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20468 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20469 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20470 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20471 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20472
20473 It is @emph{important} to note that this option changes the interfaces
20474 for various library routines. It also affects the operational behavior
20475 of the C library. Thus, @emph{extreme} care is needed in using this
20476 option.
20477
20478 Library code that is intended to operate with more than one UNIX
20479 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20480 as appropriate. Most GNU software doesn't provide this capability.
20481
20482 @item -nolibdld
20483 @opindex nolibdld
20484 Suppress the generation of link options to search libdld.sl when the
20485 @option{-static} option is specified on HP-UX 10 and later.
20486
20487 @item -static
20488 @opindex static
20489 The HP-UX implementation of setlocale in libc has a dependency on
20490 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20491 when the @option{-static} option is specified, special link options
20492 are needed to resolve this dependency.
20493
20494 On HP-UX 10 and later, the GCC driver adds the necessary options to
20495 link with libdld.sl when the @option{-static} option is specified.
20496 This causes the resulting binary to be dynamic. On the 64-bit port,
20497 the linkers generate dynamic binaries by default in any case. The
20498 @option{-nolibdld} option can be used to prevent the GCC driver from
20499 adding these link options.
20500
20501 @item -threads
20502 @opindex threads
20503 Add support for multithreading with the @dfn{dce thread} library
20504 under HP-UX@. This option sets flags for both the preprocessor and
20505 linker.
20506 @end table
20507
20508 @node IA-64 Options
20509 @subsection IA-64 Options
20510 @cindex IA-64 Options
20511
20512 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20513
20514 @table @gcctabopt
20515 @item -mbig-endian
20516 @opindex mbig-endian
20517 Generate code for a big-endian target. This is the default for HP-UX@.
20518
20519 @item -mlittle-endian
20520 @opindex mlittle-endian
20521 Generate code for a little-endian target. This is the default for AIX5
20522 and GNU/Linux.
20523
20524 @item -mgnu-as
20525 @itemx -mno-gnu-as
20526 @opindex mgnu-as
20527 @opindex mno-gnu-as
20528 Generate (or don't) code for the GNU assembler. This is the default.
20529 @c Also, this is the default if the configure option @option{--with-gnu-as}
20530 @c is used.
20531
20532 @item -mgnu-ld
20533 @itemx -mno-gnu-ld
20534 @opindex mgnu-ld
20535 @opindex mno-gnu-ld
20536 Generate (or don't) code for the GNU linker. This is the default.
20537 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20538 @c is used.
20539
20540 @item -mno-pic
20541 @opindex mno-pic
20542 Generate code that does not use a global pointer register. The result
20543 is not position independent code, and violates the IA-64 ABI@.
20544
20545 @item -mvolatile-asm-stop
20546 @itemx -mno-volatile-asm-stop
20547 @opindex mvolatile-asm-stop
20548 @opindex mno-volatile-asm-stop
20549 Generate (or don't) a stop bit immediately before and after volatile asm
20550 statements.
20551
20552 @item -mregister-names
20553 @itemx -mno-register-names
20554 @opindex mregister-names
20555 @opindex mno-register-names
20556 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20557 the stacked registers. This may make assembler output more readable.
20558
20559 @item -mno-sdata
20560 @itemx -msdata
20561 @opindex mno-sdata
20562 @opindex msdata
20563 Disable (or enable) optimizations that use the small data section. This may
20564 be useful for working around optimizer bugs.
20565
20566 @item -mconstant-gp
20567 @opindex mconstant-gp
20568 Generate code that uses a single constant global pointer value. This is
20569 useful when compiling kernel code.
20570
20571 @item -mauto-pic
20572 @opindex mauto-pic
20573 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20574 This is useful when compiling firmware code.
20575
20576 @item -minline-float-divide-min-latency
20577 @opindex minline-float-divide-min-latency
20578 Generate code for inline divides of floating-point values
20579 using the minimum latency algorithm.
20580
20581 @item -minline-float-divide-max-throughput
20582 @opindex minline-float-divide-max-throughput
20583 Generate code for inline divides of floating-point values
20584 using the maximum throughput algorithm.
20585
20586 @item -mno-inline-float-divide
20587 @opindex mno-inline-float-divide
20588 Do not generate inline code for divides of floating-point values.
20589
20590 @item -minline-int-divide-min-latency
20591 @opindex minline-int-divide-min-latency
20592 Generate code for inline divides of integer values
20593 using the minimum latency algorithm.
20594
20595 @item -minline-int-divide-max-throughput
20596 @opindex minline-int-divide-max-throughput
20597 Generate code for inline divides of integer values
20598 using the maximum throughput algorithm.
20599
20600 @item -mno-inline-int-divide
20601 @opindex mno-inline-int-divide
20602 @opindex minline-int-divide
20603 Do not generate inline code for divides of integer values.
20604
20605 @item -minline-sqrt-min-latency
20606 @opindex minline-sqrt-min-latency
20607 Generate code for inline square roots
20608 using the minimum latency algorithm.
20609
20610 @item -minline-sqrt-max-throughput
20611 @opindex minline-sqrt-max-throughput
20612 Generate code for inline square roots
20613 using the maximum throughput algorithm.
20614
20615 @item -mno-inline-sqrt
20616 @opindex mno-inline-sqrt
20617 Do not generate inline code for @code{sqrt}.
20618
20619 @item -mfused-madd
20620 @itemx -mno-fused-madd
20621 @opindex mfused-madd
20622 @opindex mno-fused-madd
20623 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20624 instructions. The default is to use these instructions.
20625
20626 @item -mno-dwarf2-asm
20627 @itemx -mdwarf2-asm
20628 @opindex mno-dwarf2-asm
20629 @opindex mdwarf2-asm
20630 Don't (or do) generate assembler code for the DWARF line number debugging
20631 info. This may be useful when not using the GNU assembler.
20632
20633 @item -mearly-stop-bits
20634 @itemx -mno-early-stop-bits
20635 @opindex mearly-stop-bits
20636 @opindex mno-early-stop-bits
20637 Allow stop bits to be placed earlier than immediately preceding the
20638 instruction that triggered the stop bit. This can improve instruction
20639 scheduling, but does not always do so.
20640
20641 @item -mfixed-range=@var{register-range}
20642 @opindex mfixed-range
20643 Generate code treating the given register range as fixed registers.
20644 A fixed register is one that the register allocator cannot use. This is
20645 useful when compiling kernel code. A register range is specified as
20646 two registers separated by a dash. Multiple register ranges can be
20647 specified separated by a comma.
20648
20649 @item -mtls-size=@var{tls-size}
20650 @opindex mtls-size
20651 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20652 64.
20653
20654 @item -mtune=@var{cpu-type}
20655 @opindex mtune
20656 Tune the instruction scheduling for a particular CPU, Valid values are
20657 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20658 and @samp{mckinley}.
20659
20660 @item -milp32
20661 @itemx -mlp64
20662 @opindex milp32
20663 @opindex mlp64
20664 Generate code for a 32-bit or 64-bit environment.
20665 The 32-bit environment sets int, long and pointer to 32 bits.
20666 The 64-bit environment sets int to 32 bits and long and pointer
20667 to 64 bits. These are HP-UX specific flags.
20668
20669 @item -mno-sched-br-data-spec
20670 @itemx -msched-br-data-spec
20671 @opindex mno-sched-br-data-spec
20672 @opindex msched-br-data-spec
20673 (Dis/En)able data speculative scheduling before reload.
20674 This results in generation of @code{ld.a} instructions and
20675 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20676 The default setting is disabled.
20677
20678 @item -msched-ar-data-spec
20679 @itemx -mno-sched-ar-data-spec
20680 @opindex msched-ar-data-spec
20681 @opindex mno-sched-ar-data-spec
20682 (En/Dis)able data speculative scheduling after reload.
20683 This results in generation of @code{ld.a} instructions and
20684 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20685 The default setting is enabled.
20686
20687 @item -mno-sched-control-spec
20688 @itemx -msched-control-spec
20689 @opindex mno-sched-control-spec
20690 @opindex msched-control-spec
20691 (Dis/En)able control speculative scheduling. This feature is
20692 available only during region scheduling (i.e.@: before reload).
20693 This results in generation of the @code{ld.s} instructions and
20694 the corresponding check instructions @code{chk.s}.
20695 The default setting is disabled.
20696
20697 @item -msched-br-in-data-spec
20698 @itemx -mno-sched-br-in-data-spec
20699 @opindex msched-br-in-data-spec
20700 @opindex mno-sched-br-in-data-spec
20701 (En/Dis)able speculative scheduling of the instructions that
20702 are dependent on the data speculative loads before reload.
20703 This is effective only with @option{-msched-br-data-spec} enabled.
20704 The default setting is enabled.
20705
20706 @item -msched-ar-in-data-spec
20707 @itemx -mno-sched-ar-in-data-spec
20708 @opindex msched-ar-in-data-spec
20709 @opindex mno-sched-ar-in-data-spec
20710 (En/Dis)able speculative scheduling of the instructions that
20711 are dependent on the data speculative loads after reload.
20712 This is effective only with @option{-msched-ar-data-spec} enabled.
20713 The default setting is enabled.
20714
20715 @item -msched-in-control-spec
20716 @itemx -mno-sched-in-control-spec
20717 @opindex msched-in-control-spec
20718 @opindex mno-sched-in-control-spec
20719 (En/Dis)able speculative scheduling of the instructions that
20720 are dependent on the control speculative loads.
20721 This is effective only with @option{-msched-control-spec} enabled.
20722 The default setting is enabled.
20723
20724 @item -mno-sched-prefer-non-data-spec-insns
20725 @itemx -msched-prefer-non-data-spec-insns
20726 @opindex mno-sched-prefer-non-data-spec-insns
20727 @opindex msched-prefer-non-data-spec-insns
20728 If enabled, data-speculative instructions are chosen for schedule
20729 only if there are no other choices at the moment. This makes
20730 the use of the data speculation much more conservative.
20731 The default setting is disabled.
20732
20733 @item -mno-sched-prefer-non-control-spec-insns
20734 @itemx -msched-prefer-non-control-spec-insns
20735 @opindex mno-sched-prefer-non-control-spec-insns
20736 @opindex msched-prefer-non-control-spec-insns
20737 If enabled, control-speculative instructions are chosen for schedule
20738 only if there are no other choices at the moment. This makes
20739 the use of the control speculation much more conservative.
20740 The default setting is disabled.
20741
20742 @item -mno-sched-count-spec-in-critical-path
20743 @itemx -msched-count-spec-in-critical-path
20744 @opindex mno-sched-count-spec-in-critical-path
20745 @opindex msched-count-spec-in-critical-path
20746 If enabled, speculative dependencies are considered during
20747 computation of the instructions priorities. This makes the use of the
20748 speculation a bit more conservative.
20749 The default setting is disabled.
20750
20751 @item -msched-spec-ldc
20752 @opindex msched-spec-ldc
20753 Use a simple data speculation check. This option is on by default.
20754
20755 @item -msched-control-spec-ldc
20756 @opindex msched-spec-ldc
20757 Use a simple check for control speculation. This option is on by default.
20758
20759 @item -msched-stop-bits-after-every-cycle
20760 @opindex msched-stop-bits-after-every-cycle
20761 Place a stop bit after every cycle when scheduling. This option is on
20762 by default.
20763
20764 @item -msched-fp-mem-deps-zero-cost
20765 @opindex msched-fp-mem-deps-zero-cost
20766 Assume that floating-point stores and loads are not likely to cause a conflict
20767 when placed into the same instruction group. This option is disabled by
20768 default.
20769
20770 @item -msel-sched-dont-check-control-spec
20771 @opindex msel-sched-dont-check-control-spec
20772 Generate checks for control speculation in selective scheduling.
20773 This flag is disabled by default.
20774
20775 @item -msched-max-memory-insns=@var{max-insns}
20776 @opindex msched-max-memory-insns
20777 Limit on the number of memory insns per instruction group, giving lower
20778 priority to subsequent memory insns attempting to schedule in the same
20779 instruction group. Frequently useful to prevent cache bank conflicts.
20780 The default value is 1.
20781
20782 @item -msched-max-memory-insns-hard-limit
20783 @opindex msched-max-memory-insns-hard-limit
20784 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20785 disallowing more than that number in an instruction group.
20786 Otherwise, the limit is ``soft'', meaning that non-memory operations
20787 are preferred when the limit is reached, but memory operations may still
20788 be scheduled.
20789
20790 @end table
20791
20792 @node LM32 Options
20793 @subsection LM32 Options
20794 @cindex LM32 options
20795
20796 These @option{-m} options are defined for the LatticeMico32 architecture:
20797
20798 @table @gcctabopt
20799 @item -mbarrel-shift-enabled
20800 @opindex mbarrel-shift-enabled
20801 Enable barrel-shift instructions.
20802
20803 @item -mdivide-enabled
20804 @opindex mdivide-enabled
20805 Enable divide and modulus instructions.
20806
20807 @item -mmultiply-enabled
20808 @opindex multiply-enabled
20809 Enable multiply instructions.
20810
20811 @item -msign-extend-enabled
20812 @opindex msign-extend-enabled
20813 Enable sign extend instructions.
20814
20815 @item -muser-enabled
20816 @opindex muser-enabled
20817 Enable user-defined instructions.
20818
20819 @end table
20820
20821 @node M32C Options
20822 @subsection M32C Options
20823 @cindex M32C options
20824
20825 @table @gcctabopt
20826 @item -mcpu=@var{name}
20827 @opindex mcpu=
20828 Select the CPU for which code is generated. @var{name} may be one of
20829 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20830 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20831 the M32C/80 series.
20832
20833 @item -msim
20834 @opindex msim
20835 Specifies that the program will be run on the simulator. This causes
20836 an alternate runtime library to be linked in which supports, for
20837 example, file I/O@. You must not use this option when generating
20838 programs that will run on real hardware; you must provide your own
20839 runtime library for whatever I/O functions are needed.
20840
20841 @item -memregs=@var{number}
20842 @opindex memregs=
20843 Specifies the number of memory-based pseudo-registers GCC uses
20844 during code generation. These pseudo-registers are used like real
20845 registers, so there is a tradeoff between GCC's ability to fit the
20846 code into available registers, and the performance penalty of using
20847 memory instead of registers. Note that all modules in a program must
20848 be compiled with the same value for this option. Because of that, you
20849 must not use this option with GCC's default runtime libraries.
20850
20851 @end table
20852
20853 @node M32R/D Options
20854 @subsection M32R/D Options
20855 @cindex M32R/D options
20856
20857 These @option{-m} options are defined for Renesas M32R/D architectures:
20858
20859 @table @gcctabopt
20860 @item -m32r2
20861 @opindex m32r2
20862 Generate code for the M32R/2@.
20863
20864 @item -m32rx
20865 @opindex m32rx
20866 Generate code for the M32R/X@.
20867
20868 @item -m32r
20869 @opindex m32r
20870 Generate code for the M32R@. This is the default.
20871
20872 @item -mmodel=small
20873 @opindex mmodel=small
20874 Assume all objects live in the lower 16MB of memory (so that their addresses
20875 can be loaded with the @code{ld24} instruction), and assume all subroutines
20876 are reachable with the @code{bl} instruction.
20877 This is the default.
20878
20879 The addressability of a particular object can be set with the
20880 @code{model} attribute.
20881
20882 @item -mmodel=medium
20883 @opindex mmodel=medium
20884 Assume objects may be anywhere in the 32-bit address space (the compiler
20885 generates @code{seth/add3} instructions to load their addresses), and
20886 assume all subroutines are reachable with the @code{bl} instruction.
20887
20888 @item -mmodel=large
20889 @opindex mmodel=large
20890 Assume objects may be anywhere in the 32-bit address space (the compiler
20891 generates @code{seth/add3} instructions to load their addresses), and
20892 assume subroutines may not be reachable with the @code{bl} instruction
20893 (the compiler generates the much slower @code{seth/add3/jl}
20894 instruction sequence).
20895
20896 @item -msdata=none
20897 @opindex msdata=none
20898 Disable use of the small data area. Variables are put into
20899 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20900 @code{section} attribute has been specified).
20901 This is the default.
20902
20903 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20904 Objects may be explicitly put in the small data area with the
20905 @code{section} attribute using one of these sections.
20906
20907 @item -msdata=sdata
20908 @opindex msdata=sdata
20909 Put small global and static data in the small data area, but do not
20910 generate special code to reference them.
20911
20912 @item -msdata=use
20913 @opindex msdata=use
20914 Put small global and static data in the small data area, and generate
20915 special instructions to reference them.
20916
20917 @item -G @var{num}
20918 @opindex G
20919 @cindex smaller data references
20920 Put global and static objects less than or equal to @var{num} bytes
20921 into the small data or BSS sections instead of the normal data or BSS
20922 sections. The default value of @var{num} is 8.
20923 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20924 for this option to have any effect.
20925
20926 All modules should be compiled with the same @option{-G @var{num}} value.
20927 Compiling with different values of @var{num} may or may not work; if it
20928 doesn't the linker gives an error message---incorrect code is not
20929 generated.
20930
20931 @item -mdebug
20932 @opindex mdebug
20933 Makes the M32R-specific code in the compiler display some statistics
20934 that might help in debugging programs.
20935
20936 @item -malign-loops
20937 @opindex malign-loops
20938 Align all loops to a 32-byte boundary.
20939
20940 @item -mno-align-loops
20941 @opindex mno-align-loops
20942 Do not enforce a 32-byte alignment for loops. This is the default.
20943
20944 @item -missue-rate=@var{number}
20945 @opindex missue-rate=@var{number}
20946 Issue @var{number} instructions per cycle. @var{number} can only be 1
20947 or 2.
20948
20949 @item -mbranch-cost=@var{number}
20950 @opindex mbranch-cost=@var{number}
20951 @var{number} can only be 1 or 2. If it is 1 then branches are
20952 preferred over conditional code, if it is 2, then the opposite applies.
20953
20954 @item -mflush-trap=@var{number}
20955 @opindex mflush-trap=@var{number}
20956 Specifies the trap number to use to flush the cache. The default is
20957 12. Valid numbers are between 0 and 15 inclusive.
20958
20959 @item -mno-flush-trap
20960 @opindex mno-flush-trap
20961 Specifies that the cache cannot be flushed by using a trap.
20962
20963 @item -mflush-func=@var{name}
20964 @opindex mflush-func=@var{name}
20965 Specifies the name of the operating system function to call to flush
20966 the cache. The default is @samp{_flush_cache}, but a function call
20967 is only used if a trap is not available.
20968
20969 @item -mno-flush-func
20970 @opindex mno-flush-func
20971 Indicates that there is no OS function for flushing the cache.
20972
20973 @end table
20974
20975 @node M680x0 Options
20976 @subsection M680x0 Options
20977 @cindex M680x0 options
20978
20979 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20980 The default settings depend on which architecture was selected when
20981 the compiler was configured; the defaults for the most common choices
20982 are given below.
20983
20984 @table @gcctabopt
20985 @item -march=@var{arch}
20986 @opindex march
20987 Generate code for a specific M680x0 or ColdFire instruction set
20988 architecture. Permissible values of @var{arch} for M680x0
20989 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20990 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20991 architectures are selected according to Freescale's ISA classification
20992 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20993 @samp{isab} and @samp{isac}.
20994
20995 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20996 code for a ColdFire target. The @var{arch} in this macro is one of the
20997 @option{-march} arguments given above.
20998
20999 When used together, @option{-march} and @option{-mtune} select code
21000 that runs on a family of similar processors but that is optimized
21001 for a particular microarchitecture.
21002
21003 @item -mcpu=@var{cpu}
21004 @opindex mcpu
21005 Generate code for a specific M680x0 or ColdFire processor.
21006 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
21007 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
21008 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
21009 below, which also classifies the CPUs into families:
21010
21011 @multitable @columnfractions 0.20 0.80
21012 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
21013 @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}
21014 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
21015 @item @samp{5206e} @tab @samp{5206e}
21016 @item @samp{5208} @tab @samp{5207} @samp{5208}
21017 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
21018 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
21019 @item @samp{5216} @tab @samp{5214} @samp{5216}
21020 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
21021 @item @samp{5225} @tab @samp{5224} @samp{5225}
21022 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
21023 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
21024 @item @samp{5249} @tab @samp{5249}
21025 @item @samp{5250} @tab @samp{5250}
21026 @item @samp{5271} @tab @samp{5270} @samp{5271}
21027 @item @samp{5272} @tab @samp{5272}
21028 @item @samp{5275} @tab @samp{5274} @samp{5275}
21029 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
21030 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
21031 @item @samp{5307} @tab @samp{5307}
21032 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
21033 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
21034 @item @samp{5407} @tab @samp{5407}
21035 @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}
21036 @end multitable
21037
21038 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
21039 @var{arch} is compatible with @var{cpu}. Other combinations of
21040 @option{-mcpu} and @option{-march} are rejected.
21041
21042 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
21043 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
21044 where the value of @var{family} is given by the table above.
21045
21046 @item -mtune=@var{tune}
21047 @opindex mtune
21048 Tune the code for a particular microarchitecture within the
21049 constraints set by @option{-march} and @option{-mcpu}.
21050 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
21051 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
21052 and @samp{cpu32}. The ColdFire microarchitectures
21053 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
21054
21055 You can also use @option{-mtune=68020-40} for code that needs
21056 to run relatively well on 68020, 68030 and 68040 targets.
21057 @option{-mtune=68020-60} is similar but includes 68060 targets
21058 as well. These two options select the same tuning decisions as
21059 @option{-m68020-40} and @option{-m68020-60} respectively.
21060
21061 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
21062 when tuning for 680x0 architecture @var{arch}. It also defines
21063 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
21064 option is used. If GCC is tuning for a range of architectures,
21065 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21066 it defines the macros for every architecture in the range.
21067
21068 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21069 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21070 of the arguments given above.
21071
21072 @item -m68000
21073 @itemx -mc68000
21074 @opindex m68000
21075 @opindex mc68000
21076 Generate output for a 68000. This is the default
21077 when the compiler is configured for 68000-based systems.
21078 It is equivalent to @option{-march=68000}.
21079
21080 Use this option for microcontrollers with a 68000 or EC000 core,
21081 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21082
21083 @item -m68010
21084 @opindex m68010
21085 Generate output for a 68010. This is the default
21086 when the compiler is configured for 68010-based systems.
21087 It is equivalent to @option{-march=68010}.
21088
21089 @item -m68020
21090 @itemx -mc68020
21091 @opindex m68020
21092 @opindex mc68020
21093 Generate output for a 68020. This is the default
21094 when the compiler is configured for 68020-based systems.
21095 It is equivalent to @option{-march=68020}.
21096
21097 @item -m68030
21098 @opindex m68030
21099 Generate output for a 68030. This is the default when the compiler is
21100 configured for 68030-based systems. It is equivalent to
21101 @option{-march=68030}.
21102
21103 @item -m68040
21104 @opindex m68040
21105 Generate output for a 68040. This is the default when the compiler is
21106 configured for 68040-based systems. It is equivalent to
21107 @option{-march=68040}.
21108
21109 This option inhibits the use of 68881/68882 instructions that have to be
21110 emulated by software on the 68040. Use this option if your 68040 does not
21111 have code to emulate those instructions.
21112
21113 @item -m68060
21114 @opindex m68060
21115 Generate output for a 68060. This is the default when the compiler is
21116 configured for 68060-based systems. It is equivalent to
21117 @option{-march=68060}.
21118
21119 This option inhibits the use of 68020 and 68881/68882 instructions that
21120 have to be emulated by software on the 68060. Use this option if your 68060
21121 does not have code to emulate those instructions.
21122
21123 @item -mcpu32
21124 @opindex mcpu32
21125 Generate output for a CPU32. This is the default
21126 when the compiler is configured for CPU32-based systems.
21127 It is equivalent to @option{-march=cpu32}.
21128
21129 Use this option for microcontrollers with a
21130 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21131 68336, 68340, 68341, 68349 and 68360.
21132
21133 @item -m5200
21134 @opindex m5200
21135 Generate output for a 520X ColdFire CPU@. This is the default
21136 when the compiler is configured for 520X-based systems.
21137 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21138 in favor of that option.
21139
21140 Use this option for microcontroller with a 5200 core, including
21141 the MCF5202, MCF5203, MCF5204 and MCF5206.
21142
21143 @item -m5206e
21144 @opindex m5206e
21145 Generate output for a 5206e ColdFire CPU@. The option is now
21146 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21147
21148 @item -m528x
21149 @opindex m528x
21150 Generate output for a member of the ColdFire 528X family.
21151 The option is now deprecated in favor of the equivalent
21152 @option{-mcpu=528x}.
21153
21154 @item -m5307
21155 @opindex m5307
21156 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21157 in favor of the equivalent @option{-mcpu=5307}.
21158
21159 @item -m5407
21160 @opindex m5407
21161 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21162 in favor of the equivalent @option{-mcpu=5407}.
21163
21164 @item -mcfv4e
21165 @opindex mcfv4e
21166 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21167 This includes use of hardware floating-point instructions.
21168 The option is equivalent to @option{-mcpu=547x}, and is now
21169 deprecated in favor of that option.
21170
21171 @item -m68020-40
21172 @opindex m68020-40
21173 Generate output for a 68040, without using any of the new instructions.
21174 This results in code that can run relatively efficiently on either a
21175 68020/68881 or a 68030 or a 68040. The generated code does use the
21176 68881 instructions that are emulated on the 68040.
21177
21178 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21179
21180 @item -m68020-60
21181 @opindex m68020-60
21182 Generate output for a 68060, without using any of the new instructions.
21183 This results in code that can run relatively efficiently on either a
21184 68020/68881 or a 68030 or a 68040. The generated code does use the
21185 68881 instructions that are emulated on the 68060.
21186
21187 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21188
21189 @item -mhard-float
21190 @itemx -m68881
21191 @opindex mhard-float
21192 @opindex m68881
21193 Generate floating-point instructions. This is the default for 68020
21194 and above, and for ColdFire devices that have an FPU@. It defines the
21195 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21196 on ColdFire targets.
21197
21198 @item -msoft-float
21199 @opindex msoft-float
21200 Do not generate floating-point instructions; use library calls instead.
21201 This is the default for 68000, 68010, and 68832 targets. It is also
21202 the default for ColdFire devices that have no FPU.
21203
21204 @item -mdiv
21205 @itemx -mno-div
21206 @opindex mdiv
21207 @opindex mno-div
21208 Generate (do not generate) ColdFire hardware divide and remainder
21209 instructions. If @option{-march} is used without @option{-mcpu},
21210 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21211 architectures. Otherwise, the default is taken from the target CPU
21212 (either the default CPU, or the one specified by @option{-mcpu}). For
21213 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21214 @option{-mcpu=5206e}.
21215
21216 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21217
21218 @item -mshort
21219 @opindex mshort
21220 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21221 Additionally, parameters passed on the stack are also aligned to a
21222 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21223
21224 @item -mno-short
21225 @opindex mno-short
21226 Do not consider type @code{int} to be 16 bits wide. This is the default.
21227
21228 @item -mnobitfield
21229 @itemx -mno-bitfield
21230 @opindex mnobitfield
21231 @opindex mno-bitfield
21232 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21233 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21234
21235 @item -mbitfield
21236 @opindex mbitfield
21237 Do use the bit-field instructions. The @option{-m68020} option implies
21238 @option{-mbitfield}. This is the default if you use a configuration
21239 designed for a 68020.
21240
21241 @item -mrtd
21242 @opindex mrtd
21243 Use a different function-calling convention, in which functions
21244 that take a fixed number of arguments return with the @code{rtd}
21245 instruction, which pops their arguments while returning. This
21246 saves one instruction in the caller since there is no need to pop
21247 the arguments there.
21248
21249 This calling convention is incompatible with the one normally
21250 used on Unix, so you cannot use it if you need to call libraries
21251 compiled with the Unix compiler.
21252
21253 Also, you must provide function prototypes for all functions that
21254 take variable numbers of arguments (including @code{printf});
21255 otherwise incorrect code is generated for calls to those
21256 functions.
21257
21258 In addition, seriously incorrect code results if you call a
21259 function with too many arguments. (Normally, extra arguments are
21260 harmlessly ignored.)
21261
21262 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21263 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21264
21265 The default is @option{-mno-rtd}.
21266
21267 @item -malign-int
21268 @itemx -mno-align-int
21269 @opindex malign-int
21270 @opindex mno-align-int
21271 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21272 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21273 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21274 Aligning variables on 32-bit boundaries produces code that runs somewhat
21275 faster on processors with 32-bit busses at the expense of more memory.
21276
21277 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21278 aligns structures containing the above types differently than
21279 most published application binary interface specifications for the m68k.
21280
21281 @item -mpcrel
21282 @opindex mpcrel
21283 Use the pc-relative addressing mode of the 68000 directly, instead of
21284 using a global offset table. At present, this option implies @option{-fpic},
21285 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21286 not presently supported with @option{-mpcrel}, though this could be supported for
21287 68020 and higher processors.
21288
21289 @item -mno-strict-align
21290 @itemx -mstrict-align
21291 @opindex mno-strict-align
21292 @opindex mstrict-align
21293 Do not (do) assume that unaligned memory references are handled by
21294 the system.
21295
21296 @item -msep-data
21297 Generate code that allows the data segment to be located in a different
21298 area of memory from the text segment. This allows for execute-in-place in
21299 an environment without virtual memory management. This option implies
21300 @option{-fPIC}.
21301
21302 @item -mno-sep-data
21303 Generate code that assumes that the data segment follows the text segment.
21304 This is the default.
21305
21306 @item -mid-shared-library
21307 Generate code that supports shared libraries via the library ID method.
21308 This allows for execute-in-place and shared libraries in an environment
21309 without virtual memory management. This option implies @option{-fPIC}.
21310
21311 @item -mno-id-shared-library
21312 Generate code that doesn't assume ID-based shared libraries are being used.
21313 This is the default.
21314
21315 @item -mshared-library-id=n
21316 Specifies the identification number of the ID-based shared library being
21317 compiled. Specifying a value of 0 generates more compact code; specifying
21318 other values forces the allocation of that number to the current
21319 library, but is no more space- or time-efficient than omitting this option.
21320
21321 @item -mxgot
21322 @itemx -mno-xgot
21323 @opindex mxgot
21324 @opindex mno-xgot
21325 When generating position-independent code for ColdFire, generate code
21326 that works if the GOT has more than 8192 entries. This code is
21327 larger and slower than code generated without this option. On M680x0
21328 processors, this option is not needed; @option{-fPIC} suffices.
21329
21330 GCC normally uses a single instruction to load values from the GOT@.
21331 While this is relatively efficient, it only works if the GOT
21332 is smaller than about 64k. Anything larger causes the linker
21333 to report an error such as:
21334
21335 @cindex relocation truncated to fit (ColdFire)
21336 @smallexample
21337 relocation truncated to fit: R_68K_GOT16O foobar
21338 @end smallexample
21339
21340 If this happens, you should recompile your code with @option{-mxgot}.
21341 It should then work with very large GOTs. However, code generated with
21342 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21343 the value of a global symbol.
21344
21345 Note that some linkers, including newer versions of the GNU linker,
21346 can create multiple GOTs and sort GOT entries. If you have such a linker,
21347 you should only need to use @option{-mxgot} when compiling a single
21348 object file that accesses more than 8192 GOT entries. Very few do.
21349
21350 These options have no effect unless GCC is generating
21351 position-independent code.
21352
21353 @item -mlong-jump-table-offsets
21354 @opindex mlong-jump-table-offsets
21355 Use 32-bit offsets in @code{switch} tables. The default is to use
21356 16-bit offsets.
21357
21358 @end table
21359
21360 @node MCore Options
21361 @subsection MCore Options
21362 @cindex MCore options
21363
21364 These are the @samp{-m} options defined for the Motorola M*Core
21365 processors.
21366
21367 @table @gcctabopt
21368
21369 @item -mhardlit
21370 @itemx -mno-hardlit
21371 @opindex mhardlit
21372 @opindex mno-hardlit
21373 Inline constants into the code stream if it can be done in two
21374 instructions or less.
21375
21376 @item -mdiv
21377 @itemx -mno-div
21378 @opindex mdiv
21379 @opindex mno-div
21380 Use the divide instruction. (Enabled by default).
21381
21382 @item -mrelax-immediate
21383 @itemx -mno-relax-immediate
21384 @opindex mrelax-immediate
21385 @opindex mno-relax-immediate
21386 Allow arbitrary-sized immediates in bit operations.
21387
21388 @item -mwide-bitfields
21389 @itemx -mno-wide-bitfields
21390 @opindex mwide-bitfields
21391 @opindex mno-wide-bitfields
21392 Always treat bit-fields as @code{int}-sized.
21393
21394 @item -m4byte-functions
21395 @itemx -mno-4byte-functions
21396 @opindex m4byte-functions
21397 @opindex mno-4byte-functions
21398 Force all functions to be aligned to a 4-byte boundary.
21399
21400 @item -mcallgraph-data
21401 @itemx -mno-callgraph-data
21402 @opindex mcallgraph-data
21403 @opindex mno-callgraph-data
21404 Emit callgraph information.
21405
21406 @item -mslow-bytes
21407 @itemx -mno-slow-bytes
21408 @opindex mslow-bytes
21409 @opindex mno-slow-bytes
21410 Prefer word access when reading byte quantities.
21411
21412 @item -mlittle-endian
21413 @itemx -mbig-endian
21414 @opindex mlittle-endian
21415 @opindex mbig-endian
21416 Generate code for a little-endian target.
21417
21418 @item -m210
21419 @itemx -m340
21420 @opindex m210
21421 @opindex m340
21422 Generate code for the 210 processor.
21423
21424 @item -mno-lsim
21425 @opindex mno-lsim
21426 Assume that runtime support has been provided and so omit the
21427 simulator library (@file{libsim.a)} from the linker command line.
21428
21429 @item -mstack-increment=@var{size}
21430 @opindex mstack-increment
21431 Set the maximum amount for a single stack increment operation. Large
21432 values can increase the speed of programs that contain functions
21433 that need a large amount of stack space, but they can also trigger a
21434 segmentation fault if the stack is extended too much. The default
21435 value is 0x1000.
21436
21437 @end table
21438
21439 @node MeP Options
21440 @subsection MeP Options
21441 @cindex MeP options
21442
21443 @table @gcctabopt
21444
21445 @item -mabsdiff
21446 @opindex mabsdiff
21447 Enables the @code{abs} instruction, which is the absolute difference
21448 between two registers.
21449
21450 @item -mall-opts
21451 @opindex mall-opts
21452 Enables all the optional instructions---average, multiply, divide, bit
21453 operations, leading zero, absolute difference, min/max, clip, and
21454 saturation.
21455
21456
21457 @item -maverage
21458 @opindex maverage
21459 Enables the @code{ave} instruction, which computes the average of two
21460 registers.
21461
21462 @item -mbased=@var{n}
21463 @opindex mbased=
21464 Variables of size @var{n} bytes or smaller are placed in the
21465 @code{.based} section by default. Based variables use the @code{$tp}
21466 register as a base register, and there is a 128-byte limit to the
21467 @code{.based} section.
21468
21469 @item -mbitops
21470 @opindex mbitops
21471 Enables the bit operation instructions---bit test (@code{btstm}), set
21472 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21473 test-and-set (@code{tas}).
21474
21475 @item -mc=@var{name}
21476 @opindex mc=
21477 Selects which section constant data is placed in. @var{name} may
21478 be @samp{tiny}, @samp{near}, or @samp{far}.
21479
21480 @item -mclip
21481 @opindex mclip
21482 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21483 useful unless you also provide @option{-mminmax}.
21484
21485 @item -mconfig=@var{name}
21486 @opindex mconfig=
21487 Selects one of the built-in core configurations. Each MeP chip has
21488 one or more modules in it; each module has a core CPU and a variety of
21489 coprocessors, optional instructions, and peripherals. The
21490 @code{MeP-Integrator} tool, not part of GCC, provides these
21491 configurations through this option; using this option is the same as
21492 using all the corresponding command-line options. The default
21493 configuration is @samp{default}.
21494
21495 @item -mcop
21496 @opindex mcop
21497 Enables the coprocessor instructions. By default, this is a 32-bit
21498 coprocessor. Note that the coprocessor is normally enabled via the
21499 @option{-mconfig=} option.
21500
21501 @item -mcop32
21502 @opindex mcop32
21503 Enables the 32-bit coprocessor's instructions.
21504
21505 @item -mcop64
21506 @opindex mcop64
21507 Enables the 64-bit coprocessor's instructions.
21508
21509 @item -mivc2
21510 @opindex mivc2
21511 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21512
21513 @item -mdc
21514 @opindex mdc
21515 Causes constant variables to be placed in the @code{.near} section.
21516
21517 @item -mdiv
21518 @opindex mdiv
21519 Enables the @code{div} and @code{divu} instructions.
21520
21521 @item -meb
21522 @opindex meb
21523 Generate big-endian code.
21524
21525 @item -mel
21526 @opindex mel
21527 Generate little-endian code.
21528
21529 @item -mio-volatile
21530 @opindex mio-volatile
21531 Tells the compiler that any variable marked with the @code{io}
21532 attribute is to be considered volatile.
21533
21534 @item -ml
21535 @opindex ml
21536 Causes variables to be assigned to the @code{.far} section by default.
21537
21538 @item -mleadz
21539 @opindex mleadz
21540 Enables the @code{leadz} (leading zero) instruction.
21541
21542 @item -mm
21543 @opindex mm
21544 Causes variables to be assigned to the @code{.near} section by default.
21545
21546 @item -mminmax
21547 @opindex mminmax
21548 Enables the @code{min} and @code{max} instructions.
21549
21550 @item -mmult
21551 @opindex mmult
21552 Enables the multiplication and multiply-accumulate instructions.
21553
21554 @item -mno-opts
21555 @opindex mno-opts
21556 Disables all the optional instructions enabled by @option{-mall-opts}.
21557
21558 @item -mrepeat
21559 @opindex mrepeat
21560 Enables the @code{repeat} and @code{erepeat} instructions, used for
21561 low-overhead looping.
21562
21563 @item -ms
21564 @opindex ms
21565 Causes all variables to default to the @code{.tiny} section. Note
21566 that there is a 65536-byte limit to this section. Accesses to these
21567 variables use the @code{%gp} base register.
21568
21569 @item -msatur
21570 @opindex msatur
21571 Enables the saturation instructions. Note that the compiler does not
21572 currently generate these itself, but this option is included for
21573 compatibility with other tools, like @code{as}.
21574
21575 @item -msdram
21576 @opindex msdram
21577 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21578
21579 @item -msim
21580 @opindex msim
21581 Link the simulator run-time libraries.
21582
21583 @item -msimnovec
21584 @opindex msimnovec
21585 Link the simulator runtime libraries, excluding built-in support
21586 for reset and exception vectors and tables.
21587
21588 @item -mtf
21589 @opindex mtf
21590 Causes all functions to default to the @code{.far} section. Without
21591 this option, functions default to the @code{.near} section.
21592
21593 @item -mtiny=@var{n}
21594 @opindex mtiny=
21595 Variables that are @var{n} bytes or smaller are allocated to the
21596 @code{.tiny} section. These variables use the @code{$gp} base
21597 register. The default for this option is 4, but note that there's a
21598 65536-byte limit to the @code{.tiny} section.
21599
21600 @end table
21601
21602 @node MicroBlaze Options
21603 @subsection MicroBlaze Options
21604 @cindex MicroBlaze Options
21605
21606 @table @gcctabopt
21607
21608 @item -msoft-float
21609 @opindex msoft-float
21610 Use software emulation for floating point (default).
21611
21612 @item -mhard-float
21613 @opindex mhard-float
21614 Use hardware floating-point instructions.
21615
21616 @item -mmemcpy
21617 @opindex mmemcpy
21618 Do not optimize block moves, use @code{memcpy}.
21619
21620 @item -mno-clearbss
21621 @opindex mno-clearbss
21622 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21623
21624 @item -mcpu=@var{cpu-type}
21625 @opindex mcpu=
21626 Use features of, and schedule code for, the given CPU.
21627 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21628 where @var{X} is a major version, @var{YY} is the minor version, and
21629 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21630 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21631
21632 @item -mxl-soft-mul
21633 @opindex mxl-soft-mul
21634 Use software multiply emulation (default).
21635
21636 @item -mxl-soft-div
21637 @opindex mxl-soft-div
21638 Use software emulation for divides (default).
21639
21640 @item -mxl-barrel-shift
21641 @opindex mxl-barrel-shift
21642 Use the hardware barrel shifter.
21643
21644 @item -mxl-pattern-compare
21645 @opindex mxl-pattern-compare
21646 Use pattern compare instructions.
21647
21648 @item -msmall-divides
21649 @opindex msmall-divides
21650 Use table lookup optimization for small signed integer divisions.
21651
21652 @item -mxl-stack-check
21653 @opindex mxl-stack-check
21654 This option is deprecated. Use @option{-fstack-check} instead.
21655
21656 @item -mxl-gp-opt
21657 @opindex mxl-gp-opt
21658 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21659
21660 @item -mxl-multiply-high
21661 @opindex mxl-multiply-high
21662 Use multiply high instructions for high part of 32x32 multiply.
21663
21664 @item -mxl-float-convert
21665 @opindex mxl-float-convert
21666 Use hardware floating-point conversion instructions.
21667
21668 @item -mxl-float-sqrt
21669 @opindex mxl-float-sqrt
21670 Use hardware floating-point square root instruction.
21671
21672 @item -mbig-endian
21673 @opindex mbig-endian
21674 Generate code for a big-endian target.
21675
21676 @item -mlittle-endian
21677 @opindex mlittle-endian
21678 Generate code for a little-endian target.
21679
21680 @item -mxl-reorder
21681 @opindex mxl-reorder
21682 Use reorder instructions (swap and byte reversed load/store).
21683
21684 @item -mxl-mode-@var{app-model}
21685 Select application model @var{app-model}. Valid models are
21686 @table @samp
21687 @item executable
21688 normal executable (default), uses startup code @file{crt0.o}.
21689
21690 @item -mpic-data-is-text-relative
21691 @opindex mpic-data-is-text-relative
21692 Assume that the displacement between the text and data segments is fixed
21693 at static link time. This allows data to be referenced by offset from start of
21694 text address instead of GOT since PC-relative addressing is not supported.
21695
21696 @item xmdstub
21697 for use with Xilinx Microprocessor Debugger (XMD) based
21698 software intrusive debug agent called xmdstub. This uses startup file
21699 @file{crt1.o} and sets the start address of the program to 0x800.
21700
21701 @item bootstrap
21702 for applications that are loaded using a bootloader.
21703 This model uses startup file @file{crt2.o} which does not contain a processor
21704 reset vector handler. This is suitable for transferring control on a
21705 processor reset to the bootloader rather than the application.
21706
21707 @item novectors
21708 for applications that do not require any of the
21709 MicroBlaze vectors. This option may be useful for applications running
21710 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21711 @end table
21712
21713 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21714 @option{-mxl-mode-@var{app-model}}.
21715
21716 @end table
21717
21718 @node MIPS Options
21719 @subsection MIPS Options
21720 @cindex MIPS options
21721
21722 @table @gcctabopt
21723
21724 @item -EB
21725 @opindex EB
21726 Generate big-endian code.
21727
21728 @item -EL
21729 @opindex EL
21730 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21731 configurations.
21732
21733 @item -march=@var{arch}
21734 @opindex march
21735 Generate code that runs on @var{arch}, which can be the name of a
21736 generic MIPS ISA, or the name of a particular processor.
21737 The ISA names are:
21738 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21739 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21740 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21741 @samp{mips64r5} and @samp{mips64r6}.
21742 The processor names are:
21743 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21744 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21745 @samp{5kc}, @samp{5kf},
21746 @samp{20kc},
21747 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21748 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21749 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21750 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21751 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21752 @samp{i6400}, @samp{i6500},
21753 @samp{interaptiv},
21754 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21755 @samp{gs464e}, @samp{gs264e},
21756 @samp{m4k},
21757 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21758 @samp{m5100}, @samp{m5101},
21759 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21760 @samp{orion},
21761 @samp{p5600}, @samp{p6600},
21762 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21763 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21764 @samp{r6000}, @samp{r8000},
21765 @samp{rm7000}, @samp{rm9000},
21766 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21767 @samp{sb1},
21768 @samp{sr71000},
21769 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21770 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21771 @samp{xlr} and @samp{xlp}.
21772 The special value @samp{from-abi} selects the
21773 most compatible architecture for the selected ABI (that is,
21774 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21775
21776 The native Linux/GNU toolchain also supports the value @samp{native},
21777 which selects the best architecture option for the host processor.
21778 @option{-march=native} has no effect if GCC does not recognize
21779 the processor.
21780
21781 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21782 (for example, @option{-march=r2k}). Prefixes are optional, and
21783 @samp{vr} may be written @samp{r}.
21784
21785 Names of the form @samp{@var{n}f2_1} refer to processors with
21786 FPUs clocked at half the rate of the core, names of the form
21787 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21788 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21789 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21790 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21791 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21792 accepted as synonyms for @samp{@var{n}f1_1}.
21793
21794 GCC defines two macros based on the value of this option. The first
21795 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21796 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21797 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21798 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21799 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21800
21801 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21802 above. In other words, it has the full prefix and does not
21803 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21804 the macro names the resolved architecture (either @code{"mips1"} or
21805 @code{"mips3"}). It names the default architecture when no
21806 @option{-march} option is given.
21807
21808 @item -mtune=@var{arch}
21809 @opindex mtune
21810 Optimize for @var{arch}. Among other things, this option controls
21811 the way instructions are scheduled, and the perceived cost of arithmetic
21812 operations. The list of @var{arch} values is the same as for
21813 @option{-march}.
21814
21815 When this option is not used, GCC optimizes for the processor
21816 specified by @option{-march}. By using @option{-march} and
21817 @option{-mtune} together, it is possible to generate code that
21818 runs on a family of processors, but optimize the code for one
21819 particular member of that family.
21820
21821 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21822 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21823 @option{-march} ones described above.
21824
21825 @item -mips1
21826 @opindex mips1
21827 Equivalent to @option{-march=mips1}.
21828
21829 @item -mips2
21830 @opindex mips2
21831 Equivalent to @option{-march=mips2}.
21832
21833 @item -mips3
21834 @opindex mips3
21835 Equivalent to @option{-march=mips3}.
21836
21837 @item -mips4
21838 @opindex mips4
21839 Equivalent to @option{-march=mips4}.
21840
21841 @item -mips32
21842 @opindex mips32
21843 Equivalent to @option{-march=mips32}.
21844
21845 @item -mips32r3
21846 @opindex mips32r3
21847 Equivalent to @option{-march=mips32r3}.
21848
21849 @item -mips32r5
21850 @opindex mips32r5
21851 Equivalent to @option{-march=mips32r5}.
21852
21853 @item -mips32r6
21854 @opindex mips32r6
21855 Equivalent to @option{-march=mips32r6}.
21856
21857 @item -mips64
21858 @opindex mips64
21859 Equivalent to @option{-march=mips64}.
21860
21861 @item -mips64r2
21862 @opindex mips64r2
21863 Equivalent to @option{-march=mips64r2}.
21864
21865 @item -mips64r3
21866 @opindex mips64r3
21867 Equivalent to @option{-march=mips64r3}.
21868
21869 @item -mips64r5
21870 @opindex mips64r5
21871 Equivalent to @option{-march=mips64r5}.
21872
21873 @item -mips64r6
21874 @opindex mips64r6
21875 Equivalent to @option{-march=mips64r6}.
21876
21877 @item -mips16
21878 @itemx -mno-mips16
21879 @opindex mips16
21880 @opindex mno-mips16
21881 Generate (do not generate) MIPS16 code. If GCC is targeting a
21882 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21883
21884 MIPS16 code generation can also be controlled on a per-function basis
21885 by means of @code{mips16} and @code{nomips16} attributes.
21886 @xref{Function Attributes}, for more information.
21887
21888 @item -mflip-mips16
21889 @opindex mflip-mips16
21890 Generate MIPS16 code on alternating functions. This option is provided
21891 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21892 not intended for ordinary use in compiling user code.
21893
21894 @item -minterlink-compressed
21895 @itemx -mno-interlink-compressed
21896 @opindex minterlink-compressed
21897 @opindex mno-interlink-compressed
21898 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21899 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21900
21901 For example, code using the standard ISA encoding cannot jump directly
21902 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21903 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21904 knows that the target of the jump is not compressed.
21905
21906 @item -minterlink-mips16
21907 @itemx -mno-interlink-mips16
21908 @opindex minterlink-mips16
21909 @opindex mno-interlink-mips16
21910 Aliases of @option{-minterlink-compressed} and
21911 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21912 and are retained for backwards compatibility.
21913
21914 @item -mabi=32
21915 @itemx -mabi=o64
21916 @itemx -mabi=n32
21917 @itemx -mabi=64
21918 @itemx -mabi=eabi
21919 @opindex mabi=32
21920 @opindex mabi=o64
21921 @opindex mabi=n32
21922 @opindex mabi=64
21923 @opindex mabi=eabi
21924 Generate code for the given ABI@.
21925
21926 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21927 generates 64-bit code when you select a 64-bit architecture, but you
21928 can use @option{-mgp32} to get 32-bit code instead.
21929
21930 For information about the O64 ABI, see
21931 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21932
21933 GCC supports a variant of the o32 ABI in which floating-point registers
21934 are 64 rather than 32 bits wide. You can select this combination with
21935 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21936 and @code{mfhc1} instructions and is therefore only supported for
21937 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21938
21939 The register assignments for arguments and return values remain the
21940 same, but each scalar value is passed in a single 64-bit register
21941 rather than a pair of 32-bit registers. For example, scalar
21942 floating-point values are returned in @samp{$f0} only, not a
21943 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21944 remains the same in that the even-numbered double-precision registers
21945 are saved.
21946
21947 Two additional variants of the o32 ABI are supported to enable
21948 a transition from 32-bit to 64-bit registers. These are FPXX
21949 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21950 The FPXX extension mandates that all code must execute correctly
21951 when run using 32-bit or 64-bit registers. The code can be interlinked
21952 with either FP32 or FP64, but not both.
21953 The FP64A extension is similar to the FP64 extension but forbids the
21954 use of odd-numbered single-precision registers. This can be used
21955 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21956 processors and allows both FP32 and FP64A code to interlink and
21957 run in the same process without changing FPU modes.
21958
21959 @item -mabicalls
21960 @itemx -mno-abicalls
21961 @opindex mabicalls
21962 @opindex mno-abicalls
21963 Generate (do not generate) code that is suitable for SVR4-style
21964 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21965 systems.
21966
21967 @item -mshared
21968 @itemx -mno-shared
21969 Generate (do not generate) code that is fully position-independent,
21970 and that can therefore be linked into shared libraries. This option
21971 only affects @option{-mabicalls}.
21972
21973 All @option{-mabicalls} code has traditionally been position-independent,
21974 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21975 as an extension, the GNU toolchain allows executables to use absolute
21976 accesses for locally-binding symbols. It can also use shorter GP
21977 initialization sequences and generate direct calls to locally-defined
21978 functions. This mode is selected by @option{-mno-shared}.
21979
21980 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21981 objects that can only be linked by the GNU linker. However, the option
21982 does not affect the ABI of the final executable; it only affects the ABI
21983 of relocatable objects. Using @option{-mno-shared} generally makes
21984 executables both smaller and quicker.
21985
21986 @option{-mshared} is the default.
21987
21988 @item -mplt
21989 @itemx -mno-plt
21990 @opindex mplt
21991 @opindex mno-plt
21992 Assume (do not assume) that the static and dynamic linkers
21993 support PLTs and copy relocations. This option only affects
21994 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21995 has no effect without @option{-msym32}.
21996
21997 You can make @option{-mplt} the default by configuring
21998 GCC with @option{--with-mips-plt}. The default is
21999 @option{-mno-plt} otherwise.
22000
22001 @item -mxgot
22002 @itemx -mno-xgot
22003 @opindex mxgot
22004 @opindex mno-xgot
22005 Lift (do not lift) the usual restrictions on the size of the global
22006 offset table.
22007
22008 GCC normally uses a single instruction to load values from the GOT@.
22009 While this is relatively efficient, it only works if the GOT
22010 is smaller than about 64k. Anything larger causes the linker
22011 to report an error such as:
22012
22013 @cindex relocation truncated to fit (MIPS)
22014 @smallexample
22015 relocation truncated to fit: R_MIPS_GOT16 foobar
22016 @end smallexample
22017
22018 If this happens, you should recompile your code with @option{-mxgot}.
22019 This works with very large GOTs, although the code is also
22020 less efficient, since it takes three instructions to fetch the
22021 value of a global symbol.
22022
22023 Note that some linkers can create multiple GOTs. If you have such a
22024 linker, you should only need to use @option{-mxgot} when a single object
22025 file accesses more than 64k's worth of GOT entries. Very few do.
22026
22027 These options have no effect unless GCC is generating position
22028 independent code.
22029
22030 @item -mgp32
22031 @opindex mgp32
22032 Assume that general-purpose registers are 32 bits wide.
22033
22034 @item -mgp64
22035 @opindex mgp64
22036 Assume that general-purpose registers are 64 bits wide.
22037
22038 @item -mfp32
22039 @opindex mfp32
22040 Assume that floating-point registers are 32 bits wide.
22041
22042 @item -mfp64
22043 @opindex mfp64
22044 Assume that floating-point registers are 64 bits wide.
22045
22046 @item -mfpxx
22047 @opindex mfpxx
22048 Do not assume the width of floating-point registers.
22049
22050 @item -mhard-float
22051 @opindex mhard-float
22052 Use floating-point coprocessor instructions.
22053
22054 @item -msoft-float
22055 @opindex msoft-float
22056 Do not use floating-point coprocessor instructions. Implement
22057 floating-point calculations using library calls instead.
22058
22059 @item -mno-float
22060 @opindex mno-float
22061 Equivalent to @option{-msoft-float}, but additionally asserts that the
22062 program being compiled does not perform any floating-point operations.
22063 This option is presently supported only by some bare-metal MIPS
22064 configurations, where it may select a special set of libraries
22065 that lack all floating-point support (including, for example, the
22066 floating-point @code{printf} formats).
22067 If code compiled with @option{-mno-float} accidentally contains
22068 floating-point operations, it is likely to suffer a link-time
22069 or run-time failure.
22070
22071 @item -msingle-float
22072 @opindex msingle-float
22073 Assume that the floating-point coprocessor only supports single-precision
22074 operations.
22075
22076 @item -mdouble-float
22077 @opindex mdouble-float
22078 Assume that the floating-point coprocessor supports double-precision
22079 operations. This is the default.
22080
22081 @item -modd-spreg
22082 @itemx -mno-odd-spreg
22083 @opindex modd-spreg
22084 @opindex mno-odd-spreg
22085 Enable the use of odd-numbered single-precision floating-point registers
22086 for the o32 ABI. This is the default for processors that are known to
22087 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22088 is set by default.
22089
22090 @item -mabs=2008
22091 @itemx -mabs=legacy
22092 @opindex mabs=2008
22093 @opindex mabs=legacy
22094 These options control the treatment of the special not-a-number (NaN)
22095 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22096 @code{neg.@i{fmt}} machine instructions.
22097
22098 By default or when @option{-mabs=legacy} is used the legacy
22099 treatment is selected. In this case these instructions are considered
22100 arithmetic and avoided where correct operation is required and the
22101 input operand might be a NaN. A longer sequence of instructions that
22102 manipulate the sign bit of floating-point datum manually is used
22103 instead unless the @option{-ffinite-math-only} option has also been
22104 specified.
22105
22106 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22107 this case these instructions are considered non-arithmetic and therefore
22108 operating correctly in all cases, including in particular where the
22109 input operand is a NaN. These instructions are therefore always used
22110 for the respective operations.
22111
22112 @item -mnan=2008
22113 @itemx -mnan=legacy
22114 @opindex mnan=2008
22115 @opindex mnan=legacy
22116 These options control the encoding of the special not-a-number (NaN)
22117 IEEE 754 floating-point data.
22118
22119 The @option{-mnan=legacy} option selects the legacy encoding. In this
22120 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22121 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22122 by the first bit of their trailing significand field being 1.
22123
22124 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22125 this case qNaNs are denoted by the first bit of their trailing
22126 significand field being 1, whereas sNaNs are denoted by the first bit of
22127 their trailing significand field being 0.
22128
22129 The default is @option{-mnan=legacy} unless GCC has been configured with
22130 @option{--with-nan=2008}.
22131
22132 @item -mllsc
22133 @itemx -mno-llsc
22134 @opindex mllsc
22135 @opindex mno-llsc
22136 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22137 implement atomic memory built-in functions. When neither option is
22138 specified, GCC uses the instructions if the target architecture
22139 supports them.
22140
22141 @option{-mllsc} is useful if the runtime environment can emulate the
22142 instructions and @option{-mno-llsc} can be useful when compiling for
22143 nonstandard ISAs. You can make either option the default by
22144 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22145 respectively. @option{--with-llsc} is the default for some
22146 configurations; see the installation documentation for details.
22147
22148 @item -mdsp
22149 @itemx -mno-dsp
22150 @opindex mdsp
22151 @opindex mno-dsp
22152 Use (do not use) revision 1 of the MIPS DSP ASE@.
22153 @xref{MIPS DSP Built-in Functions}. This option defines the
22154 preprocessor macro @code{__mips_dsp}. It also defines
22155 @code{__mips_dsp_rev} to 1.
22156
22157 @item -mdspr2
22158 @itemx -mno-dspr2
22159 @opindex mdspr2
22160 @opindex mno-dspr2
22161 Use (do not use) revision 2 of the MIPS DSP ASE@.
22162 @xref{MIPS DSP Built-in Functions}. This option defines the
22163 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22164 It also defines @code{__mips_dsp_rev} to 2.
22165
22166 @item -msmartmips
22167 @itemx -mno-smartmips
22168 @opindex msmartmips
22169 @opindex mno-smartmips
22170 Use (do not use) the MIPS SmartMIPS ASE.
22171
22172 @item -mpaired-single
22173 @itemx -mno-paired-single
22174 @opindex mpaired-single
22175 @opindex mno-paired-single
22176 Use (do not use) paired-single floating-point instructions.
22177 @xref{MIPS Paired-Single Support}. This option requires
22178 hardware floating-point support to be enabled.
22179
22180 @item -mdmx
22181 @itemx -mno-mdmx
22182 @opindex mdmx
22183 @opindex mno-mdmx
22184 Use (do not use) MIPS Digital Media Extension instructions.
22185 This option can only be used when generating 64-bit code and requires
22186 hardware floating-point support to be enabled.
22187
22188 @item -mips3d
22189 @itemx -mno-mips3d
22190 @opindex mips3d
22191 @opindex mno-mips3d
22192 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22193 The option @option{-mips3d} implies @option{-mpaired-single}.
22194
22195 @item -mmicromips
22196 @itemx -mno-micromips
22197 @opindex mmicromips
22198 @opindex mno-mmicromips
22199 Generate (do not generate) microMIPS code.
22200
22201 MicroMIPS code generation can also be controlled on a per-function basis
22202 by means of @code{micromips} and @code{nomicromips} attributes.
22203 @xref{Function Attributes}, for more information.
22204
22205 @item -mmt
22206 @itemx -mno-mt
22207 @opindex mmt
22208 @opindex mno-mt
22209 Use (do not use) MT Multithreading instructions.
22210
22211 @item -mmcu
22212 @itemx -mno-mcu
22213 @opindex mmcu
22214 @opindex mno-mcu
22215 Use (do not use) the MIPS MCU ASE instructions.
22216
22217 @item -meva
22218 @itemx -mno-eva
22219 @opindex meva
22220 @opindex mno-eva
22221 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22222
22223 @item -mvirt
22224 @itemx -mno-virt
22225 @opindex mvirt
22226 @opindex mno-virt
22227 Use (do not use) the MIPS Virtualization (VZ) instructions.
22228
22229 @item -mxpa
22230 @itemx -mno-xpa
22231 @opindex mxpa
22232 @opindex mno-xpa
22233 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22234
22235 @item -mcrc
22236 @itemx -mno-crc
22237 @opindex mcrc
22238 @opindex mno-crc
22239 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22240
22241 @item -mginv
22242 @itemx -mno-ginv
22243 @opindex mginv
22244 @opindex mno-ginv
22245 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22246
22247 @item -mloongson-mmi
22248 @itemx -mno-loongson-mmi
22249 @opindex mloongson-mmi
22250 @opindex mno-loongson-mmi
22251 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22252
22253 @item -mloongson-ext
22254 @itemx -mno-loongson-ext
22255 @opindex mloongson-ext
22256 @opindex mno-loongson-ext
22257 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22258
22259 @item -mloongson-ext2
22260 @itemx -mno-loongson-ext2
22261 @opindex mloongson-ext2
22262 @opindex mno-loongson-ext2
22263 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22264
22265 @item -mlong64
22266 @opindex mlong64
22267 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22268 an explanation of the default and the way that the pointer size is
22269 determined.
22270
22271 @item -mlong32
22272 @opindex mlong32
22273 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22274
22275 The default size of @code{int}s, @code{long}s and pointers depends on
22276 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22277 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22278 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22279 or the same size as integer registers, whichever is smaller.
22280
22281 @item -msym32
22282 @itemx -mno-sym32
22283 @opindex msym32
22284 @opindex mno-sym32
22285 Assume (do not assume) that all symbols have 32-bit values, regardless
22286 of the selected ABI@. This option is useful in combination with
22287 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22288 to generate shorter and faster references to symbolic addresses.
22289
22290 @item -G @var{num}
22291 @opindex G
22292 Put definitions of externally-visible data in a small data section
22293 if that data is no bigger than @var{num} bytes. GCC can then generate
22294 more efficient accesses to the data; see @option{-mgpopt} for details.
22295
22296 The default @option{-G} option depends on the configuration.
22297
22298 @item -mlocal-sdata
22299 @itemx -mno-local-sdata
22300 @opindex mlocal-sdata
22301 @opindex mno-local-sdata
22302 Extend (do not extend) the @option{-G} behavior to local data too,
22303 such as to static variables in C@. @option{-mlocal-sdata} is the
22304 default for all configurations.
22305
22306 If the linker complains that an application is using too much small data,
22307 you might want to try rebuilding the less performance-critical parts with
22308 @option{-mno-local-sdata}. You might also want to build large
22309 libraries with @option{-mno-local-sdata}, so that the libraries leave
22310 more room for the main program.
22311
22312 @item -mextern-sdata
22313 @itemx -mno-extern-sdata
22314 @opindex mextern-sdata
22315 @opindex mno-extern-sdata
22316 Assume (do not assume) that externally-defined data is in
22317 a small data section if the size of that data is within the @option{-G} limit.
22318 @option{-mextern-sdata} is the default for all configurations.
22319
22320 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22321 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22322 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22323 is placed in a small data section. If @var{Var} is defined by another
22324 module, you must either compile that module with a high-enough
22325 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22326 definition. If @var{Var} is common, you must link the application
22327 with a high-enough @option{-G} setting.
22328
22329 The easiest way of satisfying these restrictions is to compile
22330 and link every module with the same @option{-G} option. However,
22331 you may wish to build a library that supports several different
22332 small data limits. You can do this by compiling the library with
22333 the highest supported @option{-G} setting and additionally using
22334 @option{-mno-extern-sdata} to stop the library from making assumptions
22335 about externally-defined data.
22336
22337 @item -mgpopt
22338 @itemx -mno-gpopt
22339 @opindex mgpopt
22340 @opindex mno-gpopt
22341 Use (do not use) GP-relative accesses for symbols that are known to be
22342 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22343 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22344 configurations.
22345
22346 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22347 might not hold the value of @code{_gp}. For example, if the code is
22348 part of a library that might be used in a boot monitor, programs that
22349 call boot monitor routines pass an unknown value in @code{$gp}.
22350 (In such situations, the boot monitor itself is usually compiled
22351 with @option{-G0}.)
22352
22353 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22354 @option{-mno-extern-sdata}.
22355
22356 @item -membedded-data
22357 @itemx -mno-embedded-data
22358 @opindex membedded-data
22359 @opindex mno-embedded-data
22360 Allocate variables to the read-only data section first if possible, then
22361 next in the small data section if possible, otherwise in data. This gives
22362 slightly slower code than the default, but reduces the amount of RAM required
22363 when executing, and thus may be preferred for some embedded systems.
22364
22365 @item -muninit-const-in-rodata
22366 @itemx -mno-uninit-const-in-rodata
22367 @opindex muninit-const-in-rodata
22368 @opindex mno-uninit-const-in-rodata
22369 Put uninitialized @code{const} variables in the read-only data section.
22370 This option is only meaningful in conjunction with @option{-membedded-data}.
22371
22372 @item -mcode-readable=@var{setting}
22373 @opindex mcode-readable
22374 Specify whether GCC may generate code that reads from executable sections.
22375 There are three possible settings:
22376
22377 @table @gcctabopt
22378 @item -mcode-readable=yes
22379 Instructions may freely access executable sections. This is the
22380 default setting.
22381
22382 @item -mcode-readable=pcrel
22383 MIPS16 PC-relative load instructions can access executable sections,
22384 but other instructions must not do so. This option is useful on 4KSc
22385 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22386 It is also useful on processors that can be configured to have a dual
22387 instruction/data SRAM interface and that, like the M4K, automatically
22388 redirect PC-relative loads to the instruction RAM.
22389
22390 @item -mcode-readable=no
22391 Instructions must not access executable sections. This option can be
22392 useful on targets that are configured to have a dual instruction/data
22393 SRAM interface but that (unlike the M4K) do not automatically redirect
22394 PC-relative loads to the instruction RAM.
22395 @end table
22396
22397 @item -msplit-addresses
22398 @itemx -mno-split-addresses
22399 @opindex msplit-addresses
22400 @opindex mno-split-addresses
22401 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22402 relocation operators. This option has been superseded by
22403 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22404
22405 @item -mexplicit-relocs
22406 @itemx -mno-explicit-relocs
22407 @opindex mexplicit-relocs
22408 @opindex mno-explicit-relocs
22409 Use (do not use) assembler relocation operators when dealing with symbolic
22410 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22411 is to use assembler macros instead.
22412
22413 @option{-mexplicit-relocs} is the default if GCC was configured
22414 to use an assembler that supports relocation operators.
22415
22416 @item -mcheck-zero-division
22417 @itemx -mno-check-zero-division
22418 @opindex mcheck-zero-division
22419 @opindex mno-check-zero-division
22420 Trap (do not trap) on integer division by zero.
22421
22422 The default is @option{-mcheck-zero-division}.
22423
22424 @item -mdivide-traps
22425 @itemx -mdivide-breaks
22426 @opindex mdivide-traps
22427 @opindex mdivide-breaks
22428 MIPS systems check for division by zero by generating either a
22429 conditional trap or a break instruction. Using traps results in
22430 smaller code, but is only supported on MIPS II and later. Also, some
22431 versions of the Linux kernel have a bug that prevents trap from
22432 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22433 allow conditional traps on architectures that support them and
22434 @option{-mdivide-breaks} to force the use of breaks.
22435
22436 The default is usually @option{-mdivide-traps}, but this can be
22437 overridden at configure time using @option{--with-divide=breaks}.
22438 Divide-by-zero checks can be completely disabled using
22439 @option{-mno-check-zero-division}.
22440
22441 @item -mload-store-pairs
22442 @itemx -mno-load-store-pairs
22443 @opindex mload-store-pairs
22444 @opindex mno-load-store-pairs
22445 Enable (disable) an optimization that pairs consecutive load or store
22446 instructions to enable load/store bonding. This option is enabled by
22447 default but only takes effect when the selected architecture is known
22448 to support bonding.
22449
22450 @item -mmemcpy
22451 @itemx -mno-memcpy
22452 @opindex mmemcpy
22453 @opindex mno-memcpy
22454 Force (do not force) the use of @code{memcpy} for non-trivial block
22455 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22456 most constant-sized copies.
22457
22458 @item -mlong-calls
22459 @itemx -mno-long-calls
22460 @opindex mlong-calls
22461 @opindex mno-long-calls
22462 Disable (do not disable) use of the @code{jal} instruction. Calling
22463 functions using @code{jal} is more efficient but requires the caller
22464 and callee to be in the same 256 megabyte segment.
22465
22466 This option has no effect on abicalls code. The default is
22467 @option{-mno-long-calls}.
22468
22469 @item -mmad
22470 @itemx -mno-mad
22471 @opindex mmad
22472 @opindex mno-mad
22473 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22474 instructions, as provided by the R4650 ISA@.
22475
22476 @item -mimadd
22477 @itemx -mno-imadd
22478 @opindex mimadd
22479 @opindex mno-imadd
22480 Enable (disable) use of the @code{madd} and @code{msub} integer
22481 instructions. The default is @option{-mimadd} on architectures
22482 that support @code{madd} and @code{msub} except for the 74k
22483 architecture where it was found to generate slower code.
22484
22485 @item -mfused-madd
22486 @itemx -mno-fused-madd
22487 @opindex mfused-madd
22488 @opindex mno-fused-madd
22489 Enable (disable) use of the floating-point multiply-accumulate
22490 instructions, when they are available. The default is
22491 @option{-mfused-madd}.
22492
22493 On the R8000 CPU when multiply-accumulate instructions are used,
22494 the intermediate product is calculated to infinite precision
22495 and is not subject to the FCSR Flush to Zero bit. This may be
22496 undesirable in some circumstances. On other processors the result
22497 is numerically identical to the equivalent computation using
22498 separate multiply, add, subtract and negate instructions.
22499
22500 @item -nocpp
22501 @opindex nocpp
22502 Tell the MIPS assembler to not run its preprocessor over user
22503 assembler files (with a @samp{.s} suffix) when assembling them.
22504
22505 @item -mfix-24k
22506 @itemx -mno-fix-24k
22507 @opindex mfix-24k
22508 @opindex mno-fix-24k
22509 Work around the 24K E48 (lost data on stores during refill) errata.
22510 The workarounds are implemented by the assembler rather than by GCC@.
22511
22512 @item -mfix-r4000
22513 @itemx -mno-fix-r4000
22514 @opindex mfix-r4000
22515 @opindex mno-fix-r4000
22516 Work around certain R4000 CPU errata:
22517 @itemize @minus
22518 @item
22519 A double-word or a variable shift may give an incorrect result if executed
22520 immediately after starting an integer division.
22521 @item
22522 A double-word or a variable shift may give an incorrect result if executed
22523 while an integer multiplication is in progress.
22524 @item
22525 An integer division may give an incorrect result if started in a delay slot
22526 of a taken branch or a jump.
22527 @end itemize
22528
22529 @item -mfix-r4400
22530 @itemx -mno-fix-r4400
22531 @opindex mfix-r4400
22532 @opindex mno-fix-r4400
22533 Work around certain R4400 CPU errata:
22534 @itemize @minus
22535 @item
22536 A double-word or a variable shift may give an incorrect result if executed
22537 immediately after starting an integer division.
22538 @end itemize
22539
22540 @item -mfix-r10000
22541 @itemx -mno-fix-r10000
22542 @opindex mfix-r10000
22543 @opindex mno-fix-r10000
22544 Work around certain R10000 errata:
22545 @itemize @minus
22546 @item
22547 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22548 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22549 @end itemize
22550
22551 This option can only be used if the target architecture supports
22552 branch-likely instructions. @option{-mfix-r10000} is the default when
22553 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22554 otherwise.
22555
22556 @item -mfix-r5900
22557 @itemx -mno-fix-r5900
22558 @opindex mfix-r5900
22559 Do not attempt to schedule the preceding instruction into the delay slot
22560 of a branch instruction placed at the end of a short loop of six
22561 instructions or fewer and always schedule a @code{nop} instruction there
22562 instead. The short loop bug under certain conditions causes loops to
22563 execute only once or twice, due to a hardware bug in the R5900 chip. The
22564 workaround is implemented by the assembler rather than by GCC@.
22565
22566 @item -mfix-rm7000
22567 @itemx -mno-fix-rm7000
22568 @opindex mfix-rm7000
22569 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22570 workarounds are implemented by the assembler rather than by GCC@.
22571
22572 @item -mfix-vr4120
22573 @itemx -mno-fix-vr4120
22574 @opindex mfix-vr4120
22575 Work around certain VR4120 errata:
22576 @itemize @minus
22577 @item
22578 @code{dmultu} does not always produce the correct result.
22579 @item
22580 @code{div} and @code{ddiv} do not always produce the correct result if one
22581 of the operands is negative.
22582 @end itemize
22583 The workarounds for the division errata rely on special functions in
22584 @file{libgcc.a}. At present, these functions are only provided by
22585 the @code{mips64vr*-elf} configurations.
22586
22587 Other VR4120 errata require a NOP to be inserted between certain pairs of
22588 instructions. These errata are handled by the assembler, not by GCC itself.
22589
22590 @item -mfix-vr4130
22591 @opindex mfix-vr4130
22592 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22593 workarounds are implemented by the assembler rather than by GCC,
22594 although GCC avoids using @code{mflo} and @code{mfhi} if the
22595 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22596 instructions are available instead.
22597
22598 @item -mfix-sb1
22599 @itemx -mno-fix-sb1
22600 @opindex mfix-sb1
22601 Work around certain SB-1 CPU core errata.
22602 (This flag currently works around the SB-1 revision 2
22603 ``F1'' and ``F2'' floating-point errata.)
22604
22605 @item -mr10k-cache-barrier=@var{setting}
22606 @opindex mr10k-cache-barrier
22607 Specify whether GCC should insert cache barriers to avoid the
22608 side effects of speculation on R10K processors.
22609
22610 In common with many processors, the R10K tries to predict the outcome
22611 of a conditional branch and speculatively executes instructions from
22612 the ``taken'' branch. It later aborts these instructions if the
22613 predicted outcome is wrong. However, on the R10K, even aborted
22614 instructions can have side effects.
22615
22616 This problem only affects kernel stores and, depending on the system,
22617 kernel loads. As an example, a speculatively-executed store may load
22618 the target memory into cache and mark the cache line as dirty, even if
22619 the store itself is later aborted. If a DMA operation writes to the
22620 same area of memory before the ``dirty'' line is flushed, the cached
22621 data overwrites the DMA-ed data. See the R10K processor manual
22622 for a full description, including other potential problems.
22623
22624 One workaround is to insert cache barrier instructions before every memory
22625 access that might be speculatively executed and that might have side
22626 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22627 controls GCC's implementation of this workaround. It assumes that
22628 aborted accesses to any byte in the following regions does not have
22629 side effects:
22630
22631 @enumerate
22632 @item
22633 the memory occupied by the current function's stack frame;
22634
22635 @item
22636 the memory occupied by an incoming stack argument;
22637
22638 @item
22639 the memory occupied by an object with a link-time-constant address.
22640 @end enumerate
22641
22642 It is the kernel's responsibility to ensure that speculative
22643 accesses to these regions are indeed safe.
22644
22645 If the input program contains a function declaration such as:
22646
22647 @smallexample
22648 void foo (void);
22649 @end smallexample
22650
22651 then the implementation of @code{foo} must allow @code{j foo} and
22652 @code{jal foo} to be executed speculatively. GCC honors this
22653 restriction for functions it compiles itself. It expects non-GCC
22654 functions (such as hand-written assembly code) to do the same.
22655
22656 The option has three forms:
22657
22658 @table @gcctabopt
22659 @item -mr10k-cache-barrier=load-store
22660 Insert a cache barrier before a load or store that might be
22661 speculatively executed and that might have side effects even
22662 if aborted.
22663
22664 @item -mr10k-cache-barrier=store
22665 Insert a cache barrier before a store that might be speculatively
22666 executed and that might have side effects even if aborted.
22667
22668 @item -mr10k-cache-barrier=none
22669 Disable the insertion of cache barriers. This is the default setting.
22670 @end table
22671
22672 @item -mflush-func=@var{func}
22673 @itemx -mno-flush-func
22674 @opindex mflush-func
22675 Specifies the function to call to flush the I and D caches, or to not
22676 call any such function. If called, the function must take the same
22677 arguments as the common @code{_flush_func}, that is, the address of the
22678 memory range for which the cache is being flushed, the size of the
22679 memory range, and the number 3 (to flush both caches). The default
22680 depends on the target GCC was configured for, but commonly is either
22681 @code{_flush_func} or @code{__cpu_flush}.
22682
22683 @item mbranch-cost=@var{num}
22684 @opindex mbranch-cost
22685 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22686 This cost is only a heuristic and is not guaranteed to produce
22687 consistent results across releases. A zero cost redundantly selects
22688 the default, which is based on the @option{-mtune} setting.
22689
22690 @item -mbranch-likely
22691 @itemx -mno-branch-likely
22692 @opindex mbranch-likely
22693 @opindex mno-branch-likely
22694 Enable or disable use of Branch Likely instructions, regardless of the
22695 default for the selected architecture. By default, Branch Likely
22696 instructions may be generated if they are supported by the selected
22697 architecture. An exception is for the MIPS32 and MIPS64 architectures
22698 and processors that implement those architectures; for those, Branch
22699 Likely instructions are not be generated by default because the MIPS32
22700 and MIPS64 architectures specifically deprecate their use.
22701
22702 @item -mcompact-branches=never
22703 @itemx -mcompact-branches=optimal
22704 @itemx -mcompact-branches=always
22705 @opindex mcompact-branches=never
22706 @opindex mcompact-branches=optimal
22707 @opindex mcompact-branches=always
22708 These options control which form of branches will be generated. The
22709 default is @option{-mcompact-branches=optimal}.
22710
22711 The @option{-mcompact-branches=never} option ensures that compact branch
22712 instructions will never be generated.
22713
22714 The @option{-mcompact-branches=always} option ensures that a compact
22715 branch instruction will be generated if available. If a compact branch
22716 instruction is not available, a delay slot form of the branch will be
22717 used instead.
22718
22719 This option is supported from MIPS Release 6 onwards.
22720
22721 The @option{-mcompact-branches=optimal} option will cause a delay slot
22722 branch to be used if one is available in the current ISA and the delay
22723 slot is successfully filled. If the delay slot is not filled, a compact
22724 branch will be chosen if one is available.
22725
22726 @item -mfp-exceptions
22727 @itemx -mno-fp-exceptions
22728 @opindex mfp-exceptions
22729 Specifies whether FP exceptions are enabled. This affects how
22730 FP instructions are scheduled for some processors.
22731 The default is that FP exceptions are
22732 enabled.
22733
22734 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22735 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22736 FP pipe.
22737
22738 @item -mvr4130-align
22739 @itemx -mno-vr4130-align
22740 @opindex mvr4130-align
22741 The VR4130 pipeline is two-way superscalar, but can only issue two
22742 instructions together if the first one is 8-byte aligned. When this
22743 option is enabled, GCC aligns pairs of instructions that it
22744 thinks should execute in parallel.
22745
22746 This option only has an effect when optimizing for the VR4130.
22747 It normally makes code faster, but at the expense of making it bigger.
22748 It is enabled by default at optimization level @option{-O3}.
22749
22750 @item -msynci
22751 @itemx -mno-synci
22752 @opindex msynci
22753 Enable (disable) generation of @code{synci} instructions on
22754 architectures that support it. The @code{synci} instructions (if
22755 enabled) are generated when @code{__builtin___clear_cache} is
22756 compiled.
22757
22758 This option defaults to @option{-mno-synci}, but the default can be
22759 overridden by configuring GCC with @option{--with-synci}.
22760
22761 When compiling code for single processor systems, it is generally safe
22762 to use @code{synci}. However, on many multi-core (SMP) systems, it
22763 does not invalidate the instruction caches on all cores and may lead
22764 to undefined behavior.
22765
22766 @item -mrelax-pic-calls
22767 @itemx -mno-relax-pic-calls
22768 @opindex mrelax-pic-calls
22769 Try to turn PIC calls that are normally dispatched via register
22770 @code{$25} into direct calls. This is only possible if the linker can
22771 resolve the destination at link time and if the destination is within
22772 range for a direct call.
22773
22774 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22775 an assembler and a linker that support the @code{.reloc} assembly
22776 directive and @option{-mexplicit-relocs} is in effect. With
22777 @option{-mno-explicit-relocs}, this optimization can be performed by the
22778 assembler and the linker alone without help from the compiler.
22779
22780 @item -mmcount-ra-address
22781 @itemx -mno-mcount-ra-address
22782 @opindex mmcount-ra-address
22783 @opindex mno-mcount-ra-address
22784 Emit (do not emit) code that allows @code{_mcount} to modify the
22785 calling function's return address. When enabled, this option extends
22786 the usual @code{_mcount} interface with a new @var{ra-address}
22787 parameter, which has type @code{intptr_t *} and is passed in register
22788 @code{$12}. @code{_mcount} can then modify the return address by
22789 doing both of the following:
22790 @itemize
22791 @item
22792 Returning the new address in register @code{$31}.
22793 @item
22794 Storing the new address in @code{*@var{ra-address}},
22795 if @var{ra-address} is nonnull.
22796 @end itemize
22797
22798 The default is @option{-mno-mcount-ra-address}.
22799
22800 @item -mframe-header-opt
22801 @itemx -mno-frame-header-opt
22802 @opindex mframe-header-opt
22803 Enable (disable) frame header optimization in the o32 ABI. When using the
22804 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22805 function to write out register arguments. When enabled, this optimization
22806 will suppress the allocation of the frame header if it can be determined that
22807 it is unused.
22808
22809 This optimization is off by default at all optimization levels.
22810
22811 @item -mlxc1-sxc1
22812 @itemx -mno-lxc1-sxc1
22813 @opindex mlxc1-sxc1
22814 When applicable, enable (disable) the generation of @code{lwxc1},
22815 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22816
22817 @item -mmadd4
22818 @itemx -mno-madd4
22819 @opindex mmadd4
22820 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22821 @code{madd.d} and related instructions. Enabled by default.
22822
22823 @end table
22824
22825 @node MMIX Options
22826 @subsection MMIX Options
22827 @cindex MMIX Options
22828
22829 These options are defined for the MMIX:
22830
22831 @table @gcctabopt
22832 @item -mlibfuncs
22833 @itemx -mno-libfuncs
22834 @opindex mlibfuncs
22835 @opindex mno-libfuncs
22836 Specify that intrinsic library functions are being compiled, passing all
22837 values in registers, no matter the size.
22838
22839 @item -mepsilon
22840 @itemx -mno-epsilon
22841 @opindex mepsilon
22842 @opindex mno-epsilon
22843 Generate floating-point comparison instructions that compare with respect
22844 to the @code{rE} epsilon register.
22845
22846 @item -mabi=mmixware
22847 @itemx -mabi=gnu
22848 @opindex mabi=mmixware
22849 @opindex mabi=gnu
22850 Generate code that passes function parameters and return values that (in
22851 the called function) are seen as registers @code{$0} and up, as opposed to
22852 the GNU ABI which uses global registers @code{$231} and up.
22853
22854 @item -mzero-extend
22855 @itemx -mno-zero-extend
22856 @opindex mzero-extend
22857 @opindex mno-zero-extend
22858 When reading data from memory in sizes shorter than 64 bits, use (do not
22859 use) zero-extending load instructions by default, rather than
22860 sign-extending ones.
22861
22862 @item -mknuthdiv
22863 @itemx -mno-knuthdiv
22864 @opindex mknuthdiv
22865 @opindex mno-knuthdiv
22866 Make the result of a division yielding a remainder have the same sign as
22867 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22868 remainder follows the sign of the dividend. Both methods are
22869 arithmetically valid, the latter being almost exclusively used.
22870
22871 @item -mtoplevel-symbols
22872 @itemx -mno-toplevel-symbols
22873 @opindex mtoplevel-symbols
22874 @opindex mno-toplevel-symbols
22875 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22876 code can be used with the @code{PREFIX} assembly directive.
22877
22878 @item -melf
22879 @opindex melf
22880 Generate an executable in the ELF format, rather than the default
22881 @samp{mmo} format used by the @command{mmix} simulator.
22882
22883 @item -mbranch-predict
22884 @itemx -mno-branch-predict
22885 @opindex mbranch-predict
22886 @opindex mno-branch-predict
22887 Use (do not use) the probable-branch instructions, when static branch
22888 prediction indicates a probable branch.
22889
22890 @item -mbase-addresses
22891 @itemx -mno-base-addresses
22892 @opindex mbase-addresses
22893 @opindex mno-base-addresses
22894 Generate (do not generate) code that uses @emph{base addresses}. Using a
22895 base address automatically generates a request (handled by the assembler
22896 and the linker) for a constant to be set up in a global register. The
22897 register is used for one or more base address requests within the range 0
22898 to 255 from the value held in the register. The generally leads to short
22899 and fast code, but the number of different data items that can be
22900 addressed is limited. This means that a program that uses lots of static
22901 data may require @option{-mno-base-addresses}.
22902
22903 @item -msingle-exit
22904 @itemx -mno-single-exit
22905 @opindex msingle-exit
22906 @opindex mno-single-exit
22907 Force (do not force) generated code to have a single exit point in each
22908 function.
22909 @end table
22910
22911 @node MN10300 Options
22912 @subsection MN10300 Options
22913 @cindex MN10300 options
22914
22915 These @option{-m} options are defined for Matsushita MN10300 architectures:
22916
22917 @table @gcctabopt
22918 @item -mmult-bug
22919 @opindex mmult-bug
22920 Generate code to avoid bugs in the multiply instructions for the MN10300
22921 processors. This is the default.
22922
22923 @item -mno-mult-bug
22924 @opindex mno-mult-bug
22925 Do not generate code to avoid bugs in the multiply instructions for the
22926 MN10300 processors.
22927
22928 @item -mam33
22929 @opindex mam33
22930 Generate code using features specific to the AM33 processor.
22931
22932 @item -mno-am33
22933 @opindex mno-am33
22934 Do not generate code using features specific to the AM33 processor. This
22935 is the default.
22936
22937 @item -mam33-2
22938 @opindex mam33-2
22939 Generate code using features specific to the AM33/2.0 processor.
22940
22941 @item -mam34
22942 @opindex mam34
22943 Generate code using features specific to the AM34 processor.
22944
22945 @item -mtune=@var{cpu-type}
22946 @opindex mtune
22947 Use the timing characteristics of the indicated CPU type when
22948 scheduling instructions. This does not change the targeted processor
22949 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22950 @samp{am33-2} or @samp{am34}.
22951
22952 @item -mreturn-pointer-on-d0
22953 @opindex mreturn-pointer-on-d0
22954 When generating a function that returns a pointer, return the pointer
22955 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22956 only in @code{a0}, and attempts to call such functions without a prototype
22957 result in errors. Note that this option is on by default; use
22958 @option{-mno-return-pointer-on-d0} to disable it.
22959
22960 @item -mno-crt0
22961 @opindex mno-crt0
22962 Do not link in the C run-time initialization object file.
22963
22964 @item -mrelax
22965 @opindex mrelax
22966 Indicate to the linker that it should perform a relaxation optimization pass
22967 to shorten branches, calls and absolute memory addresses. This option only
22968 has an effect when used on the command line for the final link step.
22969
22970 This option makes symbolic debugging impossible.
22971
22972 @item -mliw
22973 @opindex mliw
22974 Allow the compiler to generate @emph{Long Instruction Word}
22975 instructions if the target is the @samp{AM33} or later. This is the
22976 default. This option defines the preprocessor macro @code{__LIW__}.
22977
22978 @item -mno-liw
22979 @opindex mno-liw
22980 Do not allow the compiler to generate @emph{Long Instruction Word}
22981 instructions. This option defines the preprocessor macro
22982 @code{__NO_LIW__}.
22983
22984 @item -msetlb
22985 @opindex msetlb
22986 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22987 instructions if the target is the @samp{AM33} or later. This is the
22988 default. This option defines the preprocessor macro @code{__SETLB__}.
22989
22990 @item -mno-setlb
22991 @opindex mno-setlb
22992 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22993 instructions. This option defines the preprocessor macro
22994 @code{__NO_SETLB__}.
22995
22996 @end table
22997
22998 @node Moxie Options
22999 @subsection Moxie Options
23000 @cindex Moxie Options
23001
23002 @table @gcctabopt
23003
23004 @item -meb
23005 @opindex meb
23006 Generate big-endian code. This is the default for @samp{moxie-*-*}
23007 configurations.
23008
23009 @item -mel
23010 @opindex mel
23011 Generate little-endian code.
23012
23013 @item -mmul.x
23014 @opindex mmul.x
23015 Generate mul.x and umul.x instructions. This is the default for
23016 @samp{moxiebox-*-*} configurations.
23017
23018 @item -mno-crt0
23019 @opindex mno-crt0
23020 Do not link in the C run-time initialization object file.
23021
23022 @end table
23023
23024 @node MSP430 Options
23025 @subsection MSP430 Options
23026 @cindex MSP430 Options
23027
23028 These options are defined for the MSP430:
23029
23030 @table @gcctabopt
23031
23032 @item -masm-hex
23033 @opindex masm-hex
23034 Force assembly output to always use hex constants. Normally such
23035 constants are signed decimals, but this option is available for
23036 testsuite and/or aesthetic purposes.
23037
23038 @item -mmcu=
23039 @opindex mmcu=
23040 Select the MCU to target. This is used to create a C preprocessor
23041 symbol based upon the MCU name, converted to upper case and pre- and
23042 post-fixed with @samp{__}. This in turn is used by the
23043 @file{msp430.h} header file to select an MCU-specific supplementary
23044 header file.
23045
23046 The option also sets the ISA to use. If the MCU name is one that is
23047 known to only support the 430 ISA then that is selected, otherwise the
23048 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
23049 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
23050 name selects the 430X ISA.
23051
23052 In addition an MCU-specific linker script is added to the linker
23053 command line. The script's name is the name of the MCU with
23054 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
23055 command line defines the C preprocessor symbol @code{__XXX__} and
23056 cause the linker to search for a script called @file{xxx.ld}.
23057
23058 The ISA and hardware multiply supported for the different MCUs is hard-coded
23059 into GCC. However, an external @samp{devices.csv} file can be used to
23060 extend device support beyond those that have been hard-coded.
23061
23062 GCC searches for the @samp{devices.csv} file on the paths specified
23063 with the @code{-I} and @code{-L} options.
23064
23065 @item -mwarn-mcu
23066 @itemx -mno-warn-mcu
23067 @opindex mwarn-mcu
23068 @opindex mno-warn-mcu
23069 This option enables or disables warnings about conflicts between the
23070 MCU name specified by the @option{-mmcu} option and the ISA set by the
23071 @option{-mcpu} option and/or the hardware multiply support set by the
23072 @option{-mhwmult} option. It also toggles warnings about unrecognized
23073 MCU names. This option is on by default.
23074
23075 @item -mcpu=
23076 @opindex mcpu=
23077 Specifies the ISA to use. Accepted values are @samp{msp430},
23078 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
23079 @option{-mmcu=} option should be used to select the ISA.
23080
23081 @item -msim
23082 @opindex msim
23083 Link to the simulator runtime libraries and linker script. Overrides
23084 any scripts that would be selected by the @option{-mmcu=} option.
23085
23086 @item -mlarge
23087 @opindex mlarge
23088 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23089
23090 @item -msmall
23091 @opindex msmall
23092 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23093
23094 @item -mrelax
23095 @opindex mrelax
23096 This option is passed to the assembler and linker, and allows the
23097 linker to perform certain optimizations that cannot be done until
23098 the final link.
23099
23100 @item mhwmult=
23101 @opindex mhwmult=
23102 Describes the type of hardware multiply supported by the target.
23103 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23104 for the original 16-bit-only multiply supported by early MCUs.
23105 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23106 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23107 A value of @samp{auto} can also be given. This tells GCC to deduce
23108 the hardware multiply support based upon the MCU name provided by the
23109 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23110 the MCU name is not recognized then no hardware multiply support is
23111 assumed. @code{auto} is the default setting.
23112
23113 Hardware multiplies are normally performed by calling a library
23114 routine. This saves space in the generated code. When compiling at
23115 @option{-O3} or higher however the hardware multiplier is invoked
23116 inline. This makes for bigger, but faster code.
23117
23118 The hardware multiply routines disable interrupts whilst running and
23119 restore the previous interrupt state when they finish. This makes
23120 them safe to use inside interrupt handlers as well as in normal code.
23121
23122 @item -minrt
23123 @opindex minrt
23124 Enable the use of a minimum runtime environment - no static
23125 initializers or constructors. This is intended for memory-constrained
23126 devices. The compiler includes special symbols in some objects
23127 that tell the linker and runtime which code fragments are required.
23128
23129 @item -mcode-region=
23130 @itemx -mdata-region=
23131 @opindex mcode-region
23132 @opindex mdata-region
23133 These options tell the compiler where to place functions and data that
23134 do not have one of the @code{lower}, @code{upper}, @code{either} or
23135 @code{section} attributes. Possible values are @code{lower},
23136 @code{upper}, @code{either} or @code{any}. The first three behave
23137 like the corresponding attribute. The fourth possible value -
23138 @code{any} - is the default. It leaves placement entirely up to the
23139 linker script and how it assigns the standard sections
23140 (@code{.text}, @code{.data}, etc) to the memory regions.
23141
23142 @item -msilicon-errata=
23143 @opindex msilicon-errata
23144 This option passes on a request to assembler to enable the fixes for
23145 the named silicon errata.
23146
23147 @item -msilicon-errata-warn=
23148 @opindex msilicon-errata-warn
23149 This option passes on a request to the assembler to enable warning
23150 messages when a silicon errata might need to be applied.
23151
23152 @item -mwarn-devices-csv
23153 @itemx -mno-warn-devices-csv
23154 @opindex mwarn-devices-csv
23155 @opindex mno-warn-devices-csv
23156 Warn if @samp{devices.csv} is not found or there are problem parsing it
23157 (default: on).
23158
23159 @end table
23160
23161 @node NDS32 Options
23162 @subsection NDS32 Options
23163 @cindex NDS32 Options
23164
23165 These options are defined for NDS32 implementations:
23166
23167 @table @gcctabopt
23168
23169 @item -mbig-endian
23170 @opindex mbig-endian
23171 Generate code in big-endian mode.
23172
23173 @item -mlittle-endian
23174 @opindex mlittle-endian
23175 Generate code in little-endian mode.
23176
23177 @item -mreduced-regs
23178 @opindex mreduced-regs
23179 Use reduced-set registers for register allocation.
23180
23181 @item -mfull-regs
23182 @opindex mfull-regs
23183 Use full-set registers for register allocation.
23184
23185 @item -mcmov
23186 @opindex mcmov
23187 Generate conditional move instructions.
23188
23189 @item -mno-cmov
23190 @opindex mno-cmov
23191 Do not generate conditional move instructions.
23192
23193 @item -mext-perf
23194 @opindex mext-perf
23195 Generate performance extension instructions.
23196
23197 @item -mno-ext-perf
23198 @opindex mno-ext-perf
23199 Do not generate performance extension instructions.
23200
23201 @item -mext-perf2
23202 @opindex mext-perf2
23203 Generate performance extension 2 instructions.
23204
23205 @item -mno-ext-perf2
23206 @opindex mno-ext-perf2
23207 Do not generate performance extension 2 instructions.
23208
23209 @item -mext-string
23210 @opindex mext-string
23211 Generate string extension instructions.
23212
23213 @item -mno-ext-string
23214 @opindex mno-ext-string
23215 Do not generate string extension instructions.
23216
23217 @item -mv3push
23218 @opindex mv3push
23219 Generate v3 push25/pop25 instructions.
23220
23221 @item -mno-v3push
23222 @opindex mno-v3push
23223 Do not generate v3 push25/pop25 instructions.
23224
23225 @item -m16-bit
23226 @opindex m16-bit
23227 Generate 16-bit instructions.
23228
23229 @item -mno-16-bit
23230 @opindex mno-16-bit
23231 Do not generate 16-bit instructions.
23232
23233 @item -misr-vector-size=@var{num}
23234 @opindex misr-vector-size
23235 Specify the size of each interrupt vector, which must be 4 or 16.
23236
23237 @item -mcache-block-size=@var{num}
23238 @opindex mcache-block-size
23239 Specify the size of each cache block,
23240 which must be a power of 2 between 4 and 512.
23241
23242 @item -march=@var{arch}
23243 @opindex march
23244 Specify the name of the target architecture.
23245
23246 @item -mcmodel=@var{code-model}
23247 @opindex mcmodel
23248 Set the code model to one of
23249 @table @asis
23250 @item @samp{small}
23251 All the data and read-only data segments must be within 512KB addressing space.
23252 The text segment must be within 16MB addressing space.
23253 @item @samp{medium}
23254 The data segment must be within 512KB while the read-only data segment can be
23255 within 4GB addressing space. The text segment should be still within 16MB
23256 addressing space.
23257 @item @samp{large}
23258 All the text and data segments can be within 4GB addressing space.
23259 @end table
23260
23261 @item -mctor-dtor
23262 @opindex mctor-dtor
23263 Enable constructor/destructor feature.
23264
23265 @item -mrelax
23266 @opindex mrelax
23267 Guide linker to relax instructions.
23268
23269 @end table
23270
23271 @node Nios II Options
23272 @subsection Nios II Options
23273 @cindex Nios II options
23274 @cindex Altera Nios II options
23275
23276 These are the options defined for the Altera Nios II processor.
23277
23278 @table @gcctabopt
23279
23280 @item -G @var{num}
23281 @opindex G
23282 @cindex smaller data references
23283 Put global and static objects less than or equal to @var{num} bytes
23284 into the small data or BSS sections instead of the normal data or BSS
23285 sections. The default value of @var{num} is 8.
23286
23287 @item -mgpopt=@var{option}
23288 @itemx -mgpopt
23289 @itemx -mno-gpopt
23290 @opindex mgpopt
23291 @opindex mno-gpopt
23292 Generate (do not generate) GP-relative accesses. The following
23293 @var{option} names are recognized:
23294
23295 @table @samp
23296
23297 @item none
23298 Do not generate GP-relative accesses.
23299
23300 @item local
23301 Generate GP-relative accesses for small data objects that are not
23302 external, weak, or uninitialized common symbols.
23303 Also use GP-relative addressing for objects that
23304 have been explicitly placed in a small data section via a @code{section}
23305 attribute.
23306
23307 @item global
23308 As for @samp{local}, but also generate GP-relative accesses for
23309 small data objects that are external, weak, or common. If you use this option,
23310 you must ensure that all parts of your program (including libraries) are
23311 compiled with the same @option{-G} setting.
23312
23313 @item data
23314 Generate GP-relative accesses for all data objects in the program. If you
23315 use this option, the entire data and BSS segments
23316 of your program must fit in 64K of memory and you must use an appropriate
23317 linker script to allocate them within the addressable range of the
23318 global pointer.
23319
23320 @item all
23321 Generate GP-relative addresses for function pointers as well as data
23322 pointers. If you use this option, the entire text, data, and BSS segments
23323 of your program must fit in 64K of memory and you must use an appropriate
23324 linker script to allocate them within the addressable range of the
23325 global pointer.
23326
23327 @end table
23328
23329 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23330 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23331
23332 The default is @option{-mgpopt} except when @option{-fpic} or
23333 @option{-fPIC} is specified to generate position-independent code.
23334 Note that the Nios II ABI does not permit GP-relative accesses from
23335 shared libraries.
23336
23337 You may need to specify @option{-mno-gpopt} explicitly when building
23338 programs that include large amounts of small data, including large
23339 GOT data sections. In this case, the 16-bit offset for GP-relative
23340 addressing may not be large enough to allow access to the entire
23341 small data section.
23342
23343 @item -mgprel-sec=@var{regexp}
23344 @opindex mgprel-sec
23345 This option specifies additional section names that can be accessed via
23346 GP-relative addressing. It is most useful in conjunction with
23347 @code{section} attributes on variable declarations
23348 (@pxref{Common Variable Attributes}) and a custom linker script.
23349 The @var{regexp} is a POSIX Extended Regular Expression.
23350
23351 This option does not affect the behavior of the @option{-G} option, and
23352 the specified sections are in addition to the standard @code{.sdata}
23353 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23354
23355 @item -mr0rel-sec=@var{regexp}
23356 @opindex mr0rel-sec
23357 This option specifies names of sections that can be accessed via a
23358 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23359 of the 32-bit address space. It is most useful in conjunction with
23360 @code{section} attributes on variable declarations
23361 (@pxref{Common Variable Attributes}) and a custom linker script.
23362 The @var{regexp} is a POSIX Extended Regular Expression.
23363
23364 In contrast to the use of GP-relative addressing for small data,
23365 zero-based addressing is never generated by default and there are no
23366 conventional section names used in standard linker scripts for sections
23367 in the low or high areas of memory.
23368
23369 @item -mel
23370 @itemx -meb
23371 @opindex mel
23372 @opindex meb
23373 Generate little-endian (default) or big-endian (experimental) code,
23374 respectively.
23375
23376 @item -march=@var{arch}
23377 @opindex march
23378 This specifies the name of the target Nios II architecture. GCC uses this
23379 name to determine what kind of instructions it can emit when generating
23380 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23381
23382 The preprocessor macro @code{__nios2_arch__} is available to programs,
23383 with value 1 or 2, indicating the targeted ISA level.
23384
23385 @item -mbypass-cache
23386 @itemx -mno-bypass-cache
23387 @opindex mno-bypass-cache
23388 @opindex mbypass-cache
23389 Force all load and store instructions to always bypass cache by
23390 using I/O variants of the instructions. The default is not to
23391 bypass the cache.
23392
23393 @item -mno-cache-volatile
23394 @itemx -mcache-volatile
23395 @opindex mcache-volatile
23396 @opindex mno-cache-volatile
23397 Volatile memory access bypass the cache using the I/O variants of
23398 the load and store instructions. The default is not to bypass the cache.
23399
23400 @item -mno-fast-sw-div
23401 @itemx -mfast-sw-div
23402 @opindex mno-fast-sw-div
23403 @opindex mfast-sw-div
23404 Do not use table-based fast divide for small numbers. The default
23405 is to use the fast divide at @option{-O3} and above.
23406
23407 @item -mno-hw-mul
23408 @itemx -mhw-mul
23409 @itemx -mno-hw-mulx
23410 @itemx -mhw-mulx
23411 @itemx -mno-hw-div
23412 @itemx -mhw-div
23413 @opindex mno-hw-mul
23414 @opindex mhw-mul
23415 @opindex mno-hw-mulx
23416 @opindex mhw-mulx
23417 @opindex mno-hw-div
23418 @opindex mhw-div
23419 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23420 instructions by the compiler. The default is to emit @code{mul}
23421 and not emit @code{div} and @code{mulx}.
23422
23423 @item -mbmx
23424 @itemx -mno-bmx
23425 @itemx -mcdx
23426 @itemx -mno-cdx
23427 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23428 CDX (code density) instructions. Enabling these instructions also
23429 requires @option{-march=r2}. Since these instructions are optional
23430 extensions to the R2 architecture, the default is not to emit them.
23431
23432 @item -mcustom-@var{insn}=@var{N}
23433 @itemx -mno-custom-@var{insn}
23434 @opindex mcustom-@var{insn}
23435 @opindex mno-custom-@var{insn}
23436 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23437 custom instruction with encoding @var{N} when generating code that uses
23438 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23439 instruction 253 for single-precision floating-point add operations instead
23440 of the default behavior of using a library call.
23441
23442 The following values of @var{insn} are supported. Except as otherwise
23443 noted, floating-point operations are expected to be implemented with
23444 normal IEEE 754 semantics and correspond directly to the C operators or the
23445 equivalent GCC built-in functions (@pxref{Other Builtins}).
23446
23447 Single-precision floating point:
23448 @table @asis
23449
23450 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23451 Binary arithmetic operations.
23452
23453 @item @samp{fnegs}
23454 Unary negation.
23455
23456 @item @samp{fabss}
23457 Unary absolute value.
23458
23459 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23460 Comparison operations.
23461
23462 @item @samp{fmins}, @samp{fmaxs}
23463 Floating-point minimum and maximum. These instructions are only
23464 generated if @option{-ffinite-math-only} is specified.
23465
23466 @item @samp{fsqrts}
23467 Unary square root operation.
23468
23469 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23470 Floating-point trigonometric and exponential functions. These instructions
23471 are only generated if @option{-funsafe-math-optimizations} is also specified.
23472
23473 @end table
23474
23475 Double-precision floating point:
23476 @table @asis
23477
23478 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23479 Binary arithmetic operations.
23480
23481 @item @samp{fnegd}
23482 Unary negation.
23483
23484 @item @samp{fabsd}
23485 Unary absolute value.
23486
23487 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23488 Comparison operations.
23489
23490 @item @samp{fmind}, @samp{fmaxd}
23491 Double-precision minimum and maximum. These instructions are only
23492 generated if @option{-ffinite-math-only} is specified.
23493
23494 @item @samp{fsqrtd}
23495 Unary square root operation.
23496
23497 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23498 Double-precision trigonometric and exponential functions. These instructions
23499 are only generated if @option{-funsafe-math-optimizations} is also specified.
23500
23501 @end table
23502
23503 Conversions:
23504 @table @asis
23505 @item @samp{fextsd}
23506 Conversion from single precision to double precision.
23507
23508 @item @samp{ftruncds}
23509 Conversion from double precision to single precision.
23510
23511 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23512 Conversion from floating point to signed or unsigned integer types, with
23513 truncation towards zero.
23514
23515 @item @samp{round}
23516 Conversion from single-precision floating point to signed integer,
23517 rounding to the nearest integer and ties away from zero.
23518 This corresponds to the @code{__builtin_lroundf} function when
23519 @option{-fno-math-errno} is used.
23520
23521 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23522 Conversion from signed or unsigned integer types to floating-point types.
23523
23524 @end table
23525
23526 In addition, all of the following transfer instructions for internal
23527 registers X and Y must be provided to use any of the double-precision
23528 floating-point instructions. Custom instructions taking two
23529 double-precision source operands expect the first operand in the
23530 64-bit register X. The other operand (or only operand of a unary
23531 operation) is given to the custom arithmetic instruction with the
23532 least significant half in source register @var{src1} and the most
23533 significant half in @var{src2}. A custom instruction that returns a
23534 double-precision result returns the most significant 32 bits in the
23535 destination register and the other half in 32-bit register Y.
23536 GCC automatically generates the necessary code sequences to write
23537 register X and/or read register Y when double-precision floating-point
23538 instructions are used.
23539
23540 @table @asis
23541
23542 @item @samp{fwrx}
23543 Write @var{src1} into the least significant half of X and @var{src2} into
23544 the most significant half of X.
23545
23546 @item @samp{fwry}
23547 Write @var{src1} into Y.
23548
23549 @item @samp{frdxhi}, @samp{frdxlo}
23550 Read the most or least (respectively) significant half of X and store it in
23551 @var{dest}.
23552
23553 @item @samp{frdy}
23554 Read the value of Y and store it into @var{dest}.
23555 @end table
23556
23557 Note that you can gain more local control over generation of Nios II custom
23558 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23559 and @code{target("no-custom-@var{insn}")} function attributes
23560 (@pxref{Function Attributes})
23561 or pragmas (@pxref{Function Specific Option Pragmas}).
23562
23563 @item -mcustom-fpu-cfg=@var{name}
23564 @opindex mcustom-fpu-cfg
23565
23566 This option enables a predefined, named set of custom instruction encodings
23567 (see @option{-mcustom-@var{insn}} above).
23568 Currently, the following sets are defined:
23569
23570 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23571 @gccoptlist{-mcustom-fmuls=252 @gol
23572 -mcustom-fadds=253 @gol
23573 -mcustom-fsubs=254 @gol
23574 -fsingle-precision-constant}
23575
23576 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23577 @gccoptlist{-mcustom-fmuls=252 @gol
23578 -mcustom-fadds=253 @gol
23579 -mcustom-fsubs=254 @gol
23580 -mcustom-fdivs=255 @gol
23581 -fsingle-precision-constant}
23582
23583 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23584 @gccoptlist{-mcustom-floatus=243 @gol
23585 -mcustom-fixsi=244 @gol
23586 -mcustom-floatis=245 @gol
23587 -mcustom-fcmpgts=246 @gol
23588 -mcustom-fcmples=249 @gol
23589 -mcustom-fcmpeqs=250 @gol
23590 -mcustom-fcmpnes=251 @gol
23591 -mcustom-fmuls=252 @gol
23592 -mcustom-fadds=253 @gol
23593 -mcustom-fsubs=254 @gol
23594 -mcustom-fdivs=255 @gol
23595 -fsingle-precision-constant}
23596
23597 Custom instruction assignments given by individual
23598 @option{-mcustom-@var{insn}=} options override those given by
23599 @option{-mcustom-fpu-cfg=}, regardless of the
23600 order of the options on the command line.
23601
23602 Note that you can gain more local control over selection of a FPU
23603 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23604 function attribute (@pxref{Function Attributes})
23605 or pragma (@pxref{Function Specific Option Pragmas}).
23606
23607 @end table
23608
23609 These additional @samp{-m} options are available for the Altera Nios II
23610 ELF (bare-metal) target:
23611
23612 @table @gcctabopt
23613
23614 @item -mhal
23615 @opindex mhal
23616 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23617 startup and termination code, and is typically used in conjunction with
23618 @option{-msys-crt0=} to specify the location of the alternate startup code
23619 provided by the HAL BSP.
23620
23621 @item -msmallc
23622 @opindex msmallc
23623 Link with a limited version of the C library, @option{-lsmallc}, rather than
23624 Newlib.
23625
23626 @item -msys-crt0=@var{startfile}
23627 @opindex msys-crt0
23628 @var{startfile} is the file name of the startfile (crt0) to use
23629 when linking. This option is only useful in conjunction with @option{-mhal}.
23630
23631 @item -msys-lib=@var{systemlib}
23632 @opindex msys-lib
23633 @var{systemlib} is the library name of the library that provides
23634 low-level system calls required by the C library,
23635 e.g.@: @code{read} and @code{write}.
23636 This option is typically used to link with a library provided by a HAL BSP.
23637
23638 @end table
23639
23640 @node Nvidia PTX Options
23641 @subsection Nvidia PTX Options
23642 @cindex Nvidia PTX options
23643 @cindex nvptx options
23644
23645 These options are defined for Nvidia PTX:
23646
23647 @table @gcctabopt
23648
23649 @item -m32
23650 @itemx -m64
23651 @opindex m32
23652 @opindex m64
23653 Generate code for 32-bit or 64-bit ABI.
23654
23655 @item -misa=@var{ISA-string}
23656 @opindex march
23657 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23658 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23659 @samp{sm_35}. The default ISA is sm_30.
23660
23661 @item -mmainkernel
23662 @opindex mmainkernel
23663 Link in code for a __main kernel. This is for stand-alone instead of
23664 offloading execution.
23665
23666 @item -moptimize
23667 @opindex moptimize
23668 Apply partitioned execution optimizations. This is the default when any
23669 level of optimization is selected.
23670
23671 @item -msoft-stack
23672 @opindex msoft-stack
23673 Generate code that does not use @code{.local} memory
23674 directly for stack storage. Instead, a per-warp stack pointer is
23675 maintained explicitly. This enables variable-length stack allocation (with
23676 variable-length arrays or @code{alloca}), and when global memory is used for
23677 underlying storage, makes it possible to access automatic variables from other
23678 threads, or with atomic instructions. This code generation variant is used
23679 for OpenMP offloading, but the option is exposed on its own for the purpose
23680 of testing the compiler; to generate code suitable for linking into programs
23681 using OpenMP offloading, use option @option{-mgomp}.
23682
23683 @item -muniform-simt
23684 @opindex muniform-simt
23685 Switch to code generation variant that allows to execute all threads in each
23686 warp, while maintaining memory state and side effects as if only one thread
23687 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23688 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23689 current lane index equals the master lane index), and the register being
23690 assigned is copied via a shuffle instruction from the master lane. Outside of
23691 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23692 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23693 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23694 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23695 with current lane index to compute the master lane index.
23696
23697 @item -mgomp
23698 @opindex mgomp
23699 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23700 @option{-muniform-simt} options, and selects corresponding multilib variant.
23701
23702 @end table
23703
23704 @node OpenRISC Options
23705 @subsection OpenRISC Options
23706 @cindex OpenRISC Options
23707
23708 These options are defined for OpenRISC:
23709
23710 @table @gcctabopt
23711
23712 @item -mboard=@var{name}
23713 @opindex mboard
23714 Configure a board specific runtime. This will be passed to the linker for
23715 newlib board library linking. The default is @code{or1ksim}.
23716
23717 @item -mnewlib
23718 @opindex mnewlib
23719 This option is ignored; it is for compatibility purposes only. This used to
23720 select linker and preprocessor options for use with newlib.
23721
23722 @item -msoft-div
23723 @itemx -mhard-div
23724 @opindex msoft-div
23725 @opindex mhard-div
23726 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
23727 This default is hardware divide.
23728
23729 @item -msoft-mul
23730 @itemx -mhard-mul
23731 @opindex msoft-mul
23732 @opindex mhard-mul
23733 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
23734 This default is hardware multiply.
23735
23736 @item -msoft-float
23737 @itemx -mhard-float
23738 @opindex msoft-float
23739 @opindex mhard-float
23740 Select software or hardware for floating point operations.
23741 The default is software.
23742
23743 @item -mdouble-float
23744 @opindex mdouble-float
23745 When @option{-mhard-float} is selected, enables generation of double-precision
23746 floating point instructions. By default functions from @file{libgcc} are used
23747 to perform double-precision floating point operations.
23748
23749 @item -munordered-float
23750 @opindex munordered-float
23751 When @option{-mhard-float} is selected, enables generation of unordered
23752 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
23753 functions from @file{libgcc} are used to perform unordered floating point
23754 compare and set flag operations.
23755
23756 @item -mcmov
23757 @opindex mcmov
23758 Enable generation of conditional move (@code{l.cmov}) instructions. By
23759 default the equivalent will be generated using using set and branch.
23760
23761 @item -mror
23762 @opindex mror
23763 Enable generation of rotate right (@code{l.ror}) instructions. By default
23764 functions from @file{libgcc} are used to perform rotate right operations.
23765
23766 @item -mrori
23767 @opindex mrori
23768 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
23769 By default functions from @file{libgcc} are used to perform rotate right with
23770 immediate operations.
23771
23772 @item -msext
23773 @opindex msext
23774 Enable generation of sign extension (@code{l.ext*}) instructions. By default
23775 memory loads are used to perform sign extension.
23776
23777 @item -msfimm
23778 @opindex msfimm
23779 Enable generation of compare and set flag with immediate (@code{l.sf*i})
23780 instructions. By default extra instructions will be generated to store the
23781 immediate to a register first.
23782
23783 @item -mshftimm
23784 @opindex mshftimm
23785 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
23786 @code{l.slli}) instructions. By default extra instructions will be generated
23787 to store the immediate to a register first.
23788
23789
23790 @end table
23791
23792 @node PDP-11 Options
23793 @subsection PDP-11 Options
23794 @cindex PDP-11 Options
23795
23796 These options are defined for the PDP-11:
23797
23798 @table @gcctabopt
23799 @item -mfpu
23800 @opindex mfpu
23801 Use hardware FPP floating point. This is the default. (FIS floating
23802 point on the PDP-11/40 is not supported.) Implies -m45.
23803
23804 @item -msoft-float
23805 @opindex msoft-float
23806 Do not use hardware floating point.
23807
23808 @item -mac0
23809 @opindex mac0
23810 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23811
23812 @item -mno-ac0
23813 @opindex mno-ac0
23814 Return floating-point results in memory. This is the default.
23815
23816 @item -m40
23817 @opindex m40
23818 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23819
23820 @item -m45
23821 @opindex m45
23822 Generate code for a PDP-11/45. This is the default.
23823
23824 @item -m10
23825 @opindex m10
23826 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23827
23828 @item -mint16
23829 @itemx -mno-int32
23830 @opindex mint16
23831 @opindex mno-int32
23832 Use 16-bit @code{int}. This is the default.
23833
23834 @item -mint32
23835 @itemx -mno-int16
23836 @opindex mint32
23837 @opindex mno-int16
23838 Use 32-bit @code{int}.
23839
23840 @item -msplit
23841 @opindex msplit
23842 Target has split instruction and data space. Implies -m45.
23843
23844 @item -munix-asm
23845 @opindex munix-asm
23846 Use Unix assembler syntax.
23847
23848 @item -mdec-asm
23849 @opindex mdec-asm
23850 Use DEC assembler syntax.
23851
23852 @item -mgnu-asm
23853 @opindex mgnu-asm
23854 Use GNU assembler syntax. This is the default.
23855
23856 @item -mlra
23857 @opindex mlra
23858 Use the new LRA register allocator. By default, the old ``reload''
23859 allocator is used.
23860 @end table
23861
23862 @node picoChip Options
23863 @subsection picoChip Options
23864 @cindex picoChip options
23865
23866 These @samp{-m} options are defined for picoChip implementations:
23867
23868 @table @gcctabopt
23869
23870 @item -mae=@var{ae_type}
23871 @opindex mcpu
23872 Set the instruction set, register set, and instruction scheduling
23873 parameters for array element type @var{ae_type}. Supported values
23874 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23875
23876 @option{-mae=ANY} selects a completely generic AE type. Code
23877 generated with this option runs on any of the other AE types. The
23878 code is not as efficient as it would be if compiled for a specific
23879 AE type, and some types of operation (e.g., multiplication) do not
23880 work properly on all types of AE.
23881
23882 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23883 for compiled code, and is the default.
23884
23885 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23886 option may suffer from poor performance of byte (char) manipulation,
23887 since the DSP AE does not provide hardware support for byte load/stores.
23888
23889 @item -msymbol-as-address
23890 Enable the compiler to directly use a symbol name as an address in a
23891 load/store instruction, without first loading it into a
23892 register. Typically, the use of this option generates larger
23893 programs, which run faster than when the option isn't used. However, the
23894 results vary from program to program, so it is left as a user option,
23895 rather than being permanently enabled.
23896
23897 @item -mno-inefficient-warnings
23898 Disables warnings about the generation of inefficient code. These
23899 warnings can be generated, for example, when compiling code that
23900 performs byte-level memory operations on the MAC AE type. The MAC AE has
23901 no hardware support for byte-level memory operations, so all byte
23902 load/stores must be synthesized from word load/store operations. This is
23903 inefficient and a warning is generated to indicate
23904 that you should rewrite the code to avoid byte operations, or to target
23905 an AE type that has the necessary hardware support. This option disables
23906 these warnings.
23907
23908 @end table
23909
23910 @node PowerPC Options
23911 @subsection PowerPC Options
23912 @cindex PowerPC options
23913
23914 These are listed under @xref{RS/6000 and PowerPC Options}.
23915
23916 @node PRU Options
23917 @subsection PRU Options
23918 @cindex PRU Options
23919
23920 These command-line options are defined for PRU target:
23921
23922 @table @gcctabopt
23923 @item -minrt
23924 @opindex minrt
23925 Link with a minimum runtime environment, with no support for static
23926 initializers and constructors. Using this option can significantly reduce
23927 the size of the final ELF binary. Beware that the compiler could still
23928 generate code with static initializers and constructors. It is up to the
23929 programmer to ensure that the source program will not use those features.
23930
23931 @item -mmcu=@var{mcu}
23932 @opindex mmcu
23933 Specify the PRU MCU variant to use. Check Newlib for the exact list of
23934 supported MCUs.
23935
23936 @item -mno-relax
23937 @opindex mno-relax
23938 Make GCC pass the @option{--no-relax} command-line option to the linker
23939 instead of the @option{--relax} option.
23940
23941 @item -mloop
23942 @opindex mloop
23943 Allow (or do not allow) GCC to use the LOOP instruction.
23944
23945 @item -mabi=@var{variant}
23946 @opindex mabi
23947 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
23948 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
23949 more naturally with certain GCC assumptions. These are the differences:
23950
23951 @table @samp
23952 @item Function Pointer Size
23953 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
23954 supports only 32-bit data and code pointers.
23955
23956 @item Optional Return Value Pointer
23957 Function return values larger than 64 bits are passed by using a hidden
23958 pointer as the first argument of the function. TI ABI, though, mandates that
23959 the pointer can be NULL in case the caller is not using the returned value.
23960 GNU always passes and expects a valid return value pointer.
23961
23962 @end table
23963
23964 The current @option{-mabi=ti} implementation simply raises a compile error
23965 when any of the above code constructs is detected. As a consequence
23966 the standard C library cannot be built and it is omitted when linking with
23967 @option{-mabi=ti}.
23968
23969 Relaxation is a GNU feature and for safety reasons is disabled when using
23970 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
23971 instructions, so the GNU linker cannot adjust them when shortening adjacent
23972 LDI32 pseudo instructions.
23973
23974 @end table
23975
23976 @node RISC-V Options
23977 @subsection RISC-V Options
23978 @cindex RISC-V Options
23979
23980 These command-line options are defined for RISC-V targets:
23981
23982 @table @gcctabopt
23983 @item -mbranch-cost=@var{n}
23984 @opindex mbranch-cost
23985 Set the cost of branches to roughly @var{n} instructions.
23986
23987 @item -mplt
23988 @itemx -mno-plt
23989 @opindex plt
23990 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23991 non-PIC. The default is @option{-mplt}.
23992
23993 @item -mabi=@var{ABI-string}
23994 @opindex mabi
23995 Specify integer and floating-point calling convention. @var{ABI-string}
23996 contains two parts: the size of integer types and the registers used for
23997 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23998 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23999 32-bit), and that floating-point values up to 64 bits wide are passed in F
24000 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
24001 allows the compiler to generate code that uses the F and D extensions but only
24002 allows floating-point values up to 32 bits long to be passed in registers; or
24003 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
24004 passed in registers.
24005
24006 The default for this argument is system dependent, users who want a specific
24007 calling convention should specify one explicitly. The valid calling
24008 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
24009 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
24010 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
24011 invalid because the ABI requires 64-bit values be passed in F registers, but F
24012 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
24013 only be used with the @samp{rv32e} architecture. This ABI is not well
24014 specified at present, and is subject to change.
24015
24016 @item -mfdiv
24017 @itemx -mno-fdiv
24018 @opindex mfdiv
24019 Do or don't use hardware floating-point divide and square root instructions.
24020 This requires the F or D extensions for floating-point registers. The default
24021 is to use them if the specified architecture has these instructions.
24022
24023 @item -mdiv
24024 @itemx -mno-div
24025 @opindex mdiv
24026 Do or don't use hardware instructions for integer division. This requires the
24027 M extension. The default is to use them if the specified architecture has
24028 these instructions.
24029
24030 @item -march=@var{ISA-string}
24031 @opindex march
24032 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
24033 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
24034 @samp{rv32imaf}.
24035
24036 @item -mtune=@var{processor-string}
24037 @opindex mtune
24038 Optimize the output for the given processor, specified by microarchitecture
24039 name. Permissible values for this option are: @samp{rocket},
24040 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
24041 and @samp{size}.
24042
24043 When @option{-mtune=} is not specified, the default is @samp{rocket}.
24044
24045 The @samp{size} choice is not intended for use by end-users. This is used
24046 when @option{-Os} is specified. It overrides the instruction cost info
24047 provided by @option{-mtune=}, but does not override the pipeline info. This
24048 helps reduce code size while still giving good performance.
24049
24050 @item -mpreferred-stack-boundary=@var{num}
24051 @opindex mpreferred-stack-boundary
24052 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24053 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24054 the default is 4 (16 bytes or 128-bits).
24055
24056 @strong{Warning:} If you use this switch, then you must build all modules with
24057 the same value, including any libraries. This includes the system libraries
24058 and startup modules.
24059
24060 @item -msmall-data-limit=@var{n}
24061 @opindex msmall-data-limit
24062 Put global and static data smaller than @var{n} bytes into a special section
24063 (on some targets).
24064
24065 @item -msave-restore
24066 @itemx -mno-save-restore
24067 @opindex msave-restore
24068 Do or don't use smaller but slower prologue and epilogue code that uses
24069 library function calls. The default is to use fast inline prologues and
24070 epilogues.
24071
24072 @item -mstrict-align
24073 @itemx -mno-strict-align
24074 @opindex mstrict-align
24075 Do not or do generate unaligned memory accesses. The default is set depending
24076 on whether the processor we are optimizing for supports fast unaligned access
24077 or not.
24078
24079 @item -mcmodel=medlow
24080 @opindex mcmodel=medlow
24081 Generate code for the medium-low code model. The program and its statically
24082 defined symbols must lie within a single 2 GiB address range and must lie
24083 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24084 statically or dynamically linked. This is the default code model.
24085
24086 @item -mcmodel=medany
24087 @opindex mcmodel=medany
24088 Generate code for the medium-any code model. The program and its statically
24089 defined symbols must be within any single 2 GiB address range. Programs can be
24090 statically or dynamically linked.
24091
24092 @item -mexplicit-relocs
24093 @itemx -mno-exlicit-relocs
24094 Use or do not use assembler relocation operators when dealing with symbolic
24095 addresses. The alternative is to use assembler macros instead, which may
24096 limit optimization.
24097
24098 @item -mrelax
24099 @itemx -mno-relax
24100 Take advantage of linker relaxations to reduce the number of instructions
24101 required to materialize symbol addresses. The default is to take advantage of
24102 linker relaxations.
24103
24104 @item -memit-attribute
24105 @itemx -mno-emit-attribute
24106 Emit (do not emit) RISC-V attribute to record extra information into ELF
24107 objects. This feature requires at least binutils 2.32.
24108
24109 @item -malign-data=@var{type}
24110 @opindex malign-data
24111 Control how GCC aligns variables and constants of array, structure, or union
24112 types. Supported values for @var{type} are @samp{xlen} which uses x register
24113 width as the alignment value, and @samp{natural} which uses natural alignment.
24114 @samp{xlen} is the default.
24115 @end table
24116
24117 @node RL78 Options
24118 @subsection RL78 Options
24119 @cindex RL78 Options
24120
24121 @table @gcctabopt
24122
24123 @item -msim
24124 @opindex msim
24125 Links in additional target libraries to support operation within a
24126 simulator.
24127
24128 @item -mmul=none
24129 @itemx -mmul=g10
24130 @itemx -mmul=g13
24131 @itemx -mmul=g14
24132 @itemx -mmul=rl78
24133 @opindex mmul
24134 Specifies the type of hardware multiplication and division support to
24135 be used. The simplest is @code{none}, which uses software for both
24136 multiplication and division. This is the default. The @code{g13}
24137 value is for the hardware multiply/divide peripheral found on the
24138 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24139 the multiplication and division instructions supported by the RL78/G14
24140 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24141 the value @code{mg10} is an alias for @code{none}.
24142
24143 In addition a C preprocessor macro is defined, based upon the setting
24144 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24145 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24146
24147 @item -mcpu=g10
24148 @itemx -mcpu=g13
24149 @itemx -mcpu=g14
24150 @itemx -mcpu=rl78
24151 @opindex mcpu
24152 Specifies the RL78 core to target. The default is the G14 core, also
24153 known as an S3 core or just RL78. The G13 or S2 core does not have
24154 multiply or divide instructions, instead it uses a hardware peripheral
24155 for these operations. The G10 or S1 core does not have register
24156 banks, so it uses a different calling convention.
24157
24158 If this option is set it also selects the type of hardware multiply
24159 support to use, unless this is overridden by an explicit
24160 @option{-mmul=none} option on the command line. Thus specifying
24161 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24162 peripheral and specifying @option{-mcpu=g10} disables the use of
24163 hardware multiplications altogether.
24164
24165 Note, although the RL78/G14 core is the default target, specifying
24166 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24167 change the behavior of the toolchain since it also enables G14
24168 hardware multiply support. If these options are not specified on the
24169 command line then software multiplication routines will be used even
24170 though the code targets the RL78 core. This is for backwards
24171 compatibility with older toolchains which did not have hardware
24172 multiply and divide support.
24173
24174 In addition a C preprocessor macro is defined, based upon the setting
24175 of this option. Possible values are: @code{__RL78_G10__},
24176 @code{__RL78_G13__} or @code{__RL78_G14__}.
24177
24178 @item -mg10
24179 @itemx -mg13
24180 @itemx -mg14
24181 @itemx -mrl78
24182 @opindex mg10
24183 @opindex mg13
24184 @opindex mg14
24185 @opindex mrl78
24186 These are aliases for the corresponding @option{-mcpu=} option. They
24187 are provided for backwards compatibility.
24188
24189 @item -mallregs
24190 @opindex mallregs
24191 Allow the compiler to use all of the available registers. By default
24192 registers @code{r24..r31} are reserved for use in interrupt handlers.
24193 With this option enabled these registers can be used in ordinary
24194 functions as well.
24195
24196 @item -m64bit-doubles
24197 @itemx -m32bit-doubles
24198 @opindex m64bit-doubles
24199 @opindex m32bit-doubles
24200 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24201 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24202 @option{-m32bit-doubles}.
24203
24204 @item -msave-mduc-in-interrupts
24205 @itemx -mno-save-mduc-in-interrupts
24206 @opindex msave-mduc-in-interrupts
24207 @opindex mno-save-mduc-in-interrupts
24208 Specifies that interrupt handler functions should preserve the
24209 MDUC registers. This is only necessary if normal code might use
24210 the MDUC registers, for example because it performs multiplication
24211 and division operations. The default is to ignore the MDUC registers
24212 as this makes the interrupt handlers faster. The target option -mg13
24213 needs to be passed for this to work as this feature is only available
24214 on the G13 target (S2 core). The MDUC registers will only be saved
24215 if the interrupt handler performs a multiplication or division
24216 operation or it calls another function.
24217
24218 @end table
24219
24220 @node RS/6000 and PowerPC Options
24221 @subsection IBM RS/6000 and PowerPC Options
24222 @cindex RS/6000 and PowerPC Options
24223 @cindex IBM RS/6000 and PowerPC Options
24224
24225 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24226 @table @gcctabopt
24227 @item -mpowerpc-gpopt
24228 @itemx -mno-powerpc-gpopt
24229 @itemx -mpowerpc-gfxopt
24230 @itemx -mno-powerpc-gfxopt
24231 @need 800
24232 @itemx -mpowerpc64
24233 @itemx -mno-powerpc64
24234 @itemx -mmfcrf
24235 @itemx -mno-mfcrf
24236 @itemx -mpopcntb
24237 @itemx -mno-popcntb
24238 @itemx -mpopcntd
24239 @itemx -mno-popcntd
24240 @itemx -mfprnd
24241 @itemx -mno-fprnd
24242 @need 800
24243 @itemx -mcmpb
24244 @itemx -mno-cmpb
24245 @itemx -mhard-dfp
24246 @itemx -mno-hard-dfp
24247 @opindex mpowerpc-gpopt
24248 @opindex mno-powerpc-gpopt
24249 @opindex mpowerpc-gfxopt
24250 @opindex mno-powerpc-gfxopt
24251 @opindex mpowerpc64
24252 @opindex mno-powerpc64
24253 @opindex mmfcrf
24254 @opindex mno-mfcrf
24255 @opindex mpopcntb
24256 @opindex mno-popcntb
24257 @opindex mpopcntd
24258 @opindex mno-popcntd
24259 @opindex mfprnd
24260 @opindex mno-fprnd
24261 @opindex mcmpb
24262 @opindex mno-cmpb
24263 @opindex mhard-dfp
24264 @opindex mno-hard-dfp
24265 You use these options to specify which instructions are available on the
24266 processor you are using. The default value of these options is
24267 determined when configuring GCC@. Specifying the
24268 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24269 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24270 rather than the options listed above.
24271
24272 Specifying @option{-mpowerpc-gpopt} allows
24273 GCC to use the optional PowerPC architecture instructions in the
24274 General Purpose group, including floating-point square root. Specifying
24275 @option{-mpowerpc-gfxopt} allows GCC to
24276 use the optional PowerPC architecture instructions in the Graphics
24277 group, including floating-point select.
24278
24279 The @option{-mmfcrf} option allows GCC to generate the move from
24280 condition register field instruction implemented on the POWER4
24281 processor and other processors that support the PowerPC V2.01
24282 architecture.
24283 The @option{-mpopcntb} option allows GCC to generate the popcount and
24284 double-precision FP reciprocal estimate instruction implemented on the
24285 POWER5 processor and other processors that support the PowerPC V2.02
24286 architecture.
24287 The @option{-mpopcntd} option allows GCC to generate the popcount
24288 instruction implemented on the POWER7 processor and other processors
24289 that support the PowerPC V2.06 architecture.
24290 The @option{-mfprnd} option allows GCC to generate the FP round to
24291 integer instructions implemented on the POWER5+ processor and other
24292 processors that support the PowerPC V2.03 architecture.
24293 The @option{-mcmpb} option allows GCC to generate the compare bytes
24294 instruction implemented on the POWER6 processor and other processors
24295 that support the PowerPC V2.05 architecture.
24296 The @option{-mhard-dfp} option allows GCC to generate the decimal
24297 floating-point instructions implemented on some POWER processors.
24298
24299 The @option{-mpowerpc64} option allows GCC to generate the additional
24300 64-bit instructions that are found in the full PowerPC64 architecture
24301 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24302 @option{-mno-powerpc64}.
24303
24304 @item -mcpu=@var{cpu_type}
24305 @opindex mcpu
24306 Set architecture type, register usage, and
24307 instruction scheduling parameters for machine type @var{cpu_type}.
24308 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24309 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24310 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24311 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24312 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24313 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24314 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24315 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24316 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24317 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24318 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24319 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24320
24321 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24322 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24323 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24324 architecture machine types, with an appropriate, generic processor
24325 model assumed for scheduling purposes.
24326
24327 Specifying @samp{native} as cpu type detects and selects the
24328 architecture option that corresponds to the host processor of the
24329 system performing the compilation.
24330 @option{-mcpu=native} has no effect if GCC does not recognize the
24331 processor.
24332
24333 The other options specify a specific processor. Code generated under
24334 those options runs best on that processor, and may not run at all on
24335 others.
24336
24337 The @option{-mcpu} options automatically enable or disable the
24338 following options:
24339
24340 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24341 -mpopcntb -mpopcntd -mpowerpc64 @gol
24342 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24343 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24344 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24345 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24346
24347 The particular options set for any particular CPU varies between
24348 compiler versions, depending on what setting seems to produce optimal
24349 code for that CPU; it doesn't necessarily reflect the actual hardware's
24350 capabilities. If you wish to set an individual option to a particular
24351 value, you may specify it after the @option{-mcpu} option, like
24352 @option{-mcpu=970 -mno-altivec}.
24353
24354 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24355 not enabled or disabled by the @option{-mcpu} option at present because
24356 AIX does not have full support for these options. You may still
24357 enable or disable them individually if you're sure it'll work in your
24358 environment.
24359
24360 @item -mtune=@var{cpu_type}
24361 @opindex mtune
24362 Set the instruction scheduling parameters for machine type
24363 @var{cpu_type}, but do not set the architecture type or register usage,
24364 as @option{-mcpu=@var{cpu_type}} does. The same
24365 values for @var{cpu_type} are used for @option{-mtune} as for
24366 @option{-mcpu}. If both are specified, the code generated uses the
24367 architecture and registers set by @option{-mcpu}, but the
24368 scheduling parameters set by @option{-mtune}.
24369
24370 @item -mcmodel=small
24371 @opindex mcmodel=small
24372 Generate PowerPC64 code for the small model: The TOC is limited to
24373 64k.
24374
24375 @item -mcmodel=medium
24376 @opindex mcmodel=medium
24377 Generate PowerPC64 code for the medium model: The TOC and other static
24378 data may be up to a total of 4G in size. This is the default for 64-bit
24379 Linux.
24380
24381 @item -mcmodel=large
24382 @opindex mcmodel=large
24383 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24384 in size. Other data and code is only limited by the 64-bit address
24385 space.
24386
24387 @item -maltivec
24388 @itemx -mno-altivec
24389 @opindex maltivec
24390 @opindex mno-altivec
24391 Generate code that uses (does not use) AltiVec instructions, and also
24392 enable the use of built-in functions that allow more direct access to
24393 the AltiVec instruction set. You may also need to set
24394 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24395 enhancements.
24396
24397 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24398 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24399 match array element order corresponding to the endianness of the
24400 target. That is, element zero identifies the leftmost element in a
24401 vector register when targeting a big-endian platform, and identifies
24402 the rightmost element in a vector register when targeting a
24403 little-endian platform.
24404
24405 @item -mvrsave
24406 @itemx -mno-vrsave
24407 @opindex mvrsave
24408 @opindex mno-vrsave
24409 Generate VRSAVE instructions when generating AltiVec code.
24410
24411 @item -msecure-plt
24412 @opindex msecure-plt
24413 Generate code that allows @command{ld} and @command{ld.so}
24414 to build executables and shared
24415 libraries with non-executable @code{.plt} and @code{.got} sections.
24416 This is a PowerPC
24417 32-bit SYSV ABI option.
24418
24419 @item -mbss-plt
24420 @opindex mbss-plt
24421 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24422 fills in, and
24423 requires @code{.plt} and @code{.got}
24424 sections that are both writable and executable.
24425 This is a PowerPC 32-bit SYSV ABI option.
24426
24427 @item -misel
24428 @itemx -mno-isel
24429 @opindex misel
24430 @opindex mno-isel
24431 This switch enables or disables the generation of ISEL instructions.
24432
24433 @item -mvsx
24434 @itemx -mno-vsx
24435 @opindex mvsx
24436 @opindex mno-vsx
24437 Generate code that uses (does not use) vector/scalar (VSX)
24438 instructions, and also enable the use of built-in functions that allow
24439 more direct access to the VSX instruction set.
24440
24441 @item -mcrypto
24442 @itemx -mno-crypto
24443 @opindex mcrypto
24444 @opindex mno-crypto
24445 Enable the use (disable) of the built-in functions that allow direct
24446 access to the cryptographic instructions that were added in version
24447 2.07 of the PowerPC ISA.
24448
24449 @item -mhtm
24450 @itemx -mno-htm
24451 @opindex mhtm
24452 @opindex mno-htm
24453 Enable (disable) the use of the built-in functions that allow direct
24454 access to the Hardware Transactional Memory (HTM) instructions that
24455 were added in version 2.07 of the PowerPC ISA.
24456
24457 @item -mpower8-fusion
24458 @itemx -mno-power8-fusion
24459 @opindex mpower8-fusion
24460 @opindex mno-power8-fusion
24461 Generate code that keeps (does not keeps) some integer operations
24462 adjacent so that the instructions can be fused together on power8 and
24463 later processors.
24464
24465 @item -mpower8-vector
24466 @itemx -mno-power8-vector
24467 @opindex mpower8-vector
24468 @opindex mno-power8-vector
24469 Generate code that uses (does not use) the vector and scalar
24470 instructions that were added in version 2.07 of the PowerPC ISA. Also
24471 enable the use of built-in functions that allow more direct access to
24472 the vector instructions.
24473
24474 @item -mquad-memory
24475 @itemx -mno-quad-memory
24476 @opindex mquad-memory
24477 @opindex mno-quad-memory
24478 Generate code that uses (does not use) the non-atomic quad word memory
24479 instructions. The @option{-mquad-memory} option requires use of
24480 64-bit mode.
24481
24482 @item -mquad-memory-atomic
24483 @itemx -mno-quad-memory-atomic
24484 @opindex mquad-memory-atomic
24485 @opindex mno-quad-memory-atomic
24486 Generate code that uses (does not use) the atomic quad word memory
24487 instructions. The @option{-mquad-memory-atomic} option requires use of
24488 64-bit mode.
24489
24490 @item -mfloat128
24491 @itemx -mno-float128
24492 @opindex mfloat128
24493 @opindex mno-float128
24494 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24495 and use either software emulation for IEEE 128-bit floating point or
24496 hardware instructions.
24497
24498 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24499 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24500 use the IEEE 128-bit floating point support. The IEEE 128-bit
24501 floating point support only works on PowerPC Linux systems.
24502
24503 The default for @option{-mfloat128} is enabled on PowerPC Linux
24504 systems using the VSX instruction set, and disabled on other systems.
24505
24506 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24507 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24508 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24509 floating point instructions. Otherwise, if you do not specify to
24510 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24511 system, IEEE 128-bit floating point will be done with software
24512 emulation.
24513
24514 @item -mfloat128-hardware
24515 @itemx -mno-float128-hardware
24516 @opindex mfloat128-hardware
24517 @opindex mno-float128-hardware
24518 Enable/disable using ISA 3.0 hardware instructions to support the
24519 @var{__float128} data type.
24520
24521 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24522 Linux systems using the ISA 3.0 instruction set, and disabled on other
24523 systems.
24524
24525 @item -m32
24526 @itemx -m64
24527 @opindex m32
24528 @opindex m64
24529 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24530 targets (including GNU/Linux). The 32-bit environment sets int, long
24531 and pointer to 32 bits and generates code that runs on any PowerPC
24532 variant. The 64-bit environment sets int to 32 bits and long and
24533 pointer to 64 bits, and generates code for PowerPC64, as for
24534 @option{-mpowerpc64}.
24535
24536 @item -mfull-toc
24537 @itemx -mno-fp-in-toc
24538 @itemx -mno-sum-in-toc
24539 @itemx -mminimal-toc
24540 @opindex mfull-toc
24541 @opindex mno-fp-in-toc
24542 @opindex mno-sum-in-toc
24543 @opindex mminimal-toc
24544 Modify generation of the TOC (Table Of Contents), which is created for
24545 every executable file. The @option{-mfull-toc} option is selected by
24546 default. In that case, GCC allocates at least one TOC entry for
24547 each unique non-automatic variable reference in your program. GCC
24548 also places floating-point constants in the TOC@. However, only
24549 16,384 entries are available in the TOC@.
24550
24551 If you receive a linker error message that saying you have overflowed
24552 the available TOC space, you can reduce the amount of TOC space used
24553 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24554 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24555 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24556 generate code to calculate the sum of an address and a constant at
24557 run time instead of putting that sum into the TOC@. You may specify one
24558 or both of these options. Each causes GCC to produce very slightly
24559 slower and larger code at the expense of conserving TOC space.
24560
24561 If you still run out of space in the TOC even when you specify both of
24562 these options, specify @option{-mminimal-toc} instead. This option causes
24563 GCC to make only one TOC entry for every file. When you specify this
24564 option, GCC produces code that is slower and larger but which
24565 uses extremely little TOC space. You may wish to use this option
24566 only on files that contain less frequently-executed code.
24567
24568 @item -maix64
24569 @itemx -maix32
24570 @opindex maix64
24571 @opindex maix32
24572 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24573 @code{long} type, and the infrastructure needed to support them.
24574 Specifying @option{-maix64} implies @option{-mpowerpc64},
24575 while @option{-maix32} disables the 64-bit ABI and
24576 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24577
24578 @item -mxl-compat
24579 @itemx -mno-xl-compat
24580 @opindex mxl-compat
24581 @opindex mno-xl-compat
24582 Produce code that conforms more closely to IBM XL compiler semantics
24583 when using AIX-compatible ABI@. Pass floating-point arguments to
24584 prototyped functions beyond the register save area (RSA) on the stack
24585 in addition to argument FPRs. Do not assume that most significant
24586 double in 128-bit long double value is properly rounded when comparing
24587 values and converting to double. Use XL symbol names for long double
24588 support routines.
24589
24590 The AIX calling convention was extended but not initially documented to
24591 handle an obscure K&R C case of calling a function that takes the
24592 address of its arguments with fewer arguments than declared. IBM XL
24593 compilers access floating-point arguments that do not fit in the
24594 RSA from the stack when a subroutine is compiled without
24595 optimization. Because always storing floating-point arguments on the
24596 stack is inefficient and rarely needed, this option is not enabled by
24597 default and only is necessary when calling subroutines compiled by IBM
24598 XL compilers without optimization.
24599
24600 @item -mpe
24601 @opindex mpe
24602 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24603 application written to use message passing with special startup code to
24604 enable the application to run. The system must have PE installed in the
24605 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24606 must be overridden with the @option{-specs=} option to specify the
24607 appropriate directory location. The Parallel Environment does not
24608 support threads, so the @option{-mpe} option and the @option{-pthread}
24609 option are incompatible.
24610
24611 @item -malign-natural
24612 @itemx -malign-power
24613 @opindex malign-natural
24614 @opindex malign-power
24615 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24616 @option{-malign-natural} overrides the ABI-defined alignment of larger
24617 types, such as floating-point doubles, on their natural size-based boundary.
24618 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24619 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24620
24621 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24622 is not supported.
24623
24624 @item -msoft-float
24625 @itemx -mhard-float
24626 @opindex msoft-float
24627 @opindex mhard-float
24628 Generate code that does not use (uses) the floating-point register set.
24629 Software floating-point emulation is provided if you use the
24630 @option{-msoft-float} option, and pass the option to GCC when linking.
24631
24632 @item -mmultiple
24633 @itemx -mno-multiple
24634 @opindex mmultiple
24635 @opindex mno-multiple
24636 Generate code that uses (does not use) the load multiple word
24637 instructions and the store multiple word instructions. These
24638 instructions are generated by default on POWER systems, and not
24639 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24640 PowerPC systems, since those instructions do not work when the
24641 processor is in little-endian mode. The exceptions are PPC740 and
24642 PPC750 which permit these instructions in little-endian mode.
24643
24644 @item -mupdate
24645 @itemx -mno-update
24646 @opindex mupdate
24647 @opindex mno-update
24648 Generate code that uses (does not use) the load or store instructions
24649 that update the base register to the address of the calculated memory
24650 location. These instructions are generated by default. If you use
24651 @option{-mno-update}, there is a small window between the time that the
24652 stack pointer is updated and the address of the previous frame is
24653 stored, which means code that walks the stack frame across interrupts or
24654 signals may get corrupted data.
24655
24656 @item -mavoid-indexed-addresses
24657 @itemx -mno-avoid-indexed-addresses
24658 @opindex mavoid-indexed-addresses
24659 @opindex mno-avoid-indexed-addresses
24660 Generate code that tries to avoid (not avoid) the use of indexed load
24661 or store instructions. These instructions can incur a performance
24662 penalty on Power6 processors in certain situations, such as when
24663 stepping through large arrays that cross a 16M boundary. This option
24664 is enabled by default when targeting Power6 and disabled otherwise.
24665
24666 @item -mfused-madd
24667 @itemx -mno-fused-madd
24668 @opindex mfused-madd
24669 @opindex mno-fused-madd
24670 Generate code that uses (does not use) the floating-point multiply and
24671 accumulate instructions. These instructions are generated by default
24672 if hardware floating point is used. The machine-dependent
24673 @option{-mfused-madd} option is now mapped to the machine-independent
24674 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24675 mapped to @option{-ffp-contract=off}.
24676
24677 @item -mmulhw
24678 @itemx -mno-mulhw
24679 @opindex mmulhw
24680 @opindex mno-mulhw
24681 Generate code that uses (does not use) the half-word multiply and
24682 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24683 These instructions are generated by default when targeting those
24684 processors.
24685
24686 @item -mdlmzb
24687 @itemx -mno-dlmzb
24688 @opindex mdlmzb
24689 @opindex mno-dlmzb
24690 Generate code that uses (does not use) the string-search @samp{dlmzb}
24691 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24692 generated by default when targeting those processors.
24693
24694 @item -mno-bit-align
24695 @itemx -mbit-align
24696 @opindex mno-bit-align
24697 @opindex mbit-align
24698 On System V.4 and embedded PowerPC systems do not (do) force structures
24699 and unions that contain bit-fields to be aligned to the base type of the
24700 bit-field.
24701
24702 For example, by default a structure containing nothing but 8
24703 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24704 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24705 the structure is aligned to a 1-byte boundary and is 1 byte in
24706 size.
24707
24708 @item -mno-strict-align
24709 @itemx -mstrict-align
24710 @opindex mno-strict-align
24711 @opindex mstrict-align
24712 On System V.4 and embedded PowerPC systems do not (do) assume that
24713 unaligned memory references are handled by the system.
24714
24715 @item -mrelocatable
24716 @itemx -mno-relocatable
24717 @opindex mrelocatable
24718 @opindex mno-relocatable
24719 Generate code that allows (does not allow) a static executable to be
24720 relocated to a different address at run time. A simple embedded
24721 PowerPC system loader should relocate the entire contents of
24722 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24723 a table of 32-bit addresses generated by this option. For this to
24724 work, all objects linked together must be compiled with
24725 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24726 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24727
24728 @item -mrelocatable-lib
24729 @itemx -mno-relocatable-lib
24730 @opindex mrelocatable-lib
24731 @opindex mno-relocatable-lib
24732 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24733 @code{.fixup} section to allow static executables to be relocated at
24734 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24735 alignment of @option{-mrelocatable}. Objects compiled with
24736 @option{-mrelocatable-lib} may be linked with objects compiled with
24737 any combination of the @option{-mrelocatable} options.
24738
24739 @item -mno-toc
24740 @itemx -mtoc
24741 @opindex mno-toc
24742 @opindex mtoc
24743 On System V.4 and embedded PowerPC systems do not (do) assume that
24744 register 2 contains a pointer to a global area pointing to the addresses
24745 used in the program.
24746
24747 @item -mlittle
24748 @itemx -mlittle-endian
24749 @opindex mlittle
24750 @opindex mlittle-endian
24751 On System V.4 and embedded PowerPC systems compile code for the
24752 processor in little-endian mode. The @option{-mlittle-endian} option is
24753 the same as @option{-mlittle}.
24754
24755 @item -mbig
24756 @itemx -mbig-endian
24757 @opindex mbig
24758 @opindex mbig-endian
24759 On System V.4 and embedded PowerPC systems compile code for the
24760 processor in big-endian mode. The @option{-mbig-endian} option is
24761 the same as @option{-mbig}.
24762
24763 @item -mdynamic-no-pic
24764 @opindex mdynamic-no-pic
24765 On Darwin and Mac OS X systems, compile code so that it is not
24766 relocatable, but that its external references are relocatable. The
24767 resulting code is suitable for applications, but not shared
24768 libraries.
24769
24770 @item -msingle-pic-base
24771 @opindex msingle-pic-base
24772 Treat the register used for PIC addressing as read-only, rather than
24773 loading it in the prologue for each function. The runtime system is
24774 responsible for initializing this register with an appropriate value
24775 before execution begins.
24776
24777 @item -mprioritize-restricted-insns=@var{priority}
24778 @opindex mprioritize-restricted-insns
24779 This option controls the priority that is assigned to
24780 dispatch-slot restricted instructions during the second scheduling
24781 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24782 or @samp{2} to assign no, highest, or second-highest (respectively)
24783 priority to dispatch-slot restricted
24784 instructions.
24785
24786 @item -msched-costly-dep=@var{dependence_type}
24787 @opindex msched-costly-dep
24788 This option controls which dependences are considered costly
24789 by the target during instruction scheduling. The argument
24790 @var{dependence_type} takes one of the following values:
24791
24792 @table @asis
24793 @item @samp{no}
24794 No dependence is costly.
24795
24796 @item @samp{all}
24797 All dependences are costly.
24798
24799 @item @samp{true_store_to_load}
24800 A true dependence from store to load is costly.
24801
24802 @item @samp{store_to_load}
24803 Any dependence from store to load is costly.
24804
24805 @item @var{number}
24806 Any dependence for which the latency is greater than or equal to
24807 @var{number} is costly.
24808 @end table
24809
24810 @item -minsert-sched-nops=@var{scheme}
24811 @opindex minsert-sched-nops
24812 This option controls which NOP insertion scheme is used during
24813 the second scheduling pass. The argument @var{scheme} takes one of the
24814 following values:
24815
24816 @table @asis
24817 @item @samp{no}
24818 Don't insert NOPs.
24819
24820 @item @samp{pad}
24821 Pad with NOPs any dispatch group that has vacant issue slots,
24822 according to the scheduler's grouping.
24823
24824 @item @samp{regroup_exact}
24825 Insert NOPs to force costly dependent insns into
24826 separate groups. Insert exactly as many NOPs as needed to force an insn
24827 to a new group, according to the estimated processor grouping.
24828
24829 @item @var{number}
24830 Insert NOPs to force costly dependent insns into
24831 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24832 @end table
24833
24834 @item -mcall-sysv
24835 @opindex mcall-sysv
24836 On System V.4 and embedded PowerPC systems compile code using calling
24837 conventions that adhere to the March 1995 draft of the System V
24838 Application Binary Interface, PowerPC processor supplement. This is the
24839 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24840
24841 @item -mcall-sysv-eabi
24842 @itemx -mcall-eabi
24843 @opindex mcall-sysv-eabi
24844 @opindex mcall-eabi
24845 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24846
24847 @item -mcall-sysv-noeabi
24848 @opindex mcall-sysv-noeabi
24849 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24850
24851 @item -mcall-aixdesc
24852 @opindex m
24853 On System V.4 and embedded PowerPC systems compile code for the AIX
24854 operating system.
24855
24856 @item -mcall-linux
24857 @opindex mcall-linux
24858 On System V.4 and embedded PowerPC systems compile code for the
24859 Linux-based GNU system.
24860
24861 @item -mcall-freebsd
24862 @opindex mcall-freebsd
24863 On System V.4 and embedded PowerPC systems compile code for the
24864 FreeBSD operating system.
24865
24866 @item -mcall-netbsd
24867 @opindex mcall-netbsd
24868 On System V.4 and embedded PowerPC systems compile code for the
24869 NetBSD operating system.
24870
24871 @item -mcall-openbsd
24872 @opindex mcall-netbsd
24873 On System V.4 and embedded PowerPC systems compile code for the
24874 OpenBSD operating system.
24875
24876 @item -mtraceback=@var{traceback_type}
24877 @opindex mtraceback
24878 Select the type of traceback table. Valid values for @var{traceback_type}
24879 are @samp{full}, @samp{part}, and @samp{no}.
24880
24881 @item -maix-struct-return
24882 @opindex maix-struct-return
24883 Return all structures in memory (as specified by the AIX ABI)@.
24884
24885 @item -msvr4-struct-return
24886 @opindex msvr4-struct-return
24887 Return structures smaller than 8 bytes in registers (as specified by the
24888 SVR4 ABI)@.
24889
24890 @item -mabi=@var{abi-type}
24891 @opindex mabi
24892 Extend the current ABI with a particular extension, or remove such extension.
24893 Valid values are @samp{altivec}, @samp{no-altivec},
24894 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24895 @samp{elfv1}, @samp{elfv2}@.
24896
24897 @item -mabi=ibmlongdouble
24898 @opindex mabi=ibmlongdouble
24899 Change the current ABI to use IBM extended-precision long double.
24900 This is not likely to work if your system defaults to using IEEE
24901 extended-precision long double. If you change the long double type
24902 from IEEE extended-precision, the compiler will issue a warning unless
24903 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24904 to be enabled.
24905
24906 @item -mabi=ieeelongdouble
24907 @opindex mabi=ieeelongdouble
24908 Change the current ABI to use IEEE extended-precision long double.
24909 This is not likely to work if your system defaults to using IBM
24910 extended-precision long double. If you change the long double type
24911 from IBM extended-precision, the compiler will issue a warning unless
24912 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24913 to be enabled.
24914
24915 @item -mabi=elfv1
24916 @opindex mabi=elfv1
24917 Change the current ABI to use the ELFv1 ABI.
24918 This is the default ABI for big-endian PowerPC 64-bit Linux.
24919 Overriding the default ABI requires special system support and is
24920 likely to fail in spectacular ways.
24921
24922 @item -mabi=elfv2
24923 @opindex mabi=elfv2
24924 Change the current ABI to use the ELFv2 ABI.
24925 This is the default ABI for little-endian PowerPC 64-bit Linux.
24926 Overriding the default ABI requires special system support and is
24927 likely to fail in spectacular ways.
24928
24929 @item -mgnu-attribute
24930 @itemx -mno-gnu-attribute
24931 @opindex mgnu-attribute
24932 @opindex mno-gnu-attribute
24933 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24934 .gnu.attributes section that specify ABI variations in function
24935 parameters or return values.
24936
24937 @item -mprototype
24938 @itemx -mno-prototype
24939 @opindex mprototype
24940 @opindex mno-prototype
24941 On System V.4 and embedded PowerPC systems assume that all calls to
24942 variable argument functions are properly prototyped. Otherwise, the
24943 compiler must insert an instruction before every non-prototyped call to
24944 set or clear bit 6 of the condition code register (@code{CR}) to
24945 indicate whether floating-point values are passed in the floating-point
24946 registers in case the function takes variable arguments. With
24947 @option{-mprototype}, only calls to prototyped variable argument functions
24948 set or clear the bit.
24949
24950 @item -msim
24951 @opindex msim
24952 On embedded PowerPC systems, assume that the startup module is called
24953 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24954 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24955 configurations.
24956
24957 @item -mmvme
24958 @opindex mmvme
24959 On embedded PowerPC systems, assume that the startup module is called
24960 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24961 @file{libc.a}.
24962
24963 @item -mads
24964 @opindex mads
24965 On embedded PowerPC systems, assume that the startup module is called
24966 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24967 @file{libc.a}.
24968
24969 @item -myellowknife
24970 @opindex myellowknife
24971 On embedded PowerPC systems, assume that the startup module is called
24972 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24973 @file{libc.a}.
24974
24975 @item -mvxworks
24976 @opindex mvxworks
24977 On System V.4 and embedded PowerPC systems, specify that you are
24978 compiling for a VxWorks system.
24979
24980 @item -memb
24981 @opindex memb
24982 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24983 header to indicate that @samp{eabi} extended relocations are used.
24984
24985 @item -meabi
24986 @itemx -mno-eabi
24987 @opindex meabi
24988 @opindex mno-eabi
24989 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24990 Embedded Applications Binary Interface (EABI), which is a set of
24991 modifications to the System V.4 specifications. Selecting @option{-meabi}
24992 means that the stack is aligned to an 8-byte boundary, a function
24993 @code{__eabi} is called from @code{main} to set up the EABI
24994 environment, and the @option{-msdata} option can use both @code{r2} and
24995 @code{r13} to point to two separate small data areas. Selecting
24996 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24997 no EABI initialization function is called from @code{main}, and the
24998 @option{-msdata} option only uses @code{r13} to point to a single
24999 small data area. The @option{-meabi} option is on by default if you
25000 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
25001
25002 @item -msdata=eabi
25003 @opindex msdata=eabi
25004 On System V.4 and embedded PowerPC systems, put small initialized
25005 @code{const} global and static data in the @code{.sdata2} section, which
25006 is pointed to by register @code{r2}. Put small initialized
25007 non-@code{const} global and static data in the @code{.sdata} section,
25008 which is pointed to by register @code{r13}. Put small uninitialized
25009 global and static data in the @code{.sbss} section, which is adjacent to
25010 the @code{.sdata} section. The @option{-msdata=eabi} option is
25011 incompatible with the @option{-mrelocatable} option. The
25012 @option{-msdata=eabi} option also sets the @option{-memb} option.
25013
25014 @item -msdata=sysv
25015 @opindex msdata=sysv
25016 On System V.4 and embedded PowerPC systems, put small global and static
25017 data in the @code{.sdata} section, which is pointed to by register
25018 @code{r13}. Put small uninitialized global and static data in the
25019 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
25020 The @option{-msdata=sysv} option is incompatible with the
25021 @option{-mrelocatable} option.
25022
25023 @item -msdata=default
25024 @itemx -msdata
25025 @opindex msdata=default
25026 @opindex msdata
25027 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
25028 compile code the same as @option{-msdata=eabi}, otherwise compile code the
25029 same as @option{-msdata=sysv}.
25030
25031 @item -msdata=data
25032 @opindex msdata=data
25033 On System V.4 and embedded PowerPC systems, put small global
25034 data in the @code{.sdata} section. Put small uninitialized global
25035 data in the @code{.sbss} section. Do not use register @code{r13}
25036 to address small data however. This is the default behavior unless
25037 other @option{-msdata} options are used.
25038
25039 @item -msdata=none
25040 @itemx -mno-sdata
25041 @opindex msdata=none
25042 @opindex mno-sdata
25043 On embedded PowerPC systems, put all initialized global and static data
25044 in the @code{.data} section, and all uninitialized data in the
25045 @code{.bss} section.
25046
25047 @item -mreadonly-in-sdata
25048 @opindex mreadonly-in-sdata
25049 @opindex mno-readonly-in-sdata
25050 Put read-only objects in the @code{.sdata} section as well. This is the
25051 default.
25052
25053 @item -mblock-move-inline-limit=@var{num}
25054 @opindex mblock-move-inline-limit
25055 Inline all block moves (such as calls to @code{memcpy} or structure
25056 copies) less than or equal to @var{num} bytes. The minimum value for
25057 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25058 targets. The default value is target-specific.
25059
25060 @item -mblock-compare-inline-limit=@var{num}
25061 @opindex mblock-compare-inline-limit
25062 Generate non-looping inline code for all block compares (such as calls
25063 to @code{memcmp} or structure compares) less than or equal to @var{num}
25064 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25065 block compare is disabled. The default value is target-specific.
25066
25067 @item -mblock-compare-inline-loop-limit=@var{num}
25068 @opindex mblock-compare-inline-loop-limit
25069 Generate an inline expansion using loop code for all block compares that
25070 are less than or equal to @var{num} bytes, but greater than the limit
25071 for non-loop inline block compare expansion. If the block length is not
25072 constant, at most @var{num} bytes will be compared before @code{memcmp}
25073 is called to compare the remainder of the block. The default value is
25074 target-specific.
25075
25076 @item -mstring-compare-inline-limit=@var{num}
25077 @opindex mstring-compare-inline-limit
25078 Compare at most @var{num} string bytes with inline code.
25079 If the difference or end of string is not found at the
25080 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25081 take care of the rest of the comparison. The default is 64 bytes.
25082
25083 @item -G @var{num}
25084 @opindex G
25085 @cindex smaller data references (PowerPC)
25086 @cindex .sdata/.sdata2 references (PowerPC)
25087 On embedded PowerPC systems, put global and static items less than or
25088 equal to @var{num} bytes into the small data or BSS sections instead of
25089 the normal data or BSS section. By default, @var{num} is 8. The
25090 @option{-G @var{num}} switch is also passed to the linker.
25091 All modules should be compiled with the same @option{-G @var{num}} value.
25092
25093 @item -mregnames
25094 @itemx -mno-regnames
25095 @opindex mregnames
25096 @opindex mno-regnames
25097 On System V.4 and embedded PowerPC systems do (do not) emit register
25098 names in the assembly language output using symbolic forms.
25099
25100 @item -mlongcall
25101 @itemx -mno-longcall
25102 @opindex mlongcall
25103 @opindex mno-longcall
25104 By default assume that all calls are far away so that a longer and more
25105 expensive calling sequence is required. This is required for calls
25106 farther than 32 megabytes (33,554,432 bytes) from the current location.
25107 A short call is generated if the compiler knows
25108 the call cannot be that far away. This setting can be overridden by
25109 the @code{shortcall} function attribute, or by @code{#pragma
25110 longcall(0)}.
25111
25112 Some linkers are capable of detecting out-of-range calls and generating
25113 glue code on the fly. On these systems, long calls are unnecessary and
25114 generate slower code. As of this writing, the AIX linker can do this,
25115 as can the GNU linker for PowerPC/64. It is planned to add this feature
25116 to the GNU linker for 32-bit PowerPC systems as well.
25117
25118 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25119 GCC can generate long calls using an inline PLT call sequence (see
25120 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
25121 ELFv1 (big-endian) do not support inline PLT calls.
25122
25123 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25124 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25125 addresses represent the callee and the branch island. The
25126 Darwin/PPC linker prefers the first address and generates a @code{bl
25127 callee} if the PPC @code{bl} instruction reaches the callee directly;
25128 otherwise, the linker generates @code{bl L42} to call the branch
25129 island. The branch island is appended to the body of the
25130 calling function; it computes the full 32-bit address of the callee
25131 and jumps to it.
25132
25133 On Mach-O (Darwin) systems, this option directs the compiler emit to
25134 the glue for every direct call, and the Darwin linker decides whether
25135 to use or discard it.
25136
25137 In the future, GCC may ignore all longcall specifications
25138 when the linker is known to generate glue.
25139
25140 @item -mpltseq
25141 @itemx -mno-pltseq
25142 @opindex mpltseq
25143 @opindex mno-pltseq
25144 Implement (do not implement) -fno-plt and long calls using an inline
25145 PLT call sequence that supports lazy linking and long calls to
25146 functions in dlopen'd shared libraries. Inline PLT calls are only
25147 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25148 linkers, and are enabled by default if the support is detected when
25149 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25150 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25151 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25152 linked together.
25153
25154 @item -mtls-markers
25155 @itemx -mno-tls-markers
25156 @opindex mtls-markers
25157 @opindex mno-tls-markers
25158 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25159 specifying the function argument. The relocation allows the linker to
25160 reliably associate function call with argument setup instructions for
25161 TLS optimization, which in turn allows GCC to better schedule the
25162 sequence.
25163
25164 @item -mrecip
25165 @itemx -mno-recip
25166 @opindex mrecip
25167 This option enables use of the reciprocal estimate and
25168 reciprocal square root estimate instructions with additional
25169 Newton-Raphson steps to increase precision instead of doing a divide or
25170 square root and divide for floating-point arguments. You should use
25171 the @option{-ffast-math} option when using @option{-mrecip} (or at
25172 least @option{-funsafe-math-optimizations},
25173 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25174 @option{-fno-trapping-math}). Note that while the throughput of the
25175 sequence is generally higher than the throughput of the non-reciprocal
25176 instruction, the precision of the sequence can be decreased by up to 2
25177 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25178 roots.
25179
25180 @item -mrecip=@var{opt}
25181 @opindex mrecip=opt
25182 This option controls which reciprocal estimate instructions
25183 may be used. @var{opt} is a comma-separated list of options, which may
25184 be preceded by a @code{!} to invert the option:
25185
25186 @table @samp
25187
25188 @item all
25189 Enable all estimate instructions.
25190
25191 @item default
25192 Enable the default instructions, equivalent to @option{-mrecip}.
25193
25194 @item none
25195 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25196
25197 @item div
25198 Enable the reciprocal approximation instructions for both
25199 single and double precision.
25200
25201 @item divf
25202 Enable the single-precision reciprocal approximation instructions.
25203
25204 @item divd
25205 Enable the double-precision reciprocal approximation instructions.
25206
25207 @item rsqrt
25208 Enable the reciprocal square root approximation instructions for both
25209 single and double precision.
25210
25211 @item rsqrtf
25212 Enable the single-precision reciprocal square root approximation instructions.
25213
25214 @item rsqrtd
25215 Enable the double-precision reciprocal square root approximation instructions.
25216
25217 @end table
25218
25219 So, for example, @option{-mrecip=all,!rsqrtd} enables
25220 all of the reciprocal estimate instructions, except for the
25221 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25222 which handle the double-precision reciprocal square root calculations.
25223
25224 @item -mrecip-precision
25225 @itemx -mno-recip-precision
25226 @opindex mrecip-precision
25227 Assume (do not assume) that the reciprocal estimate instructions
25228 provide higher-precision estimates than is mandated by the PowerPC
25229 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25230 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25231 The double-precision square root estimate instructions are not generated by
25232 default on low-precision machines, since they do not provide an
25233 estimate that converges after three steps.
25234
25235 @item -mveclibabi=@var{type}
25236 @opindex mveclibabi
25237 Specifies the ABI type to use for vectorizing intrinsics using an
25238 external library. The only type supported at present is @samp{mass},
25239 which specifies to use IBM's Mathematical Acceleration Subsystem
25240 (MASS) libraries for vectorizing intrinsics using external libraries.
25241 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25242 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25243 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25244 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25245 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25246 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25247 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25248 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25249 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25250 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25251 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25252 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25253 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25254 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25255 for power7. Both @option{-ftree-vectorize} and
25256 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25257 libraries must be specified at link time.
25258
25259 @item -mfriz
25260 @itemx -mno-friz
25261 @opindex mfriz
25262 Generate (do not generate) the @code{friz} instruction when the
25263 @option{-funsafe-math-optimizations} option is used to optimize
25264 rounding of floating-point values to 64-bit integer and back to floating
25265 point. The @code{friz} instruction does not return the same value if
25266 the floating-point number is too large to fit in an integer.
25267
25268 @item -mpointers-to-nested-functions
25269 @itemx -mno-pointers-to-nested-functions
25270 @opindex mpointers-to-nested-functions
25271 Generate (do not generate) code to load up the static chain register
25272 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25273 systems where a function pointer points to a 3-word descriptor giving
25274 the function address, TOC value to be loaded in register @code{r2}, and
25275 static chain value to be loaded in register @code{r11}. The
25276 @option{-mpointers-to-nested-functions} is on by default. You cannot
25277 call through pointers to nested functions or pointers
25278 to functions compiled in other languages that use the static chain if
25279 you use @option{-mno-pointers-to-nested-functions}.
25280
25281 @item -msave-toc-indirect
25282 @itemx -mno-save-toc-indirect
25283 @opindex msave-toc-indirect
25284 Generate (do not generate) code to save the TOC value in the reserved
25285 stack location in the function prologue if the function calls through
25286 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25287 saved in the prologue, it is saved just before the call through the
25288 pointer. The @option{-mno-save-toc-indirect} option is the default.
25289
25290 @item -mcompat-align-parm
25291 @itemx -mno-compat-align-parm
25292 @opindex mcompat-align-parm
25293 Generate (do not generate) code to pass structure parameters with a
25294 maximum alignment of 64 bits, for compatibility with older versions
25295 of GCC.
25296
25297 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25298 structure parameter on a 128-bit boundary when that structure contained
25299 a member requiring 128-bit alignment. This is corrected in more
25300 recent versions of GCC. This option may be used to generate code
25301 that is compatible with functions compiled with older versions of
25302 GCC.
25303
25304 The @option{-mno-compat-align-parm} option is the default.
25305
25306 @item -mstack-protector-guard=@var{guard}
25307 @itemx -mstack-protector-guard-reg=@var{reg}
25308 @itemx -mstack-protector-guard-offset=@var{offset}
25309 @itemx -mstack-protector-guard-symbol=@var{symbol}
25310 @opindex mstack-protector-guard
25311 @opindex mstack-protector-guard-reg
25312 @opindex mstack-protector-guard-offset
25313 @opindex mstack-protector-guard-symbol
25314 Generate stack protection code using canary at @var{guard}. Supported
25315 locations are @samp{global} for global canary or @samp{tls} for per-thread
25316 canary in the TLS block (the default with GNU libc version 2.4 or later).
25317
25318 With the latter choice the options
25319 @option{-mstack-protector-guard-reg=@var{reg}} and
25320 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25321 which register to use as base register for reading the canary, and from what
25322 offset from that base register. The default for those is as specified in the
25323 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25324 the offset with a symbol reference to a canary in the TLS block.
25325
25326 @item -mpcrel
25327 @itemx -mno-pcrel
25328 @opindex mpcrel
25329 @opindex mno-pcrel
25330 Generate (do not generate) pc-relative addressing when the option
25331 @option{-mcpu=future} is used.
25332 @end table
25333
25334 @node RX Options
25335 @subsection RX Options
25336 @cindex RX Options
25337
25338 These command-line options are defined for RX targets:
25339
25340 @table @gcctabopt
25341 @item -m64bit-doubles
25342 @itemx -m32bit-doubles
25343 @opindex m64bit-doubles
25344 @opindex m32bit-doubles
25345 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25346 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25347 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25348 works on 32-bit values, which is why the default is
25349 @option{-m32bit-doubles}.
25350
25351 @item -fpu
25352 @itemx -nofpu
25353 @opindex fpu
25354 @opindex nofpu
25355 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25356 floating-point hardware. The default is enabled for the RX600
25357 series and disabled for the RX200 series.
25358
25359 Floating-point instructions are only generated for 32-bit floating-point
25360 values, however, so the FPU hardware is not used for doubles if the
25361 @option{-m64bit-doubles} option is used.
25362
25363 @emph{Note} If the @option{-fpu} option is enabled then
25364 @option{-funsafe-math-optimizations} is also enabled automatically.
25365 This is because the RX FPU instructions are themselves unsafe.
25366
25367 @item -mcpu=@var{name}
25368 @opindex mcpu
25369 Selects the type of RX CPU to be targeted. Currently three types are
25370 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25371 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25372
25373 The only difference between @samp{RX600} and @samp{RX610} is that the
25374 @samp{RX610} does not support the @code{MVTIPL} instruction.
25375
25376 The @samp{RX200} series does not have a hardware floating-point unit
25377 and so @option{-nofpu} is enabled by default when this type is
25378 selected.
25379
25380 @item -mbig-endian-data
25381 @itemx -mlittle-endian-data
25382 @opindex mbig-endian-data
25383 @opindex mlittle-endian-data
25384 Store data (but not code) in the big-endian format. The default is
25385 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25386 format.
25387
25388 @item -msmall-data-limit=@var{N}
25389 @opindex msmall-data-limit
25390 Specifies the maximum size in bytes of global and static variables
25391 which can be placed into the small data area. Using the small data
25392 area can lead to smaller and faster code, but the size of area is
25393 limited and it is up to the programmer to ensure that the area does
25394 not overflow. Also when the small data area is used one of the RX's
25395 registers (usually @code{r13}) is reserved for use pointing to this
25396 area, so it is no longer available for use by the compiler. This
25397 could result in slower and/or larger code if variables are pushed onto
25398 the stack instead of being held in this register.
25399
25400 Note, common variables (variables that have not been initialized) and
25401 constants are not placed into the small data area as they are assigned
25402 to other sections in the output executable.
25403
25404 The default value is zero, which disables this feature. Note, this
25405 feature is not enabled by default with higher optimization levels
25406 (@option{-O2} etc) because of the potentially detrimental effects of
25407 reserving a register. It is up to the programmer to experiment and
25408 discover whether this feature is of benefit to their program. See the
25409 description of the @option{-mpid} option for a description of how the
25410 actual register to hold the small data area pointer is chosen.
25411
25412 @item -msim
25413 @itemx -mno-sim
25414 @opindex msim
25415 @opindex mno-sim
25416 Use the simulator runtime. The default is to use the libgloss
25417 board-specific runtime.
25418
25419 @item -mas100-syntax
25420 @itemx -mno-as100-syntax
25421 @opindex mas100-syntax
25422 @opindex mno-as100-syntax
25423 When generating assembler output use a syntax that is compatible with
25424 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25425 assembler, but it has some restrictions so it is not generated by default.
25426
25427 @item -mmax-constant-size=@var{N}
25428 @opindex mmax-constant-size
25429 Specifies the maximum size, in bytes, of a constant that can be used as
25430 an operand in a RX instruction. Although the RX instruction set does
25431 allow constants of up to 4 bytes in length to be used in instructions,
25432 a longer value equates to a longer instruction. Thus in some
25433 circumstances it can be beneficial to restrict the size of constants
25434 that are used in instructions. Constants that are too big are instead
25435 placed into a constant pool and referenced via register indirection.
25436
25437 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25438 or 4 means that constants of any size are allowed.
25439
25440 @item -mrelax
25441 @opindex mrelax
25442 Enable linker relaxation. Linker relaxation is a process whereby the
25443 linker attempts to reduce the size of a program by finding shorter
25444 versions of various instructions. Disabled by default.
25445
25446 @item -mint-register=@var{N}
25447 @opindex mint-register
25448 Specify the number of registers to reserve for fast interrupt handler
25449 functions. The value @var{N} can be between 0 and 4. A value of 1
25450 means that register @code{r13} is reserved for the exclusive use
25451 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25452 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25453 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25454 A value of 0, the default, does not reserve any registers.
25455
25456 @item -msave-acc-in-interrupts
25457 @opindex msave-acc-in-interrupts
25458 Specifies that interrupt handler functions should preserve the
25459 accumulator register. This is only necessary if normal code might use
25460 the accumulator register, for example because it performs 64-bit
25461 multiplications. The default is to ignore the accumulator as this
25462 makes the interrupt handlers faster.
25463
25464 @item -mpid
25465 @itemx -mno-pid
25466 @opindex mpid
25467 @opindex mno-pid
25468 Enables the generation of position independent data. When enabled any
25469 access to constant data is done via an offset from a base address
25470 held in a register. This allows the location of constant data to be
25471 determined at run time without requiring the executable to be
25472 relocated, which is a benefit to embedded applications with tight
25473 memory constraints. Data that can be modified is not affected by this
25474 option.
25475
25476 Note, using this feature reserves a register, usually @code{r13}, for
25477 the constant data base address. This can result in slower and/or
25478 larger code, especially in complicated functions.
25479
25480 The actual register chosen to hold the constant data base address
25481 depends upon whether the @option{-msmall-data-limit} and/or the
25482 @option{-mint-register} command-line options are enabled. Starting
25483 with register @code{r13} and proceeding downwards, registers are
25484 allocated first to satisfy the requirements of @option{-mint-register},
25485 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25486 is possible for the small data area register to be @code{r8} if both
25487 @option{-mint-register=4} and @option{-mpid} are specified on the
25488 command line.
25489
25490 By default this feature is not enabled. The default can be restored
25491 via the @option{-mno-pid} command-line option.
25492
25493 @item -mno-warn-multiple-fast-interrupts
25494 @itemx -mwarn-multiple-fast-interrupts
25495 @opindex mno-warn-multiple-fast-interrupts
25496 @opindex mwarn-multiple-fast-interrupts
25497 Prevents GCC from issuing a warning message if it finds more than one
25498 fast interrupt handler when it is compiling a file. The default is to
25499 issue a warning for each extra fast interrupt handler found, as the RX
25500 only supports one such interrupt.
25501
25502 @item -mallow-string-insns
25503 @itemx -mno-allow-string-insns
25504 @opindex mallow-string-insns
25505 @opindex mno-allow-string-insns
25506 Enables or disables the use of the string manipulation instructions
25507 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25508 @code{SWHILE} and also the @code{RMPA} instruction. These
25509 instructions may prefetch data, which is not safe to do if accessing
25510 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25511 for more information).
25512
25513 The default is to allow these instructions, but it is not possible for
25514 GCC to reliably detect all circumstances where a string instruction
25515 might be used to access an I/O register, so their use cannot be
25516 disabled automatically. Instead it is reliant upon the programmer to
25517 use the @option{-mno-allow-string-insns} option if their program
25518 accesses I/O space.
25519
25520 When the instructions are enabled GCC defines the C preprocessor
25521 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25522 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25523
25524 @item -mjsr
25525 @itemx -mno-jsr
25526 @opindex mjsr
25527 @opindex mno-jsr
25528 Use only (or not only) @code{JSR} instructions to access functions.
25529 This option can be used when code size exceeds the range of @code{BSR}
25530 instructions. Note that @option{-mno-jsr} does not mean to not use
25531 @code{JSR} but instead means that any type of branch may be used.
25532 @end table
25533
25534 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25535 has special significance to the RX port when used with the
25536 @code{interrupt} function attribute. This attribute indicates a
25537 function intended to process fast interrupts. GCC ensures
25538 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25539 and/or @code{r13} and only provided that the normal use of the
25540 corresponding registers have been restricted via the
25541 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25542 options.
25543
25544 @node S/390 and zSeries Options
25545 @subsection S/390 and zSeries Options
25546 @cindex S/390 and zSeries Options
25547
25548 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25549
25550 @table @gcctabopt
25551 @item -mhard-float
25552 @itemx -msoft-float
25553 @opindex mhard-float
25554 @opindex msoft-float
25555 Use (do not use) the hardware floating-point instructions and registers
25556 for floating-point operations. When @option{-msoft-float} is specified,
25557 functions in @file{libgcc.a} are used to perform floating-point
25558 operations. When @option{-mhard-float} is specified, the compiler
25559 generates IEEE floating-point instructions. This is the default.
25560
25561 @item -mhard-dfp
25562 @itemx -mno-hard-dfp
25563 @opindex mhard-dfp
25564 @opindex mno-hard-dfp
25565 Use (do not use) the hardware decimal-floating-point instructions for
25566 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25567 specified, functions in @file{libgcc.a} are used to perform
25568 decimal-floating-point operations. When @option{-mhard-dfp} is
25569 specified, the compiler generates decimal-floating-point hardware
25570 instructions. This is the default for @option{-march=z9-ec} or higher.
25571
25572 @item -mlong-double-64
25573 @itemx -mlong-double-128
25574 @opindex mlong-double-64
25575 @opindex mlong-double-128
25576 These switches control the size of @code{long double} type. A size
25577 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25578 type. This is the default.
25579
25580 @item -mbackchain
25581 @itemx -mno-backchain
25582 @opindex mbackchain
25583 @opindex mno-backchain
25584 Store (do not store) the address of the caller's frame as backchain pointer
25585 into the callee's stack frame.
25586 A backchain may be needed to allow debugging using tools that do not understand
25587 DWARF call frame information.
25588 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25589 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25590 the backchain is placed into the topmost word of the 96/160 byte register
25591 save area.
25592
25593 In general, code compiled with @option{-mbackchain} is call-compatible with
25594 code compiled with @option{-mmo-backchain}; however, use of the backchain
25595 for debugging purposes usually requires that the whole binary is built with
25596 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25597 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25598 to build a linux kernel use @option{-msoft-float}.
25599
25600 The default is to not maintain the backchain.
25601
25602 @item -mpacked-stack
25603 @itemx -mno-packed-stack
25604 @opindex mpacked-stack
25605 @opindex mno-packed-stack
25606 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25607 specified, the compiler uses the all fields of the 96/160 byte register save
25608 area only for their default purpose; unused fields still take up stack space.
25609 When @option{-mpacked-stack} is specified, register save slots are densely
25610 packed at the top of the register save area; unused space is reused for other
25611 purposes, allowing for more efficient use of the available stack space.
25612 However, when @option{-mbackchain} is also in effect, the topmost word of
25613 the save area is always used to store the backchain, and the return address
25614 register is always saved two words below the backchain.
25615
25616 As long as the stack frame backchain is not used, code generated with
25617 @option{-mpacked-stack} is call-compatible with code generated with
25618 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25619 S/390 or zSeries generated code that uses the stack frame backchain at run
25620 time, not just for debugging purposes. Such code is not call-compatible
25621 with code compiled with @option{-mpacked-stack}. Also, note that the
25622 combination of @option{-mbackchain},
25623 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25624 to build a linux kernel use @option{-msoft-float}.
25625
25626 The default is to not use the packed stack layout.
25627
25628 @item -msmall-exec
25629 @itemx -mno-small-exec
25630 @opindex msmall-exec
25631 @opindex mno-small-exec
25632 Generate (or do not generate) code using the @code{bras} instruction
25633 to do subroutine calls.
25634 This only works reliably if the total executable size does not
25635 exceed 64k. The default is to use the @code{basr} instruction instead,
25636 which does not have this limitation.
25637
25638 @item -m64
25639 @itemx -m31
25640 @opindex m64
25641 @opindex m31
25642 When @option{-m31} is specified, generate code compliant to the
25643 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25644 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25645 particular to generate 64-bit instructions. For the @samp{s390}
25646 targets, the default is @option{-m31}, while the @samp{s390x}
25647 targets default to @option{-m64}.
25648
25649 @item -mzarch
25650 @itemx -mesa
25651 @opindex mzarch
25652 @opindex mesa
25653 When @option{-mzarch} is specified, generate code using the
25654 instructions available on z/Architecture.
25655 When @option{-mesa} is specified, generate code using the
25656 instructions available on ESA/390. Note that @option{-mesa} is
25657 not possible with @option{-m64}.
25658 When generating code compliant to the GNU/Linux for S/390 ABI,
25659 the default is @option{-mesa}. When generating code compliant
25660 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25661
25662 @item -mhtm
25663 @itemx -mno-htm
25664 @opindex mhtm
25665 @opindex mno-htm
25666 The @option{-mhtm} option enables a set of builtins making use of
25667 instructions available with the transactional execution facility
25668 introduced with the IBM zEnterprise EC12 machine generation
25669 @ref{S/390 System z Built-in Functions}.
25670 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25671
25672 @item -mvx
25673 @itemx -mno-vx
25674 @opindex mvx
25675 @opindex mno-vx
25676 When @option{-mvx} is specified, generate code using the instructions
25677 available with the vector extension facility introduced with the IBM
25678 z13 machine generation.
25679 This option changes the ABI for some vector type values with regard to
25680 alignment and calling conventions. In case vector type values are
25681 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25682 command will be added to mark the resulting binary with the ABI used.
25683 @option{-mvx} is enabled by default when using @option{-march=z13}.
25684
25685 @item -mzvector
25686 @itemx -mno-zvector
25687 @opindex mzvector
25688 @opindex mno-zvector
25689 The @option{-mzvector} option enables vector language extensions and
25690 builtins using instructions available with the vector extension
25691 facility introduced with the IBM z13 machine generation.
25692 This option adds support for @samp{vector} to be used as a keyword to
25693 define vector type variables and arguments. @samp{vector} is only
25694 available when GNU extensions are enabled. It will not be expanded
25695 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25696 In addition to the GCC low-level builtins @option{-mzvector} enables
25697 a set of builtins added for compatibility with AltiVec-style
25698 implementations like Power and Cell. In order to make use of these
25699 builtins the header file @file{vecintrin.h} needs to be included.
25700 @option{-mzvector} is disabled by default.
25701
25702 @item -mmvcle
25703 @itemx -mno-mvcle
25704 @opindex mmvcle
25705 @opindex mno-mvcle
25706 Generate (or do not generate) code using the @code{mvcle} instruction
25707 to perform block moves. When @option{-mno-mvcle} is specified,
25708 use a @code{mvc} loop instead. This is the default unless optimizing for
25709 size.
25710
25711 @item -mdebug
25712 @itemx -mno-debug
25713 @opindex mdebug
25714 @opindex mno-debug
25715 Print (or do not print) additional debug information when compiling.
25716 The default is to not print debug information.
25717
25718 @item -march=@var{cpu-type}
25719 @opindex march
25720 Generate code that runs on @var{cpu-type}, which is the name of a
25721 system representing a certain processor type. Possible values for
25722 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25723 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25724 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25725 @samp{z14}/@samp{arch12}, and @samp{native}.
25726
25727 The default is @option{-march=z900}.
25728
25729 Specifying @samp{native} as cpu type can be used to select the best
25730 architecture option for the host processor.
25731 @option{-march=native} has no effect if GCC does not recognize the
25732 processor.
25733
25734 @item -mtune=@var{cpu-type}
25735 @opindex mtune
25736 Tune to @var{cpu-type} everything applicable about the generated code,
25737 except for the ABI and the set of available instructions.
25738 The list of @var{cpu-type} values is the same as for @option{-march}.
25739 The default is the value used for @option{-march}.
25740
25741 @item -mtpf-trace
25742 @itemx -mno-tpf-trace
25743 @opindex mtpf-trace
25744 @opindex mno-tpf-trace
25745 Generate code that adds (does not add) in TPF OS specific branches to trace
25746 routines in the operating system. This option is off by default, even
25747 when compiling for the TPF OS@.
25748
25749 @item -mfused-madd
25750 @itemx -mno-fused-madd
25751 @opindex mfused-madd
25752 @opindex mno-fused-madd
25753 Generate code that uses (does not use) the floating-point multiply and
25754 accumulate instructions. These instructions are generated by default if
25755 hardware floating point is used.
25756
25757 @item -mwarn-framesize=@var{framesize}
25758 @opindex mwarn-framesize
25759 Emit a warning if the current function exceeds the given frame size. Because
25760 this is a compile-time check it doesn't need to be a real problem when the program
25761 runs. It is intended to identify functions that most probably cause
25762 a stack overflow. It is useful to be used in an environment with limited stack
25763 size e.g.@: the linux kernel.
25764
25765 @item -mwarn-dynamicstack
25766 @opindex mwarn-dynamicstack
25767 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25768 arrays. This is generally a bad idea with a limited stack size.
25769
25770 @item -mstack-guard=@var{stack-guard}
25771 @itemx -mstack-size=@var{stack-size}
25772 @opindex mstack-guard
25773 @opindex mstack-size
25774 If these options are provided the S/390 back end emits additional instructions in
25775 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25776 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25777 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25778 the frame size of the compiled function is chosen.
25779 These options are intended to be used to help debugging stack overflow problems.
25780 The additionally emitted code causes only little overhead and hence can also be
25781 used in production-like systems without greater performance degradation. The given
25782 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25783 @var{stack-guard} without exceeding 64k.
25784 In order to be efficient the extra code makes the assumption that the stack starts
25785 at an address aligned to the value given by @var{stack-size}.
25786 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25787
25788 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25789 @opindex mhotpatch
25790 If the hotpatch option is enabled, a ``hot-patching'' function
25791 prologue is generated for all functions in the compilation unit.
25792 The funtion label is prepended with the given number of two-byte
25793 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25794 the label, 2 * @var{post-halfwords} bytes are appended, using the
25795 largest NOP like instructions the architecture allows (maximum
25796 1000000).
25797
25798 If both arguments are zero, hotpatching is disabled.
25799
25800 This option can be overridden for individual functions with the
25801 @code{hotpatch} attribute.
25802 @end table
25803
25804 @node Score Options
25805 @subsection Score Options
25806 @cindex Score Options
25807
25808 These options are defined for Score implementations:
25809
25810 @table @gcctabopt
25811 @item -meb
25812 @opindex meb
25813 Compile code for big-endian mode. This is the default.
25814
25815 @item -mel
25816 @opindex mel
25817 Compile code for little-endian mode.
25818
25819 @item -mnhwloop
25820 @opindex mnhwloop
25821 Disable generation of @code{bcnz} instructions.
25822
25823 @item -muls
25824 @opindex muls
25825 Enable generation of unaligned load and store instructions.
25826
25827 @item -mmac
25828 @opindex mmac
25829 Enable the use of multiply-accumulate instructions. Disabled by default.
25830
25831 @item -mscore5
25832 @opindex mscore5
25833 Specify the SCORE5 as the target architecture.
25834
25835 @item -mscore5u
25836 @opindex mscore5u
25837 Specify the SCORE5U of the target architecture.
25838
25839 @item -mscore7
25840 @opindex mscore7
25841 Specify the SCORE7 as the target architecture. This is the default.
25842
25843 @item -mscore7d
25844 @opindex mscore7d
25845 Specify the SCORE7D as the target architecture.
25846 @end table
25847
25848 @node SH Options
25849 @subsection SH Options
25850
25851 These @samp{-m} options are defined for the SH implementations:
25852
25853 @table @gcctabopt
25854 @item -m1
25855 @opindex m1
25856 Generate code for the SH1.
25857
25858 @item -m2
25859 @opindex m2
25860 Generate code for the SH2.
25861
25862 @item -m2e
25863 Generate code for the SH2e.
25864
25865 @item -m2a-nofpu
25866 @opindex m2a-nofpu
25867 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25868 that the floating-point unit is not used.
25869
25870 @item -m2a-single-only
25871 @opindex m2a-single-only
25872 Generate code for the SH2a-FPU, in such a way that no double-precision
25873 floating-point operations are used.
25874
25875 @item -m2a-single
25876 @opindex m2a-single
25877 Generate code for the SH2a-FPU assuming the floating-point unit is in
25878 single-precision mode by default.
25879
25880 @item -m2a
25881 @opindex m2a
25882 Generate code for the SH2a-FPU assuming the floating-point unit is in
25883 double-precision mode by default.
25884
25885 @item -m3
25886 @opindex m3
25887 Generate code for the SH3.
25888
25889 @item -m3e
25890 @opindex m3e
25891 Generate code for the SH3e.
25892
25893 @item -m4-nofpu
25894 @opindex m4-nofpu
25895 Generate code for the SH4 without a floating-point unit.
25896
25897 @item -m4-single-only
25898 @opindex m4-single-only
25899 Generate code for the SH4 with a floating-point unit that only
25900 supports single-precision arithmetic.
25901
25902 @item -m4-single
25903 @opindex m4-single
25904 Generate code for the SH4 assuming the floating-point unit is in
25905 single-precision mode by default.
25906
25907 @item -m4
25908 @opindex m4
25909 Generate code for the SH4.
25910
25911 @item -m4-100
25912 @opindex m4-100
25913 Generate code for SH4-100.
25914
25915 @item -m4-100-nofpu
25916 @opindex m4-100-nofpu
25917 Generate code for SH4-100 in such a way that the
25918 floating-point unit is not used.
25919
25920 @item -m4-100-single
25921 @opindex m4-100-single
25922 Generate code for SH4-100 assuming the floating-point unit is in
25923 single-precision mode by default.
25924
25925 @item -m4-100-single-only
25926 @opindex m4-100-single-only
25927 Generate code for SH4-100 in such a way that no double-precision
25928 floating-point operations are used.
25929
25930 @item -m4-200
25931 @opindex m4-200
25932 Generate code for SH4-200.
25933
25934 @item -m4-200-nofpu
25935 @opindex m4-200-nofpu
25936 Generate code for SH4-200 without in such a way that the
25937 floating-point unit is not used.
25938
25939 @item -m4-200-single
25940 @opindex m4-200-single
25941 Generate code for SH4-200 assuming the floating-point unit is in
25942 single-precision mode by default.
25943
25944 @item -m4-200-single-only
25945 @opindex m4-200-single-only
25946 Generate code for SH4-200 in such a way that no double-precision
25947 floating-point operations are used.
25948
25949 @item -m4-300
25950 @opindex m4-300
25951 Generate code for SH4-300.
25952
25953 @item -m4-300-nofpu
25954 @opindex m4-300-nofpu
25955 Generate code for SH4-300 without in such a way that the
25956 floating-point unit is not used.
25957
25958 @item -m4-300-single
25959 @opindex m4-300-single
25960 Generate code for SH4-300 in such a way that no double-precision
25961 floating-point operations are used.
25962
25963 @item -m4-300-single-only
25964 @opindex m4-300-single-only
25965 Generate code for SH4-300 in such a way that no double-precision
25966 floating-point operations are used.
25967
25968 @item -m4-340
25969 @opindex m4-340
25970 Generate code for SH4-340 (no MMU, no FPU).
25971
25972 @item -m4-500
25973 @opindex m4-500
25974 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25975 assembler.
25976
25977 @item -m4a-nofpu
25978 @opindex m4a-nofpu
25979 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25980 floating-point unit is not used.
25981
25982 @item -m4a-single-only
25983 @opindex m4a-single-only
25984 Generate code for the SH4a, in such a way that no double-precision
25985 floating-point operations are used.
25986
25987 @item -m4a-single
25988 @opindex m4a-single
25989 Generate code for the SH4a assuming the floating-point unit is in
25990 single-precision mode by default.
25991
25992 @item -m4a
25993 @opindex m4a
25994 Generate code for the SH4a.
25995
25996 @item -m4al
25997 @opindex m4al
25998 Same as @option{-m4a-nofpu}, except that it implicitly passes
25999 @option{-dsp} to the assembler. GCC doesn't generate any DSP
26000 instructions at the moment.
26001
26002 @item -mb
26003 @opindex mb
26004 Compile code for the processor in big-endian mode.
26005
26006 @item -ml
26007 @opindex ml
26008 Compile code for the processor in little-endian mode.
26009
26010 @item -mdalign
26011 @opindex mdalign
26012 Align doubles at 64-bit boundaries. Note that this changes the calling
26013 conventions, and thus some functions from the standard C library do
26014 not work unless you recompile it first with @option{-mdalign}.
26015
26016 @item -mrelax
26017 @opindex mrelax
26018 Shorten some address references at link time, when possible; uses the
26019 linker option @option{-relax}.
26020
26021 @item -mbigtable
26022 @opindex mbigtable
26023 Use 32-bit offsets in @code{switch} tables. The default is to use
26024 16-bit offsets.
26025
26026 @item -mbitops
26027 @opindex mbitops
26028 Enable the use of bit manipulation instructions on SH2A.
26029
26030 @item -mfmovd
26031 @opindex mfmovd
26032 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
26033 alignment constraints.
26034
26035 @item -mrenesas
26036 @opindex mrenesas
26037 Comply with the calling conventions defined by Renesas.
26038
26039 @item -mno-renesas
26040 @opindex mno-renesas
26041 Comply with the calling conventions defined for GCC before the Renesas
26042 conventions were available. This option is the default for all
26043 targets of the SH toolchain.
26044
26045 @item -mnomacsave
26046 @opindex mnomacsave
26047 Mark the @code{MAC} register as call-clobbered, even if
26048 @option{-mrenesas} is given.
26049
26050 @item -mieee
26051 @itemx -mno-ieee
26052 @opindex mieee
26053 @opindex mno-ieee
26054 Control the IEEE compliance of floating-point comparisons, which affects the
26055 handling of cases where the result of a comparison is unordered. By default
26056 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
26057 enabled @option{-mno-ieee} is implicitly set, which results in faster
26058 floating-point greater-equal and less-equal comparisons. The implicit settings
26059 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
26060
26061 @item -minline-ic_invalidate
26062 @opindex minline-ic_invalidate
26063 Inline code to invalidate instruction cache entries after setting up
26064 nested function trampolines.
26065 This option has no effect if @option{-musermode} is in effect and the selected
26066 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26067 instruction.
26068 If the selected code generation option does not allow the use of the @code{icbi}
26069 instruction, and @option{-musermode} is not in effect, the inlined code
26070 manipulates the instruction cache address array directly with an associative
26071 write. This not only requires privileged mode at run time, but it also
26072 fails if the cache line had been mapped via the TLB and has become unmapped.
26073
26074 @item -misize
26075 @opindex misize
26076 Dump instruction size and location in the assembly code.
26077
26078 @item -mpadstruct
26079 @opindex mpadstruct
26080 This option is deprecated. It pads structures to multiple of 4 bytes,
26081 which is incompatible with the SH ABI@.
26082
26083 @item -matomic-model=@var{model}
26084 @opindex matomic-model=@var{model}
26085 Sets the model of atomic operations and additional parameters as a comma
26086 separated list. For details on the atomic built-in functions see
26087 @ref{__atomic Builtins}. The following models and parameters are supported:
26088
26089 @table @samp
26090
26091 @item none
26092 Disable compiler generated atomic sequences and emit library calls for atomic
26093 operations. This is the default if the target is not @code{sh*-*-linux*}.
26094
26095 @item soft-gusa
26096 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26097 built-in functions. The generated atomic sequences require additional support
26098 from the interrupt/exception handling code of the system and are only suitable
26099 for SH3* and SH4* single-core systems. This option is enabled by default when
26100 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26101 this option also partially utilizes the hardware atomic instructions
26102 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26103 @samp{strict} is specified.
26104
26105 @item soft-tcb
26106 Generate software atomic sequences that use a variable in the thread control
26107 block. This is a variation of the gUSA sequences which can also be used on
26108 SH1* and SH2* targets. The generated atomic sequences require additional
26109 support from the interrupt/exception handling code of the system and are only
26110 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26111 parameter has to be specified as well.
26112
26113 @item soft-imask
26114 Generate software atomic sequences that temporarily disable interrupts by
26115 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26116 in privileged mode and is only suitable for single-core systems. Additional
26117 support from the interrupt/exception handling code of the system is not
26118 required. This model is enabled by default when the target is
26119 @code{sh*-*-linux*} and SH1* or SH2*.
26120
26121 @item hard-llcs
26122 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26123 instructions only. This is only available on SH4A and is suitable for
26124 multi-core systems. Since the hardware instructions support only 32 bit atomic
26125 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26126 Code compiled with this option is also compatible with other software
26127 atomic model interrupt/exception handling systems if executed on an SH4A
26128 system. Additional support from the interrupt/exception handling code of the
26129 system is not required for this model.
26130
26131 @item gbr-offset=
26132 This parameter specifies the offset in bytes of the variable in the thread
26133 control block structure that should be used by the generated atomic sequences
26134 when the @samp{soft-tcb} model has been selected. For other models this
26135 parameter is ignored. The specified value must be an integer multiple of four
26136 and in the range 0-1020.
26137
26138 @item strict
26139 This parameter prevents mixed usage of multiple atomic models, even if they
26140 are compatible, and makes the compiler generate atomic sequences of the
26141 specified model only.
26142
26143 @end table
26144
26145 @item -mtas
26146 @opindex mtas
26147 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26148 Notice that depending on the particular hardware and software configuration
26149 this can degrade overall performance due to the operand cache line flushes
26150 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26151 processors the @code{tas.b} instruction must be used with caution since it
26152 can result in data corruption for certain cache configurations.
26153
26154 @item -mprefergot
26155 @opindex mprefergot
26156 When generating position-independent code, emit function calls using
26157 the Global Offset Table instead of the Procedure Linkage Table.
26158
26159 @item -musermode
26160 @itemx -mno-usermode
26161 @opindex musermode
26162 @opindex mno-usermode
26163 Don't allow (allow) the compiler generating privileged mode code. Specifying
26164 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26165 inlined code would not work in user mode. @option{-musermode} is the default
26166 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26167 @option{-musermode} has no effect, since there is no user mode.
26168
26169 @item -multcost=@var{number}
26170 @opindex multcost=@var{number}
26171 Set the cost to assume for a multiply insn.
26172
26173 @item -mdiv=@var{strategy}
26174 @opindex mdiv=@var{strategy}
26175 Set the division strategy to be used for integer division operations.
26176 @var{strategy} can be one of:
26177
26178 @table @samp
26179
26180 @item call-div1
26181 Calls a library function that uses the single-step division instruction
26182 @code{div1} to perform the operation. Division by zero calculates an
26183 unspecified result and does not trap. This is the default except for SH4,
26184 SH2A and SHcompact.
26185
26186 @item call-fp
26187 Calls a library function that performs the operation in double precision
26188 floating point. Division by zero causes a floating-point exception. This is
26189 the default for SHcompact with FPU. Specifying this for targets that do not
26190 have a double precision FPU defaults to @code{call-div1}.
26191
26192 @item call-table
26193 Calls a library function that uses a lookup table for small divisors and
26194 the @code{div1} instruction with case distinction for larger divisors. Division
26195 by zero calculates an unspecified result and does not trap. This is the default
26196 for SH4. Specifying this for targets that do not have dynamic shift
26197 instructions defaults to @code{call-div1}.
26198
26199 @end table
26200
26201 When a division strategy has not been specified the default strategy is
26202 selected based on the current target. For SH2A the default strategy is to
26203 use the @code{divs} and @code{divu} instructions instead of library function
26204 calls.
26205
26206 @item -maccumulate-outgoing-args
26207 @opindex maccumulate-outgoing-args
26208 Reserve space once for outgoing arguments in the function prologue rather
26209 than around each call. Generally beneficial for performance and size. Also
26210 needed for unwinding to avoid changing the stack frame around conditional code.
26211
26212 @item -mdivsi3_libfunc=@var{name}
26213 @opindex mdivsi3_libfunc=@var{name}
26214 Set the name of the library function used for 32-bit signed division to
26215 @var{name}.
26216 This only affects the name used in the @samp{call} division strategies, and
26217 the compiler still expects the same sets of input/output/clobbered registers as
26218 if this option were not present.
26219
26220 @item -mfixed-range=@var{register-range}
26221 @opindex mfixed-range
26222 Generate code treating the given register range as fixed registers.
26223 A fixed register is one that the register allocator cannot use. This is
26224 useful when compiling kernel code. A register range is specified as
26225 two registers separated by a dash. Multiple register ranges can be
26226 specified separated by a comma.
26227
26228 @item -mbranch-cost=@var{num}
26229 @opindex mbranch-cost=@var{num}
26230 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26231 make the compiler try to generate more branch-free code if possible.
26232 If not specified the value is selected depending on the processor type that
26233 is being compiled for.
26234
26235 @item -mzdcbranch
26236 @itemx -mno-zdcbranch
26237 @opindex mzdcbranch
26238 @opindex mno-zdcbranch
26239 Assume (do not assume) that zero displacement conditional branch instructions
26240 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26241 compiler prefers zero displacement branch code sequences. This is
26242 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26243 disabled by specifying @option{-mno-zdcbranch}.
26244
26245 @item -mcbranch-force-delay-slot
26246 @opindex mcbranch-force-delay-slot
26247 Force the usage of delay slots for conditional branches, which stuffs the delay
26248 slot with a @code{nop} if a suitable instruction cannot be found. By default
26249 this option is disabled. It can be enabled to work around hardware bugs as
26250 found in the original SH7055.
26251
26252 @item -mfused-madd
26253 @itemx -mno-fused-madd
26254 @opindex mfused-madd
26255 @opindex mno-fused-madd
26256 Generate code that uses (does not use) the floating-point multiply and
26257 accumulate instructions. These instructions are generated by default
26258 if hardware floating point is used. The machine-dependent
26259 @option{-mfused-madd} option is now mapped to the machine-independent
26260 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26261 mapped to @option{-ffp-contract=off}.
26262
26263 @item -mfsca
26264 @itemx -mno-fsca
26265 @opindex mfsca
26266 @opindex mno-fsca
26267 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26268 and cosine approximations. The option @option{-mfsca} must be used in
26269 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26270 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26271 approximations even if @option{-funsafe-math-optimizations} is in effect.
26272
26273 @item -mfsrra
26274 @itemx -mno-fsrra
26275 @opindex mfsrra
26276 @opindex mno-fsrra
26277 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26278 reciprocal square root approximations. The option @option{-mfsrra} must be used
26279 in combination with @option{-funsafe-math-optimizations} and
26280 @option{-ffinite-math-only}. It is enabled by default when generating code for
26281 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26282 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26283 in effect.
26284
26285 @item -mpretend-cmove
26286 @opindex mpretend-cmove
26287 Prefer zero-displacement conditional branches for conditional move instruction
26288 patterns. This can result in faster code on the SH4 processor.
26289
26290 @item -mfdpic
26291 @opindex fdpic
26292 Generate code using the FDPIC ABI.
26293
26294 @end table
26295
26296 @node Solaris 2 Options
26297 @subsection Solaris 2 Options
26298 @cindex Solaris 2 options
26299
26300 These @samp{-m} options are supported on Solaris 2:
26301
26302 @table @gcctabopt
26303 @item -mclear-hwcap
26304 @opindex mclear-hwcap
26305 @option{-mclear-hwcap} tells the compiler to remove the hardware
26306 capabilities generated by the Solaris assembler. This is only necessary
26307 when object files use ISA extensions not supported by the current
26308 machine, but check at runtime whether or not to use them.
26309
26310 @item -mimpure-text
26311 @opindex mimpure-text
26312 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26313 the compiler to not pass @option{-z text} to the linker when linking a
26314 shared object. Using this option, you can link position-dependent
26315 code into a shared object.
26316
26317 @option{-mimpure-text} suppresses the ``relocations remain against
26318 allocatable but non-writable sections'' linker error message.
26319 However, the necessary relocations trigger copy-on-write, and the
26320 shared object is not actually shared across processes. Instead of
26321 using @option{-mimpure-text}, you should compile all source code with
26322 @option{-fpic} or @option{-fPIC}.
26323
26324 @end table
26325
26326 These switches are supported in addition to the above on Solaris 2:
26327
26328 @table @gcctabopt
26329 @item -pthreads
26330 @opindex pthreads
26331 This is a synonym for @option{-pthread}.
26332 @end table
26333
26334 @node SPARC Options
26335 @subsection SPARC Options
26336 @cindex SPARC options
26337
26338 These @samp{-m} options are supported on the SPARC:
26339
26340 @table @gcctabopt
26341 @item -mno-app-regs
26342 @itemx -mapp-regs
26343 @opindex mno-app-regs
26344 @opindex mapp-regs
26345 Specify @option{-mapp-regs} to generate output using the global registers
26346 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26347 global register 1, each global register 2 through 4 is then treated as an
26348 allocable register that is clobbered by function calls. This is the default.
26349
26350 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26351 specify @option{-mno-app-regs}. You should compile libraries and system
26352 software with this option.
26353
26354 @item -mflat
26355 @itemx -mno-flat
26356 @opindex mflat
26357 @opindex mno-flat
26358 With @option{-mflat}, the compiler does not generate save/restore instructions
26359 and uses a ``flat'' or single register window model. This model is compatible
26360 with the regular register window model. The local registers and the input
26361 registers (0--5) are still treated as ``call-saved'' registers and are
26362 saved on the stack as needed.
26363
26364 With @option{-mno-flat} (the default), the compiler generates save/restore
26365 instructions (except for leaf functions). This is the normal operating mode.
26366
26367 @item -mfpu
26368 @itemx -mhard-float
26369 @opindex mfpu
26370 @opindex mhard-float
26371 Generate output containing floating-point instructions. This is the
26372 default.
26373
26374 @item -mno-fpu
26375 @itemx -msoft-float
26376 @opindex mno-fpu
26377 @opindex msoft-float
26378 Generate output containing library calls for floating point.
26379 @strong{Warning:} the requisite libraries are not available for all SPARC
26380 targets. Normally the facilities of the machine's usual C compiler are
26381 used, but this cannot be done directly in cross-compilation. You must make
26382 your own arrangements to provide suitable library functions for
26383 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26384 @samp{sparclite-*-*} do provide software floating-point support.
26385
26386 @option{-msoft-float} changes the calling convention in the output file;
26387 therefore, it is only useful if you compile @emph{all} of a program with
26388 this option. In particular, you need to compile @file{libgcc.a}, the
26389 library that comes with GCC, with @option{-msoft-float} in order for
26390 this to work.
26391
26392 @item -mhard-quad-float
26393 @opindex mhard-quad-float
26394 Generate output containing quad-word (long double) floating-point
26395 instructions.
26396
26397 @item -msoft-quad-float
26398 @opindex msoft-quad-float
26399 Generate output containing library calls for quad-word (long double)
26400 floating-point instructions. The functions called are those specified
26401 in the SPARC ABI@. This is the default.
26402
26403 As of this writing, there are no SPARC implementations that have hardware
26404 support for the quad-word floating-point instructions. They all invoke
26405 a trap handler for one of these instructions, and then the trap handler
26406 emulates the effect of the instruction. Because of the trap handler overhead,
26407 this is much slower than calling the ABI library routines. Thus the
26408 @option{-msoft-quad-float} option is the default.
26409
26410 @item -mno-unaligned-doubles
26411 @itemx -munaligned-doubles
26412 @opindex mno-unaligned-doubles
26413 @opindex munaligned-doubles
26414 Assume that doubles have 8-byte alignment. This is the default.
26415
26416 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26417 alignment only if they are contained in another type, or if they have an
26418 absolute address. Otherwise, it assumes they have 4-byte alignment.
26419 Specifying this option avoids some rare compatibility problems with code
26420 generated by other compilers. It is not the default because it results
26421 in a performance loss, especially for floating-point code.
26422
26423 @item -muser-mode
26424 @itemx -mno-user-mode
26425 @opindex muser-mode
26426 @opindex mno-user-mode
26427 Do not generate code that can only run in supervisor mode. This is relevant
26428 only for the @code{casa} instruction emitted for the LEON3 processor. This
26429 is the default.
26430
26431 @item -mfaster-structs
26432 @itemx -mno-faster-structs
26433 @opindex mfaster-structs
26434 @opindex mno-faster-structs
26435 With @option{-mfaster-structs}, the compiler assumes that structures
26436 should have 8-byte alignment. This enables the use of pairs of
26437 @code{ldd} and @code{std} instructions for copies in structure
26438 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26439 However, the use of this changed alignment directly violates the SPARC
26440 ABI@. Thus, it's intended only for use on targets where the developer
26441 acknowledges that their resulting code is not directly in line with
26442 the rules of the ABI@.
26443
26444 @item -mstd-struct-return
26445 @itemx -mno-std-struct-return
26446 @opindex mstd-struct-return
26447 @opindex mno-std-struct-return
26448 With @option{-mstd-struct-return}, the compiler generates checking code
26449 in functions returning structures or unions to detect size mismatches
26450 between the two sides of function calls, as per the 32-bit ABI@.
26451
26452 The default is @option{-mno-std-struct-return}. This option has no effect
26453 in 64-bit mode.
26454
26455 @item -mlra
26456 @itemx -mno-lra
26457 @opindex mlra
26458 @opindex mno-lra
26459 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26460 so @option{-mno-lra} needs to be passed to get old Reload.
26461
26462 @item -mcpu=@var{cpu_type}
26463 @opindex mcpu
26464 Set the instruction set, register set, and instruction scheduling parameters
26465 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26466 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26467 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26468 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26469 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26470 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26471
26472 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26473 which selects the best architecture option for the host processor.
26474 @option{-mcpu=native} has no effect if GCC does not recognize
26475 the processor.
26476
26477 Default instruction scheduling parameters are used for values that select
26478 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26479 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26480
26481 Here is a list of each supported architecture and their supported
26482 implementations.
26483
26484 @table @asis
26485 @item v7
26486 cypress, leon3v7
26487
26488 @item v8
26489 supersparc, hypersparc, leon, leon3
26490
26491 @item sparclite
26492 f930, f934, sparclite86x
26493
26494 @item sparclet
26495 tsc701
26496
26497 @item v9
26498 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26499 niagara7, m8
26500 @end table
26501
26502 By default (unless configured otherwise), GCC generates code for the V7
26503 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26504 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26505 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26506 SPARCStation 1, 2, IPX etc.
26507
26508 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26509 architecture. The only difference from V7 code is that the compiler emits
26510 the integer multiply and integer divide instructions which exist in SPARC-V8
26511 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26512 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26513 2000 series.
26514
26515 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26516 the SPARC architecture. This adds the integer multiply, integer divide step
26517 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26518 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26519 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26520 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26521 MB86934 chip, which is the more recent SPARClite with FPU@.
26522
26523 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26524 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26525 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26526 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26527 optimizes it for the TEMIC SPARClet chip.
26528
26529 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26530 architecture. This adds 64-bit integer and floating-point move instructions,
26531 3 additional floating-point condition code registers and conditional move
26532 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26533 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26534 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26535 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26536 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26537 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26538 additionally optimizes it for Sun UltraSPARC T2 chips. With
26539 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26540 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26541 additionally optimizes it for Sun UltraSPARC T4 chips. With
26542 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26543 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26544 additionally optimizes it for Oracle M8 chips.
26545
26546 @item -mtune=@var{cpu_type}
26547 @opindex mtune
26548 Set the instruction scheduling parameters for machine type
26549 @var{cpu_type}, but do not set the instruction set or register set that the
26550 option @option{-mcpu=@var{cpu_type}} does.
26551
26552 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26553 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26554 that select a particular CPU implementation. Those are
26555 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26556 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26557 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26558 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26559 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26560 and GNU/Linux toolchains, @samp{native} can also be used.
26561
26562 @item -mv8plus
26563 @itemx -mno-v8plus
26564 @opindex mv8plus
26565 @opindex mno-v8plus
26566 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26567 difference from the V8 ABI is that the global and out registers are
26568 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26569 mode for all SPARC-V9 processors.
26570
26571 @item -mvis
26572 @itemx -mno-vis
26573 @opindex mvis
26574 @opindex mno-vis
26575 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26576 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26577
26578 @item -mvis2
26579 @itemx -mno-vis2
26580 @opindex mvis2
26581 @opindex mno-vis2
26582 With @option{-mvis2}, GCC generates code that takes advantage of
26583 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26584 default is @option{-mvis2} when targeting a cpu that supports such
26585 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26586 also sets @option{-mvis}.
26587
26588 @item -mvis3
26589 @itemx -mno-vis3
26590 @opindex mvis3
26591 @opindex mno-vis3
26592 With @option{-mvis3}, GCC generates code that takes advantage of
26593 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26594 default is @option{-mvis3} when targeting a cpu that supports such
26595 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26596 also sets @option{-mvis2} and @option{-mvis}.
26597
26598 @item -mvis4
26599 @itemx -mno-vis4
26600 @opindex mvis4
26601 @opindex mno-vis4
26602 With @option{-mvis4}, GCC generates code that takes advantage of
26603 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26604 default is @option{-mvis4} when targeting a cpu that supports such
26605 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26606 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26607
26608 @item -mvis4b
26609 @itemx -mno-vis4b
26610 @opindex mvis4b
26611 @opindex mno-vis4b
26612 With @option{-mvis4b}, GCC generates code that takes advantage of
26613 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26614 the additional VIS instructions introduced in the Oracle SPARC
26615 Architecture 2017. The default is @option{-mvis4b} when targeting a
26616 cpu that supports such instructions, such as m8 and later. Setting
26617 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26618 @option{-mvis2} and @option{-mvis}.
26619
26620 @item -mcbcond
26621 @itemx -mno-cbcond
26622 @opindex mcbcond
26623 @opindex mno-cbcond
26624 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26625 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26626 when targeting a CPU that supports such instructions, such as Niagara-4 and
26627 later.
26628
26629 @item -mfmaf
26630 @itemx -mno-fmaf
26631 @opindex mfmaf
26632 @opindex mno-fmaf
26633 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26634 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26635 when targeting a CPU that supports such instructions, such as Niagara-3 and
26636 later.
26637
26638 @item -mfsmuld
26639 @itemx -mno-fsmuld
26640 @opindex mfsmuld
26641 @opindex mno-fsmuld
26642 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26643 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26644 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26645 or V9 with FPU except @option{-mcpu=leon}.
26646
26647 @item -mpopc
26648 @itemx -mno-popc
26649 @opindex mpopc
26650 @opindex mno-popc
26651 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26652 Population Count instruction. The default is @option{-mpopc}
26653 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26654 later.
26655
26656 @item -msubxc
26657 @itemx -mno-subxc
26658 @opindex msubxc
26659 @opindex mno-subxc
26660 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26661 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26662 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26663 later.
26664
26665 @item -mfix-at697f
26666 @opindex mfix-at697f
26667 Enable the documented workaround for the single erratum of the Atmel AT697F
26668 processor (which corresponds to erratum #13 of the AT697E processor).
26669
26670 @item -mfix-ut699
26671 @opindex mfix-ut699
26672 Enable the documented workarounds for the floating-point errata and the data
26673 cache nullify errata of the UT699 processor.
26674
26675 @item -mfix-ut700
26676 @opindex mfix-ut700
26677 Enable the documented workaround for the back-to-back store errata of
26678 the UT699E/UT700 processor.
26679
26680 @item -mfix-gr712rc
26681 @opindex mfix-gr712rc
26682 Enable the documented workaround for the back-to-back store errata of
26683 the GR712RC processor.
26684 @end table
26685
26686 These @samp{-m} options are supported in addition to the above
26687 on SPARC-V9 processors in 64-bit environments:
26688
26689 @table @gcctabopt
26690 @item -m32
26691 @itemx -m64
26692 @opindex m32
26693 @opindex m64
26694 Generate code for a 32-bit or 64-bit environment.
26695 The 32-bit environment sets int, long and pointer to 32 bits.
26696 The 64-bit environment sets int to 32 bits and long and pointer
26697 to 64 bits.
26698
26699 @item -mcmodel=@var{which}
26700 @opindex mcmodel
26701 Set the code model to one of
26702
26703 @table @samp
26704 @item medlow
26705 The Medium/Low code model: 64-bit addresses, programs
26706 must be linked in the low 32 bits of memory. Programs can be statically
26707 or dynamically linked.
26708
26709 @item medmid
26710 The Medium/Middle code model: 64-bit addresses, programs
26711 must be linked in the low 44 bits of memory, the text and data segments must
26712 be less than 2GB in size and the data segment must be located within 2GB of
26713 the text segment.
26714
26715 @item medany
26716 The Medium/Anywhere code model: 64-bit addresses, programs
26717 may be linked anywhere in memory, the text and data segments must be less
26718 than 2GB in size and the data segment must be located within 2GB of the
26719 text segment.
26720
26721 @item embmedany
26722 The Medium/Anywhere code model for embedded systems:
26723 64-bit addresses, the text and data segments must be less than 2GB in
26724 size, both starting anywhere in memory (determined at link time). The
26725 global register %g4 points to the base of the data segment. Programs
26726 are statically linked and PIC is not supported.
26727 @end table
26728
26729 @item -mmemory-model=@var{mem-model}
26730 @opindex mmemory-model
26731 Set the memory model in force on the processor to one of
26732
26733 @table @samp
26734 @item default
26735 The default memory model for the processor and operating system.
26736
26737 @item rmo
26738 Relaxed Memory Order
26739
26740 @item pso
26741 Partial Store Order
26742
26743 @item tso
26744 Total Store Order
26745
26746 @item sc
26747 Sequential Consistency
26748 @end table
26749
26750 These memory models are formally defined in Appendix D of the SPARC-V9
26751 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26752
26753 @item -mstack-bias
26754 @itemx -mno-stack-bias
26755 @opindex mstack-bias
26756 @opindex mno-stack-bias
26757 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26758 frame pointer if present, are offset by @minus{}2047 which must be added back
26759 when making stack frame references. This is the default in 64-bit mode.
26760 Otherwise, assume no such offset is present.
26761 @end table
26762
26763 @node System V Options
26764 @subsection Options for System V
26765
26766 These additional options are available on System V Release 4 for
26767 compatibility with other compilers on those systems:
26768
26769 @table @gcctabopt
26770 @item -G
26771 @opindex G
26772 Create a shared object.
26773 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26774
26775 @item -Qy
26776 @opindex Qy
26777 Identify the versions of each tool used by the compiler, in a
26778 @code{.ident} assembler directive in the output.
26779
26780 @item -Qn
26781 @opindex Qn
26782 Refrain from adding @code{.ident} directives to the output file (this is
26783 the default).
26784
26785 @item -YP,@var{dirs}
26786 @opindex YP
26787 Search the directories @var{dirs}, and no others, for libraries
26788 specified with @option{-l}.
26789
26790 @item -Ym,@var{dir}
26791 @opindex Ym
26792 Look in the directory @var{dir} to find the M4 preprocessor.
26793 The assembler uses this option.
26794 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26795 @c the generic assembler that comes with Solaris takes just -Ym.
26796 @end table
26797
26798 @node TILE-Gx Options
26799 @subsection TILE-Gx Options
26800 @cindex TILE-Gx options
26801
26802 These @samp{-m} options are supported on the TILE-Gx:
26803
26804 @table @gcctabopt
26805 @item -mcmodel=small
26806 @opindex mcmodel=small
26807 Generate code for the small model. The distance for direct calls is
26808 limited to 500M in either direction. PC-relative addresses are 32
26809 bits. Absolute addresses support the full address range.
26810
26811 @item -mcmodel=large
26812 @opindex mcmodel=large
26813 Generate code for the large model. There is no limitation on call
26814 distance, pc-relative addresses, or absolute addresses.
26815
26816 @item -mcpu=@var{name}
26817 @opindex mcpu
26818 Selects the type of CPU to be targeted. Currently the only supported
26819 type is @samp{tilegx}.
26820
26821 @item -m32
26822 @itemx -m64
26823 @opindex m32
26824 @opindex m64
26825 Generate code for a 32-bit or 64-bit environment. The 32-bit
26826 environment sets int, long, and pointer to 32 bits. The 64-bit
26827 environment sets int to 32 bits and long and pointer to 64 bits.
26828
26829 @item -mbig-endian
26830 @itemx -mlittle-endian
26831 @opindex mbig-endian
26832 @opindex mlittle-endian
26833 Generate code in big/little endian mode, respectively.
26834 @end table
26835
26836 @node TILEPro Options
26837 @subsection TILEPro Options
26838 @cindex TILEPro options
26839
26840 These @samp{-m} options are supported on the TILEPro:
26841
26842 @table @gcctabopt
26843 @item -mcpu=@var{name}
26844 @opindex mcpu
26845 Selects the type of CPU to be targeted. Currently the only supported
26846 type is @samp{tilepro}.
26847
26848 @item -m32
26849 @opindex m32
26850 Generate code for a 32-bit environment, which sets int, long, and
26851 pointer to 32 bits. This is the only supported behavior so the flag
26852 is essentially ignored.
26853 @end table
26854
26855 @node V850 Options
26856 @subsection V850 Options
26857 @cindex V850 Options
26858
26859 These @samp{-m} options are defined for V850 implementations:
26860
26861 @table @gcctabopt
26862 @item -mlong-calls
26863 @itemx -mno-long-calls
26864 @opindex mlong-calls
26865 @opindex mno-long-calls
26866 Treat all calls as being far away (near). If calls are assumed to be
26867 far away, the compiler always loads the function's address into a
26868 register, and calls indirect through the pointer.
26869
26870 @item -mno-ep
26871 @itemx -mep
26872 @opindex mno-ep
26873 @opindex mep
26874 Do not optimize (do optimize) basic blocks that use the same index
26875 pointer 4 or more times to copy pointer into the @code{ep} register, and
26876 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26877 option is on by default if you optimize.
26878
26879 @item -mno-prolog-function
26880 @itemx -mprolog-function
26881 @opindex mno-prolog-function
26882 @opindex mprolog-function
26883 Do not use (do use) external functions to save and restore registers
26884 at the prologue and epilogue of a function. The external functions
26885 are slower, but use less code space if more than one function saves
26886 the same number of registers. The @option{-mprolog-function} option
26887 is on by default if you optimize.
26888
26889 @item -mspace
26890 @opindex mspace
26891 Try to make the code as small as possible. At present, this just turns
26892 on the @option{-mep} and @option{-mprolog-function} options.
26893
26894 @item -mtda=@var{n}
26895 @opindex mtda
26896 Put static or global variables whose size is @var{n} bytes or less into
26897 the tiny data area that register @code{ep} points to. The tiny data
26898 area can hold up to 256 bytes in total (128 bytes for byte references).
26899
26900 @item -msda=@var{n}
26901 @opindex msda
26902 Put static or global variables whose size is @var{n} bytes or less into
26903 the small data area that register @code{gp} points to. The small data
26904 area can hold up to 64 kilobytes.
26905
26906 @item -mzda=@var{n}
26907 @opindex mzda
26908 Put static or global variables whose size is @var{n} bytes or less into
26909 the first 32 kilobytes of memory.
26910
26911 @item -mv850
26912 @opindex mv850
26913 Specify that the target processor is the V850.
26914
26915 @item -mv850e3v5
26916 @opindex mv850e3v5
26917 Specify that the target processor is the V850E3V5. The preprocessor
26918 constant @code{__v850e3v5__} is defined if this option is used.
26919
26920 @item -mv850e2v4
26921 @opindex mv850e2v4
26922 Specify that the target processor is the V850E3V5. This is an alias for
26923 the @option{-mv850e3v5} option.
26924
26925 @item -mv850e2v3
26926 @opindex mv850e2v3
26927 Specify that the target processor is the V850E2V3. The preprocessor
26928 constant @code{__v850e2v3__} is defined if this option is used.
26929
26930 @item -mv850e2
26931 @opindex mv850e2
26932 Specify that the target processor is the V850E2. The preprocessor
26933 constant @code{__v850e2__} is defined if this option is used.
26934
26935 @item -mv850e1
26936 @opindex mv850e1
26937 Specify that the target processor is the V850E1. The preprocessor
26938 constants @code{__v850e1__} and @code{__v850e__} are defined if
26939 this option is used.
26940
26941 @item -mv850es
26942 @opindex mv850es
26943 Specify that the target processor is the V850ES. This is an alias for
26944 the @option{-mv850e1} option.
26945
26946 @item -mv850e
26947 @opindex mv850e
26948 Specify that the target processor is the V850E@. The preprocessor
26949 constant @code{__v850e__} is defined if this option is used.
26950
26951 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26952 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26953 are defined then a default target processor is chosen and the
26954 relevant @samp{__v850*__} preprocessor constant is defined.
26955
26956 The preprocessor constants @code{__v850} and @code{__v851__} are always
26957 defined, regardless of which processor variant is the target.
26958
26959 @item -mdisable-callt
26960 @itemx -mno-disable-callt
26961 @opindex mdisable-callt
26962 @opindex mno-disable-callt
26963 This option suppresses generation of the @code{CALLT} instruction for the
26964 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26965 architecture.
26966
26967 This option is enabled by default when the RH850 ABI is
26968 in use (see @option{-mrh850-abi}), and disabled by default when the
26969 GCC ABI is in use. If @code{CALLT} instructions are being generated
26970 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26971
26972 @item -mrelax
26973 @itemx -mno-relax
26974 @opindex mrelax
26975 @opindex mno-relax
26976 Pass on (or do not pass on) the @option{-mrelax} command-line option
26977 to the assembler.
26978
26979 @item -mlong-jumps
26980 @itemx -mno-long-jumps
26981 @opindex mlong-jumps
26982 @opindex mno-long-jumps
26983 Disable (or re-enable) the generation of PC-relative jump instructions.
26984
26985 @item -msoft-float
26986 @itemx -mhard-float
26987 @opindex msoft-float
26988 @opindex mhard-float
26989 Disable (or re-enable) the generation of hardware floating point
26990 instructions. This option is only significant when the target
26991 architecture is @samp{V850E2V3} or higher. If hardware floating point
26992 instructions are being generated then the C preprocessor symbol
26993 @code{__FPU_OK__} is defined, otherwise the symbol
26994 @code{__NO_FPU__} is defined.
26995
26996 @item -mloop
26997 @opindex mloop
26998 Enables the use of the e3v5 LOOP instruction. The use of this
26999 instruction is not enabled by default when the e3v5 architecture is
27000 selected because its use is still experimental.
27001
27002 @item -mrh850-abi
27003 @itemx -mghs
27004 @opindex mrh850-abi
27005 @opindex mghs
27006 Enables support for the RH850 version of the V850 ABI. This is the
27007 default. With this version of the ABI the following rules apply:
27008
27009 @itemize
27010 @item
27011 Integer sized structures and unions are returned via a memory pointer
27012 rather than a register.
27013
27014 @item
27015 Large structures and unions (more than 8 bytes in size) are passed by
27016 value.
27017
27018 @item
27019 Functions are aligned to 16-bit boundaries.
27020
27021 @item
27022 The @option{-m8byte-align} command-line option is supported.
27023
27024 @item
27025 The @option{-mdisable-callt} command-line option is enabled by
27026 default. The @option{-mno-disable-callt} command-line option is not
27027 supported.
27028 @end itemize
27029
27030 When this version of the ABI is enabled the C preprocessor symbol
27031 @code{__V850_RH850_ABI__} is defined.
27032
27033 @item -mgcc-abi
27034 @opindex mgcc-abi
27035 Enables support for the old GCC version of the V850 ABI. With this
27036 version of the ABI the following rules apply:
27037
27038 @itemize
27039 @item
27040 Integer sized structures and unions are returned in register @code{r10}.
27041
27042 @item
27043 Large structures and unions (more than 8 bytes in size) are passed by
27044 reference.
27045
27046 @item
27047 Functions are aligned to 32-bit boundaries, unless optimizing for
27048 size.
27049
27050 @item
27051 The @option{-m8byte-align} command-line option is not supported.
27052
27053 @item
27054 The @option{-mdisable-callt} command-line option is supported but not
27055 enabled by default.
27056 @end itemize
27057
27058 When this version of the ABI is enabled the C preprocessor symbol
27059 @code{__V850_GCC_ABI__} is defined.
27060
27061 @item -m8byte-align
27062 @itemx -mno-8byte-align
27063 @opindex m8byte-align
27064 @opindex mno-8byte-align
27065 Enables support for @code{double} and @code{long long} types to be
27066 aligned on 8-byte boundaries. The default is to restrict the
27067 alignment of all objects to at most 4-bytes. When
27068 @option{-m8byte-align} is in effect the C preprocessor symbol
27069 @code{__V850_8BYTE_ALIGN__} is defined.
27070
27071 @item -mbig-switch
27072 @opindex mbig-switch
27073 Generate code suitable for big switch tables. Use this option only if
27074 the assembler/linker complain about out of range branches within a switch
27075 table.
27076
27077 @item -mapp-regs
27078 @opindex mapp-regs
27079 This option causes r2 and r5 to be used in the code generated by
27080 the compiler. This setting is the default.
27081
27082 @item -mno-app-regs
27083 @opindex mno-app-regs
27084 This option causes r2 and r5 to be treated as fixed registers.
27085
27086 @end table
27087
27088 @node VAX Options
27089 @subsection VAX Options
27090 @cindex VAX options
27091
27092 These @samp{-m} options are defined for the VAX:
27093
27094 @table @gcctabopt
27095 @item -munix
27096 @opindex munix
27097 Do not output certain jump instructions (@code{aobleq} and so on)
27098 that the Unix assembler for the VAX cannot handle across long
27099 ranges.
27100
27101 @item -mgnu
27102 @opindex mgnu
27103 Do output those jump instructions, on the assumption that the
27104 GNU assembler is being used.
27105
27106 @item -mg
27107 @opindex mg
27108 Output code for G-format floating-point numbers instead of D-format.
27109 @end table
27110
27111 @node Visium Options
27112 @subsection Visium Options
27113 @cindex Visium options
27114
27115 @table @gcctabopt
27116
27117 @item -mdebug
27118 @opindex mdebug
27119 A program which performs file I/O and is destined to run on an MCM target
27120 should be linked with this option. It causes the libraries libc.a and
27121 libdebug.a to be linked. The program should be run on the target under
27122 the control of the GDB remote debugging stub.
27123
27124 @item -msim
27125 @opindex msim
27126 A program which performs file I/O and is destined to run on the simulator
27127 should be linked with option. This causes libraries libc.a and libsim.a to
27128 be linked.
27129
27130 @item -mfpu
27131 @itemx -mhard-float
27132 @opindex mfpu
27133 @opindex mhard-float
27134 Generate code containing floating-point instructions. This is the
27135 default.
27136
27137 @item -mno-fpu
27138 @itemx -msoft-float
27139 @opindex mno-fpu
27140 @opindex msoft-float
27141 Generate code containing library calls for floating-point.
27142
27143 @option{-msoft-float} changes the calling convention in the output file;
27144 therefore, it is only useful if you compile @emph{all} of a program with
27145 this option. In particular, you need to compile @file{libgcc.a}, the
27146 library that comes with GCC, with @option{-msoft-float} in order for
27147 this to work.
27148
27149 @item -mcpu=@var{cpu_type}
27150 @opindex mcpu
27151 Set the instruction set, register set, and instruction scheduling parameters
27152 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27153 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27154
27155 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27156
27157 By default (unless configured otherwise), GCC generates code for the GR5
27158 variant of the Visium architecture.
27159
27160 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27161 architecture. The only difference from GR5 code is that the compiler will
27162 generate block move instructions.
27163
27164 @item -mtune=@var{cpu_type}
27165 @opindex mtune
27166 Set the instruction scheduling parameters for machine type @var{cpu_type},
27167 but do not set the instruction set or register set that the option
27168 @option{-mcpu=@var{cpu_type}} would.
27169
27170 @item -msv-mode
27171 @opindex msv-mode
27172 Generate code for the supervisor mode, where there are no restrictions on
27173 the access to general registers. This is the default.
27174
27175 @item -muser-mode
27176 @opindex muser-mode
27177 Generate code for the user mode, where the access to some general registers
27178 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27179 mode; on the GR6, only registers r29 to r31 are affected.
27180 @end table
27181
27182 @node VMS Options
27183 @subsection VMS Options
27184
27185 These @samp{-m} options are defined for the VMS implementations:
27186
27187 @table @gcctabopt
27188 @item -mvms-return-codes
27189 @opindex mvms-return-codes
27190 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27191 condition (e.g.@: error) codes.
27192
27193 @item -mdebug-main=@var{prefix}
27194 @opindex mdebug-main=@var{prefix}
27195 Flag the first routine whose name starts with @var{prefix} as the main
27196 routine for the debugger.
27197
27198 @item -mmalloc64
27199 @opindex mmalloc64
27200 Default to 64-bit memory allocation routines.
27201
27202 @item -mpointer-size=@var{size}
27203 @opindex mpointer-size=@var{size}
27204 Set the default size of pointers. Possible options for @var{size} are
27205 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27206 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27207 The later option disables @code{pragma pointer_size}.
27208 @end table
27209
27210 @node VxWorks Options
27211 @subsection VxWorks Options
27212 @cindex VxWorks Options
27213
27214 The options in this section are defined for all VxWorks targets.
27215 Options specific to the target hardware are listed with the other
27216 options for that target.
27217
27218 @table @gcctabopt
27219 @item -mrtp
27220 @opindex mrtp
27221 GCC can generate code for both VxWorks kernels and real time processes
27222 (RTPs). This option switches from the former to the latter. It also
27223 defines the preprocessor macro @code{__RTP__}.
27224
27225 @item -non-static
27226 @opindex non-static
27227 Link an RTP executable against shared libraries rather than static
27228 libraries. The options @option{-static} and @option{-shared} can
27229 also be used for RTPs (@pxref{Link Options}); @option{-static}
27230 is the default.
27231
27232 @item -Bstatic
27233 @itemx -Bdynamic
27234 @opindex Bstatic
27235 @opindex Bdynamic
27236 These options are passed down to the linker. They are defined for
27237 compatibility with Diab.
27238
27239 @item -Xbind-lazy
27240 @opindex Xbind-lazy
27241 Enable lazy binding of function calls. This option is equivalent to
27242 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27243
27244 @item -Xbind-now
27245 @opindex Xbind-now
27246 Disable lazy binding of function calls. This option is the default and
27247 is defined for compatibility with Diab.
27248 @end table
27249
27250 @node x86 Options
27251 @subsection x86 Options
27252 @cindex x86 Options
27253
27254 These @samp{-m} options are defined for the x86 family of computers.
27255
27256 @table @gcctabopt
27257
27258 @item -march=@var{cpu-type}
27259 @opindex march
27260 Generate instructions for the machine type @var{cpu-type}. In contrast to
27261 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27262 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27263 to generate code that may not run at all on processors other than the one
27264 indicated. Specifying @option{-march=@var{cpu-type}} implies
27265 @option{-mtune=@var{cpu-type}}.
27266
27267 The choices for @var{cpu-type} are:
27268
27269 @table @samp
27270 @item native
27271 This selects the CPU to generate code for at compilation time by determining
27272 the processor type of the compiling machine. Using @option{-march=native}
27273 enables all instruction subsets supported by the local machine (hence
27274 the result might not run on different machines). Using @option{-mtune=native}
27275 produces code optimized for the local machine under the constraints
27276 of the selected instruction set.
27277
27278 @item x86-64
27279 A generic CPU with 64-bit extensions.
27280
27281 @item i386
27282 Original Intel i386 CPU@.
27283
27284 @item i486
27285 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27286
27287 @item i586
27288 @itemx pentium
27289 Intel Pentium CPU with no MMX support.
27290
27291 @item lakemont
27292 Intel Lakemont MCU, based on Intel Pentium CPU.
27293
27294 @item pentium-mmx
27295 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27296
27297 @item pentiumpro
27298 Intel Pentium Pro CPU@.
27299
27300 @item i686
27301 When used with @option{-march}, the Pentium Pro
27302 instruction set is used, so the code runs on all i686 family chips.
27303 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27304
27305 @item pentium2
27306 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27307 support.
27308
27309 @item pentium3
27310 @itemx pentium3m
27311 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27312 set support.
27313
27314 @item pentium-m
27315 Intel Pentium M; low-power version of Intel Pentium III CPU
27316 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27317
27318 @item pentium4
27319 @itemx pentium4m
27320 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27321
27322 @item prescott
27323 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27324 set support.
27325
27326 @item nocona
27327 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27328 SSE2 and SSE3 instruction set support.
27329
27330 @item core2
27331 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27332 instruction set support.
27333
27334 @item nehalem
27335 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27336 SSE4.1, SSE4.2 and POPCNT instruction set support.
27337
27338 @item westmere
27339 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27340 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27341
27342 @item sandybridge
27343 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27344 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27345
27346 @item ivybridge
27347 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27348 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27349 instruction set support.
27350
27351 @item haswell
27352 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27353 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27354 BMI, BMI2 and F16C instruction set support.
27355
27356 @item broadwell
27357 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27358 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27359 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27360
27361 @item skylake
27362 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27363 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27364 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27365 XSAVES instruction set support.
27366
27367 @item bonnell
27368 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27369 instruction set support.
27370
27371 @item silvermont
27372 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27373 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27374
27375 @item goldmont
27376 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27377 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27378 instruction set support.
27379
27380 @item goldmont-plus
27381 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27382 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27383 PTWRITE, RDPID, SGX and UMIP instruction set support.
27384
27385 @item tremont
27386 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27387 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27388 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27389
27390 @item knl
27391 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27392 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27393 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27394 AVX512CD instruction set support.
27395
27396 @item knm
27397 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27398 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27399 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27400 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27401
27402 @item skylake-avx512
27403 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27404 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27405 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27406 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27407
27408 @item cannonlake
27409 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27410 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27411 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27412 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27413 AVX512IFMA, SHA and UMIP instruction set support.
27414
27415 @item icelake-client
27416 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27417 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27418 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27419 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27420 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27421 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27422
27423 @item icelake-server
27424 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27425 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27426 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27427 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27428 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27429 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27430 set support.
27431
27432 @item cascadelake
27433 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27434 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27435 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27436 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27437
27438 @item cooperlake
27439 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27440 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27441 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27442 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
27443 set support.
27444
27445 @item tigerlake
27446 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27447 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27448 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27449 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
27450 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
27451 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction
27452 set support.
27453
27454 @item k6
27455 AMD K6 CPU with MMX instruction set support.
27456
27457 @item k6-2
27458 @itemx k6-3
27459 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27460
27461 @item athlon
27462 @itemx athlon-tbird
27463 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27464 support.
27465
27466 @item athlon-4
27467 @itemx athlon-xp
27468 @itemx athlon-mp
27469 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27470 instruction set support.
27471
27472 @item k8
27473 @itemx opteron
27474 @itemx athlon64
27475 @itemx athlon-fx
27476 Processors based on the AMD K8 core with x86-64 instruction set support,
27477 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27478 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27479 instruction set extensions.)
27480
27481 @item k8-sse3
27482 @itemx opteron-sse3
27483 @itemx athlon64-sse3
27484 Improved versions of AMD K8 cores with SSE3 instruction set support.
27485
27486 @item amdfam10
27487 @itemx barcelona
27488 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27489 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27490 instruction set extensions.)
27491
27492 @item bdver1
27493 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27494 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27495 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27496 @item bdver2
27497 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27498 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27499 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27500 extensions.)
27501 @item bdver3
27502 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27503 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27504 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27505 64-bit instruction set extensions.
27506 @item bdver4
27507 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27508 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27509 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27510 SSE4.2, ABM and 64-bit instruction set extensions.
27511
27512 @item znver1
27513 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27514 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27515 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27516 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27517 instruction set extensions.
27518 @item znver2
27519 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27520 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27521 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27522 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27523 instruction set extensions.)
27524
27525
27526 @item btver1
27527 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27528 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27529 instruction set extensions.)
27530
27531 @item btver2
27532 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27533 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27534 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27535
27536 @item winchip-c6
27537 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27538 set support.
27539
27540 @item winchip2
27541 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27542 instruction set support.
27543
27544 @item c3
27545 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27546 (No scheduling is implemented for this chip.)
27547
27548 @item c3-2
27549 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27550 (No scheduling is implemented for this chip.)
27551
27552 @item c7
27553 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27554 (No scheduling is implemented for this chip.)
27555
27556 @item samuel-2
27557 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27558 (No scheduling is implemented for this chip.)
27559
27560 @item nehemiah
27561 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27562 (No scheduling is implemented for this chip.)
27563
27564 @item esther
27565 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27566 (No scheduling is implemented for this chip.)
27567
27568 @item eden-x2
27569 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27570 (No scheduling is implemented for this chip.)
27571
27572 @item eden-x4
27573 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27574 AVX and AVX2 instruction set support.
27575 (No scheduling is implemented for this chip.)
27576
27577 @item nano
27578 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27579 instruction set support.
27580 (No scheduling is implemented for this chip.)
27581
27582 @item nano-1000
27583 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27584 instruction set support.
27585 (No scheduling is implemented for this chip.)
27586
27587 @item nano-2000
27588 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27589 instruction set support.
27590 (No scheduling is implemented for this chip.)
27591
27592 @item nano-3000
27593 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27594 instruction set support.
27595 (No scheduling is implemented for this chip.)
27596
27597 @item nano-x2
27598 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27599 instruction set support.
27600 (No scheduling is implemented for this chip.)
27601
27602 @item nano-x4
27603 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27604 instruction set support.
27605 (No scheduling is implemented for this chip.)
27606
27607 @item geode
27608 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27609 @end table
27610
27611 @item -mtune=@var{cpu-type}
27612 @opindex mtune
27613 Tune to @var{cpu-type} everything applicable about the generated code, except
27614 for the ABI and the set of available instructions.
27615 While picking a specific @var{cpu-type} schedules things appropriately
27616 for that particular chip, the compiler does not generate any code that
27617 cannot run on the default machine type unless you use a
27618 @option{-march=@var{cpu-type}} option.
27619 For example, if GCC is configured for i686-pc-linux-gnu
27620 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27621 but still runs on i686 machines.
27622
27623 The choices for @var{cpu-type} are the same as for @option{-march}.
27624 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27625
27626 @table @samp
27627 @item generic
27628 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27629 If you know the CPU on which your code will run, then you should use
27630 the corresponding @option{-mtune} or @option{-march} option instead of
27631 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27632 of your application will have, then you should use this option.
27633
27634 As new processors are deployed in the marketplace, the behavior of this
27635 option will change. Therefore, if you upgrade to a newer version of
27636 GCC, code generation controlled by this option will change to reflect
27637 the processors
27638 that are most common at the time that version of GCC is released.
27639
27640 There is no @option{-march=generic} option because @option{-march}
27641 indicates the instruction set the compiler can use, and there is no
27642 generic instruction set applicable to all processors. In contrast,
27643 @option{-mtune} indicates the processor (or, in this case, collection of
27644 processors) for which the code is optimized.
27645
27646 @item intel
27647 Produce code optimized for the most current Intel processors, which are
27648 Haswell and Silvermont for this version of GCC. If you know the CPU
27649 on which your code will run, then you should use the corresponding
27650 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27651 But, if you want your application performs better on both Haswell and
27652 Silvermont, then you should use this option.
27653
27654 As new Intel processors are deployed in the marketplace, the behavior of
27655 this option will change. Therefore, if you upgrade to a newer version of
27656 GCC, code generation controlled by this option will change to reflect
27657 the most current Intel processors at the time that version of GCC is
27658 released.
27659
27660 There is no @option{-march=intel} option because @option{-march} indicates
27661 the instruction set the compiler can use, and there is no common
27662 instruction set applicable to all processors. In contrast,
27663 @option{-mtune} indicates the processor (or, in this case, collection of
27664 processors) for which the code is optimized.
27665 @end table
27666
27667 @item -mcpu=@var{cpu-type}
27668 @opindex mcpu
27669 A deprecated synonym for @option{-mtune}.
27670
27671 @item -mfpmath=@var{unit}
27672 @opindex mfpmath
27673 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27674 for @var{unit} are:
27675
27676 @table @samp
27677 @item 387
27678 Use the standard 387 floating-point coprocessor present on the majority of chips and
27679 emulated otherwise. Code compiled with this option runs almost everywhere.
27680 The temporary results are computed in 80-bit precision instead of the precision
27681 specified by the type, resulting in slightly different results compared to most
27682 of other chips. See @option{-ffloat-store} for more detailed description.
27683
27684 This is the default choice for non-Darwin x86-32 targets.
27685
27686 @item sse
27687 Use scalar floating-point instructions present in the SSE instruction set.
27688 This instruction set is supported by Pentium III and newer chips,
27689 and in the AMD line
27690 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27691 instruction set supports only single-precision arithmetic, thus the double and
27692 extended-precision arithmetic are still done using 387. A later version, present
27693 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27694 arithmetic too.
27695
27696 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27697 or @option{-msse2} switches to enable SSE extensions and make this option
27698 effective. For the x86-64 compiler, these extensions are enabled by default.
27699
27700 The resulting code should be considerably faster in the majority of cases and avoid
27701 the numerical instability problems of 387 code, but may break some existing
27702 code that expects temporaries to be 80 bits.
27703
27704 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27705 and the default choice for x86-32 targets with the SSE2 instruction set
27706 when @option{-ffast-math} is enabled.
27707
27708 @item sse,387
27709 @itemx sse+387
27710 @itemx both
27711 Attempt to utilize both instruction sets at once. This effectively doubles the
27712 amount of available registers, and on chips with separate execution units for
27713 387 and SSE the execution resources too. Use this option with care, as it is
27714 still experimental, because the GCC register allocator does not model separate
27715 functional units well, resulting in unstable performance.
27716 @end table
27717
27718 @item -masm=@var{dialect}
27719 @opindex masm=@var{dialect}
27720 Output assembly instructions using selected @var{dialect}. Also affects
27721 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27722 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27723 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27724 not support @samp{intel}.
27725
27726 @item -mieee-fp
27727 @itemx -mno-ieee-fp
27728 @opindex mieee-fp
27729 @opindex mno-ieee-fp
27730 Control whether or not the compiler uses IEEE floating-point
27731 comparisons. These correctly handle the case where the result of a
27732 comparison is unordered.
27733
27734 @item -m80387
27735 @itemx -mhard-float
27736 @opindex 80387
27737 @opindex mhard-float
27738 Generate output containing 80387 instructions for floating point.
27739
27740 @item -mno-80387
27741 @itemx -msoft-float
27742 @opindex no-80387
27743 @opindex msoft-float
27744 Generate output containing library calls for floating point.
27745
27746 @strong{Warning:} the requisite libraries are not part of GCC@.
27747 Normally the facilities of the machine's usual C compiler are used, but
27748 this cannot be done directly in cross-compilation. You must make your
27749 own arrangements to provide suitable library functions for
27750 cross-compilation.
27751
27752 On machines where a function returns floating-point results in the 80387
27753 register stack, some floating-point opcodes may be emitted even if
27754 @option{-msoft-float} is used.
27755
27756 @item -mno-fp-ret-in-387
27757 @opindex mno-fp-ret-in-387
27758 @opindex mfp-ret-in-387
27759 Do not use the FPU registers for return values of functions.
27760
27761 The usual calling convention has functions return values of types
27762 @code{float} and @code{double} in an FPU register, even if there
27763 is no FPU@. The idea is that the operating system should emulate
27764 an FPU@.
27765
27766 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27767 in ordinary CPU registers instead.
27768
27769 @item -mno-fancy-math-387
27770 @opindex mno-fancy-math-387
27771 @opindex mfancy-math-387
27772 Some 387 emulators do not support the @code{sin}, @code{cos} and
27773 @code{sqrt} instructions for the 387. Specify this option to avoid
27774 generating those instructions.
27775 This option is overridden when @option{-march}
27776 indicates that the target CPU always has an FPU and so the
27777 instruction does not need emulation. These
27778 instructions are not generated unless you also use the
27779 @option{-funsafe-math-optimizations} switch.
27780
27781 @item -malign-double
27782 @itemx -mno-align-double
27783 @opindex malign-double
27784 @opindex mno-align-double
27785 Control whether GCC aligns @code{double}, @code{long double}, and
27786 @code{long long} variables on a two-word boundary or a one-word
27787 boundary. Aligning @code{double} variables on a two-word boundary
27788 produces code that runs somewhat faster on a Pentium at the
27789 expense of more memory.
27790
27791 On x86-64, @option{-malign-double} is enabled by default.
27792
27793 @strong{Warning:} if you use the @option{-malign-double} switch,
27794 structures containing the above types are aligned differently than
27795 the published application binary interface specifications for the x86-32
27796 and are not binary compatible with structures in code compiled
27797 without that switch.
27798
27799 @item -m96bit-long-double
27800 @itemx -m128bit-long-double
27801 @opindex m96bit-long-double
27802 @opindex m128bit-long-double
27803 These switches control the size of @code{long double} type. The x86-32
27804 application binary interface specifies the size to be 96 bits,
27805 so @option{-m96bit-long-double} is the default in 32-bit mode.
27806
27807 Modern architectures (Pentium and newer) prefer @code{long double}
27808 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27809 conforming to the ABI, this is not possible. So specifying
27810 @option{-m128bit-long-double} aligns @code{long double}
27811 to a 16-byte boundary by padding the @code{long double} with an additional
27812 32-bit zero.
27813
27814 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27815 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27816
27817 Notice that neither of these options enable any extra precision over the x87
27818 standard of 80 bits for a @code{long double}.
27819
27820 @strong{Warning:} if you override the default value for your target ABI, this
27821 changes the size of
27822 structures and arrays containing @code{long double} variables,
27823 as well as modifying the function calling convention for functions taking
27824 @code{long double}. Hence they are not binary-compatible
27825 with code compiled without that switch.
27826
27827 @item -mlong-double-64
27828 @itemx -mlong-double-80
27829 @itemx -mlong-double-128
27830 @opindex mlong-double-64
27831 @opindex mlong-double-80
27832 @opindex mlong-double-128
27833 These switches control the size of @code{long double} type. A size
27834 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27835 type. This is the default for 32-bit Bionic C library. A size
27836 of 128 bits makes the @code{long double} type equivalent to the
27837 @code{__float128} type. This is the default for 64-bit Bionic C library.
27838
27839 @strong{Warning:} if you override the default value for your target ABI, this
27840 changes the size of
27841 structures and arrays containing @code{long double} variables,
27842 as well as modifying the function calling convention for functions taking
27843 @code{long double}. Hence they are not binary-compatible
27844 with code compiled without that switch.
27845
27846 @item -malign-data=@var{type}
27847 @opindex malign-data
27848 Control how GCC aligns variables. Supported values for @var{type} are
27849 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27850 and earlier, @samp{abi} uses alignment value as specified by the
27851 psABI, and @samp{cacheline} uses increased alignment value to match
27852 the cache line size. @samp{compat} is the default.
27853
27854 @item -mlarge-data-threshold=@var{threshold}
27855 @opindex mlarge-data-threshold
27856 When @option{-mcmodel=medium} is specified, data objects larger than
27857 @var{threshold} are placed in the large data section. This value must be the
27858 same across all objects linked into the binary, and defaults to 65535.
27859
27860 @item -mrtd
27861 @opindex mrtd
27862 Use a different function-calling convention, in which functions that
27863 take a fixed number of arguments return with the @code{ret @var{num}}
27864 instruction, which pops their arguments while returning. This saves one
27865 instruction in the caller since there is no need to pop the arguments
27866 there.
27867
27868 You can specify that an individual function is called with this calling
27869 sequence with the function attribute @code{stdcall}. You can also
27870 override the @option{-mrtd} option by using the function attribute
27871 @code{cdecl}. @xref{Function Attributes}.
27872
27873 @strong{Warning:} this calling convention is incompatible with the one
27874 normally used on Unix, so you cannot use it if you need to call
27875 libraries compiled with the Unix compiler.
27876
27877 Also, you must provide function prototypes for all functions that
27878 take variable numbers of arguments (including @code{printf});
27879 otherwise incorrect code is generated for calls to those
27880 functions.
27881
27882 In addition, seriously incorrect code results if you call a
27883 function with too many arguments. (Normally, extra arguments are
27884 harmlessly ignored.)
27885
27886 @item -mregparm=@var{num}
27887 @opindex mregparm
27888 Control how many registers are used to pass integer arguments. By
27889 default, no registers are used to pass arguments, and at most 3
27890 registers can be used. You can control this behavior for a specific
27891 function by using the function attribute @code{regparm}.
27892 @xref{Function Attributes}.
27893
27894 @strong{Warning:} if you use this switch, and
27895 @var{num} is nonzero, then you must build all modules with the same
27896 value, including any libraries. This includes the system libraries and
27897 startup modules.
27898
27899 @item -msseregparm
27900 @opindex msseregparm
27901 Use SSE register passing conventions for float and double arguments
27902 and return values. You can control this behavior for a specific
27903 function by using the function attribute @code{sseregparm}.
27904 @xref{Function Attributes}.
27905
27906 @strong{Warning:} if you use this switch then you must build all
27907 modules with the same value, including any libraries. This includes
27908 the system libraries and startup modules.
27909
27910 @item -mvect8-ret-in-mem
27911 @opindex mvect8-ret-in-mem
27912 Return 8-byte vectors in memory instead of MMX registers. This is the
27913 default on VxWorks to match the ABI of the Sun Studio compilers until
27914 version 12. @emph{Only} use this option if you need to remain
27915 compatible with existing code produced by those previous compiler
27916 versions or older versions of GCC@.
27917
27918 @item -mpc32
27919 @itemx -mpc64
27920 @itemx -mpc80
27921 @opindex mpc32
27922 @opindex mpc64
27923 @opindex mpc80
27924
27925 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27926 is specified, the significands of results of floating-point operations are
27927 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27928 significands of results of floating-point operations to 53 bits (double
27929 precision) and @option{-mpc80} rounds the significands of results of
27930 floating-point operations to 64 bits (extended double precision), which is
27931 the default. When this option is used, floating-point operations in higher
27932 precisions are not available to the programmer without setting the FPU
27933 control word explicitly.
27934
27935 Setting the rounding of floating-point operations to less than the default
27936 80 bits can speed some programs by 2% or more. Note that some mathematical
27937 libraries assume that extended-precision (80-bit) floating-point operations
27938 are enabled by default; routines in such libraries could suffer significant
27939 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27940 when this option is used to set the precision to less than extended precision.
27941
27942 @item -mstackrealign
27943 @opindex mstackrealign
27944 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27945 option generates an alternate prologue and epilogue that realigns the
27946 run-time stack if necessary. This supports mixing legacy codes that keep
27947 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27948 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27949 applicable to individual functions.
27950
27951 @item -mpreferred-stack-boundary=@var{num}
27952 @opindex mpreferred-stack-boundary
27953 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27954 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27955 the default is 4 (16 bytes or 128 bits).
27956
27957 @strong{Warning:} When generating code for the x86-64 architecture with
27958 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27959 used to keep the stack boundary aligned to 8 byte boundary. Since
27960 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27961 intended to be used in controlled environment where stack space is
27962 important limitation. This option leads to wrong code when functions
27963 compiled with 16 byte stack alignment (such as functions from a standard
27964 library) are called with misaligned stack. In this case, SSE
27965 instructions may lead to misaligned memory access traps. In addition,
27966 variable arguments are handled incorrectly for 16 byte aligned
27967 objects (including x87 long double and __int128), leading to wrong
27968 results. You must build all modules with
27969 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27970 includes the system libraries and startup modules.
27971
27972 @item -mincoming-stack-boundary=@var{num}
27973 @opindex mincoming-stack-boundary
27974 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27975 boundary. If @option{-mincoming-stack-boundary} is not specified,
27976 the one specified by @option{-mpreferred-stack-boundary} is used.
27977
27978 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27979 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27980 suffer significant run time performance penalties. On Pentium III, the
27981 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27982 properly if it is not 16-byte aligned.
27983
27984 To ensure proper alignment of this values on the stack, the stack boundary
27985 must be as aligned as that required by any value stored on the stack.
27986 Further, every function must be generated such that it keeps the stack
27987 aligned. Thus calling a function compiled with a higher preferred
27988 stack boundary from a function compiled with a lower preferred stack
27989 boundary most likely misaligns the stack. It is recommended that
27990 libraries that use callbacks always use the default setting.
27991
27992 This extra alignment does consume extra stack space, and generally
27993 increases code size. Code that is sensitive to stack space usage, such
27994 as embedded systems and operating system kernels, may want to reduce the
27995 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27996
27997 @need 200
27998 @item -mmmx
27999 @opindex mmmx
28000 @need 200
28001 @itemx -msse
28002 @opindex msse
28003 @need 200
28004 @itemx -msse2
28005 @opindex msse2
28006 @need 200
28007 @itemx -msse3
28008 @opindex msse3
28009 @need 200
28010 @itemx -mssse3
28011 @opindex mssse3
28012 @need 200
28013 @itemx -msse4
28014 @opindex msse4
28015 @need 200
28016 @itemx -msse4a
28017 @opindex msse4a
28018 @need 200
28019 @itemx -msse4.1
28020 @opindex msse4.1
28021 @need 200
28022 @itemx -msse4.2
28023 @opindex msse4.2
28024 @need 200
28025 @itemx -mavx
28026 @opindex mavx
28027 @need 200
28028 @itemx -mavx2
28029 @opindex mavx2
28030 @need 200
28031 @itemx -mavx512f
28032 @opindex mavx512f
28033 @need 200
28034 @itemx -mavx512pf
28035 @opindex mavx512pf
28036 @need 200
28037 @itemx -mavx512er
28038 @opindex mavx512er
28039 @need 200
28040 @itemx -mavx512cd
28041 @opindex mavx512cd
28042 @need 200
28043 @itemx -mavx512vl
28044 @opindex mavx512vl
28045 @need 200
28046 @itemx -mavx512bw
28047 @opindex mavx512bw
28048 @need 200
28049 @itemx -mavx512dq
28050 @opindex mavx512dq
28051 @need 200
28052 @itemx -mavx512ifma
28053 @opindex mavx512ifma
28054 @need 200
28055 @itemx -mavx512vbmi
28056 @opindex mavx512vbmi
28057 @need 200
28058 @itemx -msha
28059 @opindex msha
28060 @need 200
28061 @itemx -maes
28062 @opindex maes
28063 @need 200
28064 @itemx -mpclmul
28065 @opindex mpclmul
28066 @need 200
28067 @itemx -mclflushopt
28068 @opindex mclflushopt
28069 @need 200
28070 @itemx -mclwb
28071 @opindex mclwb
28072 @need 200
28073 @itemx -mfsgsbase
28074 @opindex mfsgsbase
28075 @need 200
28076 @itemx -mptwrite
28077 @opindex mptwrite
28078 @need 200
28079 @itemx -mrdrnd
28080 @opindex mrdrnd
28081 @need 200
28082 @itemx -mf16c
28083 @opindex mf16c
28084 @need 200
28085 @itemx -mfma
28086 @opindex mfma
28087 @need 200
28088 @itemx -mpconfig
28089 @opindex mpconfig
28090 @need 200
28091 @itemx -mwbnoinvd
28092 @opindex mwbnoinvd
28093 @need 200
28094 @itemx -mfma4
28095 @opindex mfma4
28096 @need 200
28097 @itemx -mprfchw
28098 @opindex mprfchw
28099 @need 200
28100 @itemx -mrdpid
28101 @opindex mrdpid
28102 @need 200
28103 @itemx -mprefetchwt1
28104 @opindex mprefetchwt1
28105 @need 200
28106 @itemx -mrdseed
28107 @opindex mrdseed
28108 @need 200
28109 @itemx -msgx
28110 @opindex msgx
28111 @need 200
28112 @itemx -mxop
28113 @opindex mxop
28114 @need 200
28115 @itemx -mlwp
28116 @opindex mlwp
28117 @need 200
28118 @itemx -m3dnow
28119 @opindex m3dnow
28120 @need 200
28121 @itemx -m3dnowa
28122 @opindex m3dnowa
28123 @need 200
28124 @itemx -mpopcnt
28125 @opindex mpopcnt
28126 @need 200
28127 @itemx -mabm
28128 @opindex mabm
28129 @need 200
28130 @itemx -madx
28131 @opindex madx
28132 @need 200
28133 @itemx -mbmi
28134 @opindex mbmi
28135 @need 200
28136 @itemx -mbmi2
28137 @opindex mbmi2
28138 @need 200
28139 @itemx -mlzcnt
28140 @opindex mlzcnt
28141 @need 200
28142 @itemx -mfxsr
28143 @opindex mfxsr
28144 @need 200
28145 @itemx -mxsave
28146 @opindex mxsave
28147 @need 200
28148 @itemx -mxsaveopt
28149 @opindex mxsaveopt
28150 @need 200
28151 @itemx -mxsavec
28152 @opindex mxsavec
28153 @need 200
28154 @itemx -mxsaves
28155 @opindex mxsaves
28156 @need 200
28157 @itemx -mrtm
28158 @opindex mrtm
28159 @need 200
28160 @itemx -mhle
28161 @opindex mhle
28162 @need 200
28163 @itemx -mtbm
28164 @opindex mtbm
28165 @need 200
28166 @itemx -mmwaitx
28167 @opindex mmwaitx
28168 @need 200
28169 @itemx -mclzero
28170 @opindex mclzero
28171 @need 200
28172 @itemx -mpku
28173 @opindex mpku
28174 @need 200
28175 @itemx -mavx512vbmi2
28176 @opindex mavx512vbmi2
28177 @need 200
28178 @itemx -mavx512bf16
28179 @opindex mavx512bf16
28180 @need 200
28181 @itemx -mgfni
28182 @opindex mgfni
28183 @need 200
28184 @itemx -mvaes
28185 @opindex mvaes
28186 @need 200
28187 @itemx -mwaitpkg
28188 @opindex mwaitpkg
28189 @need 200
28190 @itemx -mvpclmulqdq
28191 @opindex mvpclmulqdq
28192 @need 200
28193 @itemx -mavx512bitalg
28194 @opindex mavx512bitalg
28195 @need 200
28196 @itemx -mmovdiri
28197 @opindex mmovdiri
28198 @need 200
28199 @itemx -mmovdir64b
28200 @opindex mmovdir64b
28201 @need 200
28202 @itemx -menqcmd
28203 @opindex menqcmd
28204 @need 200
28205 @itemx -mavx512vpopcntdq
28206 @opindex mavx512vpopcntdq
28207 @need 200
28208 @itemx -mavx512vp2intersect
28209 @opindex mavx512vp2intersect
28210 @need 200
28211 @itemx -mavx5124fmaps
28212 @opindex mavx5124fmaps
28213 @need 200
28214 @itemx -mavx512vnni
28215 @opindex mavx512vnni
28216 @need 200
28217 @itemx -mavx5124vnniw
28218 @opindex mavx5124vnniw
28219 @need 200
28220 @itemx -mcldemote
28221 @opindex mcldemote
28222 These switches enable the use of instructions in the MMX, SSE,
28223 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28224 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28225 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28226 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28227 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28228 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28229 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28230 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28231 extended instruction sets. Each has a corresponding @option{-mno-} option to
28232 disable use of these instructions.
28233
28234 These extensions are also available as built-in functions: see
28235 @ref{x86 Built-in Functions}, for details of the functions enabled and
28236 disabled by these switches.
28237
28238 To generate SSE/SSE2 instructions automatically from floating-point
28239 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28240
28241 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28242 generates new AVX instructions or AVX equivalence for all SSEx instructions
28243 when needed.
28244
28245 These options enable GCC to use these extended instructions in
28246 generated code, even without @option{-mfpmath=sse}. Applications that
28247 perform run-time CPU detection must compile separate files for each
28248 supported architecture, using the appropriate flags. In particular,
28249 the file containing the CPU detection code should be compiled without
28250 these options.
28251
28252 @item -mdump-tune-features
28253 @opindex mdump-tune-features
28254 This option instructs GCC to dump the names of the x86 performance
28255 tuning features and default settings. The names can be used in
28256 @option{-mtune-ctrl=@var{feature-list}}.
28257
28258 @item -mtune-ctrl=@var{feature-list}
28259 @opindex mtune-ctrl=@var{feature-list}
28260 This option is used to do fine grain control of x86 code generation features.
28261 @var{feature-list} is a comma separated list of @var{feature} names. See also
28262 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28263 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28264 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28265 developers. Using it may lead to code paths not covered by testing and can
28266 potentially result in compiler ICEs or runtime errors.
28267
28268 @item -mno-default
28269 @opindex mno-default
28270 This option instructs GCC to turn off all tunable features. See also
28271 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28272
28273 @item -mcld
28274 @opindex mcld
28275 This option instructs GCC to emit a @code{cld} instruction in the prologue
28276 of functions that use string instructions. String instructions depend on
28277 the DF flag to select between autoincrement or autodecrement mode. While the
28278 ABI specifies the DF flag to be cleared on function entry, some operating
28279 systems violate this specification by not clearing the DF flag in their
28280 exception dispatchers. The exception handler can be invoked with the DF flag
28281 set, which leads to wrong direction mode when string instructions are used.
28282 This option can be enabled by default on 32-bit x86 targets by configuring
28283 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28284 instructions can be suppressed with the @option{-mno-cld} compiler option
28285 in this case.
28286
28287 @item -mvzeroupper
28288 @opindex mvzeroupper
28289 This option instructs GCC to emit a @code{vzeroupper} instruction
28290 before a transfer of control flow out of the function to minimize
28291 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28292 intrinsics.
28293
28294 @item -mprefer-avx128
28295 @opindex mprefer-avx128
28296 This option instructs GCC to use 128-bit AVX instructions instead of
28297 256-bit AVX instructions in the auto-vectorizer.
28298
28299 @item -mprefer-vector-width=@var{opt}
28300 @opindex mprefer-vector-width
28301 This option instructs GCC to use @var{opt}-bit vector width in instructions
28302 instead of default on the selected platform.
28303
28304 @table @samp
28305 @item none
28306 No extra limitations applied to GCC other than defined by the selected platform.
28307
28308 @item 128
28309 Prefer 128-bit vector width for instructions.
28310
28311 @item 256
28312 Prefer 256-bit vector width for instructions.
28313
28314 @item 512
28315 Prefer 512-bit vector width for instructions.
28316 @end table
28317
28318 @item -mcx16
28319 @opindex mcx16
28320 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28321 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28322 objects. This is useful for atomic updates of data structures exceeding one
28323 machine word in size. The compiler uses this instruction to implement
28324 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28325 128-bit integers, a library call is always used.
28326
28327 @item -msahf
28328 @opindex msahf
28329 This option enables generation of @code{SAHF} instructions in 64-bit code.
28330 Early Intel Pentium 4 CPUs with Intel 64 support,
28331 prior to the introduction of Pentium 4 G1 step in December 2005,
28332 lacked the @code{LAHF} and @code{SAHF} instructions
28333 which are supported by AMD64.
28334 These are load and store instructions, respectively, for certain status flags.
28335 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28336 @code{drem}, and @code{remainder} built-in functions;
28337 see @ref{Other Builtins} for details.
28338
28339 @item -mmovbe
28340 @opindex mmovbe
28341 This option enables use of the @code{movbe} instruction to implement
28342 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28343
28344 @item -mshstk
28345 @opindex mshstk
28346 The @option{-mshstk} option enables shadow stack built-in functions
28347 from x86 Control-flow Enforcement Technology (CET).
28348
28349 @item -mcrc32
28350 @opindex mcrc32
28351 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28352 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28353 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28354
28355 @item -mrecip
28356 @opindex mrecip
28357 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28358 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28359 with an additional Newton-Raphson step
28360 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28361 (and their vectorized
28362 variants) for single-precision floating-point arguments. These instructions
28363 are generated only when @option{-funsafe-math-optimizations} is enabled
28364 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28365 Note that while the throughput of the sequence is higher than the throughput
28366 of the non-reciprocal instruction, the precision of the sequence can be
28367 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28368
28369 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28370 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28371 combination), and doesn't need @option{-mrecip}.
28372
28373 Also note that GCC emits the above sequence with additional Newton-Raphson step
28374 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28375 already with @option{-ffast-math} (or the above option combination), and
28376 doesn't need @option{-mrecip}.
28377
28378 @item -mrecip=@var{opt}
28379 @opindex mrecip=opt
28380 This option controls which reciprocal estimate instructions
28381 may be used. @var{opt} is a comma-separated list of options, which may
28382 be preceded by a @samp{!} to invert the option:
28383
28384 @table @samp
28385 @item all
28386 Enable all estimate instructions.
28387
28388 @item default
28389 Enable the default instructions, equivalent to @option{-mrecip}.
28390
28391 @item none
28392 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28393
28394 @item div
28395 Enable the approximation for scalar division.
28396
28397 @item vec-div
28398 Enable the approximation for vectorized division.
28399
28400 @item sqrt
28401 Enable the approximation for scalar square root.
28402
28403 @item vec-sqrt
28404 Enable the approximation for vectorized square root.
28405 @end table
28406
28407 So, for example, @option{-mrecip=all,!sqrt} enables
28408 all of the reciprocal approximations, except for square root.
28409
28410 @item -mveclibabi=@var{type}
28411 @opindex mveclibabi
28412 Specifies the ABI type to use for vectorizing intrinsics using an
28413 external library. Supported values for @var{type} are @samp{svml}
28414 for the Intel short
28415 vector math library and @samp{acml} for the AMD math core library.
28416 To use this option, both @option{-ftree-vectorize} and
28417 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28418 ABI-compatible library must be specified at link time.
28419
28420 GCC currently emits calls to @code{vmldExp2},
28421 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28422 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28423 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28424 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28425 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28426 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28427 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28428 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28429 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28430 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28431 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28432 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28433 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28434 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28435 when @option{-mveclibabi=acml} is used.
28436
28437 @item -mabi=@var{name}
28438 @opindex mabi
28439 Generate code for the specified calling convention. Permissible values
28440 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28441 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28442 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28443 You can control this behavior for specific functions by
28444 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28445 @xref{Function Attributes}.
28446
28447 @item -mforce-indirect-call
28448 @opindex mforce-indirect-call
28449 Force all calls to functions to be indirect. This is useful
28450 when using Intel Processor Trace where it generates more precise timing
28451 information for function calls.
28452
28453 @item -mmanual-endbr
28454 @opindex mmanual-endbr
28455 Insert ENDBR instruction at function entry only via the @code{cf_check}
28456 function attribute. This is useful when used with the option
28457 @option{-fcf-protection=branch} to control ENDBR insertion at the
28458 function entry.
28459
28460 @item -mcall-ms2sysv-xlogues
28461 @opindex mcall-ms2sysv-xlogues
28462 @opindex mno-call-ms2sysv-xlogues
28463 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28464 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28465 default, the code for saving and restoring these registers is emitted inline,
28466 resulting in fairly lengthy prologues and epilogues. Using
28467 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28468 use stubs in the static portion of libgcc to perform these saves and restores,
28469 thus reducing function size at the cost of a few extra instructions.
28470
28471 @item -mtls-dialect=@var{type}
28472 @opindex mtls-dialect
28473 Generate code to access thread-local storage using the @samp{gnu} or
28474 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28475 @samp{gnu2} is more efficient, but it may add compile- and run-time
28476 requirements that cannot be satisfied on all systems.
28477
28478 @item -mpush-args
28479 @itemx -mno-push-args
28480 @opindex mpush-args
28481 @opindex mno-push-args
28482 Use PUSH operations to store outgoing parameters. This method is shorter
28483 and usually equally fast as method using SUB/MOV operations and is enabled
28484 by default. In some cases disabling it may improve performance because of
28485 improved scheduling and reduced dependencies.
28486
28487 @item -maccumulate-outgoing-args
28488 @opindex maccumulate-outgoing-args
28489 If enabled, the maximum amount of space required for outgoing arguments is
28490 computed in the function prologue. This is faster on most modern CPUs
28491 because of reduced dependencies, improved scheduling and reduced stack usage
28492 when the preferred stack boundary is not equal to 2. The drawback is a notable
28493 increase in code size. This switch implies @option{-mno-push-args}.
28494
28495 @item -mthreads
28496 @opindex mthreads
28497 Support thread-safe exception handling on MinGW. Programs that rely
28498 on thread-safe exception handling must compile and link all code with the
28499 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28500 @option{-D_MT}; when linking, it links in a special thread helper library
28501 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28502
28503 @item -mms-bitfields
28504 @itemx -mno-ms-bitfields
28505 @opindex mms-bitfields
28506 @opindex mno-ms-bitfields
28507
28508 Enable/disable bit-field layout compatible with the native Microsoft
28509 Windows compiler.
28510
28511 If @code{packed} is used on a structure, or if bit-fields are used,
28512 it may be that the Microsoft ABI lays out the structure differently
28513 than the way GCC normally does. Particularly when moving packed
28514 data between functions compiled with GCC and the native Microsoft compiler
28515 (either via function call or as data in a file), it may be necessary to access
28516 either format.
28517
28518 This option is enabled by default for Microsoft Windows
28519 targets. This behavior can also be controlled locally by use of variable
28520 or type attributes. For more information, see @ref{x86 Variable Attributes}
28521 and @ref{x86 Type Attributes}.
28522
28523 The Microsoft structure layout algorithm is fairly simple with the exception
28524 of the bit-field packing.
28525 The padding and alignment of members of structures and whether a bit-field
28526 can straddle a storage-unit boundary are determine by these rules:
28527
28528 @enumerate
28529 @item Structure members are stored sequentially in the order in which they are
28530 declared: the first member has the lowest memory address and the last member
28531 the highest.
28532
28533 @item Every data object has an alignment requirement. The alignment requirement
28534 for all data except structures, unions, and arrays is either the size of the
28535 object or the current packing size (specified with either the
28536 @code{aligned} attribute or the @code{pack} pragma),
28537 whichever is less. For structures, unions, and arrays,
28538 the alignment requirement is the largest alignment requirement of its members.
28539 Every object is allocated an offset so that:
28540
28541 @smallexample
28542 offset % alignment_requirement == 0
28543 @end smallexample
28544
28545 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28546 unit if the integral types are the same size and if the next bit-field fits
28547 into the current allocation unit without crossing the boundary imposed by the
28548 common alignment requirements of the bit-fields.
28549 @end enumerate
28550
28551 MSVC interprets zero-length bit-fields in the following ways:
28552
28553 @enumerate
28554 @item If a zero-length bit-field is inserted between two bit-fields that
28555 are normally coalesced, the bit-fields are not coalesced.
28556
28557 For example:
28558
28559 @smallexample
28560 struct
28561 @{
28562 unsigned long bf_1 : 12;
28563 unsigned long : 0;
28564 unsigned long bf_2 : 12;
28565 @} t1;
28566 @end smallexample
28567
28568 @noindent
28569 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28570 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28571
28572 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28573 alignment of the zero-length bit-field is greater than the member that follows it,
28574 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28575
28576 For example:
28577
28578 @smallexample
28579 struct
28580 @{
28581 char foo : 4;
28582 short : 0;
28583 char bar;
28584 @} t2;
28585
28586 struct
28587 @{
28588 char foo : 4;
28589 short : 0;
28590 double bar;
28591 @} t3;
28592 @end smallexample
28593
28594 @noindent
28595 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28596 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28597 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28598 of the structure.
28599
28600 Taking this into account, it is important to note the following:
28601
28602 @enumerate
28603 @item If a zero-length bit-field follows a normal bit-field, the type of the
28604 zero-length bit-field may affect the alignment of the structure as whole. For
28605 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28606 normal bit-field, and is of type short.
28607
28608 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28609 still affect the alignment of the structure:
28610
28611 @smallexample
28612 struct
28613 @{
28614 char foo : 6;
28615 long : 0;
28616 @} t4;
28617 @end smallexample
28618
28619 @noindent
28620 Here, @code{t4} takes up 4 bytes.
28621 @end enumerate
28622
28623 @item Zero-length bit-fields following non-bit-field members are ignored:
28624
28625 @smallexample
28626 struct
28627 @{
28628 char foo;
28629 long : 0;
28630 char bar;
28631 @} t5;
28632 @end smallexample
28633
28634 @noindent
28635 Here, @code{t5} takes up 2 bytes.
28636 @end enumerate
28637
28638
28639 @item -mno-align-stringops
28640 @opindex mno-align-stringops
28641 @opindex malign-stringops
28642 Do not align the destination of inlined string operations. This switch reduces
28643 code size and improves performance in case the destination is already aligned,
28644 but GCC doesn't know about it.
28645
28646 @item -minline-all-stringops
28647 @opindex minline-all-stringops
28648 By default GCC inlines string operations only when the destination is
28649 known to be aligned to least a 4-byte boundary.
28650 This enables more inlining and increases code
28651 size, but may improve performance of code that depends on fast
28652 @code{memcpy} and @code{memset} for short lengths.
28653 The option enables inline expansion of @code{strlen} for all
28654 pointer alignments.
28655
28656 @item -minline-stringops-dynamically
28657 @opindex minline-stringops-dynamically
28658 For string operations of unknown size, use run-time checks with
28659 inline code for small blocks and a library call for large blocks.
28660
28661 @item -mstringop-strategy=@var{alg}
28662 @opindex mstringop-strategy=@var{alg}
28663 Override the internal decision heuristic for the particular algorithm to use
28664 for inlining string operations. The allowed values for @var{alg} are:
28665
28666 @table @samp
28667 @item rep_byte
28668 @itemx rep_4byte
28669 @itemx rep_8byte
28670 Expand using i386 @code{rep} prefix of the specified size.
28671
28672 @item byte_loop
28673 @itemx loop
28674 @itemx unrolled_loop
28675 Expand into an inline loop.
28676
28677 @item libcall
28678 Always use a library call.
28679 @end table
28680
28681 @item -mmemcpy-strategy=@var{strategy}
28682 @opindex mmemcpy-strategy=@var{strategy}
28683 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28684 should be inlined and what inline algorithm to use when the expected size
28685 of the copy operation is known. @var{strategy}
28686 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28687 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28688 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28689 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28690 in the list must be specified in increasing order. The minimal byte size for
28691 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28692 preceding range.
28693
28694 @item -mmemset-strategy=@var{strategy}
28695 @opindex mmemset-strategy=@var{strategy}
28696 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28697 @code{__builtin_memset} expansion.
28698
28699 @item -momit-leaf-frame-pointer
28700 @opindex momit-leaf-frame-pointer
28701 Don't keep the frame pointer in a register for leaf functions. This
28702 avoids the instructions to save, set up, and restore frame pointers and
28703 makes an extra register available in leaf functions. The option
28704 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28705 which might make debugging harder.
28706
28707 @item -mtls-direct-seg-refs
28708 @itemx -mno-tls-direct-seg-refs
28709 @opindex mtls-direct-seg-refs
28710 Controls whether TLS variables may be accessed with offsets from the
28711 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28712 or whether the thread base pointer must be added. Whether or not this
28713 is valid depends on the operating system, and whether it maps the
28714 segment to cover the entire TLS area.
28715
28716 For systems that use the GNU C Library, the default is on.
28717
28718 @item -msse2avx
28719 @itemx -mno-sse2avx
28720 @opindex msse2avx
28721 Specify that the assembler should encode SSE instructions with VEX
28722 prefix. The option @option{-mavx} turns this on by default.
28723
28724 @item -mfentry
28725 @itemx -mno-fentry
28726 @opindex mfentry
28727 If profiling is active (@option{-pg}), put the profiling
28728 counter call before the prologue.
28729 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28730 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28731
28732 @item -mrecord-mcount
28733 @itemx -mno-record-mcount
28734 @opindex mrecord-mcount
28735 If profiling is active (@option{-pg}), generate a __mcount_loc section
28736 that contains pointers to each profiling call. This is useful for
28737 automatically patching and out calls.
28738
28739 @item -mnop-mcount
28740 @itemx -mno-nop-mcount
28741 @opindex mnop-mcount
28742 If profiling is active (@option{-pg}), generate the calls to
28743 the profiling functions as NOPs. This is useful when they
28744 should be patched in later dynamically. This is likely only
28745 useful together with @option{-mrecord-mcount}.
28746
28747 @item -minstrument-return=@var{type}
28748 @opindex minstrument-return
28749 Instrument function exit in -pg -mfentry instrumented functions with
28750 call to specified function. This only instruments true returns ending
28751 with ret, but not sibling calls ending with jump. Valid types
28752 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28753 or @var{nop5} to generate a 5 byte nop.
28754
28755 @item -mrecord-return
28756 @itemx -mno-record-return
28757 @opindex mrecord-return
28758 Generate a __return_loc section pointing to all return instrumentation code.
28759
28760 @item -mfentry-name=@var{name}
28761 @opindex mfentry-name
28762 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28763
28764 @item -mfentry-section=@var{name}
28765 @opindex mfentry-section
28766 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28767
28768 @item -mskip-rax-setup
28769 @itemx -mno-skip-rax-setup
28770 @opindex mskip-rax-setup
28771 When generating code for the x86-64 architecture with SSE extensions
28772 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28773 register when there are no variable arguments passed in vector registers.
28774
28775 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28776 saving vector registers on stack when passing variable arguments, the
28777 impacts of this option are callees may waste some stack space,
28778 misbehave or jump to a random location. GCC 4.4 or newer don't have
28779 those issues, regardless the RAX register value.
28780
28781 @item -m8bit-idiv
28782 @itemx -mno-8bit-idiv
28783 @opindex m8bit-idiv
28784 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28785 much faster than 32-bit/64-bit integer divide. This option generates a
28786 run-time check. If both dividend and divisor are within range of 0
28787 to 255, 8-bit unsigned integer divide is used instead of
28788 32-bit/64-bit integer divide.
28789
28790 @item -mavx256-split-unaligned-load
28791 @itemx -mavx256-split-unaligned-store
28792 @opindex mavx256-split-unaligned-load
28793 @opindex mavx256-split-unaligned-store
28794 Split 32-byte AVX unaligned load and store.
28795
28796 @item -mstack-protector-guard=@var{guard}
28797 @itemx -mstack-protector-guard-reg=@var{reg}
28798 @itemx -mstack-protector-guard-offset=@var{offset}
28799 @opindex mstack-protector-guard
28800 @opindex mstack-protector-guard-reg
28801 @opindex mstack-protector-guard-offset
28802 Generate stack protection code using canary at @var{guard}. Supported
28803 locations are @samp{global} for global canary or @samp{tls} for per-thread
28804 canary in the TLS block (the default). This option has effect only when
28805 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28806
28807 With the latter choice the options
28808 @option{-mstack-protector-guard-reg=@var{reg}} and
28809 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28810 which segment register (@code{%fs} or @code{%gs}) to use as base register
28811 for reading the canary, and from what offset from that base register.
28812 The default for those is as specified in the relevant ABI.
28813
28814 @item -mgeneral-regs-only
28815 @opindex mgeneral-regs-only
28816 Generate code that uses only the general-purpose registers. This
28817 prevents the compiler from using floating-point, vector, mask and bound
28818 registers.
28819
28820 @item -mindirect-branch=@var{choice}
28821 @opindex mindirect-branch
28822 Convert indirect call and jump with @var{choice}. The default is
28823 @samp{keep}, which keeps indirect call and jump unmodified.
28824 @samp{thunk} converts indirect call and jump to call and return thunk.
28825 @samp{thunk-inline} converts indirect call and jump to inlined call
28826 and return thunk. @samp{thunk-extern} converts indirect call and jump
28827 to external call and return thunk provided in a separate object file.
28828 You can control this behavior for a specific function by using the
28829 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28830
28831 Note that @option{-mcmodel=large} is incompatible with
28832 @option{-mindirect-branch=thunk} and
28833 @option{-mindirect-branch=thunk-extern} since the thunk function may
28834 not be reachable in the large code model.
28835
28836 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28837 @option{-fcf-protection=branch} since the external thunk cannot be modified
28838 to disable control-flow check.
28839
28840 @item -mfunction-return=@var{choice}
28841 @opindex mfunction-return
28842 Convert function return with @var{choice}. The default is @samp{keep},
28843 which keeps function return unmodified. @samp{thunk} converts function
28844 return to call and return thunk. @samp{thunk-inline} converts function
28845 return to inlined call and return thunk. @samp{thunk-extern} converts
28846 function return to external call and return thunk provided in a separate
28847 object file. You can control this behavior for a specific function by
28848 using the function attribute @code{function_return}.
28849 @xref{Function Attributes}.
28850
28851 Note that @option{-mcmodel=large} is incompatible with
28852 @option{-mfunction-return=thunk} and
28853 @option{-mfunction-return=thunk-extern} since the thunk function may
28854 not be reachable in the large code model.
28855
28856
28857 @item -mindirect-branch-register
28858 @opindex mindirect-branch-register
28859 Force indirect call and jump via register.
28860
28861 @end table
28862
28863 These @samp{-m} switches are supported in addition to the above
28864 on x86-64 processors in 64-bit environments.
28865
28866 @table @gcctabopt
28867 @item -m32
28868 @itemx -m64
28869 @itemx -mx32
28870 @itemx -m16
28871 @itemx -miamcu
28872 @opindex m32
28873 @opindex m64
28874 @opindex mx32
28875 @opindex m16
28876 @opindex miamcu
28877 Generate code for a 16-bit, 32-bit or 64-bit environment.
28878 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28879 to 32 bits, and
28880 generates code that runs on any i386 system.
28881
28882 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28883 types to 64 bits, and generates code for the x86-64 architecture.
28884 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28885 and @option{-mdynamic-no-pic} options.
28886
28887 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28888 to 32 bits, and
28889 generates code for the x86-64 architecture.
28890
28891 The @option{-m16} option is the same as @option{-m32}, except for that
28892 it outputs the @code{.code16gcc} assembly directive at the beginning of
28893 the assembly output so that the binary can run in 16-bit mode.
28894
28895 The @option{-miamcu} option generates code which conforms to Intel MCU
28896 psABI. It requires the @option{-m32} option to be turned on.
28897
28898 @item -mno-red-zone
28899 @opindex mno-red-zone
28900 @opindex mred-zone
28901 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28902 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28903 stack pointer that is not modified by signal or interrupt handlers
28904 and therefore can be used for temporary data without adjusting the stack
28905 pointer. The flag @option{-mno-red-zone} disables this red zone.
28906
28907 @item -mcmodel=small
28908 @opindex mcmodel=small
28909 Generate code for the small code model: the program and its symbols must
28910 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28911 Programs can be statically or dynamically linked. This is the default
28912 code model.
28913
28914 @item -mcmodel=kernel
28915 @opindex mcmodel=kernel
28916 Generate code for the kernel code model. The kernel runs in the
28917 negative 2 GB of the address space.
28918 This model has to be used for Linux kernel code.
28919
28920 @item -mcmodel=medium
28921 @opindex mcmodel=medium
28922 Generate code for the medium model: the program is linked in the lower 2
28923 GB of the address space. Small symbols are also placed there. Symbols
28924 with sizes larger than @option{-mlarge-data-threshold} are put into
28925 large data or BSS sections and can be located above 2GB. Programs can
28926 be statically or dynamically linked.
28927
28928 @item -mcmodel=large
28929 @opindex mcmodel=large
28930 Generate code for the large model. This model makes no assumptions
28931 about addresses and sizes of sections.
28932
28933 @item -maddress-mode=long
28934 @opindex maddress-mode=long
28935 Generate code for long address mode. This is only supported for 64-bit
28936 and x32 environments. It is the default address mode for 64-bit
28937 environments.
28938
28939 @item -maddress-mode=short
28940 @opindex maddress-mode=short
28941 Generate code for short address mode. This is only supported for 32-bit
28942 and x32 environments. It is the default address mode for 32-bit and
28943 x32 environments.
28944 @end table
28945
28946 @node x86 Windows Options
28947 @subsection x86 Windows Options
28948 @cindex x86 Windows Options
28949 @cindex Windows Options for x86
28950
28951 These additional options are available for Microsoft Windows targets:
28952
28953 @table @gcctabopt
28954 @item -mconsole
28955 @opindex mconsole
28956 This option
28957 specifies that a console application is to be generated, by
28958 instructing the linker to set the PE header subsystem type
28959 required for console applications.
28960 This option is available for Cygwin and MinGW targets and is
28961 enabled by default on those targets.
28962
28963 @item -mdll
28964 @opindex mdll
28965 This option is available for Cygwin and MinGW targets. It
28966 specifies that a DLL---a dynamic link library---is to be
28967 generated, enabling the selection of the required runtime
28968 startup object and entry point.
28969
28970 @item -mnop-fun-dllimport
28971 @opindex mnop-fun-dllimport
28972 This option is available for Cygwin and MinGW targets. It
28973 specifies that the @code{dllimport} attribute should be ignored.
28974
28975 @item -mthread
28976 @opindex mthread
28977 This option is available for MinGW targets. It specifies
28978 that MinGW-specific thread support is to be used.
28979
28980 @item -municode
28981 @opindex municode
28982 This option is available for MinGW-w64 targets. It causes
28983 the @code{UNICODE} preprocessor macro to be predefined, and
28984 chooses Unicode-capable runtime startup code.
28985
28986 @item -mwin32
28987 @opindex mwin32
28988 This option is available for Cygwin and MinGW targets. It
28989 specifies that the typical Microsoft Windows predefined macros are to
28990 be set in the pre-processor, but does not influence the choice
28991 of runtime library/startup code.
28992
28993 @item -mwindows
28994 @opindex mwindows
28995 This option is available for Cygwin and MinGW targets. It
28996 specifies that a GUI application is to be generated by
28997 instructing the linker to set the PE header subsystem type
28998 appropriately.
28999
29000 @item -fno-set-stack-executable
29001 @opindex fno-set-stack-executable
29002 @opindex fset-stack-executable
29003 This option is available for MinGW targets. It specifies that
29004 the executable flag for the stack used by nested functions isn't
29005 set. This is necessary for binaries running in kernel mode of
29006 Microsoft Windows, as there the User32 API, which is used to set executable
29007 privileges, isn't available.
29008
29009 @item -fwritable-relocated-rdata
29010 @opindex fno-writable-relocated-rdata
29011 @opindex fwritable-relocated-rdata
29012 This option is available for MinGW and Cygwin targets. It specifies
29013 that relocated-data in read-only section is put into the @code{.data}
29014 section. This is a necessary for older runtimes not supporting
29015 modification of @code{.rdata} sections for pseudo-relocation.
29016
29017 @item -mpe-aligned-commons
29018 @opindex mpe-aligned-commons
29019 This option is available for Cygwin and MinGW targets. It
29020 specifies that the GNU extension to the PE file format that
29021 permits the correct alignment of COMMON variables should be
29022 used when generating code. It is enabled by default if
29023 GCC detects that the target assembler found during configuration
29024 supports the feature.
29025 @end table
29026
29027 See also under @ref{x86 Options} for standard options.
29028
29029 @node Xstormy16 Options
29030 @subsection Xstormy16 Options
29031 @cindex Xstormy16 Options
29032
29033 These options are defined for Xstormy16:
29034
29035 @table @gcctabopt
29036 @item -msim
29037 @opindex msim
29038 Choose startup files and linker script suitable for the simulator.
29039 @end table
29040
29041 @node Xtensa Options
29042 @subsection Xtensa Options
29043 @cindex Xtensa Options
29044
29045 These options are supported for Xtensa targets:
29046
29047 @table @gcctabopt
29048 @item -mconst16
29049 @itemx -mno-const16
29050 @opindex mconst16
29051 @opindex mno-const16
29052 Enable or disable use of @code{CONST16} instructions for loading
29053 constant values. The @code{CONST16} instruction is currently not a
29054 standard option from Tensilica. When enabled, @code{CONST16}
29055 instructions are always used in place of the standard @code{L32R}
29056 instructions. The use of @code{CONST16} is enabled by default only if
29057 the @code{L32R} instruction is not available.
29058
29059 @item -mfused-madd
29060 @itemx -mno-fused-madd
29061 @opindex mfused-madd
29062 @opindex mno-fused-madd
29063 Enable or disable use of fused multiply/add and multiply/subtract
29064 instructions in the floating-point option. This has no effect if the
29065 floating-point option is not also enabled. Disabling fused multiply/add
29066 and multiply/subtract instructions forces the compiler to use separate
29067 instructions for the multiply and add/subtract operations. This may be
29068 desirable in some cases where strict IEEE 754-compliant results are
29069 required: the fused multiply add/subtract instructions do not round the
29070 intermediate result, thereby producing results with @emph{more} bits of
29071 precision than specified by the IEEE standard. Disabling fused multiply
29072 add/subtract instructions also ensures that the program output is not
29073 sensitive to the compiler's ability to combine multiply and add/subtract
29074 operations.
29075
29076 @item -mserialize-volatile
29077 @itemx -mno-serialize-volatile
29078 @opindex mserialize-volatile
29079 @opindex mno-serialize-volatile
29080 When this option is enabled, GCC inserts @code{MEMW} instructions before
29081 @code{volatile} memory references to guarantee sequential consistency.
29082 The default is @option{-mserialize-volatile}. Use
29083 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29084
29085 @item -mforce-no-pic
29086 @opindex mforce-no-pic
29087 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29088 position-independent code (PIC), this option disables PIC for compiling
29089 kernel code.
29090
29091 @item -mtext-section-literals
29092 @itemx -mno-text-section-literals
29093 @opindex mtext-section-literals
29094 @opindex mno-text-section-literals
29095 These options control the treatment of literal pools. The default is
29096 @option{-mno-text-section-literals}, which places literals in a separate
29097 section in the output file. This allows the literal pool to be placed
29098 in a data RAM/ROM, and it also allows the linker to combine literal
29099 pools from separate object files to remove redundant literals and
29100 improve code size. With @option{-mtext-section-literals}, the literals
29101 are interspersed in the text section in order to keep them as close as
29102 possible to their references. This may be necessary for large assembly
29103 files. Literals for each function are placed right before that function.
29104
29105 @item -mauto-litpools
29106 @itemx -mno-auto-litpools
29107 @opindex mauto-litpools
29108 @opindex mno-auto-litpools
29109 These options control the treatment of literal pools. The default is
29110 @option{-mno-auto-litpools}, which places literals in a separate
29111 section in the output file unless @option{-mtext-section-literals} is
29112 used. With @option{-mauto-litpools} the literals are interspersed in
29113 the text section by the assembler. Compiler does not produce explicit
29114 @code{.literal} directives and loads literals into registers with
29115 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29116 do relaxation and place literals as necessary. This option allows
29117 assembler to create several literal pools per function and assemble
29118 very big functions, which may not be possible with
29119 @option{-mtext-section-literals}.
29120
29121 @item -mtarget-align
29122 @itemx -mno-target-align
29123 @opindex mtarget-align
29124 @opindex mno-target-align
29125 When this option is enabled, GCC instructs the assembler to
29126 automatically align instructions to reduce branch penalties at the
29127 expense of some code density. The assembler attempts to widen density
29128 instructions to align branch targets and the instructions following call
29129 instructions. If there are not enough preceding safe density
29130 instructions to align a target, no widening is performed. The
29131 default is @option{-mtarget-align}. These options do not affect the
29132 treatment of auto-aligned instructions like @code{LOOP}, which the
29133 assembler always aligns, either by widening density instructions or
29134 by inserting NOP instructions.
29135
29136 @item -mlongcalls
29137 @itemx -mno-longcalls
29138 @opindex mlongcalls
29139 @opindex mno-longcalls
29140 When this option is enabled, GCC instructs the assembler to translate
29141 direct calls to indirect calls unless it can determine that the target
29142 of a direct call is in the range allowed by the call instruction. This
29143 translation typically occurs for calls to functions in other source
29144 files. Specifically, the assembler translates a direct @code{CALL}
29145 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29146 The default is @option{-mno-longcalls}. This option should be used in
29147 programs where the call target can potentially be out of range. This
29148 option is implemented in the assembler, not the compiler, so the
29149 assembly code generated by GCC still shows direct call
29150 instructions---look at the disassembled object code to see the actual
29151 instructions. Note that the assembler uses an indirect call for
29152 every cross-file call, not just those that really are out of range.
29153 @end table
29154
29155 @node zSeries Options
29156 @subsection zSeries Options
29157 @cindex zSeries options
29158
29159 These are listed under @xref{S/390 and zSeries Options}.
29160
29161
29162 @c man end
29163
29164 @node Spec Files
29165 @section Specifying Subprocesses and the Switches to Pass to Them
29166 @cindex Spec Files
29167
29168 @command{gcc} is a driver program. It performs its job by invoking a
29169 sequence of other programs to do the work of compiling, assembling and
29170 linking. GCC interprets its command-line parameters and uses these to
29171 deduce which programs it should invoke, and which command-line options
29172 it ought to place on their command lines. This behavior is controlled
29173 by @dfn{spec strings}. In most cases there is one spec string for each
29174 program that GCC can invoke, but a few programs have multiple spec
29175 strings to control their behavior. The spec strings built into GCC can
29176 be overridden by using the @option{-specs=} command-line switch to specify
29177 a spec file.
29178
29179 @dfn{Spec files} are plain-text files that are used to construct spec
29180 strings. They consist of a sequence of directives separated by blank
29181 lines. The type of directive is determined by the first non-whitespace
29182 character on the line, which can be one of the following:
29183
29184 @table @code
29185 @item %@var{command}
29186 Issues a @var{command} to the spec file processor. The commands that can
29187 appear here are:
29188
29189 @table @code
29190 @item %include <@var{file}>
29191 @cindex @code{%include}
29192 Search for @var{file} and insert its text at the current point in the
29193 specs file.
29194
29195 @item %include_noerr <@var{file}>
29196 @cindex @code{%include_noerr}
29197 Just like @samp{%include}, but do not generate an error message if the include
29198 file cannot be found.
29199
29200 @item %rename @var{old_name} @var{new_name}
29201 @cindex @code{%rename}
29202 Rename the spec string @var{old_name} to @var{new_name}.
29203
29204 @end table
29205
29206 @item *[@var{spec_name}]:
29207 This tells the compiler to create, override or delete the named spec
29208 string. All lines after this directive up to the next directive or
29209 blank line are considered to be the text for the spec string. If this
29210 results in an empty string then the spec is deleted. (Or, if the
29211 spec did not exist, then nothing happens.) Otherwise, if the spec
29212 does not currently exist a new spec is created. If the spec does
29213 exist then its contents are overridden by the text of this
29214 directive, unless the first character of that text is the @samp{+}
29215 character, in which case the text is appended to the spec.
29216
29217 @item [@var{suffix}]:
29218 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29219 and up to the next directive or blank line are considered to make up the
29220 spec string for the indicated suffix. When the compiler encounters an
29221 input file with the named suffix, it processes the spec string in
29222 order to work out how to compile that file. For example:
29223
29224 @smallexample
29225 .ZZ:
29226 z-compile -input %i
29227 @end smallexample
29228
29229 This says that any input file whose name ends in @samp{.ZZ} should be
29230 passed to the program @samp{z-compile}, which should be invoked with the
29231 command-line switch @option{-input} and with the result of performing the
29232 @samp{%i} substitution. (See below.)
29233
29234 As an alternative to providing a spec string, the text following a
29235 suffix directive can be one of the following:
29236
29237 @table @code
29238 @item @@@var{language}
29239 This says that the suffix is an alias for a known @var{language}. This is
29240 similar to using the @option{-x} command-line switch to GCC to specify a
29241 language explicitly. For example:
29242
29243 @smallexample
29244 .ZZ:
29245 @@c++
29246 @end smallexample
29247
29248 Says that .ZZ files are, in fact, C++ source files.
29249
29250 @item #@var{name}
29251 This causes an error messages saying:
29252
29253 @smallexample
29254 @var{name} compiler not installed on this system.
29255 @end smallexample
29256 @end table
29257
29258 GCC already has an extensive list of suffixes built into it.
29259 This directive adds an entry to the end of the list of suffixes, but
29260 since the list is searched from the end backwards, it is effectively
29261 possible to override earlier entries using this technique.
29262
29263 @end table
29264
29265 GCC has the following spec strings built into it. Spec files can
29266 override these strings or create their own. Note that individual
29267 targets can also add their own spec strings to this list.
29268
29269 @smallexample
29270 asm Options to pass to the assembler
29271 asm_final Options to pass to the assembler post-processor
29272 cpp Options to pass to the C preprocessor
29273 cc1 Options to pass to the C compiler
29274 cc1plus Options to pass to the C++ compiler
29275 endfile Object files to include at the end of the link
29276 link Options to pass to the linker
29277 lib Libraries to include on the command line to the linker
29278 libgcc Decides which GCC support library to pass to the linker
29279 linker Sets the name of the linker
29280 predefines Defines to be passed to the C preprocessor
29281 signed_char Defines to pass to CPP to say whether @code{char} is signed
29282 by default
29283 startfile Object files to include at the start of the link
29284 @end smallexample
29285
29286 Here is a small example of a spec file:
29287
29288 @smallexample
29289 %rename lib old_lib
29290
29291 *lib:
29292 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29293 @end smallexample
29294
29295 This example renames the spec called @samp{lib} to @samp{old_lib} and
29296 then overrides the previous definition of @samp{lib} with a new one.
29297 The new definition adds in some extra command-line options before
29298 including the text of the old definition.
29299
29300 @dfn{Spec strings} are a list of command-line options to be passed to their
29301 corresponding program. In addition, the spec strings can contain
29302 @samp{%}-prefixed sequences to substitute variable text or to
29303 conditionally insert text into the command line. Using these constructs
29304 it is possible to generate quite complex command lines.
29305
29306 Here is a table of all defined @samp{%}-sequences for spec
29307 strings. Note that spaces are not generated automatically around the
29308 results of expanding these sequences. Therefore you can concatenate them
29309 together or combine them with constant text in a single argument.
29310
29311 @table @code
29312 @item %%
29313 Substitute one @samp{%} into the program name or argument.
29314
29315 @item %i
29316 Substitute the name of the input file being processed.
29317
29318 @item %b
29319 Substitute the basename of the input file being processed.
29320 This is the substring up to (and not including) the last period
29321 and not including the directory.
29322
29323 @item %B
29324 This is the same as @samp{%b}, but include the file suffix (text after
29325 the last period).
29326
29327 @item %d
29328 Marks the argument containing or following the @samp{%d} as a
29329 temporary file name, so that that file is deleted if GCC exits
29330 successfully. Unlike @samp{%g}, this contributes no text to the
29331 argument.
29332
29333 @item %g@var{suffix}
29334 Substitute a file name that has suffix @var{suffix} and is chosen
29335 once per compilation, and mark the argument in the same way as
29336 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29337 name is now chosen in a way that is hard to predict even when previously
29338 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29339 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29340 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29341 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29342 was simply substituted with a file name chosen once per compilation,
29343 without regard to any appended suffix (which was therefore treated
29344 just like ordinary text), making such attacks more likely to succeed.
29345
29346 @item %u@var{suffix}
29347 Like @samp{%g}, but generates a new temporary file name
29348 each time it appears instead of once per compilation.
29349
29350 @item %U@var{suffix}
29351 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29352 new one if there is no such last file name. In the absence of any
29353 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29354 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29355 involves the generation of two distinct file names, one
29356 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29357 simply substituted with a file name chosen for the previous @samp{%u},
29358 without regard to any appended suffix.
29359
29360 @item %j@var{suffix}
29361 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29362 writable, and if @option{-save-temps} is not used;
29363 otherwise, substitute the name
29364 of a temporary file, just like @samp{%u}. This temporary file is not
29365 meant for communication between processes, but rather as a junk
29366 disposal mechanism.
29367
29368 @item %|@var{suffix}
29369 @itemx %m@var{suffix}
29370 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29371 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29372 all. These are the two most common ways to instruct a program that it
29373 should read from standard input or write to standard output. If you
29374 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29375 construct: see for example @file{gcc/fortran/lang-specs.h}.
29376
29377 @item %.@var{SUFFIX}
29378 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29379 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29380 terminated by the next space or %.
29381
29382 @item %w
29383 Marks the argument containing or following the @samp{%w} as the
29384 designated output file of this compilation. This puts the argument
29385 into the sequence of arguments that @samp{%o} substitutes.
29386
29387 @item %o
29388 Substitutes the names of all the output files, with spaces
29389 automatically placed around them. You should write spaces
29390 around the @samp{%o} as well or the results are undefined.
29391 @samp{%o} is for use in the specs for running the linker.
29392 Input files whose names have no recognized suffix are not compiled
29393 at all, but they are included among the output files, so they are
29394 linked.
29395
29396 @item %O
29397 Substitutes the suffix for object files. Note that this is
29398 handled specially when it immediately follows @samp{%g, %u, or %U},
29399 because of the need for those to form complete file names. The
29400 handling is such that @samp{%O} is treated exactly as if it had already
29401 been substituted, except that @samp{%g, %u, and %U} do not currently
29402 support additional @var{suffix} characters following @samp{%O} as they do
29403 following, for example, @samp{.o}.
29404
29405 @item %p
29406 Substitutes the standard macro predefinitions for the
29407 current target machine. Use this when running @command{cpp}.
29408
29409 @item %P
29410 Like @samp{%p}, but puts @samp{__} before and after the name of each
29411 predefined macro, except for macros that start with @samp{__} or with
29412 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29413 C@.
29414
29415 @item %I
29416 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29417 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29418 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29419 and @option{-imultilib} as necessary.
29420
29421 @item %s
29422 Current argument is the name of a library or startup file of some sort.
29423 Search for that file in a standard list of directories and substitute
29424 the full name found. The current working directory is included in the
29425 list of directories scanned.
29426
29427 @item %T
29428 Current argument is the name of a linker script. Search for that file
29429 in the current list of directories to scan for libraries. If the file
29430 is located insert a @option{--script} option into the command line
29431 followed by the full path name found. If the file is not found then
29432 generate an error message. Note: the current working directory is not
29433 searched.
29434
29435 @item %e@var{str}
29436 Print @var{str} as an error message. @var{str} is terminated by a newline.
29437 Use this when inconsistent options are detected.
29438
29439 @item %(@var{name})
29440 Substitute the contents of spec string @var{name} at this point.
29441
29442 @item %x@{@var{option}@}
29443 Accumulate an option for @samp{%X}.
29444
29445 @item %X
29446 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29447 spec string.
29448
29449 @item %Y
29450 Output the accumulated assembler options specified by @option{-Wa}.
29451
29452 @item %Z
29453 Output the accumulated preprocessor options specified by @option{-Wp}.
29454
29455 @item %a
29456 Process the @code{asm} spec. This is used to compute the
29457 switches to be passed to the assembler.
29458
29459 @item %A
29460 Process the @code{asm_final} spec. This is a spec string for
29461 passing switches to an assembler post-processor, if such a program is
29462 needed.
29463
29464 @item %l
29465 Process the @code{link} spec. This is the spec for computing the
29466 command line passed to the linker. Typically it makes use of the
29467 @samp{%L %G %S %D and %E} sequences.
29468
29469 @item %D
29470 Dump out a @option{-L} option for each directory that GCC believes might
29471 contain startup files. If the target supports multilibs then the
29472 current multilib directory is prepended to each of these paths.
29473
29474 @item %L
29475 Process the @code{lib} spec. This is a spec string for deciding which
29476 libraries are included on the command line to the linker.
29477
29478 @item %G
29479 Process the @code{libgcc} spec. This is a spec string for deciding
29480 which GCC support library is included on the command line to the linker.
29481
29482 @item %S
29483 Process the @code{startfile} spec. This is a spec for deciding which
29484 object files are the first ones passed to the linker. Typically
29485 this might be a file named @file{crt0.o}.
29486
29487 @item %E
29488 Process the @code{endfile} spec. This is a spec string that specifies
29489 the last object files that are passed to the linker.
29490
29491 @item %C
29492 Process the @code{cpp} spec. This is used to construct the arguments
29493 to be passed to the C preprocessor.
29494
29495 @item %1
29496 Process the @code{cc1} spec. This is used to construct the options to be
29497 passed to the actual C compiler (@command{cc1}).
29498
29499 @item %2
29500 Process the @code{cc1plus} spec. This is used to construct the options to be
29501 passed to the actual C++ compiler (@command{cc1plus}).
29502
29503 @item %*
29504 Substitute the variable part of a matched option. See below.
29505 Note that each comma in the substituted string is replaced by
29506 a single space.
29507
29508 @item %<S
29509 Remove all occurrences of @code{-S} from the command line. Note---this
29510 command is position dependent. @samp{%} commands in the spec string
29511 before this one see @code{-S}, @samp{%} commands in the spec string
29512 after this one do not.
29513
29514 @item %:@var{function}(@var{args})
29515 Call the named function @var{function}, passing it @var{args}.
29516 @var{args} is first processed as a nested spec string, then split
29517 into an argument vector in the usual fashion. The function returns
29518 a string which is processed as if it had appeared literally as part
29519 of the current spec.
29520
29521 The following built-in spec functions are provided:
29522
29523 @table @code
29524 @item @code{getenv}
29525 The @code{getenv} spec function takes two arguments: an environment
29526 variable name and a string. If the environment variable is not
29527 defined, a fatal error is issued. Otherwise, the return value is the
29528 value of the environment variable concatenated with the string. For
29529 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29530
29531 @smallexample
29532 %:getenv(TOPDIR /include)
29533 @end smallexample
29534
29535 expands to @file{/path/to/top/include}.
29536
29537 @item @code{if-exists}
29538 The @code{if-exists} spec function takes one argument, an absolute
29539 pathname to a file. If the file exists, @code{if-exists} returns the
29540 pathname. Here is a small example of its usage:
29541
29542 @smallexample
29543 *startfile:
29544 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29545 @end smallexample
29546
29547 @item @code{if-exists-else}
29548 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29549 spec function, except that it takes two arguments. The first argument is
29550 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29551 returns the pathname. If it does not exist, it returns the second argument.
29552 This way, @code{if-exists-else} can be used to select one file or another,
29553 based on the existence of the first. Here is a small example of its usage:
29554
29555 @smallexample
29556 *startfile:
29557 crt0%O%s %:if-exists(crti%O%s) \
29558 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29559 @end smallexample
29560
29561 @item @code{replace-outfile}
29562 The @code{replace-outfile} spec function takes two arguments. It looks for the
29563 first argument in the outfiles array and replaces it with the second argument. Here
29564 is a small example of its usage:
29565
29566 @smallexample
29567 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29568 @end smallexample
29569
29570 @item @code{remove-outfile}
29571 The @code{remove-outfile} spec function takes one argument. It looks for the
29572 first argument in the outfiles array and removes it. Here is a small example
29573 its usage:
29574
29575 @smallexample
29576 %:remove-outfile(-lm)
29577 @end smallexample
29578
29579 @item @code{pass-through-libs}
29580 The @code{pass-through-libs} spec function takes any number of arguments. It
29581 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29582 assumes are the names of linker input library archive files) and returns a
29583 result containing all the found arguments each prepended by
29584 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29585 intended to be passed to the LTO linker plugin.
29586
29587 @smallexample
29588 %:pass-through-libs(%G %L %G)
29589 @end smallexample
29590
29591 @item @code{print-asm-header}
29592 The @code{print-asm-header} function takes no arguments and simply
29593 prints a banner like:
29594
29595 @smallexample
29596 Assembler options
29597 =================
29598
29599 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29600 @end smallexample
29601
29602 It is used to separate compiler options from assembler options
29603 in the @option{--target-help} output.
29604 @end table
29605
29606 @item %@{S@}
29607 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29608 If that switch is not specified, this substitutes nothing. Note that
29609 the leading dash is omitted when specifying this option, and it is
29610 automatically inserted if the substitution is performed. Thus the spec
29611 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29612 and outputs the command-line option @option{-foo}.
29613
29614 @item %W@{S@}
29615 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29616 deleted on failure.
29617
29618 @item %@{S*@}
29619 Substitutes all the switches specified to GCC whose names start
29620 with @code{-S}, but which also take an argument. This is used for
29621 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29622 GCC considers @option{-o foo} as being
29623 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29624 text, including the space. Thus two arguments are generated.
29625
29626 @item %@{S*&T*@}
29627 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29628 (the order of @code{S} and @code{T} in the spec is not significant).
29629 There can be any number of ampersand-separated variables; for each the
29630 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29631
29632 @item %@{S:X@}
29633 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29634
29635 @item %@{!S:X@}
29636 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29637
29638 @item %@{S*:X@}
29639 Substitutes @code{X} if one or more switches whose names start with
29640 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29641 once, no matter how many such switches appeared. However, if @code{%*}
29642 appears somewhere in @code{X}, then @code{X} is substituted once
29643 for each matching switch, with the @code{%*} replaced by the part of
29644 that switch matching the @code{*}.
29645
29646 If @code{%*} appears as the last part of a spec sequence then a space
29647 is added after the end of the last substitution. If there is more
29648 text in the sequence, however, then a space is not generated. This
29649 allows the @code{%*} substitution to be used as part of a larger
29650 string. For example, a spec string like this:
29651
29652 @smallexample
29653 %@{mcu=*:--script=%*/memory.ld@}
29654 @end smallexample
29655
29656 @noindent
29657 when matching an option like @option{-mcu=newchip} produces:
29658
29659 @smallexample
29660 --script=newchip/memory.ld
29661 @end smallexample
29662
29663 @item %@{.S:X@}
29664 Substitutes @code{X}, if processing a file with suffix @code{S}.
29665
29666 @item %@{!.S:X@}
29667 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29668
29669 @item %@{,S:X@}
29670 Substitutes @code{X}, if processing a file for language @code{S}.
29671
29672 @item %@{!,S:X@}
29673 Substitutes @code{X}, if not processing a file for language @code{S}.
29674
29675 @item %@{S|P:X@}
29676 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29677 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29678 @code{*} sequences as well, although they have a stronger binding than
29679 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29680 alternatives must be starred, and only the first matching alternative
29681 is substituted.
29682
29683 For example, a spec string like this:
29684
29685 @smallexample
29686 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29687 @end smallexample
29688
29689 @noindent
29690 outputs the following command-line options from the following input
29691 command-line options:
29692
29693 @smallexample
29694 fred.c -foo -baz
29695 jim.d -bar -boggle
29696 -d fred.c -foo -baz -boggle
29697 -d jim.d -bar -baz -boggle
29698 @end smallexample
29699
29700 @item %@{S:X; T:Y; :D@}
29701
29702 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29703 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29704 be as many clauses as you need. This may be combined with @code{.},
29705 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29706
29707
29708 @end table
29709
29710 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29711 or similar construct can use a backslash to ignore the special meaning
29712 of the character following it, thus allowing literal matching of a
29713 character that is otherwise specially treated. For example,
29714 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29715 @option{-std=iso9899:1999} option is given.
29716
29717 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29718 construct may contain other nested @samp{%} constructs or spaces, or
29719 even newlines. They are processed as usual, as described above.
29720 Trailing white space in @code{X} is ignored. White space may also
29721 appear anywhere on the left side of the colon in these constructs,
29722 except between @code{.} or @code{*} and the corresponding word.
29723
29724 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29725 handled specifically in these constructs. If another value of
29726 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29727 @option{-W} switch is found later in the command line, the earlier
29728 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29729 just one letter, which passes all matching options.
29730
29731 The character @samp{|} at the beginning of the predicate text is used to
29732 indicate that a command should be piped to the following command, but
29733 only if @option{-pipe} is specified.
29734
29735 It is built into GCC which switches take arguments and which do not.
29736 (You might think it would be useful to generalize this to allow each
29737 compiler's spec to say which switches take arguments. But this cannot
29738 be done in a consistent fashion. GCC cannot even decide which input
29739 files have been specified without knowing which switches take arguments,
29740 and it must know which input files to compile in order to tell which
29741 compilers to run).
29742
29743 GCC also knows implicitly that arguments starting in @option{-l} are to be
29744 treated as compiler output files, and passed to the linker in their
29745 proper position among the other output files.
29746
29747 @node Environment Variables
29748 @section Environment Variables Affecting GCC
29749 @cindex environment variables
29750
29751 @c man begin ENVIRONMENT
29752 This section describes several environment variables that affect how GCC
29753 operates. Some of them work by specifying directories or prefixes to use
29754 when searching for various kinds of files. Some are used to specify other
29755 aspects of the compilation environment.
29756
29757 Note that you can also specify places to search using options such as
29758 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29759 take precedence over places specified using environment variables, which
29760 in turn take precedence over those specified by the configuration of GCC@.
29761 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29762 GNU Compiler Collection (GCC) Internals}.
29763
29764 @table @env
29765 @item LANG
29766 @itemx LC_CTYPE
29767 @c @itemx LC_COLLATE
29768 @itemx LC_MESSAGES
29769 @c @itemx LC_MONETARY
29770 @c @itemx LC_NUMERIC
29771 @c @itemx LC_TIME
29772 @itemx LC_ALL
29773 @findex LANG
29774 @findex LC_CTYPE
29775 @c @findex LC_COLLATE
29776 @findex LC_MESSAGES
29777 @c @findex LC_MONETARY
29778 @c @findex LC_NUMERIC
29779 @c @findex LC_TIME
29780 @findex LC_ALL
29781 @cindex locale
29782 These environment variables control the way that GCC uses
29783 localization information which allows GCC to work with different
29784 national conventions. GCC inspects the locale categories
29785 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29786 so. These locale categories can be set to any value supported by your
29787 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29788 Kingdom encoded in UTF-8.
29789
29790 The @env{LC_CTYPE} environment variable specifies character
29791 classification. GCC uses it to determine the character boundaries in
29792 a string; this is needed for some multibyte encodings that contain quote
29793 and escape characters that are otherwise interpreted as a string
29794 end or escape.
29795
29796 The @env{LC_MESSAGES} environment variable specifies the language to
29797 use in diagnostic messages.
29798
29799 If the @env{LC_ALL} environment variable is set, it overrides the value
29800 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29801 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29802 environment variable. If none of these variables are set, GCC
29803 defaults to traditional C English behavior.
29804
29805 @item TMPDIR
29806 @findex TMPDIR
29807 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29808 files. GCC uses temporary files to hold the output of one stage of
29809 compilation which is to be used as input to the next stage: for example,
29810 the output of the preprocessor, which is the input to the compiler
29811 proper.
29812
29813 @item GCC_COMPARE_DEBUG
29814 @findex GCC_COMPARE_DEBUG
29815 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29816 @option{-fcompare-debug} to the compiler driver. See the documentation
29817 of this option for more details.
29818
29819 @item GCC_EXEC_PREFIX
29820 @findex GCC_EXEC_PREFIX
29821 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29822 names of the subprograms executed by the compiler. No slash is added
29823 when this prefix is combined with the name of a subprogram, but you can
29824 specify a prefix that ends with a slash if you wish.
29825
29826 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29827 an appropriate prefix to use based on the pathname it is invoked with.
29828
29829 If GCC cannot find the subprogram using the specified prefix, it
29830 tries looking in the usual places for the subprogram.
29831
29832 The default value of @env{GCC_EXEC_PREFIX} is
29833 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29834 the installed compiler. In many cases @var{prefix} is the value
29835 of @code{prefix} when you ran the @file{configure} script.
29836
29837 Other prefixes specified with @option{-B} take precedence over this prefix.
29838
29839 This prefix is also used for finding files such as @file{crt0.o} that are
29840 used for linking.
29841
29842 In addition, the prefix is used in an unusual way in finding the
29843 directories to search for header files. For each of the standard
29844 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29845 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29846 replacing that beginning with the specified prefix to produce an
29847 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29848 @file{foo/bar} just before it searches the standard directory
29849 @file{/usr/local/lib/bar}.
29850 If a standard directory begins with the configured
29851 @var{prefix} then the value of @var{prefix} is replaced by
29852 @env{GCC_EXEC_PREFIX} when looking for header files.
29853
29854 @item COMPILER_PATH
29855 @findex COMPILER_PATH
29856 The value of @env{COMPILER_PATH} is a colon-separated list of
29857 directories, much like @env{PATH}. GCC tries the directories thus
29858 specified when searching for subprograms, if it cannot find the
29859 subprograms using @env{GCC_EXEC_PREFIX}.
29860
29861 @item LIBRARY_PATH
29862 @findex LIBRARY_PATH
29863 The value of @env{LIBRARY_PATH} is a colon-separated list of
29864 directories, much like @env{PATH}. When configured as a native compiler,
29865 GCC tries the directories thus specified when searching for special
29866 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29867 using GCC also uses these directories when searching for ordinary
29868 libraries for the @option{-l} option (but directories specified with
29869 @option{-L} come first).
29870
29871 @item LANG
29872 @findex LANG
29873 @cindex locale definition
29874 This variable is used to pass locale information to the compiler. One way in
29875 which this information is used is to determine the character set to be used
29876 when character literals, string literals and comments are parsed in C and C++.
29877 When the compiler is configured to allow multibyte characters,
29878 the following values for @env{LANG} are recognized:
29879
29880 @table @samp
29881 @item C-JIS
29882 Recognize JIS characters.
29883 @item C-SJIS
29884 Recognize SJIS characters.
29885 @item C-EUCJP
29886 Recognize EUCJP characters.
29887 @end table
29888
29889 If @env{LANG} is not defined, or if it has some other value, then the
29890 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29891 recognize and translate multibyte characters.
29892 @end table
29893
29894 @noindent
29895 Some additional environment variables affect the behavior of the
29896 preprocessor.
29897
29898 @include cppenv.texi
29899
29900 @c man end
29901
29902 @node Precompiled Headers
29903 @section Using Precompiled Headers
29904 @cindex precompiled headers
29905 @cindex speed of compilation
29906
29907 Often large projects have many header files that are included in every
29908 source file. The time the compiler takes to process these header files
29909 over and over again can account for nearly all of the time required to
29910 build the project. To make builds faster, GCC allows you to
29911 @dfn{precompile} a header file.
29912
29913 To create a precompiled header file, simply compile it as you would any
29914 other file, if necessary using the @option{-x} option to make the driver
29915 treat it as a C or C++ header file. You may want to use a
29916 tool like @command{make} to keep the precompiled header up-to-date when
29917 the headers it contains change.
29918
29919 A precompiled header file is searched for when @code{#include} is
29920 seen in the compilation. As it searches for the included file
29921 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29922 compiler looks for a precompiled header in each directory just before it
29923 looks for the include file in that directory. The name searched for is
29924 the name specified in the @code{#include} with @samp{.gch} appended. If
29925 the precompiled header file cannot be used, it is ignored.
29926
29927 For instance, if you have @code{#include "all.h"}, and you have
29928 @file{all.h.gch} in the same directory as @file{all.h}, then the
29929 precompiled header file is used if possible, and the original
29930 header is used otherwise.
29931
29932 Alternatively, you might decide to put the precompiled header file in a
29933 directory and use @option{-I} to ensure that directory is searched
29934 before (or instead of) the directory containing the original header.
29935 Then, if you want to check that the precompiled header file is always
29936 used, you can put a file of the same name as the original header in this
29937 directory containing an @code{#error} command.
29938
29939 This also works with @option{-include}. So yet another way to use
29940 precompiled headers, good for projects not designed with precompiled
29941 header files in mind, is to simply take most of the header files used by
29942 a project, include them from another header file, precompile that header
29943 file, and @option{-include} the precompiled header. If the header files
29944 have guards against multiple inclusion, they are skipped because
29945 they've already been included (in the precompiled header).
29946
29947 If you need to precompile the same header file for different
29948 languages, targets, or compiler options, you can instead make a
29949 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29950 header in the directory, perhaps using @option{-o}. It doesn't matter
29951 what you call the files in the directory; every precompiled header in
29952 the directory is considered. The first precompiled header
29953 encountered in the directory that is valid for this compilation is
29954 used; they're searched in no particular order.
29955
29956 There are many other possibilities, limited only by your imagination,
29957 good sense, and the constraints of your build system.
29958
29959 A precompiled header file can be used only when these conditions apply:
29960
29961 @itemize
29962 @item
29963 Only one precompiled header can be used in a particular compilation.
29964
29965 @item
29966 A precompiled header cannot be used once the first C token is seen. You
29967 can have preprocessor directives before a precompiled header; you cannot
29968 include a precompiled header from inside another header.
29969
29970 @item
29971 The precompiled header file must be produced for the same language as
29972 the current compilation. You cannot use a C precompiled header for a C++
29973 compilation.
29974
29975 @item
29976 The precompiled header file must have been produced by the same compiler
29977 binary as the current compilation is using.
29978
29979 @item
29980 Any macros defined before the precompiled header is included must
29981 either be defined in the same way as when the precompiled header was
29982 generated, or must not affect the precompiled header, which usually
29983 means that they don't appear in the precompiled header at all.
29984
29985 The @option{-D} option is one way to define a macro before a
29986 precompiled header is included; using a @code{#define} can also do it.
29987 There are also some options that define macros implicitly, like
29988 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29989 defined this way.
29990
29991 @item If debugging information is output when using the precompiled
29992 header, using @option{-g} or similar, the same kind of debugging information
29993 must have been output when building the precompiled header. However,
29994 a precompiled header built using @option{-g} can be used in a compilation
29995 when no debugging information is being output.
29996
29997 @item The same @option{-m} options must generally be used when building
29998 and using the precompiled header. @xref{Submodel Options},
29999 for any cases where this rule is relaxed.
30000
30001 @item Each of the following options must be the same when building and using
30002 the precompiled header:
30003
30004 @gccoptlist{-fexceptions}
30005
30006 @item
30007 Some other command-line options starting with @option{-f},
30008 @option{-p}, or @option{-O} must be defined in the same way as when
30009 the precompiled header was generated. At present, it's not clear
30010 which options are safe to change and which are not; the safest choice
30011 is to use exactly the same options when generating and using the
30012 precompiled header. The following are known to be safe:
30013
30014 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30015 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30016 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30017 -pedantic-errors}
30018
30019 @end itemize
30020
30021 For all of these except the last, the compiler automatically
30022 ignores the precompiled header if the conditions aren't met. If you
30023 find an option combination that doesn't work and doesn't cause the
30024 precompiled header to be ignored, please consider filing a bug report,
30025 see @ref{Bugs}.
30026
30027 If you do use differing options when generating and using the
30028 precompiled header, the actual behavior is a mixture of the
30029 behavior for the options. For instance, if you use @option{-g} to
30030 generate the precompiled header but not when using it, you may or may
30031 not get debugging information for routines in the precompiled header.