]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
2018-11-11 Sandra Loosemore <sandra@codesourcery.com>
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2018 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
9
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2018 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below). A copy of the license is
19 included in the gfdl(7) man page.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43 Only the most useful options are listed here; see below for the
44 remainder. @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking. The ``overall options'' allow you to stop this
72 process at an intermediate stage. For example, the @option{-c} option
73 says not to run the linker. Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
76
77 Other options are passed on to one or more stages of processing. Some options
78 control the preprocessor and others the compiler itself. Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
81
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly. If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
88
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++}
98 instead. @xref{Invoking G++,,Compiling C++ Programs},
99 for information about the differences in behavior between @command{gcc}
100 and @code{g++} when compiling C++ programs.
101
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands. Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
108
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments. For the most part, the order
112 you use doesn't matter. Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified. Also,
115 the placement of the @option{-l} option is significant.
116
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}. This manual documents
122 only one of these two forms, whichever one is not the default.
123
124 Some options take one or more arguments typically separated either
125 by a space or by the equals sign (@samp{=}) from the option name.
126 Unless documented otherwise, an argument can be either numeric or
127 a string. Numeric arguments must typically be small unsigned decimal
128 or hexadecimal integers. Hexadecimal arguments must begin with
129 the @samp{0x} prefix. Arguments to options that specify a size
130 threshold of some sort may be arbitrarily large decimal or hexadecimal
131 integers followed by a byte size suffix designating a multiple of bytes
132 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133 @code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134 @code{GiB} for gigabyte and gigibyte, and so on. Such arguments are
135 designated by @var{byte-size} in the following text. Refer to the NIST,
136 IEC, and other relevant national and international standards for the full
137 listing and explanation of the binary and decimal byte size prefixes.
138
139 @c man end
140
141 @xref{Option Index}, for an index to GCC's options.
142
143 @menu
144 * Option Summary:: Brief list of all options, without explanations.
145 * Overall Options:: Controlling the kind of output:
146 an executable, object files, assembler files,
147 or preprocessed source.
148 * Invoking G++:: Compiling C++ programs.
149 * C Dialect Options:: Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152 and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154 be formatted.
155 * Warning Options:: How picky should the compiler be?
156 * Debugging Options:: Producing debuggable code.
157 * Optimize Options:: How much optimization?
158 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
159 * Preprocessor Options:: Controlling header files and macro definitions.
160 Also, getting dependency information for Make.
161 * Assembler Options:: Passing options to the assembler.
162 * Link Options:: Specifying libraries and so on.
163 * Directory Options:: Where to find header files and libraries.
164 Where to find the compiler executable files.
165 * Code Gen Options:: Specifying conventions for function calls, data layout
166 and register usage.
167 * Developer Options:: Printing GCC configuration info, statistics, and
168 debugging dumps.
169 * Submodel Options:: Target-specific options, such as compiling for a
170 specific processor variant.
171 * Spec Files:: How to pass switches to sub-processes.
172 * Environment Variables:: Env vars that affect GCC.
173 * Precompiled Headers:: Compiling a header once, and using it many times.
174 @end menu
175
176 @c man begin OPTIONS
177
178 @node Option Summary
179 @section Option Summary
180
181 Here is a summary of all the options, grouped by type. Explanations are
182 in the following sections.
183
184 @table @emph
185 @item Overall Options
186 @xref{Overall Options,,Options Controlling the Kind of Output}.
187 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
188 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
189 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
190 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
191 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
192 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
193
194 @item C Language Options
195 @xref{C Dialect Options,,Options Controlling C Dialect}.
196 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
197 -fpermitted-flt-eval-methods=@var{standard} @gol
198 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
199 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
200 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
201 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
202 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
203 -fsigned-bitfields -fsigned-char @gol
204 -funsigned-bitfields -funsigned-char}
205
206 @item C++ Language Options
207 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
208 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
209 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
210 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
211 -fno-elide-constructors @gol
212 -fno-enforce-eh-specs @gol
213 -fno-gnu-keywords @gol
214 -fno-implicit-templates @gol
215 -fno-implicit-inline-templates @gol
216 -fno-implement-inlines -fms-extensions @gol
217 -fnew-inheriting-ctors @gol
218 -fnew-ttp-matching @gol
219 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
220 -fno-optional-diags -fpermissive @gol
221 -fno-pretty-templates @gol
222 -frepo -fno-rtti -fsized-deallocation @gol
223 -ftemplate-backtrace-limit=@var{n} @gol
224 -ftemplate-depth=@var{n} @gol
225 -fno-threadsafe-statics -fuse-cxa-atexit @gol
226 -fno-weak -nostdinc++ @gol
227 -fvisibility-inlines-hidden @gol
228 -fvisibility-ms-compat @gol
229 -fext-numeric-literals @gol
230 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
231 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wliteral-suffix @gol
232 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
233 -Wnamespaces -Wnarrowing @gol
234 -Wpessimizing-move -Wredundant-move @gol
235 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
236 -Wnon-virtual-dtor -Wreorder -Wregister @gol
237 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
238 -Wno-non-template-friend -Wold-style-cast @gol
239 -Woverloaded-virtual -Wno-pmf-conversions @gol
240 -Wno-class-conversion -Wno-terminate @gol
241 -Wsign-promo -Wvirtual-inheritance}
242
243 @item Objective-C and Objective-C++ Language Options
244 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
245 Objective-C and Objective-C++ Dialects}.
246 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
247 -fgnu-runtime -fnext-runtime @gol
248 -fno-nil-receivers @gol
249 -fobjc-abi-version=@var{n} @gol
250 -fobjc-call-cxx-cdtors @gol
251 -fobjc-direct-dispatch @gol
252 -fobjc-exceptions @gol
253 -fobjc-gc @gol
254 -fobjc-nilcheck @gol
255 -fobjc-std=objc1 @gol
256 -fno-local-ivars @gol
257 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
258 -freplace-objc-classes @gol
259 -fzero-link @gol
260 -gen-decls @gol
261 -Wassign-intercept @gol
262 -Wno-protocol -Wselector @gol
263 -Wstrict-selector-match @gol
264 -Wundeclared-selector}
265
266 @item Diagnostic Message Formatting Options
267 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
268 @gccoptlist{-fmessage-length=@var{n} @gol
269 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
270 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
271 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
272 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
273 -fdiagnostics-minimum-margin-width=@var{width} @gol
274 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
275 -fdiagnostics-show-template-tree -fno-elide-type @gol
276 -fno-show-column}
277
278 @item Warning Options
279 @xref{Warning Options,,Options to Request or Suppress Warnings}.
280 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
281 -pedantic-errors @gol
282 -w -Wextra -Wall -Waddress -Waggregate-return -Waligned-new @gol
283 -Walloc-zero -Walloc-size-larger-than=@var{byte-size}
284 -Walloca -Walloca-larger-than=@var{byte-size} @gol
285 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
286 -Wno-attributes -Wno-attribute-alias @gol
287 -Wbool-compare -Wbool-operation @gol
288 -Wno-builtin-declaration-mismatch @gol
289 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
290 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
291 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
292 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
293 -Wclobbered -Wcomment -Wconditionally-supported @gol
294 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
295 -Wdelete-incomplete @gol
296 -Wno-attribute-warning @gol
297 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
298 -Wdisabled-optimization @gol
299 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
300 -Wno-div-by-zero -Wdouble-promotion @gol
301 -Wduplicated-branches -Wduplicated-cond @gol
302 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
303 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
304 -Wfloat-equal -Wformat -Wformat=2 @gol
305 -Wno-format-contains-nul -Wno-format-extra-args @gol
306 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
307 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
308 -Wformat-y2k -Wframe-address @gol
309 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
310 -Wjump-misses-init @gol
311 -Wif-not-aligned @gol
312 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
313 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
314 -Wimplicit-function-declaration -Wimplicit-int @gol
315 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
316 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
317 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
318 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
319 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
320 -Wmisleading-indentation -Wno-missing-attributes -Wmissing-braces @gol
321 -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-profile @gol
322 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
323 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
324 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
325 -Woverride-init-side-effects -Woverlength-strings @gol
326 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
327 -Wparentheses -Wno-pedantic-ms-format @gol
328 -Wplacement-new -Wplacement-new=@var{n} @gol
329 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
330 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
331 -Wrestrict -Wno-return-local-addr @gol
332 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
333 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
334 -Wshift-overflow -Wshift-overflow=@var{n} @gol
335 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
336 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
337 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
338 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
339 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
340 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
341 -Wstringop-overflow=@var{n} -Wstringop-truncation @gol
342 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
343 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
344 -Wmissing-format-attribute -Wsubobject-linkage @gol
345 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
346 -Wswitch-unreachable -Wsync-nand @gol
347 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
348 -Wtype-limits -Wundef @gol
349 -Wuninitialized -Wunknown-pragmas @gol
350 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
351 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
352 -Wunused-parameter -Wno-unused-result @gol
353 -Wunused-value -Wunused-variable @gol
354 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
355 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
356 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
357 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
358 -Wwrite-strings @gol
359 -Wzero-as-null-pointer-constant -Whsa}
360
361 @item C and Objective-C-only Warning Options
362 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
363 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
364 -Wold-style-declaration -Wold-style-definition @gol
365 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
366 -Wdeclaration-after-statement -Wpointer-sign}
367
368 @item Debugging Options
369 @xref{Debugging Options,,Options for Debugging Your Program}.
370 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
371 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
372 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
373 -gas-loc-support -gno-as-loc-support @gol
374 -gas-locview-support -gno-as-locview-support @gol
375 -gcolumn-info -gno-column-info @gol
376 -gstatement-frontiers -gno-statement-frontiers @gol
377 -gvariable-location-views -gno-variable-location-views @gol
378 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
379 -ginline-points -gno-inline-points @gol
380 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
381 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
382 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
383 -fno-eliminate-unused-debug-types @gol
384 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
385 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
386 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
387 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
388 -fvar-tracking -fvar-tracking-assignments}
389
390 @item Optimization Options
391 @xref{Optimize Options,,Options that Control Optimization}.
392 @gccoptlist{-faggressive-loop-optimizations @gol
393 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
394 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
395 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
396 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
397 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
398 -fauto-inc-dec -fbranch-probabilities @gol
399 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
400 -fbtr-bb-exclusive -fcaller-saves @gol
401 -fcombine-stack-adjustments -fconserve-stack @gol
402 -fcompare-elim -fcprop-registers -fcrossjumping @gol
403 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
404 -fcx-limited-range @gol
405 -fdata-sections -fdce -fdelayed-branch @gol
406 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
407 -fdevirtualize-at-ltrans -fdse @gol
408 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
409 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
410 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
411 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
412 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
413 -fif-conversion2 -findirect-inlining @gol
414 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
415 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
416 -fipa-bit-cp -fipa-vrp @gol
417 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-reference-addressable @gol
418 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
419 -fira-region=@var{region} -fira-hoist-pressure @gol
420 -fira-loop-pressure -fno-ira-share-save-slots @gol
421 -fno-ira-share-spill-slots @gol
422 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
423 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
424 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
425 -floop-block -floop-interchange -floop-strip-mine @gol
426 -floop-unroll-and-jam -floop-nest-optimize @gol
427 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
428 -flto-partition=@var{alg} -fmerge-all-constants @gol
429 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
430 -fmove-loop-invariants -fno-branch-count-reg @gol
431 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
432 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
433 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
434 -fno-sched-spec -fno-signed-zeros @gol
435 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
436 -fomit-frame-pointer -foptimize-sibling-calls @gol
437 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
438 -fprefetch-loop-arrays @gol
439 -fprofile-correction @gol
440 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
441 -fprofile-reorder-functions @gol
442 -freciprocal-math -free -frename-registers -freorder-blocks @gol
443 -freorder-blocks-algorithm=@var{algorithm} @gol
444 -freorder-blocks-and-partition -freorder-functions @gol
445 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
446 -frounding-math -fsave-optimization-record @gol
447 -fsched2-use-superblocks -fsched-pressure @gol
448 -fsched-spec-load -fsched-spec-load-dangerous @gol
449 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
450 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
451 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
452 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
453 -fschedule-fusion @gol
454 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
455 -fselective-scheduling -fselective-scheduling2 @gol
456 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
457 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
458 -fsignaling-nans @gol
459 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
460 -fsplit-paths @gol
461 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
462 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
463 -fthread-jumps -ftracer -ftree-bit-ccp @gol
464 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
465 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
466 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
467 -ftree-loop-if-convert -ftree-loop-im @gol
468 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
469 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
470 -ftree-loop-vectorize @gol
471 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
472 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
473 -ftree-switch-conversion -ftree-tail-merge @gol
474 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
475 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
476 -funsafe-math-optimizations -funswitch-loops @gol
477 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
478 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
479 --param @var{name}=@var{value}
480 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
481
482 @item Program Instrumentation Options
483 @xref{Instrumentation Options,,Program Instrumentation Options}.
484 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
485 -fprofile-abs-path @gol
486 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
487 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
488 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
489 -fsanitize-undefined-trap-on-error -fbounds-check @gol
490 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
491 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
492 -fstack-protector-explicit -fstack-check @gol
493 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
494 -fno-stack-limit -fsplit-stack @gol
495 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
496 -fvtv-counts -fvtv-debug @gol
497 -finstrument-functions @gol
498 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
499 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
500
501 @item Preprocessor Options
502 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
503 @gccoptlist{-A@var{question}=@var{answer} @gol
504 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
505 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
506 -dD -dI -dM -dN -dU @gol
507 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
508 -fexec-charset=@var{charset} -fextended-identifiers @gol
509 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
510 -fno-canonical-system-headers @gol -fpch-deps -fpch-preprocess @gol
511 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
512 -fwide-exec-charset=@var{charset} -fworking-directory @gol
513 -H -imacros @var{file} -include @var{file} @gol
514 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
515 -no-integrated-cpp -P -pthread -remap @gol
516 -traditional -traditional-cpp -trigraphs @gol
517 -U@var{macro} -undef @gol
518 -Wp,@var{option} -Xpreprocessor @var{option}}
519
520 @item Assembler Options
521 @xref{Assembler Options,,Passing Options to the Assembler}.
522 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
523
524 @item Linker Options
525 @xref{Link Options,,Options for Linking}.
526 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
527 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
528 -e @var{entry} --entry=@var{entry} @gol
529 -pie -pthread -r -rdynamic @gol
530 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
531 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
532 -shared -shared-libgcc -symbolic @gol
533 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
534 -u @var{symbol} -z @var{keyword}}
535
536 @item Directory Options
537 @xref{Directory Options,,Options for Directory Search}.
538 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
539 -idirafter @var{dir} @gol
540 -imacros @var{file} -imultilib @var{dir} @gol
541 -iplugindir=@var{dir} -iprefix @var{file} @gol
542 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
543 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
544 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
545 -nostdinc -nostdinc++ --sysroot=@var{dir}}
546
547 @item Code Generation Options
548 @xref{Code Gen Options,,Options for Code Generation Conventions}.
549 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
550 -ffixed-@var{reg} -fexceptions @gol
551 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
552 -fasynchronous-unwind-tables @gol
553 -fno-gnu-unique @gol
554 -finhibit-size-directive -fno-common -fno-ident @gol
555 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
556 -fno-jump-tables @gol
557 -frecord-gcc-switches @gol
558 -freg-struct-return -fshort-enums -fshort-wchar @gol
559 -fverbose-asm -fpack-struct[=@var{n}] @gol
560 -fleading-underscore -ftls-model=@var{model} @gol
561 -fstack-reuse=@var{reuse_level} @gol
562 -ftrampolines -ftrapv -fwrapv @gol
563 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
564 -fstrict-volatile-bitfields -fsync-libcalls}
565
566 @item Developer Options
567 @xref{Developer Options,,GCC Developer Options}.
568 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
569 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
570 -fdbg-cnt=@var{counter-value-list} @gol
571 -fdisable-ipa-@var{pass_name} @gol
572 -fdisable-rtl-@var{pass_name} @gol
573 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
574 -fdisable-tree-@var{pass_name} @gol
575 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
576 -fdump-debug -fdump-earlydebug @gol
577 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
578 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
579 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
580 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
581 -fdump-lang-all @gol
582 -fdump-lang-@var{switch} @gol
583 -fdump-lang-@var{switch}-@var{options} @gol
584 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
585 -fdump-passes @gol
586 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
587 -fdump-statistics @gol
588 -fdump-tree-all @gol
589 -fdump-tree-@var{switch} @gol
590 -fdump-tree-@var{switch}-@var{options} @gol
591 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
592 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
593 -fenable-@var{kind}-@var{pass} @gol
594 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
595 -fira-verbose=@var{n} @gol
596 -flto-report -flto-report-wpa -fmem-report-wpa @gol
597 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
598 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
599 -fprofile-report @gol
600 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
601 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
602 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
603 -fvar-tracking-assignments-toggle -gtoggle @gol
604 -print-file-name=@var{library} -print-libgcc-file-name @gol
605 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
606 -print-prog-name=@var{program} -print-search-dirs -Q @gol
607 -print-sysroot -print-sysroot-headers-suffix @gol
608 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
609
610 @item Machine-Dependent Options
611 @xref{Submodel Options,,Machine-Dependent Options}.
612 @c This list is ordered alphanumerically by subsection name.
613 @c Try and put the significant identifier (CPU or system) first,
614 @c so users have a clue at guessing where the ones they want will be.
615
616 @emph{AArch64 Options}
617 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
618 -mgeneral-regs-only @gol
619 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
620 -mstrict-align -mno-strict-align @gol
621 -momit-leaf-frame-pointer @gol
622 -mtls-dialect=desc -mtls-dialect=traditional @gol
623 -mtls-size=@var{size} @gol
624 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
625 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
626 -mpc-relative-literal-loads @gol
627 -msign-return-address=@var{scope} @gol
628 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
629 -moverride=@var{string} -mverbose-cost-dump -mtrack-speculation}
630
631 @emph{Adapteva Epiphany Options}
632 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
633 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
634 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
635 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
636 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
637 -msplit-vecmove-early -m1reg-@var{reg}}
638
639 @emph{ARC Options}
640 @gccoptlist{-mbarrel-shifter -mjli-always @gol
641 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
642 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
643 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
644 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
645 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
646 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
647 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
648 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
649 -mvolatile-cache -mtp-regno=@var{regno} @gol
650 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
651 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
652 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
653 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
654 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
655 -mtune=@var{cpu} -mmultcost=@var{num} @gol
656 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
657 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
658
659 @emph{ARM Options}
660 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
661 -mabi=@var{name} @gol
662 -mapcs-stack-check -mno-apcs-stack-check @gol
663 -mapcs-reentrant -mno-apcs-reentrant @gol
664 -msched-prolog -mno-sched-prolog @gol
665 -mlittle-endian -mbig-endian @gol
666 -mbe8 -mbe32 @gol
667 -mfloat-abi=@var{name} @gol
668 -mfp16-format=@var{name}
669 -mthumb-interwork -mno-thumb-interwork @gol
670 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
671 -mtune=@var{name} -mprint-tune-info @gol
672 -mstructure-size-boundary=@var{n} @gol
673 -mabort-on-noreturn @gol
674 -mlong-calls -mno-long-calls @gol
675 -msingle-pic-base -mno-single-pic-base @gol
676 -mpic-register=@var{reg} @gol
677 -mnop-fun-dllimport @gol
678 -mpoke-function-name @gol
679 -mthumb -marm -mflip-thumb @gol
680 -mtpcs-frame -mtpcs-leaf-frame @gol
681 -mcaller-super-interworking -mcallee-super-interworking @gol
682 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
683 -mword-relocations @gol
684 -mfix-cortex-m3-ldrd @gol
685 -munaligned-access @gol
686 -mneon-for-64bits @gol
687 -mslow-flash-data @gol
688 -masm-syntax-unified @gol
689 -mrestrict-it @gol
690 -mverbose-cost-dump @gol
691 -mpure-code @gol
692 -mcmse}
693
694 @emph{AVR Options}
695 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
696 -mbranch-cost=@var{cost} @gol
697 -mcall-prologues -mgas-isr-prologues -mint8 @gol
698 -mn_flash=@var{size} -mno-interrupts @gol
699 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
700 -mfract-convert-truncate @gol
701 -mshort-calls -nodevicelib @gol
702 -Waddr-space-convert -Wmisspelled-isr}
703
704 @emph{Blackfin Options}
705 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
706 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
707 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
708 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
709 -mno-id-shared-library -mshared-library-id=@var{n} @gol
710 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
711 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
712 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
713 -micplb}
714
715 @emph{C6X Options}
716 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
717 -msim -msdata=@var{sdata-type}}
718
719 @emph{CRIS Options}
720 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
721 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
722 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
723 -mstack-align -mdata-align -mconst-align @gol
724 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
725 -melf -maout -melinux -mlinux -sim -sim2 @gol
726 -mmul-bug-workaround -mno-mul-bug-workaround}
727
728 @emph{CR16 Options}
729 @gccoptlist{-mmac @gol
730 -mcr16cplus -mcr16c @gol
731 -msim -mint32 -mbit-ops
732 -mdata-model=@var{model}}
733
734 @emph{C-SKY Options}
735 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
736 -mbig-endian -EB -mlittle-endian -EL @gol
737 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
738 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
739 -mdsp -medsp -mvdsp @gol
740 -mdiv -msmart -mhigh-registers -manchor @gol
741 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
742 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
743
744 @emph{Darwin Options}
745 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
746 -arch_only -bind_at_load -bundle -bundle_loader @gol
747 -client_name -compatibility_version -current_version @gol
748 -dead_strip @gol
749 -dependency-file -dylib_file -dylinker_install_name @gol
750 -dynamic -dynamiclib -exported_symbols_list @gol
751 -filelist -flat_namespace -force_cpusubtype_ALL @gol
752 -force_flat_namespace -headerpad_max_install_names @gol
753 -iframework @gol
754 -image_base -init -install_name -keep_private_externs @gol
755 -multi_module -multiply_defined -multiply_defined_unused @gol
756 -noall_load -no_dead_strip_inits_and_terms @gol
757 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
758 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
759 -private_bundle -read_only_relocs -sectalign @gol
760 -sectobjectsymbols -whyload -seg1addr @gol
761 -sectcreate -sectobjectsymbols -sectorder @gol
762 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
763 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
764 -segprot -segs_read_only_addr -segs_read_write_addr @gol
765 -single_module -static -sub_library -sub_umbrella @gol
766 -twolevel_namespace -umbrella -undefined @gol
767 -unexported_symbols_list -weak_reference_mismatches @gol
768 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
769 -mkernel -mone-byte-bool}
770
771 @emph{DEC Alpha Options}
772 @gccoptlist{-mno-fp-regs -msoft-float @gol
773 -mieee -mieee-with-inexact -mieee-conformant @gol
774 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
775 -mtrap-precision=@var{mode} -mbuild-constants @gol
776 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
777 -mbwx -mmax -mfix -mcix @gol
778 -mfloat-vax -mfloat-ieee @gol
779 -mexplicit-relocs -msmall-data -mlarge-data @gol
780 -msmall-text -mlarge-text @gol
781 -mmemory-latency=@var{time}}
782
783 @emph{FR30 Options}
784 @gccoptlist{-msmall-model -mno-lsim}
785
786 @emph{FT32 Options}
787 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
788
789 @emph{FRV Options}
790 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
791 -mhard-float -msoft-float @gol
792 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
793 -mdouble -mno-double @gol
794 -mmedia -mno-media -mmuladd -mno-muladd @gol
795 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
796 -mlinked-fp -mlong-calls -malign-labels @gol
797 -mlibrary-pic -macc-4 -macc-8 @gol
798 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
799 -moptimize-membar -mno-optimize-membar @gol
800 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
801 -mvliw-branch -mno-vliw-branch @gol
802 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
803 -mno-nested-cond-exec -mtomcat-stats @gol
804 -mTLS -mtls @gol
805 -mcpu=@var{cpu}}
806
807 @emph{GNU/Linux Options}
808 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
809 -tno-android-cc -tno-android-ld}
810
811 @emph{H8/300 Options}
812 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
813
814 @emph{HPPA Options}
815 @gccoptlist{-march=@var{architecture-type} @gol
816 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
817 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
818 -mfixed-range=@var{register-range} @gol
819 -mjump-in-delay -mlinker-opt -mlong-calls @gol
820 -mlong-load-store -mno-disable-fpregs @gol
821 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
822 -mno-jump-in-delay -mno-long-load-store @gol
823 -mno-portable-runtime -mno-soft-float @gol
824 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
825 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
826 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
827 -munix=@var{unix-std} -nolibdld -static -threads}
828
829 @emph{IA-64 Options}
830 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
831 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
832 -mconstant-gp -mauto-pic -mfused-madd @gol
833 -minline-float-divide-min-latency @gol
834 -minline-float-divide-max-throughput @gol
835 -mno-inline-float-divide @gol
836 -minline-int-divide-min-latency @gol
837 -minline-int-divide-max-throughput @gol
838 -mno-inline-int-divide @gol
839 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
840 -mno-inline-sqrt @gol
841 -mdwarf2-asm -mearly-stop-bits @gol
842 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
843 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
844 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
845 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
846 -msched-spec-ldc -msched-spec-control-ldc @gol
847 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
848 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
849 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
850 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
851
852 @emph{LM32 Options}
853 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
854 -msign-extend-enabled -muser-enabled}
855
856 @emph{M32R/D Options}
857 @gccoptlist{-m32r2 -m32rx -m32r @gol
858 -mdebug @gol
859 -malign-loops -mno-align-loops @gol
860 -missue-rate=@var{number} @gol
861 -mbranch-cost=@var{number} @gol
862 -mmodel=@var{code-size-model-type} @gol
863 -msdata=@var{sdata-type} @gol
864 -mno-flush-func -mflush-func=@var{name} @gol
865 -mno-flush-trap -mflush-trap=@var{number} @gol
866 -G @var{num}}
867
868 @emph{M32C Options}
869 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
870
871 @emph{M680x0 Options}
872 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
873 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
874 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
875 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
876 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
877 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
878 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
879 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
880 -mxgot -mno-xgot -mlong-jump-table-offsets}
881
882 @emph{MCore Options}
883 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
884 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
885 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
886 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
887 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
888
889 @emph{MeP Options}
890 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
891 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
892 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
893 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
894 -mtiny=@var{n}}
895
896 @emph{MicroBlaze Options}
897 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
898 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
899 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
900 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
901 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}
902 -mpic-data-is-text-relative}
903
904 @emph{MIPS Options}
905 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
906 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
907 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
908 -mips16 -mno-mips16 -mflip-mips16 @gol
909 -minterlink-compressed -mno-interlink-compressed @gol
910 -minterlink-mips16 -mno-interlink-mips16 @gol
911 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
912 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
913 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
914 -mno-float -msingle-float -mdouble-float @gol
915 -modd-spreg -mno-odd-spreg @gol
916 -mabs=@var{mode} -mnan=@var{encoding} @gol
917 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
918 -mmcu -mmno-mcu @gol
919 -meva -mno-eva @gol
920 -mvirt -mno-virt @gol
921 -mxpa -mno-xpa @gol
922 -mcrc -mno-crc @gol
923 -mginv -mno-ginv @gol
924 -mmicromips -mno-micromips @gol
925 -mmsa -mno-msa @gol
926 -mloongson-mmi -mno-loongson-mmi @gol
927 -mloongson-ext -mno-loongson-ext @gol
928 -mloongson-ext2 -mno-loongson-ext2 @gol
929 -mfpu=@var{fpu-type} @gol
930 -msmartmips -mno-smartmips @gol
931 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
932 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
933 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
934 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
935 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
936 -membedded-data -mno-embedded-data @gol
937 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
938 -mcode-readable=@var{setting} @gol
939 -msplit-addresses -mno-split-addresses @gol
940 -mexplicit-relocs -mno-explicit-relocs @gol
941 -mcheck-zero-division -mno-check-zero-division @gol
942 -mdivide-traps -mdivide-breaks @gol
943 -mload-store-pairs -mno-load-store-pairs @gol
944 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
945 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
946 -mfix-24k -mno-fix-24k @gol
947 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
948 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
949 -mfix-vr4120 -mno-fix-vr4120 @gol
950 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
951 -mflush-func=@var{func} -mno-flush-func @gol
952 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
953 -mcompact-branches=@var{policy} @gol
954 -mfp-exceptions -mno-fp-exceptions @gol
955 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
956 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
957 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
958 -mframe-header-opt -mno-frame-header-opt}
959
960 @emph{MMIX Options}
961 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
962 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
963 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
964 -mno-base-addresses -msingle-exit -mno-single-exit}
965
966 @emph{MN10300 Options}
967 @gccoptlist{-mmult-bug -mno-mult-bug @gol
968 -mno-am33 -mam33 -mam33-2 -mam34 @gol
969 -mtune=@var{cpu-type} @gol
970 -mreturn-pointer-on-d0 @gol
971 -mno-crt0 -mrelax -mliw -msetlb}
972
973 @emph{Moxie Options}
974 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
975
976 @emph{MSP430 Options}
977 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
978 -mwarn-mcu @gol
979 -mcode-region= -mdata-region= @gol
980 -msilicon-errata= -msilicon-errata-warn= @gol
981 -mhwmult= -minrt}
982
983 @emph{NDS32 Options}
984 @gccoptlist{-mbig-endian -mlittle-endian @gol
985 -mreduced-regs -mfull-regs @gol
986 -mcmov -mno-cmov @gol
987 -mext-perf -mno-ext-perf @gol
988 -mext-perf2 -mno-ext-perf2 @gol
989 -mext-string -mno-ext-string @gol
990 -mv3push -mno-v3push @gol
991 -m16bit -mno-16bit @gol
992 -misr-vector-size=@var{num} @gol
993 -mcache-block-size=@var{num} @gol
994 -march=@var{arch} @gol
995 -mcmodel=@var{code-model} @gol
996 -mctor-dtor -mrelax}
997
998 @emph{Nios II Options}
999 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1000 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1001 -mel -meb @gol
1002 -mno-bypass-cache -mbypass-cache @gol
1003 -mno-cache-volatile -mcache-volatile @gol
1004 -mno-fast-sw-div -mfast-sw-div @gol
1005 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1006 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1007 -mcustom-fpu-cfg=@var{name} @gol
1008 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1009 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1010
1011 @emph{Nvidia PTX Options}
1012 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1013
1014 @emph{OpenRISC Options}
1015 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1016 -msoft-mul -msoft-div @gol
1017 -mcmov -mror -msext -msfimm -mshftimm}
1018
1019 @emph{PDP-11 Options}
1020 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1021 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1022 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1023
1024 @emph{picoChip Options}
1025 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1026 -msymbol-as-address -mno-inefficient-warnings}
1027
1028 @emph{PowerPC Options}
1029 See RS/6000 and PowerPC Options.
1030
1031 @emph{PowerPC SPE Options}
1032 @gccoptlist{-mcpu=@var{cpu-type} @gol
1033 -mtune=@var{cpu-type} @gol
1034 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb @gol
1035 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1036 -m32 -mxl-compat -mno-xl-compat @gol
1037 -malign-power -malign-natural @gol
1038 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1039 -msingle-float -mdouble-float @gol
1040 -mupdate -mno-update @gol
1041 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1042 -mstrict-align -mno-strict-align -mrelocatable @gol
1043 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1044 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1045 -msingle-pic-base @gol
1046 -mprioritize-restricted-insns=@var{priority} @gol
1047 -msched-costly-dep=@var{dependence_type} @gol
1048 -minsert-sched-nops=@var{scheme} @gol
1049 -mcall-sysv -mcall-netbsd @gol
1050 -maix-struct-return -msvr4-struct-return @gol
1051 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1052 -mblock-move-inline-limit=@var{num} @gol
1053 -misel -mno-isel @gol
1054 -misel=yes -misel=no @gol
1055 -mspe -mno-spe @gol
1056 -mspe=yes -mspe=no @gol
1057 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1058 -mprototype -mno-prototype @gol
1059 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1060 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1061 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1062 -mno-recip-precision @gol
1063 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1064 -msave-toc-indirect -mno-save-toc-indirect @gol
1065 -mcompat-align-parm -mno-compat-align-parm @gol
1066 -mfloat128 -mno-float128 @gol
1067 -mgnu-attribute -mno-gnu-attribute @gol
1068 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1069 -mstack-protector-guard-offset=@var{offset}}
1070
1071 @emph{RISC-V Options}
1072 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1073 -mplt -mno-plt @gol
1074 -mabi=@var{ABI-string} @gol
1075 -mfdiv -mno-fdiv @gol
1076 -mdiv -mno-div @gol
1077 -march=@var{ISA-string} @gol
1078 -mtune=@var{processor-string} @gol
1079 -mpreferred-stack-boundary=@var{num} @gol
1080 -msmall-data-limit=@var{N-bytes} @gol
1081 -msave-restore -mno-save-restore @gol
1082 -mstrict-align -mno-strict-align @gol
1083 -mcmodel=medlow -mcmodel=medany @gol
1084 -mexplicit-relocs -mno-explicit-relocs @gol
1085 -mrelax -mno-relax @gol}
1086
1087 @emph{RL78 Options}
1088 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1089 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1090 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1091
1092 @emph{RS/6000 and PowerPC Options}
1093 @gccoptlist{-mcpu=@var{cpu-type} @gol
1094 -mtune=@var{cpu-type} @gol
1095 -mcmodel=@var{code-model} @gol
1096 -mpowerpc64 @gol
1097 -maltivec -mno-altivec @gol
1098 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1099 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1100 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1101 -mfprnd -mno-fprnd @gol
1102 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1103 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1104 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1105 -malign-power -malign-natural @gol
1106 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1107 -mupdate -mno-update @gol
1108 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1109 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1110 -mstrict-align -mno-strict-align -mrelocatable @gol
1111 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1112 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1113 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1114 -mprioritize-restricted-insns=@var{priority} @gol
1115 -msched-costly-dep=@var{dependence_type} @gol
1116 -minsert-sched-nops=@var{scheme} @gol
1117 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1118 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1119 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1120 -mtraceback=@var{traceback_type} @gol
1121 -maix-struct-return -msvr4-struct-return @gol
1122 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1123 -mblock-move-inline-limit=@var{num} @gol
1124 -mblock-compare-inline-limit=@var{num} @gol
1125 -mblock-compare-inline-loop-limit=@var{num} @gol
1126 -mstring-compare-inline-limit=@var{num} @gol
1127 -misel -mno-isel @gol
1128 -mvrsave -mno-vrsave @gol
1129 -mmulhw -mno-mulhw @gol
1130 -mdlmzb -mno-dlmzb @gol
1131 -mprototype -mno-prototype @gol
1132 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1133 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1134 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1135 -mno-recip-precision @gol
1136 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1137 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1138 -msave-toc-indirect -mno-save-toc-indirect @gol
1139 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1140 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1141 -mquad-memory -mno-quad-memory @gol
1142 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1143 -mcompat-align-parm -mno-compat-align-parm @gol
1144 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1145 -mgnu-attribute -mno-gnu-attribute @gol
1146 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1147 -mstack-protector-guard-offset=@var{offset}}
1148
1149 @emph{RX Options}
1150 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1151 -mcpu=@gol
1152 -mbig-endian-data -mlittle-endian-data @gol
1153 -msmall-data @gol
1154 -msim -mno-sim@gol
1155 -mas100-syntax -mno-as100-syntax@gol
1156 -mrelax@gol
1157 -mmax-constant-size=@gol
1158 -mint-register=@gol
1159 -mpid@gol
1160 -mallow-string-insns -mno-allow-string-insns@gol
1161 -mjsr@gol
1162 -mno-warn-multiple-fast-interrupts@gol
1163 -msave-acc-in-interrupts}
1164
1165 @emph{S/390 and zSeries Options}
1166 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1167 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1168 -mlong-double-64 -mlong-double-128 @gol
1169 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1170 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1171 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1172 -mhtm -mvx -mzvector @gol
1173 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1174 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1175 -mhotpatch=@var{halfwords},@var{halfwords}}
1176
1177 @emph{Score Options}
1178 @gccoptlist{-meb -mel @gol
1179 -mnhwloop @gol
1180 -muls @gol
1181 -mmac @gol
1182 -mscore5 -mscore5u -mscore7 -mscore7d}
1183
1184 @emph{SH Options}
1185 @gccoptlist{-m1 -m2 -m2e @gol
1186 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1187 -m3 -m3e @gol
1188 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1189 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1190 -mb -ml -mdalign -mrelax @gol
1191 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1192 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1193 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1194 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1195 -maccumulate-outgoing-args @gol
1196 -matomic-model=@var{atomic-model} @gol
1197 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1198 -mcbranch-force-delay-slot @gol
1199 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1200 -mpretend-cmove -mtas}
1201
1202 @emph{Solaris 2 Options}
1203 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1204 -pthreads}
1205
1206 @emph{SPARC Options}
1207 @gccoptlist{-mcpu=@var{cpu-type} @gol
1208 -mtune=@var{cpu-type} @gol
1209 -mcmodel=@var{code-model} @gol
1210 -mmemory-model=@var{mem-model} @gol
1211 -m32 -m64 -mapp-regs -mno-app-regs @gol
1212 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1213 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1214 -mhard-quad-float -msoft-quad-float @gol
1215 -mstack-bias -mno-stack-bias @gol
1216 -mstd-struct-return -mno-std-struct-return @gol
1217 -munaligned-doubles -mno-unaligned-doubles @gol
1218 -muser-mode -mno-user-mode @gol
1219 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1220 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1221 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1222 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1223 -mpopc -mno-popc -msubxc -mno-subxc @gol
1224 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1225 -mlra -mno-lra}
1226
1227 @emph{SPU Options}
1228 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1229 -msafe-dma -munsafe-dma @gol
1230 -mbranch-hints @gol
1231 -msmall-mem -mlarge-mem -mstdmain @gol
1232 -mfixed-range=@var{register-range} @gol
1233 -mea32 -mea64 @gol
1234 -maddress-space-conversion -mno-address-space-conversion @gol
1235 -mcache-size=@var{cache-size} @gol
1236 -matomic-updates -mno-atomic-updates}
1237
1238 @emph{System V Options}
1239 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1240
1241 @emph{TILE-Gx Options}
1242 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1243 -mcmodel=@var{code-model}}
1244
1245 @emph{TILEPro Options}
1246 @gccoptlist{-mcpu=@var{cpu} -m32}
1247
1248 @emph{V850 Options}
1249 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1250 -mprolog-function -mno-prolog-function -mspace @gol
1251 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1252 -mapp-regs -mno-app-regs @gol
1253 -mdisable-callt -mno-disable-callt @gol
1254 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1255 -mv850e -mv850 -mv850e3v5 @gol
1256 -mloop @gol
1257 -mrelax @gol
1258 -mlong-jumps @gol
1259 -msoft-float @gol
1260 -mhard-float @gol
1261 -mgcc-abi @gol
1262 -mrh850-abi @gol
1263 -mbig-switch}
1264
1265 @emph{VAX Options}
1266 @gccoptlist{-mg -mgnu -munix}
1267
1268 @emph{Visium Options}
1269 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1270 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1271
1272 @emph{VMS Options}
1273 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1274 -mpointer-size=@var{size}}
1275
1276 @emph{VxWorks Options}
1277 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1278 -Xbind-lazy -Xbind-now}
1279
1280 @emph{x86 Options}
1281 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1282 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1283 -mfpmath=@var{unit} @gol
1284 -masm=@var{dialect} -mno-fancy-math-387 @gol
1285 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1286 -mno-wide-multiply -mrtd -malign-double @gol
1287 -mpreferred-stack-boundary=@var{num} @gol
1288 -mincoming-stack-boundary=@var{num} @gol
1289 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1290 -mrecip -mrecip=@var{opt} @gol
1291 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1292 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1293 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1294 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1295 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd -mptwrite @gol
1296 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1297 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1298 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp @gol
1299 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1300 -mshstk -mforce-indirect-call -mavx512vbmi2 @gol
1301 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq
1302 -mcldemote @gol
1303 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1304 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1305 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1306 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1307 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1308 -mregparm=@var{num} -msseregparm @gol
1309 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1310 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1311 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1312 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1313 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1314 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1315 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1316 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1317 -mstack-protector-guard-reg=@var{reg} @gol
1318 -mstack-protector-guard-offset=@var{offset} @gol
1319 -mstack-protector-guard-symbol=@var{symbol} @gol
1320 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1321 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1322 -mindirect-branch-register}
1323
1324 @emph{x86 Windows Options}
1325 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1326 -mnop-fun-dllimport -mthread @gol
1327 -municode -mwin32 -mwindows -fno-set-stack-executable}
1328
1329 @emph{Xstormy16 Options}
1330 @gccoptlist{-msim}
1331
1332 @emph{Xtensa Options}
1333 @gccoptlist{-mconst16 -mno-const16 @gol
1334 -mfused-madd -mno-fused-madd @gol
1335 -mforce-no-pic @gol
1336 -mserialize-volatile -mno-serialize-volatile @gol
1337 -mtext-section-literals -mno-text-section-literals @gol
1338 -mauto-litpools -mno-auto-litpools @gol
1339 -mtarget-align -mno-target-align @gol
1340 -mlongcalls -mno-longcalls}
1341
1342 @emph{zSeries Options}
1343 See S/390 and zSeries Options.
1344 @end table
1345
1346
1347 @node Overall Options
1348 @section Options Controlling the Kind of Output
1349
1350 Compilation can involve up to four stages: preprocessing, compilation
1351 proper, assembly and linking, always in that order. GCC is capable of
1352 preprocessing and compiling several files either into several
1353 assembler input files, or into one assembler input file; then each
1354 assembler input file produces an object file, and linking combines all
1355 the object files (those newly compiled, and those specified as input)
1356 into an executable file.
1357
1358 @cindex file name suffix
1359 For any given input file, the file name suffix determines what kind of
1360 compilation is done:
1361
1362 @table @gcctabopt
1363 @item @var{file}.c
1364 C source code that must be preprocessed.
1365
1366 @item @var{file}.i
1367 C source code that should not be preprocessed.
1368
1369 @item @var{file}.ii
1370 C++ source code that should not be preprocessed.
1371
1372 @item @var{file}.m
1373 Objective-C source code. Note that you must link with the @file{libobjc}
1374 library to make an Objective-C program work.
1375
1376 @item @var{file}.mi
1377 Objective-C source code that should not be preprocessed.
1378
1379 @item @var{file}.mm
1380 @itemx @var{file}.M
1381 Objective-C++ source code. Note that you must link with the @file{libobjc}
1382 library to make an Objective-C++ program work. Note that @samp{.M} refers
1383 to a literal capital M@.
1384
1385 @item @var{file}.mii
1386 Objective-C++ source code that should not be preprocessed.
1387
1388 @item @var{file}.h
1389 C, C++, Objective-C or Objective-C++ header file to be turned into a
1390 precompiled header (default), or C, C++ header file to be turned into an
1391 Ada spec (via the @option{-fdump-ada-spec} switch).
1392
1393 @item @var{file}.cc
1394 @itemx @var{file}.cp
1395 @itemx @var{file}.cxx
1396 @itemx @var{file}.cpp
1397 @itemx @var{file}.CPP
1398 @itemx @var{file}.c++
1399 @itemx @var{file}.C
1400 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1401 the last two letters must both be literally @samp{x}. Likewise,
1402 @samp{.C} refers to a literal capital C@.
1403
1404 @item @var{file}.mm
1405 @itemx @var{file}.M
1406 Objective-C++ source code that must be preprocessed.
1407
1408 @item @var{file}.mii
1409 Objective-C++ source code that should not be preprocessed.
1410
1411 @item @var{file}.hh
1412 @itemx @var{file}.H
1413 @itemx @var{file}.hp
1414 @itemx @var{file}.hxx
1415 @itemx @var{file}.hpp
1416 @itemx @var{file}.HPP
1417 @itemx @var{file}.h++
1418 @itemx @var{file}.tcc
1419 C++ header file to be turned into a precompiled header or Ada spec.
1420
1421 @item @var{file}.f
1422 @itemx @var{file}.for
1423 @itemx @var{file}.ftn
1424 Fixed form Fortran source code that should not be preprocessed.
1425
1426 @item @var{file}.F
1427 @itemx @var{file}.FOR
1428 @itemx @var{file}.fpp
1429 @itemx @var{file}.FPP
1430 @itemx @var{file}.FTN
1431 Fixed form Fortran source code that must be preprocessed (with the traditional
1432 preprocessor).
1433
1434 @item @var{file}.f90
1435 @itemx @var{file}.f95
1436 @itemx @var{file}.f03
1437 @itemx @var{file}.f08
1438 Free form Fortran source code that should not be preprocessed.
1439
1440 @item @var{file}.F90
1441 @itemx @var{file}.F95
1442 @itemx @var{file}.F03
1443 @itemx @var{file}.F08
1444 Free form Fortran source code that must be preprocessed (with the
1445 traditional preprocessor).
1446
1447 @item @var{file}.go
1448 Go source code.
1449
1450 @item @var{file}.brig
1451 BRIG files (binary representation of HSAIL).
1452
1453 @item @var{file}.d
1454 D source code.
1455
1456 @item @var{file}.di
1457 D interface file.
1458
1459 @item @var{file}.dd
1460 D documentation code (Ddoc).
1461
1462 @item @var{file}.ads
1463 Ada source code file that contains a library unit declaration (a
1464 declaration of a package, subprogram, or generic, or a generic
1465 instantiation), or a library unit renaming declaration (a package,
1466 generic, or subprogram renaming declaration). Such files are also
1467 called @dfn{specs}.
1468
1469 @item @var{file}.adb
1470 Ada source code file containing a library unit body (a subprogram or
1471 package body). Such files are also called @dfn{bodies}.
1472
1473 @c GCC also knows about some suffixes for languages not yet included:
1474 @c Ratfor:
1475 @c @var{file}.r
1476
1477 @item @var{file}.s
1478 Assembler code.
1479
1480 @item @var{file}.S
1481 @itemx @var{file}.sx
1482 Assembler code that must be preprocessed.
1483
1484 @item @var{other}
1485 An object file to be fed straight into linking.
1486 Any file name with no recognized suffix is treated this way.
1487 @end table
1488
1489 @opindex x
1490 You can specify the input language explicitly with the @option{-x} option:
1491
1492 @table @gcctabopt
1493 @item -x @var{language}
1494 Specify explicitly the @var{language} for the following input files
1495 (rather than letting the compiler choose a default based on the file
1496 name suffix). This option applies to all following input files until
1497 the next @option{-x} option. Possible values for @var{language} are:
1498 @smallexample
1499 c c-header cpp-output
1500 c++ c++-header c++-cpp-output
1501 objective-c objective-c-header objective-c-cpp-output
1502 objective-c++ objective-c++-header objective-c++-cpp-output
1503 assembler assembler-with-cpp
1504 ada
1505 d
1506 f77 f77-cpp-input f95 f95-cpp-input
1507 go
1508 brig
1509 @end smallexample
1510
1511 @item -x none
1512 Turn off any specification of a language, so that subsequent files are
1513 handled according to their file name suffixes (as they are if @option{-x}
1514 has not been used at all).
1515 @end table
1516
1517 If you only want some of the stages of compilation, you can use
1518 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1519 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1520 @command{gcc} is to stop. Note that some combinations (for example,
1521 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1522
1523 @table @gcctabopt
1524 @item -c
1525 @opindex c
1526 Compile or assemble the source files, but do not link. The linking
1527 stage simply is not done. The ultimate output is in the form of an
1528 object file for each source file.
1529
1530 By default, the object file name for a source file is made by replacing
1531 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1532
1533 Unrecognized input files, not requiring compilation or assembly, are
1534 ignored.
1535
1536 @item -S
1537 @opindex S
1538 Stop after the stage of compilation proper; do not assemble. The output
1539 is in the form of an assembler code file for each non-assembler input
1540 file specified.
1541
1542 By default, the assembler file name for a source file is made by
1543 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1544
1545 Input files that don't require compilation are ignored.
1546
1547 @item -E
1548 @opindex E
1549 Stop after the preprocessing stage; do not run the compiler proper. The
1550 output is in the form of preprocessed source code, which is sent to the
1551 standard output.
1552
1553 Input files that don't require preprocessing are ignored.
1554
1555 @cindex output file option
1556 @item -o @var{file}
1557 @opindex o
1558 Place output in file @var{file}. This applies to whatever
1559 sort of output is being produced, whether it be an executable file,
1560 an object file, an assembler file or preprocessed C code.
1561
1562 If @option{-o} is not specified, the default is to put an executable
1563 file in @file{a.out}, the object file for
1564 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1565 assembler file in @file{@var{source}.s}, a precompiled header file in
1566 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1567 standard output.
1568
1569 @item -v
1570 @opindex v
1571 Print (on standard error output) the commands executed to run the stages
1572 of compilation. Also print the version number of the compiler driver
1573 program and of the preprocessor and the compiler proper.
1574
1575 @item -###
1576 @opindex ###
1577 Like @option{-v} except the commands are not executed and arguments
1578 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1579 This is useful for shell scripts to capture the driver-generated command lines.
1580
1581 @item --help
1582 @opindex help
1583 Print (on the standard output) a description of the command-line options
1584 understood by @command{gcc}. If the @option{-v} option is also specified
1585 then @option{--help} is also passed on to the various processes
1586 invoked by @command{gcc}, so that they can display the command-line options
1587 they accept. If the @option{-Wextra} option has also been specified
1588 (prior to the @option{--help} option), then command-line options that
1589 have no documentation associated with them are also displayed.
1590
1591 @item --target-help
1592 @opindex target-help
1593 Print (on the standard output) a description of target-specific command-line
1594 options for each tool. For some targets extra target-specific
1595 information may also be printed.
1596
1597 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1598 Print (on the standard output) a description of the command-line
1599 options understood by the compiler that fit into all specified classes
1600 and qualifiers. These are the supported classes:
1601
1602 @table @asis
1603 @item @samp{optimizers}
1604 Display all of the optimization options supported by the
1605 compiler.
1606
1607 @item @samp{warnings}
1608 Display all of the options controlling warning messages
1609 produced by the compiler.
1610
1611 @item @samp{target}
1612 Display target-specific options. Unlike the
1613 @option{--target-help} option however, target-specific options of the
1614 linker and assembler are not displayed. This is because those
1615 tools do not currently support the extended @option{--help=} syntax.
1616
1617 @item @samp{params}
1618 Display the values recognized by the @option{--param}
1619 option.
1620
1621 @item @var{language}
1622 Display the options supported for @var{language}, where
1623 @var{language} is the name of one of the languages supported in this
1624 version of GCC@.
1625
1626 @item @samp{common}
1627 Display the options that are common to all languages.
1628 @end table
1629
1630 These are the supported qualifiers:
1631
1632 @table @asis
1633 @item @samp{undocumented}
1634 Display only those options that are undocumented.
1635
1636 @item @samp{joined}
1637 Display options taking an argument that appears after an equal
1638 sign in the same continuous piece of text, such as:
1639 @samp{--help=target}.
1640
1641 @item @samp{separate}
1642 Display options taking an argument that appears as a separate word
1643 following the original option, such as: @samp{-o output-file}.
1644 @end table
1645
1646 Thus for example to display all the undocumented target-specific
1647 switches supported by the compiler, use:
1648
1649 @smallexample
1650 --help=target,undocumented
1651 @end smallexample
1652
1653 The sense of a qualifier can be inverted by prefixing it with the
1654 @samp{^} character, so for example to display all binary warning
1655 options (i.e., ones that are either on or off and that do not take an
1656 argument) that have a description, use:
1657
1658 @smallexample
1659 --help=warnings,^joined,^undocumented
1660 @end smallexample
1661
1662 The argument to @option{--help=} should not consist solely of inverted
1663 qualifiers.
1664
1665 Combining several classes is possible, although this usually
1666 restricts the output so much that there is nothing to display. One
1667 case where it does work, however, is when one of the classes is
1668 @var{target}. For example, to display all the target-specific
1669 optimization options, use:
1670
1671 @smallexample
1672 --help=target,optimizers
1673 @end smallexample
1674
1675 The @option{--help=} option can be repeated on the command line. Each
1676 successive use displays its requested class of options, skipping
1677 those that have already been displayed.
1678
1679 If the @option{-Q} option appears on the command line before the
1680 @option{--help=} option, then the descriptive text displayed by
1681 @option{--help=} is changed. Instead of describing the displayed
1682 options, an indication is given as to whether the option is enabled,
1683 disabled or set to a specific value (assuming that the compiler
1684 knows this at the point where the @option{--help=} option is used).
1685
1686 Here is a truncated example from the ARM port of @command{gcc}:
1687
1688 @smallexample
1689 % gcc -Q -mabi=2 --help=target -c
1690 The following options are target specific:
1691 -mabi= 2
1692 -mabort-on-noreturn [disabled]
1693 -mapcs [disabled]
1694 @end smallexample
1695
1696 The output is sensitive to the effects of previous command-line
1697 options, so for example it is possible to find out which optimizations
1698 are enabled at @option{-O2} by using:
1699
1700 @smallexample
1701 -Q -O2 --help=optimizers
1702 @end smallexample
1703
1704 Alternatively you can discover which binary optimizations are enabled
1705 by @option{-O3} by using:
1706
1707 @smallexample
1708 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1709 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1710 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1711 @end smallexample
1712
1713 @item --version
1714 @opindex version
1715 Display the version number and copyrights of the invoked GCC@.
1716
1717 @item -pass-exit-codes
1718 @opindex pass-exit-codes
1719 Normally the @command{gcc} program exits with the code of 1 if any
1720 phase of the compiler returns a non-success return code. If you specify
1721 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1722 the numerically highest error produced by any phase returning an error
1723 indication. The C, C++, and Fortran front ends return 4 if an internal
1724 compiler error is encountered.
1725
1726 @item -pipe
1727 @opindex pipe
1728 Use pipes rather than temporary files for communication between the
1729 various stages of compilation. This fails to work on some systems where
1730 the assembler is unable to read from a pipe; but the GNU assembler has
1731 no trouble.
1732
1733 @item -specs=@var{file}
1734 @opindex specs
1735 Process @var{file} after the compiler reads in the standard @file{specs}
1736 file, in order to override the defaults which the @command{gcc} driver
1737 program uses when determining what switches to pass to @command{cc1},
1738 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1739 @option{-specs=@var{file}} can be specified on the command line, and they
1740 are processed in order, from left to right. @xref{Spec Files}, for
1741 information about the format of the @var{file}.
1742
1743 @item -wrapper
1744 @opindex wrapper
1745 Invoke all subcommands under a wrapper program. The name of the
1746 wrapper program and its parameters are passed as a comma separated
1747 list.
1748
1749 @smallexample
1750 gcc -c t.c -wrapper gdb,--args
1751 @end smallexample
1752
1753 @noindent
1754 This invokes all subprograms of @command{gcc} under
1755 @samp{gdb --args}, thus the invocation of @command{cc1} is
1756 @samp{gdb --args cc1 @dots{}}.
1757
1758 @item -ffile-prefix-map=@var{old}=@var{new}
1759 @opindex ffile-prefix-map
1760 When compiling files residing in directory @file{@var{old}}, record
1761 any references to them in the result of the compilation as if the
1762 files resided in directory @file{@var{new}} instead. Specifying this
1763 option is equivalent to specifying all the individual
1764 @option{-f*-prefix-map} options. This can be used to make reproducible
1765 builds that are location independent. See also
1766 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1767
1768 @item -fplugin=@var{name}.so
1769 @opindex fplugin
1770 Load the plugin code in file @var{name}.so, assumed to be a
1771 shared object to be dlopen'd by the compiler. The base name of
1772 the shared object file is used to identify the plugin for the
1773 purposes of argument parsing (See
1774 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1775 Each plugin should define the callback functions specified in the
1776 Plugins API.
1777
1778 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1779 @opindex fplugin-arg
1780 Define an argument called @var{key} with a value of @var{value}
1781 for the plugin called @var{name}.
1782
1783 @item -fdump-ada-spec@r{[}-slim@r{]}
1784 @opindex fdump-ada-spec
1785 For C and C++ source and include files, generate corresponding Ada specs.
1786 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1787 GNAT User's Guide}, which provides detailed documentation on this feature.
1788
1789 @item -fada-spec-parent=@var{unit}
1790 @opindex fada-spec-parent
1791 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1792 Ada specs as child units of parent @var{unit}.
1793
1794 @item -fdump-go-spec=@var{file}
1795 @opindex fdump-go-spec
1796 For input files in any language, generate corresponding Go
1797 declarations in @var{file}. This generates Go @code{const},
1798 @code{type}, @code{var}, and @code{func} declarations which may be a
1799 useful way to start writing a Go interface to code written in some
1800 other language.
1801
1802 @include @value{srcdir}/../libiberty/at-file.texi
1803 @end table
1804
1805 @node Invoking G++
1806 @section Compiling C++ Programs
1807
1808 @cindex suffixes for C++ source
1809 @cindex C++ source file suffixes
1810 C++ source files conventionally use one of the suffixes @samp{.C},
1811 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1812 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1813 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1814 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1815 files with these names and compiles them as C++ programs even if you
1816 call the compiler the same way as for compiling C programs (usually
1817 with the name @command{gcc}).
1818
1819 @findex g++
1820 @findex c++
1821 However, the use of @command{gcc} does not add the C++ library.
1822 @command{g++} is a program that calls GCC and automatically specifies linking
1823 against the C++ library. It treats @samp{.c},
1824 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1825 files unless @option{-x} is used. This program is also useful when
1826 precompiling a C header file with a @samp{.h} extension for use in C++
1827 compilations. On many systems, @command{g++} is also installed with
1828 the name @command{c++}.
1829
1830 @cindex invoking @command{g++}
1831 When you compile C++ programs, you may specify many of the same
1832 command-line options that you use for compiling programs in any
1833 language; or command-line options meaningful for C and related
1834 languages; or options that are meaningful only for C++ programs.
1835 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1836 explanations of options for languages related to C@.
1837 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1838 explanations of options that are meaningful only for C++ programs.
1839
1840 @node C Dialect Options
1841 @section Options Controlling C Dialect
1842 @cindex dialect options
1843 @cindex language dialect options
1844 @cindex options, dialect
1845
1846 The following options control the dialect of C (or languages derived
1847 from C, such as C++, Objective-C and Objective-C++) that the compiler
1848 accepts:
1849
1850 @table @gcctabopt
1851 @cindex ANSI support
1852 @cindex ISO support
1853 @item -ansi
1854 @opindex ansi
1855 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1856 equivalent to @option{-std=c++98}.
1857
1858 This turns off certain features of GCC that are incompatible with ISO
1859 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1860 such as the @code{asm} and @code{typeof} keywords, and
1861 predefined macros such as @code{unix} and @code{vax} that identify the
1862 type of system you are using. It also enables the undesirable and
1863 rarely used ISO trigraph feature. For the C compiler,
1864 it disables recognition of C++ style @samp{//} comments as well as
1865 the @code{inline} keyword.
1866
1867 The alternate keywords @code{__asm__}, @code{__extension__},
1868 @code{__inline__} and @code{__typeof__} continue to work despite
1869 @option{-ansi}. You would not want to use them in an ISO C program, of
1870 course, but it is useful to put them in header files that might be included
1871 in compilations done with @option{-ansi}. Alternate predefined macros
1872 such as @code{__unix__} and @code{__vax__} are also available, with or
1873 without @option{-ansi}.
1874
1875 The @option{-ansi} option does not cause non-ISO programs to be
1876 rejected gratuitously. For that, @option{-Wpedantic} is required in
1877 addition to @option{-ansi}. @xref{Warning Options}.
1878
1879 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1880 option is used. Some header files may notice this macro and refrain
1881 from declaring certain functions or defining certain macros that the
1882 ISO standard doesn't call for; this is to avoid interfering with any
1883 programs that might use these names for other things.
1884
1885 Functions that are normally built in but do not have semantics
1886 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1887 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1888 built-in functions provided by GCC}, for details of the functions
1889 affected.
1890
1891 @item -std=
1892 @opindex std
1893 Determine the language standard. @xref{Standards,,Language Standards
1894 Supported by GCC}, for details of these standard versions. This option
1895 is currently only supported when compiling C or C++.
1896
1897 The compiler can accept several base standards, such as @samp{c90} or
1898 @samp{c++98}, and GNU dialects of those standards, such as
1899 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1900 compiler accepts all programs following that standard plus those
1901 using GNU extensions that do not contradict it. For example,
1902 @option{-std=c90} turns off certain features of GCC that are
1903 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1904 keywords, but not other GNU extensions that do not have a meaning in
1905 ISO C90, such as omitting the middle term of a @code{?:}
1906 expression. On the other hand, when a GNU dialect of a standard is
1907 specified, all features supported by the compiler are enabled, even when
1908 those features change the meaning of the base standard. As a result, some
1909 strict-conforming programs may be rejected. The particular standard
1910 is used by @option{-Wpedantic} to identify which features are GNU
1911 extensions given that version of the standard. For example
1912 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1913 comments, while @option{-std=gnu99 -Wpedantic} does not.
1914
1915 A value for this option must be provided; possible values are
1916
1917 @table @samp
1918 @item c90
1919 @itemx c89
1920 @itemx iso9899:1990
1921 Support all ISO C90 programs (certain GNU extensions that conflict
1922 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1923
1924 @item iso9899:199409
1925 ISO C90 as modified in amendment 1.
1926
1927 @item c99
1928 @itemx c9x
1929 @itemx iso9899:1999
1930 @itemx iso9899:199x
1931 ISO C99. This standard is substantially completely supported, modulo
1932 bugs and floating-point issues
1933 (mainly but not entirely relating to optional C99 features from
1934 Annexes F and G). See
1935 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1936 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1937
1938 @item c11
1939 @itemx c1x
1940 @itemx iso9899:2011
1941 ISO C11, the 2011 revision of the ISO C standard. This standard is
1942 substantially completely supported, modulo bugs, floating-point issues
1943 (mainly but not entirely relating to optional C11 features from
1944 Annexes F and G) and the optional Annexes K (Bounds-checking
1945 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1946
1947 @item c17
1948 @itemx c18
1949 @itemx iso9899:2017
1950 @itemx iso9899:2018
1951 ISO C17, the 2017 revision of the ISO C standard
1952 (published in 2018). This standard is
1953 same as C11 except for corrections of defects (all of which are also
1954 applied with @option{-std=c11}) and a new value of
1955 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1956
1957 @item c2x
1958 The next version of the ISO C standard, still under development. The
1959 support for this version is experimental and incomplete.
1960
1961 @item gnu90
1962 @itemx gnu89
1963 GNU dialect of ISO C90 (including some C99 features).
1964
1965 @item gnu99
1966 @itemx gnu9x
1967 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1968
1969 @item gnu11
1970 @itemx gnu1x
1971 GNU dialect of ISO C11.
1972 The name @samp{gnu1x} is deprecated.
1973
1974 @item gnu17
1975 @itemx gnu18
1976 GNU dialect of ISO C17. This is the default for C code.
1977
1978 @item gnu2x
1979 The next version of the ISO C standard, still under development, plus
1980 GNU extensions. The support for this version is experimental and
1981 incomplete.
1982
1983 @item c++98
1984 @itemx c++03
1985 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1986 additional defect reports. Same as @option{-ansi} for C++ code.
1987
1988 @item gnu++98
1989 @itemx gnu++03
1990 GNU dialect of @option{-std=c++98}.
1991
1992 @item c++11
1993 @itemx c++0x
1994 The 2011 ISO C++ standard plus amendments.
1995 The name @samp{c++0x} is deprecated.
1996
1997 @item gnu++11
1998 @itemx gnu++0x
1999 GNU dialect of @option{-std=c++11}.
2000 The name @samp{gnu++0x} is deprecated.
2001
2002 @item c++14
2003 @itemx c++1y
2004 The 2014 ISO C++ standard plus amendments.
2005 The name @samp{c++1y} is deprecated.
2006
2007 @item gnu++14
2008 @itemx gnu++1y
2009 GNU dialect of @option{-std=c++14}.
2010 This is the default for C++ code.
2011 The name @samp{gnu++1y} is deprecated.
2012
2013 @item c++17
2014 @itemx c++1z
2015 The 2017 ISO C++ standard plus amendments.
2016 The name @samp{c++1z} is deprecated.
2017
2018 @item gnu++17
2019 @itemx gnu++1z
2020 GNU dialect of @option{-std=c++17}.
2021 The name @samp{gnu++1z} is deprecated.
2022
2023 @item c++2a
2024 The next revision of the ISO C++ standard, tentatively planned for
2025 2020. Support is highly experimental, and will almost certainly
2026 change in incompatible ways in future releases.
2027
2028 @item gnu++2a
2029 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2030 and will almost certainly change in incompatible ways in future
2031 releases.
2032 @end table
2033
2034 @item -fgnu89-inline
2035 @opindex fgnu89-inline
2036 The option @option{-fgnu89-inline} tells GCC to use the traditional
2037 GNU semantics for @code{inline} functions when in C99 mode.
2038 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2039 Using this option is roughly equivalent to adding the
2040 @code{gnu_inline} function attribute to all inline functions
2041 (@pxref{Function Attributes}).
2042
2043 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2044 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2045 specifies the default behavior).
2046 This option is not supported in @option{-std=c90} or
2047 @option{-std=gnu90} mode.
2048
2049 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2050 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2051 in effect for @code{inline} functions. @xref{Common Predefined
2052 Macros,,,cpp,The C Preprocessor}.
2053
2054 @item -fpermitted-flt-eval-methods=@var{style}
2055 @opindex fpermitted-flt-eval-methods
2056 @opindex fpermitted-flt-eval-methods=c11
2057 @opindex fpermitted-flt-eval-methods=ts-18661-3
2058 ISO/IEC TS 18661-3 defines new permissible values for
2059 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2060 a semantic type that is an interchange or extended format should be
2061 evaluated to the precision and range of that type. These new values are
2062 a superset of those permitted under C99/C11, which does not specify the
2063 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2064 conforming to C11 may not have been written expecting the possibility of
2065 the new values.
2066
2067 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2068 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2069 or the extended set of values specified in ISO/IEC TS 18661-3.
2070
2071 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2072
2073 The default when in a standards compliant mode (@option{-std=c11} or similar)
2074 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2075 dialect (@option{-std=gnu11} or similar) is
2076 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2077
2078 @item -aux-info @var{filename}
2079 @opindex aux-info
2080 Output to the given filename prototyped declarations for all functions
2081 declared and/or defined in a translation unit, including those in header
2082 files. This option is silently ignored in any language other than C@.
2083
2084 Besides declarations, the file indicates, in comments, the origin of
2085 each declaration (source file and line), whether the declaration was
2086 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2087 @samp{O} for old, respectively, in the first character after the line
2088 number and the colon), and whether it came from a declaration or a
2089 definition (@samp{C} or @samp{F}, respectively, in the following
2090 character). In the case of function definitions, a K&R-style list of
2091 arguments followed by their declarations is also provided, inside
2092 comments, after the declaration.
2093
2094 @item -fallow-parameterless-variadic-functions
2095 @opindex fallow-parameterless-variadic-functions
2096 Accept variadic functions without named parameters.
2097
2098 Although it is possible to define such a function, this is not very
2099 useful as it is not possible to read the arguments. This is only
2100 supported for C as this construct is allowed by C++.
2101
2102 @item -fno-asm
2103 @opindex fno-asm
2104 @opindex fasm
2105 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2106 keyword, so that code can use these words as identifiers. You can use
2107 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2108 instead. @option{-ansi} implies @option{-fno-asm}.
2109
2110 In C++, this switch only affects the @code{typeof} keyword, since
2111 @code{asm} and @code{inline} are standard keywords. You may want to
2112 use the @option{-fno-gnu-keywords} flag instead, which has the same
2113 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2114 switch only affects the @code{asm} and @code{typeof} keywords, since
2115 @code{inline} is a standard keyword in ISO C99.
2116
2117 @item -fno-builtin
2118 @itemx -fno-builtin-@var{function}
2119 @opindex fno-builtin
2120 @opindex fbuiltin
2121 @cindex built-in functions
2122 Don't recognize built-in functions that do not begin with
2123 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2124 functions provided by GCC}, for details of the functions affected,
2125 including those which are not built-in functions when @option{-ansi} or
2126 @option{-std} options for strict ISO C conformance are used because they
2127 do not have an ISO standard meaning.
2128
2129 GCC normally generates special code to handle certain built-in functions
2130 more efficiently; for instance, calls to @code{alloca} may become single
2131 instructions which adjust the stack directly, and calls to @code{memcpy}
2132 may become inline copy loops. The resulting code is often both smaller
2133 and faster, but since the function calls no longer appear as such, you
2134 cannot set a breakpoint on those calls, nor can you change the behavior
2135 of the functions by linking with a different library. In addition,
2136 when a function is recognized as a built-in function, GCC may use
2137 information about that function to warn about problems with calls to
2138 that function, or to generate more efficient code, even if the
2139 resulting code still contains calls to that function. For example,
2140 warnings are given with @option{-Wformat} for bad calls to
2141 @code{printf} when @code{printf} is built in and @code{strlen} is
2142 known not to modify global memory.
2143
2144 With the @option{-fno-builtin-@var{function}} option
2145 only the built-in function @var{function} is
2146 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2147 function is named that is not built-in in this version of GCC, this
2148 option is ignored. There is no corresponding
2149 @option{-fbuiltin-@var{function}} option; if you wish to enable
2150 built-in functions selectively when using @option{-fno-builtin} or
2151 @option{-ffreestanding}, you may define macros such as:
2152
2153 @smallexample
2154 #define abs(n) __builtin_abs ((n))
2155 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2156 @end smallexample
2157
2158 @item -fgimple
2159 @opindex fgimple
2160
2161 Enable parsing of function definitions marked with @code{__GIMPLE}.
2162 This is an experimental feature that allows unit testing of GIMPLE
2163 passes.
2164
2165 @item -fhosted
2166 @opindex fhosted
2167 @cindex hosted environment
2168
2169 Assert that compilation targets a hosted environment. This implies
2170 @option{-fbuiltin}. A hosted environment is one in which the
2171 entire standard library is available, and in which @code{main} has a return
2172 type of @code{int}. Examples are nearly everything except a kernel.
2173 This is equivalent to @option{-fno-freestanding}.
2174
2175 @item -ffreestanding
2176 @opindex ffreestanding
2177 @cindex hosted environment
2178
2179 Assert that compilation targets a freestanding environment. This
2180 implies @option{-fno-builtin}. A freestanding environment
2181 is one in which the standard library may not exist, and program startup may
2182 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2183 This is equivalent to @option{-fno-hosted}.
2184
2185 @xref{Standards,,Language Standards Supported by GCC}, for details of
2186 freestanding and hosted environments.
2187
2188 @item -fopenacc
2189 @opindex fopenacc
2190 @cindex OpenACC accelerator programming
2191 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2192 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2193 compiler generates accelerated code according to the OpenACC Application
2194 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2195 implies @option{-pthread}, and thus is only supported on targets that
2196 have support for @option{-pthread}.
2197
2198 @item -fopenacc-dim=@var{geom}
2199 @opindex fopenacc-dim
2200 @cindex OpenACC accelerator programming
2201 Specify default compute dimensions for parallel offload regions that do
2202 not explicitly specify. The @var{geom} value is a triple of
2203 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2204 can be omitted, to use a target-specific default value.
2205
2206 @item -fopenmp
2207 @opindex fopenmp
2208 @cindex OpenMP parallel
2209 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2210 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2211 compiler generates parallel code according to the OpenMP Application
2212 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2213 implies @option{-pthread}, and thus is only supported on targets that
2214 have support for @option{-pthread}. @option{-fopenmp} implies
2215 @option{-fopenmp-simd}.
2216
2217 @item -fopenmp-simd
2218 @opindex fopenmp-simd
2219 @cindex OpenMP SIMD
2220 @cindex SIMD
2221 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2222 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2223 are ignored.
2224
2225 @item -fgnu-tm
2226 @opindex fgnu-tm
2227 When the option @option{-fgnu-tm} is specified, the compiler
2228 generates code for the Linux variant of Intel's current Transactional
2229 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2230 an experimental feature whose interface may change in future versions
2231 of GCC, as the official specification changes. Please note that not
2232 all architectures are supported for this feature.
2233
2234 For more information on GCC's support for transactional memory,
2235 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2236 Transactional Memory Library}.
2237
2238 Note that the transactional memory feature is not supported with
2239 non-call exceptions (@option{-fnon-call-exceptions}).
2240
2241 @item -fms-extensions
2242 @opindex fms-extensions
2243 Accept some non-standard constructs used in Microsoft header files.
2244
2245 In C++ code, this allows member names in structures to be similar
2246 to previous types declarations.
2247
2248 @smallexample
2249 typedef int UOW;
2250 struct ABC @{
2251 UOW UOW;
2252 @};
2253 @end smallexample
2254
2255 Some cases of unnamed fields in structures and unions are only
2256 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2257 fields within structs/unions}, for details.
2258
2259 Note that this option is off for all targets but x86
2260 targets using ms-abi.
2261
2262 @item -fplan9-extensions
2263 @opindex fplan9-extensions
2264 Accept some non-standard constructs used in Plan 9 code.
2265
2266 This enables @option{-fms-extensions}, permits passing pointers to
2267 structures with anonymous fields to functions that expect pointers to
2268 elements of the type of the field, and permits referring to anonymous
2269 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2270 struct/union fields within structs/unions}, for details. This is only
2271 supported for C, not C++.
2272
2273 @item -fcond-mismatch
2274 @opindex fcond-mismatch
2275 Allow conditional expressions with mismatched types in the second and
2276 third arguments. The value of such an expression is void. This option
2277 is not supported for C++.
2278
2279 @item -flax-vector-conversions
2280 @opindex flax-vector-conversions
2281 Allow implicit conversions between vectors with differing numbers of
2282 elements and/or incompatible element types. This option should not be
2283 used for new code.
2284
2285 @item -funsigned-char
2286 @opindex funsigned-char
2287 Let the type @code{char} be unsigned, like @code{unsigned char}.
2288
2289 Each kind of machine has a default for what @code{char} should
2290 be. It is either like @code{unsigned char} by default or like
2291 @code{signed char} by default.
2292
2293 Ideally, a portable program should always use @code{signed char} or
2294 @code{unsigned char} when it depends on the signedness of an object.
2295 But many programs have been written to use plain @code{char} and
2296 expect it to be signed, or expect it to be unsigned, depending on the
2297 machines they were written for. This option, and its inverse, let you
2298 make such a program work with the opposite default.
2299
2300 The type @code{char} is always a distinct type from each of
2301 @code{signed char} or @code{unsigned char}, even though its behavior
2302 is always just like one of those two.
2303
2304 @item -fsigned-char
2305 @opindex fsigned-char
2306 Let the type @code{char} be signed, like @code{signed char}.
2307
2308 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2309 the negative form of @option{-funsigned-char}. Likewise, the option
2310 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2311
2312 @item -fsigned-bitfields
2313 @itemx -funsigned-bitfields
2314 @itemx -fno-signed-bitfields
2315 @itemx -fno-unsigned-bitfields
2316 @opindex fsigned-bitfields
2317 @opindex funsigned-bitfields
2318 @opindex fno-signed-bitfields
2319 @opindex fno-unsigned-bitfields
2320 These options control whether a bit-field is signed or unsigned, when the
2321 declaration does not use either @code{signed} or @code{unsigned}. By
2322 default, such a bit-field is signed, because this is consistent: the
2323 basic integer types such as @code{int} are signed types.
2324
2325 @item -fsso-struct=@var{endianness}
2326 @opindex fsso-struct
2327 Set the default scalar storage order of structures and unions to the
2328 specified endianness. The accepted values are @samp{big-endian},
2329 @samp{little-endian} and @samp{native} for the native endianness of
2330 the target (the default). This option is not supported for C++.
2331
2332 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2333 code that is not binary compatible with code generated without it if the
2334 specified endianness is not the native endianness of the target.
2335 @end table
2336
2337 @node C++ Dialect Options
2338 @section Options Controlling C++ Dialect
2339
2340 @cindex compiler options, C++
2341 @cindex C++ options, command-line
2342 @cindex options, C++
2343 This section describes the command-line options that are only meaningful
2344 for C++ programs. You can also use most of the GNU compiler options
2345 regardless of what language your program is in. For example, you
2346 might compile a file @file{firstClass.C} like this:
2347
2348 @smallexample
2349 g++ -g -fstrict-enums -O -c firstClass.C
2350 @end smallexample
2351
2352 @noindent
2353 In this example, only @option{-fstrict-enums} is an option meant
2354 only for C++ programs; you can use the other options with any
2355 language supported by GCC@.
2356
2357 Some options for compiling C programs, such as @option{-std}, are also
2358 relevant for C++ programs.
2359 @xref{C Dialect Options,,Options Controlling C Dialect}.
2360
2361 Here is a list of options that are @emph{only} for compiling C++ programs:
2362
2363 @table @gcctabopt
2364
2365 @item -fabi-version=@var{n}
2366 @opindex fabi-version
2367 Use version @var{n} of the C++ ABI@. The default is version 0.
2368
2369 Version 0 refers to the version conforming most closely to
2370 the C++ ABI specification. Therefore, the ABI obtained using version 0
2371 will change in different versions of G++ as ABI bugs are fixed.
2372
2373 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2374
2375 Version 2 is the version of the C++ ABI that first appeared in G++
2376 3.4, and was the default through G++ 4.9.
2377
2378 Version 3 corrects an error in mangling a constant address as a
2379 template argument.
2380
2381 Version 4, which first appeared in G++ 4.5, implements a standard
2382 mangling for vector types.
2383
2384 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2385 attribute const/volatile on function pointer types, decltype of a
2386 plain decl, and use of a function parameter in the declaration of
2387 another parameter.
2388
2389 Version 6, which first appeared in G++ 4.7, corrects the promotion
2390 behavior of C++11 scoped enums and the mangling of template argument
2391 packs, const/static_cast, prefix ++ and --, and a class scope function
2392 used as a template argument.
2393
2394 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2395 builtin type and corrects the mangling of lambdas in default argument
2396 scope.
2397
2398 Version 8, which first appeared in G++ 4.9, corrects the substitution
2399 behavior of function types with function-cv-qualifiers.
2400
2401 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2402 @code{nullptr_t}.
2403
2404 Version 10, which first appeared in G++ 6.1, adds mangling of
2405 attributes that affect type identity, such as ia32 calling convention
2406 attributes (e.g.@: @samp{stdcall}).
2407
2408 Version 11, which first appeared in G++ 7, corrects the mangling of
2409 sizeof... expressions and operator names. For multiple entities with
2410 the same name within a function, that are declared in different scopes,
2411 the mangling now changes starting with the twelfth occurrence. It also
2412 implies @option{-fnew-inheriting-ctors}.
2413
2414 Version 12, which first appeared in G++ 8, corrects the calling
2415 conventions for empty classes on the x86_64 target and for classes
2416 with only deleted copy/move constructors. It accidentally changes the
2417 calling convention for classes with a deleted copy constructor and a
2418 trivial move constructor.
2419
2420 Version 13, which first appeared in G++ 8.2, fixes the accidental
2421 change in version 12.
2422
2423 See also @option{-Wabi}.
2424
2425 @item -fabi-compat-version=@var{n}
2426 @opindex fabi-compat-version
2427 On targets that support strong aliases, G++
2428 works around mangling changes by creating an alias with the correct
2429 mangled name when defining a symbol with an incorrect mangled name.
2430 This switch specifies which ABI version to use for the alias.
2431
2432 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2433 compatibility). If another ABI version is explicitly selected, this
2434 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2435 use @option{-fabi-compat-version=2}.
2436
2437 If this option is not provided but @option{-Wabi=@var{n}} is, that
2438 version is used for compatibility aliases. If this option is provided
2439 along with @option{-Wabi} (without the version), the version from this
2440 option is used for the warning.
2441
2442 @item -fno-access-control
2443 @opindex fno-access-control
2444 @opindex faccess-control
2445 Turn off all access checking. This switch is mainly useful for working
2446 around bugs in the access control code.
2447
2448 @item -faligned-new
2449 @opindex faligned-new
2450 Enable support for C++17 @code{new} of types that require more
2451 alignment than @code{void* ::operator new(std::size_t)} provides. A
2452 numeric argument such as @code{-faligned-new=32} can be used to
2453 specify how much alignment (in bytes) is provided by that function,
2454 but few users will need to override the default of
2455 @code{alignof(std::max_align_t)}.
2456
2457 This flag is enabled by default for @option{-std=c++17}.
2458
2459 @item -fcheck-new
2460 @opindex fcheck-new
2461 Check that the pointer returned by @code{operator new} is non-null
2462 before attempting to modify the storage allocated. This check is
2463 normally unnecessary because the C++ standard specifies that
2464 @code{operator new} only returns @code{0} if it is declared
2465 @code{throw()}, in which case the compiler always checks the
2466 return value even without this option. In all other cases, when
2467 @code{operator new} has a non-empty exception specification, memory
2468 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2469 @samp{new (nothrow)}.
2470
2471 @item -fconcepts
2472 @opindex fconcepts
2473 Enable support for the C++ Extensions for Concepts Technical
2474 Specification, ISO 19217 (2015), which allows code like
2475
2476 @smallexample
2477 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2478 template <Addable T> T add (T a, T b) @{ return a + b; @}
2479 @end smallexample
2480
2481 @item -fconstexpr-depth=@var{n}
2482 @opindex fconstexpr-depth
2483 Set the maximum nested evaluation depth for C++11 constexpr functions
2484 to @var{n}. A limit is needed to detect endless recursion during
2485 constant expression evaluation. The minimum specified by the standard
2486 is 512.
2487
2488 @item -fconstexpr-loop-limit=@var{n}
2489 @opindex fconstexpr-loop-limit
2490 Set the maximum number of iterations for a loop in C++14 constexpr functions
2491 to @var{n}. A limit is needed to detect infinite loops during
2492 constant expression evaluation. The default is 262144 (1<<18).
2493
2494 @item -fdeduce-init-list
2495 @opindex fdeduce-init-list
2496 Enable deduction of a template type parameter as
2497 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2498
2499 @smallexample
2500 template <class T> auto forward(T t) -> decltype (realfn (t))
2501 @{
2502 return realfn (t);
2503 @}
2504
2505 void f()
2506 @{
2507 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2508 @}
2509 @end smallexample
2510
2511 This deduction was implemented as a possible extension to the
2512 originally proposed semantics for the C++11 standard, but was not part
2513 of the final standard, so it is disabled by default. This option is
2514 deprecated, and may be removed in a future version of G++.
2515
2516 @item -fno-elide-constructors
2517 @opindex fno-elide-constructors
2518 @opindex felide-constructors
2519 The C++ standard allows an implementation to omit creating a temporary
2520 that is only used to initialize another object of the same type.
2521 Specifying this option disables that optimization, and forces G++ to
2522 call the copy constructor in all cases. This option also causes G++
2523 to call trivial member functions which otherwise would be expanded inline.
2524
2525 In C++17, the compiler is required to omit these temporaries, but this
2526 option still affects trivial member functions.
2527
2528 @item -fno-enforce-eh-specs
2529 @opindex fno-enforce-eh-specs
2530 @opindex fenforce-eh-specs
2531 Don't generate code to check for violation of exception specifications
2532 at run time. This option violates the C++ standard, but may be useful
2533 for reducing code size in production builds, much like defining
2534 @code{NDEBUG}. This does not give user code permission to throw
2535 exceptions in violation of the exception specifications; the compiler
2536 still optimizes based on the specifications, so throwing an
2537 unexpected exception results in undefined behavior at run time.
2538
2539 @item -fextern-tls-init
2540 @itemx -fno-extern-tls-init
2541 @opindex fextern-tls-init
2542 @opindex fno-extern-tls-init
2543 The C++11 and OpenMP standards allow @code{thread_local} and
2544 @code{threadprivate} variables to have dynamic (runtime)
2545 initialization. To support this, any use of such a variable goes
2546 through a wrapper function that performs any necessary initialization.
2547 When the use and definition of the variable are in the same
2548 translation unit, this overhead can be optimized away, but when the
2549 use is in a different translation unit there is significant overhead
2550 even if the variable doesn't actually need dynamic initialization. If
2551 the programmer can be sure that no use of the variable in a
2552 non-defining TU needs to trigger dynamic initialization (either
2553 because the variable is statically initialized, or a use of the
2554 variable in the defining TU will be executed before any uses in
2555 another TU), they can avoid this overhead with the
2556 @option{-fno-extern-tls-init} option.
2557
2558 On targets that support symbol aliases, the default is
2559 @option{-fextern-tls-init}. On targets that do not support symbol
2560 aliases, the default is @option{-fno-extern-tls-init}.
2561
2562 @item -fno-gnu-keywords
2563 @opindex fno-gnu-keywords
2564 @opindex fgnu-keywords
2565 Do not recognize @code{typeof} as a keyword, so that code can use this
2566 word as an identifier. You can use the keyword @code{__typeof__} instead.
2567 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2568 @option{-std=c++98}, @option{-std=c++11}, etc.
2569
2570 @item -fno-implicit-templates
2571 @opindex fno-implicit-templates
2572 @opindex fimplicit-templates
2573 Never emit code for non-inline templates that are instantiated
2574 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2575 @xref{Template Instantiation}, for more information.
2576
2577 @item -fno-implicit-inline-templates
2578 @opindex fno-implicit-inline-templates
2579 @opindex fimplicit-inline-templates
2580 Don't emit code for implicit instantiations of inline templates, either.
2581 The default is to handle inlines differently so that compiles with and
2582 without optimization need the same set of explicit instantiations.
2583
2584 @item -fno-implement-inlines
2585 @opindex fno-implement-inlines
2586 @opindex fimplement-inlines
2587 To save space, do not emit out-of-line copies of inline functions
2588 controlled by @code{#pragma implementation}. This causes linker
2589 errors if these functions are not inlined everywhere they are called.
2590
2591 @item -fms-extensions
2592 @opindex fms-extensions
2593 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2594 int and getting a pointer to member function via non-standard syntax.
2595
2596 @item -fnew-inheriting-ctors
2597 @opindex fnew-inheriting-ctors
2598 Enable the P0136 adjustment to the semantics of C++11 constructor
2599 inheritance. This is part of C++17 but also considered to be a Defect
2600 Report against C++11 and C++14. This flag is enabled by default
2601 unless @option{-fabi-version=10} or lower is specified.
2602
2603 @item -fnew-ttp-matching
2604 @opindex fnew-ttp-matching
2605 Enable the P0522 resolution to Core issue 150, template template
2606 parameters and default arguments: this allows a template with default
2607 template arguments as an argument for a template template parameter
2608 with fewer template parameters. This flag is enabled by default for
2609 @option{-std=c++17}.
2610
2611 @item -fno-nonansi-builtins
2612 @opindex fno-nonansi-builtins
2613 @opindex fnonansi-builtins
2614 Disable built-in declarations of functions that are not mandated by
2615 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2616 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2617
2618 @item -fnothrow-opt
2619 @opindex fnothrow-opt
2620 Treat a @code{throw()} exception specification as if it were a
2621 @code{noexcept} specification to reduce or eliminate the text size
2622 overhead relative to a function with no exception specification. If
2623 the function has local variables of types with non-trivial
2624 destructors, the exception specification actually makes the
2625 function smaller because the EH cleanups for those variables can be
2626 optimized away. The semantic effect is that an exception thrown out of
2627 a function with such an exception specification results in a call
2628 to @code{terminate} rather than @code{unexpected}.
2629
2630 @item -fno-operator-names
2631 @opindex fno-operator-names
2632 @opindex foperator-names
2633 Do not treat the operator name keywords @code{and}, @code{bitand},
2634 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2635 synonyms as keywords.
2636
2637 @item -fno-optional-diags
2638 @opindex fno-optional-diags
2639 @opindex foptional-diags
2640 Disable diagnostics that the standard says a compiler does not need to
2641 issue. Currently, the only such diagnostic issued by G++ is the one for
2642 a name having multiple meanings within a class.
2643
2644 @item -fpermissive
2645 @opindex fpermissive
2646 Downgrade some diagnostics about nonconformant code from errors to
2647 warnings. Thus, using @option{-fpermissive} allows some
2648 nonconforming code to compile.
2649
2650 @item -fno-pretty-templates
2651 @opindex fno-pretty-templates
2652 @opindex fpretty-templates
2653 When an error message refers to a specialization of a function
2654 template, the compiler normally prints the signature of the
2655 template followed by the template arguments and any typedefs or
2656 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2657 rather than @code{void f(int)}) so that it's clear which template is
2658 involved. When an error message refers to a specialization of a class
2659 template, the compiler omits any template arguments that match
2660 the default template arguments for that template. If either of these
2661 behaviors make it harder to understand the error message rather than
2662 easier, you can use @option{-fno-pretty-templates} to disable them.
2663
2664 @item -frepo
2665 @opindex frepo
2666 Enable automatic template instantiation at link time. This option also
2667 implies @option{-fno-implicit-templates}. @xref{Template
2668 Instantiation}, for more information.
2669
2670 @item -fno-rtti
2671 @opindex fno-rtti
2672 @opindex frtti
2673 Disable generation of information about every class with virtual
2674 functions for use by the C++ run-time type identification features
2675 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2676 of the language, you can save some space by using this flag. Note that
2677 exception handling uses the same information, but G++ generates it as
2678 needed. The @code{dynamic_cast} operator can still be used for casts that
2679 do not require run-time type information, i.e.@: casts to @code{void *} or to
2680 unambiguous base classes.
2681
2682 Mixing code compiled with @option{-frtti} with that compiled with
2683 @option{-fno-rtti} may not work. For example, programs may
2684 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2685 for a class compiled with @option{-frtti}.
2686
2687 @item -fsized-deallocation
2688 @opindex fsized-deallocation
2689 Enable the built-in global declarations
2690 @smallexample
2691 void operator delete (void *, std::size_t) noexcept;
2692 void operator delete[] (void *, std::size_t) noexcept;
2693 @end smallexample
2694 as introduced in C++14. This is useful for user-defined replacement
2695 deallocation functions that, for example, use the size of the object
2696 to make deallocation faster. Enabled by default under
2697 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2698 warns about places that might want to add a definition.
2699
2700 @item -fstrict-enums
2701 @opindex fstrict-enums
2702 Allow the compiler to optimize using the assumption that a value of
2703 enumerated type can only be one of the values of the enumeration (as
2704 defined in the C++ standard; basically, a value that can be
2705 represented in the minimum number of bits needed to represent all the
2706 enumerators). This assumption may not be valid if the program uses a
2707 cast to convert an arbitrary integer value to the enumerated type.
2708
2709 @item -fstrong-eval-order
2710 @opindex fstrong-eval-order
2711 Evaluate member access, array subscripting, and shift expressions in
2712 left-to-right order, and evaluate assignment in right-to-left order,
2713 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2714 @option{-fstrong-eval-order=some} enables just the ordering of member
2715 access and shift expressions, and is the default without
2716 @option{-std=c++17}.
2717
2718 @item -ftemplate-backtrace-limit=@var{n}
2719 @opindex ftemplate-backtrace-limit
2720 Set the maximum number of template instantiation notes for a single
2721 warning or error to @var{n}. The default value is 10.
2722
2723 @item -ftemplate-depth=@var{n}
2724 @opindex ftemplate-depth
2725 Set the maximum instantiation depth for template classes to @var{n}.
2726 A limit on the template instantiation depth is needed to detect
2727 endless recursions during template class instantiation. ANSI/ISO C++
2728 conforming programs must not rely on a maximum depth greater than 17
2729 (changed to 1024 in C++11). The default value is 900, as the compiler
2730 can run out of stack space before hitting 1024 in some situations.
2731
2732 @item -fno-threadsafe-statics
2733 @opindex fno-threadsafe-statics
2734 @opindex fthreadsafe-statics
2735 Do not emit the extra code to use the routines specified in the C++
2736 ABI for thread-safe initialization of local statics. You can use this
2737 option to reduce code size slightly in code that doesn't need to be
2738 thread-safe.
2739
2740 @item -fuse-cxa-atexit
2741 @opindex fuse-cxa-atexit
2742 Register destructors for objects with static storage duration with the
2743 @code{__cxa_atexit} function rather than the @code{atexit} function.
2744 This option is required for fully standards-compliant handling of static
2745 destructors, but only works if your C library supports
2746 @code{__cxa_atexit}.
2747
2748 @item -fno-use-cxa-get-exception-ptr
2749 @opindex fno-use-cxa-get-exception-ptr
2750 @opindex fuse-cxa-get-exception-ptr
2751 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2752 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2753 if the runtime routine is not available.
2754
2755 @item -fvisibility-inlines-hidden
2756 @opindex fvisibility-inlines-hidden
2757 This switch declares that the user does not attempt to compare
2758 pointers to inline functions or methods where the addresses of the two functions
2759 are taken in different shared objects.
2760
2761 The effect of this is that GCC may, effectively, mark inline methods with
2762 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2763 appear in the export table of a DSO and do not require a PLT indirection
2764 when used within the DSO@. Enabling this option can have a dramatic effect
2765 on load and link times of a DSO as it massively reduces the size of the
2766 dynamic export table when the library makes heavy use of templates.
2767
2768 The behavior of this switch is not quite the same as marking the
2769 methods as hidden directly, because it does not affect static variables
2770 local to the function or cause the compiler to deduce that
2771 the function is defined in only one shared object.
2772
2773 You may mark a method as having a visibility explicitly to negate the
2774 effect of the switch for that method. For example, if you do want to
2775 compare pointers to a particular inline method, you might mark it as
2776 having default visibility. Marking the enclosing class with explicit
2777 visibility has no effect.
2778
2779 Explicitly instantiated inline methods are unaffected by this option
2780 as their linkage might otherwise cross a shared library boundary.
2781 @xref{Template Instantiation}.
2782
2783 @item -fvisibility-ms-compat
2784 @opindex fvisibility-ms-compat
2785 This flag attempts to use visibility settings to make GCC's C++
2786 linkage model compatible with that of Microsoft Visual Studio.
2787
2788 The flag makes these changes to GCC's linkage model:
2789
2790 @enumerate
2791 @item
2792 It sets the default visibility to @code{hidden}, like
2793 @option{-fvisibility=hidden}.
2794
2795 @item
2796 Types, but not their members, are not hidden by default.
2797
2798 @item
2799 The One Definition Rule is relaxed for types without explicit
2800 visibility specifications that are defined in more than one
2801 shared object: those declarations are permitted if they are
2802 permitted when this option is not used.
2803 @end enumerate
2804
2805 In new code it is better to use @option{-fvisibility=hidden} and
2806 export those classes that are intended to be externally visible.
2807 Unfortunately it is possible for code to rely, perhaps accidentally,
2808 on the Visual Studio behavior.
2809
2810 Among the consequences of these changes are that static data members
2811 of the same type with the same name but defined in different shared
2812 objects are different, so changing one does not change the other;
2813 and that pointers to function members defined in different shared
2814 objects may not compare equal. When this flag is given, it is a
2815 violation of the ODR to define types with the same name differently.
2816
2817 @item -fno-weak
2818 @opindex fno-weak
2819 @opindex fweak
2820 Do not use weak symbol support, even if it is provided by the linker.
2821 By default, G++ uses weak symbols if they are available. This
2822 option exists only for testing, and should not be used by end-users;
2823 it results in inferior code and has no benefits. This option may
2824 be removed in a future release of G++.
2825
2826 @item -nostdinc++
2827 @opindex nostdinc++
2828 Do not search for header files in the standard directories specific to
2829 C++, but do still search the other standard directories. (This option
2830 is used when building the C++ library.)
2831 @end table
2832
2833 In addition, these optimization, warning, and code generation options
2834 have meanings only for C++ programs:
2835
2836 @table @gcctabopt
2837 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2838 @opindex Wabi
2839 @opindex Wno-abi
2840 Warn when G++ it generates code that is probably not compatible with
2841 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2842 ABI with each major release, normally @option{-Wabi} will warn only if
2843 there is a check added later in a release series for an ABI issue
2844 discovered since the initial release. @option{-Wabi} will warn about
2845 more things if an older ABI version is selected (with
2846 @option{-fabi-version=@var{n}}).
2847
2848 @option{-Wabi} can also be used with an explicit version number to
2849 warn about compatibility with a particular @option{-fabi-version}
2850 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2851 @option{-fabi-version=2}.
2852
2853 If an explicit version number is provided and
2854 @option{-fabi-compat-version} is not specified, the version number
2855 from this option is used for compatibility aliases. If no explicit
2856 version number is provided with this option, but
2857 @option{-fabi-compat-version} is specified, that version number is
2858 used for ABI warnings.
2859
2860 Although an effort has been made to warn about
2861 all such cases, there are probably some cases that are not warned about,
2862 even though G++ is generating incompatible code. There may also be
2863 cases where warnings are emitted even though the code that is generated
2864 is compatible.
2865
2866 You should rewrite your code to avoid these warnings if you are
2867 concerned about the fact that code generated by G++ may not be binary
2868 compatible with code generated by other compilers.
2869
2870 Known incompatibilities in @option{-fabi-version=2} (which was the
2871 default from GCC 3.4 to 4.9) include:
2872
2873 @itemize @bullet
2874
2875 @item
2876 A template with a non-type template parameter of reference type was
2877 mangled incorrectly:
2878 @smallexample
2879 extern int N;
2880 template <int &> struct S @{@};
2881 void n (S<N>) @{2@}
2882 @end smallexample
2883
2884 This was fixed in @option{-fabi-version=3}.
2885
2886 @item
2887 SIMD vector types declared using @code{__attribute ((vector_size))} were
2888 mangled in a non-standard way that does not allow for overloading of
2889 functions taking vectors of different sizes.
2890
2891 The mangling was changed in @option{-fabi-version=4}.
2892
2893 @item
2894 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2895 qualifiers, and @code{decltype} of a plain declaration was folded away.
2896
2897 These mangling issues were fixed in @option{-fabi-version=5}.
2898
2899 @item
2900 Scoped enumerators passed as arguments to a variadic function are
2901 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2902 On most targets this does not actually affect the parameter passing
2903 ABI, as there is no way to pass an argument smaller than @code{int}.
2904
2905 Also, the ABI changed the mangling of template argument packs,
2906 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2907 a class scope function used as a template argument.
2908
2909 These issues were corrected in @option{-fabi-version=6}.
2910
2911 @item
2912 Lambdas in default argument scope were mangled incorrectly, and the
2913 ABI changed the mangling of @code{nullptr_t}.
2914
2915 These issues were corrected in @option{-fabi-version=7}.
2916
2917 @item
2918 When mangling a function type with function-cv-qualifiers, the
2919 un-qualified function type was incorrectly treated as a substitution
2920 candidate.
2921
2922 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2923
2924 @item
2925 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2926 unaligned accesses. Note that this did not affect the ABI of a
2927 function with a @code{nullptr_t} parameter, as parameters have a
2928 minimum alignment.
2929
2930 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2931
2932 @item
2933 Target-specific attributes that affect the identity of a type, such as
2934 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2935 did not affect the mangled name, leading to name collisions when
2936 function pointers were used as template arguments.
2937
2938 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2939
2940 @end itemize
2941
2942 It also warns about psABI-related changes. The known psABI changes at this
2943 point include:
2944
2945 @itemize @bullet
2946
2947 @item
2948 For SysV/x86-64, unions with @code{long double} members are
2949 passed in memory as specified in psABI. For example:
2950
2951 @smallexample
2952 union U @{
2953 long double ld;
2954 int i;
2955 @};
2956 @end smallexample
2957
2958 @noindent
2959 @code{union U} is always passed in memory.
2960
2961 @end itemize
2962
2963 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2964 @opindex Wabi-tag
2965 @opindex Wabi-tag
2966 Warn when a type with an ABI tag is used in a context that does not
2967 have that ABI tag. See @ref{C++ Attributes} for more information
2968 about ABI tags.
2969
2970 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2971 @opindex Wctor-dtor-privacy
2972 @opindex Wno-ctor-dtor-privacy
2973 Warn when a class seems unusable because all the constructors or
2974 destructors in that class are private, and it has neither friends nor
2975 public static member functions. Also warn if there are no non-private
2976 methods, and there's at least one private member function that isn't
2977 a constructor or destructor.
2978
2979 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2980 @opindex Wdelete-non-virtual-dtor
2981 @opindex Wno-delete-non-virtual-dtor
2982 Warn when @code{delete} is used to destroy an instance of a class that
2983 has virtual functions and non-virtual destructor. It is unsafe to delete
2984 an instance of a derived class through a pointer to a base class if the
2985 base class does not have a virtual destructor. This warning is enabled
2986 by @option{-Wall}.
2987
2988 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
2989 @opindex Wdeprecated-copy
2990 @opindex Wno-deprecated-copy
2991 Warn that the implicit declaration of a copy constructor or copy
2992 assignment operator is deprecated if the class has a user-provided
2993 copy constructor, copy assignment operator, or destructor, in C++11
2994 and up. This warning is enabled by @option{-Wall}.
2995
2996 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
2997 @opindex Winit-list-lifetime
2998 @opindex Wno-init-list-lifetime
2999 Do not warn about uses of @code{std::initializer_list} that are likely
3000 to result in dangling pointers. Since the underlying array for an
3001 @code{initializer_list} is handled like a normal C++ temporary object,
3002 it is easy to inadvertently keep a pointer to the array past the end
3003 of the array's lifetime. For example:
3004
3005 @itemize @bullet
3006 @item
3007 If a function returns a temporary @code{initializer_list}, or a local
3008 @code{initializer_list} variable, the array's lifetime ends at the end
3009 of the return statement, so the value returned has a dangling pointer.
3010
3011 @item
3012 If a new-expression creates an @code{initializer_list}, the array only
3013 lives until the end of the enclosing full-expression, so the
3014 @code{initializer_list} in the heap has a dangling pointer.
3015
3016 @item
3017 When an @code{initializer_list} variable is assigned from a
3018 brace-enclosed initializer list, the temporary array created for the
3019 right side of the assignment only lives until the end of the
3020 full-expression, so at the next statement the @code{initializer_list}
3021 variable has a dangling pointer.
3022
3023 @smallexample
3024 // li's initial underlying array lives as long as li
3025 std::initializer_list<int> li = @{ 1,2,3 @};
3026 // assignment changes li to point to a temporary array
3027 li = @{ 4, 5 @};
3028 // now the temporary is gone and li has a dangling pointer
3029 int i = li.begin()[0] // undefined behavior
3030 @end smallexample
3031
3032 @item
3033 When a list constructor stores the @code{begin} pointer from the
3034 @code{initializer_list} argument, this doesn't extend the lifetime of
3035 the array, so if a class variable is constructed from a temporary
3036 @code{initializer_list}, the pointer is left dangling by the end of
3037 the variable declaration statement.
3038
3039 @end itemize
3040
3041 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3042 @opindex Wliteral-suffix
3043 @opindex Wno-literal-suffix
3044 Warn when a string or character literal is followed by a ud-suffix which does
3045 not begin with an underscore. As a conforming extension, GCC treats such
3046 suffixes as separate preprocessing tokens in order to maintain backwards
3047 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3048 For example:
3049
3050 @smallexample
3051 #define __STDC_FORMAT_MACROS
3052 #include <inttypes.h>
3053 #include <stdio.h>
3054
3055 int main() @{
3056 int64_t i64 = 123;
3057 printf("My int64: %" PRId64"\n", i64);
3058 @}
3059 @end smallexample
3060
3061 In this case, @code{PRId64} is treated as a separate preprocessing token.
3062
3063 Additionally, warn when a user-defined literal operator is declared with
3064 a literal suffix identifier that doesn't begin with an underscore. Literal
3065 suffix identifiers that don't begin with an underscore are reserved for
3066 future standardization.
3067
3068 This warning is enabled by default.
3069
3070 @item -Wlto-type-mismatch
3071 @opindex Wlto-type-mismatch
3072 @opindex Wno-lto-type-mismatch
3073
3074 During the link-time optimization warn about type mismatches in
3075 global declarations from different compilation units.
3076 Requires @option{-flto} to be enabled. Enabled by default.
3077
3078 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3079 @opindex Wnarrowing
3080 @opindex Wno-narrowing
3081 For C++11 and later standards, narrowing conversions are diagnosed by default,
3082 as required by the standard. A narrowing conversion from a constant produces
3083 an error, and a narrowing conversion from a non-constant produces a warning,
3084 but @option{-Wno-narrowing} suppresses the diagnostic.
3085 Note that this does not affect the meaning of well-formed code;
3086 narrowing conversions are still considered ill-formed in SFINAE contexts.
3087
3088 With @option{-Wnarrowing} in C++98, warn when a narrowing
3089 conversion prohibited by C++11 occurs within
3090 @samp{@{ @}}, e.g.
3091
3092 @smallexample
3093 int i = @{ 2.2 @}; // error: narrowing from double to int
3094 @end smallexample
3095
3096 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3097
3098 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3099 @opindex Wnoexcept
3100 @opindex Wno-noexcept
3101 Warn when a noexcept-expression evaluates to false because of a call
3102 to a function that does not have a non-throwing exception
3103 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3104 the compiler to never throw an exception.
3105
3106 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3107 @opindex Wnoexcept-type
3108 @opindex Wno-noexcept-type
3109 Warn if the C++17 feature making @code{noexcept} part of a function
3110 type changes the mangled name of a symbol relative to C++14. Enabled
3111 by @option{-Wabi} and @option{-Wc++17-compat}.
3112
3113 As an example:
3114
3115 @smallexample
3116 template <class T> void f(T t) @{ t(); @};
3117 void g() noexcept;
3118 void h() @{ f(g); @}
3119 @end smallexample
3120
3121 @noindent
3122 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3123 C++17 it calls @code{f<void(*)()noexcept>}.
3124
3125 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3126 @opindex Wclass-memaccess
3127 @opindex Wno-class-memaccess
3128 Warn when the destination of a call to a raw memory function such as
3129 @code{memset} or @code{memcpy} is an object of class type, and when writing
3130 into such an object might bypass the class non-trivial or deleted constructor
3131 or copy assignment, violate const-correctness or encapsulation, or corrupt
3132 virtual table pointers. Modifying the representation of such objects may
3133 violate invariants maintained by member functions of the class. For example,
3134 the call to @code{memset} below is undefined because it modifies a non-trivial
3135 class object and is, therefore, diagnosed. The safe way to either initialize
3136 or clear the storage of objects of such types is by using the appropriate
3137 constructor or assignment operator, if one is available.
3138 @smallexample
3139 std::string str = "abc";
3140 memset (&str, 0, sizeof str);
3141 @end smallexample
3142 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3143 Explicitly casting the pointer to the class object to @code{void *} or
3144 to a type that can be safely accessed by the raw memory function suppresses
3145 the warning.
3146
3147 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3148 @opindex Wnon-virtual-dtor
3149 @opindex Wno-non-virtual-dtor
3150 Warn when a class has virtual functions and an accessible non-virtual
3151 destructor itself or in an accessible polymorphic base class, in which
3152 case it is possible but unsafe to delete an instance of a derived
3153 class through a pointer to the class itself or base class. This
3154 warning is automatically enabled if @option{-Weffc++} is specified.
3155
3156 @item -Wregister @r{(C++ and Objective-C++ only)}
3157 @opindex Wregister
3158 @opindex Wno-register
3159 Warn on uses of the @code{register} storage class specifier, except
3160 when it is part of the GNU @ref{Explicit Register Variables} extension.
3161 The use of the @code{register} keyword as storage class specifier has
3162 been deprecated in C++11 and removed in C++17.
3163 Enabled by default with @option{-std=c++17}.
3164
3165 @item -Wreorder @r{(C++ and Objective-C++ only)}
3166 @opindex Wreorder
3167 @opindex Wno-reorder
3168 @cindex reordering, warning
3169 @cindex warning for reordering of member initializers
3170 Warn when the order of member initializers given in the code does not
3171 match the order in which they must be executed. For instance:
3172
3173 @smallexample
3174 struct A @{
3175 int i;
3176 int j;
3177 A(): j (0), i (1) @{ @}
3178 @};
3179 @end smallexample
3180
3181 @noindent
3182 The compiler rearranges the member initializers for @code{i}
3183 and @code{j} to match the declaration order of the members, emitting
3184 a warning to that effect. This warning is enabled by @option{-Wall}.
3185
3186 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3187 @opindex Wpessimizing-move
3188 @opindex Wno-pessimizing-move
3189 This warning warns when a call to @code{std::move} prevents copy
3190 elision. A typical scenario when copy elision can occur is when returning in
3191 a function with a class return type, when the expression being returned is the
3192 name of a non-volatile automatic object, and is not a function parameter, and
3193 has the same type as the function return type.
3194
3195 @smallexample
3196 struct T @{
3197 @dots{}
3198 @};
3199 T fn()
3200 @{
3201 T t;
3202 @dots{}
3203 return std::move (t);
3204 @}
3205 @end smallexample
3206
3207 But in this example, the @code{std::move} call prevents copy elision.
3208
3209 This warning is enabled by @option{-Wall}.
3210
3211 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3212 @opindex Wredundant-move
3213 @opindex Wno-redundant-move
3214 This warning warns about redundant calls to @code{std::move}; that is, when
3215 a move operation would have been performed even without the @code{std::move}
3216 call. This happens because the compiler is forced to treat the object as if
3217 it were an rvalue in certain situations such as returning a local variable,
3218 where copy elision isn't applicable. Consider:
3219
3220 @smallexample
3221 struct T @{
3222 @dots{}
3223 @};
3224 T fn(T t)
3225 @{
3226 @dots{}
3227 return std::move (t);
3228 @}
3229 @end smallexample
3230
3231 Here, the @code{std::move} call is redundant. Because G++ implements Core
3232 Issue 1579, another example is:
3233
3234 @smallexample
3235 struct T @{ // convertible to U
3236 @dots{}
3237 @};
3238 struct U @{
3239 @dots{}
3240 @};
3241 U fn()
3242 @{
3243 T t;
3244 @dots{}
3245 return std::move (t);
3246 @}
3247 @end smallexample
3248 In this example, copy elision isn't applicable because the type of the
3249 expression being returned and the function return type differ, yet G++
3250 treats the return value as if it were designated by an rvalue.
3251
3252 This warning is enabled by @option{-Wextra}.
3253
3254 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3255 @opindex fext-numeric-literals
3256 @opindex fno-ext-numeric-literals
3257 Accept imaginary, fixed-point, or machine-defined
3258 literal number suffixes as GNU extensions.
3259 When this option is turned off these suffixes are treated
3260 as C++11 user-defined literal numeric suffixes.
3261 This is on by default for all pre-C++11 dialects and all GNU dialects:
3262 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3263 @option{-std=gnu++14}.
3264 This option is off by default
3265 for ISO C++11 onwards (@option{-std=c++11}, ...).
3266 @end table
3267
3268 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3269
3270 @table @gcctabopt
3271 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3272 @opindex Weffc++
3273 @opindex Wno-effc++
3274 Warn about violations of the following style guidelines from Scott Meyers'
3275 @cite{Effective C++} series of books:
3276
3277 @itemize @bullet
3278 @item
3279 Define a copy constructor and an assignment operator for classes
3280 with dynamically-allocated memory.
3281
3282 @item
3283 Prefer initialization to assignment in constructors.
3284
3285 @item
3286 Have @code{operator=} return a reference to @code{*this}.
3287
3288 @item
3289 Don't try to return a reference when you must return an object.
3290
3291 @item
3292 Distinguish between prefix and postfix forms of increment and
3293 decrement operators.
3294
3295 @item
3296 Never overload @code{&&}, @code{||}, or @code{,}.
3297
3298 @end itemize
3299
3300 This option also enables @option{-Wnon-virtual-dtor}, which is also
3301 one of the effective C++ recommendations. However, the check is
3302 extended to warn about the lack of virtual destructor in accessible
3303 non-polymorphic bases classes too.
3304
3305 When selecting this option, be aware that the standard library
3306 headers do not obey all of these guidelines; use @samp{grep -v}
3307 to filter out those warnings.
3308
3309 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3310 @opindex Wstrict-null-sentinel
3311 @opindex Wno-strict-null-sentinel
3312 Warn about the use of an uncasted @code{NULL} as sentinel. When
3313 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3314 to @code{__null}. Although it is a null pointer constant rather than a
3315 null pointer, it is guaranteed to be of the same size as a pointer.
3316 But this use is not portable across different compilers.
3317
3318 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3319 @opindex Wno-non-template-friend
3320 @opindex Wnon-template-friend
3321 Disable warnings when non-template friend functions are declared
3322 within a template. In very old versions of GCC that predate implementation
3323 of the ISO standard, declarations such as
3324 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3325 could be interpreted as a particular specialization of a template
3326 function; the warning exists to diagnose compatibility problems,
3327 and is enabled by default.
3328
3329 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3330 @opindex Wold-style-cast
3331 @opindex Wno-old-style-cast
3332 Warn if an old-style (C-style) cast to a non-void type is used within
3333 a C++ program. The new-style casts (@code{dynamic_cast},
3334 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3335 less vulnerable to unintended effects and much easier to search for.
3336
3337 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3338 @opindex Woverloaded-virtual
3339 @opindex Wno-overloaded-virtual
3340 @cindex overloaded virtual function, warning
3341 @cindex warning for overloaded virtual function
3342 Warn when a function declaration hides virtual functions from a
3343 base class. For example, in:
3344
3345 @smallexample
3346 struct A @{
3347 virtual void f();
3348 @};
3349
3350 struct B: public A @{
3351 void f(int);
3352 @};
3353 @end smallexample
3354
3355 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3356 like:
3357
3358 @smallexample
3359 B* b;
3360 b->f();
3361 @end smallexample
3362
3363 @noindent
3364 fails to compile.
3365
3366 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3367 @opindex Wno-pmf-conversions
3368 @opindex Wpmf-conversions
3369 Disable the diagnostic for converting a bound pointer to member function
3370 to a plain pointer.
3371
3372 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3373 @opindex Wsign-promo
3374 @opindex Wno-sign-promo
3375 Warn when overload resolution chooses a promotion from unsigned or
3376 enumerated type to a signed type, over a conversion to an unsigned type of
3377 the same size. Previous versions of G++ tried to preserve
3378 unsignedness, but the standard mandates the current behavior.
3379
3380 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3381 @opindex Wtemplates
3382 @opindex Wno-templates
3383 Warn when a primary template declaration is encountered. Some coding
3384 rules disallow templates, and this may be used to enforce that rule.
3385 The warning is inactive inside a system header file, such as the STL, so
3386 one can still use the STL. One may also instantiate or specialize
3387 templates.
3388
3389 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3390 @opindex Wmultiple-inheritance
3391 @opindex Wno-multiple-inheritance
3392 Warn when a class is defined with multiple direct base classes. Some
3393 coding rules disallow multiple inheritance, and this may be used to
3394 enforce that rule. The warning is inactive inside a system header file,
3395 such as the STL, so one can still use the STL. One may also define
3396 classes that indirectly use multiple inheritance.
3397
3398 @item -Wvirtual-inheritance
3399 @opindex Wvirtual-inheritance
3400 @opindex Wno-virtual-inheritance
3401 Warn when a class is defined with a virtual direct base class. Some
3402 coding rules disallow multiple inheritance, and this may be used to
3403 enforce that rule. The warning is inactive inside a system header file,
3404 such as the STL, so one can still use the STL. One may also define
3405 classes that indirectly use virtual inheritance.
3406
3407 @item -Wnamespaces
3408 @opindex Wnamespaces
3409 @opindex Wno-namespaces
3410 Warn when a namespace definition is opened. Some coding rules disallow
3411 namespaces, and this may be used to enforce that rule. The warning is
3412 inactive inside a system header file, such as the STL, so one can still
3413 use the STL. One may also use using directives and qualified names.
3414
3415 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3416 @opindex Wterminate
3417 @opindex Wno-terminate
3418 Disable the warning about a throw-expression that will immediately
3419 result in a call to @code{terminate}.
3420
3421 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3422 @opindex Wno-class-conversion
3423 @opindex Wclass-conversion
3424 Disable the warning about the case when a conversion function converts an
3425 object to the same type, to a base class of that type, or to void; such
3426 a conversion function will never be called.
3427 @end table
3428
3429 @node Objective-C and Objective-C++ Dialect Options
3430 @section Options Controlling Objective-C and Objective-C++ Dialects
3431
3432 @cindex compiler options, Objective-C and Objective-C++
3433 @cindex Objective-C and Objective-C++ options, command-line
3434 @cindex options, Objective-C and Objective-C++
3435 (NOTE: This manual does not describe the Objective-C and Objective-C++
3436 languages themselves. @xref{Standards,,Language Standards
3437 Supported by GCC}, for references.)
3438
3439 This section describes the command-line options that are only meaningful
3440 for Objective-C and Objective-C++ programs. You can also use most of
3441 the language-independent GNU compiler options.
3442 For example, you might compile a file @file{some_class.m} like this:
3443
3444 @smallexample
3445 gcc -g -fgnu-runtime -O -c some_class.m
3446 @end smallexample
3447
3448 @noindent
3449 In this example, @option{-fgnu-runtime} is an option meant only for
3450 Objective-C and Objective-C++ programs; you can use the other options with
3451 any language supported by GCC@.
3452
3453 Note that since Objective-C is an extension of the C language, Objective-C
3454 compilations may also use options specific to the C front-end (e.g.,
3455 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3456 C++-specific options (e.g., @option{-Wabi}).
3457
3458 Here is a list of options that are @emph{only} for compiling Objective-C
3459 and Objective-C++ programs:
3460
3461 @table @gcctabopt
3462 @item -fconstant-string-class=@var{class-name}
3463 @opindex fconstant-string-class
3464 Use @var{class-name} as the name of the class to instantiate for each
3465 literal string specified with the syntax @code{@@"@dots{}"}. The default
3466 class name is @code{NXConstantString} if the GNU runtime is being used, and
3467 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3468 @option{-fconstant-cfstrings} option, if also present, overrides the
3469 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3470 to be laid out as constant CoreFoundation strings.
3471
3472 @item -fgnu-runtime
3473 @opindex fgnu-runtime
3474 Generate object code compatible with the standard GNU Objective-C
3475 runtime. This is the default for most types of systems.
3476
3477 @item -fnext-runtime
3478 @opindex fnext-runtime
3479 Generate output compatible with the NeXT runtime. This is the default
3480 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3481 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3482 used.
3483
3484 @item -fno-nil-receivers
3485 @opindex fno-nil-receivers
3486 @opindex fnil-receivers
3487 Assume that all Objective-C message dispatches (@code{[receiver
3488 message:arg]}) in this translation unit ensure that the receiver is
3489 not @code{nil}. This allows for more efficient entry points in the
3490 runtime to be used. This option is only available in conjunction with
3491 the NeXT runtime and ABI version 0 or 1.
3492
3493 @item -fobjc-abi-version=@var{n}
3494 @opindex fobjc-abi-version
3495 Use version @var{n} of the Objective-C ABI for the selected runtime.
3496 This option is currently supported only for the NeXT runtime. In that
3497 case, Version 0 is the traditional (32-bit) ABI without support for
3498 properties and other Objective-C 2.0 additions. Version 1 is the
3499 traditional (32-bit) ABI with support for properties and other
3500 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3501 nothing is specified, the default is Version 0 on 32-bit target
3502 machines, and Version 2 on 64-bit target machines.
3503
3504 @item -fobjc-call-cxx-cdtors
3505 @opindex fobjc-call-cxx-cdtors
3506 For each Objective-C class, check if any of its instance variables is a
3507 C++ object with a non-trivial default constructor. If so, synthesize a
3508 special @code{- (id) .cxx_construct} instance method which runs
3509 non-trivial default constructors on any such instance variables, in order,
3510 and then return @code{self}. Similarly, check if any instance variable
3511 is a C++ object with a non-trivial destructor, and if so, synthesize a
3512 special @code{- (void) .cxx_destruct} method which runs
3513 all such default destructors, in reverse order.
3514
3515 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3516 methods thusly generated only operate on instance variables
3517 declared in the current Objective-C class, and not those inherited
3518 from superclasses. It is the responsibility of the Objective-C
3519 runtime to invoke all such methods in an object's inheritance
3520 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3521 by the runtime immediately after a new object instance is allocated;
3522 the @code{- (void) .cxx_destruct} methods are invoked immediately
3523 before the runtime deallocates an object instance.
3524
3525 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3526 support for invoking the @code{- (id) .cxx_construct} and
3527 @code{- (void) .cxx_destruct} methods.
3528
3529 @item -fobjc-direct-dispatch
3530 @opindex fobjc-direct-dispatch
3531 Allow fast jumps to the message dispatcher. On Darwin this is
3532 accomplished via the comm page.
3533
3534 @item -fobjc-exceptions
3535 @opindex fobjc-exceptions
3536 Enable syntactic support for structured exception handling in
3537 Objective-C, similar to what is offered by C++. This option
3538 is required to use the Objective-C keywords @code{@@try},
3539 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3540 @code{@@synchronized}. This option is available with both the GNU
3541 runtime and the NeXT runtime (but not available in conjunction with
3542 the NeXT runtime on Mac OS X 10.2 and earlier).
3543
3544 @item -fobjc-gc
3545 @opindex fobjc-gc
3546 Enable garbage collection (GC) in Objective-C and Objective-C++
3547 programs. This option is only available with the NeXT runtime; the
3548 GNU runtime has a different garbage collection implementation that
3549 does not require special compiler flags.
3550
3551 @item -fobjc-nilcheck
3552 @opindex fobjc-nilcheck
3553 For the NeXT runtime with version 2 of the ABI, check for a nil
3554 receiver in method invocations before doing the actual method call.
3555 This is the default and can be disabled using
3556 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3557 checked for nil in this way no matter what this flag is set to.
3558 Currently this flag does nothing when the GNU runtime, or an older
3559 version of the NeXT runtime ABI, is used.
3560
3561 @item -fobjc-std=objc1
3562 @opindex fobjc-std
3563 Conform to the language syntax of Objective-C 1.0, the language
3564 recognized by GCC 4.0. This only affects the Objective-C additions to
3565 the C/C++ language; it does not affect conformance to C/C++ standards,
3566 which is controlled by the separate C/C++ dialect option flags. When
3567 this option is used with the Objective-C or Objective-C++ compiler,
3568 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3569 This is useful if you need to make sure that your Objective-C code can
3570 be compiled with older versions of GCC@.
3571
3572 @item -freplace-objc-classes
3573 @opindex freplace-objc-classes
3574 Emit a special marker instructing @command{ld(1)} not to statically link in
3575 the resulting object file, and allow @command{dyld(1)} to load it in at
3576 run time instead. This is used in conjunction with the Fix-and-Continue
3577 debugging mode, where the object file in question may be recompiled and
3578 dynamically reloaded in the course of program execution, without the need
3579 to restart the program itself. Currently, Fix-and-Continue functionality
3580 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3581 and later.
3582
3583 @item -fzero-link
3584 @opindex fzero-link
3585 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3586 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3587 compile time) with static class references that get initialized at load time,
3588 which improves run-time performance. Specifying the @option{-fzero-link} flag
3589 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3590 to be retained. This is useful in Zero-Link debugging mode, since it allows
3591 for individual class implementations to be modified during program execution.
3592 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3593 regardless of command-line options.
3594
3595 @item -fno-local-ivars
3596 @opindex fno-local-ivars
3597 @opindex flocal-ivars
3598 By default instance variables in Objective-C can be accessed as if
3599 they were local variables from within the methods of the class they're
3600 declared in. This can lead to shadowing between instance variables
3601 and other variables declared either locally inside a class method or
3602 globally with the same name. Specifying the @option{-fno-local-ivars}
3603 flag disables this behavior thus avoiding variable shadowing issues.
3604
3605 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3606 @opindex fivar-visibility
3607 Set the default instance variable visibility to the specified option
3608 so that instance variables declared outside the scope of any access
3609 modifier directives default to the specified visibility.
3610
3611 @item -gen-decls
3612 @opindex gen-decls
3613 Dump interface declarations for all classes seen in the source file to a
3614 file named @file{@var{sourcename}.decl}.
3615
3616 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3617 @opindex Wassign-intercept
3618 @opindex Wno-assign-intercept
3619 Warn whenever an Objective-C assignment is being intercepted by the
3620 garbage collector.
3621
3622 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3623 @opindex Wno-protocol
3624 @opindex Wprotocol
3625 If a class is declared to implement a protocol, a warning is issued for
3626 every method in the protocol that is not implemented by the class. The
3627 default behavior is to issue a warning for every method not explicitly
3628 implemented in the class, even if a method implementation is inherited
3629 from the superclass. If you use the @option{-Wno-protocol} option, then
3630 methods inherited from the superclass are considered to be implemented,
3631 and no warning is issued for them.
3632
3633 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3634 @opindex Wselector
3635 @opindex Wno-selector
3636 Warn if multiple methods of different types for the same selector are
3637 found during compilation. The check is performed on the list of methods
3638 in the final stage of compilation. Additionally, a check is performed
3639 for each selector appearing in a @code{@@selector(@dots{})}
3640 expression, and a corresponding method for that selector has been found
3641 during compilation. Because these checks scan the method table only at
3642 the end of compilation, these warnings are not produced if the final
3643 stage of compilation is not reached, for example because an error is
3644 found during compilation, or because the @option{-fsyntax-only} option is
3645 being used.
3646
3647 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3648 @opindex Wstrict-selector-match
3649 @opindex Wno-strict-selector-match
3650 Warn if multiple methods with differing argument and/or return types are
3651 found for a given selector when attempting to send a message using this
3652 selector to a receiver of type @code{id} or @code{Class}. When this flag
3653 is off (which is the default behavior), the compiler omits such warnings
3654 if any differences found are confined to types that share the same size
3655 and alignment.
3656
3657 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3658 @opindex Wundeclared-selector
3659 @opindex Wno-undeclared-selector
3660 Warn if a @code{@@selector(@dots{})} expression referring to an
3661 undeclared selector is found. A selector is considered undeclared if no
3662 method with that name has been declared before the
3663 @code{@@selector(@dots{})} expression, either explicitly in an
3664 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3665 an @code{@@implementation} section. This option always performs its
3666 checks as soon as a @code{@@selector(@dots{})} expression is found,
3667 while @option{-Wselector} only performs its checks in the final stage of
3668 compilation. This also enforces the coding style convention
3669 that methods and selectors must be declared before being used.
3670
3671 @item -print-objc-runtime-info
3672 @opindex print-objc-runtime-info
3673 Generate C header describing the largest structure that is passed by
3674 value, if any.
3675
3676 @end table
3677
3678 @node Diagnostic Message Formatting Options
3679 @section Options to Control Diagnostic Messages Formatting
3680 @cindex options to control diagnostics formatting
3681 @cindex diagnostic messages
3682 @cindex message formatting
3683
3684 Traditionally, diagnostic messages have been formatted irrespective of
3685 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3686 options described below
3687 to control the formatting algorithm for diagnostic messages,
3688 e.g.@: how many characters per line, how often source location
3689 information should be reported. Note that some language front ends may not
3690 honor these options.
3691
3692 @table @gcctabopt
3693 @item -fmessage-length=@var{n}
3694 @opindex fmessage-length
3695 Try to format error messages so that they fit on lines of about
3696 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3697 done; each error message appears on a single line. This is the
3698 default for all front ends.
3699
3700 Note - this option also affects the display of the @samp{#error} and
3701 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3702 function/type/variable attribute. It does not however affect the
3703 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3704
3705 @item -fdiagnostics-show-location=once
3706 @opindex fdiagnostics-show-location
3707 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3708 reporter to emit source location information @emph{once}; that is, in
3709 case the message is too long to fit on a single physical line and has to
3710 be wrapped, the source location won't be emitted (as prefix) again,
3711 over and over, in subsequent continuation lines. This is the default
3712 behavior.
3713
3714 @item -fdiagnostics-show-location=every-line
3715 Only meaningful in line-wrapping mode. Instructs the diagnostic
3716 messages reporter to emit the same source location information (as
3717 prefix) for physical lines that result from the process of breaking
3718 a message which is too long to fit on a single line.
3719
3720 @item -fdiagnostics-color[=@var{WHEN}]
3721 @itemx -fno-diagnostics-color
3722 @opindex fdiagnostics-color
3723 @cindex highlight, color
3724 @vindex GCC_COLORS @r{environment variable}
3725 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3726 or @samp{auto}. The default depends on how the compiler has been configured,
3727 it can be any of the above @var{WHEN} options or also @samp{never}
3728 if @env{GCC_COLORS} environment variable isn't present in the environment,
3729 and @samp{auto} otherwise.
3730 @samp{auto} means to use color only when the standard error is a terminal.
3731 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3732 aliases for @option{-fdiagnostics-color=always} and
3733 @option{-fdiagnostics-color=never}, respectively.
3734
3735 The colors are defined by the environment variable @env{GCC_COLORS}.
3736 Its value is a colon-separated list of capabilities and Select Graphic
3737 Rendition (SGR) substrings. SGR commands are interpreted by the
3738 terminal or terminal emulator. (See the section in the documentation
3739 of your text terminal for permitted values and their meanings as
3740 character attributes.) These substring values are integers in decimal
3741 representation and can be concatenated with semicolons.
3742 Common values to concatenate include
3743 @samp{1} for bold,
3744 @samp{4} for underline,
3745 @samp{5} for blink,
3746 @samp{7} for inverse,
3747 @samp{39} for default foreground color,
3748 @samp{30} to @samp{37} for foreground colors,
3749 @samp{90} to @samp{97} for 16-color mode foreground colors,
3750 @samp{38;5;0} to @samp{38;5;255}
3751 for 88-color and 256-color modes foreground colors,
3752 @samp{49} for default background color,
3753 @samp{40} to @samp{47} for background colors,
3754 @samp{100} to @samp{107} for 16-color mode background colors,
3755 and @samp{48;5;0} to @samp{48;5;255}
3756 for 88-color and 256-color modes background colors.
3757
3758 The default @env{GCC_COLORS} is
3759 @smallexample
3760 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3761 quote=01:fixit-insert=32:fixit-delete=31:\
3762 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3763 type-diff=01;32
3764 @end smallexample
3765 @noindent
3766 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3767 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3768 @samp{01} is bold, and @samp{31} is red.
3769 Setting @env{GCC_COLORS} to the empty string disables colors.
3770 Supported capabilities are as follows.
3771
3772 @table @code
3773 @item error=
3774 @vindex error GCC_COLORS @r{capability}
3775 SGR substring for error: markers.
3776
3777 @item warning=
3778 @vindex warning GCC_COLORS @r{capability}
3779 SGR substring for warning: markers.
3780
3781 @item note=
3782 @vindex note GCC_COLORS @r{capability}
3783 SGR substring for note: markers.
3784
3785 @item range1=
3786 @vindex range1 GCC_COLORS @r{capability}
3787 SGR substring for first additional range.
3788
3789 @item range2=
3790 @vindex range2 GCC_COLORS @r{capability}
3791 SGR substring for second additional range.
3792
3793 @item locus=
3794 @vindex locus GCC_COLORS @r{capability}
3795 SGR substring for location information, @samp{file:line} or
3796 @samp{file:line:column} etc.
3797
3798 @item quote=
3799 @vindex quote GCC_COLORS @r{capability}
3800 SGR substring for information printed within quotes.
3801
3802 @item fixit-insert=
3803 @vindex fixit-insert GCC_COLORS @r{capability}
3804 SGR substring for fix-it hints suggesting text to
3805 be inserted or replaced.
3806
3807 @item fixit-delete=
3808 @vindex fixit-delete GCC_COLORS @r{capability}
3809 SGR substring for fix-it hints suggesting text to
3810 be deleted.
3811
3812 @item diff-filename=
3813 @vindex diff-filename GCC_COLORS @r{capability}
3814 SGR substring for filename headers within generated patches.
3815
3816 @item diff-hunk=
3817 @vindex diff-hunk GCC_COLORS @r{capability}
3818 SGR substring for the starts of hunks within generated patches.
3819
3820 @item diff-delete=
3821 @vindex diff-delete GCC_COLORS @r{capability}
3822 SGR substring for deleted lines within generated patches.
3823
3824 @item diff-insert=
3825 @vindex diff-insert GCC_COLORS @r{capability}
3826 SGR substring for inserted lines within generated patches.
3827
3828 @item type-diff=
3829 @vindex type-diff GCC_COLORS @r{capability}
3830 SGR substring for highlighting mismatching types within template
3831 arguments in the C++ frontend.
3832 @end table
3833
3834 @item -fno-diagnostics-show-option
3835 @opindex fno-diagnostics-show-option
3836 @opindex fdiagnostics-show-option
3837 By default, each diagnostic emitted includes text indicating the
3838 command-line option that directly controls the diagnostic (if such an
3839 option is known to the diagnostic machinery). Specifying the
3840 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3841
3842 @item -fno-diagnostics-show-caret
3843 @opindex fno-diagnostics-show-caret
3844 @opindex fdiagnostics-show-caret
3845 By default, each diagnostic emitted includes the original source line
3846 and a caret @samp{^} indicating the column. This option suppresses this
3847 information. The source line is truncated to @var{n} characters, if
3848 the @option{-fmessage-length=n} option is given. When the output is done
3849 to the terminal, the width is limited to the width given by the
3850 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3851
3852 @item -fno-diagnostics-show-labels
3853 @opindex fno-diagnostics-show-labels
3854 @opindex fdiagnostics-show-labels
3855 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3856 diagnostics can label ranges of source code with pertinent information, such
3857 as the types of expressions:
3858
3859 @smallexample
3860 printf ("foo %s bar", long_i + long_j);
3861 ~^ ~~~~~~~~~~~~~~~
3862 | |
3863 char * long int
3864 @end smallexample
3865
3866 This option suppresses the printing of these labels (in the example above,
3867 the vertical bars and the ``char *'' and ``long int'' text).
3868
3869 @item -fno-diagnostics-show-line-numbers
3870 @opindex fno-diagnostics-show-line-numbers
3871 @opindex fdiagnostics-show-line-numbers
3872 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3873 a left margin is printed, showing line numbers. This option suppresses this
3874 left margin.
3875
3876 @item -fdiagnostics-minimum-margin-width=@var{width}
3877 @opindex fdiagnostics-minimum-margin-width
3878 This option controls the minimum width of the left margin printed by
3879 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3880
3881 @item -fdiagnostics-parseable-fixits
3882 @opindex fdiagnostics-parseable-fixits
3883 Emit fix-it hints in a machine-parseable format, suitable for consumption
3884 by IDEs. For each fix-it, a line will be printed after the relevant
3885 diagnostic, starting with the string ``fix-it:''. For example:
3886
3887 @smallexample
3888 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3889 @end smallexample
3890
3891 The location is expressed as a half-open range, expressed as a count of
3892 bytes, starting at byte 1 for the initial column. In the above example,
3893 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3894 given string:
3895
3896 @smallexample
3897 00000000011111111112222222222
3898 12345678901234567890123456789
3899 gtk_widget_showall (dlg);
3900 ^^^^^^^^^^^^^^^^^^
3901 gtk_widget_show_all
3902 @end smallexample
3903
3904 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3905 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3906 (e.g. vertical tab as ``\013'').
3907
3908 An empty replacement string indicates that the given range is to be removed.
3909 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3910 be inserted at the given position.
3911
3912 @item -fdiagnostics-generate-patch
3913 @opindex fdiagnostics-generate-patch
3914 Print fix-it hints to stderr in unified diff format, after any diagnostics
3915 are printed. For example:
3916
3917 @smallexample
3918 --- test.c
3919 +++ test.c
3920 @@ -42,5 +42,5 @@
3921
3922 void show_cb(GtkDialog *dlg)
3923 @{
3924 - gtk_widget_showall(dlg);
3925 + gtk_widget_show_all(dlg);
3926 @}
3927
3928 @end smallexample
3929
3930 The diff may or may not be colorized, following the same rules
3931 as for diagnostics (see @option{-fdiagnostics-color}).
3932
3933 @item -fdiagnostics-show-template-tree
3934 @opindex fdiagnostics-show-template-tree
3935
3936 In the C++ frontend, when printing diagnostics showing mismatching
3937 template types, such as:
3938
3939 @smallexample
3940 could not convert 'std::map<int, std::vector<double> >()'
3941 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3942 @end smallexample
3943
3944 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3945 tree-like structure showing the common and differing parts of the types,
3946 such as:
3947
3948 @smallexample
3949 map<
3950 [...],
3951 vector<
3952 [double != float]>>
3953 @end smallexample
3954
3955 The parts that differ are highlighted with color (``double'' and
3956 ``float'' in this case).
3957
3958 @item -fno-elide-type
3959 @opindex fno-elide-type
3960 @opindex felide-type
3961 By default when the C++ frontend prints diagnostics showing mismatching
3962 template types, common parts of the types are printed as ``[...]'' to
3963 simplify the error message. For example:
3964
3965 @smallexample
3966 could not convert 'std::map<int, std::vector<double> >()'
3967 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3968 @end smallexample
3969
3970 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3971 This flag also affects the output of the
3972 @option{-fdiagnostics-show-template-tree} flag.
3973
3974 @item -fno-show-column
3975 @opindex fno-show-column
3976 @opindex fshow-column
3977 Do not print column numbers in diagnostics. This may be necessary if
3978 diagnostics are being scanned by a program that does not understand the
3979 column numbers, such as @command{dejagnu}.
3980
3981 @end table
3982
3983 @node Warning Options
3984 @section Options to Request or Suppress Warnings
3985 @cindex options to control warnings
3986 @cindex warning messages
3987 @cindex messages, warning
3988 @cindex suppressing warnings
3989
3990 Warnings are diagnostic messages that report constructions that
3991 are not inherently erroneous but that are risky or suggest there
3992 may have been an error.
3993
3994 The following language-independent options do not enable specific
3995 warnings but control the kinds of diagnostics produced by GCC@.
3996
3997 @table @gcctabopt
3998 @cindex syntax checking
3999 @item -fsyntax-only
4000 @opindex fsyntax-only
4001 Check the code for syntax errors, but don't do anything beyond that.
4002
4003 @item -fmax-errors=@var{n}
4004 @opindex fmax-errors
4005 Limits the maximum number of error messages to @var{n}, at which point
4006 GCC bails out rather than attempting to continue processing the source
4007 code. If @var{n} is 0 (the default), there is no limit on the number
4008 of error messages produced. If @option{-Wfatal-errors} is also
4009 specified, then @option{-Wfatal-errors} takes precedence over this
4010 option.
4011
4012 @item -w
4013 @opindex w
4014 Inhibit all warning messages.
4015
4016 @item -Werror
4017 @opindex Werror
4018 @opindex Wno-error
4019 Make all warnings into errors.
4020
4021 @item -Werror=
4022 @opindex Werror=
4023 @opindex Wno-error=
4024 Make the specified warning into an error. The specifier for a warning
4025 is appended; for example @option{-Werror=switch} turns the warnings
4026 controlled by @option{-Wswitch} into errors. This switch takes a
4027 negative form, to be used to negate @option{-Werror} for specific
4028 warnings; for example @option{-Wno-error=switch} makes
4029 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4030 is in effect.
4031
4032 The warning message for each controllable warning includes the
4033 option that controls the warning. That option can then be used with
4034 @option{-Werror=} and @option{-Wno-error=} as described above.
4035 (Printing of the option in the warning message can be disabled using the
4036 @option{-fno-diagnostics-show-option} flag.)
4037
4038 Note that specifying @option{-Werror=}@var{foo} automatically implies
4039 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4040 imply anything.
4041
4042 @item -Wfatal-errors
4043 @opindex Wfatal-errors
4044 @opindex Wno-fatal-errors
4045 This option causes the compiler to abort compilation on the first error
4046 occurred rather than trying to keep going and printing further error
4047 messages.
4048
4049 @end table
4050
4051 You can request many specific warnings with options beginning with
4052 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4053 implicit declarations. Each of these specific warning options also
4054 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4055 example, @option{-Wno-implicit}. This manual lists only one of the
4056 two forms, whichever is not the default. For further
4057 language-specific options also refer to @ref{C++ Dialect Options} and
4058 @ref{Objective-C and Objective-C++ Dialect Options}.
4059
4060 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4061 options, such as @option{-Wunused}, which may turn on further options,
4062 such as @option{-Wunused-value}. The combined effect of positive and
4063 negative forms is that more specific options have priority over less
4064 specific ones, independently of their position in the command-line. For
4065 options of the same specificity, the last one takes effect. Options
4066 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4067 as if they appeared at the end of the command-line.
4068
4069 When an unrecognized warning option is requested (e.g.,
4070 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4071 that the option is not recognized. However, if the @option{-Wno-} form
4072 is used, the behavior is slightly different: no diagnostic is
4073 produced for @option{-Wno-unknown-warning} unless other diagnostics
4074 are being produced. This allows the use of new @option{-Wno-} options
4075 with old compilers, but if something goes wrong, the compiler
4076 warns that an unrecognized option is present.
4077
4078 @table @gcctabopt
4079 @item -Wpedantic
4080 @itemx -pedantic
4081 @opindex pedantic
4082 @opindex Wpedantic
4083 @opindex Wno-pedantic
4084 Issue all the warnings demanded by strict ISO C and ISO C++;
4085 reject all programs that use forbidden extensions, and some other
4086 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4087 version of the ISO C standard specified by any @option{-std} option used.
4088
4089 Valid ISO C and ISO C++ programs should compile properly with or without
4090 this option (though a rare few require @option{-ansi} or a
4091 @option{-std} option specifying the required version of ISO C)@. However,
4092 without this option, certain GNU extensions and traditional C and C++
4093 features are supported as well. With this option, they are rejected.
4094
4095 @option{-Wpedantic} does not cause warning messages for use of the
4096 alternate keywords whose names begin and end with @samp{__}. Pedantic
4097 warnings are also disabled in the expression that follows
4098 @code{__extension__}. However, only system header files should use
4099 these escape routes; application programs should avoid them.
4100 @xref{Alternate Keywords}.
4101
4102 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4103 C conformance. They soon find that it does not do quite what they want:
4104 it finds some non-ISO practices, but not all---only those for which
4105 ISO C @emph{requires} a diagnostic, and some others for which
4106 diagnostics have been added.
4107
4108 A feature to report any failure to conform to ISO C might be useful in
4109 some instances, but would require considerable additional work and would
4110 be quite different from @option{-Wpedantic}. We don't have plans to
4111 support such a feature in the near future.
4112
4113 Where the standard specified with @option{-std} represents a GNU
4114 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4115 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4116 extended dialect is based. Warnings from @option{-Wpedantic} are given
4117 where they are required by the base standard. (It does not make sense
4118 for such warnings to be given only for features not in the specified GNU
4119 C dialect, since by definition the GNU dialects of C include all
4120 features the compiler supports with the given option, and there would be
4121 nothing to warn about.)
4122
4123 @item -pedantic-errors
4124 @opindex pedantic-errors
4125 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4126 requires a diagnostic, in some cases where there is undefined behavior
4127 at compile-time and in some other cases that do not prevent compilation
4128 of programs that are valid according to the standard. This is not
4129 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4130 by this option and not enabled by the latter and vice versa.
4131
4132 @item -Wall
4133 @opindex Wall
4134 @opindex Wno-all
4135 This enables all the warnings about constructions that some users
4136 consider questionable, and that are easy to avoid (or modify to
4137 prevent the warning), even in conjunction with macros. This also
4138 enables some language-specific warnings described in @ref{C++ Dialect
4139 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4140
4141 @option{-Wall} turns on the following warning flags:
4142
4143 @gccoptlist{-Waddress @gol
4144 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4145 -Wbool-compare @gol
4146 -Wbool-operation @gol
4147 -Wc++11-compat -Wc++14-compat @gol
4148 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4149 -Wchar-subscripts @gol
4150 -Wcomment @gol
4151 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4152 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4153 -Wformat @gol
4154 -Wint-in-bool-context @gol
4155 -Wimplicit @r{(C and Objective-C only)} @gol
4156 -Wimplicit-int @r{(C and Objective-C only)} @gol
4157 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4158 -Winit-self @r{(only for C++)} @gol
4159 -Wlogical-not-parentheses @gol
4160 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4161 -Wmaybe-uninitialized @gol
4162 -Wmemset-elt-size @gol
4163 -Wmemset-transposed-args @gol
4164 -Wmisleading-indentation @r{(only for C/C++)} @gol
4165 -Wmissing-attributes @gol
4166 -Wmissing-braces @r{(only for C/ObjC)} @gol
4167 -Wmultistatement-macros @gol
4168 -Wnarrowing @r{(only for C++)} @gol
4169 -Wnonnull @gol
4170 -Wnonnull-compare @gol
4171 -Wopenmp-simd @gol
4172 -Wparentheses @gol
4173 -Wpessimizing-move @r{(only for C++)} @gol
4174 -Wpointer-sign @gol
4175 -Wreorder @gol
4176 -Wrestrict @gol
4177 -Wreturn-type @gol
4178 -Wsequence-point @gol
4179 -Wsign-compare @r{(only in C++)} @gol
4180 -Wsizeof-pointer-div @gol
4181 -Wsizeof-pointer-memaccess @gol
4182 -Wstrict-aliasing @gol
4183 -Wstrict-overflow=1 @gol
4184 -Wswitch @gol
4185 -Wtautological-compare @gol
4186 -Wtrigraphs @gol
4187 -Wuninitialized @gol
4188 -Wunknown-pragmas @gol
4189 -Wunused-function @gol
4190 -Wunused-label @gol
4191 -Wunused-value @gol
4192 -Wunused-variable @gol
4193 -Wvolatile-register-var @gol
4194 }
4195
4196 Note that some warning flags are not implied by @option{-Wall}. Some of
4197 them warn about constructions that users generally do not consider
4198 questionable, but which occasionally you might wish to check for;
4199 others warn about constructions that are necessary or hard to avoid in
4200 some cases, and there is no simple way to modify the code to suppress
4201 the warning. Some of them are enabled by @option{-Wextra} but many of
4202 them must be enabled individually.
4203
4204 @item -Wextra
4205 @opindex W
4206 @opindex Wextra
4207 @opindex Wno-extra
4208 This enables some extra warning flags that are not enabled by
4209 @option{-Wall}. (This option used to be called @option{-W}. The older
4210 name is still supported, but the newer name is more descriptive.)
4211
4212 @gccoptlist{-Wclobbered @gol
4213 -Wcast-function-type @gol
4214 -Wempty-body @gol
4215 -Wignored-qualifiers @gol
4216 -Wimplicit-fallthrough=3 @gol
4217 -Wmissing-field-initializers @gol
4218 -Wmissing-parameter-type @r{(C only)} @gol
4219 -Wold-style-declaration @r{(C only)} @gol
4220 -Woverride-init @gol
4221 -Wsign-compare @r{(C only)} @gol
4222 -Wredundant-move @r{(only for C++)} @gol
4223 -Wtype-limits @gol
4224 -Wuninitialized @gol
4225 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4226 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4227 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4228 }
4229
4230 The option @option{-Wextra} also prints warning messages for the
4231 following cases:
4232
4233 @itemize @bullet
4234
4235 @item
4236 A pointer is compared against integer zero with @code{<}, @code{<=},
4237 @code{>}, or @code{>=}.
4238
4239 @item
4240 (C++ only) An enumerator and a non-enumerator both appear in a
4241 conditional expression.
4242
4243 @item
4244 (C++ only) Ambiguous virtual bases.
4245
4246 @item
4247 (C++ only) Subscripting an array that has been declared @code{register}.
4248
4249 @item
4250 (C++ only) Taking the address of a variable that has been declared
4251 @code{register}.
4252
4253 @item
4254 (C++ only) A base class is not initialized in the copy constructor
4255 of a derived class.
4256
4257 @end itemize
4258
4259 @item -Wchar-subscripts
4260 @opindex Wchar-subscripts
4261 @opindex Wno-char-subscripts
4262 Warn if an array subscript has type @code{char}. This is a common cause
4263 of error, as programmers often forget that this type is signed on some
4264 machines.
4265 This warning is enabled by @option{-Wall}.
4266
4267 @item -Wchkp
4268 @opindex Wchkp
4269 @opindex Wno-chkp
4270 Warn about an invalid memory access that is found by Pointer Bounds Checker
4271 (@option{-fcheck-pointer-bounds}).
4272
4273 @item -Wno-coverage-mismatch
4274 @opindex Wno-coverage-mismatch
4275 @opindex Wcoverage-mismatch
4276 Warn if feedback profiles do not match when using the
4277 @option{-fprofile-use} option.
4278 If a source file is changed between compiling with @option{-fprofile-generate}
4279 and with @option{-fprofile-use}, the files with the profile feedback can fail
4280 to match the source file and GCC cannot use the profile feedback
4281 information. By default, this warning is enabled and is treated as an
4282 error. @option{-Wno-coverage-mismatch} can be used to disable the
4283 warning or @option{-Wno-error=coverage-mismatch} can be used to
4284 disable the error. Disabling the error for this warning can result in
4285 poorly optimized code and is useful only in the
4286 case of very minor changes such as bug fixes to an existing code-base.
4287 Completely disabling the warning is not recommended.
4288
4289 @item -Wno-cpp
4290 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4291
4292 Suppress warning messages emitted by @code{#warning} directives.
4293
4294 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4295 @opindex Wdouble-promotion
4296 @opindex Wno-double-promotion
4297 Give a warning when a value of type @code{float} is implicitly
4298 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4299 floating-point unit implement @code{float} in hardware, but emulate
4300 @code{double} in software. On such a machine, doing computations
4301 using @code{double} values is much more expensive because of the
4302 overhead required for software emulation.
4303
4304 It is easy to accidentally do computations with @code{double} because
4305 floating-point literals are implicitly of type @code{double}. For
4306 example, in:
4307 @smallexample
4308 @group
4309 float area(float radius)
4310 @{
4311 return 3.14159 * radius * radius;
4312 @}
4313 @end group
4314 @end smallexample
4315 the compiler performs the entire computation with @code{double}
4316 because the floating-point literal is a @code{double}.
4317
4318 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4319 @opindex Wduplicate-decl-specifier
4320 @opindex Wno-duplicate-decl-specifier
4321 Warn if a declaration has duplicate @code{const}, @code{volatile},
4322 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4323 @option{-Wall}.
4324
4325 @item -Wformat
4326 @itemx -Wformat=@var{n}
4327 @opindex Wformat
4328 @opindex Wno-format
4329 @opindex ffreestanding
4330 @opindex fno-builtin
4331 @opindex Wformat=
4332 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4333 the arguments supplied have types appropriate to the format string
4334 specified, and that the conversions specified in the format string make
4335 sense. This includes standard functions, and others specified by format
4336 attributes (@pxref{Function Attributes}), in the @code{printf},
4337 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4338 not in the C standard) families (or other target-specific families).
4339 Which functions are checked without format attributes having been
4340 specified depends on the standard version selected, and such checks of
4341 functions without the attribute specified are disabled by
4342 @option{-ffreestanding} or @option{-fno-builtin}.
4343
4344 The formats are checked against the format features supported by GNU
4345 libc version 2.2. These include all ISO C90 and C99 features, as well
4346 as features from the Single Unix Specification and some BSD and GNU
4347 extensions. Other library implementations may not support all these
4348 features; GCC does not support warning about features that go beyond a
4349 particular library's limitations. However, if @option{-Wpedantic} is used
4350 with @option{-Wformat}, warnings are given about format features not
4351 in the selected standard version (but not for @code{strfmon} formats,
4352 since those are not in any version of the C standard). @xref{C Dialect
4353 Options,,Options Controlling C Dialect}.
4354
4355 @table @gcctabopt
4356 @item -Wformat=1
4357 @itemx -Wformat
4358 @opindex Wformat
4359 @opindex Wformat=1
4360 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4361 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4362 @option{-Wformat} also checks for null format arguments for several
4363 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4364 aspects of this level of format checking can be disabled by the
4365 options: @option{-Wno-format-contains-nul},
4366 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4367 @option{-Wformat} is enabled by @option{-Wall}.
4368
4369 @item -Wno-format-contains-nul
4370 @opindex Wno-format-contains-nul
4371 @opindex Wformat-contains-nul
4372 If @option{-Wformat} is specified, do not warn about format strings that
4373 contain NUL bytes.
4374
4375 @item -Wno-format-extra-args
4376 @opindex Wno-format-extra-args
4377 @opindex Wformat-extra-args
4378 If @option{-Wformat} is specified, do not warn about excess arguments to a
4379 @code{printf} or @code{scanf} format function. The C standard specifies
4380 that such arguments are ignored.
4381
4382 Where the unused arguments lie between used arguments that are
4383 specified with @samp{$} operand number specifications, normally
4384 warnings are still given, since the implementation could not know what
4385 type to pass to @code{va_arg} to skip the unused arguments. However,
4386 in the case of @code{scanf} formats, this option suppresses the
4387 warning if the unused arguments are all pointers, since the Single
4388 Unix Specification says that such unused arguments are allowed.
4389
4390 @item -Wformat-overflow
4391 @itemx -Wformat-overflow=@var{level}
4392 @opindex Wformat-overflow
4393 @opindex Wno-format-overflow
4394 Warn about calls to formatted input/output functions such as @code{sprintf}
4395 and @code{vsprintf} that might overflow the destination buffer. When the
4396 exact number of bytes written by a format directive cannot be determined
4397 at compile-time it is estimated based on heuristics that depend on the
4398 @var{level} argument and on optimization. While enabling optimization
4399 will in most cases improve the accuracy of the warning, it may also
4400 result in false positives.
4401
4402 @table @gcctabopt
4403 @item -Wformat-overflow
4404 @itemx -Wformat-overflow=1
4405 @opindex Wformat-overflow
4406 @opindex Wno-format-overflow
4407 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4408 employs a conservative approach that warns only about calls that most
4409 likely overflow the buffer. At this level, numeric arguments to format
4410 directives with unknown values are assumed to have the value of one, and
4411 strings of unknown length to be empty. Numeric arguments that are known
4412 to be bounded to a subrange of their type, or string arguments whose output
4413 is bounded either by their directive's precision or by a finite set of
4414 string literals, are assumed to take on the value within the range that
4415 results in the most bytes on output. For example, the call to @code{sprintf}
4416 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4417 the terminating NUL character (@code{'\0'}) appended by the function
4418 to the destination buffer will be written past its end. Increasing
4419 the size of the buffer by a single byte is sufficient to avoid the
4420 warning, though it may not be sufficient to avoid the overflow.
4421
4422 @smallexample
4423 void f (int a, int b)
4424 @{
4425 char buf [13];
4426 sprintf (buf, "a = %i, b = %i\n", a, b);
4427 @}
4428 @end smallexample
4429
4430 @item -Wformat-overflow=2
4431 Level @var{2} warns also about calls that might overflow the destination
4432 buffer given an argument of sufficient length or magnitude. At level
4433 @var{2}, unknown numeric arguments are assumed to have the minimum
4434 representable value for signed types with a precision greater than 1, and
4435 the maximum representable value otherwise. Unknown string arguments whose
4436 length cannot be assumed to be bounded either by the directive's precision,
4437 or by a finite set of string literals they may evaluate to, or the character
4438 array they may point to, are assumed to be 1 character long.
4439
4440 At level @var{2}, the call in the example above is again diagnosed, but
4441 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4442 @code{%i} directive will write some of its digits beyond the end of
4443 the destination buffer. To make the call safe regardless of the values
4444 of the two variables, the size of the destination buffer must be increased
4445 to at least 34 bytes. GCC includes the minimum size of the buffer in
4446 an informational note following the warning.
4447
4448 An alternative to increasing the size of the destination buffer is to
4449 constrain the range of formatted values. The maximum length of string
4450 arguments can be bounded by specifying the precision in the format
4451 directive. When numeric arguments of format directives can be assumed
4452 to be bounded by less than the precision of their type, choosing
4453 an appropriate length modifier to the format specifier will reduce
4454 the required buffer size. For example, if @var{a} and @var{b} in the
4455 example above can be assumed to be within the precision of
4456 the @code{short int} type then using either the @code{%hi} format
4457 directive or casting the argument to @code{short} reduces the maximum
4458 required size of the buffer to 24 bytes.
4459
4460 @smallexample
4461 void f (int a, int b)
4462 @{
4463 char buf [23];
4464 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4465 @}
4466 @end smallexample
4467 @end table
4468
4469 @item -Wno-format-zero-length
4470 @opindex Wno-format-zero-length
4471 @opindex Wformat-zero-length
4472 If @option{-Wformat} is specified, do not warn about zero-length formats.
4473 The C standard specifies that zero-length formats are allowed.
4474
4475
4476 @item -Wformat=2
4477 @opindex Wformat=2
4478 Enable @option{-Wformat} plus additional format checks. Currently
4479 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4480 -Wformat-y2k}.
4481
4482 @item -Wformat-nonliteral
4483 @opindex Wformat-nonliteral
4484 @opindex Wno-format-nonliteral
4485 If @option{-Wformat} is specified, also warn if the format string is not a
4486 string literal and so cannot be checked, unless the format function
4487 takes its format arguments as a @code{va_list}.
4488
4489 @item -Wformat-security
4490 @opindex Wformat-security
4491 @opindex Wno-format-security
4492 If @option{-Wformat} is specified, also warn about uses of format
4493 functions that represent possible security problems. At present, this
4494 warns about calls to @code{printf} and @code{scanf} functions where the
4495 format string is not a string literal and there are no format arguments,
4496 as in @code{printf (foo);}. This may be a security hole if the format
4497 string came from untrusted input and contains @samp{%n}. (This is
4498 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4499 in future warnings may be added to @option{-Wformat-security} that are not
4500 included in @option{-Wformat-nonliteral}.)
4501
4502 @item -Wformat-signedness
4503 @opindex Wformat-signedness
4504 @opindex Wno-format-signedness
4505 If @option{-Wformat} is specified, also warn if the format string
4506 requires an unsigned argument and the argument is signed and vice versa.
4507
4508 @item -Wformat-truncation
4509 @itemx -Wformat-truncation=@var{level}
4510 @opindex Wformat-truncation
4511 @opindex Wno-format-truncation
4512 Warn about calls to formatted input/output functions such as @code{snprintf}
4513 and @code{vsnprintf} that might result in output truncation. When the exact
4514 number of bytes written by a format directive cannot be determined at
4515 compile-time it is estimated based on heuristics that depend on
4516 the @var{level} argument and on optimization. While enabling optimization
4517 will in most cases improve the accuracy of the warning, it may also result
4518 in false positives. Except as noted otherwise, the option uses the same
4519 logic @option{-Wformat-overflow}.
4520
4521 @table @gcctabopt
4522 @item -Wformat-truncation
4523 @itemx -Wformat-truncation=1
4524 @opindex Wformat-truncation
4525 @opindex Wno-format-truncation
4526 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4527 employs a conservative approach that warns only about calls to bounded
4528 functions whose return value is unused and that will most likely result
4529 in output truncation.
4530
4531 @item -Wformat-truncation=2
4532 Level @var{2} warns also about calls to bounded functions whose return
4533 value is used and that might result in truncation given an argument of
4534 sufficient length or magnitude.
4535 @end table
4536
4537 @item -Wformat-y2k
4538 @opindex Wformat-y2k
4539 @opindex Wno-format-y2k
4540 If @option{-Wformat} is specified, also warn about @code{strftime}
4541 formats that may yield only a two-digit year.
4542 @end table
4543
4544 @item -Wnonnull
4545 @opindex Wnonnull
4546 @opindex Wno-nonnull
4547 Warn about passing a null pointer for arguments marked as
4548 requiring a non-null value by the @code{nonnull} function attribute.
4549
4550 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4551 can be disabled with the @option{-Wno-nonnull} option.
4552
4553 @item -Wnonnull-compare
4554 @opindex Wnonnull-compare
4555 @opindex Wno-nonnull-compare
4556 Warn when comparing an argument marked with the @code{nonnull}
4557 function attribute against null inside the function.
4558
4559 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4560 can be disabled with the @option{-Wno-nonnull-compare} option.
4561
4562 @item -Wnull-dereference
4563 @opindex Wnull-dereference
4564 @opindex Wno-null-dereference
4565 Warn if the compiler detects paths that trigger erroneous or
4566 undefined behavior due to dereferencing a null pointer. This option
4567 is only active when @option{-fdelete-null-pointer-checks} is active,
4568 which is enabled by optimizations in most targets. The precision of
4569 the warnings depends on the optimization options used.
4570
4571 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4572 @opindex Winit-self
4573 @opindex Wno-init-self
4574 Warn about uninitialized variables that are initialized with themselves.
4575 Note this option can only be used with the @option{-Wuninitialized} option.
4576
4577 For example, GCC warns about @code{i} being uninitialized in the
4578 following snippet only when @option{-Winit-self} has been specified:
4579 @smallexample
4580 @group
4581 int f()
4582 @{
4583 int i = i;
4584 return i;
4585 @}
4586 @end group
4587 @end smallexample
4588
4589 This warning is enabled by @option{-Wall} in C++.
4590
4591 @item -Wimplicit-int @r{(C and Objective-C only)}
4592 @opindex Wimplicit-int
4593 @opindex Wno-implicit-int
4594 Warn when a declaration does not specify a type.
4595 This warning is enabled by @option{-Wall}.
4596
4597 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4598 @opindex Wimplicit-function-declaration
4599 @opindex Wno-implicit-function-declaration
4600 Give a warning whenever a function is used before being declared. In
4601 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4602 enabled by default and it is made into an error by
4603 @option{-pedantic-errors}. This warning is also enabled by
4604 @option{-Wall}.
4605
4606 @item -Wimplicit @r{(C and Objective-C only)}
4607 @opindex Wimplicit
4608 @opindex Wno-implicit
4609 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4610 This warning is enabled by @option{-Wall}.
4611
4612 @item -Wimplicit-fallthrough
4613 @opindex Wimplicit-fallthrough
4614 @opindex Wno-implicit-fallthrough
4615 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4616 and @option{-Wno-implicit-fallthrough} is the same as
4617 @option{-Wimplicit-fallthrough=0}.
4618
4619 @item -Wimplicit-fallthrough=@var{n}
4620 @opindex Wimplicit-fallthrough=
4621 Warn when a switch case falls through. For example:
4622
4623 @smallexample
4624 @group
4625 switch (cond)
4626 @{
4627 case 1:
4628 a = 1;
4629 break;
4630 case 2:
4631 a = 2;
4632 case 3:
4633 a = 3;
4634 break;
4635 @}
4636 @end group
4637 @end smallexample
4638
4639 This warning does not warn when the last statement of a case cannot
4640 fall through, e.g. when there is a return statement or a call to function
4641 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4642 also takes into account control flow statements, such as ifs, and only
4643 warns when appropriate. E.g.@:
4644
4645 @smallexample
4646 @group
4647 switch (cond)
4648 @{
4649 case 1:
4650 if (i > 3) @{
4651 bar (5);
4652 break;
4653 @} else if (i < 1) @{
4654 bar (0);
4655 @} else
4656 return;
4657 default:
4658 @dots{}
4659 @}
4660 @end group
4661 @end smallexample
4662
4663 Since there are occasions where a switch case fall through is desirable,
4664 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4665 to be used along with a null statement to suppress this warning that
4666 would normally occur:
4667
4668 @smallexample
4669 @group
4670 switch (cond)
4671 @{
4672 case 1:
4673 bar (0);
4674 __attribute__ ((fallthrough));
4675 default:
4676 @dots{}
4677 @}
4678 @end group
4679 @end smallexample
4680
4681 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4682 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4683 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4684 Instead of these attributes, it is also possible to add a fallthrough comment
4685 to silence the warning. The whole body of the C or C++ style comment should
4686 match the given regular expressions listed below. The option argument @var{n}
4687 specifies what kind of comments are accepted:
4688
4689 @itemize @bullet
4690
4691 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4692
4693 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4694 expression, any comment is used as fallthrough comment.
4695
4696 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4697 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4698
4699 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4700 following regular expressions:
4701
4702 @itemize @bullet
4703
4704 @item @code{-fallthrough}
4705
4706 @item @code{@@fallthrough@@}
4707
4708 @item @code{lint -fallthrough[ \t]*}
4709
4710 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4711
4712 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4713
4714 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4715
4716 @end itemize
4717
4718 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4719 following regular expressions:
4720
4721 @itemize @bullet
4722
4723 @item @code{-fallthrough}
4724
4725 @item @code{@@fallthrough@@}
4726
4727 @item @code{lint -fallthrough[ \t]*}
4728
4729 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4730
4731 @end itemize
4732
4733 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4734 fallthrough comments, only attributes disable the warning.
4735
4736 @end itemize
4737
4738 The comment needs to be followed after optional whitespace and other comments
4739 by @code{case} or @code{default} keywords or by a user label that precedes some
4740 @code{case} or @code{default} label.
4741
4742 @smallexample
4743 @group
4744 switch (cond)
4745 @{
4746 case 1:
4747 bar (0);
4748 /* FALLTHRU */
4749 default:
4750 @dots{}
4751 @}
4752 @end group
4753 @end smallexample
4754
4755 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4756
4757 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4758 @opindex Wif-not-aligned
4759 @opindex Wno-if-not-aligned
4760 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4761 should be issued. This is enabled by default.
4762 Use @option{-Wno-if-not-aligned} to disable it.
4763
4764 @item -Wignored-qualifiers @r{(C and C++ only)}
4765 @opindex Wignored-qualifiers
4766 @opindex Wno-ignored-qualifiers
4767 Warn if the return type of a function has a type qualifier
4768 such as @code{const}. For ISO C such a type qualifier has no effect,
4769 since the value returned by a function is not an lvalue.
4770 For C++, the warning is only emitted for scalar types or @code{void}.
4771 ISO C prohibits qualified @code{void} return types on function
4772 definitions, so such return types always receive a warning
4773 even without this option.
4774
4775 This warning is also enabled by @option{-Wextra}.
4776
4777 @item -Wignored-attributes @r{(C and C++ only)}
4778 @opindex Wignored-attributes
4779 @opindex Wno-ignored-attributes
4780 Warn when an attribute is ignored. This is different from the
4781 @option{-Wattributes} option in that it warns whenever the compiler decides
4782 to drop an attribute, not that the attribute is either unknown, used in a
4783 wrong place, etc. This warning is enabled by default.
4784
4785 @item -Wmain
4786 @opindex Wmain
4787 @opindex Wno-main
4788 Warn if the type of @code{main} is suspicious. @code{main} should be
4789 a function with external linkage, returning int, taking either zero
4790 arguments, two, or three arguments of appropriate types. This warning
4791 is enabled by default in C++ and is enabled by either @option{-Wall}
4792 or @option{-Wpedantic}.
4793
4794 @item -Wmisleading-indentation @r{(C and C++ only)}
4795 @opindex Wmisleading-indentation
4796 @opindex Wno-misleading-indentation
4797 Warn when the indentation of the code does not reflect the block structure.
4798 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4799 @code{for} clauses with a guarded statement that does not use braces,
4800 followed by an unguarded statement with the same indentation.
4801
4802 In the following example, the call to ``bar'' is misleadingly indented as
4803 if it were guarded by the ``if'' conditional.
4804
4805 @smallexample
4806 if (some_condition ())
4807 foo ();
4808 bar (); /* Gotcha: this is not guarded by the "if". */
4809 @end smallexample
4810
4811 In the case of mixed tabs and spaces, the warning uses the
4812 @option{-ftabstop=} option to determine if the statements line up
4813 (defaulting to 8).
4814
4815 The warning is not issued for code involving multiline preprocessor logic
4816 such as the following example.
4817
4818 @smallexample
4819 if (flagA)
4820 foo (0);
4821 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4822 if (flagB)
4823 #endif
4824 foo (1);
4825 @end smallexample
4826
4827 The warning is not issued after a @code{#line} directive, since this
4828 typically indicates autogenerated code, and no assumptions can be made
4829 about the layout of the file that the directive references.
4830
4831 This warning is enabled by @option{-Wall} in C and C++.
4832
4833 @item -Wno-missing-attributes
4834 @opindex Wmissing-attributes
4835 @opindex Wno-missing-attributes
4836 Warn when a declaration of a function is missing one or more attributes
4837 that a related function is declared with and whose absence may adversely
4838 affect the correctness or efficiency of generated code. For example,
4839 the warning is issued for declarations of aliases that use attributes
4840 to specify less restrictive requirements than those of their targets.
4841 This typically represents a potential optimization oportunity rather
4842 than a hidden bug. The @option{-Wattribute-alias} option controls warnings
4843 issued for mismatches between declarations of aliases and their targets
4844 that might be indicative of code generation bugs.
4845 Attributes considered include @code{alloc_align}, @code{alloc_size},
4846 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
4847 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
4848 @code{returns_nonnull}, and @code{returns_twice}.
4849
4850 In C++, the warning is issued when an explicit specialization of a primary
4851 template declared with attribute @code{alloc_align}, @code{alloc_size},
4852 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
4853 or @code{nonnull} is declared without it. Attributes @code{deprecated},
4854 @code{error}, and @code{warning} suppress the warning.
4855 (@pxref{Function Attributes}).
4856
4857 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
4858
4859 For example, since the declaration of the primary function template
4860 below makes use of both attribute @code{malloc} and @code{alloc_size}
4861 the declaration of the explicit specialization of the template is
4862 diagnosed because it is missing one of the attributes.
4863
4864 @smallexample
4865 template <class T>
4866 T* __attribute__ ((malloc, alloc_size (1)))
4867 allocate (size_t);
4868
4869 template <>
4870 void* __attribute__ ((malloc)) // missing alloc_size
4871 allocate<void> (size_t);
4872 @end smallexample
4873
4874 @item -Wmissing-braces
4875 @opindex Wmissing-braces
4876 @opindex Wno-missing-braces
4877 Warn if an aggregate or union initializer is not fully bracketed. In
4878 the following example, the initializer for @code{a} is not fully
4879 bracketed, but that for @code{b} is fully bracketed. This warning is
4880 enabled by @option{-Wall} in C.
4881
4882 @smallexample
4883 int a[2][2] = @{ 0, 1, 2, 3 @};
4884 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4885 @end smallexample
4886
4887 This warning is enabled by @option{-Wall}.
4888
4889 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4890 @opindex Wmissing-include-dirs
4891 @opindex Wno-missing-include-dirs
4892 Warn if a user-supplied include directory does not exist.
4893
4894 @item -Wmissing-profile
4895 @opindex Wmissing-profile
4896 @opindex Wno-missing-profile
4897 Warn if feedback profiles are missing when using the
4898 @option{-fprofile-use} option.
4899 This option diagnoses those cases where a new function or a new file is added
4900 to the user code between compiling with @option{-fprofile-generate} and with
4901 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
4902 profile feedback data files do not contain any profile feedback information for
4903 the newly added function or file respectively. Also, in the case when profile
4904 count data (.gcda) files are removed, GCC cannot use any profile feedback
4905 information. In all these cases, warnings are issued to inform the user that a
4906 profile generation step is due. @option{-Wno-missing-profile} can be used to
4907 disable the warning. Ignoring the warning can result in poorly optimized code.
4908 Completely disabling the warning is not recommended and should be done only
4909 when non-existent profile data is justified.
4910
4911 @item -Wmultistatement-macros
4912 @opindex Wmultistatement-macros
4913 @opindex Wno-multistatement-macros
4914 Warn about unsafe multiple statement macros that appear to be guarded
4915 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
4916 @code{while}, in which only the first statement is actually guarded after
4917 the macro is expanded.
4918
4919 For example:
4920
4921 @smallexample
4922 #define DOIT x++; y++
4923 if (c)
4924 DOIT;
4925 @end smallexample
4926
4927 will increment @code{y} unconditionally, not just when @code{c} holds.
4928 The can usually be fixed by wrapping the macro in a do-while loop:
4929 @smallexample
4930 #define DOIT do @{ x++; y++; @} while (0)
4931 if (c)
4932 DOIT;
4933 @end smallexample
4934
4935 This warning is enabled by @option{-Wall} in C and C++.
4936
4937 @item -Wparentheses
4938 @opindex Wparentheses
4939 @opindex Wno-parentheses
4940 Warn if parentheses are omitted in certain contexts, such
4941 as when there is an assignment in a context where a truth value
4942 is expected, or when operators are nested whose precedence people
4943 often get confused about.
4944
4945 Also warn if a comparison like @code{x<=y<=z} appears; this is
4946 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4947 interpretation from that of ordinary mathematical notation.
4948
4949 Also warn for dangerous uses of the GNU extension to
4950 @code{?:} with omitted middle operand. When the condition
4951 in the @code{?}: operator is a boolean expression, the omitted value is
4952 always 1. Often programmers expect it to be a value computed
4953 inside the conditional expression instead.
4954
4955 For C++ this also warns for some cases of unnecessary parentheses in
4956 declarations, which can indicate an attempt at a function call instead
4957 of a declaration:
4958 @smallexample
4959 @{
4960 // Declares a local variable called mymutex.
4961 std::unique_lock<std::mutex> (mymutex);
4962 // User meant std::unique_lock<std::mutex> lock (mymutex);
4963 @}
4964 @end smallexample
4965
4966 This warning is enabled by @option{-Wall}.
4967
4968 @item -Wsequence-point
4969 @opindex Wsequence-point
4970 @opindex Wno-sequence-point
4971 Warn about code that may have undefined semantics because of violations
4972 of sequence point rules in the C and C++ standards.
4973
4974 The C and C++ standards define the order in which expressions in a C/C++
4975 program are evaluated in terms of @dfn{sequence points}, which represent
4976 a partial ordering between the execution of parts of the program: those
4977 executed before the sequence point, and those executed after it. These
4978 occur after the evaluation of a full expression (one which is not part
4979 of a larger expression), after the evaluation of the first operand of a
4980 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4981 function is called (but after the evaluation of its arguments and the
4982 expression denoting the called function), and in certain other places.
4983 Other than as expressed by the sequence point rules, the order of
4984 evaluation of subexpressions of an expression is not specified. All
4985 these rules describe only a partial order rather than a total order,
4986 since, for example, if two functions are called within one expression
4987 with no sequence point between them, the order in which the functions
4988 are called is not specified. However, the standards committee have
4989 ruled that function calls do not overlap.
4990
4991 It is not specified when between sequence points modifications to the
4992 values of objects take effect. Programs whose behavior depends on this
4993 have undefined behavior; the C and C++ standards specify that ``Between
4994 the previous and next sequence point an object shall have its stored
4995 value modified at most once by the evaluation of an expression.
4996 Furthermore, the prior value shall be read only to determine the value
4997 to be stored.''. If a program breaks these rules, the results on any
4998 particular implementation are entirely unpredictable.
4999
5000 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5001 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5002 diagnosed by this option, and it may give an occasional false positive
5003 result, but in general it has been found fairly effective at detecting
5004 this sort of problem in programs.
5005
5006 The C++17 standard will define the order of evaluation of operands in
5007 more cases: in particular it requires that the right-hand side of an
5008 assignment be evaluated before the left-hand side, so the above
5009 examples are no longer undefined. But this warning will still warn
5010 about them, to help people avoid writing code that is undefined in C
5011 and earlier revisions of C++.
5012
5013 The standard is worded confusingly, therefore there is some debate
5014 over the precise meaning of the sequence point rules in subtle cases.
5015 Links to discussions of the problem, including proposed formal
5016 definitions, may be found on the GCC readings page, at
5017 @uref{http://gcc.gnu.org/@/readings.html}.
5018
5019 This warning is enabled by @option{-Wall} for C and C++.
5020
5021 @item -Wno-return-local-addr
5022 @opindex Wno-return-local-addr
5023 @opindex Wreturn-local-addr
5024 Do not warn about returning a pointer (or in C++, a reference) to a
5025 variable that goes out of scope after the function returns.
5026
5027 @item -Wreturn-type
5028 @opindex Wreturn-type
5029 @opindex Wno-return-type
5030 Warn whenever a function is defined with a return type that defaults
5031 to @code{int}. Also warn about any @code{return} statement with no
5032 return value in a function whose return type is not @code{void}
5033 (falling off the end of the function body is considered returning
5034 without a value).
5035
5036 For C only, warn about a @code{return} statement with an expression in a
5037 function whose return type is @code{void}, unless the expression type is
5038 also @code{void}. As a GNU extension, the latter case is accepted
5039 without a warning unless @option{-Wpedantic} is used.
5040
5041 For C++, a function without return type always produces a diagnostic
5042 message, even when @option{-Wno-return-type} is specified. The only
5043 exceptions are @code{main} and functions defined in system headers.
5044
5045 This warning is enabled by default for C++ and is enabled by @option{-Wall}.
5046
5047 @item -Wshift-count-negative
5048 @opindex Wshift-count-negative
5049 @opindex Wno-shift-count-negative
5050 Warn if shift count is negative. This warning is enabled by default.
5051
5052 @item -Wshift-count-overflow
5053 @opindex Wshift-count-overflow
5054 @opindex Wno-shift-count-overflow
5055 Warn if shift count >= width of type. This warning is enabled by default.
5056
5057 @item -Wshift-negative-value
5058 @opindex Wshift-negative-value
5059 @opindex Wno-shift-negative-value
5060 Warn if left shifting a negative value. This warning is enabled by
5061 @option{-Wextra} in C99 and C++11 modes (and newer).
5062
5063 @item -Wshift-overflow
5064 @itemx -Wshift-overflow=@var{n}
5065 @opindex Wshift-overflow
5066 @opindex Wno-shift-overflow
5067 Warn about left shift overflows. This warning is enabled by
5068 default in C99 and C++11 modes (and newer).
5069
5070 @table @gcctabopt
5071 @item -Wshift-overflow=1
5072 This is the warning level of @option{-Wshift-overflow} and is enabled
5073 by default in C99 and C++11 modes (and newer). This warning level does
5074 not warn about left-shifting 1 into the sign bit. (However, in C, such
5075 an overflow is still rejected in contexts where an integer constant expression
5076 is required.)
5077
5078 @item -Wshift-overflow=2
5079 This warning level also warns about left-shifting 1 into the sign bit,
5080 unless C++14 mode is active.
5081 @end table
5082
5083 @item -Wswitch
5084 @opindex Wswitch
5085 @opindex Wno-switch
5086 Warn whenever a @code{switch} statement has an index of enumerated type
5087 and lacks a @code{case} for one or more of the named codes of that
5088 enumeration. (The presence of a @code{default} label prevents this
5089 warning.) @code{case} labels outside the enumeration range also
5090 provoke warnings when this option is used (even if there is a
5091 @code{default} label).
5092 This warning is enabled by @option{-Wall}.
5093
5094 @item -Wswitch-default
5095 @opindex Wswitch-default
5096 @opindex Wno-switch-default
5097 Warn whenever a @code{switch} statement does not have a @code{default}
5098 case.
5099
5100 @item -Wswitch-enum
5101 @opindex Wswitch-enum
5102 @opindex Wno-switch-enum
5103 Warn whenever a @code{switch} statement has an index of enumerated type
5104 and lacks a @code{case} for one or more of the named codes of that
5105 enumeration. @code{case} labels outside the enumeration range also
5106 provoke warnings when this option is used. The only difference
5107 between @option{-Wswitch} and this option is that this option gives a
5108 warning about an omitted enumeration code even if there is a
5109 @code{default} label.
5110
5111 @item -Wswitch-bool
5112 @opindex Wswitch-bool
5113 @opindex Wno-switch-bool
5114 Warn whenever a @code{switch} statement has an index of boolean type
5115 and the case values are outside the range of a boolean type.
5116 It is possible to suppress this warning by casting the controlling
5117 expression to a type other than @code{bool}. For example:
5118 @smallexample
5119 @group
5120 switch ((int) (a == 4))
5121 @{
5122 @dots{}
5123 @}
5124 @end group
5125 @end smallexample
5126 This warning is enabled by default for C and C++ programs.
5127
5128 @item -Wswitch-unreachable
5129 @opindex Wswitch-unreachable
5130 @opindex Wno-switch-unreachable
5131 Warn whenever a @code{switch} statement contains statements between the
5132 controlling expression and the first case label, which will never be
5133 executed. For example:
5134 @smallexample
5135 @group
5136 switch (cond)
5137 @{
5138 i = 15;
5139 @dots{}
5140 case 5:
5141 @dots{}
5142 @}
5143 @end group
5144 @end smallexample
5145 @option{-Wswitch-unreachable} does not warn if the statement between the
5146 controlling expression and the first case label is just a declaration:
5147 @smallexample
5148 @group
5149 switch (cond)
5150 @{
5151 int i;
5152 @dots{}
5153 case 5:
5154 i = 5;
5155 @dots{}
5156 @}
5157 @end group
5158 @end smallexample
5159 This warning is enabled by default for C and C++ programs.
5160
5161 @item -Wsync-nand @r{(C and C++ only)}
5162 @opindex Wsync-nand
5163 @opindex Wno-sync-nand
5164 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5165 built-in functions are used. These functions changed semantics in GCC 4.4.
5166
5167 @item -Wunused-but-set-parameter
5168 @opindex Wunused-but-set-parameter
5169 @opindex Wno-unused-but-set-parameter
5170 Warn whenever a function parameter is assigned to, but otherwise unused
5171 (aside from its declaration).
5172
5173 To suppress this warning use the @code{unused} attribute
5174 (@pxref{Variable Attributes}).
5175
5176 This warning is also enabled by @option{-Wunused} together with
5177 @option{-Wextra}.
5178
5179 @item -Wunused-but-set-variable
5180 @opindex Wunused-but-set-variable
5181 @opindex Wno-unused-but-set-variable
5182 Warn whenever a local variable is assigned to, but otherwise unused
5183 (aside from its declaration).
5184 This warning is enabled by @option{-Wall}.
5185
5186 To suppress this warning use the @code{unused} attribute
5187 (@pxref{Variable Attributes}).
5188
5189 This warning is also enabled by @option{-Wunused}, which is enabled
5190 by @option{-Wall}.
5191
5192 @item -Wunused-function
5193 @opindex Wunused-function
5194 @opindex Wno-unused-function
5195 Warn whenever a static function is declared but not defined or a
5196 non-inline static function is unused.
5197 This warning is enabled by @option{-Wall}.
5198
5199 @item -Wunused-label
5200 @opindex Wunused-label
5201 @opindex Wno-unused-label
5202 Warn whenever a label is declared but not used.
5203 This warning is enabled by @option{-Wall}.
5204
5205 To suppress this warning use the @code{unused} attribute
5206 (@pxref{Variable Attributes}).
5207
5208 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5209 @opindex Wunused-local-typedefs
5210 @opindex Wno-unused-local-typedefs
5211 Warn when a typedef locally defined in a function is not used.
5212 This warning is enabled by @option{-Wall}.
5213
5214 @item -Wunused-parameter
5215 @opindex Wunused-parameter
5216 @opindex Wno-unused-parameter
5217 Warn whenever a function parameter is unused aside from its declaration.
5218
5219 To suppress this warning use the @code{unused} attribute
5220 (@pxref{Variable Attributes}).
5221
5222 @item -Wno-unused-result
5223 @opindex Wunused-result
5224 @opindex Wno-unused-result
5225 Do not warn if a caller of a function marked with attribute
5226 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5227 its return value. The default is @option{-Wunused-result}.
5228
5229 @item -Wunused-variable
5230 @opindex Wunused-variable
5231 @opindex Wno-unused-variable
5232 Warn whenever a local or static variable is unused aside from its
5233 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5234 but not for C++. This warning is enabled by @option{-Wall}.
5235
5236 To suppress this warning use the @code{unused} attribute
5237 (@pxref{Variable Attributes}).
5238
5239 @item -Wunused-const-variable
5240 @itemx -Wunused-const-variable=@var{n}
5241 @opindex Wunused-const-variable
5242 @opindex Wno-unused-const-variable
5243 Warn whenever a constant static variable is unused aside from its declaration.
5244 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5245 for C, but not for C++. In C this declares variable storage, but in C++ this
5246 is not an error since const variables take the place of @code{#define}s.
5247
5248 To suppress this warning use the @code{unused} attribute
5249 (@pxref{Variable Attributes}).
5250
5251 @table @gcctabopt
5252 @item -Wunused-const-variable=1
5253 This is the warning level that is enabled by @option{-Wunused-variable} for
5254 C. It warns only about unused static const variables defined in the main
5255 compilation unit, but not about static const variables declared in any
5256 header included.
5257
5258 @item -Wunused-const-variable=2
5259 This warning level also warns for unused constant static variables in
5260 headers (excluding system headers). This is the warning level of
5261 @option{-Wunused-const-variable} and must be explicitly requested since
5262 in C++ this isn't an error and in C it might be harder to clean up all
5263 headers included.
5264 @end table
5265
5266 @item -Wunused-value
5267 @opindex Wunused-value
5268 @opindex Wno-unused-value
5269 Warn whenever a statement computes a result that is explicitly not
5270 used. To suppress this warning cast the unused expression to
5271 @code{void}. This includes an expression-statement or the left-hand
5272 side of a comma expression that contains no side effects. For example,
5273 an expression such as @code{x[i,j]} causes a warning, while
5274 @code{x[(void)i,j]} does not.
5275
5276 This warning is enabled by @option{-Wall}.
5277
5278 @item -Wunused
5279 @opindex Wunused
5280 @opindex Wno-unused
5281 All the above @option{-Wunused} options combined.
5282
5283 In order to get a warning about an unused function parameter, you must
5284 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5285 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5286
5287 @item -Wuninitialized
5288 @opindex Wuninitialized
5289 @opindex Wno-uninitialized
5290 Warn if an automatic variable is used without first being initialized
5291 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5292 warn if a non-static reference or non-static @code{const} member
5293 appears in a class without constructors.
5294
5295 If you want to warn about code that uses the uninitialized value of the
5296 variable in its own initializer, use the @option{-Winit-self} option.
5297
5298 These warnings occur for individual uninitialized or clobbered
5299 elements of structure, union or array variables as well as for
5300 variables that are uninitialized or clobbered as a whole. They do
5301 not occur for variables or elements declared @code{volatile}. Because
5302 these warnings depend on optimization, the exact variables or elements
5303 for which there are warnings depends on the precise optimization
5304 options and version of GCC used.
5305
5306 Note that there may be no warning about a variable that is used only
5307 to compute a value that itself is never used, because such
5308 computations may be deleted by data flow analysis before the warnings
5309 are printed.
5310
5311 @item -Winvalid-memory-model
5312 @opindex Winvalid-memory-model
5313 @opindex Wno-invalid-memory-model
5314 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5315 and the C11 atomic generic functions with a memory consistency argument
5316 that is either invalid for the operation or outside the range of values
5317 of the @code{memory_order} enumeration. For example, since the
5318 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5319 defined for the relaxed, release, and sequentially consistent memory
5320 orders the following code is diagnosed:
5321
5322 @smallexample
5323 void store (int *i)
5324 @{
5325 __atomic_store_n (i, 0, memory_order_consume);
5326 @}
5327 @end smallexample
5328
5329 @option{-Winvalid-memory-model} is enabled by default.
5330
5331 @item -Wmaybe-uninitialized
5332 @opindex Wmaybe-uninitialized
5333 @opindex Wno-maybe-uninitialized
5334 For an automatic (i.e.@: local) variable, if there exists a path from the
5335 function entry to a use of the variable that is initialized, but there exist
5336 some other paths for which the variable is not initialized, the compiler
5337 emits a warning if it cannot prove the uninitialized paths are not
5338 executed at run time.
5339
5340 These warnings are only possible in optimizing compilation, because otherwise
5341 GCC does not keep track of the state of variables.
5342
5343 These warnings are made optional because GCC may not be able to determine when
5344 the code is correct in spite of appearing to have an error. Here is one
5345 example of how this can happen:
5346
5347 @smallexample
5348 @group
5349 @{
5350 int x;
5351 switch (y)
5352 @{
5353 case 1: x = 1;
5354 break;
5355 case 2: x = 4;
5356 break;
5357 case 3: x = 5;
5358 @}
5359 foo (x);
5360 @}
5361 @end group
5362 @end smallexample
5363
5364 @noindent
5365 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5366 always initialized, but GCC doesn't know this. To suppress the
5367 warning, you need to provide a default case with assert(0) or
5368 similar code.
5369
5370 @cindex @code{longjmp} warnings
5371 This option also warns when a non-volatile automatic variable might be
5372 changed by a call to @code{longjmp}.
5373 The compiler sees only the calls to @code{setjmp}. It cannot know
5374 where @code{longjmp} will be called; in fact, a signal handler could
5375 call it at any point in the code. As a result, you may get a warning
5376 even when there is in fact no problem because @code{longjmp} cannot
5377 in fact be called at the place that would cause a problem.
5378
5379 Some spurious warnings can be avoided if you declare all the functions
5380 you use that never return as @code{noreturn}. @xref{Function
5381 Attributes}.
5382
5383 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5384
5385 @item -Wunknown-pragmas
5386 @opindex Wunknown-pragmas
5387 @opindex Wno-unknown-pragmas
5388 @cindex warning for unknown pragmas
5389 @cindex unknown pragmas, warning
5390 @cindex pragmas, warning of unknown
5391 Warn when a @code{#pragma} directive is encountered that is not understood by
5392 GCC@. If this command-line option is used, warnings are even issued
5393 for unknown pragmas in system header files. This is not the case if
5394 the warnings are only enabled by the @option{-Wall} command-line option.
5395
5396 @item -Wno-pragmas
5397 @opindex Wno-pragmas
5398 @opindex Wpragmas
5399 Do not warn about misuses of pragmas, such as incorrect parameters,
5400 invalid syntax, or conflicts between pragmas. See also
5401 @option{-Wunknown-pragmas}.
5402
5403 @item -Wno-prio-ctor-dtor
5404 @opindex Wno-prio-ctor-dtor
5405 @opindex Wprio-ctor-dtor
5406 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5407 The use of constructor and destructor attributes allow you to assign a
5408 priority to the constructor/destructor to control its order of execution
5409 before @code{main} is called or after it returns. The priority values must be
5410 greater than 100 as the compiler reserves priority values between 0--100 for
5411 the implementation.
5412
5413 @item -Wstrict-aliasing
5414 @opindex Wstrict-aliasing
5415 @opindex Wno-strict-aliasing
5416 This option is only active when @option{-fstrict-aliasing} is active.
5417 It warns about code that might break the strict aliasing rules that the
5418 compiler is using for optimization. The warning does not catch all
5419 cases, but does attempt to catch the more common pitfalls. It is
5420 included in @option{-Wall}.
5421 It is equivalent to @option{-Wstrict-aliasing=3}
5422
5423 @item -Wstrict-aliasing=n
5424 @opindex Wstrict-aliasing=n
5425 This option is only active when @option{-fstrict-aliasing} is active.
5426 It warns about code that might break the strict aliasing rules that the
5427 compiler is using for optimization.
5428 Higher levels correspond to higher accuracy (fewer false positives).
5429 Higher levels also correspond to more effort, similar to the way @option{-O}
5430 works.
5431 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5432
5433 Level 1: Most aggressive, quick, least accurate.
5434 Possibly useful when higher levels
5435 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5436 false negatives. However, it has many false positives.
5437 Warns for all pointer conversions between possibly incompatible types,
5438 even if never dereferenced. Runs in the front end only.
5439
5440 Level 2: Aggressive, quick, not too precise.
5441 May still have many false positives (not as many as level 1 though),
5442 and few false negatives (but possibly more than level 1).
5443 Unlike level 1, it only warns when an address is taken. Warns about
5444 incomplete types. Runs in the front end only.
5445
5446 Level 3 (default for @option{-Wstrict-aliasing}):
5447 Should have very few false positives and few false
5448 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5449 Takes care of the common pun+dereference pattern in the front end:
5450 @code{*(int*)&some_float}.
5451 If optimization is enabled, it also runs in the back end, where it deals
5452 with multiple statement cases using flow-sensitive points-to information.
5453 Only warns when the converted pointer is dereferenced.
5454 Does not warn about incomplete types.
5455
5456 @item -Wstrict-overflow
5457 @itemx -Wstrict-overflow=@var{n}
5458 @opindex Wstrict-overflow
5459 @opindex Wno-strict-overflow
5460 This option is only active when signed overflow is undefined.
5461 It warns about cases where the compiler optimizes based on the
5462 assumption that signed overflow does not occur. Note that it does not
5463 warn about all cases where the code might overflow: it only warns
5464 about cases where the compiler implements some optimization. Thus
5465 this warning depends on the optimization level.
5466
5467 An optimization that assumes that signed overflow does not occur is
5468 perfectly safe if the values of the variables involved are such that
5469 overflow never does, in fact, occur. Therefore this warning can
5470 easily give a false positive: a warning about code that is not
5471 actually a problem. To help focus on important issues, several
5472 warning levels are defined. No warnings are issued for the use of
5473 undefined signed overflow when estimating how many iterations a loop
5474 requires, in particular when determining whether a loop will be
5475 executed at all.
5476
5477 @table @gcctabopt
5478 @item -Wstrict-overflow=1
5479 Warn about cases that are both questionable and easy to avoid. For
5480 example the compiler simplifies
5481 @code{x + 1 > x} to @code{1}. This level of
5482 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5483 are not, and must be explicitly requested.
5484
5485 @item -Wstrict-overflow=2
5486 Also warn about other cases where a comparison is simplified to a
5487 constant. For example: @code{abs (x) >= 0}. This can only be
5488 simplified when signed integer overflow is undefined, because
5489 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5490 zero. @option{-Wstrict-overflow} (with no level) is the same as
5491 @option{-Wstrict-overflow=2}.
5492
5493 @item -Wstrict-overflow=3
5494 Also warn about other cases where a comparison is simplified. For
5495 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5496
5497 @item -Wstrict-overflow=4
5498 Also warn about other simplifications not covered by the above cases.
5499 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5500
5501 @item -Wstrict-overflow=5
5502 Also warn about cases where the compiler reduces the magnitude of a
5503 constant involved in a comparison. For example: @code{x + 2 > y} is
5504 simplified to @code{x + 1 >= y}. This is reported only at the
5505 highest warning level because this simplification applies to many
5506 comparisons, so this warning level gives a very large number of
5507 false positives.
5508 @end table
5509
5510 @item -Wstringop-overflow
5511 @itemx -Wstringop-overflow=@var{type}
5512 @opindex Wstringop-overflow
5513 @opindex Wno-stringop-overflow
5514 Warn for calls to string manipulation functions such as @code{memcpy} and
5515 @code{strcpy} that are determined to overflow the destination buffer. The
5516 optional argument is one greater than the type of Object Size Checking to
5517 perform to determine the size of the destination. @xref{Object Size Checking}.
5518 The argument is meaningful only for functions that operate on character arrays
5519 but not for raw memory functions like @code{memcpy} which always make use
5520 of Object Size type-0. The option also warns for calls that specify a size
5521 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5522 The option produces the best results with optimization enabled but can detect
5523 a small subset of simple buffer overflows even without optimization in
5524 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5525 correspond to the standard functions. In any case, the option warns about
5526 just a subset of buffer overflows detected by the corresponding overflow
5527 checking built-ins. For example, the option will issue a warning for
5528 the @code{strcpy} call below because it copies at least 5 characters
5529 (the string @code{"blue"} including the terminating NUL) into the buffer
5530 of size 4.
5531
5532 @smallexample
5533 enum Color @{ blue, purple, yellow @};
5534 const char* f (enum Color clr)
5535 @{
5536 static char buf [4];
5537 const char *str;
5538 switch (clr)
5539 @{
5540 case blue: str = "blue"; break;
5541 case purple: str = "purple"; break;
5542 case yellow: str = "yellow"; break;
5543 @}
5544
5545 return strcpy (buf, str); // warning here
5546 @}
5547 @end smallexample
5548
5549 Option @option{-Wstringop-overflow=2} is enabled by default.
5550
5551 @table @gcctabopt
5552 @item -Wstringop-overflow
5553 @itemx -Wstringop-overflow=1
5554 @opindex Wstringop-overflow
5555 @opindex Wno-stringop-overflow
5556 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5557 to determine the sizes of destination objects. This is the default setting
5558 of the option. At this setting the option will not warn for writes past
5559 the end of subobjects of larger objects accessed by pointers unless the
5560 size of the largest surrounding object is known. When the destination may
5561 be one of several objects it is assumed to be the largest one of them. On
5562 Linux systems, when optimization is enabled at this setting the option warns
5563 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5564 a non-zero value.
5565
5566 @item -Wstringop-overflow=2
5567 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5568 to determine the sizes of destination objects. At this setting the option
5569 will warn about overflows when writing to members of the largest complete
5570 objects whose exact size is known. It will, however, not warn for excessive
5571 writes to the same members of unknown objects referenced by pointers since
5572 they may point to arrays containing unknown numbers of elements.
5573
5574 @item -Wstringop-overflow=3
5575 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5576 to determine the sizes of destination objects. At this setting the option
5577 warns about overflowing the smallest object or data member. This is the
5578 most restrictive setting of the option that may result in warnings for safe
5579 code.
5580
5581 @item -Wstringop-overflow=4
5582 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5583 to determine the sizes of destination objects. At this setting the option
5584 will warn about overflowing any data members, and when the destination is
5585 one of several objects it uses the size of the largest of them to decide
5586 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5587 setting of the option may result in warnings for benign code.
5588 @end table
5589
5590 @item -Wstringop-truncation
5591 @opindex Wstringop-truncation
5592 @opindex Wno-stringop-truncation
5593 Warn for calls to bounded string manipulation functions such as @code{strncat},
5594 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5595 or leave the destination unchanged.
5596
5597 In the following example, the call to @code{strncat} specifies a bound that
5598 is less than the length of the source string. As a result, the copy of
5599 the source will be truncated and so the call is diagnosed. To avoid the
5600 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5601
5602 @smallexample
5603 void append (char *buf, size_t bufsize)
5604 @{
5605 strncat (buf, ".txt", 3);
5606 @}
5607 @end smallexample
5608
5609 As another example, the following call to @code{strncpy} results in copying
5610 to @code{d} just the characters preceding the terminating NUL, without
5611 appending the NUL to the end. Assuming the result of @code{strncpy} is
5612 necessarily a NUL-terminated string is a common mistake, and so the call
5613 is diagnosed. To avoid the warning when the result is not expected to be
5614 NUL-terminated, call @code{memcpy} instead.
5615
5616 @smallexample
5617 void copy (char *d, const char *s)
5618 @{
5619 strncpy (d, s, strlen (s));
5620 @}
5621 @end smallexample
5622
5623 In the following example, the call to @code{strncpy} specifies the size
5624 of the destination buffer as the bound. If the length of the source
5625 string is equal to or greater than this size the result of the copy will
5626 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5627 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5628 element of the buffer to @code{NUL}.
5629
5630 @smallexample
5631 void copy (const char *s)
5632 @{
5633 char buf[80];
5634 strncpy (buf, s, sizeof buf);
5635 @dots{}
5636 @}
5637 @end smallexample
5638
5639 In situations where a character array is intended to store a sequence
5640 of bytes with no terminating @code{NUL} such an array may be annotated
5641 with attribute @code{nonstring} to avoid this warning. Such arrays,
5642 however, are not suitable arguments to functions that expect
5643 @code{NUL}-terminated strings. To help detect accidental misuses of
5644 such arrays GCC issues warnings unless it can prove that the use is
5645 safe. @xref{Common Variable Attributes}.
5646
5647 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5648 @opindex Wsuggest-attribute=
5649 @opindex Wno-suggest-attribute=
5650 Warn for cases where adding an attribute may be beneficial. The
5651 attributes currently supported are listed below.
5652
5653 @table @gcctabopt
5654 @item -Wsuggest-attribute=pure
5655 @itemx -Wsuggest-attribute=const
5656 @itemx -Wsuggest-attribute=noreturn
5657 @itemx -Wsuggest-attribute=malloc
5658 @opindex Wsuggest-attribute=pure
5659 @opindex Wno-suggest-attribute=pure
5660 @opindex Wsuggest-attribute=const
5661 @opindex Wno-suggest-attribute=const
5662 @opindex Wsuggest-attribute=noreturn
5663 @opindex Wno-suggest-attribute=noreturn
5664 @opindex Wsuggest-attribute=malloc
5665 @opindex Wno-suggest-attribute=malloc
5666
5667 Warn about functions that might be candidates for attributes
5668 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5669 only warns for functions visible in other compilation units or (in the case of
5670 @code{pure} and @code{const}) if it cannot prove that the function returns
5671 normally. A function returns normally if it doesn't contain an infinite loop or
5672 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5673 requires option @option{-fipa-pure-const}, which is enabled by default at
5674 @option{-O} and higher. Higher optimization levels improve the accuracy
5675 of the analysis.
5676
5677 @item -Wsuggest-attribute=format
5678 @itemx -Wmissing-format-attribute
5679 @opindex Wsuggest-attribute=format
5680 @opindex Wmissing-format-attribute
5681 @opindex Wno-suggest-attribute=format
5682 @opindex Wno-missing-format-attribute
5683 @opindex Wformat
5684 @opindex Wno-format
5685
5686 Warn about function pointers that might be candidates for @code{format}
5687 attributes. Note these are only possible candidates, not absolute ones.
5688 GCC guesses that function pointers with @code{format} attributes that
5689 are used in assignment, initialization, parameter passing or return
5690 statements should have a corresponding @code{format} attribute in the
5691 resulting type. I.e.@: the left-hand side of the assignment or
5692 initialization, the type of the parameter variable, or the return type
5693 of the containing function respectively should also have a @code{format}
5694 attribute to avoid the warning.
5695
5696 GCC also warns about function definitions that might be
5697 candidates for @code{format} attributes. Again, these are only
5698 possible candidates. GCC guesses that @code{format} attributes
5699 might be appropriate for any function that calls a function like
5700 @code{vprintf} or @code{vscanf}, but this might not always be the
5701 case, and some functions for which @code{format} attributes are
5702 appropriate may not be detected.
5703
5704 @item -Wsuggest-attribute=cold
5705 @opindex Wsuggest-attribute=cold
5706 @opindex Wno-suggest-attribute=cold
5707
5708 Warn about functions that might be candidates for @code{cold} attribute. This
5709 is based on static detection and generally will only warn about functions which
5710 always leads to a call to another @code{cold} function such as wrappers of
5711 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5712 @end table
5713
5714 @item -Wsuggest-final-types
5715 @opindex Wno-suggest-final-types
5716 @opindex Wsuggest-final-types
5717 Warn about types with virtual methods where code quality would be improved
5718 if the type were declared with the C++11 @code{final} specifier,
5719 or, if possible,
5720 declared in an anonymous namespace. This allows GCC to more aggressively
5721 devirtualize the polymorphic calls. This warning is more effective with link
5722 time optimization, where the information about the class hierarchy graph is
5723 more complete.
5724
5725 @item -Wsuggest-final-methods
5726 @opindex Wno-suggest-final-methods
5727 @opindex Wsuggest-final-methods
5728 Warn about virtual methods where code quality would be improved if the method
5729 were declared with the C++11 @code{final} specifier,
5730 or, if possible, its type were
5731 declared in an anonymous namespace or with the @code{final} specifier.
5732 This warning is
5733 more effective with link-time optimization, where the information about the
5734 class hierarchy graph is more complete. It is recommended to first consider
5735 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5736 annotations.
5737
5738 @item -Wsuggest-override
5739 Warn about overriding virtual functions that are not marked with the override
5740 keyword.
5741
5742 @item -Walloc-zero
5743 @opindex Wno-alloc-zero
5744 @opindex Walloc-zero
5745 Warn about calls to allocation functions decorated with attribute
5746 @code{alloc_size} that specify zero bytes, including those to the built-in
5747 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5748 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5749 when called with a zero size differs among implementations (and in the case
5750 of @code{realloc} has been deprecated) relying on it may result in subtle
5751 portability bugs and should be avoided.
5752
5753 @item -Walloc-size-larger-than=@var{byte-size}
5754 @opindex Walloc-size-larger-than=
5755 @opindex Wno-alloc-size-larger-than
5756 Warn about calls to functions decorated with attribute @code{alloc_size}
5757 that attempt to allocate objects larger than the specified number of bytes,
5758 or where the result of the size computation in an integer type with infinite
5759 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
5760 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
5761 Warnings controlled by the option can be disabled either by specifying
5762 @var{byte-size} of @samp{SIZE_MAX} or more or by
5763 @option{-Wno-alloc-size-larger-than}.
5764 @xref{Function Attributes}.
5765
5766 @item -Wno-alloc-size-larger-than
5767 @opindex Wno-alloc-size-larger-than
5768 Disable @option{-Walloc-size-larger-than=} warnings. The option is
5769 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
5770 larger.
5771
5772 @item -Walloca
5773 @opindex Wno-alloca
5774 @opindex Walloca
5775 This option warns on all uses of @code{alloca} in the source.
5776
5777 @item -Walloca-larger-than=@var{byte-size}
5778 @opindex Walloca-larger-than=
5779 @opindex Wno-alloca-larger-than
5780 This option warns on calls to @code{alloca} with an integer argument whose
5781 value is either zero, or that is not bounded by a controlling predicate
5782 that limits its value to at most @var{byte-size}. It also warns for calls
5783 to @code{alloca} where the bound value is unknown. Arguments of non-integer
5784 types are considered unbounded even if they appear to be constrained to
5785 the expected range.
5786
5787 For example, a bounded case of @code{alloca} could be:
5788
5789 @smallexample
5790 void func (size_t n)
5791 @{
5792 void *p;
5793 if (n <= 1000)
5794 p = alloca (n);
5795 else
5796 p = malloc (n);
5797 f (p);
5798 @}
5799 @end smallexample
5800
5801 In the above example, passing @code{-Walloca-larger-than=1000} would not
5802 issue a warning because the call to @code{alloca} is known to be at most
5803 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5804 the compiler would emit a warning.
5805
5806 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5807 controlling predicate constraining its integer argument. For example:
5808
5809 @smallexample
5810 void func ()
5811 @{
5812 void *p = alloca (n);
5813 f (p);
5814 @}
5815 @end smallexample
5816
5817 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5818 a warning, but this time because of the lack of bounds checking.
5819
5820 Note, that even seemingly correct code involving signed integers could
5821 cause a warning:
5822
5823 @smallexample
5824 void func (signed int n)
5825 @{
5826 if (n < 500)
5827 @{
5828 p = alloca (n);
5829 f (p);
5830 @}
5831 @}
5832 @end smallexample
5833
5834 In the above example, @var{n} could be negative, causing a larger than
5835 expected argument to be implicitly cast into the @code{alloca} call.
5836
5837 This option also warns when @code{alloca} is used in a loop.
5838
5839 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
5840 but is usually only effective when @option{-ftree-vrp} is active (default
5841 for @option{-O2} and above).
5842
5843 See also @option{-Wvla-larger-than=}@samp{byte-size}.
5844
5845 @item -Wno-alloca-larger-than
5846 @opindex Wno-alloca-larger-than
5847 Disable @option{-Walloca-larger-than=} warnings. The option is
5848 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
5849
5850 @item -Warray-bounds
5851 @itemx -Warray-bounds=@var{n}
5852 @opindex Wno-array-bounds
5853 @opindex Warray-bounds
5854 This option is only active when @option{-ftree-vrp} is active
5855 (default for @option{-O2} and above). It warns about subscripts to arrays
5856 that are always out of bounds. This warning is enabled by @option{-Wall}.
5857
5858 @table @gcctabopt
5859 @item -Warray-bounds=1
5860 This is the warning level of @option{-Warray-bounds} and is enabled
5861 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5862
5863 @item -Warray-bounds=2
5864 This warning level also warns about out of bounds access for
5865 arrays at the end of a struct and for arrays accessed through
5866 pointers. This warning level may give a larger number of
5867 false positives and is deactivated by default.
5868 @end table
5869
5870 @item -Wattribute-alias=@var{n}
5871 @itemx -Wno-attribute-alias
5872 @opindex -Wattribute-alias
5873 @opindex -Wno-attribute-alias
5874 Warn about declarations using the @code{alias} and similar attributes whose
5875 target is incompatible with the type of the alias.
5876 @xref{Function Attributes,,Declaring Attributes of Functions}.
5877 The @option{-Wattribute-alias=1} is enabled by @option{-Wall}.
5878
5879 @table @gcctabopt
5880 @item -Wattribute-alias=1
5881 The default warning level of the @option{-Wattribute-alias} option diagnoses
5882 incompatibilities between the type of the alias declaration and that of its
5883 target. Such incompatibilities are typically indicative of bugs.
5884
5885 @item -Wattribute-alias=2
5886 At this level @option{-Wattribute-alias} also diagnoses mismatches between
5887 the set of attributes of the alias declaration and the attributes applied
5888 to its target. Although in some cases such mismatches may indicate bugs,
5889 in other cases they may be benign and could be resolved simply by adding
5890 the missing attribute to the target.
5891 @end table
5892
5893 @item -Wbool-compare
5894 @opindex Wno-bool-compare
5895 @opindex Wbool-compare
5896 Warn about boolean expression compared with an integer value different from
5897 @code{true}/@code{false}. For instance, the following comparison is
5898 always false:
5899 @smallexample
5900 int n = 5;
5901 @dots{}
5902 if ((n > 1) == 2) @{ @dots{} @}
5903 @end smallexample
5904 This warning is enabled by @option{-Wall}.
5905
5906 @item -Wbool-operation
5907 @opindex Wno-bool-operation
5908 @opindex Wbool-operation
5909 Warn about suspicious operations on expressions of a boolean type. For
5910 instance, bitwise negation of a boolean is very likely a bug in the program.
5911 For C, this warning also warns about incrementing or decrementing a boolean,
5912 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5913 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
5914
5915 This warning is enabled by @option{-Wall}.
5916
5917 @item -Wduplicated-branches
5918 @opindex Wno-duplicated-branches
5919 @opindex Wduplicated-branches
5920 Warn when an if-else has identical branches. This warning detects cases like
5921 @smallexample
5922 if (p != NULL)
5923 return 0;
5924 else
5925 return 0;
5926 @end smallexample
5927 It doesn't warn when both branches contain just a null statement. This warning
5928 also warn for conditional operators:
5929 @smallexample
5930 int i = x ? *p : *p;
5931 @end smallexample
5932
5933 @item -Wduplicated-cond
5934 @opindex Wno-duplicated-cond
5935 @opindex Wduplicated-cond
5936 Warn about duplicated conditions in an if-else-if chain. For instance,
5937 warn for the following code:
5938 @smallexample
5939 if (p->q != NULL) @{ @dots{} @}
5940 else if (p->q != NULL) @{ @dots{} @}
5941 @end smallexample
5942
5943 @item -Wframe-address
5944 @opindex Wno-frame-address
5945 @opindex Wframe-address
5946 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5947 is called with an argument greater than 0. Such calls may return indeterminate
5948 values or crash the program. The warning is included in @option{-Wall}.
5949
5950 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5951 @opindex Wno-discarded-qualifiers
5952 @opindex Wdiscarded-qualifiers
5953 Do not warn if type qualifiers on pointers are being discarded.
5954 Typically, the compiler warns if a @code{const char *} variable is
5955 passed to a function that takes a @code{char *} parameter. This option
5956 can be used to suppress such a warning.
5957
5958 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5959 @opindex Wno-discarded-array-qualifiers
5960 @opindex Wdiscarded-array-qualifiers
5961 Do not warn if type qualifiers on arrays which are pointer targets
5962 are being discarded. Typically, the compiler warns if a
5963 @code{const int (*)[]} variable is passed to a function that
5964 takes a @code{int (*)[]} parameter. This option can be used to
5965 suppress such a warning.
5966
5967 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5968 @opindex Wno-incompatible-pointer-types
5969 @opindex Wincompatible-pointer-types
5970 Do not warn when there is a conversion between pointers that have incompatible
5971 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5972 which warns for pointer argument passing or assignment with different
5973 signedness.
5974
5975 @item -Wno-int-conversion @r{(C and Objective-C only)}
5976 @opindex Wno-int-conversion
5977 @opindex Wint-conversion
5978 Do not warn about incompatible integer to pointer and pointer to integer
5979 conversions. This warning is about implicit conversions; for explicit
5980 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5981 @option{-Wno-pointer-to-int-cast} may be used.
5982
5983 @item -Wno-div-by-zero
5984 @opindex Wno-div-by-zero
5985 @opindex Wdiv-by-zero
5986 Do not warn about compile-time integer division by zero. Floating-point
5987 division by zero is not warned about, as it can be a legitimate way of
5988 obtaining infinities and NaNs.
5989
5990 @item -Wsystem-headers
5991 @opindex Wsystem-headers
5992 @opindex Wno-system-headers
5993 @cindex warnings from system headers
5994 @cindex system headers, warnings from
5995 Print warning messages for constructs found in system header files.
5996 Warnings from system headers are normally suppressed, on the assumption
5997 that they usually do not indicate real problems and would only make the
5998 compiler output harder to read. Using this command-line option tells
5999 GCC to emit warnings from system headers as if they occurred in user
6000 code. However, note that using @option{-Wall} in conjunction with this
6001 option does @emph{not} warn about unknown pragmas in system
6002 headers---for that, @option{-Wunknown-pragmas} must also be used.
6003
6004 @item -Wtautological-compare
6005 @opindex Wtautological-compare
6006 @opindex Wno-tautological-compare
6007 Warn if a self-comparison always evaluates to true or false. This
6008 warning detects various mistakes such as:
6009 @smallexample
6010 int i = 1;
6011 @dots{}
6012 if (i > i) @{ @dots{} @}
6013 @end smallexample
6014
6015 This warning also warns about bitwise comparisons that always evaluate
6016 to true or false, for instance:
6017 @smallexample
6018 if ((a & 16) == 10) @{ @dots{} @}
6019 @end smallexample
6020 will always be false.
6021
6022 This warning is enabled by @option{-Wall}.
6023
6024 @item -Wtrampolines
6025 @opindex Wtrampolines
6026 @opindex Wno-trampolines
6027 Warn about trampolines generated for pointers to nested functions.
6028 A trampoline is a small piece of data or code that is created at run
6029 time on the stack when the address of a nested function is taken, and is
6030 used to call the nested function indirectly. For some targets, it is
6031 made up of data only and thus requires no special treatment. But, for
6032 most targets, it is made up of code and thus requires the stack to be
6033 made executable in order for the program to work properly.
6034
6035 @item -Wfloat-equal
6036 @opindex Wfloat-equal
6037 @opindex Wno-float-equal
6038 Warn if floating-point values are used in equality comparisons.
6039
6040 The idea behind this is that sometimes it is convenient (for the
6041 programmer) to consider floating-point values as approximations to
6042 infinitely precise real numbers. If you are doing this, then you need
6043 to compute (by analyzing the code, or in some other way) the maximum or
6044 likely maximum error that the computation introduces, and allow for it
6045 when performing comparisons (and when producing output, but that's a
6046 different problem). In particular, instead of testing for equality, you
6047 should check to see whether the two values have ranges that overlap; and
6048 this is done with the relational operators, so equality comparisons are
6049 probably mistaken.
6050
6051 @item -Wtraditional @r{(C and Objective-C only)}
6052 @opindex Wtraditional
6053 @opindex Wno-traditional
6054 Warn about certain constructs that behave differently in traditional and
6055 ISO C@. Also warn about ISO C constructs that have no traditional C
6056 equivalent, and/or problematic constructs that should be avoided.
6057
6058 @itemize @bullet
6059 @item
6060 Macro parameters that appear within string literals in the macro body.
6061 In traditional C macro replacement takes place within string literals,
6062 but in ISO C it does not.
6063
6064 @item
6065 In traditional C, some preprocessor directives did not exist.
6066 Traditional preprocessors only considered a line to be a directive
6067 if the @samp{#} appeared in column 1 on the line. Therefore
6068 @option{-Wtraditional} warns about directives that traditional C
6069 understands but ignores because the @samp{#} does not appear as the
6070 first character on the line. It also suggests you hide directives like
6071 @code{#pragma} not understood by traditional C by indenting them. Some
6072 traditional implementations do not recognize @code{#elif}, so this option
6073 suggests avoiding it altogether.
6074
6075 @item
6076 A function-like macro that appears without arguments.
6077
6078 @item
6079 The unary plus operator.
6080
6081 @item
6082 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6083 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6084 constants.) Note, these suffixes appear in macros defined in the system
6085 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6086 Use of these macros in user code might normally lead to spurious
6087 warnings, however GCC's integrated preprocessor has enough context to
6088 avoid warning in these cases.
6089
6090 @item
6091 A function declared external in one block and then used after the end of
6092 the block.
6093
6094 @item
6095 A @code{switch} statement has an operand of type @code{long}.
6096
6097 @item
6098 A non-@code{static} function declaration follows a @code{static} one.
6099 This construct is not accepted by some traditional C compilers.
6100
6101 @item
6102 The ISO type of an integer constant has a different width or
6103 signedness from its traditional type. This warning is only issued if
6104 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6105 typically represent bit patterns, are not warned about.
6106
6107 @item
6108 Usage of ISO string concatenation is detected.
6109
6110 @item
6111 Initialization of automatic aggregates.
6112
6113 @item
6114 Identifier conflicts with labels. Traditional C lacks a separate
6115 namespace for labels.
6116
6117 @item
6118 Initialization of unions. If the initializer is zero, the warning is
6119 omitted. This is done under the assumption that the zero initializer in
6120 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6121 initializer warnings and relies on default initialization to zero in the
6122 traditional C case.
6123
6124 @item
6125 Conversions by prototypes between fixed/floating-point values and vice
6126 versa. The absence of these prototypes when compiling with traditional
6127 C causes serious problems. This is a subset of the possible
6128 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6129
6130 @item
6131 Use of ISO C style function definitions. This warning intentionally is
6132 @emph{not} issued for prototype declarations or variadic functions
6133 because these ISO C features appear in your code when using
6134 libiberty's traditional C compatibility macros, @code{PARAMS} and
6135 @code{VPARAMS}. This warning is also bypassed for nested functions
6136 because that feature is already a GCC extension and thus not relevant to
6137 traditional C compatibility.
6138 @end itemize
6139
6140 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6141 @opindex Wtraditional-conversion
6142 @opindex Wno-traditional-conversion
6143 Warn if a prototype causes a type conversion that is different from what
6144 would happen to the same argument in the absence of a prototype. This
6145 includes conversions of fixed point to floating and vice versa, and
6146 conversions changing the width or signedness of a fixed-point argument
6147 except when the same as the default promotion.
6148
6149 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6150 @opindex Wdeclaration-after-statement
6151 @opindex Wno-declaration-after-statement
6152 Warn when a declaration is found after a statement in a block. This
6153 construct, known from C++, was introduced with ISO C99 and is by default
6154 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6155
6156 @item -Wshadow
6157 @opindex Wshadow
6158 @opindex Wno-shadow
6159 Warn whenever a local variable or type declaration shadows another
6160 variable, parameter, type, class member (in C++), or instance variable
6161 (in Objective-C) or whenever a built-in function is shadowed. Note
6162 that in C++, the compiler warns if a local variable shadows an
6163 explicit typedef, but not if it shadows a struct/class/enum.
6164 Same as @option{-Wshadow=global}.
6165
6166 @item -Wno-shadow-ivar @r{(Objective-C only)}
6167 @opindex Wno-shadow-ivar
6168 @opindex Wshadow-ivar
6169 Do not warn whenever a local variable shadows an instance variable in an
6170 Objective-C method.
6171
6172 @item -Wshadow=global
6173 @opindex Wshadow=local
6174 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6175
6176 @item -Wshadow=local
6177 @opindex Wshadow=local
6178 Warn when a local variable shadows another local variable or parameter.
6179 This warning is enabled by @option{-Wshadow=global}.
6180
6181 @item -Wshadow=compatible-local
6182 @opindex Wshadow=compatible-local
6183 Warn when a local variable shadows another local variable or parameter
6184 whose type is compatible with that of the shadowing variable. In C++,
6185 type compatibility here means the type of the shadowing variable can be
6186 converted to that of the shadowed variable. The creation of this flag
6187 (in addition to @option{-Wshadow=local}) is based on the idea that when
6188 a local variable shadows another one of incompatible type, it is most
6189 likely intentional, not a bug or typo, as shown in the following example:
6190
6191 @smallexample
6192 @group
6193 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6194 @{
6195 for (int i = 0; i < N; ++i)
6196 @{
6197 ...
6198 @}
6199 ...
6200 @}
6201 @end group
6202 @end smallexample
6203
6204 Since the two variable @code{i} in the example above have incompatible types,
6205 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6206 Because their types are incompatible, if a programmer accidentally uses one
6207 in place of the other, type checking will catch that and emit an error or
6208 warning. So not warning (about shadowing) in this case will not lead to
6209 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6210 possibly reduce the number of warnings triggered by intentional shadowing.
6211
6212 This warning is enabled by @option{-Wshadow=local}.
6213
6214 @item -Wlarger-than=@var{byte-size}
6215 @opindex Wlarger-than=
6216 @opindex Wlarger-than-@var{byte-size}
6217 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6218 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6219 Warnings controlled by the option can be disabled either by specifying
6220 @var{byte-size} of @samp{SIZE_MAX} or more or by
6221 @option{-Wno-larger-than}.
6222
6223 @item -Wno-larger-than
6224 @opindex Wno-larger-than
6225 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6226 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6227
6228 @item -Wframe-larger-than=@var{byte-size}
6229 @opindex Wframe-larger-than=
6230 @opindex Wno-frame-larger-than
6231 Warn if the size of a function frame exceeds @var{byte-size}.
6232 The computation done to determine the stack frame size is approximate
6233 and not conservative.
6234 The actual requirements may be somewhat greater than @var{byte-size}
6235 even if you do not get a warning. In addition, any space allocated
6236 via @code{alloca}, variable-length arrays, or related constructs
6237 is not included by the compiler when determining
6238 whether or not to issue a warning.
6239 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6240 Warnings controlled by the option can be disabled either by specifying
6241 @var{byte-size} of @samp{SIZE_MAX} or more or by
6242 @option{-Wno-frame-larger-than}.
6243
6244 @item -Wno-frame-larger-than
6245 @opindex Wno-frame-larger-than
6246 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6247 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6248
6249 @item -Wno-free-nonheap-object
6250 @opindex Wno-free-nonheap-object
6251 @opindex Wfree-nonheap-object
6252 Do not warn when attempting to free an object that was not allocated
6253 on the heap.
6254
6255 @item -Wstack-usage=@var{byte-size}
6256 @opindex Wstack-usage
6257 @opindex Wno-stack-usage
6258 Warn if the stack usage of a function might exceed @var{byte-size}.
6259 The computation done to determine the stack usage is conservative.
6260 Any space allocated via @code{alloca}, variable-length arrays, or related
6261 constructs is included by the compiler when determining whether or not to
6262 issue a warning.
6263
6264 The message is in keeping with the output of @option{-fstack-usage}.
6265
6266 @itemize
6267 @item
6268 If the stack usage is fully static but exceeds the specified amount, it's:
6269
6270 @smallexample
6271 warning: stack usage is 1120 bytes
6272 @end smallexample
6273 @item
6274 If the stack usage is (partly) dynamic but bounded, it's:
6275
6276 @smallexample
6277 warning: stack usage might be 1648 bytes
6278 @end smallexample
6279 @item
6280 If the stack usage is (partly) dynamic and not bounded, it's:
6281
6282 @smallexample
6283 warning: stack usage might be unbounded
6284 @end smallexample
6285 @end itemize
6286
6287 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6288 Warnings controlled by the option can be disabled either by specifying
6289 @var{byte-size} of @samp{SIZE_MAX} or more or by
6290 @option{-Wno-stack-usage}.
6291
6292 @item -Wno-stack-usage
6293 @opindex Wno-stack-usage
6294 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6295 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6296
6297 @item -Wunsafe-loop-optimizations
6298 @opindex Wunsafe-loop-optimizations
6299 @opindex Wno-unsafe-loop-optimizations
6300 Warn if the loop cannot be optimized because the compiler cannot
6301 assume anything on the bounds of the loop indices. With
6302 @option{-funsafe-loop-optimizations} warn if the compiler makes
6303 such assumptions.
6304
6305 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6306 @opindex Wno-pedantic-ms-format
6307 @opindex Wpedantic-ms-format
6308 When used in combination with @option{-Wformat}
6309 and @option{-pedantic} without GNU extensions, this option
6310 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6311 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6312 which depend on the MS runtime.
6313
6314 @item -Waligned-new
6315 @opindex Waligned-new
6316 @opindex Wno-aligned-new
6317 Warn about a new-expression of a type that requires greater alignment
6318 than the @code{alignof(std::max_align_t)} but uses an allocation
6319 function without an explicit alignment parameter. This option is
6320 enabled by @option{-Wall}.
6321
6322 Normally this only warns about global allocation functions, but
6323 @option{-Waligned-new=all} also warns about class member allocation
6324 functions.
6325
6326 @item -Wplacement-new
6327 @itemx -Wplacement-new=@var{n}
6328 @opindex Wplacement-new
6329 @opindex Wno-placement-new
6330 Warn about placement new expressions with undefined behavior, such as
6331 constructing an object in a buffer that is smaller than the type of
6332 the object. For example, the placement new expression below is diagnosed
6333 because it attempts to construct an array of 64 integers in a buffer only
6334 64 bytes large.
6335 @smallexample
6336 char buf [64];
6337 new (buf) int[64];
6338 @end smallexample
6339 This warning is enabled by default.
6340
6341 @table @gcctabopt
6342 @item -Wplacement-new=1
6343 This is the default warning level of @option{-Wplacement-new}. At this
6344 level the warning is not issued for some strictly undefined constructs that
6345 GCC allows as extensions for compatibility with legacy code. For example,
6346 the following @code{new} expression is not diagnosed at this level even
6347 though it has undefined behavior according to the C++ standard because
6348 it writes past the end of the one-element array.
6349 @smallexample
6350 struct S @{ int n, a[1]; @};
6351 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6352 new (s->a)int [32]();
6353 @end smallexample
6354
6355 @item -Wplacement-new=2
6356 At this level, in addition to diagnosing all the same constructs as at level
6357 1, a diagnostic is also issued for placement new expressions that construct
6358 an object in the last member of structure whose type is an array of a single
6359 element and whose size is less than the size of the object being constructed.
6360 While the previous example would be diagnosed, the following construct makes
6361 use of the flexible member array extension to avoid the warning at level 2.
6362 @smallexample
6363 struct S @{ int n, a[]; @};
6364 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6365 new (s->a)int [32]();
6366 @end smallexample
6367
6368 @end table
6369
6370 @item -Wpointer-arith
6371 @opindex Wpointer-arith
6372 @opindex Wno-pointer-arith
6373 Warn about anything that depends on the ``size of'' a function type or
6374 of @code{void}. GNU C assigns these types a size of 1, for
6375 convenience in calculations with @code{void *} pointers and pointers
6376 to functions. In C++, warn also when an arithmetic operation involves
6377 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6378
6379 @item -Wpointer-compare
6380 @opindex Wpointer-compare
6381 @opindex Wno-pointer-compare
6382 Warn if a pointer is compared with a zero character constant. This usually
6383 means that the pointer was meant to be dereferenced. For example:
6384
6385 @smallexample
6386 const char *p = foo ();
6387 if (p == '\0')
6388 return 42;
6389 @end smallexample
6390
6391 Note that the code above is invalid in C++11.
6392
6393 This warning is enabled by default.
6394
6395 @item -Wtype-limits
6396 @opindex Wtype-limits
6397 @opindex Wno-type-limits
6398 Warn if a comparison is always true or always false due to the limited
6399 range of the data type, but do not warn for constant expressions. For
6400 example, warn if an unsigned variable is compared against zero with
6401 @code{<} or @code{>=}. This warning is also enabled by
6402 @option{-Wextra}.
6403
6404 @item -Wabsolute-value @r{(C and Objective-C only)}
6405 @opindex Wabsolute-value
6406 @opindex Wno-absolute-value
6407 Warn when a wrong absolute value function seems to be used or when it
6408 does not have any effect because its argument is an unsigned type.
6409 This warning be suppressed with an explicit type cast and it is also
6410 enabled by @option{-Wextra}.
6411
6412 @include cppwarnopts.texi
6413
6414 @item -Wbad-function-cast @r{(C and Objective-C only)}
6415 @opindex Wbad-function-cast
6416 @opindex Wno-bad-function-cast
6417 Warn when a function call is cast to a non-matching type.
6418 For example, warn if a call to a function returning an integer type
6419 is cast to a pointer type.
6420
6421 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6422 @opindex Wc90-c99-compat
6423 @opindex Wno-c90-c99-compat
6424 Warn about features not present in ISO C90, but present in ISO C99.
6425 For instance, warn about use of variable length arrays, @code{long long}
6426 type, @code{bool} type, compound literals, designated initializers, and so
6427 on. This option is independent of the standards mode. Warnings are disabled
6428 in the expression that follows @code{__extension__}.
6429
6430 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6431 @opindex Wc99-c11-compat
6432 @opindex Wno-c99-c11-compat
6433 Warn about features not present in ISO C99, but present in ISO C11.
6434 For instance, warn about use of anonymous structures and unions,
6435 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6436 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6437 and so on. This option is independent of the standards mode. Warnings are
6438 disabled in the expression that follows @code{__extension__}.
6439
6440 @item -Wc++-compat @r{(C and Objective-C only)}
6441 @opindex Wc++-compat
6442 @opindex Wno-c++-compat
6443 Warn about ISO C constructs that are outside of the common subset of
6444 ISO C and ISO C++, e.g.@: request for implicit conversion from
6445 @code{void *} to a pointer to non-@code{void} type.
6446
6447 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6448 @opindex Wc++11-compat
6449 @opindex Wno-c++11-compat
6450 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6451 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6452 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6453 enabled by @option{-Wall}.
6454
6455 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6456 @opindex Wc++14-compat
6457 @opindex Wno-c++14-compat
6458 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6459 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6460
6461 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6462 @opindex Wc++17-compat
6463 @opindex Wno-c++17-compat
6464 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6465 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6466
6467 @item -Wcast-qual
6468 @opindex Wcast-qual
6469 @opindex Wno-cast-qual
6470 Warn whenever a pointer is cast so as to remove a type qualifier from
6471 the target type. For example, warn if a @code{const char *} is cast
6472 to an ordinary @code{char *}.
6473
6474 Also warn when making a cast that introduces a type qualifier in an
6475 unsafe way. For example, casting @code{char **} to @code{const char **}
6476 is unsafe, as in this example:
6477
6478 @smallexample
6479 /* p is char ** value. */
6480 const char **q = (const char **) p;
6481 /* Assignment of readonly string to const char * is OK. */
6482 *q = "string";
6483 /* Now char** pointer points to read-only memory. */
6484 **p = 'b';
6485 @end smallexample
6486
6487 @item -Wcast-align
6488 @opindex Wcast-align
6489 @opindex Wno-cast-align
6490 Warn whenever a pointer is cast such that the required alignment of the
6491 target is increased. For example, warn if a @code{char *} is cast to
6492 an @code{int *} on machines where integers can only be accessed at
6493 two- or four-byte boundaries.
6494
6495 @item -Wcast-align=strict
6496 @opindex Wcast-align=strict
6497 Warn whenever a pointer is cast such that the required alignment of the
6498 target is increased. For example, warn if a @code{char *} is cast to
6499 an @code{int *} regardless of the target machine.
6500
6501 @item -Wcast-function-type
6502 @opindex Wcast-function-type
6503 @opindex Wno-cast-function-type
6504 Warn when a function pointer is cast to an incompatible function pointer.
6505 In a cast involving function types with a variable argument list only
6506 the types of initial arguments that are provided are considered.
6507 Any parameter of pointer-type matches any other pointer-type. Any benign
6508 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6509 on ILP32 targets. Likewise type qualifiers are ignored. The function
6510 type @code{void (*) (void)} is special and matches everything, which can
6511 be used to suppress this warning.
6512 In a cast involving pointer to member types this warning warns whenever
6513 the type cast is changing the pointer to member type.
6514 This warning is enabled by @option{-Wextra}.
6515
6516 @item -Wwrite-strings
6517 @opindex Wwrite-strings
6518 @opindex Wno-write-strings
6519 When compiling C, give string constants the type @code{const
6520 char[@var{length}]} so that copying the address of one into a
6521 non-@code{const} @code{char *} pointer produces a warning. These
6522 warnings help you find at compile time code that can try to write
6523 into a string constant, but only if you have been very careful about
6524 using @code{const} in declarations and prototypes. Otherwise, it is
6525 just a nuisance. This is why we did not make @option{-Wall} request
6526 these warnings.
6527
6528 When compiling C++, warn about the deprecated conversion from string
6529 literals to @code{char *}. This warning is enabled by default for C++
6530 programs.
6531
6532 @item -Wcatch-value
6533 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6534 @opindex Wcatch-value
6535 @opindex Wno-catch-value
6536 Warn about catch handlers that do not catch via reference.
6537 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6538 warn about polymorphic class types that are caught by value.
6539 With @option{-Wcatch-value=2} warn about all class types that are caught
6540 by value. With @option{-Wcatch-value=3} warn about all types that are
6541 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6542
6543 @item -Wclobbered
6544 @opindex Wclobbered
6545 @opindex Wno-clobbered
6546 Warn for variables that might be changed by @code{longjmp} or
6547 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6548
6549 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6550 @opindex Wconditionally-supported
6551 @opindex Wno-conditionally-supported
6552 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6553
6554 @item -Wconversion
6555 @opindex Wconversion
6556 @opindex Wno-conversion
6557 Warn for implicit conversions that may alter a value. This includes
6558 conversions between real and integer, like @code{abs (x)} when
6559 @code{x} is @code{double}; conversions between signed and unsigned,
6560 like @code{unsigned ui = -1}; and conversions to smaller types, like
6561 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6562 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6563 changed by the conversion like in @code{abs (2.0)}. Warnings about
6564 conversions between signed and unsigned integers can be disabled by
6565 using @option{-Wno-sign-conversion}.
6566
6567 For C++, also warn for confusing overload resolution for user-defined
6568 conversions; and conversions that never use a type conversion
6569 operator: conversions to @code{void}, the same type, a base class or a
6570 reference to them. Warnings about conversions between signed and
6571 unsigned integers are disabled by default in C++ unless
6572 @option{-Wsign-conversion} is explicitly enabled.
6573
6574 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6575 @opindex Wconversion-null
6576 @opindex Wno-conversion-null
6577 Do not warn for conversions between @code{NULL} and non-pointer
6578 types. @option{-Wconversion-null} is enabled by default.
6579
6580 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6581 @opindex Wzero-as-null-pointer-constant
6582 @opindex Wno-zero-as-null-pointer-constant
6583 Warn when a literal @samp{0} is used as null pointer constant. This can
6584 be useful to facilitate the conversion to @code{nullptr} in C++11.
6585
6586 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6587 @opindex Wsubobject-linkage
6588 @opindex Wno-subobject-linkage
6589 Warn if a class type has a base or a field whose type uses the anonymous
6590 namespace or depends on a type with no linkage. If a type A depends on
6591 a type B with no or internal linkage, defining it in multiple
6592 translation units would be an ODR violation because the meaning of B
6593 is different in each translation unit. If A only appears in a single
6594 translation unit, the best way to silence the warning is to give it
6595 internal linkage by putting it in an anonymous namespace as well. The
6596 compiler doesn't give this warning for types defined in the main .C
6597 file, as those are unlikely to have multiple definitions.
6598 @option{-Wsubobject-linkage} is enabled by default.
6599
6600 @item -Wdangling-else
6601 @opindex Wdangling-else
6602 @opindex Wno-dangling-else
6603 Warn about constructions where there may be confusion to which
6604 @code{if} statement an @code{else} branch belongs. Here is an example of
6605 such a case:
6606
6607 @smallexample
6608 @group
6609 @{
6610 if (a)
6611 if (b)
6612 foo ();
6613 else
6614 bar ();
6615 @}
6616 @end group
6617 @end smallexample
6618
6619 In C/C++, every @code{else} branch belongs to the innermost possible
6620 @code{if} statement, which in this example is @code{if (b)}. This is
6621 often not what the programmer expected, as illustrated in the above
6622 example by indentation the programmer chose. When there is the
6623 potential for this confusion, GCC issues a warning when this flag
6624 is specified. To eliminate the warning, add explicit braces around
6625 the innermost @code{if} statement so there is no way the @code{else}
6626 can belong to the enclosing @code{if}. The resulting code
6627 looks like this:
6628
6629 @smallexample
6630 @group
6631 @{
6632 if (a)
6633 @{
6634 if (b)
6635 foo ();
6636 else
6637 bar ();
6638 @}
6639 @}
6640 @end group
6641 @end smallexample
6642
6643 This warning is enabled by @option{-Wparentheses}.
6644
6645 @item -Wdate-time
6646 @opindex Wdate-time
6647 @opindex Wno-date-time
6648 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6649 are encountered as they might prevent bit-wise-identical reproducible
6650 compilations.
6651
6652 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6653 @opindex Wdelete-incomplete
6654 @opindex Wno-delete-incomplete
6655 Warn when deleting a pointer to incomplete type, which may cause
6656 undefined behavior at runtime. This warning is enabled by default.
6657
6658 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6659 @opindex Wuseless-cast
6660 @opindex Wno-useless-cast
6661 Warn when an expression is casted to its own type.
6662
6663 @item -Wempty-body
6664 @opindex Wempty-body
6665 @opindex Wno-empty-body
6666 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6667 while} statement. This warning is also enabled by @option{-Wextra}.
6668
6669 @item -Wenum-compare
6670 @opindex Wenum-compare
6671 @opindex Wno-enum-compare
6672 Warn about a comparison between values of different enumerated types.
6673 In C++ enumerated type mismatches in conditional expressions are also
6674 diagnosed and the warning is enabled by default. In C this warning is
6675 enabled by @option{-Wall}.
6676
6677 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6678 @opindex Wextra-semi
6679 @opindex Wno-extra-semi
6680 Warn about redundant semicolon after in-class function definition.
6681
6682 @item -Wjump-misses-init @r{(C, Objective-C only)}
6683 @opindex Wjump-misses-init
6684 @opindex Wno-jump-misses-init
6685 Warn if a @code{goto} statement or a @code{switch} statement jumps
6686 forward across the initialization of a variable, or jumps backward to a
6687 label after the variable has been initialized. This only warns about
6688 variables that are initialized when they are declared. This warning is
6689 only supported for C and Objective-C; in C++ this sort of branch is an
6690 error in any case.
6691
6692 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6693 can be disabled with the @option{-Wno-jump-misses-init} option.
6694
6695 @item -Wsign-compare
6696 @opindex Wsign-compare
6697 @opindex Wno-sign-compare
6698 @cindex warning for comparison of signed and unsigned values
6699 @cindex comparison of signed and unsigned values, warning
6700 @cindex signed and unsigned values, comparison warning
6701 Warn when a comparison between signed and unsigned values could produce
6702 an incorrect result when the signed value is converted to unsigned.
6703 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6704 also enabled by @option{-Wextra}.
6705
6706 @item -Wsign-conversion
6707 @opindex Wsign-conversion
6708 @opindex Wno-sign-conversion
6709 Warn for implicit conversions that may change the sign of an integer
6710 value, like assigning a signed integer expression to an unsigned
6711 integer variable. An explicit cast silences the warning. In C, this
6712 option is enabled also by @option{-Wconversion}.
6713
6714 @item -Wfloat-conversion
6715 @opindex Wfloat-conversion
6716 @opindex Wno-float-conversion
6717 Warn for implicit conversions that reduce the precision of a real value.
6718 This includes conversions from real to integer, and from higher precision
6719 real to lower precision real values. This option is also enabled by
6720 @option{-Wconversion}.
6721
6722 @item -Wno-scalar-storage-order
6723 @opindex Wno-scalar-storage-order
6724 @opindex Wscalar-storage-order
6725 Do not warn on suspicious constructs involving reverse scalar storage order.
6726
6727 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6728 @opindex Wsized-deallocation
6729 @opindex Wno-sized-deallocation
6730 Warn about a definition of an unsized deallocation function
6731 @smallexample
6732 void operator delete (void *) noexcept;
6733 void operator delete[] (void *) noexcept;
6734 @end smallexample
6735 without a definition of the corresponding sized deallocation function
6736 @smallexample
6737 void operator delete (void *, std::size_t) noexcept;
6738 void operator delete[] (void *, std::size_t) noexcept;
6739 @end smallexample
6740 or vice versa. Enabled by @option{-Wextra} along with
6741 @option{-fsized-deallocation}.
6742
6743 @item -Wsizeof-pointer-div
6744 @opindex Wsizeof-pointer-div
6745 @opindex Wno-sizeof-pointer-div
6746 Warn for suspicious divisions of two sizeof expressions that divide
6747 the pointer size by the element size, which is the usual way to compute
6748 the array size but won't work out correctly with pointers. This warning
6749 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6750 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6751
6752 @item -Wsizeof-pointer-memaccess
6753 @opindex Wsizeof-pointer-memaccess
6754 @opindex Wno-sizeof-pointer-memaccess
6755 Warn for suspicious length parameters to certain string and memory built-in
6756 functions if the argument uses @code{sizeof}. This warning triggers for
6757 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6758 an array, but a pointer, and suggests a possible fix, or about
6759 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6760 also warns about calls to bounded string copy functions like @code{strncat}
6761 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6762 the source array. For example, in the following function the call to
6763 @code{strncat} specifies the size of the source string as the bound. That
6764 is almost certainly a mistake and so the call is diagnosed.
6765 @smallexample
6766 void make_file (const char *name)
6767 @{
6768 char path[PATH_MAX];
6769 strncpy (path, name, sizeof path - 1);
6770 strncat (path, ".text", sizeof ".text");
6771 @dots{}
6772 @}
6773 @end smallexample
6774
6775 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6776
6777 @item -Wsizeof-array-argument
6778 @opindex Wsizeof-array-argument
6779 @opindex Wno-sizeof-array-argument
6780 Warn when the @code{sizeof} operator is applied to a parameter that is
6781 declared as an array in a function definition. This warning is enabled by
6782 default for C and C++ programs.
6783
6784 @item -Wmemset-elt-size
6785 @opindex Wmemset-elt-size
6786 @opindex Wno-memset-elt-size
6787 Warn for suspicious calls to the @code{memset} built-in function, if the
6788 first argument references an array, and the third argument is a number
6789 equal to the number of elements, but not equal to the size of the array
6790 in memory. This indicates that the user has omitted a multiplication by
6791 the element size. This warning is enabled by @option{-Wall}.
6792
6793 @item -Wmemset-transposed-args
6794 @opindex Wmemset-transposed-args
6795 @opindex Wno-memset-transposed-args
6796 Warn for suspicious calls to the @code{memset} built-in function, if the
6797 second argument is not zero and the third argument is zero. This warns e.g.@:
6798 about @code{memset (buf, sizeof buf, 0)} where most probably
6799 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6800 is only emitted if the third argument is literal zero. If it is some
6801 expression that is folded to zero, a cast of zero to some type, etc.,
6802 it is far less likely that the user has mistakenly exchanged the arguments
6803 and no warning is emitted. This warning is enabled by @option{-Wall}.
6804
6805 @item -Waddress
6806 @opindex Waddress
6807 @opindex Wno-address
6808 Warn about suspicious uses of memory addresses. These include using
6809 the address of a function in a conditional expression, such as
6810 @code{void func(void); if (func)}, and comparisons against the memory
6811 address of a string literal, such as @code{if (x == "abc")}. Such
6812 uses typically indicate a programmer error: the address of a function
6813 always evaluates to true, so their use in a conditional usually
6814 indicate that the programmer forgot the parentheses in a function
6815 call; and comparisons against string literals result in unspecified
6816 behavior and are not portable in C, so they usually indicate that the
6817 programmer intended to use @code{strcmp}. This warning is enabled by
6818 @option{-Wall}.
6819
6820 @item -Wlogical-op
6821 @opindex Wlogical-op
6822 @opindex Wno-logical-op
6823 Warn about suspicious uses of logical operators in expressions.
6824 This includes using logical operators in contexts where a
6825 bit-wise operator is likely to be expected. Also warns when
6826 the operands of a logical operator are the same:
6827 @smallexample
6828 extern int a;
6829 if (a < 0 && a < 0) @{ @dots{} @}
6830 @end smallexample
6831
6832 @item -Wlogical-not-parentheses
6833 @opindex Wlogical-not-parentheses
6834 @opindex Wno-logical-not-parentheses
6835 Warn about logical not used on the left hand side operand of a comparison.
6836 This option does not warn if the right operand is considered to be a boolean
6837 expression. Its purpose is to detect suspicious code like the following:
6838 @smallexample
6839 int a;
6840 @dots{}
6841 if (!a > 1) @{ @dots{} @}
6842 @end smallexample
6843
6844 It is possible to suppress the warning by wrapping the LHS into
6845 parentheses:
6846 @smallexample
6847 if ((!a) > 1) @{ @dots{} @}
6848 @end smallexample
6849
6850 This warning is enabled by @option{-Wall}.
6851
6852 @item -Waggregate-return
6853 @opindex Waggregate-return
6854 @opindex Wno-aggregate-return
6855 Warn if any functions that return structures or unions are defined or
6856 called. (In languages where you can return an array, this also elicits
6857 a warning.)
6858
6859 @item -Wno-aggressive-loop-optimizations
6860 @opindex Wno-aggressive-loop-optimizations
6861 @opindex Waggressive-loop-optimizations
6862 Warn if in a loop with constant number of iterations the compiler detects
6863 undefined behavior in some statement during one or more of the iterations.
6864
6865 @item -Wno-attributes
6866 @opindex Wno-attributes
6867 @opindex Wattributes
6868 Do not warn if an unexpected @code{__attribute__} is used, such as
6869 unrecognized attributes, function attributes applied to variables,
6870 etc. This does not stop errors for incorrect use of supported
6871 attributes.
6872
6873 @item -Wno-builtin-declaration-mismatch
6874 @opindex Wno-builtin-declaration-mismatch
6875 @opindex Wbuiltin-declaration-mismatch
6876 Warn if a built-in function is declared with the wrong signature or
6877 as non-function.
6878 This warning is enabled by default.
6879
6880 @item -Wno-builtin-macro-redefined
6881 @opindex Wno-builtin-macro-redefined
6882 @opindex Wbuiltin-macro-redefined
6883 Do not warn if certain built-in macros are redefined. This suppresses
6884 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
6885 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
6886
6887 @item -Wstrict-prototypes @r{(C and Objective-C only)}
6888 @opindex Wstrict-prototypes
6889 @opindex Wno-strict-prototypes
6890 Warn if a function is declared or defined without specifying the
6891 argument types. (An old-style function definition is permitted without
6892 a warning if preceded by a declaration that specifies the argument
6893 types.)
6894
6895 @item -Wold-style-declaration @r{(C and Objective-C only)}
6896 @opindex Wold-style-declaration
6897 @opindex Wno-old-style-declaration
6898 Warn for obsolescent usages, according to the C Standard, in a
6899 declaration. For example, warn if storage-class specifiers like
6900 @code{static} are not the first things in a declaration. This warning
6901 is also enabled by @option{-Wextra}.
6902
6903 @item -Wold-style-definition @r{(C and Objective-C only)}
6904 @opindex Wold-style-definition
6905 @opindex Wno-old-style-definition
6906 Warn if an old-style function definition is used. A warning is given
6907 even if there is a previous prototype.
6908
6909 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
6910 @opindex Wmissing-parameter-type
6911 @opindex Wno-missing-parameter-type
6912 A function parameter is declared without a type specifier in K&R-style
6913 functions:
6914
6915 @smallexample
6916 void foo(bar) @{ @}
6917 @end smallexample
6918
6919 This warning is also enabled by @option{-Wextra}.
6920
6921 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6922 @opindex Wmissing-prototypes
6923 @opindex Wno-missing-prototypes
6924 Warn if a global function is defined without a previous prototype
6925 declaration. This warning is issued even if the definition itself
6926 provides a prototype. Use this option to detect global functions
6927 that do not have a matching prototype declaration in a header file.
6928 This option is not valid for C++ because all function declarations
6929 provide prototypes and a non-matching declaration declares an
6930 overload rather than conflict with an earlier declaration.
6931 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6932
6933 @item -Wmissing-declarations
6934 @opindex Wmissing-declarations
6935 @opindex Wno-missing-declarations
6936 Warn if a global function is defined without a previous declaration.
6937 Do so even if the definition itself provides a prototype.
6938 Use this option to detect global functions that are not declared in
6939 header files. In C, no warnings are issued for functions with previous
6940 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6941 missing prototypes. In C++, no warnings are issued for function templates,
6942 or for inline functions, or for functions in anonymous namespaces.
6943
6944 @item -Wmissing-field-initializers
6945 @opindex Wmissing-field-initializers
6946 @opindex Wno-missing-field-initializers
6947 @opindex W
6948 @opindex Wextra
6949 @opindex Wno-extra
6950 Warn if a structure's initializer has some fields missing. For
6951 example, the following code causes such a warning, because
6952 @code{x.h} is implicitly zero:
6953
6954 @smallexample
6955 struct s @{ int f, g, h; @};
6956 struct s x = @{ 3, 4 @};
6957 @end smallexample
6958
6959 This option does not warn about designated initializers, so the following
6960 modification does not trigger a warning:
6961
6962 @smallexample
6963 struct s @{ int f, g, h; @};
6964 struct s x = @{ .f = 3, .g = 4 @};
6965 @end smallexample
6966
6967 In C this option does not warn about the universal zero initializer
6968 @samp{@{ 0 @}}:
6969
6970 @smallexample
6971 struct s @{ int f, g, h; @};
6972 struct s x = @{ 0 @};
6973 @end smallexample
6974
6975 Likewise, in C++ this option does not warn about the empty @{ @}
6976 initializer, for example:
6977
6978 @smallexample
6979 struct s @{ int f, g, h; @};
6980 s x = @{ @};
6981 @end smallexample
6982
6983 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6984 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6985
6986 @item -Wno-multichar
6987 @opindex Wno-multichar
6988 @opindex Wmultichar
6989 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6990 Usually they indicate a typo in the user's code, as they have
6991 implementation-defined values, and should not be used in portable code.
6992
6993 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
6994 @opindex Wnormalized=
6995 @opindex Wnormalized
6996 @opindex Wno-normalized
6997 @cindex NFC
6998 @cindex NFKC
6999 @cindex character set, input normalization
7000 In ISO C and ISO C++, two identifiers are different if they are
7001 different sequences of characters. However, sometimes when characters
7002 outside the basic ASCII character set are used, you can have two
7003 different character sequences that look the same. To avoid confusion,
7004 the ISO 10646 standard sets out some @dfn{normalization rules} which
7005 when applied ensure that two sequences that look the same are turned into
7006 the same sequence. GCC can warn you if you are using identifiers that
7007 have not been normalized; this option controls that warning.
7008
7009 There are four levels of warning supported by GCC@. The default is
7010 @option{-Wnormalized=nfc}, which warns about any identifier that is
7011 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7012 recommended form for most uses. It is equivalent to
7013 @option{-Wnormalized}.
7014
7015 Unfortunately, there are some characters allowed in identifiers by
7016 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7017 identifiers. That is, there's no way to use these symbols in portable
7018 ISO C or C++ and have all your identifiers in NFC@.
7019 @option{-Wnormalized=id} suppresses the warning for these characters.
7020 It is hoped that future versions of the standards involved will correct
7021 this, which is why this option is not the default.
7022
7023 You can switch the warning off for all characters by writing
7024 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7025 only do this if you are using some other normalization scheme (like
7026 ``D''), because otherwise you can easily create bugs that are
7027 literally impossible to see.
7028
7029 Some characters in ISO 10646 have distinct meanings but look identical
7030 in some fonts or display methodologies, especially once formatting has
7031 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7032 LETTER N'', displays just like a regular @code{n} that has been
7033 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7034 normalization scheme to convert all these into a standard form as
7035 well, and GCC warns if your code is not in NFKC if you use
7036 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7037 about every identifier that contains the letter O because it might be
7038 confused with the digit 0, and so is not the default, but may be
7039 useful as a local coding convention if the programming environment
7040 cannot be fixed to display these characters distinctly.
7041
7042 @item -Wno-attribute-warning
7043 @opindex Wno-attribute-warning
7044 @opindex Wattribute-warning
7045 Do not warn about usage of functions (@pxref{Function Attributes})
7046 declared with @code{warning} attribute. By default, this warning is
7047 enabled. @option{-Wno-attribute-warning} can be used to disable the
7048 warning or @option{-Wno-error=attribute-warning} can be used to
7049 disable the error when compiled with @option{-Werror} flag.
7050
7051 @item -Wno-deprecated
7052 @opindex Wno-deprecated
7053 @opindex Wdeprecated
7054 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7055
7056 @item -Wno-deprecated-declarations
7057 @opindex Wno-deprecated-declarations
7058 @opindex Wdeprecated-declarations
7059 Do not warn about uses of functions (@pxref{Function Attributes}),
7060 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7061 Attributes}) marked as deprecated by using the @code{deprecated}
7062 attribute.
7063
7064 @item -Wno-overflow
7065 @opindex Wno-overflow
7066 @opindex Woverflow
7067 Do not warn about compile-time overflow in constant expressions.
7068
7069 @item -Wno-odr
7070 @opindex Wno-odr
7071 @opindex Wodr
7072 Warn about One Definition Rule violations during link-time optimization.
7073 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
7074
7075 @item -Wopenmp-simd
7076 @opindex Wopenmp-simd
7077 @opindex Wno-openmp-simd
7078 Warn if the vectorizer cost model overrides the OpenMP
7079 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7080 option can be used to relax the cost model.
7081
7082 @item -Woverride-init @r{(C and Objective-C only)}
7083 @opindex Woverride-init
7084 @opindex Wno-override-init
7085 @opindex W
7086 @opindex Wextra
7087 @opindex Wno-extra
7088 Warn if an initialized field without side effects is overridden when
7089 using designated initializers (@pxref{Designated Inits, , Designated
7090 Initializers}).
7091
7092 This warning is included in @option{-Wextra}. To get other
7093 @option{-Wextra} warnings without this one, use @option{-Wextra
7094 -Wno-override-init}.
7095
7096 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7097 @opindex Woverride-init-side-effects
7098 @opindex Wno-override-init-side-effects
7099 Warn if an initialized field with side effects is overridden when
7100 using designated initializers (@pxref{Designated Inits, , Designated
7101 Initializers}). This warning is enabled by default.
7102
7103 @item -Wpacked
7104 @opindex Wpacked
7105 @opindex Wno-packed
7106 Warn if a structure is given the packed attribute, but the packed
7107 attribute has no effect on the layout or size of the structure.
7108 Such structures may be mis-aligned for little benefit. For
7109 instance, in this code, the variable @code{f.x} in @code{struct bar}
7110 is misaligned even though @code{struct bar} does not itself
7111 have the packed attribute:
7112
7113 @smallexample
7114 @group
7115 struct foo @{
7116 int x;
7117 char a, b, c, d;
7118 @} __attribute__((packed));
7119 struct bar @{
7120 char z;
7121 struct foo f;
7122 @};
7123 @end group
7124 @end smallexample
7125
7126 @item -Wpacked-bitfield-compat
7127 @opindex Wpacked-bitfield-compat
7128 @opindex Wno-packed-bitfield-compat
7129 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7130 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7131 the change can lead to differences in the structure layout. GCC
7132 informs you when the offset of such a field has changed in GCC 4.4.
7133 For example there is no longer a 4-bit padding between field @code{a}
7134 and @code{b} in this structure:
7135
7136 @smallexample
7137 struct foo
7138 @{
7139 char a:4;
7140 char b:8;
7141 @} __attribute__ ((packed));
7142 @end smallexample
7143
7144 This warning is enabled by default. Use
7145 @option{-Wno-packed-bitfield-compat} to disable this warning.
7146
7147 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7148 @opindex Wpacked-not-aligned
7149 @opindex Wno-packed-not-aligned
7150 Warn if a structure field with explicitly specified alignment in a
7151 packed struct or union is misaligned. For example, a warning will
7152 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7153 'struct S' is less than 8}, in this code:
7154
7155 @smallexample
7156 @group
7157 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7158 struct __attribute__ ((packed)) S @{
7159 struct S8 s8;
7160 @};
7161 @end group
7162 @end smallexample
7163
7164 This warning is enabled by @option{-Wall}.
7165
7166 @item -Wpadded
7167 @opindex Wpadded
7168 @opindex Wno-padded
7169 Warn if padding is included in a structure, either to align an element
7170 of the structure or to align the whole structure. Sometimes when this
7171 happens it is possible to rearrange the fields of the structure to
7172 reduce the padding and so make the structure smaller.
7173
7174 @item -Wredundant-decls
7175 @opindex Wredundant-decls
7176 @opindex Wno-redundant-decls
7177 Warn if anything is declared more than once in the same scope, even in
7178 cases where multiple declaration is valid and changes nothing.
7179
7180 @item -Wno-restrict
7181 @opindex Wrestrict
7182 @opindex Wno-restrict
7183 Warn when an object referenced by a @code{restrict}-qualified parameter
7184 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7185 argument, or when copies between such objects overlap. For example,
7186 the call to the @code{strcpy} function below attempts to truncate the string
7187 by replacing its initial characters with the last four. However, because
7188 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7189 the call is diagnosed.
7190
7191 @smallexample
7192 void foo (void)
7193 @{
7194 char a[] = "abcd1234";
7195 strcpy (a, a + 4);
7196 @dots{}
7197 @}
7198 @end smallexample
7199 The @option{-Wrestrict} option detects some instances of simple overlap
7200 even without optimization but works best at @option{-O2} and above. It
7201 is included in @option{-Wall}.
7202
7203 @item -Wnested-externs @r{(C and Objective-C only)}
7204 @opindex Wnested-externs
7205 @opindex Wno-nested-externs
7206 Warn if an @code{extern} declaration is encountered within a function.
7207
7208 @item -Wno-inherited-variadic-ctor
7209 @opindex Winherited-variadic-ctor
7210 @opindex Wno-inherited-variadic-ctor
7211 Suppress warnings about use of C++11 inheriting constructors when the
7212 base class inherited from has a C variadic constructor; the warning is
7213 on by default because the ellipsis is not inherited.
7214
7215 @item -Winline
7216 @opindex Winline
7217 @opindex Wno-inline
7218 Warn if a function that is declared as inline cannot be inlined.
7219 Even with this option, the compiler does not warn about failures to
7220 inline functions declared in system headers.
7221
7222 The compiler uses a variety of heuristics to determine whether or not
7223 to inline a function. For example, the compiler takes into account
7224 the size of the function being inlined and the amount of inlining
7225 that has already been done in the current function. Therefore,
7226 seemingly insignificant changes in the source program can cause the
7227 warnings produced by @option{-Winline} to appear or disappear.
7228
7229 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7230 @opindex Wno-invalid-offsetof
7231 @opindex Winvalid-offsetof
7232 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7233 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7234 to a non-standard-layout type is undefined. In existing C++ implementations,
7235 however, @code{offsetof} typically gives meaningful results.
7236 This flag is for users who are aware that they are
7237 writing nonportable code and who have deliberately chosen to ignore the
7238 warning about it.
7239
7240 The restrictions on @code{offsetof} may be relaxed in a future version
7241 of the C++ standard.
7242
7243 @item -Wint-in-bool-context
7244 @opindex Wint-in-bool-context
7245 @opindex Wno-int-in-bool-context
7246 Warn for suspicious use of integer values where boolean values are expected,
7247 such as conditional expressions (?:) using non-boolean integer constants in
7248 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7249 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7250 for all kinds of multiplications regardless of the data type.
7251 This warning is enabled by @option{-Wall}.
7252
7253 @item -Wno-int-to-pointer-cast
7254 @opindex Wno-int-to-pointer-cast
7255 @opindex Wint-to-pointer-cast
7256 Suppress warnings from casts to pointer type of an integer of a
7257 different size. In C++, casting to a pointer type of smaller size is
7258 an error. @option{Wint-to-pointer-cast} is enabled by default.
7259
7260
7261 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7262 @opindex Wno-pointer-to-int-cast
7263 @opindex Wpointer-to-int-cast
7264 Suppress warnings from casts from a pointer to an integer type of a
7265 different size.
7266
7267 @item -Winvalid-pch
7268 @opindex Winvalid-pch
7269 @opindex Wno-invalid-pch
7270 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7271 the search path but cannot be used.
7272
7273 @item -Wlong-long
7274 @opindex Wlong-long
7275 @opindex Wno-long-long
7276 Warn if @code{long long} type is used. This is enabled by either
7277 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7278 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7279
7280 @item -Wvariadic-macros
7281 @opindex Wvariadic-macros
7282 @opindex Wno-variadic-macros
7283 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7284 alternate syntax is used in ISO C99 mode. This is enabled by either
7285 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7286 messages, use @option{-Wno-variadic-macros}.
7287
7288 @item -Wvarargs
7289 @opindex Wvarargs
7290 @opindex Wno-varargs
7291 Warn upon questionable usage of the macros used to handle variable
7292 arguments like @code{va_start}. This is default. To inhibit the
7293 warning messages, use @option{-Wno-varargs}.
7294
7295 @item -Wvector-operation-performance
7296 @opindex Wvector-operation-performance
7297 @opindex Wno-vector-operation-performance
7298 Warn if vector operation is not implemented via SIMD capabilities of the
7299 architecture. Mainly useful for the performance tuning.
7300 Vector operation can be implemented @code{piecewise}, which means that the
7301 scalar operation is performed on every vector element;
7302 @code{in parallel}, which means that the vector operation is implemented
7303 using scalars of wider type, which normally is more performance efficient;
7304 and @code{as a single scalar}, which means that vector fits into a
7305 scalar type.
7306
7307 @item -Wno-virtual-move-assign
7308 @opindex Wvirtual-move-assign
7309 @opindex Wno-virtual-move-assign
7310 Suppress warnings about inheriting from a virtual base with a
7311 non-trivial C++11 move assignment operator. This is dangerous because
7312 if the virtual base is reachable along more than one path, it is
7313 moved multiple times, which can mean both objects end up in the
7314 moved-from state. If the move assignment operator is written to avoid
7315 moving from a moved-from object, this warning can be disabled.
7316
7317 @item -Wvla
7318 @opindex Wvla
7319 @opindex Wno-vla
7320 Warn if a variable-length array is used in the code.
7321 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7322 the variable-length array.
7323
7324 @item -Wvla-larger-than=@var{byte-size}
7325 @opindex Wvla-larger-than=
7326 @opindex Wno-vla-larger-than
7327 If this option is used, the compiler will warn for declarations of
7328 variable-length arrays whose size is either unbounded, or bounded
7329 by an argument that allows the array size to exceed @var{byte-size}
7330 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7331 works, but with variable-length arrays.
7332
7333 Note that GCC may optimize small variable-length arrays of a known
7334 value into plain arrays, so this warning may not get triggered for
7335 such arrays.
7336
7337 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7338 is typically only effective when @option{-ftree-vrp} is active (default
7339 for @option{-O2} and above).
7340
7341 See also @option{-Walloca-larger-than=@var{byte-size}}.
7342
7343 @item -Wno-vla-larger-than
7344 @opindex Wno-vla-larger-than
7345 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7346 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7347
7348 @item -Wvolatile-register-var
7349 @opindex Wvolatile-register-var
7350 @opindex Wno-volatile-register-var
7351 Warn if a register variable is declared volatile. The volatile
7352 modifier does not inhibit all optimizations that may eliminate reads
7353 and/or writes to register variables. This warning is enabled by
7354 @option{-Wall}.
7355
7356 @item -Wdisabled-optimization
7357 @opindex Wdisabled-optimization
7358 @opindex Wno-disabled-optimization
7359 Warn if a requested optimization pass is disabled. This warning does
7360 not generally indicate that there is anything wrong with your code; it
7361 merely indicates that GCC's optimizers are unable to handle the code
7362 effectively. Often, the problem is that your code is too big or too
7363 complex; GCC refuses to optimize programs when the optimization
7364 itself is likely to take inordinate amounts of time.
7365
7366 @item -Wpointer-sign @r{(C and Objective-C only)}
7367 @opindex Wpointer-sign
7368 @opindex Wno-pointer-sign
7369 Warn for pointer argument passing or assignment with different signedness.
7370 This option is only supported for C and Objective-C@. It is implied by
7371 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7372 @option{-Wno-pointer-sign}.
7373
7374 @item -Wstack-protector
7375 @opindex Wstack-protector
7376 @opindex Wno-stack-protector
7377 This option is only active when @option{-fstack-protector} is active. It
7378 warns about functions that are not protected against stack smashing.
7379
7380 @item -Woverlength-strings
7381 @opindex Woverlength-strings
7382 @opindex Wno-overlength-strings
7383 Warn about string constants that are longer than the ``minimum
7384 maximum'' length specified in the C standard. Modern compilers
7385 generally allow string constants that are much longer than the
7386 standard's minimum limit, but very portable programs should avoid
7387 using longer strings.
7388
7389 The limit applies @emph{after} string constant concatenation, and does
7390 not count the trailing NUL@. In C90, the limit was 509 characters; in
7391 C99, it was raised to 4095. C++98 does not specify a normative
7392 minimum maximum, so we do not diagnose overlength strings in C++@.
7393
7394 This option is implied by @option{-Wpedantic}, and can be disabled with
7395 @option{-Wno-overlength-strings}.
7396
7397 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7398 @opindex Wunsuffixed-float-constants
7399 @opindex Wno-unsuffixed-float-constants
7400
7401 Issue a warning for any floating constant that does not have
7402 a suffix. When used together with @option{-Wsystem-headers} it
7403 warns about such constants in system header files. This can be useful
7404 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7405 from the decimal floating-point extension to C99.
7406
7407 @item -Wno-designated-init @r{(C and Objective-C only)}
7408 Suppress warnings when a positional initializer is used to initialize
7409 a structure that has been marked with the @code{designated_init}
7410 attribute.
7411
7412 @item -Whsa
7413 Issue a warning when HSAIL cannot be emitted for the compiled function or
7414 OpenMP construct.
7415
7416 @end table
7417
7418 @node Debugging Options
7419 @section Options for Debugging Your Program
7420 @cindex options, debugging
7421 @cindex debugging information options
7422
7423 To tell GCC to emit extra information for use by a debugger, in almost
7424 all cases you need only to add @option{-g} to your other options.
7425
7426 GCC allows you to use @option{-g} with
7427 @option{-O}. The shortcuts taken by optimized code may occasionally
7428 be surprising: some variables you declared may not exist
7429 at all; flow of control may briefly move where you did not expect it;
7430 some statements may not be executed because they compute constant
7431 results or their values are already at hand; some statements may
7432 execute in different places because they have been moved out of loops.
7433 Nevertheless it is possible to debug optimized output. This makes
7434 it reasonable to use the optimizer for programs that might have bugs.
7435
7436 If you are not using some other optimization option, consider
7437 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7438 With no @option{-O} option at all, some compiler passes that collect
7439 information useful for debugging do not run at all, so that
7440 @option{-Og} may result in a better debugging experience.
7441
7442 @table @gcctabopt
7443 @item -g
7444 @opindex g
7445 Produce debugging information in the operating system's native format
7446 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7447 information.
7448
7449 On most systems that use stabs format, @option{-g} enables use of extra
7450 debugging information that only GDB can use; this extra information
7451 makes debugging work better in GDB but probably makes other debuggers
7452 crash or
7453 refuse to read the program. If you want to control for certain whether
7454 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7455 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7456
7457 @item -ggdb
7458 @opindex ggdb
7459 Produce debugging information for use by GDB@. This means to use the
7460 most expressive format available (DWARF, stabs, or the native format
7461 if neither of those are supported), including GDB extensions if at all
7462 possible.
7463
7464 @item -gdwarf
7465 @itemx -gdwarf-@var{version}
7466 @opindex gdwarf
7467 Produce debugging information in DWARF format (if that is supported).
7468 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7469 for most targets is 4. DWARF Version 5 is only experimental.
7470
7471 Note that with DWARF Version 2, some ports require and always
7472 use some non-conflicting DWARF 3 extensions in the unwind tables.
7473
7474 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7475 for maximum benefit.
7476
7477 GCC no longer supports DWARF Version 1, which is substantially
7478 different than Version 2 and later. For historical reasons, some
7479 other DWARF-related options such as
7480 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7481 in their names, but apply to all currently-supported versions of DWARF.
7482
7483 @item -gstabs
7484 @opindex gstabs
7485 Produce debugging information in stabs format (if that is supported),
7486 without GDB extensions. This is the format used by DBX on most BSD
7487 systems. On MIPS, Alpha and System V Release 4 systems this option
7488 produces stabs debugging output that is not understood by DBX@.
7489 On System V Release 4 systems this option requires the GNU assembler.
7490
7491 @item -gstabs+
7492 @opindex gstabs+
7493 Produce debugging information in stabs format (if that is supported),
7494 using GNU extensions understood only by the GNU debugger (GDB)@. The
7495 use of these extensions is likely to make other debuggers crash or
7496 refuse to read the program.
7497
7498 @item -gxcoff
7499 @opindex gxcoff
7500 Produce debugging information in XCOFF format (if that is supported).
7501 This is the format used by the DBX debugger on IBM RS/6000 systems.
7502
7503 @item -gxcoff+
7504 @opindex gxcoff+
7505 Produce debugging information in XCOFF format (if that is supported),
7506 using GNU extensions understood only by the GNU debugger (GDB)@. The
7507 use of these extensions is likely to make other debuggers crash or
7508 refuse to read the program, and may cause assemblers other than the GNU
7509 assembler (GAS) to fail with an error.
7510
7511 @item -gvms
7512 @opindex gvms
7513 Produce debugging information in Alpha/VMS debug format (if that is
7514 supported). This is the format used by DEBUG on Alpha/VMS systems.
7515
7516 @item -g@var{level}
7517 @itemx -ggdb@var{level}
7518 @itemx -gstabs@var{level}
7519 @itemx -gxcoff@var{level}
7520 @itemx -gvms@var{level}
7521 Request debugging information and also use @var{level} to specify how
7522 much information. The default level is 2.
7523
7524 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7525 @option{-g}.
7526
7527 Level 1 produces minimal information, enough for making backtraces in
7528 parts of the program that you don't plan to debug. This includes
7529 descriptions of functions and external variables, and line number
7530 tables, but no information about local variables.
7531
7532 Level 3 includes extra information, such as all the macro definitions
7533 present in the program. Some debuggers support macro expansion when
7534 you use @option{-g3}.
7535
7536 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7537 confusion with @option{-gdwarf-@var{level}}.
7538 Instead use an additional @option{-g@var{level}} option to change the
7539 debug level for DWARF.
7540
7541 @item -feliminate-unused-debug-symbols
7542 @opindex feliminate-unused-debug-symbols
7543 Produce debugging information in stabs format (if that is supported),
7544 for only symbols that are actually used.
7545
7546 @item -femit-class-debug-always
7547 @opindex femit-class-debug-always
7548 Instead of emitting debugging information for a C++ class in only one
7549 object file, emit it in all object files using the class. This option
7550 should be used only with debuggers that are unable to handle the way GCC
7551 normally emits debugging information for classes because using this
7552 option increases the size of debugging information by as much as a
7553 factor of two.
7554
7555 @item -fno-merge-debug-strings
7556 @opindex fmerge-debug-strings
7557 @opindex fno-merge-debug-strings
7558 Direct the linker to not merge together strings in the debugging
7559 information that are identical in different object files. Merging is
7560 not supported by all assemblers or linkers. Merging decreases the size
7561 of the debug information in the output file at the cost of increasing
7562 link processing time. Merging is enabled by default.
7563
7564 @item -fdebug-prefix-map=@var{old}=@var{new}
7565 @opindex fdebug-prefix-map
7566 When compiling files residing in directory @file{@var{old}}, record
7567 debugging information describing them as if the files resided in
7568 directory @file{@var{new}} instead. This can be used to replace a
7569 build-time path with an install-time path in the debug info. It can
7570 also be used to change an absolute path to a relative path by using
7571 @file{.} for @var{new}. This can give more reproducible builds, which
7572 are location independent, but may require an extra command to tell GDB
7573 where to find the source files. See also @option{-ffile-prefix-map}.
7574
7575 @item -fvar-tracking
7576 @opindex fvar-tracking
7577 Run variable tracking pass. It computes where variables are stored at each
7578 position in code. Better debugging information is then generated
7579 (if the debugging information format supports this information).
7580
7581 It is enabled by default when compiling with optimization (@option{-Os},
7582 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7583 the debug info format supports it.
7584
7585 @item -fvar-tracking-assignments
7586 @opindex fvar-tracking-assignments
7587 @opindex fno-var-tracking-assignments
7588 Annotate assignments to user variables early in the compilation and
7589 attempt to carry the annotations over throughout the compilation all the
7590 way to the end, in an attempt to improve debug information while
7591 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7592
7593 It can be enabled even if var-tracking is disabled, in which case
7594 annotations are created and maintained, but discarded at the end.
7595 By default, this flag is enabled together with @option{-fvar-tracking},
7596 except when selective scheduling is enabled.
7597
7598 @item -gsplit-dwarf
7599 @opindex gsplit-dwarf
7600 Separate as much DWARF debugging information as possible into a
7601 separate output file with the extension @file{.dwo}. This option allows
7602 the build system to avoid linking files with debug information. To
7603 be useful, this option requires a debugger capable of reading @file{.dwo}
7604 files.
7605
7606 @item -gdescribe-dies
7607 @opindex gdescribe-dies
7608 Add description attributes to some DWARF DIEs that have no name attribute,
7609 such as artificial variables, external references and call site
7610 parameter DIEs.
7611
7612 @item -gpubnames
7613 @opindex gpubnames
7614 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7615
7616 @item -ggnu-pubnames
7617 @opindex ggnu-pubnames
7618 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7619 suitable for conversion into a GDB@ index. This option is only useful
7620 with a linker that can produce GDB@ index version 7.
7621
7622 @item -fdebug-types-section
7623 @opindex fdebug-types-section
7624 @opindex fno-debug-types-section
7625 When using DWARF Version 4 or higher, type DIEs can be put into
7626 their own @code{.debug_types} section instead of making them part of the
7627 @code{.debug_info} section. It is more efficient to put them in a separate
7628 comdat section since the linker can then remove duplicates.
7629 But not all DWARF consumers support @code{.debug_types} sections yet
7630 and on some objects @code{.debug_types} produces larger instead of smaller
7631 debugging information.
7632
7633 @item -grecord-gcc-switches
7634 @itemx -gno-record-gcc-switches
7635 @opindex grecord-gcc-switches
7636 @opindex gno-record-gcc-switches
7637 This switch causes the command-line options used to invoke the
7638 compiler that may affect code generation to be appended to the
7639 DW_AT_producer attribute in DWARF debugging information. The options
7640 are concatenated with spaces separating them from each other and from
7641 the compiler version.
7642 It is enabled by default.
7643 See also @option{-frecord-gcc-switches} for another
7644 way of storing compiler options into the object file.
7645
7646 @item -gstrict-dwarf
7647 @opindex gstrict-dwarf
7648 Disallow using extensions of later DWARF standard version than selected
7649 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7650 DWARF extensions from later standard versions is allowed.
7651
7652 @item -gno-strict-dwarf
7653 @opindex gno-strict-dwarf
7654 Allow using extensions of later DWARF standard version than selected with
7655 @option{-gdwarf-@var{version}}.
7656
7657 @item -gas-loc-support
7658 @opindex gas-loc-support
7659 Inform the compiler that the assembler supports @code{.loc} directives.
7660 It may then use them for the assembler to generate DWARF2+ line number
7661 tables.
7662
7663 This is generally desirable, because assembler-generated line-number
7664 tables are a lot more compact than those the compiler can generate
7665 itself.
7666
7667 This option will be enabled by default if, at GCC configure time, the
7668 assembler was found to support such directives.
7669
7670 @item -gno-as-loc-support
7671 @opindex gno-as-loc-support
7672 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7673 line number tables are to be generated.
7674
7675 @item gas-locview-support
7676 @opindex gas-locview-support
7677 Inform the compiler that the assembler supports @code{view} assignment
7678 and reset assertion checking in @code{.loc} directives.
7679
7680 This option will be enabled by default if, at GCC configure time, the
7681 assembler was found to support them.
7682
7683 @item gno-as-locview-support
7684 Force GCC to assign view numbers internally, if
7685 @option{-gvariable-location-views} are explicitly requested.
7686
7687 @item -gcolumn-info
7688 @itemx -gno-column-info
7689 @opindex gcolumn-info
7690 @opindex gno-column-info
7691 Emit location column information into DWARF debugging information, rather
7692 than just file and line.
7693 This option is enabled by default.
7694
7695 @item -gstatement-frontiers
7696 @itemx -gno-statement-frontiers
7697 @opindex gstatement-frontiers
7698 @opindex gno-statement-frontiers
7699 This option causes GCC to create markers in the internal representation
7700 at the beginning of statements, and to keep them roughly in place
7701 throughout compilation, using them to guide the output of @code{is_stmt}
7702 markers in the line number table. This is enabled by default when
7703 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7704 @dots{}), and outputting DWARF 2 debug information at the normal level.
7705
7706 @item -gvariable-location-views
7707 @itemx -gvariable-location-views=incompat5
7708 @itemx -gno-variable-location-views
7709 @opindex gvariable-location-views
7710 @opindex gvariable-location-views=incompat5
7711 @opindex gno-variable-location-views
7712 Augment variable location lists with progressive view numbers implied
7713 from the line number table. This enables debug information consumers to
7714 inspect state at certain points of the program, even if no instructions
7715 associated with the corresponding source locations are present at that
7716 point. If the assembler lacks support for view numbers in line number
7717 tables, this will cause the compiler to emit the line number table,
7718 which generally makes them somewhat less compact. The augmented line
7719 number tables and location lists are fully backward-compatible, so they
7720 can be consumed by debug information consumers that are not aware of
7721 these augmentations, but they won't derive any benefit from them either.
7722
7723 This is enabled by default when outputting DWARF 2 debug information at
7724 the normal level, as long as there is assembler support,
7725 @option{-fvar-tracking-assignments} is enabled and
7726 @option{-gstrict-dwarf} is not. When assembler support is not
7727 available, this may still be enabled, but it will force GCC to output
7728 internal line number tables, and if
7729 @option{-ginternal-reset-location-views} is not enabled, that will most
7730 certainly lead to silently mismatching location views.
7731
7732 There is a proposed representation for view numbers that is not backward
7733 compatible with the location list format introduced in DWARF 5, that can
7734 be enabled with @option{-gvariable-location-views=incompat5}. This
7735 option may be removed in the future, is only provided as a reference
7736 implementation of the proposed representation. Debug information
7737 consumers are not expected to support this extended format, and they
7738 would be rendered unable to decode location lists using it.
7739
7740 @item -ginternal-reset-location-views
7741 @itemx -gnointernal-reset-location-views
7742 @opindex ginternal-reset-location-views
7743 @opindex gno-internal-reset-location-views
7744 Attempt to determine location views that can be omitted from location
7745 view lists. This requires the compiler to have very accurate insn
7746 length estimates, which isn't always the case, and it may cause
7747 incorrect view lists to be generated silently when using an assembler
7748 that does not support location view lists. The GNU assembler will flag
7749 any such error as a @code{view number mismatch}. This is only enabled
7750 on ports that define a reliable estimation function.
7751
7752 @item -ginline-points
7753 @itemx -gno-inline-points
7754 @opindex ginline-points
7755 @opindex gno-inline-points
7756 Generate extended debug information for inlined functions. Location
7757 view tracking markers are inserted at inlined entry points, so that
7758 address and view numbers can be computed and output in debug
7759 information. This can be enabled independently of location views, in
7760 which case the view numbers won't be output, but it can only be enabled
7761 along with statement frontiers, and it is only enabled by default if
7762 location views are enabled.
7763
7764 @item -gz@r{[}=@var{type}@r{]}
7765 @opindex gz
7766 Produce compressed debug sections in DWARF format, if that is supported.
7767 If @var{type} is not given, the default type depends on the capabilities
7768 of the assembler and linker used. @var{type} may be one of
7769 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7770 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7771 compression in traditional GNU format). If the linker doesn't support
7772 writing compressed debug sections, the option is rejected. Otherwise,
7773 if the assembler does not support them, @option{-gz} is silently ignored
7774 when producing object files.
7775
7776 @item -femit-struct-debug-baseonly
7777 @opindex femit-struct-debug-baseonly
7778 Emit debug information for struct-like types
7779 only when the base name of the compilation source file
7780 matches the base name of file in which the struct is defined.
7781
7782 This option substantially reduces the size of debugging information,
7783 but at significant potential loss in type information to the debugger.
7784 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7785 See @option{-femit-struct-debug-detailed} for more detailed control.
7786
7787 This option works only with DWARF debug output.
7788
7789 @item -femit-struct-debug-reduced
7790 @opindex femit-struct-debug-reduced
7791 Emit debug information for struct-like types
7792 only when the base name of the compilation source file
7793 matches the base name of file in which the type is defined,
7794 unless the struct is a template or defined in a system header.
7795
7796 This option significantly reduces the size of debugging information,
7797 with some potential loss in type information to the debugger.
7798 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
7799 See @option{-femit-struct-debug-detailed} for more detailed control.
7800
7801 This option works only with DWARF debug output.
7802
7803 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
7804 @opindex femit-struct-debug-detailed
7805 Specify the struct-like types
7806 for which the compiler generates debug information.
7807 The intent is to reduce duplicate struct debug information
7808 between different object files within the same program.
7809
7810 This option is a detailed version of
7811 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
7812 which serves for most needs.
7813
7814 A specification has the syntax@*
7815 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
7816
7817 The optional first word limits the specification to
7818 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
7819 A struct type is used directly when it is the type of a variable, member.
7820 Indirect uses arise through pointers to structs.
7821 That is, when use of an incomplete struct is valid, the use is indirect.
7822 An example is
7823 @samp{struct one direct; struct two * indirect;}.
7824
7825 The optional second word limits the specification to
7826 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
7827 Generic structs are a bit complicated to explain.
7828 For C++, these are non-explicit specializations of template classes,
7829 or non-template classes within the above.
7830 Other programming languages have generics,
7831 but @option{-femit-struct-debug-detailed} does not yet implement them.
7832
7833 The third word specifies the source files for those
7834 structs for which the compiler should emit debug information.
7835 The values @samp{none} and @samp{any} have the normal meaning.
7836 The value @samp{base} means that
7837 the base of name of the file in which the type declaration appears
7838 must match the base of the name of the main compilation file.
7839 In practice, this means that when compiling @file{foo.c}, debug information
7840 is generated for types declared in that file and @file{foo.h},
7841 but not other header files.
7842 The value @samp{sys} means those types satisfying @samp{base}
7843 or declared in system or compiler headers.
7844
7845 You may need to experiment to determine the best settings for your application.
7846
7847 The default is @option{-femit-struct-debug-detailed=all}.
7848
7849 This option works only with DWARF debug output.
7850
7851 @item -fno-dwarf2-cfi-asm
7852 @opindex fdwarf2-cfi-asm
7853 @opindex fno-dwarf2-cfi-asm
7854 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
7855 instead of using GAS @code{.cfi_*} directives.
7856
7857 @item -fno-eliminate-unused-debug-types
7858 @opindex feliminate-unused-debug-types
7859 @opindex fno-eliminate-unused-debug-types
7860 Normally, when producing DWARF output, GCC avoids producing debug symbol
7861 output for types that are nowhere used in the source file being compiled.
7862 Sometimes it is useful to have GCC emit debugging
7863 information for all types declared in a compilation
7864 unit, regardless of whether or not they are actually used
7865 in that compilation unit, for example
7866 if, in the debugger, you want to cast a value to a type that is
7867 not actually used in your program (but is declared). More often,
7868 however, this results in a significant amount of wasted space.
7869 @end table
7870
7871 @node Optimize Options
7872 @section Options That Control Optimization
7873 @cindex optimize options
7874 @cindex options, optimization
7875
7876 These options control various sorts of optimizations.
7877
7878 Without any optimization option, the compiler's goal is to reduce the
7879 cost of compilation and to make debugging produce the expected
7880 results. Statements are independent: if you stop the program with a
7881 breakpoint between statements, you can then assign a new value to any
7882 variable or change the program counter to any other statement in the
7883 function and get exactly the results you expect from the source
7884 code.
7885
7886 Turning on optimization flags makes the compiler attempt to improve
7887 the performance and/or code size at the expense of compilation time
7888 and possibly the ability to debug the program.
7889
7890 The compiler performs optimization based on the knowledge it has of the
7891 program. Compiling multiple files at once to a single output file mode allows
7892 the compiler to use information gained from all of the files when compiling
7893 each of them.
7894
7895 Not all optimizations are controlled directly by a flag. Only
7896 optimizations that have a flag are listed in this section.
7897
7898 Most optimizations are only enabled if an @option{-O} level is set on
7899 the command line. Otherwise they are disabled, even if individual
7900 optimization flags are specified.
7901
7902 Depending on the target and how GCC was configured, a slightly different
7903 set of optimizations may be enabled at each @option{-O} level than
7904 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7905 to find out the exact set of optimizations that are enabled at each level.
7906 @xref{Overall Options}, for examples.
7907
7908 @table @gcctabopt
7909 @item -O
7910 @itemx -O1
7911 @opindex O
7912 @opindex O1
7913 Optimize. Optimizing compilation takes somewhat more time, and a lot
7914 more memory for a large function.
7915
7916 With @option{-O}, the compiler tries to reduce code size and execution
7917 time, without performing any optimizations that take a great deal of
7918 compilation time.
7919
7920 @option{-O} turns on the following optimization flags:
7921 @gccoptlist{
7922 -fauto-inc-dec @gol
7923 -fbranch-count-reg @gol
7924 -fcombine-stack-adjustments @gol
7925 -fcompare-elim @gol
7926 -fcprop-registers @gol
7927 -fdce @gol
7928 -fdefer-pop @gol
7929 -fdelayed-branch @gol
7930 -fdse @gol
7931 -fforward-propagate @gol
7932 -fguess-branch-probability @gol
7933 -fif-conversion2 @gol
7934 -fif-conversion @gol
7935 -finline-functions-called-once @gol
7936 -fipa-pure-const @gol
7937 -fipa-profile @gol
7938 -fipa-reference @gol
7939 -fipa-reference-addressable @gol
7940 -fmerge-constants @gol
7941 -fmove-loop-invariants @gol
7942 -fomit-frame-pointer @gol
7943 -freorder-blocks @gol
7944 -fshrink-wrap @gol
7945 -fshrink-wrap-separate @gol
7946 -fsplit-wide-types @gol
7947 -fssa-backprop @gol
7948 -fssa-phiopt @gol
7949 -ftree-bit-ccp @gol
7950 -ftree-ccp @gol
7951 -ftree-ch @gol
7952 -ftree-coalesce-vars @gol
7953 -ftree-copy-prop @gol
7954 -ftree-dce @gol
7955 -ftree-dominator-opts @gol
7956 -ftree-dse @gol
7957 -ftree-forwprop @gol
7958 -ftree-fre @gol
7959 -ftree-phiprop @gol
7960 -ftree-scev-cprop @gol
7961 -ftree-sink @gol
7962 -ftree-slsr @gol
7963 -ftree-sra @gol
7964 -ftree-pta @gol
7965 -ftree-ter @gol
7966 -funit-at-a-time}
7967
7968 @item -O2
7969 @opindex O2
7970 Optimize even more. GCC performs nearly all supported optimizations
7971 that do not involve a space-speed tradeoff.
7972 As compared to @option{-O}, this option increases both compilation time
7973 and the performance of the generated code.
7974
7975 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7976 also turns on the following optimization flags:
7977 @gccoptlist{-fthread-jumps @gol
7978 -falign-functions -falign-jumps @gol
7979 -falign-loops -falign-labels @gol
7980 -fcaller-saves @gol
7981 -fcrossjumping @gol
7982 -fcse-follow-jumps -fcse-skip-blocks @gol
7983 -fdelete-null-pointer-checks @gol
7984 -fdevirtualize -fdevirtualize-speculatively @gol
7985 -fexpensive-optimizations @gol
7986 -fgcse -fgcse-lm @gol
7987 -fhoist-adjacent-loads @gol
7988 -finline-small-functions @gol
7989 -findirect-inlining @gol
7990 -fipa-cp @gol
7991 -fipa-bit-cp @gol
7992 -fipa-vrp @gol
7993 -fipa-sra @gol
7994 -fipa-icf @gol
7995 -fisolate-erroneous-paths-dereference @gol
7996 -flra-remat @gol
7997 -foptimize-sibling-calls @gol
7998 -foptimize-strlen @gol
7999 -fpartial-inlining @gol
8000 -fpeephole2 @gol
8001 -freorder-blocks-algorithm=stc @gol
8002 -freorder-blocks-and-partition -freorder-functions @gol
8003 -frerun-cse-after-loop @gol
8004 -fsched-interblock -fsched-spec @gol
8005 -fschedule-insns -fschedule-insns2 @gol
8006 -fstore-merging @gol
8007 -fstrict-aliasing @gol
8008 -ftree-builtin-call-dce @gol
8009 -ftree-switch-conversion -ftree-tail-merge @gol
8010 -fcode-hoisting @gol
8011 -ftree-pre @gol
8012 -ftree-vrp @gol
8013 -fipa-ra}
8014
8015 Please note the warning under @option{-fgcse} about
8016 invoking @option{-O2} on programs that use computed gotos.
8017
8018 @item -O3
8019 @opindex O3
8020 Optimize yet more. @option{-O3} turns on all optimizations specified
8021 by @option{-O2} and also turns on the following optimization flags:
8022 @gccoptlist{-finline-functions @gol
8023 -funswitch-loops @gol
8024 -fpredictive-commoning @gol
8025 -fgcse-after-reload @gol
8026 -ftree-loop-vectorize @gol
8027 -ftree-loop-distribution @gol
8028 -ftree-loop-distribute-patterns @gol
8029 -floop-interchange @gol
8030 -floop-unroll-and-jam @gol
8031 -fsplit-paths @gol
8032 -ftree-slp-vectorize @gol
8033 -fvect-cost-model @gol
8034 -ftree-partial-pre @gol
8035 -fpeel-loops @gol
8036 -fipa-cp-clone}
8037
8038 @item -O0
8039 @opindex O0
8040 Reduce compilation time and make debugging produce the expected
8041 results. This is the default.
8042
8043 @item -Os
8044 @opindex Os
8045 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
8046 do not typically increase code size. It also performs further
8047 optimizations designed to reduce code size.
8048
8049 @option{-Os} disables the following optimization flags:
8050 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
8051 -falign-labels -fprefetch-loop-arrays}
8052
8053 @item -Ofast
8054 @opindex Ofast
8055 Disregard strict standards compliance. @option{-Ofast} enables all
8056 @option{-O3} optimizations. It also enables optimizations that are not
8057 valid for all standard-compliant programs.
8058 It turns on @option{-ffast-math} and the Fortran-specific
8059 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8060 specified, and @option{-fno-protect-parens}.
8061
8062 @item -Og
8063 @opindex Og
8064 Optimize debugging experience. @option{-Og} enables optimizations
8065 that do not interfere with debugging. It should be the optimization
8066 level of choice for the standard edit-compile-debug cycle, offering
8067 a reasonable level of optimization while maintaining fast compilation
8068 and a good debugging experience.
8069 @end table
8070
8071 If you use multiple @option{-O} options, with or without level numbers,
8072 the last such option is the one that is effective.
8073
8074 Options of the form @option{-f@var{flag}} specify machine-independent
8075 flags. Most flags have both positive and negative forms; the negative
8076 form of @option{-ffoo} is @option{-fno-foo}. In the table
8077 below, only one of the forms is listed---the one you typically
8078 use. You can figure out the other form by either removing @samp{no-}
8079 or adding it.
8080
8081 The following options control specific optimizations. They are either
8082 activated by @option{-O} options or are related to ones that are. You
8083 can use the following flags in the rare cases when ``fine-tuning'' of
8084 optimizations to be performed is desired.
8085
8086 @table @gcctabopt
8087 @item -fno-defer-pop
8088 @opindex fno-defer-pop
8089 @opindex fdefer-pop
8090 For machines that must pop arguments after a function call, always pop
8091 the arguments as soon as each function returns.
8092 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8093 this allows the compiler to let arguments accumulate on the stack for several
8094 function calls and pop them all at once.
8095
8096 @item -fforward-propagate
8097 @opindex fforward-propagate
8098 Perform a forward propagation pass on RTL@. The pass tries to combine two
8099 instructions and checks if the result can be simplified. If loop unrolling
8100 is active, two passes are performed and the second is scheduled after
8101 loop unrolling.
8102
8103 This option is enabled by default at optimization levels @option{-O},
8104 @option{-O2}, @option{-O3}, @option{-Os}.
8105
8106 @item -ffp-contract=@var{style}
8107 @opindex ffp-contract
8108 @option{-ffp-contract=off} disables floating-point expression contraction.
8109 @option{-ffp-contract=fast} enables floating-point expression contraction
8110 such as forming of fused multiply-add operations if the target has
8111 native support for them.
8112 @option{-ffp-contract=on} enables floating-point expression contraction
8113 if allowed by the language standard. This is currently not implemented
8114 and treated equal to @option{-ffp-contract=off}.
8115
8116 The default is @option{-ffp-contract=fast}.
8117
8118 @item -fomit-frame-pointer
8119 @opindex fomit-frame-pointer
8120 Omit the frame pointer in functions that don't need one. This avoids the
8121 instructions to save, set up and restore the frame pointer; on many targets
8122 it also makes an extra register available.
8123
8124 On some targets this flag has no effect because the standard calling sequence
8125 always uses a frame pointer, so it cannot be omitted.
8126
8127 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8128 is used in all functions. Several targets always omit the frame pointer in
8129 leaf functions.
8130
8131 Enabled by default at @option{-O} and higher.
8132
8133 @item -foptimize-sibling-calls
8134 @opindex foptimize-sibling-calls
8135 Optimize sibling and tail recursive calls.
8136
8137 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8138
8139 @item -foptimize-strlen
8140 @opindex foptimize-strlen
8141 Optimize various standard C string functions (e.g.@: @code{strlen},
8142 @code{strchr} or @code{strcpy}) and
8143 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8144
8145 Enabled at levels @option{-O2}, @option{-O3}.
8146
8147 @item -fno-inline
8148 @opindex fno-inline
8149 @opindex finline
8150 Do not expand any functions inline apart from those marked with
8151 the @code{always_inline} attribute. This is the default when not
8152 optimizing.
8153
8154 Single functions can be exempted from inlining by marking them
8155 with the @code{noinline} attribute.
8156
8157 @item -finline-small-functions
8158 @opindex finline-small-functions
8159 Integrate functions into their callers when their body is smaller than expected
8160 function call code (so overall size of program gets smaller). The compiler
8161 heuristically decides which functions are simple enough to be worth integrating
8162 in this way. This inlining applies to all functions, even those not declared
8163 inline.
8164
8165 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8166
8167 @item -findirect-inlining
8168 @opindex findirect-inlining
8169 Inline also indirect calls that are discovered to be known at compile
8170 time thanks to previous inlining. This option has any effect only
8171 when inlining itself is turned on by the @option{-finline-functions}
8172 or @option{-finline-small-functions} options.
8173
8174 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8175
8176 @item -finline-functions
8177 @opindex finline-functions
8178 Consider all functions for inlining, even if they are not declared inline.
8179 The compiler heuristically decides which functions are worth integrating
8180 in this way.
8181
8182 If all calls to a given function are integrated, and the function is
8183 declared @code{static}, then the function is normally not output as
8184 assembler code in its own right.
8185
8186 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8187
8188 @item -finline-functions-called-once
8189 @opindex finline-functions-called-once
8190 Consider all @code{static} functions called once for inlining into their
8191 caller even if they are not marked @code{inline}. If a call to a given
8192 function is integrated, then the function is not output as assembler code
8193 in its own right.
8194
8195 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
8196
8197 @item -fearly-inlining
8198 @opindex fearly-inlining
8199 Inline functions marked by @code{always_inline} and functions whose body seems
8200 smaller than the function call overhead early before doing
8201 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8202 makes profiling significantly cheaper and usually inlining faster on programs
8203 having large chains of nested wrapper functions.
8204
8205 Enabled by default.
8206
8207 @item -fipa-sra
8208 @opindex fipa-sra
8209 Perform interprocedural scalar replacement of aggregates, removal of
8210 unused parameters and replacement of parameters passed by reference
8211 by parameters passed by value.
8212
8213 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8214
8215 @item -finline-limit=@var{n}
8216 @opindex finline-limit
8217 By default, GCC limits the size of functions that can be inlined. This flag
8218 allows coarse control of this limit. @var{n} is the size of functions that
8219 can be inlined in number of pseudo instructions.
8220
8221 Inlining is actually controlled by a number of parameters, which may be
8222 specified individually by using @option{--param @var{name}=@var{value}}.
8223 The @option{-finline-limit=@var{n}} option sets some of these parameters
8224 as follows:
8225
8226 @table @gcctabopt
8227 @item max-inline-insns-single
8228 is set to @var{n}/2.
8229 @item max-inline-insns-auto
8230 is set to @var{n}/2.
8231 @end table
8232
8233 See below for a documentation of the individual
8234 parameters controlling inlining and for the defaults of these parameters.
8235
8236 @emph{Note:} there may be no value to @option{-finline-limit} that results
8237 in default behavior.
8238
8239 @emph{Note:} pseudo instruction represents, in this particular context, an
8240 abstract measurement of function's size. In no way does it represent a count
8241 of assembly instructions and as such its exact meaning might change from one
8242 release to an another.
8243
8244 @item -fno-keep-inline-dllexport
8245 @opindex fno-keep-inline-dllexport
8246 @opindex fkeep-inline-dllexport
8247 This is a more fine-grained version of @option{-fkeep-inline-functions},
8248 which applies only to functions that are declared using the @code{dllexport}
8249 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8250 Functions}.
8251
8252 @item -fkeep-inline-functions
8253 @opindex fkeep-inline-functions
8254 In C, emit @code{static} functions that are declared @code{inline}
8255 into the object file, even if the function has been inlined into all
8256 of its callers. This switch does not affect functions using the
8257 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8258 inline functions into the object file.
8259
8260 @item -fkeep-static-functions
8261 @opindex fkeep-static-functions
8262 Emit @code{static} functions into the object file, even if the function
8263 is never used.
8264
8265 @item -fkeep-static-consts
8266 @opindex fkeep-static-consts
8267 Emit variables declared @code{static const} when optimization isn't turned
8268 on, even if the variables aren't referenced.
8269
8270 GCC enables this option by default. If you want to force the compiler to
8271 check if a variable is referenced, regardless of whether or not
8272 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8273
8274 @item -fmerge-constants
8275 @opindex fmerge-constants
8276 Attempt to merge identical constants (string constants and floating-point
8277 constants) across compilation units.
8278
8279 This option is the default for optimized compilation if the assembler and
8280 linker support it. Use @option{-fno-merge-constants} to inhibit this
8281 behavior.
8282
8283 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8284
8285 @item -fmerge-all-constants
8286 @opindex fmerge-all-constants
8287 Attempt to merge identical constants and identical variables.
8288
8289 This option implies @option{-fmerge-constants}. In addition to
8290 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8291 arrays or initialized constant variables with integral or floating-point
8292 types. Languages like C or C++ require each variable, including multiple
8293 instances of the same variable in recursive calls, to have distinct locations,
8294 so using this option results in non-conforming
8295 behavior.
8296
8297 @item -fmodulo-sched
8298 @opindex fmodulo-sched
8299 Perform swing modulo scheduling immediately before the first scheduling
8300 pass. This pass looks at innermost loops and reorders their
8301 instructions by overlapping different iterations.
8302
8303 @item -fmodulo-sched-allow-regmoves
8304 @opindex fmodulo-sched-allow-regmoves
8305 Perform more aggressive SMS-based modulo scheduling with register moves
8306 allowed. By setting this flag certain anti-dependences edges are
8307 deleted, which triggers the generation of reg-moves based on the
8308 life-range analysis. This option is effective only with
8309 @option{-fmodulo-sched} enabled.
8310
8311 @item -fno-branch-count-reg
8312 @opindex fno-branch-count-reg
8313 @opindex fbranch-count-reg
8314 Disable the optimization pass that scans for opportunities to use
8315 ``decrement and branch'' instructions on a count register instead of
8316 instruction sequences that decrement a register, compare it against zero, and
8317 then branch based upon the result. This option is only meaningful on
8318 architectures that support such instructions, which include x86, PowerPC,
8319 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8320 doesn't remove the decrement and branch instructions from the generated
8321 instruction stream introduced by other optimization passes.
8322
8323 The default is @option{-fbranch-count-reg} at @option{-O1} and higher.
8324
8325 @item -fno-function-cse
8326 @opindex fno-function-cse
8327 @opindex ffunction-cse
8328 Do not put function addresses in registers; make each instruction that
8329 calls a constant function contain the function's address explicitly.
8330
8331 This option results in less efficient code, but some strange hacks
8332 that alter the assembler output may be confused by the optimizations
8333 performed when this option is not used.
8334
8335 The default is @option{-ffunction-cse}
8336
8337 @item -fno-zero-initialized-in-bss
8338 @opindex fno-zero-initialized-in-bss
8339 @opindex fzero-initialized-in-bss
8340 If the target supports a BSS section, GCC by default puts variables that
8341 are initialized to zero into BSS@. This can save space in the resulting
8342 code.
8343
8344 This option turns off this behavior because some programs explicitly
8345 rely on variables going to the data section---e.g., so that the
8346 resulting executable can find the beginning of that section and/or make
8347 assumptions based on that.
8348
8349 The default is @option{-fzero-initialized-in-bss}.
8350
8351 @item -fthread-jumps
8352 @opindex fthread-jumps
8353 Perform optimizations that check to see if a jump branches to a
8354 location where another comparison subsumed by the first is found. If
8355 so, the first branch is redirected to either the destination of the
8356 second branch or a point immediately following it, depending on whether
8357 the condition is known to be true or false.
8358
8359 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8360
8361 @item -fsplit-wide-types
8362 @opindex fsplit-wide-types
8363 When using a type that occupies multiple registers, such as @code{long
8364 long} on a 32-bit system, split the registers apart and allocate them
8365 independently. This normally generates better code for those types,
8366 but may make debugging more difficult.
8367
8368 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8369 @option{-Os}.
8370
8371 @item -fcse-follow-jumps
8372 @opindex fcse-follow-jumps
8373 In common subexpression elimination (CSE), scan through jump instructions
8374 when the target of the jump is not reached by any other path. For
8375 example, when CSE encounters an @code{if} statement with an
8376 @code{else} clause, CSE follows the jump when the condition
8377 tested is false.
8378
8379 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8380
8381 @item -fcse-skip-blocks
8382 @opindex fcse-skip-blocks
8383 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8384 follow jumps that conditionally skip over blocks. When CSE
8385 encounters a simple @code{if} statement with no else clause,
8386 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8387 body of the @code{if}.
8388
8389 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8390
8391 @item -frerun-cse-after-loop
8392 @opindex frerun-cse-after-loop
8393 Re-run common subexpression elimination after loop optimizations are
8394 performed.
8395
8396 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8397
8398 @item -fgcse
8399 @opindex fgcse
8400 Perform a global common subexpression elimination pass.
8401 This pass also performs global constant and copy propagation.
8402
8403 @emph{Note:} When compiling a program using computed gotos, a GCC
8404 extension, you may get better run-time performance if you disable
8405 the global common subexpression elimination pass by adding
8406 @option{-fno-gcse} to the command line.
8407
8408 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8409
8410 @item -fgcse-lm
8411 @opindex fgcse-lm
8412 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8413 attempts to move loads that are only killed by stores into themselves. This
8414 allows a loop containing a load/store sequence to be changed to a load outside
8415 the loop, and a copy/store within the loop.
8416
8417 Enabled by default when @option{-fgcse} is enabled.
8418
8419 @item -fgcse-sm
8420 @opindex fgcse-sm
8421 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8422 global common subexpression elimination. This pass attempts to move
8423 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8424 loops containing a load/store sequence can be changed to a load before
8425 the loop and a store after the loop.
8426
8427 Not enabled at any optimization level.
8428
8429 @item -fgcse-las
8430 @opindex fgcse-las
8431 When @option{-fgcse-las} is enabled, the global common subexpression
8432 elimination pass eliminates redundant loads that come after stores to the
8433 same memory location (both partial and full redundancies).
8434
8435 Not enabled at any optimization level.
8436
8437 @item -fgcse-after-reload
8438 @opindex fgcse-after-reload
8439 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8440 pass is performed after reload. The purpose of this pass is to clean up
8441 redundant spilling.
8442
8443 @item -faggressive-loop-optimizations
8444 @opindex faggressive-loop-optimizations
8445 This option tells the loop optimizer to use language constraints to
8446 derive bounds for the number of iterations of a loop. This assumes that
8447 loop code does not invoke undefined behavior by for example causing signed
8448 integer overflows or out-of-bound array accesses. The bounds for the
8449 number of iterations of a loop are used to guide loop unrolling and peeling
8450 and loop exit test optimizations.
8451 This option is enabled by default.
8452
8453 @item -funconstrained-commons
8454 @opindex funconstrained-commons
8455 This option tells the compiler that variables declared in common blocks
8456 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8457 prevents certain optimizations that depend on knowing the array bounds.
8458
8459 @item -fcrossjumping
8460 @opindex fcrossjumping
8461 Perform cross-jumping transformation.
8462 This transformation unifies equivalent code and saves code size. The
8463 resulting code may or may not perform better than without cross-jumping.
8464
8465 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8466
8467 @item -fauto-inc-dec
8468 @opindex fauto-inc-dec
8469 Combine increments or decrements of addresses with memory accesses.
8470 This pass is always skipped on architectures that do not have
8471 instructions to support this. Enabled by default at @option{-O} and
8472 higher on architectures that support this.
8473
8474 @item -fdce
8475 @opindex fdce
8476 Perform dead code elimination (DCE) on RTL@.
8477 Enabled by default at @option{-O} and higher.
8478
8479 @item -fdse
8480 @opindex fdse
8481 Perform dead store elimination (DSE) on RTL@.
8482 Enabled by default at @option{-O} and higher.
8483
8484 @item -fif-conversion
8485 @opindex fif-conversion
8486 Attempt to transform conditional jumps into branch-less equivalents. This
8487 includes use of conditional moves, min, max, set flags and abs instructions, and
8488 some tricks doable by standard arithmetics. The use of conditional execution
8489 on chips where it is available is controlled by @option{-fif-conversion2}.
8490
8491 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8492
8493 @item -fif-conversion2
8494 @opindex fif-conversion2
8495 Use conditional execution (where available) to transform conditional jumps into
8496 branch-less equivalents.
8497
8498 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8499
8500 @item -fdeclone-ctor-dtor
8501 @opindex fdeclone-ctor-dtor
8502 The C++ ABI requires multiple entry points for constructors and
8503 destructors: one for a base subobject, one for a complete object, and
8504 one for a virtual destructor that calls operator delete afterwards.
8505 For a hierarchy with virtual bases, the base and complete variants are
8506 clones, which means two copies of the function. With this option, the
8507 base and complete variants are changed to be thunks that call a common
8508 implementation.
8509
8510 Enabled by @option{-Os}.
8511
8512 @item -fdelete-null-pointer-checks
8513 @opindex fdelete-null-pointer-checks
8514 Assume that programs cannot safely dereference null pointers, and that
8515 no code or data element resides at address zero.
8516 This option enables simple constant
8517 folding optimizations at all optimization levels. In addition, other
8518 optimization passes in GCC use this flag to control global dataflow
8519 analyses that eliminate useless checks for null pointers; these assume
8520 that a memory access to address zero always results in a trap, so
8521 that if a pointer is checked after it has already been dereferenced,
8522 it cannot be null.
8523
8524 Note however that in some environments this assumption is not true.
8525 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8526 for programs that depend on that behavior.
8527
8528 This option is enabled by default on most targets. On Nios II ELF, it
8529 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8530
8531 Passes that use the dataflow information
8532 are enabled independently at different optimization levels.
8533
8534 @item -fdevirtualize
8535 @opindex fdevirtualize
8536 Attempt to convert calls to virtual functions to direct calls. This
8537 is done both within a procedure and interprocedurally as part of
8538 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8539 propagation (@option{-fipa-cp}).
8540 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8541
8542 @item -fdevirtualize-speculatively
8543 @opindex fdevirtualize-speculatively
8544 Attempt to convert calls to virtual functions to speculative direct calls.
8545 Based on the analysis of the type inheritance graph, determine for a given call
8546 the set of likely targets. If the set is small, preferably of size 1, change
8547 the call into a conditional deciding between direct and indirect calls. The
8548 speculative calls enable more optimizations, such as inlining. When they seem
8549 useless after further optimization, they are converted back into original form.
8550
8551 @item -fdevirtualize-at-ltrans
8552 @opindex fdevirtualize-at-ltrans
8553 Stream extra information needed for aggressive devirtualization when running
8554 the link-time optimizer in local transformation mode.
8555 This option enables more devirtualization but
8556 significantly increases the size of streamed data. For this reason it is
8557 disabled by default.
8558
8559 @item -fexpensive-optimizations
8560 @opindex fexpensive-optimizations
8561 Perform a number of minor optimizations that are relatively expensive.
8562
8563 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8564
8565 @item -free
8566 @opindex free
8567 Attempt to remove redundant extension instructions. This is especially
8568 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8569 registers after writing to their lower 32-bit half.
8570
8571 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8572 @option{-O3}, @option{-Os}.
8573
8574 @item -fno-lifetime-dse
8575 @opindex fno-lifetime-dse
8576 @opindex flifetime-dse
8577 In C++ the value of an object is only affected by changes within its
8578 lifetime: when the constructor begins, the object has an indeterminate
8579 value, and any changes during the lifetime of the object are dead when
8580 the object is destroyed. Normally dead store elimination will take
8581 advantage of this; if your code relies on the value of the object
8582 storage persisting beyond the lifetime of the object, you can use this
8583 flag to disable this optimization. To preserve stores before the
8584 constructor starts (e.g.@: because your operator new clears the object
8585 storage) but still treat the object as dead after the destructor you,
8586 can use @option{-flifetime-dse=1}. The default behavior can be
8587 explicitly selected with @option{-flifetime-dse=2}.
8588 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8589
8590 @item -flive-range-shrinkage
8591 @opindex flive-range-shrinkage
8592 Attempt to decrease register pressure through register live range
8593 shrinkage. This is helpful for fast processors with small or moderate
8594 size register sets.
8595
8596 @item -fira-algorithm=@var{algorithm}
8597 @opindex fira-algorithm
8598 Use the specified coloring algorithm for the integrated register
8599 allocator. The @var{algorithm} argument can be @samp{priority}, which
8600 specifies Chow's priority coloring, or @samp{CB}, which specifies
8601 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8602 for all architectures, but for those targets that do support it, it is
8603 the default because it generates better code.
8604
8605 @item -fira-region=@var{region}
8606 @opindex fira-region
8607 Use specified regions for the integrated register allocator. The
8608 @var{region} argument should be one of the following:
8609
8610 @table @samp
8611
8612 @item all
8613 Use all loops as register allocation regions.
8614 This can give the best results for machines with a small and/or
8615 irregular register set.
8616
8617 @item mixed
8618 Use all loops except for loops with small register pressure
8619 as the regions. This value usually gives
8620 the best results in most cases and for most architectures,
8621 and is enabled by default when compiling with optimization for speed
8622 (@option{-O}, @option{-O2}, @dots{}).
8623
8624 @item one
8625 Use all functions as a single region.
8626 This typically results in the smallest code size, and is enabled by default for
8627 @option{-Os} or @option{-O0}.
8628
8629 @end table
8630
8631 @item -fira-hoist-pressure
8632 @opindex fira-hoist-pressure
8633 Use IRA to evaluate register pressure in the code hoisting pass for
8634 decisions to hoist expressions. This option usually results in smaller
8635 code, but it can slow the compiler down.
8636
8637 This option is enabled at level @option{-Os} for all targets.
8638
8639 @item -fira-loop-pressure
8640 @opindex fira-loop-pressure
8641 Use IRA to evaluate register pressure in loops for decisions to move
8642 loop invariants. This option usually results in generation
8643 of faster and smaller code on machines with large register files (>= 32
8644 registers), but it can slow the compiler down.
8645
8646 This option is enabled at level @option{-O3} for some targets.
8647
8648 @item -fno-ira-share-save-slots
8649 @opindex fno-ira-share-save-slots
8650 @opindex fira-share-save-slots
8651 Disable sharing of stack slots used for saving call-used hard
8652 registers living through a call. Each hard register gets a
8653 separate stack slot, and as a result function stack frames are
8654 larger.
8655
8656 @item -fno-ira-share-spill-slots
8657 @opindex fno-ira-share-spill-slots
8658 @opindex fira-share-spill-slots
8659 Disable sharing of stack slots allocated for pseudo-registers. Each
8660 pseudo-register that does not get a hard register gets a separate
8661 stack slot, and as a result function stack frames are larger.
8662
8663 @item -flra-remat
8664 @opindex flra-remat
8665 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8666 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8667 values if it is profitable.
8668
8669 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8670
8671 @item -fdelayed-branch
8672 @opindex fdelayed-branch
8673 If supported for the target machine, attempt to reorder instructions
8674 to exploit instruction slots available after delayed branch
8675 instructions.
8676
8677 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
8678 but not at @option{-Og}.
8679
8680 @item -fschedule-insns
8681 @opindex fschedule-insns
8682 If supported for the target machine, attempt to reorder instructions to
8683 eliminate execution stalls due to required data being unavailable. This
8684 helps machines that have slow floating point or memory load instructions
8685 by allowing other instructions to be issued until the result of the load
8686 or floating-point instruction is required.
8687
8688 Enabled at levels @option{-O2}, @option{-O3}.
8689
8690 @item -fschedule-insns2
8691 @opindex fschedule-insns2
8692 Similar to @option{-fschedule-insns}, but requests an additional pass of
8693 instruction scheduling after register allocation has been done. This is
8694 especially useful on machines with a relatively small number of
8695 registers and where memory load instructions take more than one cycle.
8696
8697 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8698
8699 @item -fno-sched-interblock
8700 @opindex fno-sched-interblock
8701 @opindex fsched-interblock
8702 Disable instruction scheduling across basic blocks, which
8703 is normally enabled when scheduling before register allocation, i.e.@:
8704 with @option{-fschedule-insns} or at @option{-O2} or higher.
8705
8706 @item -fno-sched-spec
8707 @opindex fno-sched-spec
8708 @opindex fsched-spec
8709 Disable speculative motion of non-load instructions, which
8710 is normally enabled when scheduling before register allocation, i.e.@:
8711 with @option{-fschedule-insns} or at @option{-O2} or higher.
8712
8713 @item -fsched-pressure
8714 @opindex fsched-pressure
8715 Enable register pressure sensitive insn scheduling before register
8716 allocation. This only makes sense when scheduling before register
8717 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8718 @option{-O2} or higher. Usage of this option can improve the
8719 generated code and decrease its size by preventing register pressure
8720 increase above the number of available hard registers and subsequent
8721 spills in register allocation.
8722
8723 @item -fsched-spec-load
8724 @opindex fsched-spec-load
8725 Allow speculative motion of some load instructions. This only makes
8726 sense when scheduling before register allocation, i.e.@: with
8727 @option{-fschedule-insns} or at @option{-O2} or higher.
8728
8729 @item -fsched-spec-load-dangerous
8730 @opindex fsched-spec-load-dangerous
8731 Allow speculative motion of more load instructions. This only makes
8732 sense when scheduling before register allocation, i.e.@: with
8733 @option{-fschedule-insns} or at @option{-O2} or higher.
8734
8735 @item -fsched-stalled-insns
8736 @itemx -fsched-stalled-insns=@var{n}
8737 @opindex fsched-stalled-insns
8738 Define how many insns (if any) can be moved prematurely from the queue
8739 of stalled insns into the ready list during the second scheduling pass.
8740 @option{-fno-sched-stalled-insns} means that no insns are moved
8741 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8742 on how many queued insns can be moved prematurely.
8743 @option{-fsched-stalled-insns} without a value is equivalent to
8744 @option{-fsched-stalled-insns=1}.
8745
8746 @item -fsched-stalled-insns-dep
8747 @itemx -fsched-stalled-insns-dep=@var{n}
8748 @opindex fsched-stalled-insns-dep
8749 Define how many insn groups (cycles) are examined for a dependency
8750 on a stalled insn that is a candidate for premature removal from the queue
8751 of stalled insns. This has an effect only during the second scheduling pass,
8752 and only if @option{-fsched-stalled-insns} is used.
8753 @option{-fno-sched-stalled-insns-dep} is equivalent to
8754 @option{-fsched-stalled-insns-dep=0}.
8755 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8756 @option{-fsched-stalled-insns-dep=1}.
8757
8758 @item -fsched2-use-superblocks
8759 @opindex fsched2-use-superblocks
8760 When scheduling after register allocation, use superblock scheduling.
8761 This allows motion across basic block boundaries,
8762 resulting in faster schedules. This option is experimental, as not all machine
8763 descriptions used by GCC model the CPU closely enough to avoid unreliable
8764 results from the algorithm.
8765
8766 This only makes sense when scheduling after register allocation, i.e.@: with
8767 @option{-fschedule-insns2} or at @option{-O2} or higher.
8768
8769 @item -fsched-group-heuristic
8770 @opindex fsched-group-heuristic
8771 Enable the group heuristic in the scheduler. This heuristic favors
8772 the instruction that belongs to a schedule group. This is enabled
8773 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8774 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8775
8776 @item -fsched-critical-path-heuristic
8777 @opindex fsched-critical-path-heuristic
8778 Enable the critical-path heuristic in the scheduler. This heuristic favors
8779 instructions on the critical path. This is enabled by default when
8780 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8781 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8782
8783 @item -fsched-spec-insn-heuristic
8784 @opindex fsched-spec-insn-heuristic
8785 Enable the speculative instruction heuristic in the scheduler. This
8786 heuristic favors speculative instructions with greater dependency weakness.
8787 This is enabled by default when scheduling is enabled, i.e.@:
8788 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8789 or at @option{-O2} or higher.
8790
8791 @item -fsched-rank-heuristic
8792 @opindex fsched-rank-heuristic
8793 Enable the rank heuristic in the scheduler. This heuristic favors
8794 the instruction belonging to a basic block with greater size or frequency.
8795 This is enabled by default when scheduling is enabled, i.e.@:
8796 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8797 at @option{-O2} or higher.
8798
8799 @item -fsched-last-insn-heuristic
8800 @opindex fsched-last-insn-heuristic
8801 Enable the last-instruction heuristic in the scheduler. This heuristic
8802 favors the instruction that is less dependent on the last instruction
8803 scheduled. This is enabled by default when scheduling is enabled,
8804 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8805 at @option{-O2} or higher.
8806
8807 @item -fsched-dep-count-heuristic
8808 @opindex fsched-dep-count-heuristic
8809 Enable the dependent-count heuristic in the scheduler. This heuristic
8810 favors the instruction that has more instructions depending on it.
8811 This is enabled by default when scheduling is enabled, i.e.@:
8812 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8813 at @option{-O2} or higher.
8814
8815 @item -freschedule-modulo-scheduled-loops
8816 @opindex freschedule-modulo-scheduled-loops
8817 Modulo scheduling is performed before traditional scheduling. If a loop
8818 is modulo scheduled, later scheduling passes may change its schedule.
8819 Use this option to control that behavior.
8820
8821 @item -fselective-scheduling
8822 @opindex fselective-scheduling
8823 Schedule instructions using selective scheduling algorithm. Selective
8824 scheduling runs instead of the first scheduler pass.
8825
8826 @item -fselective-scheduling2
8827 @opindex fselective-scheduling2
8828 Schedule instructions using selective scheduling algorithm. Selective
8829 scheduling runs instead of the second scheduler pass.
8830
8831 @item -fsel-sched-pipelining
8832 @opindex fsel-sched-pipelining
8833 Enable software pipelining of innermost loops during selective scheduling.
8834 This option has no effect unless one of @option{-fselective-scheduling} or
8835 @option{-fselective-scheduling2} is turned on.
8836
8837 @item -fsel-sched-pipelining-outer-loops
8838 @opindex fsel-sched-pipelining-outer-loops
8839 When pipelining loops during selective scheduling, also pipeline outer loops.
8840 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8841
8842 @item -fsemantic-interposition
8843 @opindex fsemantic-interposition
8844 Some object formats, like ELF, allow interposing of symbols by the
8845 dynamic linker.
8846 This means that for symbols exported from the DSO, the compiler cannot perform
8847 interprocedural propagation, inlining and other optimizations in anticipation
8848 that the function or variable in question may change. While this feature is
8849 useful, for example, to rewrite memory allocation functions by a debugging
8850 implementation, it is expensive in the terms of code quality.
8851 With @option{-fno-semantic-interposition} the compiler assumes that
8852 if interposition happens for functions the overwriting function will have
8853 precisely the same semantics (and side effects).
8854 Similarly if interposition happens
8855 for variables, the constructor of the variable will be the same. The flag
8856 has no effect for functions explicitly declared inline
8857 (where it is never allowed for interposition to change semantics)
8858 and for symbols explicitly declared weak.
8859
8860 @item -fshrink-wrap
8861 @opindex fshrink-wrap
8862 Emit function prologues only before parts of the function that need it,
8863 rather than at the top of the function. This flag is enabled by default at
8864 @option{-O} and higher.
8865
8866 @item -fshrink-wrap-separate
8867 @opindex fshrink-wrap-separate
8868 Shrink-wrap separate parts of the prologue and epilogue separately, so that
8869 those parts are only executed when needed.
8870 This option is on by default, but has no effect unless @option{-fshrink-wrap}
8871 is also turned on and the target supports this.
8872
8873 @item -fcaller-saves
8874 @opindex fcaller-saves
8875 Enable allocation of values to registers that are clobbered by
8876 function calls, by emitting extra instructions to save and restore the
8877 registers around such calls. Such allocation is done only when it
8878 seems to result in better code.
8879
8880 This option is always enabled by default on certain machines, usually
8881 those which have no call-preserved registers to use instead.
8882
8883 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8884
8885 @item -fcombine-stack-adjustments
8886 @opindex fcombine-stack-adjustments
8887 Tracks stack adjustments (pushes and pops) and stack memory references
8888 and then tries to find ways to combine them.
8889
8890 Enabled by default at @option{-O1} and higher.
8891
8892 @item -fipa-ra
8893 @opindex fipa-ra
8894 Use caller save registers for allocation if those registers are not used by
8895 any called function. In that case it is not necessary to save and restore
8896 them around calls. This is only possible if called functions are part of
8897 same compilation unit as current function and they are compiled before it.
8898
8899 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
8900 is disabled if generated code will be instrumented for profiling
8901 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
8902 exactly (this happens on targets that do not expose prologues
8903 and epilogues in RTL).
8904
8905 @item -fconserve-stack
8906 @opindex fconserve-stack
8907 Attempt to minimize stack usage. The compiler attempts to use less
8908 stack space, even if that makes the program slower. This option
8909 implies setting the @option{large-stack-frame} parameter to 100
8910 and the @option{large-stack-frame-growth} parameter to 400.
8911
8912 @item -ftree-reassoc
8913 @opindex ftree-reassoc
8914 Perform reassociation on trees. This flag is enabled by default
8915 at @option{-O} and higher.
8916
8917 @item -fcode-hoisting
8918 @opindex fcode-hoisting
8919 Perform code hoisting. Code hoisting tries to move the
8920 evaluation of expressions executed on all paths to the function exit
8921 as early as possible. This is especially useful as a code size
8922 optimization, but it often helps for code speed as well.
8923 This flag is enabled by default at @option{-O2} and higher.
8924
8925 @item -ftree-pre
8926 @opindex ftree-pre
8927 Perform partial redundancy elimination (PRE) on trees. This flag is
8928 enabled by default at @option{-O2} and @option{-O3}.
8929
8930 @item -ftree-partial-pre
8931 @opindex ftree-partial-pre
8932 Make partial redundancy elimination (PRE) more aggressive. This flag is
8933 enabled by default at @option{-O3}.
8934
8935 @item -ftree-forwprop
8936 @opindex ftree-forwprop
8937 Perform forward propagation on trees. This flag is enabled by default
8938 at @option{-O} and higher.
8939
8940 @item -ftree-fre
8941 @opindex ftree-fre
8942 Perform full redundancy elimination (FRE) on trees. The difference
8943 between FRE and PRE is that FRE only considers expressions
8944 that are computed on all paths leading to the redundant computation.
8945 This analysis is faster than PRE, though it exposes fewer redundancies.
8946 This flag is enabled by default at @option{-O} and higher.
8947
8948 @item -ftree-phiprop
8949 @opindex ftree-phiprop
8950 Perform hoisting of loads from conditional pointers on trees. This
8951 pass is enabled by default at @option{-O} and higher.
8952
8953 @item -fhoist-adjacent-loads
8954 @opindex fhoist-adjacent-loads
8955 Speculatively hoist loads from both branches of an if-then-else if the
8956 loads are from adjacent locations in the same structure and the target
8957 architecture has a conditional move instruction. This flag is enabled
8958 by default at @option{-O2} and higher.
8959
8960 @item -ftree-copy-prop
8961 @opindex ftree-copy-prop
8962 Perform copy propagation on trees. This pass eliminates unnecessary
8963 copy operations. This flag is enabled by default at @option{-O} and
8964 higher.
8965
8966 @item -fipa-pure-const
8967 @opindex fipa-pure-const
8968 Discover which functions are pure or constant.
8969 Enabled by default at @option{-O} and higher.
8970
8971 @item -fipa-reference
8972 @opindex fipa-reference
8973 Discover which static variables do not escape the
8974 compilation unit.
8975 Enabled by default at @option{-O} and higher.
8976
8977 @item -fipa-reference-addressable
8978 @opindex fipa-reference-addressable
8979 Discover read-only, write-only and non-addressable static variables.
8980 Enabled by default at @option{-O} and higher.
8981
8982 @item -fipa-stack-alignment
8983 @opindex fipa-stack-alignment
8984 Reduce stack alignment on call sites if possible.
8985 Enabled by default.
8986
8987 @item -fipa-pta
8988 @opindex fipa-pta
8989 Perform interprocedural pointer analysis and interprocedural modification
8990 and reference analysis. This option can cause excessive memory and
8991 compile-time usage on large compilation units. It is not enabled by
8992 default at any optimization level.
8993
8994 @item -fipa-profile
8995 @opindex fipa-profile
8996 Perform interprocedural profile propagation. The functions called only from
8997 cold functions are marked as cold. Also functions executed once (such as
8998 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8999 functions and loop less parts of functions executed once are then optimized for
9000 size.
9001 Enabled by default at @option{-O} and higher.
9002
9003 @item -fipa-cp
9004 @opindex fipa-cp
9005 Perform interprocedural constant propagation.
9006 This optimization analyzes the program to determine when values passed
9007 to functions are constants and then optimizes accordingly.
9008 This optimization can substantially increase performance
9009 if the application has constants passed to functions.
9010 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9011
9012 @item -fipa-cp-clone
9013 @opindex fipa-cp-clone
9014 Perform function cloning to make interprocedural constant propagation stronger.
9015 When enabled, interprocedural constant propagation performs function cloning
9016 when externally visible function can be called with constant arguments.
9017 Because this optimization can create multiple copies of functions,
9018 it may significantly increase code size
9019 (see @option{--param ipcp-unit-growth=@var{value}}).
9020 This flag is enabled by default at @option{-O3}.
9021
9022 @item -fipa-bit-cp
9023 @opindex fipa-bit-cp
9024 When enabled, perform interprocedural bitwise constant
9025 propagation. This flag is enabled by default at @option{-O2}. It
9026 requires that @option{-fipa-cp} is enabled.
9027
9028 @item -fipa-vrp
9029 @opindex fipa-vrp
9030 When enabled, perform interprocedural propagation of value
9031 ranges. This flag is enabled by default at @option{-O2}. It requires
9032 that @option{-fipa-cp} is enabled.
9033
9034 @item -fipa-icf
9035 @opindex fipa-icf
9036 Perform Identical Code Folding for functions and read-only variables.
9037 The optimization reduces code size and may disturb unwind stacks by replacing
9038 a function by equivalent one with a different name. The optimization works
9039 more effectively with link-time optimization enabled.
9040
9041 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
9042 works on different levels and thus the optimizations are not same - there are
9043 equivalences that are found only by GCC and equivalences found only by Gold.
9044
9045 This flag is enabled by default at @option{-O2} and @option{-Os}.
9046
9047 @item -fisolate-erroneous-paths-dereference
9048 @opindex fisolate-erroneous-paths-dereference
9049 Detect paths that trigger erroneous or undefined behavior due to
9050 dereferencing a null pointer. Isolate those paths from the main control
9051 flow and turn the statement with erroneous or undefined behavior into a trap.
9052 This flag is enabled by default at @option{-O2} and higher and depends on
9053 @option{-fdelete-null-pointer-checks} also being enabled.
9054
9055 @item -fisolate-erroneous-paths-attribute
9056 @opindex fisolate-erroneous-paths-attribute
9057 Detect paths that trigger erroneous or undefined behavior due to a null value
9058 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9059 attribute. Isolate those paths from the main control flow and turn the
9060 statement with erroneous or undefined behavior into a trap. This is not
9061 currently enabled, but may be enabled by @option{-O2} in the future.
9062
9063 @item -ftree-sink
9064 @opindex ftree-sink
9065 Perform forward store motion on trees. This flag is
9066 enabled by default at @option{-O} and higher.
9067
9068 @item -ftree-bit-ccp
9069 @opindex ftree-bit-ccp
9070 Perform sparse conditional bit constant propagation on trees and propagate
9071 pointer alignment information.
9072 This pass only operates on local scalar variables and is enabled by default
9073 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
9074
9075 @item -ftree-ccp
9076 @opindex ftree-ccp
9077 Perform sparse conditional constant propagation (CCP) on trees. This
9078 pass only operates on local scalar variables and is enabled by default
9079 at @option{-O} and higher.
9080
9081 @item -fssa-backprop
9082 @opindex fssa-backprop
9083 Propagate information about uses of a value up the definition chain
9084 in order to simplify the definitions. For example, this pass strips
9085 sign operations if the sign of a value never matters. The flag is
9086 enabled by default at @option{-O} and higher.
9087
9088 @item -fssa-phiopt
9089 @opindex fssa-phiopt
9090 Perform pattern matching on SSA PHI nodes to optimize conditional
9091 code. This pass is enabled by default at @option{-O} and higher.
9092
9093 @item -ftree-switch-conversion
9094 @opindex ftree-switch-conversion
9095 Perform conversion of simple initializations in a switch to
9096 initializations from a scalar array. This flag is enabled by default
9097 at @option{-O2} and higher.
9098
9099 @item -ftree-tail-merge
9100 @opindex ftree-tail-merge
9101 Look for identical code sequences. When found, replace one with a jump to the
9102 other. This optimization is known as tail merging or cross jumping. This flag
9103 is enabled by default at @option{-O2} and higher. The compilation time
9104 in this pass can
9105 be limited using @option{max-tail-merge-comparisons} parameter and
9106 @option{max-tail-merge-iterations} parameter.
9107
9108 @item -ftree-dce
9109 @opindex ftree-dce
9110 Perform dead code elimination (DCE) on trees. This flag is enabled by
9111 default at @option{-O} and higher.
9112
9113 @item -ftree-builtin-call-dce
9114 @opindex ftree-builtin-call-dce
9115 Perform conditional dead code elimination (DCE) for calls to built-in functions
9116 that may set @code{errno} but are otherwise free of side effects. This flag is
9117 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9118 specified.
9119
9120 @item -ftree-dominator-opts
9121 @opindex ftree-dominator-opts
9122 Perform a variety of simple scalar cleanups (constant/copy
9123 propagation, redundancy elimination, range propagation and expression
9124 simplification) based on a dominator tree traversal. This also
9125 performs jump threading (to reduce jumps to jumps). This flag is
9126 enabled by default at @option{-O} and higher.
9127
9128 @item -ftree-dse
9129 @opindex ftree-dse
9130 Perform dead store elimination (DSE) on trees. A dead store is a store into
9131 a memory location that is later overwritten by another store without
9132 any intervening loads. In this case the earlier store can be deleted. This
9133 flag is enabled by default at @option{-O} and higher.
9134
9135 @item -ftree-ch
9136 @opindex ftree-ch
9137 Perform loop header copying on trees. This is beneficial since it increases
9138 effectiveness of code motion optimizations. It also saves one jump. This flag
9139 is enabled by default at @option{-O} and higher. It is not enabled
9140 for @option{-Os}, since it usually increases code size.
9141
9142 @item -ftree-loop-optimize
9143 @opindex ftree-loop-optimize
9144 Perform loop optimizations on trees. This flag is enabled by default
9145 at @option{-O} and higher.
9146
9147 @item -ftree-loop-linear
9148 @itemx -floop-strip-mine
9149 @itemx -floop-block
9150 @opindex ftree-loop-linear
9151 @opindex floop-strip-mine
9152 @opindex floop-block
9153 Perform loop nest optimizations. Same as
9154 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9155 to be configured with @option{--with-isl} to enable the Graphite loop
9156 transformation infrastructure.
9157
9158 @item -fgraphite-identity
9159 @opindex fgraphite-identity
9160 Enable the identity transformation for graphite. For every SCoP we generate
9161 the polyhedral representation and transform it back to gimple. Using
9162 @option{-fgraphite-identity} we can check the costs or benefits of the
9163 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9164 are also performed by the code generator isl, like index splitting and
9165 dead code elimination in loops.
9166
9167 @item -floop-nest-optimize
9168 @opindex floop-nest-optimize
9169 Enable the isl based loop nest optimizer. This is a generic loop nest
9170 optimizer based on the Pluto optimization algorithms. It calculates a loop
9171 structure optimized for data-locality and parallelism. This option
9172 is experimental.
9173
9174 @item -floop-parallelize-all
9175 @opindex floop-parallelize-all
9176 Use the Graphite data dependence analysis to identify loops that can
9177 be parallelized. Parallelize all the loops that can be analyzed to
9178 not contain loop carried dependences without checking that it is
9179 profitable to parallelize the loops.
9180
9181 @item -ftree-coalesce-vars
9182 @opindex ftree-coalesce-vars
9183 While transforming the program out of the SSA representation, attempt to
9184 reduce copying by coalescing versions of different user-defined
9185 variables, instead of just compiler temporaries. This may severely
9186 limit the ability to debug an optimized program compiled with
9187 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9188 prevents SSA coalescing of user variables. This option is enabled by
9189 default if optimization is enabled, and it does very little otherwise.
9190
9191 @item -ftree-loop-if-convert
9192 @opindex ftree-loop-if-convert
9193 Attempt to transform conditional jumps in the innermost loops to
9194 branch-less equivalents. The intent is to remove control-flow from
9195 the innermost loops in order to improve the ability of the
9196 vectorization pass to handle these loops. This is enabled by default
9197 if vectorization is enabled.
9198
9199 @item -ftree-loop-distribution
9200 @opindex ftree-loop-distribution
9201 Perform loop distribution. This flag can improve cache performance on
9202 big loop bodies and allow further loop optimizations, like
9203 parallelization or vectorization, to take place. For example, the loop
9204 @smallexample
9205 DO I = 1, N
9206 A(I) = B(I) + C
9207 D(I) = E(I) * F
9208 ENDDO
9209 @end smallexample
9210 is transformed to
9211 @smallexample
9212 DO I = 1, N
9213 A(I) = B(I) + C
9214 ENDDO
9215 DO I = 1, N
9216 D(I) = E(I) * F
9217 ENDDO
9218 @end smallexample
9219
9220 @item -ftree-loop-distribute-patterns
9221 @opindex ftree-loop-distribute-patterns
9222 Perform loop distribution of patterns that can be code generated with
9223 calls to a library. This flag is enabled by default at @option{-O3}.
9224
9225 This pass distributes the initialization loops and generates a call to
9226 memset zero. For example, the loop
9227 @smallexample
9228 DO I = 1, N
9229 A(I) = 0
9230 B(I) = A(I) + I
9231 ENDDO
9232 @end smallexample
9233 is transformed to
9234 @smallexample
9235 DO I = 1, N
9236 A(I) = 0
9237 ENDDO
9238 DO I = 1, N
9239 B(I) = A(I) + I
9240 ENDDO
9241 @end smallexample
9242 and the initialization loop is transformed into a call to memset zero.
9243
9244 @item -floop-interchange
9245 @opindex floop-interchange
9246 Perform loop interchange outside of graphite. This flag can improve cache
9247 performance on loop nest and allow further loop optimizations, like
9248 vectorization, to take place. For example, the loop
9249 @smallexample
9250 for (int i = 0; i < N; i++)
9251 for (int j = 0; j < N; j++)
9252 for (int k = 0; k < N; k++)
9253 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9254 @end smallexample
9255 is transformed to
9256 @smallexample
9257 for (int i = 0; i < N; i++)
9258 for (int k = 0; k < N; k++)
9259 for (int j = 0; j < N; j++)
9260 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9261 @end smallexample
9262 This flag is enabled by default at @option{-O3}.
9263
9264 @item -floop-unroll-and-jam
9265 @opindex floop-unroll-and-jam
9266 Apply unroll and jam transformations on feasible loops. In a loop
9267 nest this unrolls the outer loop by some factor and fuses the resulting
9268 multiple inner loops. This flag is enabled by default at @option{-O3}.
9269
9270 @item -ftree-loop-im
9271 @opindex ftree-loop-im
9272 Perform loop invariant motion on trees. This pass moves only invariants that
9273 are hard to handle at RTL level (function calls, operations that expand to
9274 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9275 operands of conditions that are invariant out of the loop, so that we can use
9276 just trivial invariantness analysis in loop unswitching. The pass also includes
9277 store motion.
9278
9279 @item -ftree-loop-ivcanon
9280 @opindex ftree-loop-ivcanon
9281 Create a canonical counter for number of iterations in loops for which
9282 determining number of iterations requires complicated analysis. Later
9283 optimizations then may determine the number easily. Useful especially
9284 in connection with unrolling.
9285
9286 @item -ftree-scev-cprop
9287 @opindex ftree-scev-cprop
9288 Perform final value replacement. If a variable is modified in a loop
9289 in such a way that its value when exiting the loop can be determined using
9290 only its initial value and the number of loop iterations, replace uses of
9291 the final value by such a computation, provided it is sufficiently cheap.
9292 This reduces data dependencies and may allow further simplifications.
9293 Enabled by default at @option{-O} and higher.
9294
9295 @item -fivopts
9296 @opindex fivopts
9297 Perform induction variable optimizations (strength reduction, induction
9298 variable merging and induction variable elimination) on trees.
9299
9300 @item -ftree-parallelize-loops=n
9301 @opindex ftree-parallelize-loops
9302 Parallelize loops, i.e., split their iteration space to run in n threads.
9303 This is only possible for loops whose iterations are independent
9304 and can be arbitrarily reordered. The optimization is only
9305 profitable on multiprocessor machines, for loops that are CPU-intensive,
9306 rather than constrained e.g.@: by memory bandwidth. This option
9307 implies @option{-pthread}, and thus is only supported on targets
9308 that have support for @option{-pthread}.
9309
9310 @item -ftree-pta
9311 @opindex ftree-pta
9312 Perform function-local points-to analysis on trees. This flag is
9313 enabled by default at @option{-O} and higher.
9314
9315 @item -ftree-sra
9316 @opindex ftree-sra
9317 Perform scalar replacement of aggregates. This pass replaces structure
9318 references with scalars to prevent committing structures to memory too
9319 early. This flag is enabled by default at @option{-O} and higher.
9320
9321 @item -fstore-merging
9322 @opindex fstore-merging
9323 Perform merging of narrow stores to consecutive memory addresses. This pass
9324 merges contiguous stores of immediate values narrower than a word into fewer
9325 wider stores to reduce the number of instructions. This is enabled by default
9326 at @option{-O2} and higher as well as @option{-Os}.
9327
9328 @item -ftree-ter
9329 @opindex ftree-ter
9330 Perform temporary expression replacement during the SSA->normal phase. Single
9331 use/single def temporaries are replaced at their use location with their
9332 defining expression. This results in non-GIMPLE code, but gives the expanders
9333 much more complex trees to work on resulting in better RTL generation. This is
9334 enabled by default at @option{-O} and higher.
9335
9336 @item -ftree-slsr
9337 @opindex ftree-slsr
9338 Perform straight-line strength reduction on trees. This recognizes related
9339 expressions involving multiplications and replaces them by less expensive
9340 calculations when possible. This is enabled by default at @option{-O} and
9341 higher.
9342
9343 @item -ftree-vectorize
9344 @opindex ftree-vectorize
9345 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9346 and @option{-ftree-slp-vectorize} if not explicitly specified.
9347
9348 @item -ftree-loop-vectorize
9349 @opindex ftree-loop-vectorize
9350 Perform loop vectorization on trees. This flag is enabled by default at
9351 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9352
9353 @item -ftree-slp-vectorize
9354 @opindex ftree-slp-vectorize
9355 Perform basic block vectorization on trees. This flag is enabled by default at
9356 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9357
9358 @item -fvect-cost-model=@var{model}
9359 @opindex fvect-cost-model
9360 Alter the cost model used for vectorization. The @var{model} argument
9361 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9362 With the @samp{unlimited} model the vectorized code-path is assumed
9363 to be profitable while with the @samp{dynamic} model a runtime check
9364 guards the vectorized code-path to enable it only for iteration
9365 counts that will likely execute faster than when executing the original
9366 scalar loop. The @samp{cheap} model disables vectorization of
9367 loops where doing so would be cost prohibitive for example due to
9368 required runtime checks for data dependence or alignment but otherwise
9369 is equal to the @samp{dynamic} model.
9370 The default cost model depends on other optimization flags and is
9371 either @samp{dynamic} or @samp{cheap}.
9372
9373 @item -fsimd-cost-model=@var{model}
9374 @opindex fsimd-cost-model
9375 Alter the cost model used for vectorization of loops marked with the OpenMP
9376 simd directive. The @var{model} argument should be one of
9377 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9378 have the same meaning as described in @option{-fvect-cost-model} and by
9379 default a cost model defined with @option{-fvect-cost-model} is used.
9380
9381 @item -ftree-vrp
9382 @opindex ftree-vrp
9383 Perform Value Range Propagation on trees. This is similar to the
9384 constant propagation pass, but instead of values, ranges of values are
9385 propagated. This allows the optimizers to remove unnecessary range
9386 checks like array bound checks and null pointer checks. This is
9387 enabled by default at @option{-O2} and higher. Null pointer check
9388 elimination is only done if @option{-fdelete-null-pointer-checks} is
9389 enabled.
9390
9391 @item -fsplit-paths
9392 @opindex fsplit-paths
9393 Split paths leading to loop backedges. This can improve dead code
9394 elimination and common subexpression elimination. This is enabled by
9395 default at @option{-O2} and above.
9396
9397 @item -fsplit-ivs-in-unroller
9398 @opindex fsplit-ivs-in-unroller
9399 Enables expression of values of induction variables in later iterations
9400 of the unrolled loop using the value in the first iteration. This breaks
9401 long dependency chains, thus improving efficiency of the scheduling passes.
9402
9403 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9404 same effect. However, that is not reliable in cases where the loop body
9405 is more complicated than a single basic block. It also does not work at all
9406 on some architectures due to restrictions in the CSE pass.
9407
9408 This optimization is enabled by default.
9409
9410 @item -fvariable-expansion-in-unroller
9411 @opindex fvariable-expansion-in-unroller
9412 With this option, the compiler creates multiple copies of some
9413 local variables when unrolling a loop, which can result in superior code.
9414
9415 @item -fpartial-inlining
9416 @opindex fpartial-inlining
9417 Inline parts of functions. This option has any effect only
9418 when inlining itself is turned on by the @option{-finline-functions}
9419 or @option{-finline-small-functions} options.
9420
9421 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9422
9423 @item -fpredictive-commoning
9424 @opindex fpredictive-commoning
9425 Perform predictive commoning optimization, i.e., reusing computations
9426 (especially memory loads and stores) performed in previous
9427 iterations of loops.
9428
9429 This option is enabled at level @option{-O3}.
9430
9431 @item -fprefetch-loop-arrays
9432 @opindex fprefetch-loop-arrays
9433 If supported by the target machine, generate instructions to prefetch
9434 memory to improve the performance of loops that access large arrays.
9435
9436 This option may generate better or worse code; results are highly
9437 dependent on the structure of loops within the source code.
9438
9439 Disabled at level @option{-Os}.
9440
9441 @item -fno-printf-return-value
9442 @opindex fno-printf-return-value
9443 @opindex fprintf-return-value
9444 Do not substitute constants for known return value of formatted output
9445 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9446 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9447 transformation allows GCC to optimize or even eliminate branches based
9448 on the known return value of these functions called with arguments that
9449 are either constant, or whose values are known to be in a range that
9450 makes determining the exact return value possible. For example, when
9451 @option{-fprintf-return-value} is in effect, both the branch and the
9452 body of the @code{if} statement (but not the call to @code{snprint})
9453 can be optimized away when @code{i} is a 32-bit or smaller integer
9454 because the return value is guaranteed to be at most 8.
9455
9456 @smallexample
9457 char buf[9];
9458 if (snprintf (buf, "%08x", i) >= sizeof buf)
9459 @dots{}
9460 @end smallexample
9461
9462 The @option{-fprintf-return-value} option relies on other optimizations
9463 and yields best results with @option{-O2} and above. It works in tandem
9464 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9465 options. The @option{-fprintf-return-value} option is enabled by default.
9466
9467 @item -fno-peephole
9468 @itemx -fno-peephole2
9469 @opindex fno-peephole
9470 @opindex fpeephole
9471 @opindex fno-peephole2
9472 @opindex fpeephole2
9473 Disable any machine-specific peephole optimizations. The difference
9474 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9475 are implemented in the compiler; some targets use one, some use the
9476 other, a few use both.
9477
9478 @option{-fpeephole} is enabled by default.
9479 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9480
9481 @item -fno-guess-branch-probability
9482 @opindex fno-guess-branch-probability
9483 @opindex fguess-branch-probability
9484 Do not guess branch probabilities using heuristics.
9485
9486 GCC uses heuristics to guess branch probabilities if they are
9487 not provided by profiling feedback (@option{-fprofile-arcs}). These
9488 heuristics are based on the control flow graph. If some branch probabilities
9489 are specified by @code{__builtin_expect}, then the heuristics are
9490 used to guess branch probabilities for the rest of the control flow graph,
9491 taking the @code{__builtin_expect} info into account. The interactions
9492 between the heuristics and @code{__builtin_expect} can be complex, and in
9493 some cases, it may be useful to disable the heuristics so that the effects
9494 of @code{__builtin_expect} are easier to understand.
9495
9496 It is also possible to specify expected probability of the expression
9497 with @code{__builtin_expect_with_probability} built-in function.
9498
9499 The default is @option{-fguess-branch-probability} at levels
9500 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9501
9502 @item -freorder-blocks
9503 @opindex freorder-blocks
9504 Reorder basic blocks in the compiled function in order to reduce number of
9505 taken branches and improve code locality.
9506
9507 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9508
9509 @item -freorder-blocks-algorithm=@var{algorithm}
9510 @opindex freorder-blocks-algorithm
9511 Use the specified algorithm for basic block reordering. The
9512 @var{algorithm} argument can be @samp{simple}, which does not increase
9513 code size (except sometimes due to secondary effects like alignment),
9514 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9515 put all often executed code together, minimizing the number of branches
9516 executed by making extra copies of code.
9517
9518 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9519 @samp{stc} at levels @option{-O2}, @option{-O3}.
9520
9521 @item -freorder-blocks-and-partition
9522 @opindex freorder-blocks-and-partition
9523 In addition to reordering basic blocks in the compiled function, in order
9524 to reduce number of taken branches, partitions hot and cold basic blocks
9525 into separate sections of the assembly and @file{.o} files, to improve
9526 paging and cache locality performance.
9527
9528 This optimization is automatically turned off in the presence of
9529 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9530 section attribute and on any architecture that does not support named
9531 sections. When @option{-fsplit-stack} is used this option is not
9532 enabled by default (to avoid linker errors), but may be enabled
9533 explicitly (if using a working linker).
9534
9535 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9536
9537 @item -freorder-functions
9538 @opindex freorder-functions
9539 Reorder functions in the object file in order to
9540 improve code locality. This is implemented by using special
9541 subsections @code{.text.hot} for most frequently executed functions and
9542 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9543 the linker so object file format must support named sections and linker must
9544 place them in a reasonable way.
9545
9546 Also profile feedback must be available to make this option effective. See
9547 @option{-fprofile-arcs} for details.
9548
9549 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9550
9551 @item -fstrict-aliasing
9552 @opindex fstrict-aliasing
9553 Allow the compiler to assume the strictest aliasing rules applicable to
9554 the language being compiled. For C (and C++), this activates
9555 optimizations based on the type of expressions. In particular, an
9556 object of one type is assumed never to reside at the same address as an
9557 object of a different type, unless the types are almost the same. For
9558 example, an @code{unsigned int} can alias an @code{int}, but not a
9559 @code{void*} or a @code{double}. A character type may alias any other
9560 type.
9561
9562 @anchor{Type-punning}Pay special attention to code like this:
9563 @smallexample
9564 union a_union @{
9565 int i;
9566 double d;
9567 @};
9568
9569 int f() @{
9570 union a_union t;
9571 t.d = 3.0;
9572 return t.i;
9573 @}
9574 @end smallexample
9575 The practice of reading from a different union member than the one most
9576 recently written to (called ``type-punning'') is common. Even with
9577 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9578 is accessed through the union type. So, the code above works as
9579 expected. @xref{Structures unions enumerations and bit-fields
9580 implementation}. However, this code might not:
9581 @smallexample
9582 int f() @{
9583 union a_union t;
9584 int* ip;
9585 t.d = 3.0;
9586 ip = &t.i;
9587 return *ip;
9588 @}
9589 @end smallexample
9590
9591 Similarly, access by taking the address, casting the resulting pointer
9592 and dereferencing the result has undefined behavior, even if the cast
9593 uses a union type, e.g.:
9594 @smallexample
9595 int f() @{
9596 double d = 3.0;
9597 return ((union a_union *) &d)->i;
9598 @}
9599 @end smallexample
9600
9601 The @option{-fstrict-aliasing} option is enabled at levels
9602 @option{-O2}, @option{-O3}, @option{-Os}.
9603
9604 @item -falign-functions
9605 @itemx -falign-functions=@var{n}
9606 @itemx -falign-functions=@var{n}:@var{m}
9607 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
9608 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
9609 @opindex falign-functions
9610 Align the start of functions to the next power-of-two greater than
9611 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
9612 the first @var{m} bytes of the function can be fetched by the CPU
9613 without crossing an @var{n}-byte alignment boundary.
9614
9615 If @var{m} is not specified, it defaults to @var{n}.
9616
9617 Examples: @option{-falign-functions=32} aligns functions to the next
9618 32-byte boundary, @option{-falign-functions=24} aligns to the next
9619 32-byte boundary only if this can be done by skipping 23 bytes or less,
9620 @option{-falign-functions=32:7} aligns to the next
9621 32-byte boundary only if this can be done by skipping 6 bytes or less.
9622
9623 The second pair of @var{n2}:@var{m2} values allows you to specify
9624 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
9625 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
9626 otherwise aligns to the next 32-byte boundary if this can be done
9627 by skipping 2 bytes or less.
9628 If @var{m2} is not specified, it defaults to @var{n2}.
9629
9630 Some assemblers only support this flag when @var{n} is a power of two;
9631 in that case, it is rounded up.
9632
9633 @option{-fno-align-functions} and @option{-falign-functions=1} are
9634 equivalent and mean that functions are not aligned.
9635
9636 If @var{n} is not specified or is zero, use a machine-dependent default.
9637 The maximum allowed @var{n} option value is 65536.
9638
9639 Enabled at levels @option{-O2}, @option{-O3}.
9640
9641 @item -flimit-function-alignment
9642 If this option is enabled, the compiler tries to avoid unnecessarily
9643 overaligning functions. It attempts to instruct the assembler to align
9644 by the amount specified by @option{-falign-functions}, but not to
9645 skip more bytes than the size of the function.
9646
9647 @item -falign-labels
9648 @itemx -falign-labels=@var{n}
9649 @itemx -falign-labels=@var{n}:@var{m}
9650 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
9651 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
9652 @opindex falign-labels
9653 Align all branch targets to a power-of-two boundary.
9654
9655 Parameters of this option are analogous to the @option{-falign-functions} option.
9656 @option{-fno-align-labels} and @option{-falign-labels=1} are
9657 equivalent and mean that labels are not aligned.
9658
9659 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9660 are greater than this value, then their values are used instead.
9661
9662 If @var{n} is not specified or is zero, use a machine-dependent default
9663 which is very likely to be @samp{1}, meaning no alignment.
9664 The maximum allowed @var{n} option value is 65536.
9665
9666 Enabled at levels @option{-O2}, @option{-O3}.
9667
9668 @item -falign-loops
9669 @itemx -falign-loops=@var{n}
9670 @itemx -falign-loops=@var{n}:@var{m}
9671 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
9672 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
9673 @opindex falign-loops
9674 Align loops to a power-of-two boundary. If the loops are executed
9675 many times, this makes up for any execution of the dummy padding
9676 instructions.
9677
9678 Parameters of this option are analogous to the @option{-falign-functions} option.
9679 @option{-fno-align-loops} and @option{-falign-loops=1} are
9680 equivalent and mean that loops are not aligned.
9681 The maximum allowed @var{n} option value is 65536.
9682
9683 If @var{n} is not specified or is zero, use a machine-dependent default.
9684
9685 Enabled at levels @option{-O2}, @option{-O3}.
9686
9687 @item -falign-jumps
9688 @itemx -falign-jumps=@var{n}
9689 @itemx -falign-jumps=@var{n}:@var{m}
9690 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
9691 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
9692 @opindex falign-jumps
9693 Align branch targets to a power-of-two boundary, for branch targets
9694 where the targets can only be reached by jumping. In this case,
9695 no dummy operations need be executed.
9696
9697 Parameters of this option are analogous to the @option{-falign-functions} option.
9698 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9699 equivalent and mean that loops are not aligned.
9700
9701 If @var{n} is not specified or is zero, use a machine-dependent default.
9702 The maximum allowed @var{n} option value is 65536.
9703
9704 Enabled at levels @option{-O2}, @option{-O3}.
9705
9706 @item -funit-at-a-time
9707 @opindex funit-at-a-time
9708 This option is left for compatibility reasons. @option{-funit-at-a-time}
9709 has no effect, while @option{-fno-unit-at-a-time} implies
9710 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9711
9712 Enabled by default.
9713
9714 @item -fno-toplevel-reorder
9715 @opindex fno-toplevel-reorder
9716 @opindex ftoplevel-reorder
9717 Do not reorder top-level functions, variables, and @code{asm}
9718 statements. Output them in the same order that they appear in the
9719 input file. When this option is used, unreferenced static variables
9720 are not removed. This option is intended to support existing code
9721 that relies on a particular ordering. For new code, it is better to
9722 use attributes when possible.
9723
9724 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
9725 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
9726 Additionally @option{-fno-toplevel-reorder} implies
9727 @option{-fno-section-anchors}.
9728
9729 @item -fweb
9730 @opindex fweb
9731 Constructs webs as commonly used for register allocation purposes and assign
9732 each web individual pseudo register. This allows the register allocation pass
9733 to operate on pseudos directly, but also strengthens several other optimization
9734 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9735 however, make debugging impossible, since variables no longer stay in a
9736 ``home register''.
9737
9738 Enabled by default with @option{-funroll-loops}.
9739
9740 @item -fwhole-program
9741 @opindex fwhole-program
9742 Assume that the current compilation unit represents the whole program being
9743 compiled. All public functions and variables with the exception of @code{main}
9744 and those merged by attribute @code{externally_visible} become static functions
9745 and in effect are optimized more aggressively by interprocedural optimizers.
9746
9747 This option should not be used in combination with @option{-flto}.
9748 Instead relying on a linker plugin should provide safer and more precise
9749 information.
9750
9751 @item -flto[=@var{n}]
9752 @opindex flto
9753 This option runs the standard link-time optimizer. When invoked
9754 with source code, it generates GIMPLE (one of GCC's internal
9755 representations) and writes it to special ELF sections in the object
9756 file. When the object files are linked together, all the function
9757 bodies are read from these ELF sections and instantiated as if they
9758 had been part of the same translation unit.
9759
9760 To use the link-time optimizer, @option{-flto} and optimization
9761 options should be specified at compile time and during the final link.
9762 It is recommended that you compile all the files participating in the
9763 same link with the same options and also specify those options at
9764 link time.
9765 For example:
9766
9767 @smallexample
9768 gcc -c -O2 -flto foo.c
9769 gcc -c -O2 -flto bar.c
9770 gcc -o myprog -flto -O2 foo.o bar.o
9771 @end smallexample
9772
9773 The first two invocations to GCC save a bytecode representation
9774 of GIMPLE into special ELF sections inside @file{foo.o} and
9775 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
9776 @file{foo.o} and @file{bar.o}, merges the two files into a single
9777 internal image, and compiles the result as usual. Since both
9778 @file{foo.o} and @file{bar.o} are merged into a single image, this
9779 causes all the interprocedural analyses and optimizations in GCC to
9780 work across the two files as if they were a single one. This means,
9781 for example, that the inliner is able to inline functions in
9782 @file{bar.o} into functions in @file{foo.o} and vice-versa.
9783
9784 Another (simpler) way to enable link-time optimization is:
9785
9786 @smallexample
9787 gcc -o myprog -flto -O2 foo.c bar.c
9788 @end smallexample
9789
9790 The above generates bytecode for @file{foo.c} and @file{bar.c},
9791 merges them together into a single GIMPLE representation and optimizes
9792 them as usual to produce @file{myprog}.
9793
9794 The only important thing to keep in mind is that to enable link-time
9795 optimizations you need to use the GCC driver to perform the link step.
9796 GCC then automatically performs link-time optimization if any of the
9797 objects involved were compiled with the @option{-flto} command-line option.
9798 You generally
9799 should specify the optimization options to be used for link-time
9800 optimization though GCC tries to be clever at guessing an
9801 optimization level to use from the options used at compile time
9802 if you fail to specify one at link time. You can always override
9803 the automatic decision to do link-time optimization
9804 by passing @option{-fno-lto} to the link command.
9805
9806 To make whole program optimization effective, it is necessary to make
9807 certain whole program assumptions. The compiler needs to know
9808 what functions and variables can be accessed by libraries and runtime
9809 outside of the link-time optimized unit. When supported by the linker,
9810 the linker plugin (see @option{-fuse-linker-plugin}) passes information
9811 to the compiler about used and externally visible symbols. When
9812 the linker plugin is not available, @option{-fwhole-program} should be
9813 used to allow the compiler to make these assumptions, which leads
9814 to more aggressive optimization decisions.
9815
9816 When @option{-fuse-linker-plugin} is not enabled, when a file is
9817 compiled with @option{-flto}, the generated object file is larger than
9818 a regular object file because it contains GIMPLE bytecodes and the usual
9819 final code (see @option{-ffat-lto-objects}. This means that
9820 object files with LTO information can be linked as normal object
9821 files; if @option{-fno-lto} is passed to the linker, no
9822 interprocedural optimizations are applied. Note that when
9823 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
9824 but you cannot perform a regular, non-LTO link on them.
9825
9826 Additionally, the optimization flags used to compile individual files
9827 are not necessarily related to those used at link time. For instance,
9828
9829 @smallexample
9830 gcc -c -O0 -ffat-lto-objects -flto foo.c
9831 gcc -c -O0 -ffat-lto-objects -flto bar.c
9832 gcc -o myprog -O3 foo.o bar.o
9833 @end smallexample
9834
9835 This produces individual object files with unoptimized assembler
9836 code, but the resulting binary @file{myprog} is optimized at
9837 @option{-O3}. If, instead, the final binary is generated with
9838 @option{-fno-lto}, then @file{myprog} is not optimized.
9839
9840 When producing the final binary, GCC only
9841 applies link-time optimizations to those files that contain bytecode.
9842 Therefore, you can mix and match object files and libraries with
9843 GIMPLE bytecodes and final object code. GCC automatically selects
9844 which files to optimize in LTO mode and which files to link without
9845 further processing.
9846
9847 There are some code generation flags preserved by GCC when
9848 generating bytecodes, as they need to be used during the final link
9849 stage. Generally options specified at link time override those
9850 specified at compile time.
9851
9852 If you do not specify an optimization level option @option{-O} at
9853 link time, then GCC uses the highest optimization level
9854 used when compiling the object files.
9855
9856 Currently, the following options and their settings are taken from
9857 the first object file that explicitly specifies them:
9858 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9859 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9860 and all the @option{-m} target flags.
9861
9862 Certain ABI-changing flags are required to match in all compilation units,
9863 and trying to override this at link time with a conflicting value
9864 is ignored. This includes options such as @option{-freg-struct-return}
9865 and @option{-fpcc-struct-return}.
9866
9867 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9868 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9869 are passed through to the link stage and merged conservatively for
9870 conflicting translation units. Specifically
9871 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9872 precedence; and for example @option{-ffp-contract=off} takes precedence
9873 over @option{-ffp-contract=fast}. You can override them at link time.
9874
9875 If LTO encounters objects with C linkage declared with incompatible
9876 types in separate translation units to be linked together (undefined
9877 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9878 issued. The behavior is still undefined at run time. Similar
9879 diagnostics may be raised for other languages.
9880
9881 Another feature of LTO is that it is possible to apply interprocedural
9882 optimizations on files written in different languages:
9883
9884 @smallexample
9885 gcc -c -flto foo.c
9886 g++ -c -flto bar.cc
9887 gfortran -c -flto baz.f90
9888 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9889 @end smallexample
9890
9891 Notice that the final link is done with @command{g++} to get the C++
9892 runtime libraries and @option{-lgfortran} is added to get the Fortran
9893 runtime libraries. In general, when mixing languages in LTO mode, you
9894 should use the same link command options as when mixing languages in a
9895 regular (non-LTO) compilation.
9896
9897 If object files containing GIMPLE bytecode are stored in a library archive, say
9898 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9899 are using a linker with plugin support. To create static libraries suitable
9900 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9901 and @command{ranlib};
9902 to show the symbols of object files with GIMPLE bytecode, use
9903 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9904 and @command{nm} have been compiled with plugin support. At link time, use the
9905 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9906 the LTO optimization process:
9907
9908 @smallexample
9909 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9910 @end smallexample
9911
9912 With the linker plugin enabled, the linker extracts the needed
9913 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9914 to make them part of the aggregated GIMPLE image to be optimized.
9915
9916 If you are not using a linker with plugin support and/or do not
9917 enable the linker plugin, then the objects inside @file{libfoo.a}
9918 are extracted and linked as usual, but they do not participate
9919 in the LTO optimization process. In order to make a static library suitable
9920 for both LTO optimization and usual linkage, compile its object files with
9921 @option{-flto} @option{-ffat-lto-objects}.
9922
9923 Link-time optimizations do not require the presence of the whole program to
9924 operate. If the program does not require any symbols to be exported, it is
9925 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9926 the interprocedural optimizers to use more aggressive assumptions which may
9927 lead to improved optimization opportunities.
9928 Use of @option{-fwhole-program} is not needed when linker plugin is
9929 active (see @option{-fuse-linker-plugin}).
9930
9931 The current implementation of LTO makes no
9932 attempt to generate bytecode that is portable between different
9933 types of hosts. The bytecode files are versioned and there is a
9934 strict version check, so bytecode files generated in one version of
9935 GCC do not work with an older or newer version of GCC.
9936
9937 Link-time optimization does not work well with generation of debugging
9938 information on systems other than those using a combination of ELF and
9939 DWARF.
9940
9941 If you specify the optional @var{n}, the optimization and code
9942 generation done at link time is executed in parallel using @var{n}
9943 parallel jobs by utilizing an installed @command{make} program. The
9944 environment variable @env{MAKE} may be used to override the program
9945 used. The default value for @var{n} is 1.
9946
9947 You can also specify @option{-flto=jobserver} to use GNU make's
9948 job server mode to determine the number of parallel jobs. This
9949 is useful when the Makefile calling GCC is already executing in parallel.
9950 You must prepend a @samp{+} to the command recipe in the parent Makefile
9951 for this to work. This option likely only works if @env{MAKE} is
9952 GNU make.
9953
9954 @item -flto-partition=@var{alg}
9955 @opindex flto-partition
9956 Specify the partitioning algorithm used by the link-time optimizer.
9957 The value is either @samp{1to1} to specify a partitioning mirroring
9958 the original source files or @samp{balanced} to specify partitioning
9959 into equally sized chunks (whenever possible) or @samp{max} to create
9960 new partition for every symbol where possible. Specifying @samp{none}
9961 as an algorithm disables partitioning and streaming completely.
9962 The default value is @samp{balanced}. While @samp{1to1} can be used
9963 as an workaround for various code ordering issues, the @samp{max}
9964 partitioning is intended for internal testing only.
9965 The value @samp{one} specifies that exactly one partition should be
9966 used while the value @samp{none} bypasses partitioning and executes
9967 the link-time optimization step directly from the WPA phase.
9968
9969 @item -flto-odr-type-merging
9970 @opindex flto-odr-type-merging
9971 Enable streaming of mangled types names of C++ types and their unification
9972 at link time. This increases size of LTO object files, but enables
9973 diagnostics about One Definition Rule violations.
9974
9975 @item -flto-compression-level=@var{n}
9976 @opindex flto-compression-level
9977 This option specifies the level of compression used for intermediate
9978 language written to LTO object files, and is only meaningful in
9979 conjunction with LTO mode (@option{-flto}). Valid
9980 values are 0 (no compression) to 9 (maximum compression). Values
9981 outside this range are clamped to either 0 or 9. If the option is not
9982 given, a default balanced compression setting is used.
9983
9984 @item -fuse-linker-plugin
9985 @opindex fuse-linker-plugin
9986 Enables the use of a linker plugin during link-time optimization. This
9987 option relies on plugin support in the linker, which is available in gold
9988 or in GNU ld 2.21 or newer.
9989
9990 This option enables the extraction of object files with GIMPLE bytecode out
9991 of library archives. This improves the quality of optimization by exposing
9992 more code to the link-time optimizer. This information specifies what
9993 symbols can be accessed externally (by non-LTO object or during dynamic
9994 linking). Resulting code quality improvements on binaries (and shared
9995 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9996 See @option{-flto} for a description of the effect of this flag and how to
9997 use it.
9998
9999 This option is enabled by default when LTO support in GCC is enabled
10000 and GCC was configured for use with
10001 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10002
10003 @item -ffat-lto-objects
10004 @opindex ffat-lto-objects
10005 Fat LTO objects are object files that contain both the intermediate language
10006 and the object code. This makes them usable for both LTO linking and normal
10007 linking. This option is effective only when compiling with @option{-flto}
10008 and is ignored at link time.
10009
10010 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10011 requires the complete toolchain to be aware of LTO. It requires a linker with
10012 linker plugin support for basic functionality. Additionally,
10013 @command{nm}, @command{ar} and @command{ranlib}
10014 need to support linker plugins to allow a full-featured build environment
10015 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10016 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10017 to these tools. With non fat LTO makefiles need to be modified to use them.
10018
10019 Note that modern binutils provide plugin auto-load mechanism.
10020 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10021 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10022 @command{gcc-ranlib}).
10023
10024 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10025 support.
10026
10027 @item -fcompare-elim
10028 @opindex fcompare-elim
10029 After register allocation and post-register allocation instruction splitting,
10030 identify arithmetic instructions that compute processor flags similar to a
10031 comparison operation based on that arithmetic. If possible, eliminate the
10032 explicit comparison operation.
10033
10034 This pass only applies to certain targets that cannot explicitly represent
10035 the comparison operation before register allocation is complete.
10036
10037 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10038
10039 @item -fcprop-registers
10040 @opindex fcprop-registers
10041 After register allocation and post-register allocation instruction splitting,
10042 perform a copy-propagation pass to try to reduce scheduling dependencies
10043 and occasionally eliminate the copy.
10044
10045 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10046
10047 @item -fprofile-correction
10048 @opindex fprofile-correction
10049 Profiles collected using an instrumented binary for multi-threaded programs may
10050 be inconsistent due to missed counter updates. When this option is specified,
10051 GCC uses heuristics to correct or smooth out such inconsistencies. By
10052 default, GCC emits an error message when an inconsistent profile is detected.
10053
10054 @item -fprofile-use
10055 @itemx -fprofile-use=@var{path}
10056 @opindex fprofile-use
10057 Enable profile feedback-directed optimizations,
10058 and the following optimizations
10059 which are generally profitable only with profile feedback available:
10060 @option{-fbranch-probabilities}, @option{-fvpt},
10061 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
10062 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
10063
10064 Before you can use this option, you must first generate profiling information.
10065 @xref{Instrumentation Options}, for information about the
10066 @option{-fprofile-generate} option.
10067
10068 By default, GCC emits an error message if the feedback profiles do not
10069 match the source code. This error can be turned into a warning by using
10070 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10071 optimized code. Additionally, by default, GCC also emits a warning message if
10072 the feedback profiles do not exist (See @option{-Wmissing-profile}).
10073
10074 If @var{path} is specified, GCC looks at the @var{path} to find
10075 the profile feedback data files. See @option{-fprofile-dir}.
10076
10077 @item -fauto-profile
10078 @itemx -fauto-profile=@var{path}
10079 @opindex fauto-profile
10080 Enable sampling-based feedback-directed optimizations,
10081 and the following optimizations
10082 which are generally profitable only with profile feedback available:
10083 @option{-fbranch-probabilities}, @option{-fvpt},
10084 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
10085 @option{-ftree-vectorize},
10086 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
10087 @option{-fpredictive-commoning}, @option{-funswitch-loops},
10088 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
10089
10090 @var{path} is the name of a file containing AutoFDO profile information.
10091 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10092
10093 Producing an AutoFDO profile data file requires running your program
10094 with the @command{perf} utility on a supported GNU/Linux target system.
10095 For more information, see @uref{https://perf.wiki.kernel.org/}.
10096
10097 E.g.
10098 @smallexample
10099 perf record -e br_inst_retired:near_taken -b -o perf.data \
10100 -- your_program
10101 @end smallexample
10102
10103 Then use the @command{create_gcov} tool to convert the raw profile data
10104 to a format that can be used by GCC.@ You must also supply the
10105 unstripped binary for your program to this tool.
10106 See @uref{https://github.com/google/autofdo}.
10107
10108 E.g.
10109 @smallexample
10110 create_gcov --binary=your_program.unstripped --profile=perf.data \
10111 --gcov=profile.afdo
10112 @end smallexample
10113 @end table
10114
10115 The following options control compiler behavior regarding floating-point
10116 arithmetic. These options trade off between speed and
10117 correctness. All must be specifically enabled.
10118
10119 @table @gcctabopt
10120 @item -ffloat-store
10121 @opindex ffloat-store
10122 Do not store floating-point variables in registers, and inhibit other
10123 options that might change whether a floating-point value is taken from a
10124 register or memory.
10125
10126 @cindex floating-point precision
10127 This option prevents undesirable excess precision on machines such as
10128 the 68000 where the floating registers (of the 68881) keep more
10129 precision than a @code{double} is supposed to have. Similarly for the
10130 x86 architecture. For most programs, the excess precision does only
10131 good, but a few programs rely on the precise definition of IEEE floating
10132 point. Use @option{-ffloat-store} for such programs, after modifying
10133 them to store all pertinent intermediate computations into variables.
10134
10135 @item -fexcess-precision=@var{style}
10136 @opindex fexcess-precision
10137 This option allows further control over excess precision on machines
10138 where floating-point operations occur in a format with more precision or
10139 range than the IEEE standard and interchange floating-point types. By
10140 default, @option{-fexcess-precision=fast} is in effect; this means that
10141 operations may be carried out in a wider precision than the types specified
10142 in the source if that would result in faster code, and it is unpredictable
10143 when rounding to the types specified in the source code takes place.
10144 When compiling C, if @option{-fexcess-precision=standard} is specified then
10145 excess precision follows the rules specified in ISO C99; in particular,
10146 both casts and assignments cause values to be rounded to their
10147 semantic types (whereas @option{-ffloat-store} only affects
10148 assignments). This option is enabled by default for C if a strict
10149 conformance option such as @option{-std=c99} is used.
10150 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10151 regardless of whether a strict conformance option is used.
10152
10153 @opindex mfpmath
10154 @option{-fexcess-precision=standard} is not implemented for languages
10155 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10156 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10157 semantics apply without excess precision, and in the latter, rounding
10158 is unpredictable.
10159
10160 @item -ffast-math
10161 @opindex ffast-math
10162 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10163 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10164 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10165 @option{-fexcess-precision=fast}.
10166
10167 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10168
10169 This option is not turned on by any @option{-O} option besides
10170 @option{-Ofast} since it can result in incorrect output for programs
10171 that depend on an exact implementation of IEEE or ISO rules/specifications
10172 for math functions. It may, however, yield faster code for programs
10173 that do not require the guarantees of these specifications.
10174
10175 @item -fno-math-errno
10176 @opindex fno-math-errno
10177 @opindex fmath-errno
10178 Do not set @code{errno} after calling math functions that are executed
10179 with a single instruction, e.g., @code{sqrt}. A program that relies on
10180 IEEE exceptions for math error handling may want to use this flag
10181 for speed while maintaining IEEE arithmetic compatibility.
10182
10183 This option is not turned on by any @option{-O} option since
10184 it can result in incorrect output for programs that depend on
10185 an exact implementation of IEEE or ISO rules/specifications for
10186 math functions. It may, however, yield faster code for programs
10187 that do not require the guarantees of these specifications.
10188
10189 The default is @option{-fmath-errno}.
10190
10191 On Darwin systems, the math library never sets @code{errno}. There is
10192 therefore no reason for the compiler to consider the possibility that
10193 it might, and @option{-fno-math-errno} is the default.
10194
10195 @item -funsafe-math-optimizations
10196 @opindex funsafe-math-optimizations
10197
10198 Allow optimizations for floating-point arithmetic that (a) assume
10199 that arguments and results are valid and (b) may violate IEEE or
10200 ANSI standards. When used at link time, it may include libraries
10201 or startup files that change the default FPU control word or other
10202 similar optimizations.
10203
10204 This option is not turned on by any @option{-O} option since
10205 it can result in incorrect output for programs that depend on
10206 an exact implementation of IEEE or ISO rules/specifications for
10207 math functions. It may, however, yield faster code for programs
10208 that do not require the guarantees of these specifications.
10209 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10210 @option{-fassociative-math} and @option{-freciprocal-math}.
10211
10212 The default is @option{-fno-unsafe-math-optimizations}.
10213
10214 @item -fassociative-math
10215 @opindex fassociative-math
10216
10217 Allow re-association of operands in series of floating-point operations.
10218 This violates the ISO C and C++ language standard by possibly changing
10219 computation result. NOTE: re-ordering may change the sign of zero as
10220 well as ignore NaNs and inhibit or create underflow or overflow (and
10221 thus cannot be used on code that relies on rounding behavior like
10222 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10223 and thus may not be used when ordered comparisons are required.
10224 This option requires that both @option{-fno-signed-zeros} and
10225 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10226 much sense with @option{-frounding-math}. For Fortran the option
10227 is automatically enabled when both @option{-fno-signed-zeros} and
10228 @option{-fno-trapping-math} are in effect.
10229
10230 The default is @option{-fno-associative-math}.
10231
10232 @item -freciprocal-math
10233 @opindex freciprocal-math
10234
10235 Allow the reciprocal of a value to be used instead of dividing by
10236 the value if this enables optimizations. For example @code{x / y}
10237 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10238 is subject to common subexpression elimination. Note that this loses
10239 precision and increases the number of flops operating on the value.
10240
10241 The default is @option{-fno-reciprocal-math}.
10242
10243 @item -ffinite-math-only
10244 @opindex ffinite-math-only
10245 Allow optimizations for floating-point arithmetic that assume
10246 that arguments and results are not NaNs or +-Infs.
10247
10248 This option is not turned on by any @option{-O} option since
10249 it can result in incorrect output for programs that depend on
10250 an exact implementation of IEEE or ISO rules/specifications for
10251 math functions. It may, however, yield faster code for programs
10252 that do not require the guarantees of these specifications.
10253
10254 The default is @option{-fno-finite-math-only}.
10255
10256 @item -fno-signed-zeros
10257 @opindex fno-signed-zeros
10258 @opindex fsigned-zeros
10259 Allow optimizations for floating-point arithmetic that ignore the
10260 signedness of zero. IEEE arithmetic specifies the behavior of
10261 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10262 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10263 This option implies that the sign of a zero result isn't significant.
10264
10265 The default is @option{-fsigned-zeros}.
10266
10267 @item -fno-trapping-math
10268 @opindex fno-trapping-math
10269 @opindex ftrapping-math
10270 Compile code assuming that floating-point operations cannot generate
10271 user-visible traps. These traps include division by zero, overflow,
10272 underflow, inexact result and invalid operation. This option requires
10273 that @option{-fno-signaling-nans} be in effect. Setting this option may
10274 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10275
10276 This option should never be turned on by any @option{-O} option since
10277 it can result in incorrect output for programs that depend on
10278 an exact implementation of IEEE or ISO rules/specifications for
10279 math functions.
10280
10281 The default is @option{-ftrapping-math}.
10282
10283 @item -frounding-math
10284 @opindex frounding-math
10285 Disable transformations and optimizations that assume default floating-point
10286 rounding behavior. This is round-to-zero for all floating point
10287 to integer conversions, and round-to-nearest for all other arithmetic
10288 truncations. This option should be specified for programs that change
10289 the FP rounding mode dynamically, or that may be executed with a
10290 non-default rounding mode. This option disables constant folding of
10291 floating-point expressions at compile time (which may be affected by
10292 rounding mode) and arithmetic transformations that are unsafe in the
10293 presence of sign-dependent rounding modes.
10294
10295 The default is @option{-fno-rounding-math}.
10296
10297 This option is experimental and does not currently guarantee to
10298 disable all GCC optimizations that are affected by rounding mode.
10299 Future versions of GCC may provide finer control of this setting
10300 using C99's @code{FENV_ACCESS} pragma. This command-line option
10301 will be used to specify the default state for @code{FENV_ACCESS}.
10302
10303 @item -fsignaling-nans
10304 @opindex fsignaling-nans
10305 Compile code assuming that IEEE signaling NaNs may generate user-visible
10306 traps during floating-point operations. Setting this option disables
10307 optimizations that may change the number of exceptions visible with
10308 signaling NaNs. This option implies @option{-ftrapping-math}.
10309
10310 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10311 be defined.
10312
10313 The default is @option{-fno-signaling-nans}.
10314
10315 This option is experimental and does not currently guarantee to
10316 disable all GCC optimizations that affect signaling NaN behavior.
10317
10318 @item -fno-fp-int-builtin-inexact
10319 @opindex fno-fp-int-builtin-inexact
10320 @opindex ffp-int-builtin-inexact
10321 Do not allow the built-in functions @code{ceil}, @code{floor},
10322 @code{round} and @code{trunc}, and their @code{float} and @code{long
10323 double} variants, to generate code that raises the ``inexact''
10324 floating-point exception for noninteger arguments. ISO C99 and C11
10325 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10326 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10327 functions to do so.
10328
10329 The default is @option{-ffp-int-builtin-inexact}, allowing the
10330 exception to be raised. This option does nothing unless
10331 @option{-ftrapping-math} is in effect.
10332
10333 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10334 generate a call to a library function then the ``inexact'' exception
10335 may be raised if the library implementation does not follow TS 18661.
10336
10337 @item -fsingle-precision-constant
10338 @opindex fsingle-precision-constant
10339 Treat floating-point constants as single precision instead of
10340 implicitly converting them to double-precision constants.
10341
10342 @item -fcx-limited-range
10343 @opindex fcx-limited-range
10344 When enabled, this option states that a range reduction step is not
10345 needed when performing complex division. Also, there is no checking
10346 whether the result of a complex multiplication or division is @code{NaN
10347 + I*NaN}, with an attempt to rescue the situation in that case. The
10348 default is @option{-fno-cx-limited-range}, but is enabled by
10349 @option{-ffast-math}.
10350
10351 This option controls the default setting of the ISO C99
10352 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10353 all languages.
10354
10355 @item -fcx-fortran-rules
10356 @opindex fcx-fortran-rules
10357 Complex multiplication and division follow Fortran rules. Range
10358 reduction is done as part of complex division, but there is no checking
10359 whether the result of a complex multiplication or division is @code{NaN
10360 + I*NaN}, with an attempt to rescue the situation in that case.
10361
10362 The default is @option{-fno-cx-fortran-rules}.
10363
10364 @end table
10365
10366 The following options control optimizations that may improve
10367 performance, but are not enabled by any @option{-O} options. This
10368 section includes experimental options that may produce broken code.
10369
10370 @table @gcctabopt
10371 @item -fbranch-probabilities
10372 @opindex fbranch-probabilities
10373 After running a program compiled with @option{-fprofile-arcs}
10374 (@pxref{Instrumentation Options}),
10375 you can compile it a second time using
10376 @option{-fbranch-probabilities}, to improve optimizations based on
10377 the number of times each branch was taken. When a program
10378 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10379 counts to a file called @file{@var{sourcename}.gcda} for each source
10380 file. The information in this data file is very dependent on the
10381 structure of the generated code, so you must use the same source code
10382 and the same optimization options for both compilations.
10383
10384 With @option{-fbranch-probabilities}, GCC puts a
10385 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10386 These can be used to improve optimization. Currently, they are only
10387 used in one place: in @file{reorg.c}, instead of guessing which path a
10388 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10389 exactly determine which path is taken more often.
10390
10391 @item -fprofile-values
10392 @opindex fprofile-values
10393 If combined with @option{-fprofile-arcs}, it adds code so that some
10394 data about values of expressions in the program is gathered.
10395
10396 With @option{-fbranch-probabilities}, it reads back the data gathered
10397 from profiling values of expressions for usage in optimizations.
10398
10399 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
10400
10401 @item -fprofile-reorder-functions
10402 @opindex fprofile-reorder-functions
10403 Function reordering based on profile instrumentation collects
10404 first time of execution of a function and orders these functions
10405 in ascending order.
10406
10407 Enabled with @option{-fprofile-use}.
10408
10409 @item -fvpt
10410 @opindex fvpt
10411 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10412 to add code to gather information about values of expressions.
10413
10414 With @option{-fbranch-probabilities}, it reads back the data gathered
10415 and actually performs the optimizations based on them.
10416 Currently the optimizations include specialization of division operations
10417 using the knowledge about the value of the denominator.
10418
10419 @item -frename-registers
10420 @opindex frename-registers
10421 Attempt to avoid false dependencies in scheduled code by making use
10422 of registers left over after register allocation. This optimization
10423 most benefits processors with lots of registers. Depending on the
10424 debug information format adopted by the target, however, it can
10425 make debugging impossible, since variables no longer stay in
10426 a ``home register''.
10427
10428 Enabled by default with @option{-funroll-loops}.
10429
10430 @item -fschedule-fusion
10431 @opindex fschedule-fusion
10432 Performs a target dependent pass over the instruction stream to schedule
10433 instructions of same type together because target machine can execute them
10434 more efficiently if they are adjacent to each other in the instruction flow.
10435
10436 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10437
10438 @item -ftracer
10439 @opindex ftracer
10440 Perform tail duplication to enlarge superblock size. This transformation
10441 simplifies the control flow of the function allowing other optimizations to do
10442 a better job.
10443
10444 Enabled with @option{-fprofile-use}.
10445
10446 @item -funroll-loops
10447 @opindex funroll-loops
10448 Unroll loops whose number of iterations can be determined at compile time or
10449 upon entry to the loop. @option{-funroll-loops} implies
10450 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10451 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10452 a small constant number of iterations). This option makes code larger, and may
10453 or may not make it run faster.
10454
10455 Enabled with @option{-fprofile-use}.
10456
10457 @item -funroll-all-loops
10458 @opindex funroll-all-loops
10459 Unroll all loops, even if their number of iterations is uncertain when
10460 the loop is entered. This usually makes programs run more slowly.
10461 @option{-funroll-all-loops} implies the same options as
10462 @option{-funroll-loops}.
10463
10464 @item -fpeel-loops
10465 @opindex fpeel-loops
10466 Peels loops for which there is enough information that they do not
10467 roll much (from profile feedback or static analysis). It also turns on
10468 complete loop peeling (i.e.@: complete removal of loops with small constant
10469 number of iterations).
10470
10471 Enabled with @option{-O3} and/or @option{-fprofile-use}.
10472
10473 @item -fmove-loop-invariants
10474 @opindex fmove-loop-invariants
10475 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10476 at level @option{-O1}
10477
10478 @item -fsplit-loops
10479 @opindex fsplit-loops
10480 Split a loop into two if it contains a condition that's always true
10481 for one side of the iteration space and false for the other.
10482
10483 @item -funswitch-loops
10484 @opindex funswitch-loops
10485 Move branches with loop invariant conditions out of the loop, with duplicates
10486 of the loop on both branches (modified according to result of the condition).
10487
10488 @item -ffunction-sections
10489 @itemx -fdata-sections
10490 @opindex ffunction-sections
10491 @opindex fdata-sections
10492 Place each function or data item into its own section in the output
10493 file if the target supports arbitrary sections. The name of the
10494 function or the name of the data item determines the section's name
10495 in the output file.
10496
10497 Use these options on systems where the linker can perform optimizations to
10498 improve locality of reference in the instruction space. Most systems using the
10499 ELF object format have linkers with such optimizations. On AIX, the linker
10500 rearranges sections (CSECTs) based on the call graph. The performance impact
10501 varies.
10502
10503 Together with a linker garbage collection (linker @option{--gc-sections}
10504 option) these options may lead to smaller statically-linked executables (after
10505 stripping).
10506
10507 On ELF/DWARF systems these options do not degenerate the quality of the debug
10508 information. There could be issues with other object files/debug info formats.
10509
10510 Only use these options when there are significant benefits from doing so. When
10511 you specify these options, the assembler and linker create larger object and
10512 executable files and are also slower. These options affect code generation.
10513 They prevent optimizations by the compiler and assembler using relative
10514 locations inside a translation unit since the locations are unknown until
10515 link time. An example of such an optimization is relaxing calls to short call
10516 instructions.
10517
10518 @item -fbranch-target-load-optimize
10519 @opindex fbranch-target-load-optimize
10520 Perform branch target register load optimization before prologue / epilogue
10521 threading.
10522 The use of target registers can typically be exposed only during reload,
10523 thus hoisting loads out of loops and doing inter-block scheduling needs
10524 a separate optimization pass.
10525
10526 @item -fbranch-target-load-optimize2
10527 @opindex fbranch-target-load-optimize2
10528 Perform branch target register load optimization after prologue / epilogue
10529 threading.
10530
10531 @item -fbtr-bb-exclusive
10532 @opindex fbtr-bb-exclusive
10533 When performing branch target register load optimization, don't reuse
10534 branch target registers within any basic block.
10535
10536 @item -fstdarg-opt
10537 @opindex fstdarg-opt
10538 Optimize the prologue of variadic argument functions with respect to usage of
10539 those arguments.
10540
10541 @item -fsection-anchors
10542 @opindex fsection-anchors
10543 Try to reduce the number of symbolic address calculations by using
10544 shared ``anchor'' symbols to address nearby objects. This transformation
10545 can help to reduce the number of GOT entries and GOT accesses on some
10546 targets.
10547
10548 For example, the implementation of the following function @code{foo}:
10549
10550 @smallexample
10551 static int a, b, c;
10552 int foo (void) @{ return a + b + c; @}
10553 @end smallexample
10554
10555 @noindent
10556 usually calculates the addresses of all three variables, but if you
10557 compile it with @option{-fsection-anchors}, it accesses the variables
10558 from a common anchor point instead. The effect is similar to the
10559 following pseudocode (which isn't valid C):
10560
10561 @smallexample
10562 int foo (void)
10563 @{
10564 register int *xr = &x;
10565 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10566 @}
10567 @end smallexample
10568
10569 Not all targets support this option.
10570
10571 @item --param @var{name}=@var{value}
10572 @opindex param
10573 In some places, GCC uses various constants to control the amount of
10574 optimization that is done. For example, GCC does not inline functions
10575 that contain more than a certain number of instructions. You can
10576 control some of these constants on the command line using the
10577 @option{--param} option.
10578
10579 The names of specific parameters, and the meaning of the values, are
10580 tied to the internals of the compiler, and are subject to change
10581 without notice in future releases.
10582
10583 In order to get minimal, maximal and default value of a parameter,
10584 one can use @option{--help=param -Q} options.
10585
10586 In each case, the @var{value} is an integer. The allowable choices for
10587 @var{name} are:
10588
10589 @table @gcctabopt
10590 @item predictable-branch-outcome
10591 When branch is predicted to be taken with probability lower than this threshold
10592 (in percent), then it is considered well predictable.
10593
10594 @item max-rtl-if-conversion-insns
10595 RTL if-conversion tries to remove conditional branches around a block and
10596 replace them with conditionally executed instructions. This parameter
10597 gives the maximum number of instructions in a block which should be
10598 considered for if-conversion. The compiler will
10599 also use other heuristics to decide whether if-conversion is likely to be
10600 profitable.
10601
10602 @item max-rtl-if-conversion-predictable-cost
10603 @itemx max-rtl-if-conversion-unpredictable-cost
10604 RTL if-conversion will try to remove conditional branches around a block
10605 and replace them with conditionally executed instructions. These parameters
10606 give the maximum permissible cost for the sequence that would be generated
10607 by if-conversion depending on whether the branch is statically determined
10608 to be predictable or not. The units for this parameter are the same as
10609 those for the GCC internal seq_cost metric. The compiler will try to
10610 provide a reasonable default for this parameter using the BRANCH_COST
10611 target macro.
10612
10613 @item max-crossjump-edges
10614 The maximum number of incoming edges to consider for cross-jumping.
10615 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10616 the number of edges incoming to each block. Increasing values mean
10617 more aggressive optimization, making the compilation time increase with
10618 probably small improvement in executable size.
10619
10620 @item min-crossjump-insns
10621 The minimum number of instructions that must be matched at the end
10622 of two blocks before cross-jumping is performed on them. This
10623 value is ignored in the case where all instructions in the block being
10624 cross-jumped from are matched.
10625
10626 @item max-grow-copy-bb-insns
10627 The maximum code size expansion factor when copying basic blocks
10628 instead of jumping. The expansion is relative to a jump instruction.
10629
10630 @item max-goto-duplication-insns
10631 The maximum number of instructions to duplicate to a block that jumps
10632 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10633 passes, GCC factors computed gotos early in the compilation process,
10634 and unfactors them as late as possible. Only computed jumps at the
10635 end of a basic blocks with no more than max-goto-duplication-insns are
10636 unfactored.
10637
10638 @item max-delay-slot-insn-search
10639 The maximum number of instructions to consider when looking for an
10640 instruction to fill a delay slot. If more than this arbitrary number of
10641 instructions are searched, the time savings from filling the delay slot
10642 are minimal, so stop searching. Increasing values mean more
10643 aggressive optimization, making the compilation time increase with probably
10644 small improvement in execution time.
10645
10646 @item max-delay-slot-live-search
10647 When trying to fill delay slots, the maximum number of instructions to
10648 consider when searching for a block with valid live register
10649 information. Increasing this arbitrarily chosen value means more
10650 aggressive optimization, increasing the compilation time. This parameter
10651 should be removed when the delay slot code is rewritten to maintain the
10652 control-flow graph.
10653
10654 @item max-gcse-memory
10655 The approximate maximum amount of memory that can be allocated in
10656 order to perform the global common subexpression elimination
10657 optimization. If more memory than specified is required, the
10658 optimization is not done.
10659
10660 @item max-gcse-insertion-ratio
10661 If the ratio of expression insertions to deletions is larger than this value
10662 for any expression, then RTL PRE inserts or removes the expression and thus
10663 leaves partially redundant computations in the instruction stream.
10664
10665 @item max-pending-list-length
10666 The maximum number of pending dependencies scheduling allows
10667 before flushing the current state and starting over. Large functions
10668 with few branches or calls can create excessively large lists which
10669 needlessly consume memory and resources.
10670
10671 @item max-modulo-backtrack-attempts
10672 The maximum number of backtrack attempts the scheduler should make
10673 when modulo scheduling a loop. Larger values can exponentially increase
10674 compilation time.
10675
10676 @item max-inline-insns-single
10677 Several parameters control the tree inliner used in GCC@.
10678 This number sets the maximum number of instructions (counted in GCC's
10679 internal representation) in a single function that the tree inliner
10680 considers for inlining. This only affects functions declared
10681 inline and methods implemented in a class declaration (C++).
10682
10683 @item max-inline-insns-auto
10684 When you use @option{-finline-functions} (included in @option{-O3}),
10685 a lot of functions that would otherwise not be considered for inlining
10686 by the compiler are investigated. To those functions, a different
10687 (more restrictive) limit compared to functions declared inline can
10688 be applied.
10689
10690 @item inline-min-speedup
10691 When estimated performance improvement of caller + callee runtime exceeds this
10692 threshold (in percent), the function can be inlined regardless of the limit on
10693 @option{--param max-inline-insns-single} and @option{--param
10694 max-inline-insns-auto}.
10695
10696 @item large-function-insns
10697 The limit specifying really large functions. For functions larger than this
10698 limit after inlining, inlining is constrained by
10699 @option{--param large-function-growth}. This parameter is useful primarily
10700 to avoid extreme compilation time caused by non-linear algorithms used by the
10701 back end.
10702
10703 @item large-function-growth
10704 Specifies maximal growth of large function caused by inlining in percents.
10705 For example, parameter value 100 limits large function growth to 2.0 times
10706 the original size.
10707
10708 @item large-unit-insns
10709 The limit specifying large translation unit. Growth caused by inlining of
10710 units larger than this limit is limited by @option{--param inline-unit-growth}.
10711 For small units this might be too tight.
10712 For example, consider a unit consisting of function A
10713 that is inline and B that just calls A three times. If B is small relative to
10714 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10715 large units consisting of small inlineable functions, however, the overall unit
10716 growth limit is needed to avoid exponential explosion of code size. Thus for
10717 smaller units, the size is increased to @option{--param large-unit-insns}
10718 before applying @option{--param inline-unit-growth}.
10719
10720 @item inline-unit-growth
10721 Specifies maximal overall growth of the compilation unit caused by inlining.
10722 For example, parameter value 20 limits unit growth to 1.2 times the original
10723 size. Cold functions (either marked cold via an attribute or by profile
10724 feedback) are not accounted into the unit size.
10725
10726 @item ipcp-unit-growth
10727 Specifies maximal overall growth of the compilation unit caused by
10728 interprocedural constant propagation. For example, parameter value 10 limits
10729 unit growth to 1.1 times the original size.
10730
10731 @item large-stack-frame
10732 The limit specifying large stack frames. While inlining the algorithm is trying
10733 to not grow past this limit too much.
10734
10735 @item large-stack-frame-growth
10736 Specifies maximal growth of large stack frames caused by inlining in percents.
10737 For example, parameter value 1000 limits large stack frame growth to 11 times
10738 the original size.
10739
10740 @item max-inline-insns-recursive
10741 @itemx max-inline-insns-recursive-auto
10742 Specifies the maximum number of instructions an out-of-line copy of a
10743 self-recursive inline
10744 function can grow into by performing recursive inlining.
10745
10746 @option{--param max-inline-insns-recursive} applies to functions
10747 declared inline.
10748 For functions not declared inline, recursive inlining
10749 happens only when @option{-finline-functions} (included in @option{-O3}) is
10750 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
10751
10752 @item max-inline-recursive-depth
10753 @itemx max-inline-recursive-depth-auto
10754 Specifies the maximum recursion depth used for recursive inlining.
10755
10756 @option{--param max-inline-recursive-depth} applies to functions
10757 declared inline. For functions not declared inline, recursive inlining
10758 happens only when @option{-finline-functions} (included in @option{-O3}) is
10759 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
10760
10761 @item min-inline-recursive-probability
10762 Recursive inlining is profitable only for function having deep recursion
10763 in average and can hurt for function having little recursion depth by
10764 increasing the prologue size or complexity of function body to other
10765 optimizers.
10766
10767 When profile feedback is available (see @option{-fprofile-generate}) the actual
10768 recursion depth can be guessed from the probability that function recurses
10769 via a given call expression. This parameter limits inlining only to call
10770 expressions whose probability exceeds the given threshold (in percents).
10771
10772 @item early-inlining-insns
10773 Specify growth that the early inliner can make. In effect it increases
10774 the amount of inlining for code having a large abstraction penalty.
10775
10776 @item max-early-inliner-iterations
10777 Limit of iterations of the early inliner. This basically bounds
10778 the number of nested indirect calls the early inliner can resolve.
10779 Deeper chains are still handled by late inlining.
10780
10781 @item comdat-sharing-probability
10782 Probability (in percent) that C++ inline function with comdat visibility
10783 are shared across multiple compilation units.
10784
10785 @item profile-func-internal-id
10786 A parameter to control whether to use function internal id in profile
10787 database lookup. If the value is 0, the compiler uses an id that
10788 is based on function assembler name and filename, which makes old profile
10789 data more tolerant to source changes such as function reordering etc.
10790
10791 @item min-vect-loop-bound
10792 The minimum number of iterations under which loops are not vectorized
10793 when @option{-ftree-vectorize} is used. The number of iterations after
10794 vectorization needs to be greater than the value specified by this option
10795 to allow vectorization.
10796
10797 @item gcse-cost-distance-ratio
10798 Scaling factor in calculation of maximum distance an expression
10799 can be moved by GCSE optimizations. This is currently supported only in the
10800 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
10801 is with simple expressions, i.e., the expressions that have cost
10802 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
10803 hoisting of simple expressions.
10804
10805 @item gcse-unrestricted-cost
10806 Cost, roughly measured as the cost of a single typical machine
10807 instruction, at which GCSE optimizations do not constrain
10808 the distance an expression can travel. This is currently
10809 supported only in the code hoisting pass. The lesser the cost,
10810 the more aggressive code hoisting is. Specifying 0
10811 allows all expressions to travel unrestricted distances.
10812
10813 @item max-hoist-depth
10814 The depth of search in the dominator tree for expressions to hoist.
10815 This is used to avoid quadratic behavior in hoisting algorithm.
10816 The value of 0 does not limit on the search, but may slow down compilation
10817 of huge functions.
10818
10819 @item max-tail-merge-comparisons
10820 The maximum amount of similar bbs to compare a bb with. This is used to
10821 avoid quadratic behavior in tree tail merging.
10822
10823 @item max-tail-merge-iterations
10824 The maximum amount of iterations of the pass over the function. This is used to
10825 limit compilation time in tree tail merging.
10826
10827 @item store-merging-allow-unaligned
10828 Allow the store merging pass to introduce unaligned stores if it is legal to
10829 do so.
10830
10831 @item max-stores-to-merge
10832 The maximum number of stores to attempt to merge into wider stores in the store
10833 merging pass.
10834
10835 @item max-unrolled-insns
10836 The maximum number of instructions that a loop may have to be unrolled.
10837 If a loop is unrolled, this parameter also determines how many times
10838 the loop code is unrolled.
10839
10840 @item max-average-unrolled-insns
10841 The maximum number of instructions biased by probabilities of their execution
10842 that a loop may have to be unrolled. If a loop is unrolled,
10843 this parameter also determines how many times the loop code is unrolled.
10844
10845 @item max-unroll-times
10846 The maximum number of unrollings of a single loop.
10847
10848 @item max-peeled-insns
10849 The maximum number of instructions that a loop may have to be peeled.
10850 If a loop is peeled, this parameter also determines how many times
10851 the loop code is peeled.
10852
10853 @item max-peel-times
10854 The maximum number of peelings of a single loop.
10855
10856 @item max-peel-branches
10857 The maximum number of branches on the hot path through the peeled sequence.
10858
10859 @item max-completely-peeled-insns
10860 The maximum number of insns of a completely peeled loop.
10861
10862 @item max-completely-peel-times
10863 The maximum number of iterations of a loop to be suitable for complete peeling.
10864
10865 @item max-completely-peel-loop-nest-depth
10866 The maximum depth of a loop nest suitable for complete peeling.
10867
10868 @item max-unswitch-insns
10869 The maximum number of insns of an unswitched loop.
10870
10871 @item max-unswitch-level
10872 The maximum number of branches unswitched in a single loop.
10873
10874 @item lim-expensive
10875 The minimum cost of an expensive expression in the loop invariant motion.
10876
10877 @item iv-consider-all-candidates-bound
10878 Bound on number of candidates for induction variables, below which
10879 all candidates are considered for each use in induction variable
10880 optimizations. If there are more candidates than this,
10881 only the most relevant ones are considered to avoid quadratic time complexity.
10882
10883 @item iv-max-considered-uses
10884 The induction variable optimizations give up on loops that contain more
10885 induction variable uses.
10886
10887 @item iv-always-prune-cand-set-bound
10888 If the number of candidates in the set is smaller than this value,
10889 always try to remove unnecessary ivs from the set
10890 when adding a new one.
10891
10892 @item avg-loop-niter
10893 Average number of iterations of a loop.
10894
10895 @item dse-max-object-size
10896 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
10897 Larger values may result in larger compilation times.
10898
10899 @item dse-max-alias-queries-per-store
10900 Maximum number of queries into the alias oracle per store.
10901 Larger values result in larger compilation times and may result in more
10902 removed dead stores.
10903
10904 @item scev-max-expr-size
10905 Bound on size of expressions used in the scalar evolutions analyzer.
10906 Large expressions slow the analyzer.
10907
10908 @item scev-max-expr-complexity
10909 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10910 Complex expressions slow the analyzer.
10911
10912 @item max-tree-if-conversion-phi-args
10913 Maximum number of arguments in a PHI supported by TREE if conversion
10914 unless the loop is marked with simd pragma.
10915
10916 @item vect-max-version-for-alignment-checks
10917 The maximum number of run-time checks that can be performed when
10918 doing loop versioning for alignment in the vectorizer.
10919
10920 @item vect-max-version-for-alias-checks
10921 The maximum number of run-time checks that can be performed when
10922 doing loop versioning for alias in the vectorizer.
10923
10924 @item vect-max-peeling-for-alignment
10925 The maximum number of loop peels to enhance access alignment
10926 for vectorizer. Value -1 means no limit.
10927
10928 @item max-iterations-to-track
10929 The maximum number of iterations of a loop the brute-force algorithm
10930 for analysis of the number of iterations of the loop tries to evaluate.
10931
10932 @item hot-bb-count-ws-permille
10933 A basic block profile count is considered hot if it contributes to
10934 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
10935
10936 @item hot-bb-frequency-fraction
10937 Select fraction of the entry block frequency of executions of basic block in
10938 function given basic block needs to have to be considered hot.
10939
10940 @item max-predicted-iterations
10941 The maximum number of loop iterations we predict statically. This is useful
10942 in cases where a function contains a single loop with known bound and
10943 another loop with unknown bound.
10944 The known number of iterations is predicted correctly, while
10945 the unknown number of iterations average to roughly 10. This means that the
10946 loop without bounds appears artificially cold relative to the other one.
10947
10948 @item builtin-expect-probability
10949 Control the probability of the expression having the specified value. This
10950 parameter takes a percentage (i.e.@: 0 ... 100) as input.
10951
10952 @item builtin-string-cmp-inline-length
10953 The maximum length of a constant string for a builtin string cmp call
10954 eligible for inlining.
10955
10956 @item align-threshold
10957
10958 Select fraction of the maximal frequency of executions of a basic block in
10959 a function to align the basic block.
10960
10961 @item align-loop-iterations
10962
10963 A loop expected to iterate at least the selected number of iterations is
10964 aligned.
10965
10966 @item tracer-dynamic-coverage
10967 @itemx tracer-dynamic-coverage-feedback
10968
10969 This value is used to limit superblock formation once the given percentage of
10970 executed instructions is covered. This limits unnecessary code size
10971 expansion.
10972
10973 The @option{tracer-dynamic-coverage-feedback} parameter
10974 is used only when profile
10975 feedback is available. The real profiles (as opposed to statically estimated
10976 ones) are much less balanced allowing the threshold to be larger value.
10977
10978 @item tracer-max-code-growth
10979 Stop tail duplication once code growth has reached given percentage. This is
10980 a rather artificial limit, as most of the duplicates are eliminated later in
10981 cross jumping, so it may be set to much higher values than is the desired code
10982 growth.
10983
10984 @item tracer-min-branch-ratio
10985
10986 Stop reverse growth when the reverse probability of best edge is less than this
10987 threshold (in percent).
10988
10989 @item tracer-min-branch-probability
10990 @itemx tracer-min-branch-probability-feedback
10991
10992 Stop forward growth if the best edge has probability lower than this
10993 threshold.
10994
10995 Similarly to @option{tracer-dynamic-coverage} two parameters are
10996 provided. @option{tracer-min-branch-probability-feedback} is used for
10997 compilation with profile feedback and @option{tracer-min-branch-probability}
10998 compilation without. The value for compilation with profile feedback
10999 needs to be more conservative (higher) in order to make tracer
11000 effective.
11001
11002 @item stack-clash-protection-guard-size
11003 Specify the size of the operating system provided stack guard as
11004 2 raised to @var{num} bytes. Higher values may reduce the
11005 number of explicit probes, but a value larger than the operating system
11006 provided guard will leave code vulnerable to stack clash style attacks.
11007
11008 @item stack-clash-protection-probe-interval
11009 Stack clash protection involves probing stack space as it is allocated. This
11010 param controls the maximum distance between probes into the stack as 2 raised
11011 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11012 larger than the operating system provided guard will leave code vulnerable to
11013 stack clash style attacks.
11014
11015 @item max-cse-path-length
11016
11017 The maximum number of basic blocks on path that CSE considers.
11018
11019 @item max-cse-insns
11020 The maximum number of instructions CSE processes before flushing.
11021
11022 @item ggc-min-expand
11023
11024 GCC uses a garbage collector to manage its own memory allocation. This
11025 parameter specifies the minimum percentage by which the garbage
11026 collector's heap should be allowed to expand between collections.
11027 Tuning this may improve compilation speed; it has no effect on code
11028 generation.
11029
11030 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11031 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11032 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11033 GCC is not able to calculate RAM on a particular platform, the lower
11034 bound of 30% is used. Setting this parameter and
11035 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11036 every opportunity. This is extremely slow, but can be useful for
11037 debugging.
11038
11039 @item ggc-min-heapsize
11040
11041 Minimum size of the garbage collector's heap before it begins bothering
11042 to collect garbage. The first collection occurs after the heap expands
11043 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11044 tuning this may improve compilation speed, and has no effect on code
11045 generation.
11046
11047 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11048 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11049 with a lower bound of 4096 (four megabytes) and an upper bound of
11050 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11051 particular platform, the lower bound is used. Setting this parameter
11052 very large effectively disables garbage collection. Setting this
11053 parameter and @option{ggc-min-expand} to zero causes a full collection
11054 to occur at every opportunity.
11055
11056 @item max-reload-search-insns
11057 The maximum number of instruction reload should look backward for equivalent
11058 register. Increasing values mean more aggressive optimization, making the
11059 compilation time increase with probably slightly better performance.
11060
11061 @item max-cselib-memory-locations
11062 The maximum number of memory locations cselib should take into account.
11063 Increasing values mean more aggressive optimization, making the compilation time
11064 increase with probably slightly better performance.
11065
11066 @item max-sched-ready-insns
11067 The maximum number of instructions ready to be issued the scheduler should
11068 consider at any given time during the first scheduling pass. Increasing
11069 values mean more thorough searches, making the compilation time increase
11070 with probably little benefit.
11071
11072 @item max-sched-region-blocks
11073 The maximum number of blocks in a region to be considered for
11074 interblock scheduling.
11075
11076 @item max-pipeline-region-blocks
11077 The maximum number of blocks in a region to be considered for
11078 pipelining in the selective scheduler.
11079
11080 @item max-sched-region-insns
11081 The maximum number of insns in a region to be considered for
11082 interblock scheduling.
11083
11084 @item max-pipeline-region-insns
11085 The maximum number of insns in a region to be considered for
11086 pipelining in the selective scheduler.
11087
11088 @item min-spec-prob
11089 The minimum probability (in percents) of reaching a source block
11090 for interblock speculative scheduling.
11091
11092 @item max-sched-extend-regions-iters
11093 The maximum number of iterations through CFG to extend regions.
11094 A value of 0 disables region extensions.
11095
11096 @item max-sched-insn-conflict-delay
11097 The maximum conflict delay for an insn to be considered for speculative motion.
11098
11099 @item sched-spec-prob-cutoff
11100 The minimal probability of speculation success (in percents), so that
11101 speculative insns are scheduled.
11102
11103 @item sched-state-edge-prob-cutoff
11104 The minimum probability an edge must have for the scheduler to save its
11105 state across it.
11106
11107 @item sched-mem-true-dep-cost
11108 Minimal distance (in CPU cycles) between store and load targeting same
11109 memory locations.
11110
11111 @item selsched-max-lookahead
11112 The maximum size of the lookahead window of selective scheduling. It is a
11113 depth of search for available instructions.
11114
11115 @item selsched-max-sched-times
11116 The maximum number of times that an instruction is scheduled during
11117 selective scheduling. This is the limit on the number of iterations
11118 through which the instruction may be pipelined.
11119
11120 @item selsched-insns-to-rename
11121 The maximum number of best instructions in the ready list that are considered
11122 for renaming in the selective scheduler.
11123
11124 @item sms-min-sc
11125 The minimum value of stage count that swing modulo scheduler
11126 generates.
11127
11128 @item max-last-value-rtl
11129 The maximum size measured as number of RTLs that can be recorded in an expression
11130 in combiner for a pseudo register as last known value of that register.
11131
11132 @item max-combine-insns
11133 The maximum number of instructions the RTL combiner tries to combine.
11134
11135 @item integer-share-limit
11136 Small integer constants can use a shared data structure, reducing the
11137 compiler's memory usage and increasing its speed. This sets the maximum
11138 value of a shared integer constant.
11139
11140 @item ssp-buffer-size
11141 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11142 protection when @option{-fstack-protection} is used.
11143
11144 @item min-size-for-stack-sharing
11145 The minimum size of variables taking part in stack slot sharing when not
11146 optimizing.
11147
11148 @item max-jump-thread-duplication-stmts
11149 Maximum number of statements allowed in a block that needs to be
11150 duplicated when threading jumps.
11151
11152 @item max-fields-for-field-sensitive
11153 Maximum number of fields in a structure treated in
11154 a field sensitive manner during pointer analysis.
11155
11156 @item prefetch-latency
11157 Estimate on average number of instructions that are executed before
11158 prefetch finishes. The distance prefetched ahead is proportional
11159 to this constant. Increasing this number may also lead to less
11160 streams being prefetched (see @option{simultaneous-prefetches}).
11161
11162 @item simultaneous-prefetches
11163 Maximum number of prefetches that can run at the same time.
11164
11165 @item l1-cache-line-size
11166 The size of cache line in L1 cache, in bytes.
11167
11168 @item l1-cache-size
11169 The size of L1 cache, in kilobytes.
11170
11171 @item l2-cache-size
11172 The size of L2 cache, in kilobytes.
11173
11174 @item prefetch-dynamic-strides
11175 Whether the loop array prefetch pass should issue software prefetch hints
11176 for strides that are non-constant. In some cases this may be
11177 beneficial, though the fact the stride is non-constant may make it
11178 hard to predict when there is clear benefit to issuing these hints.
11179
11180 Set to 1 if the prefetch hints should be issued for non-constant
11181 strides. Set to 0 if prefetch hints should be issued only for strides that
11182 are known to be constant and below @option{prefetch-minimum-stride}.
11183
11184 @item prefetch-minimum-stride
11185 Minimum constant stride, in bytes, to start using prefetch hints for. If
11186 the stride is less than this threshold, prefetch hints will not be issued.
11187
11188 This setting is useful for processors that have hardware prefetchers, in
11189 which case there may be conflicts between the hardware prefetchers and
11190 the software prefetchers. If the hardware prefetchers have a maximum
11191 stride they can handle, it should be used here to improve the use of
11192 software prefetchers.
11193
11194 A value of -1 means we don't have a threshold and therefore
11195 prefetch hints can be issued for any constant stride.
11196
11197 This setting is only useful for strides that are known and constant.
11198
11199 @item loop-interchange-max-num-stmts
11200 The maximum number of stmts in a loop to be interchanged.
11201
11202 @item loop-interchange-stride-ratio
11203 The minimum ratio between stride of two loops for interchange to be profitable.
11204
11205 @item min-insn-to-prefetch-ratio
11206 The minimum ratio between the number of instructions and the
11207 number of prefetches to enable prefetching in a loop.
11208
11209 @item prefetch-min-insn-to-mem-ratio
11210 The minimum ratio between the number of instructions and the
11211 number of memory references to enable prefetching in a loop.
11212
11213 @item use-canonical-types
11214 Whether the compiler should use the ``canonical'' type system.
11215 Should always be 1, which uses a more efficient internal
11216 mechanism for comparing types in C++ and Objective-C++. However, if
11217 bugs in the canonical type system are causing compilation failures,
11218 set this value to 0 to disable canonical types.
11219
11220 @item switch-conversion-max-branch-ratio
11221 Switch initialization conversion refuses to create arrays that are
11222 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11223 branches in the switch.
11224
11225 @item max-partial-antic-length
11226 Maximum length of the partial antic set computed during the tree
11227 partial redundancy elimination optimization (@option{-ftree-pre}) when
11228 optimizing at @option{-O3} and above. For some sorts of source code
11229 the enhanced partial redundancy elimination optimization can run away,
11230 consuming all of the memory available on the host machine. This
11231 parameter sets a limit on the length of the sets that are computed,
11232 which prevents the runaway behavior. Setting a value of 0 for
11233 this parameter allows an unlimited set length.
11234
11235 @item rpo-vn-max-loop-depth
11236 Maximum loop depth that is value-numbered optimistically.
11237 When the limit hits the innermost
11238 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11239 loop nest are value-numbered optimistically and the remaining ones not.
11240
11241 @item sccvn-max-alias-queries-per-access
11242 Maximum number of alias-oracle queries we perform when looking for
11243 redundancies for loads and stores. If this limit is hit the search
11244 is aborted and the load or store is not considered redundant. The
11245 number of queries is algorithmically limited to the number of
11246 stores on all paths from the load to the function entry.
11247
11248 @item ira-max-loops-num
11249 IRA uses regional register allocation by default. If a function
11250 contains more loops than the number given by this parameter, only at most
11251 the given number of the most frequently-executed loops form regions
11252 for regional register allocation.
11253
11254 @item ira-max-conflict-table-size
11255 Although IRA uses a sophisticated algorithm to compress the conflict
11256 table, the table can still require excessive amounts of memory for
11257 huge functions. If the conflict table for a function could be more
11258 than the size in MB given by this parameter, the register allocator
11259 instead uses a faster, simpler, and lower-quality
11260 algorithm that does not require building a pseudo-register conflict table.
11261
11262 @item ira-loop-reserved-regs
11263 IRA can be used to evaluate more accurate register pressure in loops
11264 for decisions to move loop invariants (see @option{-O3}). The number
11265 of available registers reserved for some other purposes is given
11266 by this parameter. Default of the parameter
11267 is the best found from numerous experiments.
11268
11269 @item lra-inheritance-ebb-probability-cutoff
11270 LRA tries to reuse values reloaded in registers in subsequent insns.
11271 This optimization is called inheritance. EBB is used as a region to
11272 do this optimization. The parameter defines a minimal fall-through
11273 edge probability in percentage used to add BB to inheritance EBB in
11274 LRA. The default value was chosen
11275 from numerous runs of SPEC2000 on x86-64.
11276
11277 @item loop-invariant-max-bbs-in-loop
11278 Loop invariant motion can be very expensive, both in compilation time and
11279 in amount of needed compile-time memory, with very large loops. Loops
11280 with more basic blocks than this parameter won't have loop invariant
11281 motion optimization performed on them.
11282
11283 @item loop-max-datarefs-for-datadeps
11284 Building data dependencies is expensive for very large loops. This
11285 parameter limits the number of data references in loops that are
11286 considered for data dependence analysis. These large loops are no
11287 handled by the optimizations using loop data dependencies.
11288
11289 @item max-vartrack-size
11290 Sets a maximum number of hash table slots to use during variable
11291 tracking dataflow analysis of any function. If this limit is exceeded
11292 with variable tracking at assignments enabled, analysis for that
11293 function is retried without it, after removing all debug insns from
11294 the function. If the limit is exceeded even without debug insns, var
11295 tracking analysis is completely disabled for the function. Setting
11296 the parameter to zero makes it unlimited.
11297
11298 @item max-vartrack-expr-depth
11299 Sets a maximum number of recursion levels when attempting to map
11300 variable names or debug temporaries to value expressions. This trades
11301 compilation time for more complete debug information. If this is set too
11302 low, value expressions that are available and could be represented in
11303 debug information may end up not being used; setting this higher may
11304 enable the compiler to find more complex debug expressions, but compile
11305 time and memory use may grow.
11306
11307 @item max-debug-marker-count
11308 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11309 markers) to avoid complexity explosion at inlining or expanding to RTL.
11310 If a function has more such gimple stmts than the set limit, such stmts
11311 will be dropped from the inlined copy of a function, and from its RTL
11312 expansion.
11313
11314 @item min-nondebug-insn-uid
11315 Use uids starting at this parameter for nondebug insns. The range below
11316 the parameter is reserved exclusively for debug insns created by
11317 @option{-fvar-tracking-assignments}, but debug insns may get
11318 (non-overlapping) uids above it if the reserved range is exhausted.
11319
11320 @item ipa-sra-ptr-growth-factor
11321 IPA-SRA replaces a pointer to an aggregate with one or more new
11322 parameters only when their cumulative size is less or equal to
11323 @option{ipa-sra-ptr-growth-factor} times the size of the original
11324 pointer parameter.
11325
11326 @item sra-max-scalarization-size-Ospeed
11327 @itemx sra-max-scalarization-size-Osize
11328 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11329 replace scalar parts of aggregates with uses of independent scalar
11330 variables. These parameters control the maximum size, in storage units,
11331 of aggregate which is considered for replacement when compiling for
11332 speed
11333 (@option{sra-max-scalarization-size-Ospeed}) or size
11334 (@option{sra-max-scalarization-size-Osize}) respectively.
11335
11336 @item tm-max-aggregate-size
11337 When making copies of thread-local variables in a transaction, this
11338 parameter specifies the size in bytes after which variables are
11339 saved with the logging functions as opposed to save/restore code
11340 sequence pairs. This option only applies when using
11341 @option{-fgnu-tm}.
11342
11343 @item graphite-max-nb-scop-params
11344 To avoid exponential effects in the Graphite loop transforms, the
11345 number of parameters in a Static Control Part (SCoP) is bounded.
11346 A value of zero can be used to lift
11347 the bound. A variable whose value is unknown at compilation time and
11348 defined outside a SCoP is a parameter of the SCoP.
11349
11350 @item loop-block-tile-size
11351 Loop blocking or strip mining transforms, enabled with
11352 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11353 loop in the loop nest by a given number of iterations. The strip
11354 length can be changed using the @option{loop-block-tile-size}
11355 parameter.
11356
11357 @item ipa-cp-value-list-size
11358 IPA-CP attempts to track all possible values and types passed to a function's
11359 parameter in order to propagate them and perform devirtualization.
11360 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11361 stores per one formal parameter of a function.
11362
11363 @item ipa-cp-eval-threshold
11364 IPA-CP calculates its own score of cloning profitability heuristics
11365 and performs those cloning opportunities with scores that exceed
11366 @option{ipa-cp-eval-threshold}.
11367
11368 @item ipa-cp-recursion-penalty
11369 Percentage penalty the recursive functions will receive when they
11370 are evaluated for cloning.
11371
11372 @item ipa-cp-single-call-penalty
11373 Percentage penalty functions containing a single call to another
11374 function will receive when they are evaluated for cloning.
11375
11376 @item ipa-max-agg-items
11377 IPA-CP is also capable to propagate a number of scalar values passed
11378 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11379 number of such values per one parameter.
11380
11381 @item ipa-cp-loop-hint-bonus
11382 When IPA-CP determines that a cloning candidate would make the number
11383 of iterations of a loop known, it adds a bonus of
11384 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11385 the candidate.
11386
11387 @item ipa-cp-array-index-hint-bonus
11388 When IPA-CP determines that a cloning candidate would make the index of
11389 an array access known, it adds a bonus of
11390 @option{ipa-cp-array-index-hint-bonus} to the profitability
11391 score of the candidate.
11392
11393 @item ipa-max-aa-steps
11394 During its analysis of function bodies, IPA-CP employs alias analysis
11395 in order to track values pointed to by function parameters. In order
11396 not spend too much time analyzing huge functions, it gives up and
11397 consider all memory clobbered after examining
11398 @option{ipa-max-aa-steps} statements modifying memory.
11399
11400 @item lto-partitions
11401 Specify desired number of partitions produced during WHOPR compilation.
11402 The number of partitions should exceed the number of CPUs used for compilation.
11403
11404 @item lto-min-partition
11405 Size of minimal partition for WHOPR (in estimated instructions).
11406 This prevents expenses of splitting very small programs into too many
11407 partitions.
11408
11409 @item lto-max-partition
11410 Size of max partition for WHOPR (in estimated instructions).
11411 to provide an upper bound for individual size of partition.
11412 Meant to be used only with balanced partitioning.
11413
11414 @item cxx-max-namespaces-for-diagnostic-help
11415 The maximum number of namespaces to consult for suggestions when C++
11416 name lookup fails for an identifier.
11417
11418 @item sink-frequency-threshold
11419 The maximum relative execution frequency (in percents) of the target block
11420 relative to a statement's original block to allow statement sinking of a
11421 statement. Larger numbers result in more aggressive statement sinking.
11422 A small positive adjustment is applied for
11423 statements with memory operands as those are even more profitable so sink.
11424
11425 @item max-stores-to-sink
11426 The maximum number of conditional store pairs that can be sunk. Set to 0
11427 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11428 (@option{-ftree-loop-if-convert}) is disabled.
11429
11430 @item allow-store-data-races
11431 Allow optimizers to introduce new data races on stores.
11432 Set to 1 to allow, otherwise to 0.
11433
11434 @item case-values-threshold
11435 The smallest number of different values for which it is best to use a
11436 jump-table instead of a tree of conditional branches. If the value is
11437 0, use the default for the machine.
11438
11439 @item tree-reassoc-width
11440 Set the maximum number of instructions executed in parallel in
11441 reassociated tree. This parameter overrides target dependent
11442 heuristics used by default if has non zero value.
11443
11444 @item sched-pressure-algorithm
11445 Choose between the two available implementations of
11446 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11447 and is the more likely to prevent instructions from being reordered.
11448 Algorithm 2 was designed to be a compromise between the relatively
11449 conservative approach taken by algorithm 1 and the rather aggressive
11450 approach taken by the default scheduler. It relies more heavily on
11451 having a regular register file and accurate register pressure classes.
11452 See @file{haifa-sched.c} in the GCC sources for more details.
11453
11454 The default choice depends on the target.
11455
11456 @item max-slsr-cand-scan
11457 Set the maximum number of existing candidates that are considered when
11458 seeking a basis for a new straight-line strength reduction candidate.
11459
11460 @item asan-globals
11461 Enable buffer overflow detection for global objects. This kind
11462 of protection is enabled by default if you are using
11463 @option{-fsanitize=address} option.
11464 To disable global objects protection use @option{--param asan-globals=0}.
11465
11466 @item asan-stack
11467 Enable buffer overflow detection for stack objects. This kind of
11468 protection is enabled by default when using @option{-fsanitize=address}.
11469 To disable stack protection use @option{--param asan-stack=0} option.
11470
11471 @item asan-instrument-reads
11472 Enable buffer overflow detection for memory reads. This kind of
11473 protection is enabled by default when using @option{-fsanitize=address}.
11474 To disable memory reads protection use
11475 @option{--param asan-instrument-reads=0}.
11476
11477 @item asan-instrument-writes
11478 Enable buffer overflow detection for memory writes. This kind of
11479 protection is enabled by default when using @option{-fsanitize=address}.
11480 To disable memory writes protection use
11481 @option{--param asan-instrument-writes=0} option.
11482
11483 @item asan-memintrin
11484 Enable detection for built-in functions. This kind of protection
11485 is enabled by default when using @option{-fsanitize=address}.
11486 To disable built-in functions protection use
11487 @option{--param asan-memintrin=0}.
11488
11489 @item asan-use-after-return
11490 Enable detection of use-after-return. This kind of protection
11491 is enabled by default when using the @option{-fsanitize=address} option.
11492 To disable it use @option{--param asan-use-after-return=0}.
11493
11494 Note: By default the check is disabled at run time. To enable it,
11495 add @code{detect_stack_use_after_return=1} to the environment variable
11496 @env{ASAN_OPTIONS}.
11497
11498 @item asan-instrumentation-with-call-threshold
11499 If number of memory accesses in function being instrumented
11500 is greater or equal to this number, use callbacks instead of inline checks.
11501 E.g. to disable inline code use
11502 @option{--param asan-instrumentation-with-call-threshold=0}.
11503
11504 @item use-after-scope-direct-emission-threshold
11505 If the size of a local variable in bytes is smaller or equal to this
11506 number, directly poison (or unpoison) shadow memory instead of using
11507 run-time callbacks.
11508
11509 @item max-fsm-thread-path-insns
11510 Maximum number of instructions to copy when duplicating blocks on a
11511 finite state automaton jump thread path.
11512
11513 @item max-fsm-thread-length
11514 Maximum number of basic blocks on a finite state automaton jump thread
11515 path.
11516
11517 @item max-fsm-thread-paths
11518 Maximum number of new jump thread paths to create for a finite state
11519 automaton.
11520
11521 @item parloops-chunk-size
11522 Chunk size of omp schedule for loops parallelized by parloops.
11523
11524 @item parloops-schedule
11525 Schedule type of omp schedule for loops parallelized by parloops (static,
11526 dynamic, guided, auto, runtime).
11527
11528 @item parloops-min-per-thread
11529 The minimum number of iterations per thread of an innermost parallelized
11530 loop for which the parallelized variant is preferred over the single threaded
11531 one. Note that for a parallelized loop nest the
11532 minimum number of iterations of the outermost loop per thread is two.
11533
11534 @item max-ssa-name-query-depth
11535 Maximum depth of recursion when querying properties of SSA names in things
11536 like fold routines. One level of recursion corresponds to following a
11537 use-def chain.
11538
11539 @item hsa-gen-debug-stores
11540 Enable emission of special debug stores within HSA kernels which are
11541 then read and reported by libgomp plugin. Generation of these stores
11542 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11543 enable it.
11544
11545 @item max-speculative-devirt-maydefs
11546 The maximum number of may-defs we analyze when looking for a must-def
11547 specifying the dynamic type of an object that invokes a virtual call
11548 we may be able to devirtualize speculatively.
11549
11550 @item max-vrp-switch-assertions
11551 The maximum number of assertions to add along the default edge of a switch
11552 statement during VRP.
11553
11554 @item unroll-jam-min-percent
11555 The minimum percentage of memory references that must be optimized
11556 away for the unroll-and-jam transformation to be considered profitable.
11557
11558 @item unroll-jam-max-unroll
11559 The maximum number of times the outer loop should be unrolled by
11560 the unroll-and-jam transformation.
11561
11562 @item max-rtl-if-conversion-unpredictable-cost
11563 Maximum permissible cost for the sequence that would be generated
11564 by the RTL if-conversion pass for a branch that is considered unpredictable.
11565
11566 @item max-variable-expansions-in-unroller
11567 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
11568 of times that an individual variable will be expanded during loop unrolling.
11569
11570 @item tracer-min-branch-probability-feedback
11571 Stop forward growth if the probability of best edge is less than
11572 this threshold (in percent). Used when profile feedback is available.
11573
11574 @item partial-inlining-entry-probability
11575 Maximum probability of the entry BB of split region
11576 (in percent relative to entry BB of the function)
11577 to make partial inlining happen.
11578
11579 @item max-tracked-strlens
11580 Maximum number of strings for which strlen optimization pass will
11581 track string lengths.
11582
11583 @item gcse-after-reload-partial-fraction
11584 The threshold ratio for performing partial redundancy
11585 elimination after reload.
11586
11587 @item gcse-after-reload-critical-fraction
11588 The threshold ratio of critical edges execution count that
11589 permit performing redundancy elimination after reload.
11590
11591 @item max-loop-header-insns
11592 The maximum number of insns in loop header duplicated
11593 by the copy loop headers pass.
11594
11595 @item vect-epilogues-nomask
11596 Enable loop epilogue vectorization using smaller vector size.
11597
11598 @item slp-max-insns-in-bb
11599 Maximum number of instructions in basic block to be
11600 considered for SLP vectorization.
11601
11602 @item avoid-fma-max-bits
11603 Maximum number of bits for which we avoid creating FMAs.
11604
11605 @item sms-loop-average-count-threshold
11606 A threshold on the average loop count considered by the swing modulo scheduler.
11607
11608 @item sms-dfa-history
11609 The number of cycles the swing modulo scheduler considers when checking
11610 conflicts using DFA.
11611
11612 @item hot-bb-count-fraction
11613 Select fraction of the maximal count of repetitions of basic block
11614 in program given basic block needs
11615 to have to be considered hot (used in non-LTO mode)
11616
11617 @item max-inline-insns-recursive-auto
11618 The maximum number of instructions non-inline function
11619 can grow to via recursive inlining.
11620
11621 @item graphite-allow-codegen-errors
11622 Whether codegen errors should be ICEs when @option{-fchecking}.
11623
11624 @item sms-max-ii-factor
11625 A factor for tuning the upper bound that swing modulo scheduler
11626 uses for scheduling a loop.
11627
11628 @item lra-max-considered-reload-pseudos
11629 The max number of reload pseudos which are considered during
11630 spilling a non-reload pseudo.
11631
11632 @item max-pow-sqrt-depth
11633 Maximum depth of sqrt chains to use when synthesizing exponentiation
11634 by a real constant.
11635
11636 @item max-dse-active-local-stores
11637 Maximum number of active local stores in RTL dead store elimination.
11638
11639 @item asan-instrument-allocas
11640 Enable asan allocas/VLAs protection.
11641
11642 @item max-iterations-computation-cost
11643 Bound on the cost of an expression to compute the number of iterations.
11644
11645 @item max-isl-operations
11646 Maximum number of isl operations, 0 means unlimited.
11647
11648 @item graphite-max-arrays-per-scop
11649 Maximum number of arrays per scop.
11650
11651 @item max-vartrack-reverse-op-size
11652 Max. size of loc list for which reverse ops should be added.
11653
11654 @item unlikely-bb-count-fraction
11655 The minimum fraction of profile runs a given basic block execution count
11656 must be not to be considered unlikely.
11657
11658 @item tracer-dynamic-coverage-feedback
11659 The percentage of function, weighted by execution frequency,
11660 that must be covered by trace formation.
11661 Used when profile feedback is available.
11662
11663 @item max-inline-recursive-depth-auto
11664 The maximum depth of recursive inlining for non-inline functions.
11665
11666 @item fsm-scale-path-stmts
11667 Scale factor to apply to the number of statements in a threading path
11668 when comparing to the number of (scaled) blocks.
11669
11670 @item fsm-maximum-phi-arguments
11671 Maximum number of arguments a PHI may have before the FSM threader
11672 will not try to thread through its block.
11673
11674 @item uninit-control-dep-attempts
11675 Maximum number of nested calls to search for control dependencies
11676 during uninitialized variable analysis.
11677
11678 @item indir-call-topn-profile
11679 Track top N target addresses in indirect-call profile.
11680
11681 @item max-once-peeled-insns
11682 The maximum number of insns of a peeled loop that rolls only once.
11683
11684 @item sra-max-scalarization-size-Osize
11685 Maximum size, in storage units, of an aggregate
11686 which should be considered for scalarization when compiling for size.
11687
11688 @item fsm-scale-path-blocks
11689 Scale factor to apply to the number of blocks in a threading path
11690 when comparing to the number of (scaled) statements.
11691
11692 @item sched-autopref-queue-depth
11693 Hardware autoprefetcher scheduler model control flag.
11694 Number of lookahead cycles the model looks into; at '
11695 ' only enable instruction sorting heuristic.
11696
11697
11698 @end table
11699 @end table
11700
11701 @node Instrumentation Options
11702 @section Program Instrumentation Options
11703 @cindex instrumentation options
11704 @cindex program instrumentation options
11705 @cindex run-time error checking options
11706 @cindex profiling options
11707 @cindex options, program instrumentation
11708 @cindex options, run-time error checking
11709 @cindex options, profiling
11710
11711 GCC supports a number of command-line options that control adding
11712 run-time instrumentation to the code it normally generates.
11713 For example, one purpose of instrumentation is collect profiling
11714 statistics for use in finding program hot spots, code coverage
11715 analysis, or profile-guided optimizations.
11716 Another class of program instrumentation is adding run-time checking
11717 to detect programming errors like invalid pointer
11718 dereferences or out-of-bounds array accesses, as well as deliberately
11719 hostile attacks such as stack smashing or C++ vtable hijacking.
11720 There is also a general hook which can be used to implement other
11721 forms of tracing or function-level instrumentation for debug or
11722 program analysis purposes.
11723
11724 @table @gcctabopt
11725 @cindex @command{prof}
11726 @item -p
11727 @opindex p
11728 Generate extra code to write profile information suitable for the
11729 analysis program @command{prof}. You must use this option when compiling
11730 the source files you want data about, and you must also use it when
11731 linking.
11732
11733 @cindex @command{gprof}
11734 @item -pg
11735 @opindex pg
11736 Generate extra code to write profile information suitable for the
11737 analysis program @command{gprof}. You must use this option when compiling
11738 the source files you want data about, and you must also use it when
11739 linking.
11740
11741 @item -fprofile-arcs
11742 @opindex fprofile-arcs
11743 Add code so that program flow @dfn{arcs} are instrumented. During
11744 execution the program records how many times each branch and call is
11745 executed and how many times it is taken or returns. On targets that support
11746 constructors with priority support, profiling properly handles constructors,
11747 destructors and C++ constructors (and destructors) of classes which are used
11748 as a type of a global variable.
11749
11750 When the compiled
11751 program exits it saves this data to a file called
11752 @file{@var{auxname}.gcda} for each source file. The data may be used for
11753 profile-directed optimizations (@option{-fbranch-probabilities}), or for
11754 test coverage analysis (@option{-ftest-coverage}). Each object file's
11755 @var{auxname} is generated from the name of the output file, if
11756 explicitly specified and it is not the final executable, otherwise it is
11757 the basename of the source file. In both cases any suffix is removed
11758 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
11759 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
11760 @xref{Cross-profiling}.
11761
11762 @cindex @command{gcov}
11763 @item --coverage
11764 @opindex coverage
11765
11766 This option is used to compile and link code instrumented for coverage
11767 analysis. The option is a synonym for @option{-fprofile-arcs}
11768 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
11769 linking). See the documentation for those options for more details.
11770
11771 @itemize
11772
11773 @item
11774 Compile the source files with @option{-fprofile-arcs} plus optimization
11775 and code generation options. For test coverage analysis, use the
11776 additional @option{-ftest-coverage} option. You do not need to profile
11777 every source file in a program.
11778
11779 @item
11780 Compile the source files additionally with @option{-fprofile-abs-path}
11781 to create absolute path names in the @file{.gcno} files. This allows
11782 @command{gcov} to find the correct sources in projects where compilations
11783 occur with different working directories.
11784
11785 @item
11786 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
11787 (the latter implies the former).
11788
11789 @item
11790 Run the program on a representative workload to generate the arc profile
11791 information. This may be repeated any number of times. You can run
11792 concurrent instances of your program, and provided that the file system
11793 supports locking, the data files will be correctly updated. Unless
11794 a strict ISO C dialect option is in effect, @code{fork} calls are
11795 detected and correctly handled without double counting.
11796
11797 @item
11798 For profile-directed optimizations, compile the source files again with
11799 the same optimization and code generation options plus
11800 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
11801 Control Optimization}).
11802
11803 @item
11804 For test coverage analysis, use @command{gcov} to produce human readable
11805 information from the @file{.gcno} and @file{.gcda} files. Refer to the
11806 @command{gcov} documentation for further information.
11807
11808 @end itemize
11809
11810 With @option{-fprofile-arcs}, for each function of your program GCC
11811 creates a program flow graph, then finds a spanning tree for the graph.
11812 Only arcs that are not on the spanning tree have to be instrumented: the
11813 compiler adds code to count the number of times that these arcs are
11814 executed. When an arc is the only exit or only entrance to a block, the
11815 instrumentation code can be added to the block; otherwise, a new basic
11816 block must be created to hold the instrumentation code.
11817
11818 @need 2000
11819 @item -ftest-coverage
11820 @opindex ftest-coverage
11821 Produce a notes file that the @command{gcov} code-coverage utility
11822 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
11823 show program coverage. Each source file's note file is called
11824 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
11825 above for a description of @var{auxname} and instructions on how to
11826 generate test coverage data. Coverage data matches the source files
11827 more closely if you do not optimize.
11828
11829 @item -fprofile-abs-path
11830 @opindex fprofile-abs-path
11831 Automatically convert relative source file names to absolute path names
11832 in the @file{.gcno} files. This allows @command{gcov} to find the correct
11833 sources in projects where compilations occur with different working
11834 directories.
11835
11836 @item -fprofile-dir=@var{path}
11837 @opindex fprofile-dir
11838
11839 Set the directory to search for the profile data files in to @var{path}.
11840 This option affects only the profile data generated by
11841 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
11842 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
11843 and its related options. Both absolute and relative paths can be used.
11844 By default, GCC uses the current directory as @var{path}, thus the
11845 profile data file appears in the same directory as the object file.
11846 In order to prevent the file name clashing, if the object file name is
11847 not an absolute path, we mangle the absolute path of the
11848 @file{@var{sourcename}.gcda} file and use it as the file name of a
11849 @file{.gcda} file.
11850
11851 When an executable is run in a massive parallel environment, it is recommended
11852 to save profile to different folders. That can be done with variables
11853 in @var{path} that are exported during run-time:
11854
11855 @table @gcctabopt
11856
11857 @item %p
11858 process ID.
11859
11860 @item %q@{VAR@}
11861 value of environment variable @var{VAR}
11862
11863 @end table
11864
11865 @item -fprofile-generate
11866 @itemx -fprofile-generate=@var{path}
11867 @opindex fprofile-generate
11868
11869 Enable options usually used for instrumenting application to produce
11870 profile useful for later recompilation with profile feedback based
11871 optimization. You must use @option{-fprofile-generate} both when
11872 compiling and when linking your program.
11873
11874 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
11875
11876 If @var{path} is specified, GCC looks at the @var{path} to find
11877 the profile feedback data files. See @option{-fprofile-dir}.
11878
11879 To optimize the program based on the collected profile information, use
11880 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
11881
11882 @item -fprofile-update=@var{method}
11883 @opindex fprofile-update
11884
11885 Alter the update method for an application instrumented for profile
11886 feedback based optimization. The @var{method} argument should be one of
11887 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
11888 The first one is useful for single-threaded applications,
11889 while the second one prevents profile corruption by emitting thread-safe code.
11890
11891 @strong{Warning:} When an application does not properly join all threads
11892 (or creates an detached thread), a profile file can be still corrupted.
11893
11894 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
11895 when supported by a target, or to @samp{single} otherwise. The GCC driver
11896 automatically selects @samp{prefer-atomic} when @option{-pthread}
11897 is present in the command line.
11898
11899 @item -fsanitize=address
11900 @opindex fsanitize=address
11901 Enable AddressSanitizer, a fast memory error detector.
11902 Memory access instructions are instrumented to detect
11903 out-of-bounds and use-after-free bugs.
11904 The option enables @option{-fsanitize-address-use-after-scope}.
11905 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
11906 more details. The run-time behavior can be influenced using the
11907 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
11908 the available options are shown at startup of the instrumented program. See
11909 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
11910 for a list of supported options.
11911 The option cannot be combined with @option{-fsanitize=thread}.
11912
11913 @item -fsanitize=kernel-address
11914 @opindex fsanitize=kernel-address
11915 Enable AddressSanitizer for Linux kernel.
11916 See @uref{https://github.com/google/kasan/wiki} for more details.
11917
11918 @item -fsanitize=pointer-compare
11919 @opindex fsanitize=pointer-compare
11920 Instrument comparison operation (<, <=, >, >=) with pointer operands.
11921 The option must be combined with either @option{-fsanitize=kernel-address} or
11922 @option{-fsanitize=address}
11923 The option cannot be combined with @option{-fsanitize=thread}.
11924 Note: By default the check is disabled at run time. To enable it,
11925 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11926 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11927 invalid operation only when both pointers are non-null.
11928
11929 @item -fsanitize=pointer-subtract
11930 @opindex fsanitize=pointer-subtract
11931 Instrument subtraction with pointer operands.
11932 The option must be combined with either @option{-fsanitize=kernel-address} or
11933 @option{-fsanitize=address}
11934 The option cannot be combined with @option{-fsanitize=thread}.
11935 Note: By default the check is disabled at run time. To enable it,
11936 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11937 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11938 invalid operation only when both pointers are non-null.
11939
11940 @item -fsanitize=thread
11941 @opindex fsanitize=thread
11942 Enable ThreadSanitizer, a fast data race detector.
11943 Memory access instructions are instrumented to detect
11944 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
11945 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
11946 environment variable; see
11947 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
11948 supported options.
11949 The option cannot be combined with @option{-fsanitize=address},
11950 @option{-fsanitize=leak}.
11951
11952 Note that sanitized atomic builtins cannot throw exceptions when
11953 operating on invalid memory addresses with non-call exceptions
11954 (@option{-fnon-call-exceptions}).
11955
11956 @item -fsanitize=leak
11957 @opindex fsanitize=leak
11958 Enable LeakSanitizer, a memory leak detector.
11959 This option only matters for linking of executables and
11960 the executable is linked against a library that overrides @code{malloc}
11961 and other allocator functions. See
11962 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
11963 details. The run-time behavior can be influenced using the
11964 @env{LSAN_OPTIONS} environment variable.
11965 The option cannot be combined with @option{-fsanitize=thread}.
11966
11967 @item -fsanitize=undefined
11968 @opindex fsanitize=undefined
11969 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
11970 Various computations are instrumented to detect undefined behavior
11971 at runtime. Current suboptions are:
11972
11973 @table @gcctabopt
11974
11975 @item -fsanitize=shift
11976 @opindex fsanitize=shift
11977 This option enables checking that the result of a shift operation is
11978 not undefined. Note that what exactly is considered undefined differs
11979 slightly between C and C++, as well as between ISO C90 and C99, etc.
11980 This option has two suboptions, @option{-fsanitize=shift-base} and
11981 @option{-fsanitize=shift-exponent}.
11982
11983 @item -fsanitize=shift-exponent
11984 @opindex fsanitize=shift-exponent
11985 This option enables checking that the second argument of a shift operation
11986 is not negative and is smaller than the precision of the promoted first
11987 argument.
11988
11989 @item -fsanitize=shift-base
11990 @opindex fsanitize=shift-base
11991 If the second argument of a shift operation is within range, check that the
11992 result of a shift operation is not undefined. Note that what exactly is
11993 considered undefined differs slightly between C and C++, as well as between
11994 ISO C90 and C99, etc.
11995
11996 @item -fsanitize=integer-divide-by-zero
11997 @opindex fsanitize=integer-divide-by-zero
11998 Detect integer division by zero as well as @code{INT_MIN / -1} division.
11999
12000 @item -fsanitize=unreachable
12001 @opindex fsanitize=unreachable
12002 With this option, the compiler turns the @code{__builtin_unreachable}
12003 call into a diagnostics message call instead. When reaching the
12004 @code{__builtin_unreachable} call, the behavior is undefined.
12005
12006 @item -fsanitize=vla-bound
12007 @opindex fsanitize=vla-bound
12008 This option instructs the compiler to check that the size of a variable
12009 length array is positive.
12010
12011 @item -fsanitize=null
12012 @opindex fsanitize=null
12013 This option enables pointer checking. Particularly, the application
12014 built with this option turned on will issue an error message when it
12015 tries to dereference a NULL pointer, or if a reference (possibly an
12016 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12017 on an object pointed by a NULL pointer.
12018
12019 @item -fsanitize=return
12020 @opindex fsanitize=return
12021 This option enables return statement checking. Programs
12022 built with this option turned on will issue an error message
12023 when the end of a non-void function is reached without actually
12024 returning a value. This option works in C++ only.
12025
12026 @item -fsanitize=signed-integer-overflow
12027 @opindex fsanitize=signed-integer-overflow
12028 This option enables signed integer overflow checking. We check that
12029 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12030 does not overflow in the signed arithmetics. Note, integer promotion
12031 rules must be taken into account. That is, the following is not an
12032 overflow:
12033 @smallexample
12034 signed char a = SCHAR_MAX;
12035 a++;
12036 @end smallexample
12037
12038 @item -fsanitize=bounds
12039 @opindex fsanitize=bounds
12040 This option enables instrumentation of array bounds. Various out of bounds
12041 accesses are detected. Flexible array members, flexible array member-like
12042 arrays, and initializers of variables with static storage are not instrumented.
12043
12044 @item -fsanitize=bounds-strict
12045 @opindex fsanitize=bounds-strict
12046 This option enables strict instrumentation of array bounds. Most out of bounds
12047 accesses are detected, including flexible array members and flexible array
12048 member-like arrays. Initializers of variables with static storage are not
12049 instrumented.
12050
12051 @item -fsanitize=alignment
12052 @opindex fsanitize=alignment
12053
12054 This option enables checking of alignment of pointers when they are
12055 dereferenced, or when a reference is bound to insufficiently aligned target,
12056 or when a method or constructor is invoked on insufficiently aligned object.
12057
12058 @item -fsanitize=object-size
12059 @opindex fsanitize=object-size
12060 This option enables instrumentation of memory references using the
12061 @code{__builtin_object_size} function. Various out of bounds pointer
12062 accesses are detected.
12063
12064 @item -fsanitize=float-divide-by-zero
12065 @opindex fsanitize=float-divide-by-zero
12066 Detect floating-point division by zero. Unlike other similar options,
12067 @option{-fsanitize=float-divide-by-zero} is not enabled by
12068 @option{-fsanitize=undefined}, since floating-point division by zero can
12069 be a legitimate way of obtaining infinities and NaNs.
12070
12071 @item -fsanitize=float-cast-overflow
12072 @opindex fsanitize=float-cast-overflow
12073 This option enables floating-point type to integer conversion checking.
12074 We check that the result of the conversion does not overflow.
12075 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12076 not enabled by @option{-fsanitize=undefined}.
12077 This option does not work well with @code{FE_INVALID} exceptions enabled.
12078
12079 @item -fsanitize=nonnull-attribute
12080 @opindex fsanitize=nonnull-attribute
12081
12082 This option enables instrumentation of calls, checking whether null values
12083 are not passed to arguments marked as requiring a non-null value by the
12084 @code{nonnull} function attribute.
12085
12086 @item -fsanitize=returns-nonnull-attribute
12087 @opindex fsanitize=returns-nonnull-attribute
12088
12089 This option enables instrumentation of return statements in functions
12090 marked with @code{returns_nonnull} function attribute, to detect returning
12091 of null values from such functions.
12092
12093 @item -fsanitize=bool
12094 @opindex fsanitize=bool
12095
12096 This option enables instrumentation of loads from bool. If a value other
12097 than 0/1 is loaded, a run-time error is issued.
12098
12099 @item -fsanitize=enum
12100 @opindex fsanitize=enum
12101
12102 This option enables instrumentation of loads from an enum type. If
12103 a value outside the range of values for the enum type is loaded,
12104 a run-time error is issued.
12105
12106 @item -fsanitize=vptr
12107 @opindex fsanitize=vptr
12108
12109 This option enables instrumentation of C++ member function calls, member
12110 accesses and some conversions between pointers to base and derived classes,
12111 to verify the referenced object has the correct dynamic type.
12112
12113 @item -fsanitize=pointer-overflow
12114 @opindex fsanitize=pointer-overflow
12115
12116 This option enables instrumentation of pointer arithmetics. If the pointer
12117 arithmetics overflows, a run-time error is issued.
12118
12119 @item -fsanitize=builtin
12120 @opindex fsanitize=builtin
12121
12122 This option enables instrumentation of arguments to selected builtin
12123 functions. If an invalid value is passed to such arguments, a run-time
12124 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12125 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12126 by this option.
12127
12128 @end table
12129
12130 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12131 @option{-fsanitize=undefined} gives a diagnostic message.
12132 This currently works only for the C family of languages.
12133
12134 @item -fno-sanitize=all
12135 @opindex fno-sanitize=all
12136
12137 This option disables all previously enabled sanitizers.
12138 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12139 together.
12140
12141 @item -fasan-shadow-offset=@var{number}
12142 @opindex fasan-shadow-offset
12143 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12144 It is useful for experimenting with different shadow memory layouts in
12145 Kernel AddressSanitizer.
12146
12147 @item -fsanitize-sections=@var{s1},@var{s2},...
12148 @opindex fsanitize-sections
12149 Sanitize global variables in selected user-defined sections. @var{si} may
12150 contain wildcards.
12151
12152 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12153 @opindex fsanitize-recover
12154 @opindex fno-sanitize-recover
12155 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12156 mentioned in comma-separated list of @var{opts}. Enabling this option
12157 for a sanitizer component causes it to attempt to continue
12158 running the program as if no error happened. This means multiple
12159 runtime errors can be reported in a single program run, and the exit
12160 code of the program may indicate success even when errors
12161 have been reported. The @option{-fno-sanitize-recover=} option
12162 can be used to alter
12163 this behavior: only the first detected error is reported
12164 and program then exits with a non-zero exit code.
12165
12166 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12167 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12168 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12169 @option{-fsanitize=bounds-strict},
12170 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12171 For these sanitizers error recovery is turned on by default,
12172 except @option{-fsanitize=address}, for which this feature is experimental.
12173 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12174 accepted, the former enables recovery for all sanitizers that support it,
12175 the latter disables recovery for all sanitizers that support it.
12176
12177 Even if a recovery mode is turned on the compiler side, it needs to be also
12178 enabled on the runtime library side, otherwise the failures are still fatal.
12179 The runtime library defaults to @code{halt_on_error=0} for
12180 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12181 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12182 setting the @code{halt_on_error} flag in the corresponding environment variable.
12183
12184 Syntax without an explicit @var{opts} parameter is deprecated. It is
12185 equivalent to specifying an @var{opts} list of:
12186
12187 @smallexample
12188 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12189 @end smallexample
12190
12191 @item -fsanitize-address-use-after-scope
12192 @opindex fsanitize-address-use-after-scope
12193 Enable sanitization of local variables to detect use-after-scope bugs.
12194 The option sets @option{-fstack-reuse} to @samp{none}.
12195
12196 @item -fsanitize-undefined-trap-on-error
12197 @opindex fsanitize-undefined-trap-on-error
12198 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12199 report undefined behavior using @code{__builtin_trap} rather than
12200 a @code{libubsan} library routine. The advantage of this is that the
12201 @code{libubsan} library is not needed and is not linked in, so this
12202 is usable even in freestanding environments.
12203
12204 @item -fsanitize-coverage=trace-pc
12205 @opindex fsanitize-coverage=trace-pc
12206 Enable coverage-guided fuzzing code instrumentation.
12207 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12208
12209 @item -fsanitize-coverage=trace-cmp
12210 @opindex fsanitize-coverage=trace-cmp
12211 Enable dataflow guided fuzzing code instrumentation.
12212 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12213 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12214 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12215 variable or @code{__sanitizer_cov_trace_const_cmp1},
12216 @code{__sanitizer_cov_trace_const_cmp2},
12217 @code{__sanitizer_cov_trace_const_cmp4} or
12218 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12219 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12220 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12221 @code{__sanitizer_cov_trace_switch} for switch statements.
12222
12223 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12224 @opindex fcf-protection
12225 Enable code instrumentation of control-flow transfers to increase
12226 program security by checking that target addresses of control-flow
12227 transfer instructions (such as indirect function call, function return,
12228 indirect jump) are valid. This prevents diverting the flow of control
12229 to an unexpected target. This is intended to protect against such
12230 threats as Return-oriented Programming (ROP), and similarly
12231 call/jmp-oriented programming (COP/JOP).
12232
12233 The value @code{branch} tells the compiler to implement checking of
12234 validity of control-flow transfer at the point of indirect branch
12235 instructions, i.e.@: call/jmp instructions. The value @code{return}
12236 implements checking of validity at the point of returning from a
12237 function. The value @code{full} is an alias for specifying both
12238 @code{branch} and @code{return}. The value @code{none} turns off
12239 instrumentation.
12240
12241 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12242 used. The first bit of @code{__CET__} is set to 1 for the value
12243 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12244 the @code{return}.
12245
12246 You can also use the @code{nocf_check} attribute to identify
12247 which functions and calls should be skipped from instrumentation
12248 (@pxref{Function Attributes}).
12249
12250 Currently the x86 GNU/Linux target provides an implementation based
12251 on Intel Control-flow Enforcement Technology (CET).
12252
12253 @item -fstack-protector
12254 @opindex fstack-protector
12255 Emit extra code to check for buffer overflows, such as stack smashing
12256 attacks. This is done by adding a guard variable to functions with
12257 vulnerable objects. This includes functions that call @code{alloca}, and
12258 functions with buffers larger than 8 bytes. The guards are initialized
12259 when a function is entered and then checked when the function exits.
12260 If a guard check fails, an error message is printed and the program exits.
12261
12262 @item -fstack-protector-all
12263 @opindex fstack-protector-all
12264 Like @option{-fstack-protector} except that all functions are protected.
12265
12266 @item -fstack-protector-strong
12267 @opindex fstack-protector-strong
12268 Like @option{-fstack-protector} but includes additional functions to
12269 be protected --- those that have local array definitions, or have
12270 references to local frame addresses.
12271
12272 @item -fstack-protector-explicit
12273 @opindex fstack-protector-explicit
12274 Like @option{-fstack-protector} but only protects those functions which
12275 have the @code{stack_protect} attribute.
12276
12277 @item -fstack-check
12278 @opindex fstack-check
12279 Generate code to verify that you do not go beyond the boundary of the
12280 stack. You should specify this flag if you are running in an
12281 environment with multiple threads, but you only rarely need to specify it in
12282 a single-threaded environment since stack overflow is automatically
12283 detected on nearly all systems if there is only one stack.
12284
12285 Note that this switch does not actually cause checking to be done; the
12286 operating system or the language runtime must do that. The switch causes
12287 generation of code to ensure that they see the stack being extended.
12288
12289 You can additionally specify a string parameter: @samp{no} means no
12290 checking, @samp{generic} means force the use of old-style checking,
12291 @samp{specific} means use the best checking method and is equivalent
12292 to bare @option{-fstack-check}.
12293
12294 Old-style checking is a generic mechanism that requires no specific
12295 target support in the compiler but comes with the following drawbacks:
12296
12297 @enumerate
12298 @item
12299 Modified allocation strategy for large objects: they are always
12300 allocated dynamically if their size exceeds a fixed threshold. Note this
12301 may change the semantics of some code.
12302
12303 @item
12304 Fixed limit on the size of the static frame of functions: when it is
12305 topped by a particular function, stack checking is not reliable and
12306 a warning is issued by the compiler.
12307
12308 @item
12309 Inefficiency: because of both the modified allocation strategy and the
12310 generic implementation, code performance is hampered.
12311 @end enumerate
12312
12313 Note that old-style stack checking is also the fallback method for
12314 @samp{specific} if no target support has been added in the compiler.
12315
12316 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12317 and stack overflows. @samp{specific} is an excellent choice when compiling
12318 Ada code. It is not generally sufficient to protect against stack-clash
12319 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12320
12321 @item -fstack-clash-protection
12322 @opindex fstack-clash-protection
12323 Generate code to prevent stack clash style attacks. When this option is
12324 enabled, the compiler will only allocate one page of stack space at a time
12325 and each page is accessed immediately after allocation. Thus, it prevents
12326 allocations from jumping over any stack guard page provided by the
12327 operating system.
12328
12329 Most targets do not fully support stack clash protection. However, on
12330 those targets @option{-fstack-clash-protection} will protect dynamic stack
12331 allocations. @option{-fstack-clash-protection} may also provide limited
12332 protection for static stack allocations if the target supports
12333 @option{-fstack-check=specific}.
12334
12335 @item -fstack-limit-register=@var{reg}
12336 @itemx -fstack-limit-symbol=@var{sym}
12337 @itemx -fno-stack-limit
12338 @opindex fstack-limit-register
12339 @opindex fstack-limit-symbol
12340 @opindex fno-stack-limit
12341 Generate code to ensure that the stack does not grow beyond a certain value,
12342 either the value of a register or the address of a symbol. If a larger
12343 stack is required, a signal is raised at run time. For most targets,
12344 the signal is raised before the stack overruns the boundary, so
12345 it is possible to catch the signal without taking special precautions.
12346
12347 For instance, if the stack starts at absolute address @samp{0x80000000}
12348 and grows downwards, you can use the flags
12349 @option{-fstack-limit-symbol=__stack_limit} and
12350 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12351 of 128KB@. Note that this may only work with the GNU linker.
12352
12353 You can locally override stack limit checking by using the
12354 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12355
12356 @item -fsplit-stack
12357 @opindex fsplit-stack
12358 Generate code to automatically split the stack before it overflows.
12359 The resulting program has a discontiguous stack which can only
12360 overflow if the program is unable to allocate any more memory. This
12361 is most useful when running threaded programs, as it is no longer
12362 necessary to calculate a good stack size to use for each thread. This
12363 is currently only implemented for the x86 targets running
12364 GNU/Linux.
12365
12366 When code compiled with @option{-fsplit-stack} calls code compiled
12367 without @option{-fsplit-stack}, there may not be much stack space
12368 available for the latter code to run. If compiling all code,
12369 including library code, with @option{-fsplit-stack} is not an option,
12370 then the linker can fix up these calls so that the code compiled
12371 without @option{-fsplit-stack} always has a large stack. Support for
12372 this is implemented in the gold linker in GNU binutils release 2.21
12373 and later.
12374
12375 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12376 @opindex fvtable-verify
12377 This option is only available when compiling C++ code.
12378 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12379 feature that verifies at run time, for every virtual call, that
12380 the vtable pointer through which the call is made is valid for the type of
12381 the object, and has not been corrupted or overwritten. If an invalid vtable
12382 pointer is detected at run time, an error is reported and execution of the
12383 program is immediately halted.
12384
12385 This option causes run-time data structures to be built at program startup,
12386 which are used for verifying the vtable pointers.
12387 The options @samp{std} and @samp{preinit}
12388 control the timing of when these data structures are built. In both cases the
12389 data structures are built before execution reaches @code{main}. Using
12390 @option{-fvtable-verify=std} causes the data structures to be built after
12391 shared libraries have been loaded and initialized.
12392 @option{-fvtable-verify=preinit} causes them to be built before shared
12393 libraries have been loaded and initialized.
12394
12395 If this option appears multiple times in the command line with different
12396 values specified, @samp{none} takes highest priority over both @samp{std} and
12397 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12398
12399 @item -fvtv-debug
12400 @opindex fvtv-debug
12401 When used in conjunction with @option{-fvtable-verify=std} or
12402 @option{-fvtable-verify=preinit}, causes debug versions of the
12403 runtime functions for the vtable verification feature to be called.
12404 This flag also causes the compiler to log information about which
12405 vtable pointers it finds for each class.
12406 This information is written to a file named @file{vtv_set_ptr_data.log}
12407 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12408 if that is defined or the current working directory otherwise.
12409
12410 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12411 file, be sure to delete any existing one.
12412
12413 @item -fvtv-counts
12414 @opindex fvtv-counts
12415 This is a debugging flag. When used in conjunction with
12416 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12417 causes the compiler to keep track of the total number of virtual calls
12418 it encounters and the number of verifications it inserts. It also
12419 counts the number of calls to certain run-time library functions
12420 that it inserts and logs this information for each compilation unit.
12421 The compiler writes this information to a file named
12422 @file{vtv_count_data.log} in the directory named by the environment
12423 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12424 directory otherwise. It also counts the size of the vtable pointer sets
12425 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12426 in the same directory.
12427
12428 Note: This feature @emph{appends} data to the log files. To get fresh log
12429 files, be sure to delete any existing ones.
12430
12431 @item -finstrument-functions
12432 @opindex finstrument-functions
12433 Generate instrumentation calls for entry and exit to functions. Just
12434 after function entry and just before function exit, the following
12435 profiling functions are called with the address of the current
12436 function and its call site. (On some platforms,
12437 @code{__builtin_return_address} does not work beyond the current
12438 function, so the call site information may not be available to the
12439 profiling functions otherwise.)
12440
12441 @smallexample
12442 void __cyg_profile_func_enter (void *this_fn,
12443 void *call_site);
12444 void __cyg_profile_func_exit (void *this_fn,
12445 void *call_site);
12446 @end smallexample
12447
12448 The first argument is the address of the start of the current function,
12449 which may be looked up exactly in the symbol table.
12450
12451 This instrumentation is also done for functions expanded inline in other
12452 functions. The profiling calls indicate where, conceptually, the
12453 inline function is entered and exited. This means that addressable
12454 versions of such functions must be available. If all your uses of a
12455 function are expanded inline, this may mean an additional expansion of
12456 code size. If you use @code{extern inline} in your C code, an
12457 addressable version of such functions must be provided. (This is
12458 normally the case anyway, but if you get lucky and the optimizer always
12459 expands the functions inline, you might have gotten away without
12460 providing static copies.)
12461
12462 A function may be given the attribute @code{no_instrument_function}, in
12463 which case this instrumentation is not done. This can be used, for
12464 example, for the profiling functions listed above, high-priority
12465 interrupt routines, and any functions from which the profiling functions
12466 cannot safely be called (perhaps signal handlers, if the profiling
12467 routines generate output or allocate memory).
12468
12469 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12470 @opindex finstrument-functions-exclude-file-list
12471
12472 Set the list of functions that are excluded from instrumentation (see
12473 the description of @option{-finstrument-functions}). If the file that
12474 contains a function definition matches with one of @var{file}, then
12475 that function is not instrumented. The match is done on substrings:
12476 if the @var{file} parameter is a substring of the file name, it is
12477 considered to be a match.
12478
12479 For example:
12480
12481 @smallexample
12482 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12483 @end smallexample
12484
12485 @noindent
12486 excludes any inline function defined in files whose pathnames
12487 contain @file{/bits/stl} or @file{include/sys}.
12488
12489 If, for some reason, you want to include letter @samp{,} in one of
12490 @var{sym}, write @samp{\,}. For example,
12491 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12492 (note the single quote surrounding the option).
12493
12494 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12495 @opindex finstrument-functions-exclude-function-list
12496
12497 This is similar to @option{-finstrument-functions-exclude-file-list},
12498 but this option sets the list of function names to be excluded from
12499 instrumentation. The function name to be matched is its user-visible
12500 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12501 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12502 match is done on substrings: if the @var{sym} parameter is a substring
12503 of the function name, it is considered to be a match. For C99 and C++
12504 extended identifiers, the function name must be given in UTF-8, not
12505 using universal character names.
12506
12507 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12508 @opindex fpatchable-function-entry
12509 Generate @var{N} NOPs right at the beginning
12510 of each function, with the function entry point before the @var{M}th NOP.
12511 If @var{M} is omitted, it defaults to @code{0} so the
12512 function entry points to the address just at the first NOP.
12513 The NOP instructions reserve extra space which can be used to patch in
12514 any desired instrumentation at run time, provided that the code segment
12515 is writable. The amount of space is controllable indirectly via
12516 the number of NOPs; the NOP instruction used corresponds to the instruction
12517 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12518 is target-specific and may also depend on the architecture variant and/or
12519 other compilation options.
12520
12521 For run-time identification, the starting addresses of these areas,
12522 which correspond to their respective function entries minus @var{M},
12523 are additionally collected in the @code{__patchable_function_entries}
12524 section of the resulting binary.
12525
12526 Note that the value of @code{__attribute__ ((patchable_function_entry
12527 (N,M)))} takes precedence over command-line option
12528 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12529 the area size or to remove it completely on a single function.
12530 If @code{N=0}, no pad location is recorded.
12531
12532 The NOP instructions are inserted at---and maybe before, depending on
12533 @var{M}---the function entry address, even before the prologue.
12534
12535 @end table
12536
12537
12538 @node Preprocessor Options
12539 @section Options Controlling the Preprocessor
12540 @cindex preprocessor options
12541 @cindex options, preprocessor
12542
12543 These options control the C preprocessor, which is run on each C source
12544 file before actual compilation.
12545
12546 If you use the @option{-E} option, nothing is done except preprocessing.
12547 Some of these options make sense only together with @option{-E} because
12548 they cause the preprocessor output to be unsuitable for actual
12549 compilation.
12550
12551 In addition to the options listed here, there are a number of options
12552 to control search paths for include files documented in
12553 @ref{Directory Options}.
12554 Options to control preprocessor diagnostics are listed in
12555 @ref{Warning Options}.
12556
12557 @table @gcctabopt
12558 @include cppopts.texi
12559
12560 @item -Wp,@var{option}
12561 @opindex Wp
12562 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12563 and pass @var{option} directly through to the preprocessor. If
12564 @var{option} contains commas, it is split into multiple options at the
12565 commas. However, many options are modified, translated or interpreted
12566 by the compiler driver before being passed to the preprocessor, and
12567 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12568 interface is undocumented and subject to change, so whenever possible
12569 you should avoid using @option{-Wp} and let the driver handle the
12570 options instead.
12571
12572 @item -Xpreprocessor @var{option}
12573 @opindex Xpreprocessor
12574 Pass @var{option} as an option to the preprocessor. You can use this to
12575 supply system-specific preprocessor options that GCC does not
12576 recognize.
12577
12578 If you want to pass an option that takes an argument, you must use
12579 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12580
12581 @item -no-integrated-cpp
12582 @opindex no-integrated-cpp
12583 Perform preprocessing as a separate pass before compilation.
12584 By default, GCC performs preprocessing as an integrated part of
12585 input tokenization and parsing.
12586 If this option is provided, the appropriate language front end
12587 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12588 and Objective-C, respectively) is instead invoked twice,
12589 once for preprocessing only and once for actual compilation
12590 of the preprocessed input.
12591 This option may be useful in conjunction with the @option{-B} or
12592 @option{-wrapper} options to specify an alternate preprocessor or
12593 perform additional processing of the program source between
12594 normal preprocessing and compilation.
12595
12596 @end table
12597
12598 @node Assembler Options
12599 @section Passing Options to the Assembler
12600
12601 @c prevent bad page break with this line
12602 You can pass options to the assembler.
12603
12604 @table @gcctabopt
12605 @item -Wa,@var{option}
12606 @opindex Wa
12607 Pass @var{option} as an option to the assembler. If @var{option}
12608 contains commas, it is split into multiple options at the commas.
12609
12610 @item -Xassembler @var{option}
12611 @opindex Xassembler
12612 Pass @var{option} as an option to the assembler. You can use this to
12613 supply system-specific assembler options that GCC does not
12614 recognize.
12615
12616 If you want to pass an option that takes an argument, you must use
12617 @option{-Xassembler} twice, once for the option and once for the argument.
12618
12619 @end table
12620
12621 @node Link Options
12622 @section Options for Linking
12623 @cindex link options
12624 @cindex options, linking
12625
12626 These options come into play when the compiler links object files into
12627 an executable output file. They are meaningless if the compiler is
12628 not doing a link step.
12629
12630 @table @gcctabopt
12631 @cindex file names
12632 @item @var{object-file-name}
12633 A file name that does not end in a special recognized suffix is
12634 considered to name an object file or library. (Object files are
12635 distinguished from libraries by the linker according to the file
12636 contents.) If linking is done, these object files are used as input
12637 to the linker.
12638
12639 @item -c
12640 @itemx -S
12641 @itemx -E
12642 @opindex c
12643 @opindex S
12644 @opindex E
12645 If any of these options is used, then the linker is not run, and
12646 object file names should not be used as arguments. @xref{Overall
12647 Options}.
12648
12649 @item -flinker-output=@var{type}
12650 @opindex flinker-output
12651 This option controls the code generation of the link time optimizer. By
12652 default the linker output is determined by the linker plugin automatically. For
12653 debugging the compiler and in the case of incremental linking to non-lto object
12654 file is desired, it may be useful to control the type manually.
12655
12656 If @var{type} is @samp{exec} the code generation is configured to produce static
12657 binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
12658
12659 If @var{type} is @samp{dyn} the code generation is configured to produce shared
12660 library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
12661 enabled automatically. This makes it possible to build shared libraries without
12662 position independent code on architectures this is possible, i.e.@: on x86.
12663
12664 If @var{type} is @samp{pie} the code generation is configured to produce
12665 @option{-fpie} executable. This result in similar optimizations as @samp{exec}
12666 except that @option{-fpie} is not disabled if specified at compilation time.
12667
12668 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
12669 done. The sections containing intermediate code for link-time optimization are
12670 merged, pre-optimized, and output to the resulting object file. In addition, if
12671 @option{-ffat-lto-objects} is specified the binary code is produced for future
12672 non-lto linking. The object file produced by incremental linking will be smaller
12673 than a static library produced from the same object files. At link-time the
12674 result of incremental linking will also load faster to compiler than a static
12675 library assuming that majority of objects in the library are used.
12676
12677 Finally @samp{nolto-rel} configure compiler to for incremental linking where
12678 code generation is forced, final binary is produced and the intermediate code
12679 for later link-time optimization is stripped. When multiple object files are
12680 linked together the resulting code will be optimized better than with link time
12681 optimizations disabled (for example, the cross-module inlining will happen),
12682 most of benefits of whole program optimizations are however lost.
12683
12684 During the incremental link (by @option{-r}) the linker plugin will default to
12685 @option{rel}. With current interfaces to GNU Binutils it is however not
12686 possible to link incrementally LTO objects and non-LTO objects into a single
12687 mixed object file. In the case any of object files in incremental link can not
12688 be used for link-time optimization the linker plugin will output warning and
12689 use @samp{nolto-rel}. To maintain the whole program optimization it is
12690 recommended to link such objects into static library instead. Alternatively it
12691 is possible to use H.J. Lu's binutils with support for mixed objects.
12692
12693 @item -fuse-ld=bfd
12694 @opindex fuse-ld=bfd
12695 Use the @command{bfd} linker instead of the default linker.
12696
12697 @item -fuse-ld=gold
12698 @opindex fuse-ld=gold
12699 Use the @command{gold} linker instead of the default linker.
12700
12701 @item -fuse-ld=lld
12702 @opindex fuse-ld=lld
12703 Use the LLVM @command{lld} linker instead of the default linker.
12704
12705 @cindex Libraries
12706 @item -l@var{library}
12707 @itemx -l @var{library}
12708 @opindex l
12709 Search the library named @var{library} when linking. (The second
12710 alternative with the library as a separate argument is only for
12711 POSIX compliance and is not recommended.)
12712
12713 It makes a difference where in the command you write this option; the
12714 linker searches and processes libraries and object files in the order they
12715 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
12716 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
12717 to functions in @samp{z}, those functions may not be loaded.
12718
12719 The linker searches a standard list of directories for the library,
12720 which is actually a file named @file{lib@var{library}.a}. The linker
12721 then uses this file as if it had been specified precisely by name.
12722
12723 The directories searched include several standard system directories
12724 plus any that you specify with @option{-L}.
12725
12726 Normally the files found this way are library files---archive files
12727 whose members are object files. The linker handles an archive file by
12728 scanning through it for members which define symbols that have so far
12729 been referenced but not defined. But if the file that is found is an
12730 ordinary object file, it is linked in the usual fashion. The only
12731 difference between using an @option{-l} option and specifying a file name
12732 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
12733 and searches several directories.
12734
12735 @item -lobjc
12736 @opindex lobjc
12737 You need this special case of the @option{-l} option in order to
12738 link an Objective-C or Objective-C++ program.
12739
12740 @item -nostartfiles
12741 @opindex nostartfiles
12742 Do not use the standard system startup files when linking.
12743 The standard system libraries are used normally, unless @option{-nostdlib},
12744 @option{-nolibc}, or @option{-nodefaultlibs} is used.
12745
12746 @item -nodefaultlibs
12747 @opindex nodefaultlibs
12748 Do not use the standard system libraries when linking.
12749 Only the libraries you specify are passed to the linker, and options
12750 specifying linkage of the system libraries, such as @option{-static-libgcc}
12751 or @option{-shared-libgcc}, are ignored.
12752 The standard startup files are used normally, unless @option{-nostartfiles}
12753 is used.
12754
12755 The compiler may generate calls to @code{memcmp},
12756 @code{memset}, @code{memcpy} and @code{memmove}.
12757 These entries are usually resolved by entries in
12758 libc. These entry points should be supplied through some other
12759 mechanism when this option is specified.
12760
12761 @item -nolibc
12762 @opindex nolibc
12763 Do not use the C library or system libraries tightly coupled with it when
12764 linking. Still link with the startup files, @file{libgcc} or toolchain
12765 provided language support libraries such as @file{libgnat}, @file{libgfortran}
12766 or @file{libstdc++} unless options preventing their inclusion are used as
12767 well. This typically removes @option{-lc} from the link command line, as well
12768 as system libraries that normally go with it and become meaningless when
12769 absence of a C library is assumed, for example @option{-lpthread} or
12770 @option{-lm} in some configurations. This is intended for bare-board
12771 targets when there is indeed no C library available.
12772
12773 @item -nostdlib
12774 @opindex nostdlib
12775 Do not use the standard system startup files or libraries when linking.
12776 No startup files and only the libraries you specify are passed to
12777 the linker, and options specifying linkage of the system libraries, such as
12778 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
12779
12780 The compiler may generate calls to @code{memcmp}, @code{memset},
12781 @code{memcpy} and @code{memmove}.
12782 These entries are usually resolved by entries in
12783 libc. These entry points should be supplied through some other
12784 mechanism when this option is specified.
12785
12786 @cindex @option{-lgcc}, use with @option{-nostdlib}
12787 @cindex @option{-nostdlib} and unresolved references
12788 @cindex unresolved references and @option{-nostdlib}
12789 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
12790 @cindex @option{-nodefaultlibs} and unresolved references
12791 @cindex unresolved references and @option{-nodefaultlibs}
12792 One of the standard libraries bypassed by @option{-nostdlib} and
12793 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
12794 which GCC uses to overcome shortcomings of particular machines, or special
12795 needs for some languages.
12796 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
12797 Collection (GCC) Internals},
12798 for more discussion of @file{libgcc.a}.)
12799 In most cases, you need @file{libgcc.a} even when you want to avoid
12800 other standard libraries. In other words, when you specify @option{-nostdlib}
12801 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
12802 This ensures that you have no unresolved references to internal GCC
12803 library subroutines.
12804 (An example of such an internal subroutine is @code{__main}, used to ensure C++
12805 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
12806 GNU Compiler Collection (GCC) Internals}.)
12807
12808 @item -e @var{entry}
12809 @itemx --entry=@var{entry}
12810 @opindex e
12811 @opindex entry
12812
12813 Specify that the program entry point is @var{entry}. The argument is
12814 interpreted by the linker; the GNU linker accepts either a symbol name
12815 or an address.
12816
12817 @item -pie
12818 @opindex pie
12819 Produce a dynamically linked position independent executable on targets
12820 that support it. For predictable results, you must also specify the same
12821 set of options used for compilation (@option{-fpie}, @option{-fPIE},
12822 or model suboptions) when you specify this linker option.
12823
12824 @item -no-pie
12825 @opindex no-pie
12826 Don't produce a dynamically linked position independent executable.
12827
12828 @item -static-pie
12829 @opindex static-pie
12830 Produce a static position independent executable on targets that support
12831 it. A static position independent executable is similar to a static
12832 executable, but can be loaded at any address without a dynamic linker.
12833 For predictable results, you must also specify the same set of options
12834 used for compilation (@option{-fpie}, @option{-fPIE}, or model
12835 suboptions) when you specify this linker option.
12836
12837 @item -pthread
12838 @opindex pthread
12839 Link with the POSIX threads library. This option is supported on
12840 GNU/Linux targets, most other Unix derivatives, and also on
12841 x86 Cygwin and MinGW targets. On some targets this option also sets
12842 flags for the preprocessor, so it should be used consistently for both
12843 compilation and linking.
12844
12845 @item -r
12846 @opindex r
12847 Produce a relocatable object as output. This is also known as partial
12848 linking.
12849
12850 @item -rdynamic
12851 @opindex rdynamic
12852 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
12853 that support it. This instructs the linker to add all symbols, not
12854 only used ones, to the dynamic symbol table. This option is needed
12855 for some uses of @code{dlopen} or to allow obtaining backtraces
12856 from within a program.
12857
12858 @item -s
12859 @opindex s
12860 Remove all symbol table and relocation information from the executable.
12861
12862 @item -static
12863 @opindex static
12864 On systems that support dynamic linking, this overrides @option{-pie}
12865 and prevents linking with the shared libraries. On other systems, this
12866 option has no effect.
12867
12868 @item -shared
12869 @opindex shared
12870 Produce a shared object which can then be linked with other objects to
12871 form an executable. Not all systems support this option. For predictable
12872 results, you must also specify the same set of options used for compilation
12873 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
12874 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
12875 needs to build supplementary stub code for constructors to work. On
12876 multi-libbed systems, @samp{gcc -shared} must select the correct support
12877 libraries to link against. Failing to supply the correct flags may lead
12878 to subtle defects. Supplying them in cases where they are not necessary
12879 is innocuous.}
12880
12881 @item -shared-libgcc
12882 @itemx -static-libgcc
12883 @opindex shared-libgcc
12884 @opindex static-libgcc
12885 On systems that provide @file{libgcc} as a shared library, these options
12886 force the use of either the shared or static version, respectively.
12887 If no shared version of @file{libgcc} was built when the compiler was
12888 configured, these options have no effect.
12889
12890 There are several situations in which an application should use the
12891 shared @file{libgcc} instead of the static version. The most common
12892 of these is when the application wishes to throw and catch exceptions
12893 across different shared libraries. In that case, each of the libraries
12894 as well as the application itself should use the shared @file{libgcc}.
12895
12896 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
12897 whenever you build a shared library or a main executable, because C++
12898 programs typically use exceptions, so this is the right thing to do.
12899
12900 If, instead, you use the GCC driver to create shared libraries, you may
12901 find that they are not always linked with the shared @file{libgcc}.
12902 If GCC finds, at its configuration time, that you have a non-GNU linker
12903 or a GNU linker that does not support option @option{--eh-frame-hdr},
12904 it links the shared version of @file{libgcc} into shared libraries
12905 by default. Otherwise, it takes advantage of the linker and optimizes
12906 away the linking with the shared version of @file{libgcc}, linking with
12907 the static version of libgcc by default. This allows exceptions to
12908 propagate through such shared libraries, without incurring relocation
12909 costs at library load time.
12910
12911 However, if a library or main executable is supposed to throw or catch
12912 exceptions, you must link it using the G++ driver, or using the option
12913 @option{-shared-libgcc}, such that it is linked with the shared
12914 @file{libgcc}.
12915
12916 @item -static-libasan
12917 @opindex static-libasan
12918 When the @option{-fsanitize=address} option is used to link a program,
12919 the GCC driver automatically links against @option{libasan}. If
12920 @file{libasan} is available as a shared library, and the @option{-static}
12921 option is not used, then this links against the shared version of
12922 @file{libasan}. The @option{-static-libasan} option directs the GCC
12923 driver to link @file{libasan} statically, without necessarily linking
12924 other libraries statically.
12925
12926 @item -static-libtsan
12927 @opindex static-libtsan
12928 When the @option{-fsanitize=thread} option is used to link a program,
12929 the GCC driver automatically links against @option{libtsan}. If
12930 @file{libtsan} is available as a shared library, and the @option{-static}
12931 option is not used, then this links against the shared version of
12932 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
12933 driver to link @file{libtsan} statically, without necessarily linking
12934 other libraries statically.
12935
12936 @item -static-liblsan
12937 @opindex static-liblsan
12938 When the @option{-fsanitize=leak} option is used to link a program,
12939 the GCC driver automatically links against @option{liblsan}. If
12940 @file{liblsan} is available as a shared library, and the @option{-static}
12941 option is not used, then this links against the shared version of
12942 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
12943 driver to link @file{liblsan} statically, without necessarily linking
12944 other libraries statically.
12945
12946 @item -static-libubsan
12947 @opindex static-libubsan
12948 When the @option{-fsanitize=undefined} option is used to link a program,
12949 the GCC driver automatically links against @option{libubsan}. If
12950 @file{libubsan} is available as a shared library, and the @option{-static}
12951 option is not used, then this links against the shared version of
12952 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
12953 driver to link @file{libubsan} statically, without necessarily linking
12954 other libraries statically.
12955
12956 @item -static-libstdc++
12957 @opindex static-libstdc++
12958 When the @command{g++} program is used to link a C++ program, it
12959 normally automatically links against @option{libstdc++}. If
12960 @file{libstdc++} is available as a shared library, and the
12961 @option{-static} option is not used, then this links against the
12962 shared version of @file{libstdc++}. That is normally fine. However, it
12963 is sometimes useful to freeze the version of @file{libstdc++} used by
12964 the program without going all the way to a fully static link. The
12965 @option{-static-libstdc++} option directs the @command{g++} driver to
12966 link @file{libstdc++} statically, without necessarily linking other
12967 libraries statically.
12968
12969 @item -symbolic
12970 @opindex symbolic
12971 Bind references to global symbols when building a shared object. Warn
12972 about any unresolved references (unless overridden by the link editor
12973 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
12974 this option.
12975
12976 @item -T @var{script}
12977 @opindex T
12978 @cindex linker script
12979 Use @var{script} as the linker script. This option is supported by most
12980 systems using the GNU linker. On some targets, such as bare-board
12981 targets without an operating system, the @option{-T} option may be required
12982 when linking to avoid references to undefined symbols.
12983
12984 @item -Xlinker @var{option}
12985 @opindex Xlinker
12986 Pass @var{option} as an option to the linker. You can use this to
12987 supply system-specific linker options that GCC does not recognize.
12988
12989 If you want to pass an option that takes a separate argument, you must use
12990 @option{-Xlinker} twice, once for the option and once for the argument.
12991 For example, to pass @option{-assert definitions}, you must write
12992 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
12993 @option{-Xlinker "-assert definitions"}, because this passes the entire
12994 string as a single argument, which is not what the linker expects.
12995
12996 When using the GNU linker, it is usually more convenient to pass
12997 arguments to linker options using the @option{@var{option}=@var{value}}
12998 syntax than as separate arguments. For example, you can specify
12999 @option{-Xlinker -Map=output.map} rather than
13000 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13001 this syntax for command-line options.
13002
13003 @item -Wl,@var{option}
13004 @opindex Wl
13005 Pass @var{option} as an option to the linker. If @var{option} contains
13006 commas, it is split into multiple options at the commas. You can use this
13007 syntax to pass an argument to the option.
13008 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13009 linker. When using the GNU linker, you can also get the same effect with
13010 @option{-Wl,-Map=output.map}.
13011
13012 @item -u @var{symbol}
13013 @opindex u
13014 Pretend the symbol @var{symbol} is undefined, to force linking of
13015 library modules to define it. You can use @option{-u} multiple times with
13016 different symbols to force loading of additional library modules.
13017
13018 @item -z @var{keyword}
13019 @opindex z
13020 @option{-z} is passed directly on to the linker along with the keyword
13021 @var{keyword}. See the section in the documentation of your linker for
13022 permitted values and their meanings.
13023 @end table
13024
13025 @node Directory Options
13026 @section Options for Directory Search
13027 @cindex directory options
13028 @cindex options, directory search
13029 @cindex search path
13030
13031 These options specify directories to search for header files, for
13032 libraries and for parts of the compiler:
13033
13034 @table @gcctabopt
13035 @include cppdiropts.texi
13036
13037 @item -iplugindir=@var{dir}
13038 @opindex iplugindir=
13039 Set the directory to search for plugins that are passed
13040 by @option{-fplugin=@var{name}} instead of
13041 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13042 to be used by the user, but only passed by the driver.
13043
13044 @item -L@var{dir}
13045 @opindex L
13046 Add directory @var{dir} to the list of directories to be searched
13047 for @option{-l}.
13048
13049 @item -B@var{prefix}
13050 @opindex B
13051 This option specifies where to find the executables, libraries,
13052 include files, and data files of the compiler itself.
13053
13054 The compiler driver program runs one or more of the subprograms
13055 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13056 @var{prefix} as a prefix for each program it tries to run, both with and
13057 without @samp{@var{machine}/@var{version}/} for the corresponding target
13058 machine and compiler version.
13059
13060 For each subprogram to be run, the compiler driver first tries the
13061 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13062 is not specified, the driver tries two standard prefixes,
13063 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13064 those results in a file name that is found, the unmodified program
13065 name is searched for using the directories specified in your
13066 @env{PATH} environment variable.
13067
13068 The compiler checks to see if the path provided by @option{-B}
13069 refers to a directory, and if necessary it adds a directory
13070 separator character at the end of the path.
13071
13072 @option{-B} prefixes that effectively specify directory names also apply
13073 to libraries in the linker, because the compiler translates these
13074 options into @option{-L} options for the linker. They also apply to
13075 include files in the preprocessor, because the compiler translates these
13076 options into @option{-isystem} options for the preprocessor. In this case,
13077 the compiler appends @samp{include} to the prefix.
13078
13079 The runtime support file @file{libgcc.a} can also be searched for using
13080 the @option{-B} prefix, if needed. If it is not found there, the two
13081 standard prefixes above are tried, and that is all. The file is left
13082 out of the link if it is not found by those means.
13083
13084 Another way to specify a prefix much like the @option{-B} prefix is to use
13085 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13086 Variables}.
13087
13088 As a special kludge, if the path provided by @option{-B} is
13089 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13090 9, then it is replaced by @file{[dir/]include}. This is to help
13091 with boot-strapping the compiler.
13092
13093 @item -no-canonical-prefixes
13094 @opindex no-canonical-prefixes
13095 Do not expand any symbolic links, resolve references to @samp{/../}
13096 or @samp{/./}, or make the path absolute when generating a relative
13097 prefix.
13098
13099 @item --sysroot=@var{dir}
13100 @opindex sysroot
13101 Use @var{dir} as the logical root directory for headers and libraries.
13102 For example, if the compiler normally searches for headers in
13103 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13104 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13105
13106 If you use both this option and the @option{-isysroot} option, then
13107 the @option{--sysroot} option applies to libraries, but the
13108 @option{-isysroot} option applies to header files.
13109
13110 The GNU linker (beginning with version 2.16) has the necessary support
13111 for this option. If your linker does not support this option, the
13112 header file aspect of @option{--sysroot} still works, but the
13113 library aspect does not.
13114
13115 @item --no-sysroot-suffix
13116 @opindex no-sysroot-suffix
13117 For some targets, a suffix is added to the root directory specified
13118 with @option{--sysroot}, depending on the other options used, so that
13119 headers may for example be found in
13120 @file{@var{dir}/@var{suffix}/usr/include} instead of
13121 @file{@var{dir}/usr/include}. This option disables the addition of
13122 such a suffix.
13123
13124 @end table
13125
13126 @node Code Gen Options
13127 @section Options for Code Generation Conventions
13128 @cindex code generation conventions
13129 @cindex options, code generation
13130 @cindex run-time options
13131
13132 These machine-independent options control the interface conventions
13133 used in code generation.
13134
13135 Most of them have both positive and negative forms; the negative form
13136 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13137 one of the forms is listed---the one that is not the default. You
13138 can figure out the other form by either removing @samp{no-} or adding
13139 it.
13140
13141 @table @gcctabopt
13142 @item -fstack-reuse=@var{reuse-level}
13143 @opindex fstack_reuse
13144 This option controls stack space reuse for user declared local/auto variables
13145 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13146 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13147 local variables and temporaries, @samp{named_vars} enables the reuse only for
13148 user defined local variables with names, and @samp{none} disables stack reuse
13149 completely. The default value is @samp{all}. The option is needed when the
13150 program extends the lifetime of a scoped local variable or a compiler generated
13151 temporary beyond the end point defined by the language. When a lifetime of
13152 a variable ends, and if the variable lives in memory, the optimizing compiler
13153 has the freedom to reuse its stack space with other temporaries or scoped
13154 local variables whose live range does not overlap with it. Legacy code extending
13155 local lifetime is likely to break with the stack reuse optimization.
13156
13157 For example,
13158
13159 @smallexample
13160 int *p;
13161 @{
13162 int local1;
13163
13164 p = &local1;
13165 local1 = 10;
13166 ....
13167 @}
13168 @{
13169 int local2;
13170 local2 = 20;
13171 ...
13172 @}
13173
13174 if (*p == 10) // out of scope use of local1
13175 @{
13176
13177 @}
13178 @end smallexample
13179
13180 Another example:
13181 @smallexample
13182
13183 struct A
13184 @{
13185 A(int k) : i(k), j(k) @{ @}
13186 int i;
13187 int j;
13188 @};
13189
13190 A *ap;
13191
13192 void foo(const A& ar)
13193 @{
13194 ap = &ar;
13195 @}
13196
13197 void bar()
13198 @{
13199 foo(A(10)); // temp object's lifetime ends when foo returns
13200
13201 @{
13202 A a(20);
13203 ....
13204 @}
13205 ap->i+= 10; // ap references out of scope temp whose space
13206 // is reused with a. What is the value of ap->i?
13207 @}
13208
13209 @end smallexample
13210
13211 The lifetime of a compiler generated temporary is well defined by the C++
13212 standard. When a lifetime of a temporary ends, and if the temporary lives
13213 in memory, the optimizing compiler has the freedom to reuse its stack
13214 space with other temporaries or scoped local variables whose live range
13215 does not overlap with it. However some of the legacy code relies on
13216 the behavior of older compilers in which temporaries' stack space is
13217 not reused, the aggressive stack reuse can lead to runtime errors. This
13218 option is used to control the temporary stack reuse optimization.
13219
13220 @item -ftrapv
13221 @opindex ftrapv
13222 This option generates traps for signed overflow on addition, subtraction,
13223 multiplication operations.
13224 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13225 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13226 @option{-fwrapv} being effective. Note that only active options override, so
13227 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13228 results in @option{-ftrapv} being effective.
13229
13230 @item -fwrapv
13231 @opindex fwrapv
13232 This option instructs the compiler to assume that signed arithmetic
13233 overflow of addition, subtraction and multiplication wraps around
13234 using twos-complement representation. This flag enables some optimizations
13235 and disables others.
13236 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13237 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13238 @option{-fwrapv} being effective. Note that only active options override, so
13239 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13240 results in @option{-ftrapv} being effective.
13241
13242 @item -fwrapv-pointer
13243 @opindex fwrapv-pointer
13244 This option instructs the compiler to assume that pointer arithmetic
13245 overflow on addition and subtraction wraps around using twos-complement
13246 representation. This flag disables some optimizations which assume
13247 pointer overflow is invalid.
13248
13249 @item -fstrict-overflow
13250 @opindex fstrict-overflow
13251 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13252 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13253
13254 @item -fexceptions
13255 @opindex fexceptions
13256 Enable exception handling. Generates extra code needed to propagate
13257 exceptions. For some targets, this implies GCC generates frame
13258 unwind information for all functions, which can produce significant data
13259 size overhead, although it does not affect execution. If you do not
13260 specify this option, GCC enables it by default for languages like
13261 C++ that normally require exception handling, and disables it for
13262 languages like C that do not normally require it. However, you may need
13263 to enable this option when compiling C code that needs to interoperate
13264 properly with exception handlers written in C++. You may also wish to
13265 disable this option if you are compiling older C++ programs that don't
13266 use exception handling.
13267
13268 @item -fnon-call-exceptions
13269 @opindex fnon-call-exceptions
13270 Generate code that allows trapping instructions to throw exceptions.
13271 Note that this requires platform-specific runtime support that does
13272 not exist everywhere. Moreover, it only allows @emph{trapping}
13273 instructions to throw exceptions, i.e.@: memory references or floating-point
13274 instructions. It does not allow exceptions to be thrown from
13275 arbitrary signal handlers such as @code{SIGALRM}.
13276
13277 @item -fdelete-dead-exceptions
13278 @opindex fdelete-dead-exceptions
13279 Consider that instructions that may throw exceptions but don't otherwise
13280 contribute to the execution of the program can be optimized away.
13281 This option is enabled by default for the Ada front end, as permitted by
13282 the Ada language specification.
13283 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13284
13285 @item -funwind-tables
13286 @opindex funwind-tables
13287 Similar to @option{-fexceptions}, except that it just generates any needed
13288 static data, but does not affect the generated code in any other way.
13289 You normally do not need to enable this option; instead, a language processor
13290 that needs this handling enables it on your behalf.
13291
13292 @item -fasynchronous-unwind-tables
13293 @opindex fasynchronous-unwind-tables
13294 Generate unwind table in DWARF format, if supported by target machine. The
13295 table is exact at each instruction boundary, so it can be used for stack
13296 unwinding from asynchronous events (such as debugger or garbage collector).
13297
13298 @item -fno-gnu-unique
13299 @opindex fno-gnu-unique
13300 @opindex fgnu-unique
13301 On systems with recent GNU assembler and C library, the C++ compiler
13302 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13303 of template static data members and static local variables in inline
13304 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13305 is necessary to avoid problems with a library used by two different
13306 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13307 therefore disagreeing with the other one about the binding of the
13308 symbol. But this causes @code{dlclose} to be ignored for affected
13309 DSOs; if your program relies on reinitialization of a DSO via
13310 @code{dlclose} and @code{dlopen}, you can use
13311 @option{-fno-gnu-unique}.
13312
13313 @item -fpcc-struct-return
13314 @opindex fpcc-struct-return
13315 Return ``short'' @code{struct} and @code{union} values in memory like
13316 longer ones, rather than in registers. This convention is less
13317 efficient, but it has the advantage of allowing intercallability between
13318 GCC-compiled files and files compiled with other compilers, particularly
13319 the Portable C Compiler (pcc).
13320
13321 The precise convention for returning structures in memory depends
13322 on the target configuration macros.
13323
13324 Short structures and unions are those whose size and alignment match
13325 that of some integer type.
13326
13327 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13328 switch is not binary compatible with code compiled with the
13329 @option{-freg-struct-return} switch.
13330 Use it to conform to a non-default application binary interface.
13331
13332 @item -freg-struct-return
13333 @opindex freg-struct-return
13334 Return @code{struct} and @code{union} values in registers when possible.
13335 This is more efficient for small structures than
13336 @option{-fpcc-struct-return}.
13337
13338 If you specify neither @option{-fpcc-struct-return} nor
13339 @option{-freg-struct-return}, GCC defaults to whichever convention is
13340 standard for the target. If there is no standard convention, GCC
13341 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13342 the principal compiler. In those cases, we can choose the standard, and
13343 we chose the more efficient register return alternative.
13344
13345 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13346 switch is not binary compatible with code compiled with the
13347 @option{-fpcc-struct-return} switch.
13348 Use it to conform to a non-default application binary interface.
13349
13350 @item -fshort-enums
13351 @opindex fshort-enums
13352 Allocate to an @code{enum} type only as many bytes as it needs for the
13353 declared range of possible values. Specifically, the @code{enum} type
13354 is equivalent to the smallest integer type that has enough room.
13355
13356 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13357 code that is not binary compatible with code generated without that switch.
13358 Use it to conform to a non-default application binary interface.
13359
13360 @item -fshort-wchar
13361 @opindex fshort-wchar
13362 Override the underlying type for @code{wchar_t} to be @code{short
13363 unsigned int} instead of the default for the target. This option is
13364 useful for building programs to run under WINE@.
13365
13366 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13367 code that is not binary compatible with code generated without that switch.
13368 Use it to conform to a non-default application binary interface.
13369
13370 @item -fno-common
13371 @opindex fno-common
13372 @opindex fcommon
13373 @cindex tentative definitions
13374 In C code, this option controls the placement of global variables
13375 defined without an initializer, known as @dfn{tentative definitions}
13376 in the C standard. Tentative definitions are distinct from declarations
13377 of a variable with the @code{extern} keyword, which do not allocate storage.
13378
13379 Unix C compilers have traditionally allocated storage for
13380 uninitialized global variables in a common block. This allows the
13381 linker to resolve all tentative definitions of the same variable
13382 in different compilation units to the same object, or to a non-tentative
13383 definition.
13384 This is the behavior specified by @option{-fcommon}, and is the default for
13385 GCC on most targets.
13386 On the other hand, this behavior is not required by ISO
13387 C, and on some targets may carry a speed or code size penalty on
13388 variable references.
13389
13390 The @option{-fno-common} option specifies that the compiler should instead
13391 place uninitialized global variables in the BSS section of the object file.
13392 This inhibits the merging of tentative definitions by the linker so
13393 you get a multiple-definition error if the same
13394 variable is defined in more than one compilation unit.
13395 Compiling with @option{-fno-common} is useful on targets for which
13396 it provides better performance, or if you wish to verify that the
13397 program will work on other systems that always treat uninitialized
13398 variable definitions this way.
13399
13400 @item -fno-ident
13401 @opindex fno-ident
13402 @opindex fident
13403 Ignore the @code{#ident} directive.
13404
13405 @item -finhibit-size-directive
13406 @opindex finhibit-size-directive
13407 Don't output a @code{.size} assembler directive, or anything else that
13408 would cause trouble if the function is split in the middle, and the
13409 two halves are placed at locations far apart in memory. This option is
13410 used when compiling @file{crtstuff.c}; you should not need to use it
13411 for anything else.
13412
13413 @item -fverbose-asm
13414 @opindex fverbose-asm
13415 Put extra commentary information in the generated assembly code to
13416 make it more readable. This option is generally only of use to those
13417 who actually need to read the generated assembly code (perhaps while
13418 debugging the compiler itself).
13419
13420 @option{-fno-verbose-asm}, the default, causes the
13421 extra information to be omitted and is useful when comparing two assembler
13422 files.
13423
13424 The added comments include:
13425
13426 @itemize @bullet
13427
13428 @item
13429 information on the compiler version and command-line options,
13430
13431 @item
13432 the source code lines associated with the assembly instructions,
13433 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13434
13435 @item
13436 hints on which high-level expressions correspond to
13437 the various assembly instruction operands.
13438
13439 @end itemize
13440
13441 For example, given this C source file:
13442
13443 @smallexample
13444 int test (int n)
13445 @{
13446 int i;
13447 int total = 0;
13448
13449 for (i = 0; i < n; i++)
13450 total += i * i;
13451
13452 return total;
13453 @}
13454 @end smallexample
13455
13456 compiling to (x86_64) assembly via @option{-S} and emitting the result
13457 direct to stdout via @option{-o} @option{-}
13458
13459 @smallexample
13460 gcc -S test.c -fverbose-asm -Os -o -
13461 @end smallexample
13462
13463 gives output similar to this:
13464
13465 @smallexample
13466 .file "test.c"
13467 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13468 [...snip...]
13469 # options passed:
13470 [...snip...]
13471
13472 .text
13473 .globl test
13474 .type test, @@function
13475 test:
13476 .LFB0:
13477 .cfi_startproc
13478 # test.c:4: int total = 0;
13479 xorl %eax, %eax # <retval>
13480 # test.c:6: for (i = 0; i < n; i++)
13481 xorl %edx, %edx # i
13482 .L2:
13483 # test.c:6: for (i = 0; i < n; i++)
13484 cmpl %edi, %edx # n, i
13485 jge .L5 #,
13486 # test.c:7: total += i * i;
13487 movl %edx, %ecx # i, tmp92
13488 imull %edx, %ecx # i, tmp92
13489 # test.c:6: for (i = 0; i < n; i++)
13490 incl %edx # i
13491 # test.c:7: total += i * i;
13492 addl %ecx, %eax # tmp92, <retval>
13493 jmp .L2 #
13494 .L5:
13495 # test.c:10: @}
13496 ret
13497 .cfi_endproc
13498 .LFE0:
13499 .size test, .-test
13500 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13501 .section .note.GNU-stack,"",@@progbits
13502 @end smallexample
13503
13504 The comments are intended for humans rather than machines and hence the
13505 precise format of the comments is subject to change.
13506
13507 @item -frecord-gcc-switches
13508 @opindex frecord-gcc-switches
13509 This switch causes the command line used to invoke the
13510 compiler to be recorded into the object file that is being created.
13511 This switch is only implemented on some targets and the exact format
13512 of the recording is target and binary file format dependent, but it
13513 usually takes the form of a section containing ASCII text. This
13514 switch is related to the @option{-fverbose-asm} switch, but that
13515 switch only records information in the assembler output file as
13516 comments, so it never reaches the object file.
13517 See also @option{-grecord-gcc-switches} for another
13518 way of storing compiler options into the object file.
13519
13520 @item -fpic
13521 @opindex fpic
13522 @cindex global offset table
13523 @cindex PIC
13524 Generate position-independent code (PIC) suitable for use in a shared
13525 library, if supported for the target machine. Such code accesses all
13526 constant addresses through a global offset table (GOT)@. The dynamic
13527 loader resolves the GOT entries when the program starts (the dynamic
13528 loader is not part of GCC; it is part of the operating system). If
13529 the GOT size for the linked executable exceeds a machine-specific
13530 maximum size, you get an error message from the linker indicating that
13531 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13532 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13533 on the m68k and RS/6000. The x86 has no such limit.)
13534
13535 Position-independent code requires special support, and therefore works
13536 only on certain machines. For the x86, GCC supports PIC for System V
13537 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13538 position-independent.
13539
13540 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13541 are defined to 1.
13542
13543 @item -fPIC
13544 @opindex fPIC
13545 If supported for the target machine, emit position-independent code,
13546 suitable for dynamic linking and avoiding any limit on the size of the
13547 global offset table. This option makes a difference on AArch64, m68k,
13548 PowerPC and SPARC@.
13549
13550 Position-independent code requires special support, and therefore works
13551 only on certain machines.
13552
13553 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13554 are defined to 2.
13555
13556 @item -fpie
13557 @itemx -fPIE
13558 @opindex fpie
13559 @opindex fPIE
13560 These options are similar to @option{-fpic} and @option{-fPIC}, but the
13561 generated position-independent code can be only linked into executables.
13562 Usually these options are used to compile code that will be linked using
13563 the @option{-pie} GCC option.
13564
13565 @option{-fpie} and @option{-fPIE} both define the macros
13566 @code{__pie__} and @code{__PIE__}. The macros have the value 1
13567 for @option{-fpie} and 2 for @option{-fPIE}.
13568
13569 @item -fno-plt
13570 @opindex fno-plt
13571 @opindex fplt
13572 Do not use the PLT for external function calls in position-independent code.
13573 Instead, load the callee address at call sites from the GOT and branch to it.
13574 This leads to more efficient code by eliminating PLT stubs and exposing
13575 GOT loads to optimizations. On architectures such as 32-bit x86 where
13576 PLT stubs expect the GOT pointer in a specific register, this gives more
13577 register allocation freedom to the compiler.
13578 Lazy binding requires use of the PLT;
13579 with @option{-fno-plt} all external symbols are resolved at load time.
13580
13581 Alternatively, the function attribute @code{noplt} can be used to avoid calls
13582 through the PLT for specific external functions.
13583
13584 In position-dependent code, a few targets also convert calls to
13585 functions that are marked to not use the PLT to use the GOT instead.
13586
13587 @item -fno-jump-tables
13588 @opindex fno-jump-tables
13589 @opindex fjump-tables
13590 Do not use jump tables for switch statements even where it would be
13591 more efficient than other code generation strategies. This option is
13592 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13593 building code that forms part of a dynamic linker and cannot
13594 reference the address of a jump table. On some targets, jump tables
13595 do not require a GOT and this option is not needed.
13596
13597 @item -ffixed-@var{reg}
13598 @opindex ffixed
13599 Treat the register named @var{reg} as a fixed register; generated code
13600 should never refer to it (except perhaps as a stack pointer, frame
13601 pointer or in some other fixed role).
13602
13603 @var{reg} must be the name of a register. The register names accepted
13604 are machine-specific and are defined in the @code{REGISTER_NAMES}
13605 macro in the machine description macro file.
13606
13607 This flag does not have a negative form, because it specifies a
13608 three-way choice.
13609
13610 @item -fcall-used-@var{reg}
13611 @opindex fcall-used
13612 Treat the register named @var{reg} as an allocable register that is
13613 clobbered by function calls. It may be allocated for temporaries or
13614 variables that do not live across a call. Functions compiled this way
13615 do not save and restore the register @var{reg}.
13616
13617 It is an error to use this flag with the frame pointer or stack pointer.
13618 Use of this flag for other registers that have fixed pervasive roles in
13619 the machine's execution model produces disastrous results.
13620
13621 This flag does not have a negative form, because it specifies a
13622 three-way choice.
13623
13624 @item -fcall-saved-@var{reg}
13625 @opindex fcall-saved
13626 Treat the register named @var{reg} as an allocable register saved by
13627 functions. It may be allocated even for temporaries or variables that
13628 live across a call. Functions compiled this way save and restore
13629 the register @var{reg} if they use it.
13630
13631 It is an error to use this flag with the frame pointer or stack pointer.
13632 Use of this flag for other registers that have fixed pervasive roles in
13633 the machine's execution model produces disastrous results.
13634
13635 A different sort of disaster results from the use of this flag for
13636 a register in which function values may be returned.
13637
13638 This flag does not have a negative form, because it specifies a
13639 three-way choice.
13640
13641 @item -fpack-struct[=@var{n}]
13642 @opindex fpack-struct
13643 Without a value specified, pack all structure members together without
13644 holes. When a value is specified (which must be a small power of two), pack
13645 structure members according to this value, representing the maximum
13646 alignment (that is, objects with default alignment requirements larger than
13647 this are output potentially unaligned at the next fitting location.
13648
13649 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13650 code that is not binary compatible with code generated without that switch.
13651 Additionally, it makes the code suboptimal.
13652 Use it to conform to a non-default application binary interface.
13653
13654 @item -fleading-underscore
13655 @opindex fleading-underscore
13656 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13657 change the way C symbols are represented in the object file. One use
13658 is to help link with legacy assembly code.
13659
13660 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13661 generate code that is not binary compatible with code generated without that
13662 switch. Use it to conform to a non-default application binary interface.
13663 Not all targets provide complete support for this switch.
13664
13665 @item -ftls-model=@var{model}
13666 @opindex ftls-model
13667 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13668 The @var{model} argument should be one of @samp{global-dynamic},
13669 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
13670 Note that the choice is subject to optimization: the compiler may use
13671 a more efficient model for symbols not visible outside of the translation
13672 unit, or if @option{-fpic} is not given on the command line.
13673
13674 The default without @option{-fpic} is @samp{initial-exec}; with
13675 @option{-fpic} the default is @samp{global-dynamic}.
13676
13677 @item -ftrampolines
13678 @opindex ftrampolines
13679 For targets that normally need trampolines for nested functions, always
13680 generate them instead of using descriptors. Otherwise, for targets that
13681 do not need them, like for example HP-PA or IA-64, do nothing.
13682
13683 A trampoline is a small piece of code that is created at run time on the
13684 stack when the address of a nested function is taken, and is used to call
13685 the nested function indirectly. Therefore, it requires the stack to be
13686 made executable in order for the program to work properly.
13687
13688 @option{-fno-trampolines} is enabled by default on a language by language
13689 basis to let the compiler avoid generating them, if it computes that this
13690 is safe, and replace them with descriptors. Descriptors are made up of data
13691 only, but the generated code must be prepared to deal with them. As of this
13692 writing, @option{-fno-trampolines} is enabled by default only for Ada.
13693
13694 Moreover, code compiled with @option{-ftrampolines} and code compiled with
13695 @option{-fno-trampolines} are not binary compatible if nested functions are
13696 present. This option must therefore be used on a program-wide basis and be
13697 manipulated with extreme care.
13698
13699 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
13700 @opindex fvisibility
13701 Set the default ELF image symbol visibility to the specified option---all
13702 symbols are marked with this unless overridden within the code.
13703 Using this feature can very substantially improve linking and
13704 load times of shared object libraries, produce more optimized
13705 code, provide near-perfect API export and prevent symbol clashes.
13706 It is @strong{strongly} recommended that you use this in any shared objects
13707 you distribute.
13708
13709 Despite the nomenclature, @samp{default} always means public; i.e.,
13710 available to be linked against from outside the shared object.
13711 @samp{protected} and @samp{internal} are pretty useless in real-world
13712 usage so the only other commonly used option is @samp{hidden}.
13713 The default if @option{-fvisibility} isn't specified is
13714 @samp{default}, i.e., make every symbol public.
13715
13716 A good explanation of the benefits offered by ensuring ELF
13717 symbols have the correct visibility is given by ``How To Write
13718 Shared Libraries'' by Ulrich Drepper (which can be found at
13719 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
13720 solution made possible by this option to marking things hidden when
13721 the default is public is to make the default hidden and mark things
13722 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
13723 and @code{__attribute__ ((visibility("default")))} instead of
13724 @code{__declspec(dllexport)} you get almost identical semantics with
13725 identical syntax. This is a great boon to those working with
13726 cross-platform projects.
13727
13728 For those adding visibility support to existing code, you may find
13729 @code{#pragma GCC visibility} of use. This works by you enclosing
13730 the declarations you wish to set visibility for with (for example)
13731 @code{#pragma GCC visibility push(hidden)} and
13732 @code{#pragma GCC visibility pop}.
13733 Bear in mind that symbol visibility should be viewed @strong{as
13734 part of the API interface contract} and thus all new code should
13735 always specify visibility when it is not the default; i.e., declarations
13736 only for use within the local DSO should @strong{always} be marked explicitly
13737 as hidden as so to avoid PLT indirection overheads---making this
13738 abundantly clear also aids readability and self-documentation of the code.
13739 Note that due to ISO C++ specification requirements, @code{operator new} and
13740 @code{operator delete} must always be of default visibility.
13741
13742 Be aware that headers from outside your project, in particular system
13743 headers and headers from any other library you use, may not be
13744 expecting to be compiled with visibility other than the default. You
13745 may need to explicitly say @code{#pragma GCC visibility push(default)}
13746 before including any such headers.
13747
13748 @code{extern} declarations are not affected by @option{-fvisibility}, so
13749 a lot of code can be recompiled with @option{-fvisibility=hidden} with
13750 no modifications. However, this means that calls to @code{extern}
13751 functions with no explicit visibility use the PLT, so it is more
13752 effective to use @code{__attribute ((visibility))} and/or
13753 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
13754 declarations should be treated as hidden.
13755
13756 Note that @option{-fvisibility} does affect C++ vague linkage
13757 entities. This means that, for instance, an exception class that is
13758 be thrown between DSOs must be explicitly marked with default
13759 visibility so that the @samp{type_info} nodes are unified between
13760 the DSOs.
13761
13762 An overview of these techniques, their benefits and how to use them
13763 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
13764
13765 @item -fstrict-volatile-bitfields
13766 @opindex fstrict-volatile-bitfields
13767 This option should be used if accesses to volatile bit-fields (or other
13768 structure fields, although the compiler usually honors those types
13769 anyway) should use a single access of the width of the
13770 field's type, aligned to a natural alignment if possible. For
13771 example, targets with memory-mapped peripheral registers might require
13772 all such accesses to be 16 bits wide; with this flag you can
13773 declare all peripheral bit-fields as @code{unsigned short} (assuming short
13774 is 16 bits on these targets) to force GCC to use 16-bit accesses
13775 instead of, perhaps, a more efficient 32-bit access.
13776
13777 If this option is disabled, the compiler uses the most efficient
13778 instruction. In the previous example, that might be a 32-bit load
13779 instruction, even though that accesses bytes that do not contain
13780 any portion of the bit-field, or memory-mapped registers unrelated to
13781 the one being updated.
13782
13783 In some cases, such as when the @code{packed} attribute is applied to a
13784 structure field, it may not be possible to access the field with a single
13785 read or write that is correctly aligned for the target machine. In this
13786 case GCC falls back to generating multiple accesses rather than code that
13787 will fault or truncate the result at run time.
13788
13789 Note: Due to restrictions of the C/C++11 memory model, write accesses are
13790 not allowed to touch non bit-field members. It is therefore recommended
13791 to define all bits of the field's type as bit-field members.
13792
13793 The default value of this option is determined by the application binary
13794 interface for the target processor.
13795
13796 @item -fsync-libcalls
13797 @opindex fsync-libcalls
13798 This option controls whether any out-of-line instance of the @code{__sync}
13799 family of functions may be used to implement the C++11 @code{__atomic}
13800 family of functions.
13801
13802 The default value of this option is enabled, thus the only useful form
13803 of the option is @option{-fno-sync-libcalls}. This option is used in
13804 the implementation of the @file{libatomic} runtime library.
13805
13806 @end table
13807
13808 @node Developer Options
13809 @section GCC Developer Options
13810 @cindex developer options
13811 @cindex debugging GCC
13812 @cindex debug dump options
13813 @cindex dump options
13814 @cindex compilation statistics
13815
13816 This section describes command-line options that are primarily of
13817 interest to GCC developers, including options to support compiler
13818 testing and investigation of compiler bugs and compile-time
13819 performance problems. This includes options that produce debug dumps
13820 at various points in the compilation; that print statistics such as
13821 memory use and execution time; and that print information about GCC's
13822 configuration, such as where it searches for libraries. You should
13823 rarely need to use any of these options for ordinary compilation and
13824 linking tasks.
13825
13826 Many developer options that cause GCC to dump output to a file take an
13827 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
13828 or @samp{-} to dump to standard output, and @samp{stderr} for standard
13829 error.
13830
13831 If @samp{=@var{filename}} is omitted, a default dump file name is
13832 constructed by concatenating the base dump file name, a pass number,
13833 phase letter, and pass name. The base dump file name is the name of
13834 output file produced by the compiler if explicitly specified and not
13835 an executable; otherwise it is the source file name.
13836 The pass number is determined by the order passes are registered with
13837 the compiler's pass manager.
13838 This is generally the same as the order of execution, but passes
13839 registered by plugins, target-specific passes, or passes that are
13840 otherwise registered late are numbered higher than the pass named
13841 @samp{final}, even if they are executed earlier. The phase letter is
13842 one of @samp{i} (inter-procedural analysis), @samp{l}
13843 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
13844 The files are created in the directory of the output file.
13845
13846 @table @gcctabopt
13847
13848 @item -d@var{letters}
13849 @itemx -fdump-rtl-@var{pass}
13850 @itemx -fdump-rtl-@var{pass}=@var{filename}
13851 @opindex d
13852 @opindex fdump-rtl-@var{pass}
13853 Says to make debugging dumps during compilation at times specified by
13854 @var{letters}. This is used for debugging the RTL-based passes of the
13855 compiler.
13856
13857 Some @option{-d@var{letters}} switches have different meaning when
13858 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
13859 for information about preprocessor-specific dump options.
13860
13861 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
13862 @option{-d} option @var{letters}. Here are the possible
13863 letters for use in @var{pass} and @var{letters}, and their meanings:
13864
13865 @table @gcctabopt
13866
13867 @item -fdump-rtl-alignments
13868 @opindex fdump-rtl-alignments
13869 Dump after branch alignments have been computed.
13870
13871 @item -fdump-rtl-asmcons
13872 @opindex fdump-rtl-asmcons
13873 Dump after fixing rtl statements that have unsatisfied in/out constraints.
13874
13875 @item -fdump-rtl-auto_inc_dec
13876 @opindex fdump-rtl-auto_inc_dec
13877 Dump after auto-inc-dec discovery. This pass is only run on
13878 architectures that have auto inc or auto dec instructions.
13879
13880 @item -fdump-rtl-barriers
13881 @opindex fdump-rtl-barriers
13882 Dump after cleaning up the barrier instructions.
13883
13884 @item -fdump-rtl-bbpart
13885 @opindex fdump-rtl-bbpart
13886 Dump after partitioning hot and cold basic blocks.
13887
13888 @item -fdump-rtl-bbro
13889 @opindex fdump-rtl-bbro
13890 Dump after block reordering.
13891
13892 @item -fdump-rtl-btl1
13893 @itemx -fdump-rtl-btl2
13894 @opindex fdump-rtl-btl2
13895 @opindex fdump-rtl-btl2
13896 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
13897 after the two branch
13898 target load optimization passes.
13899
13900 @item -fdump-rtl-bypass
13901 @opindex fdump-rtl-bypass
13902 Dump after jump bypassing and control flow optimizations.
13903
13904 @item -fdump-rtl-combine
13905 @opindex fdump-rtl-combine
13906 Dump after the RTL instruction combination pass.
13907
13908 @item -fdump-rtl-compgotos
13909 @opindex fdump-rtl-compgotos
13910 Dump after duplicating the computed gotos.
13911
13912 @item -fdump-rtl-ce1
13913 @itemx -fdump-rtl-ce2
13914 @itemx -fdump-rtl-ce3
13915 @opindex fdump-rtl-ce1
13916 @opindex fdump-rtl-ce2
13917 @opindex fdump-rtl-ce3
13918 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
13919 @option{-fdump-rtl-ce3} enable dumping after the three
13920 if conversion passes.
13921
13922 @item -fdump-rtl-cprop_hardreg
13923 @opindex fdump-rtl-cprop_hardreg
13924 Dump after hard register copy propagation.
13925
13926 @item -fdump-rtl-csa
13927 @opindex fdump-rtl-csa
13928 Dump after combining stack adjustments.
13929
13930 @item -fdump-rtl-cse1
13931 @itemx -fdump-rtl-cse2
13932 @opindex fdump-rtl-cse1
13933 @opindex fdump-rtl-cse2
13934 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
13935 the two common subexpression elimination passes.
13936
13937 @item -fdump-rtl-dce
13938 @opindex fdump-rtl-dce
13939 Dump after the standalone dead code elimination passes.
13940
13941 @item -fdump-rtl-dbr
13942 @opindex fdump-rtl-dbr
13943 Dump after delayed branch scheduling.
13944
13945 @item -fdump-rtl-dce1
13946 @itemx -fdump-rtl-dce2
13947 @opindex fdump-rtl-dce1
13948 @opindex fdump-rtl-dce2
13949 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
13950 the two dead store elimination passes.
13951
13952 @item -fdump-rtl-eh
13953 @opindex fdump-rtl-eh
13954 Dump after finalization of EH handling code.
13955
13956 @item -fdump-rtl-eh_ranges
13957 @opindex fdump-rtl-eh_ranges
13958 Dump after conversion of EH handling range regions.
13959
13960 @item -fdump-rtl-expand
13961 @opindex fdump-rtl-expand
13962 Dump after RTL generation.
13963
13964 @item -fdump-rtl-fwprop1
13965 @itemx -fdump-rtl-fwprop2
13966 @opindex fdump-rtl-fwprop1
13967 @opindex fdump-rtl-fwprop2
13968 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
13969 dumping after the two forward propagation passes.
13970
13971 @item -fdump-rtl-gcse1
13972 @itemx -fdump-rtl-gcse2
13973 @opindex fdump-rtl-gcse1
13974 @opindex fdump-rtl-gcse2
13975 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
13976 after global common subexpression elimination.
13977
13978 @item -fdump-rtl-init-regs
13979 @opindex fdump-rtl-init-regs
13980 Dump after the initialization of the registers.
13981
13982 @item -fdump-rtl-initvals
13983 @opindex fdump-rtl-initvals
13984 Dump after the computation of the initial value sets.
13985
13986 @item -fdump-rtl-into_cfglayout
13987 @opindex fdump-rtl-into_cfglayout
13988 Dump after converting to cfglayout mode.
13989
13990 @item -fdump-rtl-ira
13991 @opindex fdump-rtl-ira
13992 Dump after iterated register allocation.
13993
13994 @item -fdump-rtl-jump
13995 @opindex fdump-rtl-jump
13996 Dump after the second jump optimization.
13997
13998 @item -fdump-rtl-loop2
13999 @opindex fdump-rtl-loop2
14000 @option{-fdump-rtl-loop2} enables dumping after the rtl
14001 loop optimization passes.
14002
14003 @item -fdump-rtl-mach
14004 @opindex fdump-rtl-mach
14005 Dump after performing the machine dependent reorganization pass, if that
14006 pass exists.
14007
14008 @item -fdump-rtl-mode_sw
14009 @opindex fdump-rtl-mode_sw
14010 Dump after removing redundant mode switches.
14011
14012 @item -fdump-rtl-rnreg
14013 @opindex fdump-rtl-rnreg
14014 Dump after register renumbering.
14015
14016 @item -fdump-rtl-outof_cfglayout
14017 @opindex fdump-rtl-outof_cfglayout
14018 Dump after converting from cfglayout mode.
14019
14020 @item -fdump-rtl-peephole2
14021 @opindex fdump-rtl-peephole2
14022 Dump after the peephole pass.
14023
14024 @item -fdump-rtl-postreload
14025 @opindex fdump-rtl-postreload
14026 Dump after post-reload optimizations.
14027
14028 @item -fdump-rtl-pro_and_epilogue
14029 @opindex fdump-rtl-pro_and_epilogue
14030 Dump after generating the function prologues and epilogues.
14031
14032 @item -fdump-rtl-sched1
14033 @itemx -fdump-rtl-sched2
14034 @opindex fdump-rtl-sched1
14035 @opindex fdump-rtl-sched2
14036 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14037 after the basic block scheduling passes.
14038
14039 @item -fdump-rtl-ree
14040 @opindex fdump-rtl-ree
14041 Dump after sign/zero extension elimination.
14042
14043 @item -fdump-rtl-seqabstr
14044 @opindex fdump-rtl-seqabstr
14045 Dump after common sequence discovery.
14046
14047 @item -fdump-rtl-shorten
14048 @opindex fdump-rtl-shorten
14049 Dump after shortening branches.
14050
14051 @item -fdump-rtl-sibling
14052 @opindex fdump-rtl-sibling
14053 Dump after sibling call optimizations.
14054
14055 @item -fdump-rtl-split1
14056 @itemx -fdump-rtl-split2
14057 @itemx -fdump-rtl-split3
14058 @itemx -fdump-rtl-split4
14059 @itemx -fdump-rtl-split5
14060 @opindex fdump-rtl-split1
14061 @opindex fdump-rtl-split2
14062 @opindex fdump-rtl-split3
14063 @opindex fdump-rtl-split4
14064 @opindex fdump-rtl-split5
14065 These options enable dumping after five rounds of
14066 instruction splitting.
14067
14068 @item -fdump-rtl-sms
14069 @opindex fdump-rtl-sms
14070 Dump after modulo scheduling. This pass is only run on some
14071 architectures.
14072
14073 @item -fdump-rtl-stack
14074 @opindex fdump-rtl-stack
14075 Dump after conversion from GCC's ``flat register file'' registers to the
14076 x87's stack-like registers. This pass is only run on x86 variants.
14077
14078 @item -fdump-rtl-subreg1
14079 @itemx -fdump-rtl-subreg2
14080 @opindex fdump-rtl-subreg1
14081 @opindex fdump-rtl-subreg2
14082 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14083 the two subreg expansion passes.
14084
14085 @item -fdump-rtl-unshare
14086 @opindex fdump-rtl-unshare
14087 Dump after all rtl has been unshared.
14088
14089 @item -fdump-rtl-vartrack
14090 @opindex fdump-rtl-vartrack
14091 Dump after variable tracking.
14092
14093 @item -fdump-rtl-vregs
14094 @opindex fdump-rtl-vregs
14095 Dump after converting virtual registers to hard registers.
14096
14097 @item -fdump-rtl-web
14098 @opindex fdump-rtl-web
14099 Dump after live range splitting.
14100
14101 @item -fdump-rtl-regclass
14102 @itemx -fdump-rtl-subregs_of_mode_init
14103 @itemx -fdump-rtl-subregs_of_mode_finish
14104 @itemx -fdump-rtl-dfinit
14105 @itemx -fdump-rtl-dfinish
14106 @opindex fdump-rtl-regclass
14107 @opindex fdump-rtl-subregs_of_mode_init
14108 @opindex fdump-rtl-subregs_of_mode_finish
14109 @opindex fdump-rtl-dfinit
14110 @opindex fdump-rtl-dfinish
14111 These dumps are defined but always produce empty files.
14112
14113 @item -da
14114 @itemx -fdump-rtl-all
14115 @opindex da
14116 @opindex fdump-rtl-all
14117 Produce all the dumps listed above.
14118
14119 @item -dA
14120 @opindex dA
14121 Annotate the assembler output with miscellaneous debugging information.
14122
14123 @item -dD
14124 @opindex dD
14125 Dump all macro definitions, at the end of preprocessing, in addition to
14126 normal output.
14127
14128 @item -dH
14129 @opindex dH
14130 Produce a core dump whenever an error occurs.
14131
14132 @item -dp
14133 @opindex dp
14134 Annotate the assembler output with a comment indicating which
14135 pattern and alternative is used. The length and cost of each instruction are
14136 also printed.
14137
14138 @item -dP
14139 @opindex dP
14140 Dump the RTL in the assembler output as a comment before each instruction.
14141 Also turns on @option{-dp} annotation.
14142
14143 @item -dx
14144 @opindex dx
14145 Just generate RTL for a function instead of compiling it. Usually used
14146 with @option{-fdump-rtl-expand}.
14147 @end table
14148
14149 @item -fdump-debug
14150 @opindex fdump-debug
14151 Dump debugging information generated during the debug
14152 generation phase.
14153
14154 @item -fdump-earlydebug
14155 @opindex fdump-earlydebug
14156 Dump debugging information generated during the early debug
14157 generation phase.
14158
14159 @item -fdump-noaddr
14160 @opindex fdump-noaddr
14161 When doing debugging dumps, suppress address output. This makes it more
14162 feasible to use diff on debugging dumps for compiler invocations with
14163 different compiler binaries and/or different
14164 text / bss / data / heap / stack / dso start locations.
14165
14166 @item -freport-bug
14167 @opindex freport-bug
14168 Collect and dump debug information into a temporary file if an
14169 internal compiler error (ICE) occurs.
14170
14171 @item -fdump-unnumbered
14172 @opindex fdump-unnumbered
14173 When doing debugging dumps, suppress instruction numbers and address output.
14174 This makes it more feasible to use diff on debugging dumps for compiler
14175 invocations with different options, in particular with and without
14176 @option{-g}.
14177
14178 @item -fdump-unnumbered-links
14179 @opindex fdump-unnumbered-links
14180 When doing debugging dumps (see @option{-d} option above), suppress
14181 instruction numbers for the links to the previous and next instructions
14182 in a sequence.
14183
14184 @item -fdump-ipa-@var{switch}
14185 @itemx -fdump-ipa-@var{switch}-@var{options}
14186 @opindex fdump-ipa
14187 Control the dumping at various stages of inter-procedural analysis
14188 language tree to a file. The file name is generated by appending a
14189 switch specific suffix to the source file name, and the file is created
14190 in the same directory as the output file. The following dumps are
14191 possible:
14192
14193 @table @samp
14194 @item all
14195 Enables all inter-procedural analysis dumps.
14196
14197 @item cgraph
14198 Dumps information about call-graph optimization, unused function removal,
14199 and inlining decisions.
14200
14201 @item inline
14202 Dump after function inlining.
14203
14204 @end table
14205
14206 Additionally, the options @option{-optimized}, @option{-missed},
14207 @option{-note}, and @option{-all} can be provided, with the same meaning
14208 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14209
14210 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14211 information on callsites that were inlined, along with callsites
14212 that were not inlined.
14213
14214 By default, the dump will contain messages about successful
14215 optimizations (equivalent to @option{-optimized}) together with
14216 low-level details about the analysis.
14217
14218 @item -fdump-lang-all
14219 @itemx -fdump-lang-@var{switch}
14220 @itemx -fdump-lang-@var{switch}-@var{options}
14221 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14222 @opindex fdump-lang-all
14223 @opindex fdump-lang
14224 Control the dumping of language-specific information. The @var{options}
14225 and @var{filename} portions behave as described in the
14226 @option{-fdump-tree} option. The following @var{switch} values are
14227 accepted:
14228
14229 @table @samp
14230 @item all
14231
14232 Enable all language-specific dumps.
14233
14234 @item class
14235 Dump class hierarchy information. Virtual table information is emitted
14236 unless '@option{slim}' is specified. This option is applicable to C++ only.
14237
14238 @item raw
14239 Dump the raw internal tree data. This option is applicable to C++ only.
14240
14241 @end table
14242
14243 @item -fdump-passes
14244 @opindex fdump-passes
14245 Print on @file{stderr} the list of optimization passes that are turned
14246 on and off by the current command-line options.
14247
14248 @item -fdump-statistics-@var{option}
14249 @opindex fdump-statistics
14250 Enable and control dumping of pass statistics in a separate file. The
14251 file name is generated by appending a suffix ending in
14252 @samp{.statistics} to the source file name, and the file is created in
14253 the same directory as the output file. If the @samp{-@var{option}}
14254 form is used, @samp{-stats} causes counters to be summed over the
14255 whole compilation unit while @samp{-details} dumps every event as
14256 the passes generate them. The default with no option is to sum
14257 counters for each function compiled.
14258
14259 @item -fdump-tree-all
14260 @itemx -fdump-tree-@var{switch}
14261 @itemx -fdump-tree-@var{switch}-@var{options}
14262 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14263 @opindex fdump-tree-all
14264 @opindex fdump-tree
14265 Control the dumping at various stages of processing the intermediate
14266 language tree to a file. If the @samp{-@var{options}}
14267 form is used, @var{options} is a list of @samp{-} separated options
14268 which control the details of the dump. Not all options are applicable
14269 to all dumps; those that are not meaningful are ignored. The
14270 following options are available
14271
14272 @table @samp
14273 @item address
14274 Print the address of each node. Usually this is not meaningful as it
14275 changes according to the environment and source file. Its primary use
14276 is for tying up a dump file with a debug environment.
14277 @item asmname
14278 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14279 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14280 use working backward from mangled names in the assembly file.
14281 @item slim
14282 When dumping front-end intermediate representations, inhibit dumping
14283 of members of a scope or body of a function merely because that scope
14284 has been reached. Only dump such items when they are directly reachable
14285 by some other path.
14286
14287 When dumping pretty-printed trees, this option inhibits dumping the
14288 bodies of control structures.
14289
14290 When dumping RTL, print the RTL in slim (condensed) form instead of
14291 the default LISP-like representation.
14292 @item raw
14293 Print a raw representation of the tree. By default, trees are
14294 pretty-printed into a C-like representation.
14295 @item details
14296 Enable more detailed dumps (not honored by every dump option). Also
14297 include information from the optimization passes.
14298 @item stats
14299 Enable dumping various statistics about the pass (not honored by every dump
14300 option).
14301 @item blocks
14302 Enable showing basic block boundaries (disabled in raw dumps).
14303 @item graph
14304 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14305 dump a representation of the control flow graph suitable for viewing with
14306 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14307 the file is pretty-printed as a subgraph, so that GraphViz can render them
14308 all in a single plot.
14309
14310 This option currently only works for RTL dumps, and the RTL is always
14311 dumped in slim form.
14312 @item vops
14313 Enable showing virtual operands for every statement.
14314 @item lineno
14315 Enable showing line numbers for statements.
14316 @item uid
14317 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14318 @item verbose
14319 Enable showing the tree dump for each statement.
14320 @item eh
14321 Enable showing the EH region number holding each statement.
14322 @item scev
14323 Enable showing scalar evolution analysis details.
14324 @item optimized
14325 Enable showing optimization information (only available in certain
14326 passes).
14327 @item missed
14328 Enable showing missed optimization information (only available in certain
14329 passes).
14330 @item note
14331 Enable other detailed optimization information (only available in
14332 certain passes).
14333 @item all
14334 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14335 and @option{lineno}.
14336 @item optall
14337 Turn on all optimization options, i.e., @option{optimized},
14338 @option{missed}, and @option{note}.
14339 @end table
14340
14341 To determine what tree dumps are available or find the dump for a pass
14342 of interest follow the steps below.
14343
14344 @enumerate
14345 @item
14346 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14347 look for a code that corresponds to the pass you are interested in.
14348 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14349 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14350 The number at the end distinguishes distinct invocations of the same pass.
14351 @item
14352 To enable the creation of the dump file, append the pass code to
14353 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14354 to enable the dump from the Early Value Range Propagation pass, invoke
14355 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14356 specify the name of the dump file. If you don't specify one, GCC
14357 creates as described below.
14358 @item
14359 Find the pass dump in a file whose name is composed of three components
14360 separated by a period: the name of the source file GCC was invoked to
14361 compile, a numeric suffix indicating the pass number followed by the
14362 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14363 and finally the pass code. For example, the Early VRP pass dump might
14364 be in a file named @file{myfile.c.038t.evrp} in the current working
14365 directory. Note that the numeric codes are not stable and may change
14366 from one version of GCC to another.
14367 @end enumerate
14368
14369 @item -fopt-info
14370 @itemx -fopt-info-@var{options}
14371 @itemx -fopt-info-@var{options}=@var{filename}
14372 @opindex fopt-info
14373 Controls optimization dumps from various optimization passes. If the
14374 @samp{-@var{options}} form is used, @var{options} is a list of
14375 @samp{-} separated option keywords to select the dump details and
14376 optimizations.
14377
14378 The @var{options} can be divided into three groups:
14379 @enumerate
14380 @item
14381 options describing what kinds of messages should be emitted,
14382 @item
14383 options describing the verbosity of the dump, and
14384 @item
14385 options describing which optimizations should be included.
14386 @end enumerate
14387 The options from each group can be freely mixed as they are
14388 non-overlapping. However, in case of any conflicts,
14389 the later options override the earlier options on the command
14390 line.
14391
14392 The following options control which kinds of messages should be emitted:
14393
14394 @table @samp
14395 @item optimized
14396 Print information when an optimization is successfully applied. It is
14397 up to a pass to decide which information is relevant. For example, the
14398 vectorizer passes print the source location of loops which are
14399 successfully vectorized.
14400 @item missed
14401 Print information about missed optimizations. Individual passes
14402 control which information to include in the output.
14403 @item note
14404 Print verbose information about optimizations, such as certain
14405 transformations, more detailed messages about decisions etc.
14406 @item all
14407 Print detailed optimization information. This includes
14408 @samp{optimized}, @samp{missed}, and @samp{note}.
14409 @end table
14410
14411 The following option controls the dump verbosity:
14412
14413 @table @samp
14414 @item internals
14415 By default, only ``high-level'' messages are emitted. This option enables
14416 additional, more detailed, messages, which are likely to only be of interest
14417 to GCC developers.
14418 @end table
14419
14420 One or more of the following option keywords can be used to describe a
14421 group of optimizations:
14422
14423 @table @samp
14424 @item ipa
14425 Enable dumps from all interprocedural optimizations.
14426 @item loop
14427 Enable dumps from all loop optimizations.
14428 @item inline
14429 Enable dumps from all inlining optimizations.
14430 @item omp
14431 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14432 @item vec
14433 Enable dumps from all vectorization optimizations.
14434 @item optall
14435 Enable dumps from all optimizations. This is a superset of
14436 the optimization groups listed above.
14437 @end table
14438
14439 If @var{options} is
14440 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
14441 about successful optimizations from all the passes, omitting messages
14442 that are treated as ``internals''.
14443
14444 If the @var{filename} is provided, then the dumps from all the
14445 applicable optimizations are concatenated into the @var{filename}.
14446 Otherwise the dump is output onto @file{stderr}. Though multiple
14447 @option{-fopt-info} options are accepted, only one of them can include
14448 a @var{filename}. If other filenames are provided then all but the
14449 first such option are ignored.
14450
14451 Note that the output @var{filename} is overwritten
14452 in case of multiple translation units. If a combined output from
14453 multiple translation units is desired, @file{stderr} should be used
14454 instead.
14455
14456 In the following example, the optimization info is output to
14457 @file{stderr}:
14458
14459 @smallexample
14460 gcc -O3 -fopt-info
14461 @end smallexample
14462
14463 This example:
14464 @smallexample
14465 gcc -O3 -fopt-info-missed=missed.all
14466 @end smallexample
14467
14468 @noindent
14469 outputs missed optimization report from all the passes into
14470 @file{missed.all}, and this one:
14471
14472 @smallexample
14473 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14474 @end smallexample
14475
14476 @noindent
14477 prints information about missed optimization opportunities from
14478 vectorization passes on @file{stderr}.
14479 Note that @option{-fopt-info-vec-missed} is equivalent to
14480 @option{-fopt-info-missed-vec}. The order of the optimization group
14481 names and message types listed after @option{-fopt-info} does not matter.
14482
14483 As another example,
14484 @smallexample
14485 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14486 @end smallexample
14487
14488 @noindent
14489 outputs information about missed optimizations as well as
14490 optimized locations from all the inlining passes into
14491 @file{inline.txt}.
14492
14493 Finally, consider:
14494
14495 @smallexample
14496 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14497 @end smallexample
14498
14499 @noindent
14500 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
14501 in conflict since only one output file is allowed. In this case, only
14502 the first option takes effect and the subsequent options are
14503 ignored. Thus only @file{vec.miss} is produced which contains
14504 dumps from the vectorizer about missed opportunities.
14505
14506 @item -fsave-optimization-record
14507 @opindex fsave-optimization-record
14508 Write a SRCFILE.opt-record.json file detailing what optimizations
14509 were performed, for those optimizations that support @option{-fopt-info}.
14510
14511 This option is experimental and the format of the data within the JSON
14512 file is subject to change.
14513
14514 It is roughly equivalent to a machine-readable version of
14515 @option{-fopt-info-all}, as a collection of messages with source file,
14516 line number and column number, with the following additional data for
14517 each message:
14518
14519 @itemize @bullet
14520
14521 @item
14522 the execution count of the code being optimized, along with metadata about
14523 whether this was from actual profile data, or just an estimate, allowing
14524 consumers to prioritize messages by code hotness,
14525
14526 @item
14527 the function name of the code being optimized, where applicable,
14528
14529 @item
14530 the ``inlining chain'' for the code being optimized, so that when
14531 a function is inlined into several different places (which might
14532 themselves be inlined), the reader can distinguish between the copies,
14533
14534 @item
14535 objects identifying those parts of the message that refer to expressions,
14536 statements or symbol-table nodes, which of these categories they are, and,
14537 when available, their source code location,
14538
14539 @item
14540 the GCC pass that emitted the message, and
14541
14542 @item
14543 the location in GCC's own code from which the message was emitted
14544
14545 @end itemize
14546
14547 Additionally, some messages are logically nested within other
14548 messages, reflecting implementation details of the optimization
14549 passes.
14550
14551 @item -fsched-verbose=@var{n}
14552 @opindex fsched-verbose
14553 On targets that use instruction scheduling, this option controls the
14554 amount of debugging output the scheduler prints to the dump files.
14555
14556 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
14557 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
14558 For @var{n} greater than one, it also output basic block probabilities,
14559 detailed ready list information and unit/insn info. For @var{n} greater
14560 than two, it includes RTL at abort point, control-flow and regions info.
14561 And for @var{n} over four, @option{-fsched-verbose} also includes
14562 dependence info.
14563
14564
14565
14566 @item -fenable-@var{kind}-@var{pass}
14567 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
14568 @opindex fdisable-
14569 @opindex fenable-
14570
14571 This is a set of options that are used to explicitly disable/enable
14572 optimization passes. These options are intended for use for debugging GCC.
14573 Compiler users should use regular options for enabling/disabling
14574 passes instead.
14575
14576 @table @gcctabopt
14577
14578 @item -fdisable-ipa-@var{pass}
14579 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14580 statically invoked in the compiler multiple times, the pass name should be
14581 appended with a sequential number starting from 1.
14582
14583 @item -fdisable-rtl-@var{pass}
14584 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
14585 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
14586 statically invoked in the compiler multiple times, the pass name should be
14587 appended with a sequential number starting from 1. @var{range-list} is a
14588 comma-separated list of function ranges or assembler names. Each range is a number
14589 pair separated by a colon. The range is inclusive in both ends. If the range
14590 is trivial, the number pair can be simplified as a single number. If the
14591 function's call graph node's @var{uid} falls within one of the specified ranges,
14592 the @var{pass} is disabled for that function. The @var{uid} is shown in the
14593 function header of a dump file, and the pass names can be dumped by using
14594 option @option{-fdump-passes}.
14595
14596 @item -fdisable-tree-@var{pass}
14597 @itemx -fdisable-tree-@var{pass}=@var{range-list}
14598 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
14599 option arguments.
14600
14601 @item -fenable-ipa-@var{pass}
14602 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14603 statically invoked in the compiler multiple times, the pass name should be
14604 appended with a sequential number starting from 1.
14605
14606 @item -fenable-rtl-@var{pass}
14607 @itemx -fenable-rtl-@var{pass}=@var{range-list}
14608 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
14609 description and examples.
14610
14611 @item -fenable-tree-@var{pass}
14612 @itemx -fenable-tree-@var{pass}=@var{range-list}
14613 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
14614 of option arguments.
14615
14616 @end table
14617
14618 Here are some examples showing uses of these options.
14619
14620 @smallexample
14621
14622 # disable ccp1 for all functions
14623 -fdisable-tree-ccp1
14624 # disable complete unroll for function whose cgraph node uid is 1
14625 -fenable-tree-cunroll=1
14626 # disable gcse2 for functions at the following ranges [1,1],
14627 # [300,400], and [400,1000]
14628 # disable gcse2 for functions foo and foo2
14629 -fdisable-rtl-gcse2=foo,foo2
14630 # disable early inlining
14631 -fdisable-tree-einline
14632 # disable ipa inlining
14633 -fdisable-ipa-inline
14634 # enable tree full unroll
14635 -fenable-tree-unroll
14636
14637 @end smallexample
14638
14639 @item -fchecking
14640 @itemx -fchecking=@var{n}
14641 @opindex fchecking
14642 @opindex fno-checking
14643 Enable internal consistency checking. The default depends on
14644 the compiler configuration. @option{-fchecking=2} enables further
14645 internal consistency checking that might affect code generation.
14646
14647 @item -frandom-seed=@var{string}
14648 @opindex frandom-seed
14649 This option provides a seed that GCC uses in place of
14650 random numbers in generating certain symbol names
14651 that have to be different in every compiled file. It is also used to
14652 place unique stamps in coverage data files and the object files that
14653 produce them. You can use the @option{-frandom-seed} option to produce
14654 reproducibly identical object files.
14655
14656 The @var{string} can either be a number (decimal, octal or hex) or an
14657 arbitrary string (in which case it's converted to a number by
14658 computing CRC32).
14659
14660 The @var{string} should be different for every file you compile.
14661
14662 @item -save-temps
14663 @itemx -save-temps=cwd
14664 @opindex save-temps
14665 Store the usual ``temporary'' intermediate files permanently; place them
14666 in the current directory and name them based on the source file. Thus,
14667 compiling @file{foo.c} with @option{-c -save-temps} produces files
14668 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
14669 preprocessed @file{foo.i} output file even though the compiler now
14670 normally uses an integrated preprocessor.
14671
14672 When used in combination with the @option{-x} command-line option,
14673 @option{-save-temps} is sensible enough to avoid over writing an
14674 input source file with the same extension as an intermediate file.
14675 The corresponding intermediate file may be obtained by renaming the
14676 source file before using @option{-save-temps}.
14677
14678 If you invoke GCC in parallel, compiling several different source
14679 files that share a common base name in different subdirectories or the
14680 same source file compiled for multiple output destinations, it is
14681 likely that the different parallel compilers will interfere with each
14682 other, and overwrite the temporary files. For instance:
14683
14684 @smallexample
14685 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14686 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14687 @end smallexample
14688
14689 may result in @file{foo.i} and @file{foo.o} being written to
14690 simultaneously by both compilers.
14691
14692 @item -save-temps=obj
14693 @opindex save-temps=obj
14694 Store the usual ``temporary'' intermediate files permanently. If the
14695 @option{-o} option is used, the temporary files are based on the
14696 object file. If the @option{-o} option is not used, the
14697 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
14698
14699 For example:
14700
14701 @smallexample
14702 gcc -save-temps=obj -c foo.c
14703 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14704 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14705 @end smallexample
14706
14707 @noindent
14708 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
14709 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
14710 @file{dir2/yfoobar.o}.
14711
14712 @item -time@r{[}=@var{file}@r{]}
14713 @opindex time
14714 Report the CPU time taken by each subprocess in the compilation
14715 sequence. For C source files, this is the compiler proper and assembler
14716 (plus the linker if linking is done).
14717
14718 Without the specification of an output file, the output looks like this:
14719
14720 @smallexample
14721 # cc1 0.12 0.01
14722 # as 0.00 0.01
14723 @end smallexample
14724
14725 The first number on each line is the ``user time'', that is time spent
14726 executing the program itself. The second number is ``system time'',
14727 time spent executing operating system routines on behalf of the program.
14728 Both numbers are in seconds.
14729
14730 With the specification of an output file, the output is appended to the
14731 named file, and it looks like this:
14732
14733 @smallexample
14734 0.12 0.01 cc1 @var{options}
14735 0.00 0.01 as @var{options}
14736 @end smallexample
14737
14738 The ``user time'' and the ``system time'' are moved before the program
14739 name, and the options passed to the program are displayed, so that one
14740 can later tell what file was being compiled, and with which options.
14741
14742 @item -fdump-final-insns@r{[}=@var{file}@r{]}
14743 @opindex fdump-final-insns
14744 Dump the final internal representation (RTL) to @var{file}. If the
14745 optional argument is omitted (or if @var{file} is @code{.}), the name
14746 of the dump file is determined by appending @code{.gkd} to the
14747 compilation output file name.
14748
14749 @item -fcompare-debug@r{[}=@var{opts}@r{]}
14750 @opindex fcompare-debug
14751 @opindex fno-compare-debug
14752 If no error occurs during compilation, run the compiler a second time,
14753 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
14754 passed to the second compilation. Dump the final internal
14755 representation in both compilations, and print an error if they differ.
14756
14757 If the equal sign is omitted, the default @option{-gtoggle} is used.
14758
14759 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
14760 and nonzero, implicitly enables @option{-fcompare-debug}. If
14761 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
14762 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
14763 is used.
14764
14765 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
14766 is equivalent to @option{-fno-compare-debug}, which disables the dumping
14767 of the final representation and the second compilation, preventing even
14768 @env{GCC_COMPARE_DEBUG} from taking effect.
14769
14770 To verify full coverage during @option{-fcompare-debug} testing, set
14771 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
14772 which GCC rejects as an invalid option in any actual compilation
14773 (rather than preprocessing, assembly or linking). To get just a
14774 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
14775 not overridden} will do.
14776
14777 @item -fcompare-debug-second
14778 @opindex fcompare-debug-second
14779 This option is implicitly passed to the compiler for the second
14780 compilation requested by @option{-fcompare-debug}, along with options to
14781 silence warnings, and omitting other options that would cause the compiler
14782 to produce output to files or to standard output as a side effect. Dump
14783 files and preserved temporary files are renamed so as to contain the
14784 @code{.gk} additional extension during the second compilation, to avoid
14785 overwriting those generated by the first.
14786
14787 When this option is passed to the compiler driver, it causes the
14788 @emph{first} compilation to be skipped, which makes it useful for little
14789 other than debugging the compiler proper.
14790
14791 @item -gtoggle
14792 @opindex gtoggle
14793 Turn off generation of debug info, if leaving out this option
14794 generates it, or turn it on at level 2 otherwise. The position of this
14795 argument in the command line does not matter; it takes effect after all
14796 other options are processed, and it does so only once, no matter how
14797 many times it is given. This is mainly intended to be used with
14798 @option{-fcompare-debug}.
14799
14800 @item -fvar-tracking-assignments-toggle
14801 @opindex fvar-tracking-assignments-toggle
14802 @opindex fno-var-tracking-assignments-toggle
14803 Toggle @option{-fvar-tracking-assignments}, in the same way that
14804 @option{-gtoggle} toggles @option{-g}.
14805
14806 @item -Q
14807 @opindex Q
14808 Makes the compiler print out each function name as it is compiled, and
14809 print some statistics about each pass when it finishes.
14810
14811 @item -ftime-report
14812 @opindex ftime-report
14813 Makes the compiler print some statistics about the time consumed by each
14814 pass when it finishes.
14815
14816 @item -ftime-report-details
14817 @opindex ftime-report-details
14818 Record the time consumed by infrastructure parts separately for each pass.
14819
14820 @item -fira-verbose=@var{n}
14821 @opindex fira-verbose
14822 Control the verbosity of the dump file for the integrated register allocator.
14823 The default value is 5. If the value @var{n} is greater or equal to 10,
14824 the dump output is sent to stderr using the same format as @var{n} minus 10.
14825
14826 @item -flto-report
14827 @opindex flto-report
14828 Prints a report with internal details on the workings of the link-time
14829 optimizer. The contents of this report vary from version to version.
14830 It is meant to be useful to GCC developers when processing object
14831 files in LTO mode (via @option{-flto}).
14832
14833 Disabled by default.
14834
14835 @item -flto-report-wpa
14836 @opindex flto-report-wpa
14837 Like @option{-flto-report}, but only print for the WPA phase of Link
14838 Time Optimization.
14839
14840 @item -fmem-report
14841 @opindex fmem-report
14842 Makes the compiler print some statistics about permanent memory
14843 allocation when it finishes.
14844
14845 @item -fmem-report-wpa
14846 @opindex fmem-report-wpa
14847 Makes the compiler print some statistics about permanent memory
14848 allocation for the WPA phase only.
14849
14850 @item -fpre-ipa-mem-report
14851 @opindex fpre-ipa-mem-report
14852 @item -fpost-ipa-mem-report
14853 @opindex fpost-ipa-mem-report
14854 Makes the compiler print some statistics about permanent memory
14855 allocation before or after interprocedural optimization.
14856
14857 @item -fprofile-report
14858 @opindex fprofile-report
14859 Makes the compiler print some statistics about consistency of the
14860 (estimated) profile and effect of individual passes.
14861
14862 @item -fstack-usage
14863 @opindex fstack-usage
14864 Makes the compiler output stack usage information for the program, on a
14865 per-function basis. The filename for the dump is made by appending
14866 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
14867 the output file, if explicitly specified and it is not an executable,
14868 otherwise it is the basename of the source file. An entry is made up
14869 of three fields:
14870
14871 @itemize
14872 @item
14873 The name of the function.
14874 @item
14875 A number of bytes.
14876 @item
14877 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
14878 @end itemize
14879
14880 The qualifier @code{static} means that the function manipulates the stack
14881 statically: a fixed number of bytes are allocated for the frame on function
14882 entry and released on function exit; no stack adjustments are otherwise made
14883 in the function. The second field is this fixed number of bytes.
14884
14885 The qualifier @code{dynamic} means that the function manipulates the stack
14886 dynamically: in addition to the static allocation described above, stack
14887 adjustments are made in the body of the function, for example to push/pop
14888 arguments around function calls. If the qualifier @code{bounded} is also
14889 present, the amount of these adjustments is bounded at compile time and
14890 the second field is an upper bound of the total amount of stack used by
14891 the function. If it is not present, the amount of these adjustments is
14892 not bounded at compile time and the second field only represents the
14893 bounded part.
14894
14895 @item -fstats
14896 @opindex fstats
14897 Emit statistics about front-end processing at the end of the compilation.
14898 This option is supported only by the C++ front end, and
14899 the information is generally only useful to the G++ development team.
14900
14901 @item -fdbg-cnt-list
14902 @opindex fdbg-cnt-list
14903 Print the name and the counter upper bound for all debug counters.
14904
14905
14906 @item -fdbg-cnt=@var{counter-value-list}
14907 @opindex fdbg-cnt
14908 Set the internal debug counter lower and upper bound. @var{counter-value-list}
14909 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
14910 tuples which sets the lower and the upper bound of each debug
14911 counter @var{name}. The @var{lower_bound} is optional and is zero
14912 initialized if not set.
14913 All debug counters have the initial upper bound of @code{UINT_MAX};
14914 thus @code{dbg_cnt} returns true always unless the upper bound
14915 is set by this option.
14916 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
14917 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
14918 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
14919
14920 @item -print-file-name=@var{library}
14921 @opindex print-file-name
14922 Print the full absolute name of the library file @var{library} that
14923 would be used when linking---and don't do anything else. With this
14924 option, GCC does not compile or link anything; it just prints the
14925 file name.
14926
14927 @item -print-multi-directory
14928 @opindex print-multi-directory
14929 Print the directory name corresponding to the multilib selected by any
14930 other switches present in the command line. This directory is supposed
14931 to exist in @env{GCC_EXEC_PREFIX}.
14932
14933 @item -print-multi-lib
14934 @opindex print-multi-lib
14935 Print the mapping from multilib directory names to compiler switches
14936 that enable them. The directory name is separated from the switches by
14937 @samp{;}, and each switch starts with an @samp{@@} instead of the
14938 @samp{-}, without spaces between multiple switches. This is supposed to
14939 ease shell processing.
14940
14941 @item -print-multi-os-directory
14942 @opindex print-multi-os-directory
14943 Print the path to OS libraries for the selected
14944 multilib, relative to some @file{lib} subdirectory. If OS libraries are
14945 present in the @file{lib} subdirectory and no multilibs are used, this is
14946 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
14947 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
14948 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
14949 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
14950
14951 @item -print-multiarch
14952 @opindex print-multiarch
14953 Print the path to OS libraries for the selected multiarch,
14954 relative to some @file{lib} subdirectory.
14955
14956 @item -print-prog-name=@var{program}
14957 @opindex print-prog-name
14958 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
14959
14960 @item -print-libgcc-file-name
14961 @opindex print-libgcc-file-name
14962 Same as @option{-print-file-name=libgcc.a}.
14963
14964 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
14965 but you do want to link with @file{libgcc.a}. You can do:
14966
14967 @smallexample
14968 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
14969 @end smallexample
14970
14971 @item -print-search-dirs
14972 @opindex print-search-dirs
14973 Print the name of the configured installation directory and a list of
14974 program and library directories @command{gcc} searches---and don't do anything else.
14975
14976 This is useful when @command{gcc} prints the error message
14977 @samp{installation problem, cannot exec cpp0: No such file or directory}.
14978 To resolve this you either need to put @file{cpp0} and the other compiler
14979 components where @command{gcc} expects to find them, or you can set the environment
14980 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
14981 Don't forget the trailing @samp{/}.
14982 @xref{Environment Variables}.
14983
14984 @item -print-sysroot
14985 @opindex print-sysroot
14986 Print the target sysroot directory that is used during
14987 compilation. This is the target sysroot specified either at configure
14988 time or using the @option{--sysroot} option, possibly with an extra
14989 suffix that depends on compilation options. If no target sysroot is
14990 specified, the option prints nothing.
14991
14992 @item -print-sysroot-headers-suffix
14993 @opindex print-sysroot-headers-suffix
14994 Print the suffix added to the target sysroot when searching for
14995 headers, or give an error if the compiler is not configured with such
14996 a suffix---and don't do anything else.
14997
14998 @item -dumpmachine
14999 @opindex dumpmachine
15000 Print the compiler's target machine (for example,
15001 @samp{i686-pc-linux-gnu})---and don't do anything else.
15002
15003 @item -dumpversion
15004 @opindex dumpversion
15005 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15006 anything else. This is the compiler version used in filesystem paths and
15007 specs. Depending on how the compiler has been configured it can be just
15008 a single number (major version), two numbers separated by a dot (major and
15009 minor version) or three numbers separated by dots (major, minor and patchlevel
15010 version).
15011
15012 @item -dumpfullversion
15013 @opindex dumpfullversion
15014 Print the full compiler version---and don't do anything else. The output is
15015 always three numbers separated by dots, major, minor and patchlevel version.
15016
15017 @item -dumpspecs
15018 @opindex dumpspecs
15019 Print the compiler's built-in specs---and don't do anything else. (This
15020 is used when GCC itself is being built.) @xref{Spec Files}.
15021 @end table
15022
15023 @node Submodel Options
15024 @section Machine-Dependent Options
15025 @cindex submodel options
15026 @cindex specifying hardware config
15027 @cindex hardware models and configurations, specifying
15028 @cindex target-dependent options
15029 @cindex machine-dependent options
15030
15031 Each target machine supported by GCC can have its own options---for
15032 example, to allow you to compile for a particular processor variant or
15033 ABI, or to control optimizations specific to that machine. By
15034 convention, the names of machine-specific options start with
15035 @samp{-m}.
15036
15037 Some configurations of the compiler also support additional target-specific
15038 options, usually for compatibility with other compilers on the same
15039 platform.
15040
15041 @c This list is ordered alphanumerically by subsection name.
15042 @c It should be the same order and spelling as these options are listed
15043 @c in Machine Dependent Options
15044
15045 @menu
15046 * AArch64 Options::
15047 * Adapteva Epiphany Options::
15048 * ARC Options::
15049 * ARM Options::
15050 * AVR Options::
15051 * Blackfin Options::
15052 * C6X Options::
15053 * CRIS Options::
15054 * CR16 Options::
15055 * C-SKY Options::
15056 * Darwin Options::
15057 * DEC Alpha Options::
15058 * FR30 Options::
15059 * FT32 Options::
15060 * FRV Options::
15061 * GNU/Linux Options::
15062 * H8/300 Options::
15063 * HPPA Options::
15064 * IA-64 Options::
15065 * LM32 Options::
15066 * M32C Options::
15067 * M32R/D Options::
15068 * M680x0 Options::
15069 * MCore Options::
15070 * MeP Options::
15071 * MicroBlaze Options::
15072 * MIPS Options::
15073 * MMIX Options::
15074 * MN10300 Options::
15075 * Moxie Options::
15076 * MSP430 Options::
15077 * NDS32 Options::
15078 * Nios II Options::
15079 * Nvidia PTX Options::
15080 * OpenRISC Options::
15081 * PDP-11 Options::
15082 * picoChip Options::
15083 * PowerPC Options::
15084 * PowerPC SPE Options::
15085 * RISC-V Options::
15086 * RL78 Options::
15087 * RS/6000 and PowerPC Options::
15088 * RX Options::
15089 * S/390 and zSeries Options::
15090 * Score Options::
15091 * SH Options::
15092 * Solaris 2 Options::
15093 * SPARC Options::
15094 * SPU Options::
15095 * System V Options::
15096 * TILE-Gx Options::
15097 * TILEPro Options::
15098 * V850 Options::
15099 * VAX Options::
15100 * Visium Options::
15101 * VMS Options::
15102 * VxWorks Options::
15103 * x86 Options::
15104 * x86 Windows Options::
15105 * Xstormy16 Options::
15106 * Xtensa Options::
15107 * zSeries Options::
15108 @end menu
15109
15110 @node AArch64 Options
15111 @subsection AArch64 Options
15112 @cindex AArch64 Options
15113
15114 These options are defined for AArch64 implementations:
15115
15116 @table @gcctabopt
15117
15118 @item -mabi=@var{name}
15119 @opindex mabi
15120 Generate code for the specified data model. Permissible values
15121 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15122 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15123 but long int and pointers are 64 bits.
15124
15125 The default depends on the specific target configuration. Note that
15126 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15127 entire program with the same ABI, and link with a compatible set of libraries.
15128
15129 @item -mbig-endian
15130 @opindex mbig-endian
15131 Generate big-endian code. This is the default when GCC is configured for an
15132 @samp{aarch64_be-*-*} target.
15133
15134 @item -mgeneral-regs-only
15135 @opindex mgeneral-regs-only
15136 Generate code which uses only the general-purpose registers. This will prevent
15137 the compiler from using floating-point and Advanced SIMD registers but will not
15138 impose any restrictions on the assembler.
15139
15140 @item -mlittle-endian
15141 @opindex mlittle-endian
15142 Generate little-endian code. This is the default when GCC is configured for an
15143 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15144
15145 @item -mcmodel=tiny
15146 @opindex mcmodel=tiny
15147 Generate code for the tiny code model. The program and its statically defined
15148 symbols must be within 1MB of each other. Programs can be statically or
15149 dynamically linked.
15150
15151 @item -mcmodel=small
15152 @opindex mcmodel=small
15153 Generate code for the small code model. The program and its statically defined
15154 symbols must be within 4GB of each other. Programs can be statically or
15155 dynamically linked. This is the default code model.
15156
15157 @item -mcmodel=large
15158 @opindex mcmodel=large
15159 Generate code for the large code model. This makes no assumptions about
15160 addresses and sizes of sections. Programs can be statically linked only.
15161
15162 @item -mstrict-align
15163 @itemx -mno-strict-align
15164 @opindex mstrict-align
15165 @opindex mno-strict-align
15166 Avoid or allow generating memory accesses that may not be aligned on a natural
15167 object boundary as described in the architecture specification.
15168
15169 @item -momit-leaf-frame-pointer
15170 @itemx -mno-omit-leaf-frame-pointer
15171 @opindex momit-leaf-frame-pointer
15172 @opindex mno-omit-leaf-frame-pointer
15173 Omit or keep the frame pointer in leaf functions. The former behavior is the
15174 default.
15175
15176 @item -mtls-dialect=desc
15177 @opindex mtls-dialect=desc
15178 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15179 of TLS variables. This is the default.
15180
15181 @item -mtls-dialect=traditional
15182 @opindex mtls-dialect=traditional
15183 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15184 of TLS variables.
15185
15186 @item -mtls-size=@var{size}
15187 @opindex mtls-size
15188 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15189 This option requires binutils 2.26 or newer.
15190
15191 @item -mfix-cortex-a53-835769
15192 @itemx -mno-fix-cortex-a53-835769
15193 @opindex mfix-cortex-a53-835769
15194 @opindex mno-fix-cortex-a53-835769
15195 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15196 This involves inserting a NOP instruction between memory instructions and
15197 64-bit integer multiply-accumulate instructions.
15198
15199 @item -mfix-cortex-a53-843419
15200 @itemx -mno-fix-cortex-a53-843419
15201 @opindex mfix-cortex-a53-843419
15202 @opindex mno-fix-cortex-a53-843419
15203 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15204 This erratum workaround is made at link time and this will only pass the
15205 corresponding flag to the linker.
15206
15207 @item -mlow-precision-recip-sqrt
15208 @itemx -mno-low-precision-recip-sqrt
15209 @opindex mlow-precision-recip-sqrt
15210 @opindex mno-low-precision-recip-sqrt
15211 Enable or disable the reciprocal square root approximation.
15212 This option only has an effect if @option{-ffast-math} or
15213 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15214 precision of reciprocal square root results to about 16 bits for
15215 single precision and to 32 bits for double precision.
15216
15217 @item -mlow-precision-sqrt
15218 @itemx -mno-low-precision-sqrt
15219 @opindex mlow-precision-sqrt
15220 @opindex mno-low-precision-sqrt
15221 Enable or disable the square root approximation.
15222 This option only has an effect if @option{-ffast-math} or
15223 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15224 precision of square root results to about 16 bits for
15225 single precision and to 32 bits for double precision.
15226 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15227
15228 @item -mlow-precision-div
15229 @itemx -mno-low-precision-div
15230 @opindex mlow-precision-div
15231 @opindex mno-low-precision-div
15232 Enable or disable the division approximation.
15233 This option only has an effect if @option{-ffast-math} or
15234 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15235 precision of division results to about 16 bits for
15236 single precision and to 32 bits for double precision.
15237
15238 @item -mtrack-speculation
15239 @itemx -mno-track-speculation
15240 Enable or disable generation of additional code to track speculative
15241 execution through conditional branches. The tracking state can then
15242 be used by the compiler when expanding calls to
15243 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15244 sequence to be generated.
15245
15246 @item -march=@var{name}
15247 @opindex march
15248 Specify the name of the target architecture and, optionally, one or
15249 more feature modifiers. This option has the form
15250 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15251
15252 The permissible values for @var{arch} are @samp{armv8-a},
15253 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
15254 or @var{native}.
15255
15256 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15257 support for the ARMv8.4-A architecture extensions.
15258
15259 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15260 support for the ARMv8.3-A architecture extensions.
15261
15262 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15263 support for the ARMv8.2-A architecture extensions.
15264
15265 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15266 support for the ARMv8.1-A architecture extension. In particular, it
15267 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15268
15269 The value @samp{native} is available on native AArch64 GNU/Linux and
15270 causes the compiler to pick the architecture of the host system. This
15271 option has no effect if the compiler is unable to recognize the
15272 architecture of the host system,
15273
15274 The permissible values for @var{feature} are listed in the sub-section
15275 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15276 Feature Modifiers}. Where conflicting feature modifiers are
15277 specified, the right-most feature is used.
15278
15279 GCC uses @var{name} to determine what kind of instructions it can emit
15280 when generating assembly code. If @option{-march} is specified
15281 without either of @option{-mtune} or @option{-mcpu} also being
15282 specified, the code is tuned to perform well across a range of target
15283 processors implementing the target architecture.
15284
15285 @item -mtune=@var{name}
15286 @opindex mtune
15287 Specify the name of the target processor for which GCC should tune the
15288 performance of the code. Permissible values for this option are:
15289 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15290 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15291 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{falkor},
15292 @samp{qdf24xx}, @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
15293 @samp{thunderx}, @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
15294 @samp{tsv110}, @samp{thunderxt83}, @samp{thunderx2t99},
15295 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15296 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15297 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15298 @samp{native}.
15299
15300 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15301 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15302 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15303 should tune for a big.LITTLE system.
15304
15305 Additionally on native AArch64 GNU/Linux systems the value
15306 @samp{native} tunes performance to the host system. This option has no effect
15307 if the compiler is unable to recognize the processor of the host system.
15308
15309 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15310 are specified, the code is tuned to perform well across a range
15311 of target processors.
15312
15313 This option cannot be suffixed by feature modifiers.
15314
15315 @item -mcpu=@var{name}
15316 @opindex mcpu
15317 Specify the name of the target processor, optionally suffixed by one
15318 or more feature modifiers. This option has the form
15319 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15320 the permissible values for @var{cpu} are the same as those available
15321 for @option{-mtune}. The permissible values for @var{feature} are
15322 documented in the sub-section on
15323 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15324 Feature Modifiers}. Where conflicting feature modifiers are
15325 specified, the right-most feature is used.
15326
15327 GCC uses @var{name} to determine what kind of instructions it can emit when
15328 generating assembly code (as if by @option{-march}) and to determine
15329 the target processor for which to tune for performance (as if
15330 by @option{-mtune}). Where this option is used in conjunction
15331 with @option{-march} or @option{-mtune}, those options take precedence
15332 over the appropriate part of this option.
15333
15334 @item -moverride=@var{string}
15335 @opindex moverride
15336 Override tuning decisions made by the back-end in response to a
15337 @option{-mtune=} switch. The syntax, semantics, and accepted values
15338 for @var{string} in this option are not guaranteed to be consistent
15339 across releases.
15340
15341 This option is only intended to be useful when developing GCC.
15342
15343 @item -mverbose-cost-dump
15344 @opindex mverbose-cost-dump
15345 Enable verbose cost model dumping in the debug dump files. This option is
15346 provided for use in debugging the compiler.
15347
15348 @item -mpc-relative-literal-loads
15349 @itemx -mno-pc-relative-literal-loads
15350 @opindex mpc-relative-literal-loads
15351 @opindex mno-pc-relative-literal-loads
15352 Enable or disable PC-relative literal loads. With this option literal pools are
15353 accessed using a single instruction and emitted after each function. This
15354 limits the maximum size of functions to 1MB. This is enabled by default for
15355 @option{-mcmodel=tiny}.
15356
15357 @item -msign-return-address=@var{scope}
15358 @opindex msign-return-address
15359 Select the function scope on which return address signing will be applied.
15360 Permissible values are @samp{none}, which disables return address signing,
15361 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15362 functions, and @samp{all}, which enables pointer signing for all functions. The
15363 default value is @samp{none}.
15364
15365 @item -msve-vector-bits=@var{bits}
15366 @opindex msve-vector-bits
15367 Specify the number of bits in an SVE vector register. This option only has
15368 an effect when SVE is enabled.
15369
15370 GCC supports two forms of SVE code generation: ``vector-length
15371 agnostic'' output that works with any size of vector register and
15372 ``vector-length specific'' output that only works when the vector
15373 registers are a particular size. Replacing @var{bits} with
15374 @samp{scalable} selects vector-length agnostic output while
15375 replacing it with a number selects vector-length specific output.
15376 The possible lengths in the latter case are: 128, 256, 512, 1024
15377 and 2048. @samp{scalable} is the default.
15378
15379 At present, @samp{-msve-vector-bits=128} produces the same output
15380 as @samp{-msve-vector-bits=scalable}.
15381
15382 @end table
15383
15384 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
15385 @anchor{aarch64-feature-modifiers}
15386 @cindex @option{-march} feature modifiers
15387 @cindex @option{-mcpu} feature modifiers
15388 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
15389 the following and their inverses @option{no@var{feature}}:
15390
15391 @table @samp
15392 @item crc
15393 Enable CRC extension. This is on by default for
15394 @option{-march=armv8.1-a}.
15395 @item crypto
15396 Enable Crypto extension. This also enables Advanced SIMD and floating-point
15397 instructions.
15398 @item fp
15399 Enable floating-point instructions. This is on by default for all possible
15400 values for options @option{-march} and @option{-mcpu}.
15401 @item simd
15402 Enable Advanced SIMD instructions. This also enables floating-point
15403 instructions. This is on by default for all possible values for options
15404 @option{-march} and @option{-mcpu}.
15405 @item sve
15406 Enable Scalable Vector Extension instructions. This also enables Advanced
15407 SIMD and floating-point instructions.
15408 @item lse
15409 Enable Large System Extension instructions. This is on by default for
15410 @option{-march=armv8.1-a}.
15411 @item rdma
15412 Enable Round Double Multiply Accumulate instructions. This is on by default
15413 for @option{-march=armv8.1-a}.
15414 @item fp16
15415 Enable FP16 extension. This also enables floating-point instructions.
15416 @item fp16fml
15417 Enable FP16 fmla extension. This also enables FP16 extensions and
15418 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.
15419
15420 @item rcpc
15421 Enable the RcPc extension. This does not change code generation from GCC,
15422 but is passed on to the assembler, enabling inline asm statements to use
15423 instructions from the RcPc extension.
15424 @item dotprod
15425 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
15426 @item aes
15427 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
15428 SIMD instructions.
15429 @item sha2
15430 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
15431 @item sha3
15432 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
15433 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
15434 @item sm4
15435 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
15436 Use of this option with architectures prior to Armv8.2-A is not supported.
15437 @item profile
15438 Enable the Statistical Profiling extension. This option is only to enable the
15439 extension at the assembler level and does not affect code generation.
15440
15441 @end table
15442
15443 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
15444 which implies @option{fp}.
15445 Conversely, @option{nofp} implies @option{nosimd}, which implies
15446 @option{nocrypto}, @option{noaes} and @option{nosha2}.
15447
15448 @node Adapteva Epiphany Options
15449 @subsection Adapteva Epiphany Options
15450
15451 These @samp{-m} options are defined for Adapteva Epiphany:
15452
15453 @table @gcctabopt
15454 @item -mhalf-reg-file
15455 @opindex mhalf-reg-file
15456 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
15457 That allows code to run on hardware variants that lack these registers.
15458
15459 @item -mprefer-short-insn-regs
15460 @opindex mprefer-short-insn-regs
15461 Preferentially allocate registers that allow short instruction generation.
15462 This can result in increased instruction count, so this may either reduce or
15463 increase overall code size.
15464
15465 @item -mbranch-cost=@var{num}
15466 @opindex mbranch-cost
15467 Set the cost of branches to roughly @var{num} ``simple'' instructions.
15468 This cost is only a heuristic and is not guaranteed to produce
15469 consistent results across releases.
15470
15471 @item -mcmove
15472 @opindex mcmove
15473 Enable the generation of conditional moves.
15474
15475 @item -mnops=@var{num}
15476 @opindex mnops
15477 Emit @var{num} NOPs before every other generated instruction.
15478
15479 @item -mno-soft-cmpsf
15480 @opindex mno-soft-cmpsf
15481 @opindex msoft-cmpsf
15482 For single-precision floating-point comparisons, emit an @code{fsub} instruction
15483 and test the flags. This is faster than a software comparison, but can
15484 get incorrect results in the presence of NaNs, or when two different small
15485 numbers are compared such that their difference is calculated as zero.
15486 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
15487 software comparisons.
15488
15489 @item -mstack-offset=@var{num}
15490 @opindex mstack-offset
15491 Set the offset between the top of the stack and the stack pointer.
15492 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
15493 can be used by leaf functions without stack allocation.
15494 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
15495 Note also that this option changes the ABI; compiling a program with a
15496 different stack offset than the libraries have been compiled with
15497 generally does not work.
15498 This option can be useful if you want to evaluate if a different stack
15499 offset would give you better code, but to actually use a different stack
15500 offset to build working programs, it is recommended to configure the
15501 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
15502
15503 @item -mno-round-nearest
15504 @opindex mno-round-nearest
15505 @opindex mround-nearest
15506 Make the scheduler assume that the rounding mode has been set to
15507 truncating. The default is @option{-mround-nearest}.
15508
15509 @item -mlong-calls
15510 @opindex mlong-calls
15511 If not otherwise specified by an attribute, assume all calls might be beyond
15512 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
15513 function address into a register before performing a (otherwise direct) call.
15514 This is the default.
15515
15516 @item -mshort-calls
15517 @opindex short-calls
15518 If not otherwise specified by an attribute, assume all direct calls are
15519 in the range of the @code{b} / @code{bl} instructions, so use these instructions
15520 for direct calls. The default is @option{-mlong-calls}.
15521
15522 @item -msmall16
15523 @opindex msmall16
15524 Assume addresses can be loaded as 16-bit unsigned values. This does not
15525 apply to function addresses for which @option{-mlong-calls} semantics
15526 are in effect.
15527
15528 @item -mfp-mode=@var{mode}
15529 @opindex mfp-mode
15530 Set the prevailing mode of the floating-point unit.
15531 This determines the floating-point mode that is provided and expected
15532 at function call and return time. Making this mode match the mode you
15533 predominantly need at function start can make your programs smaller and
15534 faster by avoiding unnecessary mode switches.
15535
15536 @var{mode} can be set to one the following values:
15537
15538 @table @samp
15539 @item caller
15540 Any mode at function entry is valid, and retained or restored when
15541 the function returns, and when it calls other functions.
15542 This mode is useful for compiling libraries or other compilation units
15543 you might want to incorporate into different programs with different
15544 prevailing FPU modes, and the convenience of being able to use a single
15545 object file outweighs the size and speed overhead for any extra
15546 mode switching that might be needed, compared with what would be needed
15547 with a more specific choice of prevailing FPU mode.
15548
15549 @item truncate
15550 This is the mode used for floating-point calculations with
15551 truncating (i.e.@: round towards zero) rounding mode. That includes
15552 conversion from floating point to integer.
15553
15554 @item round-nearest
15555 This is the mode used for floating-point calculations with
15556 round-to-nearest-or-even rounding mode.
15557
15558 @item int
15559 This is the mode used to perform integer calculations in the FPU, e.g.@:
15560 integer multiply, or integer multiply-and-accumulate.
15561 @end table
15562
15563 The default is @option{-mfp-mode=caller}
15564
15565 @item -mno-split-lohi
15566 @itemx -mno-postinc
15567 @itemx -mno-postmodify
15568 @opindex mno-split-lohi
15569 @opindex msplit-lohi
15570 @opindex mno-postinc
15571 @opindex mpostinc
15572 @opindex mno-postmodify
15573 @opindex mpostmodify
15574 Code generation tweaks that disable, respectively, splitting of 32-bit
15575 loads, generation of post-increment addresses, and generation of
15576 post-modify addresses. The defaults are @option{msplit-lohi},
15577 @option{-mpost-inc}, and @option{-mpost-modify}.
15578
15579 @item -mnovect-double
15580 @opindex mno-vect-double
15581 @opindex mvect-double
15582 Change the preferred SIMD mode to SImode. The default is
15583 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
15584
15585 @item -max-vect-align=@var{num}
15586 @opindex max-vect-align
15587 The maximum alignment for SIMD vector mode types.
15588 @var{num} may be 4 or 8. The default is 8.
15589 Note that this is an ABI change, even though many library function
15590 interfaces are unaffected if they don't use SIMD vector modes
15591 in places that affect size and/or alignment of relevant types.
15592
15593 @item -msplit-vecmove-early
15594 @opindex msplit-vecmove-early
15595 Split vector moves into single word moves before reload. In theory this
15596 can give better register allocation, but so far the reverse seems to be
15597 generally the case.
15598
15599 @item -m1reg-@var{reg}
15600 @opindex m1reg-
15601 Specify a register to hold the constant @minus{}1, which makes loading small negative
15602 constants and certain bitmasks faster.
15603 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
15604 which specify use of that register as a fixed register,
15605 and @samp{none}, which means that no register is used for this
15606 purpose. The default is @option{-m1reg-none}.
15607
15608 @end table
15609
15610 @node ARC Options
15611 @subsection ARC Options
15612 @cindex ARC options
15613
15614 The following options control the architecture variant for which code
15615 is being compiled:
15616
15617 @c architecture variants
15618 @table @gcctabopt
15619
15620 @item -mbarrel-shifter
15621 @opindex mbarrel-shifter
15622 Generate instructions supported by barrel shifter. This is the default
15623 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
15624
15625 @item -mjli-always
15626 @opindex mjli-alawys
15627 Force to call a function using jli_s instruction. This option is
15628 valid only for ARCv2 architecture.
15629
15630 @item -mcpu=@var{cpu}
15631 @opindex mcpu
15632 Set architecture type, register usage, and instruction scheduling
15633 parameters for @var{cpu}. There are also shortcut alias options
15634 available for backward compatibility and convenience. Supported
15635 values for @var{cpu} are
15636
15637 @table @samp
15638 @opindex mA6
15639 @opindex mARC600
15640 @item arc600
15641 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
15642
15643 @item arc601
15644 @opindex mARC601
15645 Compile for ARC601. Alias: @option{-mARC601}.
15646
15647 @item arc700
15648 @opindex mA7
15649 @opindex mARC700
15650 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
15651 This is the default when configured with @option{--with-cpu=arc700}@.
15652
15653 @item arcem
15654 Compile for ARC EM.
15655
15656 @item archs
15657 Compile for ARC HS.
15658
15659 @item em
15660 Compile for ARC EM CPU with no hardware extensions.
15661
15662 @item em4
15663 Compile for ARC EM4 CPU.
15664
15665 @item em4_dmips
15666 Compile for ARC EM4 DMIPS CPU.
15667
15668 @item em4_fpus
15669 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
15670 extension.
15671
15672 @item em4_fpuda
15673 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
15674 double assist instructions.
15675
15676 @item hs
15677 Compile for ARC HS CPU with no hardware extensions except the atomic
15678 instructions.
15679
15680 @item hs34
15681 Compile for ARC HS34 CPU.
15682
15683 @item hs38
15684 Compile for ARC HS38 CPU.
15685
15686 @item hs38_linux
15687 Compile for ARC HS38 CPU with all hardware extensions on.
15688
15689 @item arc600_norm
15690 Compile for ARC 600 CPU with @code{norm} instructions enabled.
15691
15692 @item arc600_mul32x16
15693 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
15694 instructions enabled.
15695
15696 @item arc600_mul64
15697 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
15698 instructions enabled.
15699
15700 @item arc601_norm
15701 Compile for ARC 601 CPU with @code{norm} instructions enabled.
15702
15703 @item arc601_mul32x16
15704 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
15705 instructions enabled.
15706
15707 @item arc601_mul64
15708 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
15709 instructions enabled.
15710
15711 @item nps400
15712 Compile for ARC 700 on NPS400 chip.
15713
15714 @item em_mini
15715 Compile for ARC EM minimalist configuration featuring reduced register
15716 set.
15717
15718 @end table
15719
15720 @item -mdpfp
15721 @opindex mdpfp
15722 @itemx -mdpfp-compact
15723 @opindex mdpfp-compact
15724 Generate double-precision FPX instructions, tuned for the compact
15725 implementation.
15726
15727 @item -mdpfp-fast
15728 @opindex mdpfp-fast
15729 Generate double-precision FPX instructions, tuned for the fast
15730 implementation.
15731
15732 @item -mno-dpfp-lrsr
15733 @opindex mno-dpfp-lrsr
15734 Disable @code{lr} and @code{sr} instructions from using FPX extension
15735 aux registers.
15736
15737 @item -mea
15738 @opindex mea
15739 Generate extended arithmetic instructions. Currently only
15740 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
15741 supported. This is always enabled for @option{-mcpu=ARC700}.
15742
15743 @item -mno-mpy
15744 @opindex mno-mpy
15745 @opindex mmpy
15746 Do not generate @code{mpy}-family instructions for ARC700. This option is
15747 deprecated.
15748
15749 @item -mmul32x16
15750 @opindex mmul32x16
15751 Generate 32x16-bit multiply and multiply-accumulate instructions.
15752
15753 @item -mmul64
15754 @opindex mmul64
15755 Generate @code{mul64} and @code{mulu64} instructions.
15756 Only valid for @option{-mcpu=ARC600}.
15757
15758 @item -mnorm
15759 @opindex mnorm
15760 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
15761 is in effect.
15762
15763 @item -mspfp
15764 @opindex mspfp
15765 @itemx -mspfp-compact
15766 @opindex mspfp-compact
15767 Generate single-precision FPX instructions, tuned for the compact
15768 implementation.
15769
15770 @item -mspfp-fast
15771 @opindex mspfp-fast
15772 Generate single-precision FPX instructions, tuned for the fast
15773 implementation.
15774
15775 @item -msimd
15776 @opindex msimd
15777 Enable generation of ARC SIMD instructions via target-specific
15778 builtins. Only valid for @option{-mcpu=ARC700}.
15779
15780 @item -msoft-float
15781 @opindex msoft-float
15782 This option ignored; it is provided for compatibility purposes only.
15783 Software floating-point code is emitted by default, and this default
15784 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
15785 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
15786 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
15787
15788 @item -mswap
15789 @opindex mswap
15790 Generate @code{swap} instructions.
15791
15792 @item -matomic
15793 @opindex matomic
15794 This enables use of the locked load/store conditional extension to implement
15795 atomic memory built-in functions. Not available for ARC 6xx or ARC
15796 EM cores.
15797
15798 @item -mdiv-rem
15799 @opindex mdiv-rem
15800 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
15801
15802 @item -mcode-density
15803 @opindex mcode-density
15804 Enable code density instructions for ARC EM.
15805 This option is on by default for ARC HS.
15806
15807 @item -mll64
15808 @opindex mll64
15809 Enable double load/store operations for ARC HS cores.
15810
15811 @item -mtp-regno=@var{regno}
15812 @opindex mtp-regno
15813 Specify thread pointer register number.
15814
15815 @item -mmpy-option=@var{multo}
15816 @opindex mmpy-option
15817 Compile ARCv2 code with a multiplier design option. You can specify
15818 the option using either a string or numeric value for @var{multo}.
15819 @samp{wlh1} is the default value. The recognized values are:
15820
15821 @table @samp
15822 @item 0
15823 @itemx none
15824 No multiplier available.
15825
15826 @item 1
15827 @itemx w
15828 16x16 multiplier, fully pipelined.
15829 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
15830
15831 @item 2
15832 @itemx wlh1
15833 32x32 multiplier, fully
15834 pipelined (1 stage). The following instructions are additionally
15835 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15836
15837 @item 3
15838 @itemx wlh2
15839 32x32 multiplier, fully pipelined
15840 (2 stages). The following instructions are additionally enabled: @code{mpy},
15841 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15842
15843 @item 4
15844 @itemx wlh3
15845 Two 16x16 multipliers, blocking,
15846 sequential. The following instructions are additionally enabled: @code{mpy},
15847 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15848
15849 @item 5
15850 @itemx wlh4
15851 One 16x16 multiplier, blocking,
15852 sequential. The following instructions are additionally enabled: @code{mpy},
15853 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15854
15855 @item 6
15856 @itemx wlh5
15857 One 32x4 multiplier, blocking,
15858 sequential. The following instructions are additionally enabled: @code{mpy},
15859 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15860
15861 @item 7
15862 @itemx plus_dmpy
15863 ARC HS SIMD support.
15864
15865 @item 8
15866 @itemx plus_macd
15867 ARC HS SIMD support.
15868
15869 @item 9
15870 @itemx plus_qmacw
15871 ARC HS SIMD support.
15872
15873 @end table
15874
15875 This option is only available for ARCv2 cores@.
15876
15877 @item -mfpu=@var{fpu}
15878 @opindex mfpu
15879 Enables support for specific floating-point hardware extensions for ARCv2
15880 cores. Supported values for @var{fpu} are:
15881
15882 @table @samp
15883
15884 @item fpus
15885 Enables support for single-precision floating-point hardware
15886 extensions@.
15887
15888 @item fpud
15889 Enables support for double-precision floating-point hardware
15890 extensions. The single-precision floating-point extension is also
15891 enabled. Not available for ARC EM@.
15892
15893 @item fpuda
15894 Enables support for double-precision floating-point hardware
15895 extensions using double-precision assist instructions. The single-precision
15896 floating-point extension is also enabled. This option is
15897 only available for ARC EM@.
15898
15899 @item fpuda_div
15900 Enables support for double-precision floating-point hardware
15901 extensions using double-precision assist instructions.
15902 The single-precision floating-point, square-root, and divide
15903 extensions are also enabled. This option is
15904 only available for ARC EM@.
15905
15906 @item fpuda_fma
15907 Enables support for double-precision floating-point hardware
15908 extensions using double-precision assist instructions.
15909 The single-precision floating-point and fused multiply and add
15910 hardware extensions are also enabled. This option is
15911 only available for ARC EM@.
15912
15913 @item fpuda_all
15914 Enables support for double-precision floating-point hardware
15915 extensions using double-precision assist instructions.
15916 All single-precision floating-point hardware extensions are also
15917 enabled. This option is only available for ARC EM@.
15918
15919 @item fpus_div
15920 Enables support for single-precision floating-point, square-root and divide
15921 hardware extensions@.
15922
15923 @item fpud_div
15924 Enables support for double-precision floating-point, square-root and divide
15925 hardware extensions. This option
15926 includes option @samp{fpus_div}. Not available for ARC EM@.
15927
15928 @item fpus_fma
15929 Enables support for single-precision floating-point and
15930 fused multiply and add hardware extensions@.
15931
15932 @item fpud_fma
15933 Enables support for double-precision floating-point and
15934 fused multiply and add hardware extensions. This option
15935 includes option @samp{fpus_fma}. Not available for ARC EM@.
15936
15937 @item fpus_all
15938 Enables support for all single-precision floating-point hardware
15939 extensions@.
15940
15941 @item fpud_all
15942 Enables support for all single- and double-precision floating-point
15943 hardware extensions. Not available for ARC EM@.
15944
15945 @end table
15946
15947 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
15948 @opindex mirq-ctrl-saved
15949 Specifies general-purposes registers that the processor automatically
15950 saves/restores on interrupt entry and exit. @var{register-range} is
15951 specified as two registers separated by a dash. The register range
15952 always starts with @code{r0}, the upper limit is @code{fp} register.
15953 @var{blink} and @var{lp_count} are optional. This option is only
15954 valid for ARC EM and ARC HS cores.
15955
15956 @item -mrgf-banked-regs=@var{number}
15957 @opindex mrgf-banked-regs
15958 Specifies the number of registers replicated in second register bank
15959 on entry to fast interrupt. Fast interrupts are interrupts with the
15960 highest priority level P0. These interrupts save only PC and STATUS32
15961 registers to avoid memory transactions during interrupt entry and exit
15962 sequences. Use this option when you are using fast interrupts in an
15963 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
15964
15965 @item -mlpc-width=@var{width}
15966 @opindex mlpc-width
15967 Specify the width of the @code{lp_count} register. Valid values for
15968 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
15969 fixed to 32 bits. If the width is less than 32, the compiler does not
15970 attempt to transform loops in your program to use the zero-delay loop
15971 mechanism unless it is known that the @code{lp_count} register can
15972 hold the required loop-counter value. Depending on the width
15973 specified, the compiler and run-time library might continue to use the
15974 loop mechanism for various needs. This option defines macro
15975 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
15976
15977 @item -mrf16
15978 @opindex mrf16
15979 This option instructs the compiler to generate code for a 16-entry
15980 register file. This option defines the @code{__ARC_RF16__}
15981 preprocessor macro.
15982
15983 @item -mbranch-index
15984 @opindex mbranch-index
15985 Enable use of @code{bi} or @code{bih} instructions to implement jump
15986 tables.
15987
15988 @end table
15989
15990 The following options are passed through to the assembler, and also
15991 define preprocessor macro symbols.
15992
15993 @c Flags used by the assembler, but for which we define preprocessor
15994 @c macro symbols as well.
15995 @table @gcctabopt
15996 @item -mdsp-packa
15997 @opindex mdsp-packa
15998 Passed down to the assembler to enable the DSP Pack A extensions.
15999 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16000 deprecated.
16001
16002 @item -mdvbf
16003 @opindex mdvbf
16004 Passed down to the assembler to enable the dual Viterbi butterfly
16005 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16006 option is deprecated.
16007
16008 @c ARC700 4.10 extension instruction
16009 @item -mlock
16010 @opindex mlock
16011 Passed down to the assembler to enable the locked load/store
16012 conditional extension. Also sets the preprocessor symbol
16013 @code{__Xlock}.
16014
16015 @item -mmac-d16
16016 @opindex mmac-d16
16017 Passed down to the assembler. Also sets the preprocessor symbol
16018 @code{__Xxmac_d16}. This option is deprecated.
16019
16020 @item -mmac-24
16021 @opindex mmac-24
16022 Passed down to the assembler. Also sets the preprocessor symbol
16023 @code{__Xxmac_24}. This option is deprecated.
16024
16025 @c ARC700 4.10 extension instruction
16026 @item -mrtsc
16027 @opindex mrtsc
16028 Passed down to the assembler to enable the 64-bit time-stamp counter
16029 extension instruction. Also sets the preprocessor symbol
16030 @code{__Xrtsc}. This option is deprecated.
16031
16032 @c ARC700 4.10 extension instruction
16033 @item -mswape
16034 @opindex mswape
16035 Passed down to the assembler to enable the swap byte ordering
16036 extension instruction. Also sets the preprocessor symbol
16037 @code{__Xswape}.
16038
16039 @item -mtelephony
16040 @opindex mtelephony
16041 Passed down to the assembler to enable dual- and single-operand
16042 instructions for telephony. Also sets the preprocessor symbol
16043 @code{__Xtelephony}. This option is deprecated.
16044
16045 @item -mxy
16046 @opindex mxy
16047 Passed down to the assembler to enable the XY memory extension. Also
16048 sets the preprocessor symbol @code{__Xxy}.
16049
16050 @end table
16051
16052 The following options control how the assembly code is annotated:
16053
16054 @c Assembly annotation options
16055 @table @gcctabopt
16056 @item -misize
16057 @opindex misize
16058 Annotate assembler instructions with estimated addresses.
16059
16060 @item -mannotate-align
16061 @opindex mannotate-align
16062 Explain what alignment considerations lead to the decision to make an
16063 instruction short or long.
16064
16065 @end table
16066
16067 The following options are passed through to the linker:
16068
16069 @c options passed through to the linker
16070 @table @gcctabopt
16071 @item -marclinux
16072 @opindex marclinux
16073 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16074 This option is enabled by default in tool chains built for
16075 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16076 when profiling is not requested.
16077
16078 @item -marclinux_prof
16079 @opindex marclinux_prof
16080 Passed through to the linker, to specify use of the
16081 @code{arclinux_prof} emulation. This option is enabled by default in
16082 tool chains built for @w{@code{arc-linux-uclibc}} and
16083 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16084
16085 @end table
16086
16087 The following options control the semantics of generated code:
16088
16089 @c semantically relevant code generation options
16090 @table @gcctabopt
16091 @item -mlong-calls
16092 @opindex mlong-calls
16093 Generate calls as register indirect calls, thus providing access
16094 to the full 32-bit address range.
16095
16096 @item -mmedium-calls
16097 @opindex mmedium-calls
16098 Don't use less than 25-bit addressing range for calls, which is the
16099 offset available for an unconditional branch-and-link
16100 instruction. Conditional execution of function calls is suppressed, to
16101 allow use of the 25-bit range, rather than the 21-bit range with
16102 conditional branch-and-link. This is the default for tool chains built
16103 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16104
16105 @item -G @var{num}
16106 @opindex G
16107 Put definitions of externally-visible data in a small data section if
16108 that data is no bigger than @var{num} bytes. The default value of
16109 @var{num} is 4 for any ARC configuration, or 8 when we have double
16110 load/store operations.
16111
16112 @item -mno-sdata
16113 @opindex mno-sdata
16114 @opindex msdata
16115 Do not generate sdata references. This is the default for tool chains
16116 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16117 targets.
16118
16119 @item -mvolatile-cache
16120 @opindex mvolatile-cache
16121 Use ordinarily cached memory accesses for volatile references. This is the
16122 default.
16123
16124 @item -mno-volatile-cache
16125 @opindex mno-volatile-cache
16126 @opindex mvolatile-cache
16127 Enable cache bypass for volatile references.
16128
16129 @end table
16130
16131 The following options fine tune code generation:
16132 @c code generation tuning options
16133 @table @gcctabopt
16134 @item -malign-call
16135 @opindex malign-call
16136 Do alignment optimizations for call instructions.
16137
16138 @item -mauto-modify-reg
16139 @opindex mauto-modify-reg
16140 Enable the use of pre/post modify with register displacement.
16141
16142 @item -mbbit-peephole
16143 @opindex mbbit-peephole
16144 Enable bbit peephole2.
16145
16146 @item -mno-brcc
16147 @opindex mno-brcc
16148 This option disables a target-specific pass in @file{arc_reorg} to
16149 generate compare-and-branch (@code{br@var{cc}}) instructions.
16150 It has no effect on
16151 generation of these instructions driven by the combiner pass.
16152
16153 @item -mcase-vector-pcrel
16154 @opindex mcase-vector-pcrel
16155 Use PC-relative switch case tables to enable case table shortening.
16156 This is the default for @option{-Os}.
16157
16158 @item -mcompact-casesi
16159 @opindex mcompact-casesi
16160 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16161 and only available for ARCv1 cores. This option is deprecated.
16162
16163 @item -mno-cond-exec
16164 @opindex mno-cond-exec
16165 Disable the ARCompact-specific pass to generate conditional
16166 execution instructions.
16167
16168 Due to delay slot scheduling and interactions between operand numbers,
16169 literal sizes, instruction lengths, and the support for conditional execution,
16170 the target-independent pass to generate conditional execution is often lacking,
16171 so the ARC port has kept a special pass around that tries to find more
16172 conditional execution generation opportunities after register allocation,
16173 branch shortening, and delay slot scheduling have been done. This pass
16174 generally, but not always, improves performance and code size, at the cost of
16175 extra compilation time, which is why there is an option to switch it off.
16176 If you have a problem with call instructions exceeding their allowable
16177 offset range because they are conditionalized, you should consider using
16178 @option{-mmedium-calls} instead.
16179
16180 @item -mearly-cbranchsi
16181 @opindex mearly-cbranchsi
16182 Enable pre-reload use of the @code{cbranchsi} pattern.
16183
16184 @item -mexpand-adddi
16185 @opindex mexpand-adddi
16186 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16187 @code{add.f}, @code{adc} etc. This option is deprecated.
16188
16189 @item -mindexed-loads
16190 @opindex mindexed-loads
16191 Enable the use of indexed loads. This can be problematic because some
16192 optimizers then assume that indexed stores exist, which is not
16193 the case.
16194
16195 @item -mlra
16196 @opindex mlra
16197 Enable Local Register Allocation. This is still experimental for ARC,
16198 so by default the compiler uses standard reload
16199 (i.e.@: @option{-mno-lra}).
16200
16201 @item -mlra-priority-none
16202 @opindex mlra-priority-none
16203 Don't indicate any priority for target registers.
16204
16205 @item -mlra-priority-compact
16206 @opindex mlra-priority-compact
16207 Indicate target register priority for r0..r3 / r12..r15.
16208
16209 @item -mlra-priority-noncompact
16210 @opindex mlra-priority-noncompact
16211 Reduce target register priority for r0..r3 / r12..r15.
16212
16213 @item -mno-millicode
16214 @opindex mno-millicode
16215 When optimizing for size (using @option{-Os}), prologues and epilogues
16216 that have to save or restore a large number of registers are often
16217 shortened by using call to a special function in libgcc; this is
16218 referred to as a @emph{millicode} call. As these calls can pose
16219 performance issues, and/or cause linking issues when linking in a
16220 nonstandard way, this option is provided to turn off millicode call
16221 generation.
16222
16223 @item -mmixed-code
16224 @opindex mmixed-code
16225 Tweak register allocation to help 16-bit instruction generation.
16226 This generally has the effect of decreasing the average instruction size
16227 while increasing the instruction count.
16228
16229 @item -mq-class
16230 @opindex mq-class
16231 Enable @samp{q} instruction alternatives.
16232 This is the default for @option{-Os}.
16233
16234 @item -mRcq
16235 @opindex mRcq
16236 Enable @samp{Rcq} constraint handling.
16237 Most short code generation depends on this.
16238 This is the default.
16239
16240 @item -mRcw
16241 @opindex mRcw
16242 Enable @samp{Rcw} constraint handling.
16243 Most ccfsm condexec mostly depends on this.
16244 This is the default.
16245
16246 @item -msize-level=@var{level}
16247 @opindex msize-level
16248 Fine-tune size optimization with regards to instruction lengths and alignment.
16249 The recognized values for @var{level} are:
16250 @table @samp
16251 @item 0
16252 No size optimization. This level is deprecated and treated like @samp{1}.
16253
16254 @item 1
16255 Short instructions are used opportunistically.
16256
16257 @item 2
16258 In addition, alignment of loops and of code after barriers are dropped.
16259
16260 @item 3
16261 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16262
16263 @end table
16264
16265 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16266 the behavior when this is not set is equivalent to level @samp{1}.
16267
16268 @item -mtune=@var{cpu}
16269 @opindex mtune
16270 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16271 by @option{-mcpu=}.
16272
16273 Supported values for @var{cpu} are
16274
16275 @table @samp
16276 @item ARC600
16277 Tune for ARC600 CPU.
16278
16279 @item ARC601
16280 Tune for ARC601 CPU.
16281
16282 @item ARC700
16283 Tune for ARC700 CPU with standard multiplier block.
16284
16285 @item ARC700-xmac
16286 Tune for ARC700 CPU with XMAC block.
16287
16288 @item ARC725D
16289 Tune for ARC725D CPU.
16290
16291 @item ARC750D
16292 Tune for ARC750D CPU.
16293
16294 @end table
16295
16296 @item -mmultcost=@var{num}
16297 @opindex mmultcost
16298 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16299 normal instruction.
16300
16301 @item -munalign-prob-threshold=@var{probability}
16302 @opindex munalign-prob-threshold
16303 Set probability threshold for unaligning branches.
16304 When tuning for @samp{ARC700} and optimizing for speed, branches without
16305 filled delay slot are preferably emitted unaligned and long, unless
16306 profiling indicates that the probability for the branch to be taken
16307 is below @var{probability}. @xref{Cross-profiling}.
16308 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16309
16310 @end table
16311
16312 The following options are maintained for backward compatibility, but
16313 are now deprecated and will be removed in a future release:
16314
16315 @c Deprecated options
16316 @table @gcctabopt
16317
16318 @item -margonaut
16319 @opindex margonaut
16320 Obsolete FPX.
16321
16322 @item -mbig-endian
16323 @opindex mbig-endian
16324 @itemx -EB
16325 @opindex EB
16326 Compile code for big-endian targets. Use of these options is now
16327 deprecated. Big-endian code is supported by configuring GCC to build
16328 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
16329 for which big endian is the default.
16330
16331 @item -mlittle-endian
16332 @opindex mlittle-endian
16333 @itemx -EL
16334 @opindex EL
16335 Compile code for little-endian targets. Use of these options is now
16336 deprecated. Little-endian code is supported by configuring GCC to build
16337 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
16338 for which little endian is the default.
16339
16340 @item -mbarrel_shifter
16341 @opindex mbarrel_shifter
16342 Replaced by @option{-mbarrel-shifter}.
16343
16344 @item -mdpfp_compact
16345 @opindex mdpfp_compact
16346 Replaced by @option{-mdpfp-compact}.
16347
16348 @item -mdpfp_fast
16349 @opindex mdpfp_fast
16350 Replaced by @option{-mdpfp-fast}.
16351
16352 @item -mdsp_packa
16353 @opindex mdsp_packa
16354 Replaced by @option{-mdsp-packa}.
16355
16356 @item -mEA
16357 @opindex mEA
16358 Replaced by @option{-mea}.
16359
16360 @item -mmac_24
16361 @opindex mmac_24
16362 Replaced by @option{-mmac-24}.
16363
16364 @item -mmac_d16
16365 @opindex mmac_d16
16366 Replaced by @option{-mmac-d16}.
16367
16368 @item -mspfp_compact
16369 @opindex mspfp_compact
16370 Replaced by @option{-mspfp-compact}.
16371
16372 @item -mspfp_fast
16373 @opindex mspfp_fast
16374 Replaced by @option{-mspfp-fast}.
16375
16376 @item -mtune=@var{cpu}
16377 @opindex mtune
16378 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
16379 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
16380 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
16381
16382 @item -multcost=@var{num}
16383 @opindex multcost
16384 Replaced by @option{-mmultcost}.
16385
16386 @end table
16387
16388 @node ARM Options
16389 @subsection ARM Options
16390 @cindex ARM options
16391
16392 These @samp{-m} options are defined for the ARM port:
16393
16394 @table @gcctabopt
16395 @item -mabi=@var{name}
16396 @opindex mabi
16397 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
16398 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
16399
16400 @item -mapcs-frame
16401 @opindex mapcs-frame
16402 Generate a stack frame that is compliant with the ARM Procedure Call
16403 Standard for all functions, even if this is not strictly necessary for
16404 correct execution of the code. Specifying @option{-fomit-frame-pointer}
16405 with this option causes the stack frames not to be generated for
16406 leaf functions. The default is @option{-mno-apcs-frame}.
16407 This option is deprecated.
16408
16409 @item -mapcs
16410 @opindex mapcs
16411 This is a synonym for @option{-mapcs-frame} and is deprecated.
16412
16413 @ignore
16414 @c not currently implemented
16415 @item -mapcs-stack-check
16416 @opindex mapcs-stack-check
16417 Generate code to check the amount of stack space available upon entry to
16418 every function (that actually uses some stack space). If there is
16419 insufficient space available then either the function
16420 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
16421 called, depending upon the amount of stack space required. The runtime
16422 system is required to provide these functions. The default is
16423 @option{-mno-apcs-stack-check}, since this produces smaller code.
16424
16425 @c not currently implemented
16426 @item -mapcs-reentrant
16427 @opindex mapcs-reentrant
16428 Generate reentrant, position-independent code. The default is
16429 @option{-mno-apcs-reentrant}.
16430 @end ignore
16431
16432 @item -mthumb-interwork
16433 @opindex mthumb-interwork
16434 Generate code that supports calling between the ARM and Thumb
16435 instruction sets. Without this option, on pre-v5 architectures, the
16436 two instruction sets cannot be reliably used inside one program. The
16437 default is @option{-mno-thumb-interwork}, since slightly larger code
16438 is generated when @option{-mthumb-interwork} is specified. In AAPCS
16439 configurations this option is meaningless.
16440
16441 @item -mno-sched-prolog
16442 @opindex mno-sched-prolog
16443 @opindex msched-prolog
16444 Prevent the reordering of instructions in the function prologue, or the
16445 merging of those instruction with the instructions in the function's
16446 body. This means that all functions start with a recognizable set
16447 of instructions (or in fact one of a choice from a small set of
16448 different function prologues), and this information can be used to
16449 locate the start of functions inside an executable piece of code. The
16450 default is @option{-msched-prolog}.
16451
16452 @item -mfloat-abi=@var{name}
16453 @opindex mfloat-abi
16454 Specifies which floating-point ABI to use. Permissible values
16455 are: @samp{soft}, @samp{softfp} and @samp{hard}.
16456
16457 Specifying @samp{soft} causes GCC to generate output containing
16458 library calls for floating-point operations.
16459 @samp{softfp} allows the generation of code using hardware floating-point
16460 instructions, but still uses the soft-float calling conventions.
16461 @samp{hard} allows generation of floating-point instructions
16462 and uses FPU-specific calling conventions.
16463
16464 The default depends on the specific target configuration. Note that
16465 the hard-float and soft-float ABIs are not link-compatible; you must
16466 compile your entire program with the same ABI, and link with a
16467 compatible set of libraries.
16468
16469 @item -mlittle-endian
16470 @opindex mlittle-endian
16471 Generate code for a processor running in little-endian mode. This is
16472 the default for all standard configurations.
16473
16474 @item -mbig-endian
16475 @opindex mbig-endian
16476 Generate code for a processor running in big-endian mode; the default is
16477 to compile code for a little-endian processor.
16478
16479 @item -mbe8
16480 @itemx -mbe32
16481 @opindex mbe8
16482 When linking a big-endian image select between BE8 and BE32 formats.
16483 The option has no effect for little-endian images and is ignored. The
16484 default is dependent on the selected target architecture. For ARMv6
16485 and later architectures the default is BE8, for older architectures
16486 the default is BE32. BE32 format has been deprecated by ARM.
16487
16488 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
16489 @opindex march
16490 This specifies the name of the target ARM architecture. GCC uses this
16491 name to determine what kind of instructions it can emit when generating
16492 assembly code. This option can be used in conjunction with or instead
16493 of the @option{-mcpu=} option.
16494
16495 Permissible names are:
16496 @samp{armv4t},
16497 @samp{armv5t}, @samp{armv5te},
16498 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
16499 @samp{armv6z}, @samp{armv6zk},
16500 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
16501 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
16502 @samp{armv8.4-a},
16503 @samp{armv7-r},
16504 @samp{armv8-r},
16505 @samp{armv6-m}, @samp{armv6s-m},
16506 @samp{armv7-m}, @samp{armv7e-m},
16507 @samp{armv8-m.base}, @samp{armv8-m.main},
16508 @samp{iwmmxt} and @samp{iwmmxt2}.
16509
16510 Additionally, the following architectures, which lack support for the
16511 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
16512
16513 Many of the architectures support extensions. These can be added by
16514 appending @samp{+@var{extension}} to the architecture name. Extension
16515 options are processed in order and capabilities accumulate. An extension
16516 will also enable any necessary base extensions
16517 upon which it depends. For example, the @samp{+crypto} extension
16518 will always enable the @samp{+simd} extension. The exception to the
16519 additive construction is for extensions that are prefixed with
16520 @samp{+no@dots{}}: these extensions disable the specified option and
16521 any other extensions that may depend on the presence of that
16522 extension.
16523
16524 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
16525 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
16526 entirely disabled by the @samp{+nofp} option that follows it.
16527
16528 Most extension names are generically named, but have an effect that is
16529 dependent upon the architecture to which it is applied. For example,
16530 the @samp{+simd} option can be applied to both @samp{armv7-a} and
16531 @samp{armv8-a} architectures, but will enable the original ARMv7-A
16532 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
16533 variant for @samp{armv8-a}.
16534
16535 The table below lists the supported extensions for each architecture.
16536 Architectures not mentioned do not support any extensions.
16537
16538 @table @samp
16539 @item armv5te
16540 @itemx armv6
16541 @itemx armv6j
16542 @itemx armv6k
16543 @itemx armv6kz
16544 @itemx armv6t2
16545 @itemx armv6z
16546 @itemx armv6zk
16547 @table @samp
16548 @item +fp
16549 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
16550 used as an alias for this extension.
16551
16552 @item +nofp
16553 Disable the floating-point instructions.
16554 @end table
16555
16556 @item armv7
16557 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
16558 @table @samp
16559 @item +fp
16560 The VFPv3 floating-point instructions, with 16 double-precision
16561 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16562 for this extension. Note that floating-point is not supported by the
16563 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
16564 ARMv7-R architectures.
16565
16566 @item +nofp
16567 Disable the floating-point instructions.
16568 @end table
16569
16570 @item armv7-a
16571 @table @samp
16572 @item +fp
16573 The VFPv3 floating-point instructions, with 16 double-precision
16574 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16575 for this extension.
16576
16577 @item +simd
16578 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16579 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
16580 for this extension.
16581
16582 @item +vfpv3
16583 The VFPv3 floating-point instructions, with 32 double-precision
16584 registers.
16585
16586 @item +vfpv3-d16-fp16
16587 The VFPv3 floating-point instructions, with 16 double-precision
16588 registers and the half-precision floating-point conversion operations.
16589
16590 @item +vfpv3-fp16
16591 The VFPv3 floating-point instructions, with 32 double-precision
16592 registers and the half-precision floating-point conversion operations.
16593
16594 @item +vfpv4-d16
16595 The VFPv4 floating-point instructions, with 16 double-precision
16596 registers.
16597
16598 @item +vfpv4
16599 The VFPv4 floating-point instructions, with 32 double-precision
16600 registers.
16601
16602 @item +neon-fp16
16603 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16604 the half-precision floating-point conversion operations.
16605
16606 @item +neon-vfpv4
16607 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
16608
16609 @item +nosimd
16610 Disable the Advanced SIMD instructions (does not disable floating point).
16611
16612 @item +nofp
16613 Disable the floating-point and Advanced SIMD instructions.
16614 @end table
16615
16616 @item armv7ve
16617 The extended version of the ARMv7-A architecture with support for
16618 virtualization.
16619 @table @samp
16620 @item +fp
16621 The VFPv4 floating-point instructions, with 16 double-precision registers.
16622 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
16623
16624 @item +simd
16625 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
16626 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
16627
16628 @item +vfpv3-d16
16629 The VFPv3 floating-point instructions, with 16 double-precision
16630 registers.
16631
16632 @item +vfpv3
16633 The VFPv3 floating-point instructions, with 32 double-precision
16634 registers.
16635
16636 @item +vfpv3-d16-fp16
16637 The VFPv3 floating-point instructions, with 16 double-precision
16638 registers and the half-precision floating-point conversion operations.
16639
16640 @item +vfpv3-fp16
16641 The VFPv3 floating-point instructions, with 32 double-precision
16642 registers and the half-precision floating-point conversion operations.
16643
16644 @item +vfpv4-d16
16645 The VFPv4 floating-point instructions, with 16 double-precision
16646 registers.
16647
16648 @item +vfpv4
16649 The VFPv4 floating-point instructions, with 32 double-precision
16650 registers.
16651
16652 @item +neon
16653 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16654 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
16655
16656 @item +neon-fp16
16657 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16658 the half-precision floating-point conversion operations.
16659
16660 @item +nosimd
16661 Disable the Advanced SIMD instructions (does not disable floating point).
16662
16663 @item +nofp
16664 Disable the floating-point and Advanced SIMD instructions.
16665 @end table
16666
16667 @item armv8-a
16668 @table @samp
16669 @item +crc
16670 The Cyclic Redundancy Check (CRC) instructions.
16671 @item +simd
16672 The ARMv8-A Advanced SIMD and floating-point instructions.
16673 @item +crypto
16674 The cryptographic instructions.
16675 @item +nocrypto
16676 Disable the cryptographic instructions.
16677 @item +nofp
16678 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16679 @end table
16680
16681 @item armv8.1-a
16682 @table @samp
16683 @item +simd
16684 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16685
16686 @item +crypto
16687 The cryptographic instructions. This also enables the Advanced SIMD and
16688 floating-point instructions.
16689
16690 @item +nocrypto
16691 Disable the cryptographic instructions.
16692
16693 @item +nofp
16694 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16695 @end table
16696
16697 @item armv8.2-a
16698 @itemx armv8.3-a
16699 @table @samp
16700 @item +fp16
16701 The half-precision floating-point data processing instructions.
16702 This also enables the Advanced SIMD and floating-point instructions.
16703
16704 @item +fp16fml
16705 The half-precision floating-point fmla extension. This also enables
16706 the half-precision floating-point extension and Advanced SIMD and
16707 floating-point instructions.
16708
16709 @item +simd
16710 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16711
16712 @item +crypto
16713 The cryptographic instructions. This also enables the Advanced SIMD and
16714 floating-point instructions.
16715
16716 @item +dotprod
16717 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16718
16719 @item +nocrypto
16720 Disable the cryptographic extension.
16721
16722 @item +nofp
16723 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16724 @end table
16725
16726 @item armv8.4-a
16727 @table @samp
16728 @item +fp16
16729 The half-precision floating-point data processing instructions.
16730 This also enables the Advanced SIMD and floating-point instructions as well
16731 as the Dot Product extension and the half-precision floating-point fmla
16732 extension.
16733
16734 @item +simd
16735 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
16736 Dot Product extension.
16737
16738 @item +crypto
16739 The cryptographic instructions. This also enables the Advanced SIMD and
16740 floating-point instructions as well as the Dot Product extension.
16741
16742 @item +nocrypto
16743 Disable the cryptographic extension.
16744
16745 @item +nofp
16746 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16747 @end table
16748
16749 @item armv7-r
16750 @table @samp
16751 @item +fp.sp
16752 The single-precision VFPv3 floating-point instructions. The extension
16753 @samp{+vfpv3xd} can be used as an alias for this extension.
16754
16755 @item +fp
16756 The VFPv3 floating-point instructions with 16 double-precision registers.
16757 The extension +vfpv3-d16 can be used as an alias for this extension.
16758
16759 @item +nofp
16760 Disable the floating-point extension.
16761
16762 @item +idiv
16763 The ARM-state integer division instructions.
16764
16765 @item +noidiv
16766 Disable the ARM-state integer division extension.
16767 @end table
16768
16769 @item armv7e-m
16770 @table @samp
16771 @item +fp
16772 The single-precision VFPv4 floating-point instructions.
16773
16774 @item +fpv5
16775 The single-precision FPv5 floating-point instructions.
16776
16777 @item +fp.dp
16778 The single- and double-precision FPv5 floating-point instructions.
16779
16780 @item +nofp
16781 Disable the floating-point extensions.
16782 @end table
16783
16784 @item armv8-m.main
16785 @table @samp
16786 @item +dsp
16787 The DSP instructions.
16788
16789 @item +nodsp
16790 Disable the DSP extension.
16791
16792 @item +fp
16793 The single-precision floating-point instructions.
16794
16795 @item +fp.dp
16796 The single- and double-precision floating-point instructions.
16797
16798 @item +nofp
16799 Disable the floating-point extension.
16800 @end table
16801
16802 @item armv8-r
16803 @table @samp
16804 @item +crc
16805 The Cyclic Redundancy Check (CRC) instructions.
16806 @item +fp.sp
16807 The single-precision FPv5 floating-point instructions.
16808 @item +simd
16809 The ARMv8-A Advanced SIMD and floating-point instructions.
16810 @item +crypto
16811 The cryptographic instructions.
16812 @item +nocrypto
16813 Disable the cryptographic instructions.
16814 @item +nofp
16815 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16816 @end table
16817
16818 @end table
16819
16820 @option{-march=native} causes the compiler to auto-detect the architecture
16821 of the build computer. At present, this feature is only supported on
16822 GNU/Linux, and not all architectures are recognized. If the auto-detect
16823 is unsuccessful the option has no effect.
16824
16825 @item -mtune=@var{name}
16826 @opindex mtune
16827 This option specifies the name of the target ARM processor for
16828 which GCC should tune the performance of the code.
16829 For some ARM implementations better performance can be obtained by using
16830 this option.
16831 Permissible names are: @samp{arm2}, @samp{arm250},
16832 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
16833 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
16834 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
16835 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
16836 @samp{arm720},
16837 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
16838 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
16839 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
16840 @samp{strongarm1110},
16841 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
16842 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
16843 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
16844 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
16845 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
16846 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
16847 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
16848 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
16849 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
16850 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16851 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16852 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
16853 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
16854 @samp{cortex-m33},
16855 @samp{cortex-m23},
16856 @samp{cortex-m7},
16857 @samp{cortex-m4},
16858 @samp{cortex-m3},
16859 @samp{cortex-m1},
16860 @samp{cortex-m0},
16861 @samp{cortex-m0plus},
16862 @samp{cortex-m1.small-multiply},
16863 @samp{cortex-m0.small-multiply},
16864 @samp{cortex-m0plus.small-multiply},
16865 @samp{exynos-m1},
16866 @samp{marvell-pj4},
16867 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
16868 @samp{fa526}, @samp{fa626},
16869 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
16870 @samp{xgene1}.
16871
16872 Additionally, this option can specify that GCC should tune the performance
16873 of the code for a big.LITTLE system. Permissible names are:
16874 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
16875 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16876 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
16877 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
16878
16879 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
16880 performance for a blend of processors within architecture @var{arch}.
16881 The aim is to generate code that run well on the current most popular
16882 processors, balancing between optimizations that benefit some CPUs in the
16883 range, and avoiding performance pitfalls of other CPUs. The effects of
16884 this option may change in future GCC versions as CPU models come and go.
16885
16886 @option{-mtune} permits the same extension options as @option{-mcpu}, but
16887 the extension options do not affect the tuning of the generated code.
16888
16889 @option{-mtune=native} causes the compiler to auto-detect the CPU
16890 of the build computer. At present, this feature is only supported on
16891 GNU/Linux, and not all architectures are recognized. If the auto-detect is
16892 unsuccessful the option has no effect.
16893
16894 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
16895 @opindex mcpu
16896 This specifies the name of the target ARM processor. GCC uses this name
16897 to derive the name of the target ARM architecture (as if specified
16898 by @option{-march}) and the ARM processor type for which to tune for
16899 performance (as if specified by @option{-mtune}). Where this option
16900 is used in conjunction with @option{-march} or @option{-mtune},
16901 those options take precedence over the appropriate part of this option.
16902
16903 Many of the supported CPUs implement optional architectural
16904 extensions. Where this is so the architectural extensions are
16905 normally enabled by default. If implementations that lack the
16906 extension exist, then the extension syntax can be used to disable
16907 those extensions that have been omitted. For floating-point and
16908 Advanced SIMD (Neon) instructions, the settings of the options
16909 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
16910 floating-point and Advanced SIMD instructions will only be used if
16911 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
16912 @option{-mfpu} other than @samp{auto} will override the available
16913 floating-point and SIMD extension instructions.
16914
16915 For example, @samp{cortex-a9} can be found in three major
16916 configurations: integer only, with just a floating-point unit or with
16917 floating-point and Advanced SIMD. The default is to enable all the
16918 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
16919 be used to disable just the SIMD or both the SIMD and floating-point
16920 instructions respectively.
16921
16922 Permissible names for this option are the same as those for
16923 @option{-mtune}.
16924
16925 The following extension options are common to the listed CPUs:
16926
16927 @table @samp
16928 @item +nodsp
16929 Disable the DSP instructions on @samp{cortex-m33}.
16930
16931 @item +nofp
16932 Disables the floating-point instructions on @samp{arm9e},
16933 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
16934 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
16935 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
16936 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
16937 Disables the floating-point and SIMD instructions on
16938 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
16939 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
16940 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
16941 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
16942 @samp{cortex-a53} and @samp{cortex-a55}.
16943
16944 @item +nofp.dp
16945 Disables the double-precision component of the floating-point instructions
16946 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
16947
16948 @item +nosimd
16949 Disables the SIMD (but not floating-point) instructions on
16950 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
16951 and @samp{cortex-a9}.
16952
16953 @item +crypto
16954 Enables the cryptographic instructions on @samp{cortex-a32},
16955 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
16956 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
16957 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16958 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
16959 @samp{cortex-a75.cortex-a55}.
16960 @end table
16961
16962 Additionally the @samp{generic-armv7-a} pseudo target defaults to
16963 VFPv3 with 16 double-precision registers. It supports the following
16964 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
16965 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
16966 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
16967 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
16968 @option{-march=armv7-a}.
16969
16970 @option{-mcpu=generic-@var{arch}} is also permissible, and is
16971 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
16972 See @option{-mtune} for more information.
16973
16974 @option{-mcpu=native} causes the compiler to auto-detect the CPU
16975 of the build computer. At present, this feature is only supported on
16976 GNU/Linux, and not all architectures are recognized. If the auto-detect
16977 is unsuccessful the option has no effect.
16978
16979 @item -mfpu=@var{name}
16980 @opindex mfpu
16981 This specifies what floating-point hardware (or hardware emulation) is
16982 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
16983 @samp{vfpv3},
16984 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
16985 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
16986 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
16987 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
16988 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
16989 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
16990 is an alias for @samp{vfpv2}.
16991
16992 The setting @samp{auto} is the default and is special. It causes the
16993 compiler to select the floating-point and Advanced SIMD instructions
16994 based on the settings of @option{-mcpu} and @option{-march}.
16995
16996 If the selected floating-point hardware includes the NEON extension
16997 (e.g.@: @option{-mfpu=neon}), note that floating-point
16998 operations are not generated by GCC's auto-vectorization pass unless
16999 @option{-funsafe-math-optimizations} is also specified. This is
17000 because NEON hardware does not fully implement the IEEE 754 standard for
17001 floating-point arithmetic (in particular denormal values are treated as
17002 zero), so the use of NEON instructions may lead to a loss of precision.
17003
17004 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}).
17005
17006 @item -mfp16-format=@var{name}
17007 @opindex mfp16-format
17008 Specify the format of the @code{__fp16} half-precision floating-point type.
17009 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17010 the default is @samp{none}, in which case the @code{__fp16} type is not
17011 defined. @xref{Half-Precision}, for more information.
17012
17013 @item -mstructure-size-boundary=@var{n}
17014 @opindex mstructure-size-boundary
17015 The sizes of all structures and unions are rounded up to a multiple
17016 of the number of bits set by this option. Permissible values are 8, 32
17017 and 64. The default value varies for different toolchains. For the COFF
17018 targeted toolchain the default value is 8. A value of 64 is only allowed
17019 if the underlying ABI supports it.
17020
17021 Specifying a larger number can produce faster, more efficient code, but
17022 can also increase the size of the program. Different values are potentially
17023 incompatible. Code compiled with one value cannot necessarily expect to
17024 work with code or libraries compiled with another value, if they exchange
17025 information using structures or unions.
17026
17027 This option is deprecated.
17028
17029 @item -mabort-on-noreturn
17030 @opindex mabort-on-noreturn
17031 Generate a call to the function @code{abort} at the end of a
17032 @code{noreturn} function. It is executed if the function tries to
17033 return.
17034
17035 @item -mlong-calls
17036 @itemx -mno-long-calls
17037 @opindex mlong-calls
17038 @opindex mno-long-calls
17039 Tells the compiler to perform function calls by first loading the
17040 address of the function into a register and then performing a subroutine
17041 call on this register. This switch is needed if the target function
17042 lies outside of the 64-megabyte addressing range of the offset-based
17043 version of subroutine call instruction.
17044
17045 Even if this switch is enabled, not all function calls are turned
17046 into long calls. The heuristic is that static functions, functions
17047 that have the @code{short_call} attribute, functions that are inside
17048 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17049 definitions have already been compiled within the current compilation
17050 unit are not turned into long calls. The exceptions to this rule are
17051 that weak function definitions, functions with the @code{long_call}
17052 attribute or the @code{section} attribute, and functions that are within
17053 the scope of a @code{#pragma long_calls} directive are always
17054 turned into long calls.
17055
17056 This feature is not enabled by default. Specifying
17057 @option{-mno-long-calls} restores the default behavior, as does
17058 placing the function calls within the scope of a @code{#pragma
17059 long_calls_off} directive. Note these switches have no effect on how
17060 the compiler generates code to handle function calls via function
17061 pointers.
17062
17063 @item -msingle-pic-base
17064 @opindex msingle-pic-base
17065 Treat the register used for PIC addressing as read-only, rather than
17066 loading it in the prologue for each function. The runtime system is
17067 responsible for initializing this register with an appropriate value
17068 before execution begins.
17069
17070 @item -mpic-register=@var{reg}
17071 @opindex mpic-register
17072 Specify the register to be used for PIC addressing.
17073 For standard PIC base case, the default is any suitable register
17074 determined by compiler. For single PIC base case, the default is
17075 @samp{R9} if target is EABI based or stack-checking is enabled,
17076 otherwise the default is @samp{R10}.
17077
17078 @item -mpic-data-is-text-relative
17079 @opindex mpic-data-is-text-relative
17080 Assume that the displacement between the text and data segments is fixed
17081 at static link time. This permits using PC-relative addressing
17082 operations to access data known to be in the data segment. For
17083 non-VxWorks RTP targets, this option is enabled by default. When
17084 disabled on such targets, it will enable @option{-msingle-pic-base} by
17085 default.
17086
17087 @item -mpoke-function-name
17088 @opindex mpoke-function-name
17089 Write the name of each function into the text section, directly
17090 preceding the function prologue. The generated code is similar to this:
17091
17092 @smallexample
17093 t0
17094 .ascii "arm_poke_function_name", 0
17095 .align
17096 t1
17097 .word 0xff000000 + (t1 - t0)
17098 arm_poke_function_name
17099 mov ip, sp
17100 stmfd sp!, @{fp, ip, lr, pc@}
17101 sub fp, ip, #4
17102 @end smallexample
17103
17104 When performing a stack backtrace, code can inspect the value of
17105 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17106 location @code{pc - 12} and the top 8 bits are set, then we know that
17107 there is a function name embedded immediately preceding this location
17108 and has length @code{((pc[-3]) & 0xff000000)}.
17109
17110 @item -mthumb
17111 @itemx -marm
17112 @opindex marm
17113 @opindex mthumb
17114
17115 Select between generating code that executes in ARM and Thumb
17116 states. The default for most configurations is to generate code
17117 that executes in ARM state, but the default can be changed by
17118 configuring GCC with the @option{--with-mode=}@var{state}
17119 configure option.
17120
17121 You can also override the ARM and Thumb mode for each function
17122 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17123 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17124
17125 @item -mflip-thumb
17126 @opindex mflip-thumb
17127 Switch ARM/Thumb modes on alternating functions.
17128 This option is provided for regression testing of mixed Thumb/ARM code
17129 generation, and is not intended for ordinary use in compiling code.
17130
17131 @item -mtpcs-frame
17132 @opindex mtpcs-frame
17133 Generate a stack frame that is compliant with the Thumb Procedure Call
17134 Standard for all non-leaf functions. (A leaf function is one that does
17135 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17136
17137 @item -mtpcs-leaf-frame
17138 @opindex mtpcs-leaf-frame
17139 Generate a stack frame that is compliant with the Thumb Procedure Call
17140 Standard for all leaf functions. (A leaf function is one that does
17141 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17142
17143 @item -mcallee-super-interworking
17144 @opindex mcallee-super-interworking
17145 Gives all externally visible functions in the file being compiled an ARM
17146 instruction set header which switches to Thumb mode before executing the
17147 rest of the function. This allows these functions to be called from
17148 non-interworking code. This option is not valid in AAPCS configurations
17149 because interworking is enabled by default.
17150
17151 @item -mcaller-super-interworking
17152 @opindex mcaller-super-interworking
17153 Allows calls via function pointers (including virtual functions) to
17154 execute correctly regardless of whether the target code has been
17155 compiled for interworking or not. There is a small overhead in the cost
17156 of executing a function pointer if this option is enabled. This option
17157 is not valid in AAPCS configurations because interworking is enabled
17158 by default.
17159
17160 @item -mtp=@var{name}
17161 @opindex mtp
17162 Specify the access model for the thread local storage pointer. The valid
17163 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17164 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17165 (supported in the arm6k architecture), and @samp{auto}, which uses the
17166 best available method for the selected processor. The default setting is
17167 @samp{auto}.
17168
17169 @item -mtls-dialect=@var{dialect}
17170 @opindex mtls-dialect
17171 Specify the dialect to use for accessing thread local storage. Two
17172 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17173 @samp{gnu} dialect selects the original GNU scheme for supporting
17174 local and global dynamic TLS models. The @samp{gnu2} dialect
17175 selects the GNU descriptor scheme, which provides better performance
17176 for shared libraries. The GNU descriptor scheme is compatible with
17177 the original scheme, but does require new assembler, linker and
17178 library support. Initial and local exec TLS models are unaffected by
17179 this option and always use the original scheme.
17180
17181 @item -mword-relocations
17182 @opindex mword-relocations
17183 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17184 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17185 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17186 is specified. This option conflicts with @option{-mslow-flash-data}.
17187
17188 @item -mfix-cortex-m3-ldrd
17189 @opindex mfix-cortex-m3-ldrd
17190 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17191 with overlapping destination and base registers are used. This option avoids
17192 generating these instructions. This option is enabled by default when
17193 @option{-mcpu=cortex-m3} is specified.
17194
17195 @item -munaligned-access
17196 @itemx -mno-unaligned-access
17197 @opindex munaligned-access
17198 @opindex mno-unaligned-access
17199 Enables (or disables) reading and writing of 16- and 32- bit values
17200 from addresses that are not 16- or 32- bit aligned. By default
17201 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17202 ARMv8-M Baseline architectures, and enabled for all other
17203 architectures. If unaligned access is not enabled then words in packed
17204 data structures are accessed a byte at a time.
17205
17206 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17207 generated object file to either true or false, depending upon the
17208 setting of this option. If unaligned access is enabled then the
17209 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17210 defined.
17211
17212 @item -mneon-for-64bits
17213 @opindex mneon-for-64bits
17214 Enables using Neon to handle scalar 64-bits operations. This is
17215 disabled by default since the cost of moving data from core registers
17216 to Neon is high.
17217
17218 @item -mslow-flash-data
17219 @opindex mslow-flash-data
17220 Assume loading data from flash is slower than fetching instruction.
17221 Therefore literal load is minimized for better performance.
17222 This option is only supported when compiling for ARMv7 M-profile and
17223 off by default. It conflicts with @option{-mword-relocations}.
17224
17225 @item -masm-syntax-unified
17226 @opindex masm-syntax-unified
17227 Assume inline assembler is using unified asm syntax. The default is
17228 currently off which implies divided syntax. This option has no impact
17229 on Thumb2. However, this may change in future releases of GCC.
17230 Divided syntax should be considered deprecated.
17231
17232 @item -mrestrict-it
17233 @opindex mrestrict-it
17234 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17235 IT blocks can only contain a single 16-bit instruction from a select
17236 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17237
17238 @item -mprint-tune-info
17239 @opindex mprint-tune-info
17240 Print CPU tuning information as comment in assembler file. This is
17241 an option used only for regression testing of the compiler and not
17242 intended for ordinary use in compiling code. This option is disabled
17243 by default.
17244
17245 @item -mverbose-cost-dump
17246 @opindex mverbose-cost-dump
17247 Enable verbose cost model dumping in the debug dump files. This option is
17248 provided for use in debugging the compiler.
17249
17250 @item -mpure-code
17251 @opindex mpure-code
17252 Do not allow constant data to be placed in code sections.
17253 Additionally, when compiling for ELF object format give all text sections the
17254 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
17255 is only available when generating non-pic code for M-profile targets with the
17256 MOVT instruction.
17257
17258 @item -mcmse
17259 @opindex mcmse
17260 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
17261 Development Tools Engineering Specification", which can be found on
17262 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
17263 @end table
17264
17265 @node AVR Options
17266 @subsection AVR Options
17267 @cindex AVR Options
17268
17269 These options are defined for AVR implementations:
17270
17271 @table @gcctabopt
17272 @item -mmcu=@var{mcu}
17273 @opindex mmcu
17274 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17275
17276 The default for this option is@tie{}@samp{avr2}.
17277
17278 GCC supports the following AVR devices and ISAs:
17279
17280 @include avr-mmcu.texi
17281
17282 @item -mabsdata
17283 @opindex mabsdata
17284
17285 Assume that all data in static storage can be accessed by LDS / STS
17286 instructions. This option has only an effect on reduced Tiny devices like
17287 ATtiny40. See also the @code{absdata}
17288 @ref{AVR Variable Attributes,variable attribute}.
17289
17290 @item -maccumulate-args
17291 @opindex maccumulate-args
17292 Accumulate outgoing function arguments and acquire/release the needed
17293 stack space for outgoing function arguments once in function
17294 prologue/epilogue. Without this option, outgoing arguments are pushed
17295 before calling a function and popped afterwards.
17296
17297 Popping the arguments after the function call can be expensive on
17298 AVR so that accumulating the stack space might lead to smaller
17299 executables because arguments need not be removed from the
17300 stack after such a function call.
17301
17302 This option can lead to reduced code size for functions that perform
17303 several calls to functions that get their arguments on the stack like
17304 calls to printf-like functions.
17305
17306 @item -mbranch-cost=@var{cost}
17307 @opindex mbranch-cost
17308 Set the branch costs for conditional branch instructions to
17309 @var{cost}. Reasonable values for @var{cost} are small, non-negative
17310 integers. The default branch cost is 0.
17311
17312 @item -mcall-prologues
17313 @opindex mcall-prologues
17314 Functions prologues/epilogues are expanded as calls to appropriate
17315 subroutines. Code size is smaller.
17316
17317 @item -mgas-isr-prologues
17318 @opindex mgas-isr-prologues
17319 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
17320 instruction supported by GNU Binutils.
17321 If this option is on, the feature can still be disabled for individual
17322 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
17323 function attribute. This feature is activated per default
17324 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
17325 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
17326
17327 @item -mint8
17328 @opindex mint8
17329 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
17330 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
17331 and @code{long long} is 4 bytes. Please note that this option does not
17332 conform to the C standards, but it results in smaller code
17333 size.
17334
17335 @item -mmain-is-OS_task
17336 @opindex mmain-is-OS_task
17337 Do not save registers in @code{main}. The effect is the same like
17338 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
17339 to @code{main}. It is activated per default if optimization is on.
17340
17341 @item -mn-flash=@var{num}
17342 @opindex mn-flash
17343 Assume that the flash memory has a size of
17344 @var{num} times 64@tie{}KiB.
17345
17346 @item -mno-interrupts
17347 @opindex mno-interrupts
17348 Generated code is not compatible with hardware interrupts.
17349 Code size is smaller.
17350
17351 @item -mrelax
17352 @opindex mrelax
17353 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
17354 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
17355 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
17356 the assembler's command line and the @option{--relax} option to the
17357 linker's command line.
17358
17359 Jump relaxing is performed by the linker because jump offsets are not
17360 known before code is located. Therefore, the assembler code generated by the
17361 compiler is the same, but the instructions in the executable may
17362 differ from instructions in the assembler code.
17363
17364 Relaxing must be turned on if linker stubs are needed, see the
17365 section on @code{EIND} and linker stubs below.
17366
17367 @item -mrmw
17368 @opindex mrmw
17369 Assume that the device supports the Read-Modify-Write
17370 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
17371
17372 @item -mshort-calls
17373 @opindex mshort-calls
17374
17375 Assume that @code{RJMP} and @code{RCALL} can target the whole
17376 program memory.
17377
17378 This option is used internally for multilib selection. It is
17379 not an optimization option, and you don't need to set it by hand.
17380
17381 @item -msp8
17382 @opindex msp8
17383 Treat the stack pointer register as an 8-bit register,
17384 i.e.@: assume the high byte of the stack pointer is zero.
17385 In general, you don't need to set this option by hand.
17386
17387 This option is used internally by the compiler to select and
17388 build multilibs for architectures @code{avr2} and @code{avr25}.
17389 These architectures mix devices with and without @code{SPH}.
17390 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
17391 the compiler driver adds or removes this option from the compiler
17392 proper's command line, because the compiler then knows if the device
17393 or architecture has an 8-bit stack pointer and thus no @code{SPH}
17394 register or not.
17395
17396 @item -mstrict-X
17397 @opindex mstrict-X
17398 Use address register @code{X} in a way proposed by the hardware. This means
17399 that @code{X} is only used in indirect, post-increment or
17400 pre-decrement addressing.
17401
17402 Without this option, the @code{X} register may be used in the same way
17403 as @code{Y} or @code{Z} which then is emulated by additional
17404 instructions.
17405 For example, loading a value with @code{X+const} addressing with a
17406 small non-negative @code{const < 64} to a register @var{Rn} is
17407 performed as
17408
17409 @example
17410 adiw r26, const ; X += const
17411 ld @var{Rn}, X ; @var{Rn} = *X
17412 sbiw r26, const ; X -= const
17413 @end example
17414
17415 @item -mtiny-stack
17416 @opindex mtiny-stack
17417 Only change the lower 8@tie{}bits of the stack pointer.
17418
17419 @item -mfract-convert-truncate
17420 @opindex mfract-convert-truncate
17421 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
17422
17423 @item -nodevicelib
17424 @opindex nodevicelib
17425 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
17426
17427 @item -Waddr-space-convert
17428 @opindex Waddr-space-convert
17429 @opindex Wno-addr-space-convert
17430 Warn about conversions between address spaces in the case where the
17431 resulting address space is not contained in the incoming address space.
17432
17433 @item -Wmisspelled-isr
17434 @opindex Wmisspelled-isr
17435 @opindex Wno-misspelled-isr
17436 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
17437 Enabled by default.
17438 @end table
17439
17440 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
17441 @cindex @code{EIND}
17442 Pointers in the implementation are 16@tie{}bits wide.
17443 The address of a function or label is represented as word address so
17444 that indirect jumps and calls can target any code address in the
17445 range of 64@tie{}Ki words.
17446
17447 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
17448 bytes of program memory space, there is a special function register called
17449 @code{EIND} that serves as most significant part of the target address
17450 when @code{EICALL} or @code{EIJMP} instructions are used.
17451
17452 Indirect jumps and calls on these devices are handled as follows by
17453 the compiler and are subject to some limitations:
17454
17455 @itemize @bullet
17456
17457 @item
17458 The compiler never sets @code{EIND}.
17459
17460 @item
17461 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
17462 instructions or might read @code{EIND} directly in order to emulate an
17463 indirect call/jump by means of a @code{RET} instruction.
17464
17465 @item
17466 The compiler assumes that @code{EIND} never changes during the startup
17467 code or during the application. In particular, @code{EIND} is not
17468 saved/restored in function or interrupt service routine
17469 prologue/epilogue.
17470
17471 @item
17472 For indirect calls to functions and computed goto, the linker
17473 generates @emph{stubs}. Stubs are jump pads sometimes also called
17474 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
17475 The stub contains a direct jump to the desired address.
17476
17477 @item
17478 Linker relaxation must be turned on so that the linker generates
17479 the stubs correctly in all situations. See the compiler option
17480 @option{-mrelax} and the linker option @option{--relax}.
17481 There are corner cases where the linker is supposed to generate stubs
17482 but aborts without relaxation and without a helpful error message.
17483
17484 @item
17485 The default linker script is arranged for code with @code{EIND = 0}.
17486 If code is supposed to work for a setup with @code{EIND != 0}, a custom
17487 linker script has to be used in order to place the sections whose
17488 name start with @code{.trampolines} into the segment where @code{EIND}
17489 points to.
17490
17491 @item
17492 The startup code from libgcc never sets @code{EIND}.
17493 Notice that startup code is a blend of code from libgcc and AVR-LibC.
17494 For the impact of AVR-LibC on @code{EIND}, see the
17495 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
17496
17497 @item
17498 It is legitimate for user-specific startup code to set up @code{EIND}
17499 early, for example by means of initialization code located in
17500 section @code{.init3}. Such code runs prior to general startup code
17501 that initializes RAM and calls constructors, but after the bit
17502 of startup code from AVR-LibC that sets @code{EIND} to the segment
17503 where the vector table is located.
17504 @example
17505 #include <avr/io.h>
17506
17507 static void
17508 __attribute__((section(".init3"),naked,used,no_instrument_function))
17509 init3_set_eind (void)
17510 @{
17511 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
17512 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
17513 @}
17514 @end example
17515
17516 @noindent
17517 The @code{__trampolines_start} symbol is defined in the linker script.
17518
17519 @item
17520 Stubs are generated automatically by the linker if
17521 the following two conditions are met:
17522 @itemize @minus
17523
17524 @item The address of a label is taken by means of the @code{gs} modifier
17525 (short for @emph{generate stubs}) like so:
17526 @example
17527 LDI r24, lo8(gs(@var{func}))
17528 LDI r25, hi8(gs(@var{func}))
17529 @end example
17530 @item The final location of that label is in a code segment
17531 @emph{outside} the segment where the stubs are located.
17532 @end itemize
17533
17534 @item
17535 The compiler emits such @code{gs} modifiers for code labels in the
17536 following situations:
17537 @itemize @minus
17538 @item Taking address of a function or code label.
17539 @item Computed goto.
17540 @item If prologue-save function is used, see @option{-mcall-prologues}
17541 command-line option.
17542 @item Switch/case dispatch tables. If you do not want such dispatch
17543 tables you can specify the @option{-fno-jump-tables} command-line option.
17544 @item C and C++ constructors/destructors called during startup/shutdown.
17545 @item If the tools hit a @code{gs()} modifier explained above.
17546 @end itemize
17547
17548 @item
17549 Jumping to non-symbolic addresses like so is @emph{not} supported:
17550
17551 @example
17552 int main (void)
17553 @{
17554 /* Call function at word address 0x2 */
17555 return ((int(*)(void)) 0x2)();
17556 @}
17557 @end example
17558
17559 Instead, a stub has to be set up, i.e.@: the function has to be called
17560 through a symbol (@code{func_4} in the example):
17561
17562 @example
17563 int main (void)
17564 @{
17565 extern int func_4 (void);
17566
17567 /* Call function at byte address 0x4 */
17568 return func_4();
17569 @}
17570 @end example
17571
17572 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
17573 Alternatively, @code{func_4} can be defined in the linker script.
17574 @end itemize
17575
17576 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
17577 @cindex @code{RAMPD}
17578 @cindex @code{RAMPX}
17579 @cindex @code{RAMPY}
17580 @cindex @code{RAMPZ}
17581 Some AVR devices support memories larger than the 64@tie{}KiB range
17582 that can be accessed with 16-bit pointers. To access memory locations
17583 outside this 64@tie{}KiB range, the content of a @code{RAMP}
17584 register is used as high part of the address:
17585 The @code{X}, @code{Y}, @code{Z} address register is concatenated
17586 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
17587 register, respectively, to get a wide address. Similarly,
17588 @code{RAMPD} is used together with direct addressing.
17589
17590 @itemize
17591 @item
17592 The startup code initializes the @code{RAMP} special function
17593 registers with zero.
17594
17595 @item
17596 If a @ref{AVR Named Address Spaces,named address space} other than
17597 generic or @code{__flash} is used, then @code{RAMPZ} is set
17598 as needed before the operation.
17599
17600 @item
17601 If the device supports RAM larger than 64@tie{}KiB and the compiler
17602 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
17603 is reset to zero after the operation.
17604
17605 @item
17606 If the device comes with a specific @code{RAMP} register, the ISR
17607 prologue/epilogue saves/restores that SFR and initializes it with
17608 zero in case the ISR code might (implicitly) use it.
17609
17610 @item
17611 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
17612 If you use inline assembler to read from locations outside the
17613 16-bit address range and change one of the @code{RAMP} registers,
17614 you must reset it to zero after the access.
17615
17616 @end itemize
17617
17618 @subsubsection AVR Built-in Macros
17619
17620 GCC defines several built-in macros so that the user code can test
17621 for the presence or absence of features. Almost any of the following
17622 built-in macros are deduced from device capabilities and thus
17623 triggered by the @option{-mmcu=} command-line option.
17624
17625 For even more AVR-specific built-in macros see
17626 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
17627
17628 @table @code
17629
17630 @item __AVR_ARCH__
17631 Build-in macro that resolves to a decimal number that identifies the
17632 architecture and depends on the @option{-mmcu=@var{mcu}} option.
17633 Possible values are:
17634
17635 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
17636 @code{4}, @code{5}, @code{51}, @code{6}
17637
17638 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
17639 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
17640
17641 respectively and
17642
17643 @code{100},
17644 @code{102}, @code{103}, @code{104},
17645 @code{105}, @code{106}, @code{107}
17646
17647 for @var{mcu}=@code{avrtiny},
17648 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
17649 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
17650 If @var{mcu} specifies a device, this built-in macro is set
17651 accordingly. For example, with @option{-mmcu=atmega8} the macro is
17652 defined to @code{4}.
17653
17654 @item __AVR_@var{Device}__
17655 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
17656 the device's name. For example, @option{-mmcu=atmega8} defines the
17657 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
17658 @code{__AVR_ATtiny261A__}, etc.
17659
17660 The built-in macros' names follow
17661 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
17662 the device name as from the AVR user manual. The difference between
17663 @var{Device} in the built-in macro and @var{device} in
17664 @option{-mmcu=@var{device}} is that the latter is always lowercase.
17665
17666 If @var{device} is not a device but only a core architecture like
17667 @samp{avr51}, this macro is not defined.
17668
17669 @item __AVR_DEVICE_NAME__
17670 Setting @option{-mmcu=@var{device}} defines this built-in macro to
17671 the device's name. For example, with @option{-mmcu=atmega8} the macro
17672 is defined to @code{atmega8}.
17673
17674 If @var{device} is not a device but only a core architecture like
17675 @samp{avr51}, this macro is not defined.
17676
17677 @item __AVR_XMEGA__
17678 The device / architecture belongs to the XMEGA family of devices.
17679
17680 @item __AVR_HAVE_ELPM__
17681 The device has the @code{ELPM} instruction.
17682
17683 @item __AVR_HAVE_ELPMX__
17684 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
17685 R@var{n},Z+} instructions.
17686
17687 @item __AVR_HAVE_MOVW__
17688 The device has the @code{MOVW} instruction to perform 16-bit
17689 register-register moves.
17690
17691 @item __AVR_HAVE_LPMX__
17692 The device has the @code{LPM R@var{n},Z} and
17693 @code{LPM R@var{n},Z+} instructions.
17694
17695 @item __AVR_HAVE_MUL__
17696 The device has a hardware multiplier.
17697
17698 @item __AVR_HAVE_JMP_CALL__
17699 The device has the @code{JMP} and @code{CALL} instructions.
17700 This is the case for devices with more than 8@tie{}KiB of program
17701 memory.
17702
17703 @item __AVR_HAVE_EIJMP_EICALL__
17704 @itemx __AVR_3_BYTE_PC__
17705 The device has the @code{EIJMP} and @code{EICALL} instructions.
17706 This is the case for devices with more than 128@tie{}KiB of program memory.
17707 This also means that the program counter
17708 (PC) is 3@tie{}bytes wide.
17709
17710 @item __AVR_2_BYTE_PC__
17711 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
17712 with up to 128@tie{}KiB of program memory.
17713
17714 @item __AVR_HAVE_8BIT_SP__
17715 @itemx __AVR_HAVE_16BIT_SP__
17716 The stack pointer (SP) register is treated as 8-bit respectively
17717 16-bit register by the compiler.
17718 The definition of these macros is affected by @option{-mtiny-stack}.
17719
17720 @item __AVR_HAVE_SPH__
17721 @itemx __AVR_SP8__
17722 The device has the SPH (high part of stack pointer) special function
17723 register or has an 8-bit stack pointer, respectively.
17724 The definition of these macros is affected by @option{-mmcu=} and
17725 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
17726 by @option{-msp8}.
17727
17728 @item __AVR_HAVE_RAMPD__
17729 @itemx __AVR_HAVE_RAMPX__
17730 @itemx __AVR_HAVE_RAMPY__
17731 @itemx __AVR_HAVE_RAMPZ__
17732 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
17733 @code{RAMPZ} special function register, respectively.
17734
17735 @item __NO_INTERRUPTS__
17736 This macro reflects the @option{-mno-interrupts} command-line option.
17737
17738 @item __AVR_ERRATA_SKIP__
17739 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
17740 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
17741 instructions because of a hardware erratum. Skip instructions are
17742 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
17743 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
17744 set.
17745
17746 @item __AVR_ISA_RMW__
17747 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
17748
17749 @item __AVR_SFR_OFFSET__=@var{offset}
17750 Instructions that can address I/O special function registers directly
17751 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
17752 address as if addressed by an instruction to access RAM like @code{LD}
17753 or @code{STS}. This offset depends on the device architecture and has
17754 to be subtracted from the RAM address in order to get the
17755 respective I/O@tie{}address.
17756
17757 @item __AVR_SHORT_CALLS__
17758 The @option{-mshort-calls} command line option is set.
17759
17760 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
17761 Some devices support reading from flash memory by means of @code{LD*}
17762 instructions. The flash memory is seen in the data address space
17763 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
17764 is not defined, this feature is not available. If defined,
17765 the address space is linear and there is no need to put
17766 @code{.rodata} into RAM. This is handled by the default linker
17767 description file, and is currently available for
17768 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
17769 there is no need to use address spaces like @code{__flash} or
17770 features like attribute @code{progmem} and @code{pgm_read_*}.
17771
17772 @item __WITH_AVRLIBC__
17773 The compiler is configured to be used together with AVR-Libc.
17774 See the @option{--with-avrlibc} configure option.
17775
17776 @end table
17777
17778 @node Blackfin Options
17779 @subsection Blackfin Options
17780 @cindex Blackfin Options
17781
17782 @table @gcctabopt
17783 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
17784 @opindex mcpu=
17785 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
17786 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
17787 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
17788 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
17789 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
17790 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
17791 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
17792 @samp{bf561}, @samp{bf592}.
17793
17794 The optional @var{sirevision} specifies the silicon revision of the target
17795 Blackfin processor. Any workarounds available for the targeted silicon revision
17796 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
17797 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
17798 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
17799 hexadecimal digits representing the major and minor numbers in the silicon
17800 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
17801 is not defined. If @var{sirevision} is @samp{any}, the
17802 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
17803 If this optional @var{sirevision} is not used, GCC assumes the latest known
17804 silicon revision of the targeted Blackfin processor.
17805
17806 GCC defines a preprocessor macro for the specified @var{cpu}.
17807 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
17808 provided by libgloss to be linked in if @option{-msim} is not given.
17809
17810 Without this option, @samp{bf532} is used as the processor by default.
17811
17812 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
17813 only the preprocessor macro is defined.
17814
17815 @item -msim
17816 @opindex msim
17817 Specifies that the program will be run on the simulator. This causes
17818 the simulator BSP provided by libgloss to be linked in. This option
17819 has effect only for @samp{bfin-elf} toolchain.
17820 Certain other options, such as @option{-mid-shared-library} and
17821 @option{-mfdpic}, imply @option{-msim}.
17822
17823 @item -momit-leaf-frame-pointer
17824 @opindex momit-leaf-frame-pointer
17825 Don't keep the frame pointer in a register for leaf functions. This
17826 avoids the instructions to save, set up and restore frame pointers and
17827 makes an extra register available in leaf functions.
17828
17829 @item -mspecld-anomaly
17830 @opindex mspecld-anomaly
17831 When enabled, the compiler ensures that the generated code does not
17832 contain speculative loads after jump instructions. If this option is used,
17833 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
17834
17835 @item -mno-specld-anomaly
17836 @opindex mno-specld-anomaly
17837 @opindex mspecld-anomaly
17838 Don't generate extra code to prevent speculative loads from occurring.
17839
17840 @item -mcsync-anomaly
17841 @opindex mcsync-anomaly
17842 When enabled, the compiler ensures that the generated code does not
17843 contain CSYNC or SSYNC instructions too soon after conditional branches.
17844 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
17845
17846 @item -mno-csync-anomaly
17847 @opindex mno-csync-anomaly
17848 @opindex mcsync-anomaly
17849 Don't generate extra code to prevent CSYNC or SSYNC instructions from
17850 occurring too soon after a conditional branch.
17851
17852 @item -mlow64k
17853 @opindex mlow64k
17854 When enabled, the compiler is free to take advantage of the knowledge that
17855 the entire program fits into the low 64k of memory.
17856
17857 @item -mno-low64k
17858 @opindex mno-low64k
17859 Assume that the program is arbitrarily large. This is the default.
17860
17861 @item -mstack-check-l1
17862 @opindex mstack-check-l1
17863 Do stack checking using information placed into L1 scratchpad memory by the
17864 uClinux kernel.
17865
17866 @item -mid-shared-library
17867 @opindex mid-shared-library
17868 Generate code that supports shared libraries via the library ID method.
17869 This allows for execute in place and shared libraries in an environment
17870 without virtual memory management. This option implies @option{-fPIC}.
17871 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17872
17873 @item -mno-id-shared-library
17874 @opindex mno-id-shared-library
17875 @opindex mid-shared-library
17876 Generate code that doesn't assume ID-based shared libraries are being used.
17877 This is the default.
17878
17879 @item -mleaf-id-shared-library
17880 @opindex mleaf-id-shared-library
17881 Generate code that supports shared libraries via the library ID method,
17882 but assumes that this library or executable won't link against any other
17883 ID shared libraries. That allows the compiler to use faster code for jumps
17884 and calls.
17885
17886 @item -mno-leaf-id-shared-library
17887 @opindex mno-leaf-id-shared-library
17888 @opindex mleaf-id-shared-library
17889 Do not assume that the code being compiled won't link against any ID shared
17890 libraries. Slower code is generated for jump and call insns.
17891
17892 @item -mshared-library-id=n
17893 @opindex mshared-library-id
17894 Specifies the identification number of the ID-based shared library being
17895 compiled. Specifying a value of 0 generates more compact code; specifying
17896 other values forces the allocation of that number to the current
17897 library but is no more space- or time-efficient than omitting this option.
17898
17899 @item -msep-data
17900 @opindex msep-data
17901 Generate code that allows the data segment to be located in a different
17902 area of memory from the text segment. This allows for execute in place in
17903 an environment without virtual memory management by eliminating relocations
17904 against the text section.
17905
17906 @item -mno-sep-data
17907 @opindex mno-sep-data
17908 @opindex msep-data
17909 Generate code that assumes that the data segment follows the text segment.
17910 This is the default.
17911
17912 @item -mlong-calls
17913 @itemx -mno-long-calls
17914 @opindex mlong-calls
17915 @opindex mno-long-calls
17916 Tells the compiler to perform function calls by first loading the
17917 address of the function into a register and then performing a subroutine
17918 call on this register. This switch is needed if the target function
17919 lies outside of the 24-bit addressing range of the offset-based
17920 version of subroutine call instruction.
17921
17922 This feature is not enabled by default. Specifying
17923 @option{-mno-long-calls} restores the default behavior. Note these
17924 switches have no effect on how the compiler generates code to handle
17925 function calls via function pointers.
17926
17927 @item -mfast-fp
17928 @opindex mfast-fp
17929 Link with the fast floating-point library. This library relaxes some of
17930 the IEEE floating-point standard's rules for checking inputs against
17931 Not-a-Number (NAN), in the interest of performance.
17932
17933 @item -minline-plt
17934 @opindex minline-plt
17935 Enable inlining of PLT entries in function calls to functions that are
17936 not known to bind locally. It has no effect without @option{-mfdpic}.
17937
17938 @item -mmulticore
17939 @opindex mmulticore
17940 Build a standalone application for multicore Blackfin processors.
17941 This option causes proper start files and link scripts supporting
17942 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
17943 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
17944
17945 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
17946 selects the one-application-per-core programming model. Without
17947 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
17948 programming model is used. In this model, the main function of Core B
17949 should be named as @code{coreb_main}.
17950
17951 If this option is not used, the single-core application programming
17952 model is used.
17953
17954 @item -mcorea
17955 @opindex mcorea
17956 Build a standalone application for Core A of BF561 when using
17957 the one-application-per-core programming model. Proper start files
17958 and link scripts are used to support Core A, and the macro
17959 @code{__BFIN_COREA} is defined.
17960 This option can only be used in conjunction with @option{-mmulticore}.
17961
17962 @item -mcoreb
17963 @opindex mcoreb
17964 Build a standalone application for Core B of BF561 when using
17965 the one-application-per-core programming model. Proper start files
17966 and link scripts are used to support Core B, and the macro
17967 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
17968 should be used instead of @code{main}.
17969 This option can only be used in conjunction with @option{-mmulticore}.
17970
17971 @item -msdram
17972 @opindex msdram
17973 Build a standalone application for SDRAM. Proper start files and
17974 link scripts are used to put the application into SDRAM, and the macro
17975 @code{__BFIN_SDRAM} is defined.
17976 The loader should initialize SDRAM before loading the application.
17977
17978 @item -micplb
17979 @opindex micplb
17980 Assume that ICPLBs are enabled at run time. This has an effect on certain
17981 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
17982 are enabled; for standalone applications the default is off.
17983 @end table
17984
17985 @node C6X Options
17986 @subsection C6X Options
17987 @cindex C6X Options
17988
17989 @table @gcctabopt
17990 @item -march=@var{name}
17991 @opindex march
17992 This specifies the name of the target architecture. GCC uses this
17993 name to determine what kind of instructions it can emit when generating
17994 assembly code. Permissible names are: @samp{c62x},
17995 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
17996
17997 @item -mbig-endian
17998 @opindex mbig-endian
17999 Generate code for a big-endian target.
18000
18001 @item -mlittle-endian
18002 @opindex mlittle-endian
18003 Generate code for a little-endian target. This is the default.
18004
18005 @item -msim
18006 @opindex msim
18007 Choose startup files and linker script suitable for the simulator.
18008
18009 @item -msdata=default
18010 @opindex msdata=default
18011 Put small global and static data in the @code{.neardata} section,
18012 which is pointed to by register @code{B14}. Put small uninitialized
18013 global and static data in the @code{.bss} section, which is adjacent
18014 to the @code{.neardata} section. Put small read-only data into the
18015 @code{.rodata} section. The corresponding sections used for large
18016 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18017
18018 @item -msdata=all
18019 @opindex msdata=all
18020 Put all data, not just small objects, into the sections reserved for
18021 small data, and use addressing relative to the @code{B14} register to
18022 access them.
18023
18024 @item -msdata=none
18025 @opindex msdata=none
18026 Make no use of the sections reserved for small data, and use absolute
18027 addresses to access all data. Put all initialized global and static
18028 data in the @code{.fardata} section, and all uninitialized data in the
18029 @code{.far} section. Put all constant data into the @code{.const}
18030 section.
18031 @end table
18032
18033 @node CRIS Options
18034 @subsection CRIS Options
18035 @cindex CRIS Options
18036
18037 These options are defined specifically for the CRIS ports.
18038
18039 @table @gcctabopt
18040 @item -march=@var{architecture-type}
18041 @itemx -mcpu=@var{architecture-type}
18042 @opindex march
18043 @opindex mcpu
18044 Generate code for the specified architecture. The choices for
18045 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18046 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18047 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18048 @samp{v10}.
18049
18050 @item -mtune=@var{architecture-type}
18051 @opindex mtune
18052 Tune to @var{architecture-type} everything applicable about the generated
18053 code, except for the ABI and the set of available instructions. The
18054 choices for @var{architecture-type} are the same as for
18055 @option{-march=@var{architecture-type}}.
18056
18057 @item -mmax-stack-frame=@var{n}
18058 @opindex mmax-stack-frame
18059 Warn when the stack frame of a function exceeds @var{n} bytes.
18060
18061 @item -metrax4
18062 @itemx -metrax100
18063 @opindex metrax4
18064 @opindex metrax100
18065 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18066 @option{-march=v3} and @option{-march=v8} respectively.
18067
18068 @item -mmul-bug-workaround
18069 @itemx -mno-mul-bug-workaround
18070 @opindex mmul-bug-workaround
18071 @opindex mno-mul-bug-workaround
18072 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18073 models where it applies. This option is active by default.
18074
18075 @item -mpdebug
18076 @opindex mpdebug
18077 Enable CRIS-specific verbose debug-related information in the assembly
18078 code. This option also has the effect of turning off the @samp{#NO_APP}
18079 formatted-code indicator to the assembler at the beginning of the
18080 assembly file.
18081
18082 @item -mcc-init
18083 @opindex mcc-init
18084 Do not use condition-code results from previous instruction; always emit
18085 compare and test instructions before use of condition codes.
18086
18087 @item -mno-side-effects
18088 @opindex mno-side-effects
18089 @opindex mside-effects
18090 Do not emit instructions with side effects in addressing modes other than
18091 post-increment.
18092
18093 @item -mstack-align
18094 @itemx -mno-stack-align
18095 @itemx -mdata-align
18096 @itemx -mno-data-align
18097 @itemx -mconst-align
18098 @itemx -mno-const-align
18099 @opindex mstack-align
18100 @opindex mno-stack-align
18101 @opindex mdata-align
18102 @opindex mno-data-align
18103 @opindex mconst-align
18104 @opindex mno-const-align
18105 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18106 stack frame, individual data and constants to be aligned for the maximum
18107 single data access size for the chosen CPU model. The default is to
18108 arrange for 32-bit alignment. ABI details such as structure layout are
18109 not affected by these options.
18110
18111 @item -m32-bit
18112 @itemx -m16-bit
18113 @itemx -m8-bit
18114 @opindex m32-bit
18115 @opindex m16-bit
18116 @opindex m8-bit
18117 Similar to the stack- data- and const-align options above, these options
18118 arrange for stack frame, writable data and constants to all be 32-bit,
18119 16-bit or 8-bit aligned. The default is 32-bit alignment.
18120
18121 @item -mno-prologue-epilogue
18122 @itemx -mprologue-epilogue
18123 @opindex mno-prologue-epilogue
18124 @opindex mprologue-epilogue
18125 With @option{-mno-prologue-epilogue}, the normal function prologue and
18126 epilogue which set up the stack frame are omitted and no return
18127 instructions or return sequences are generated in the code. Use this
18128 option only together with visual inspection of the compiled code: no
18129 warnings or errors are generated when call-saved registers must be saved,
18130 or storage for local variables needs to be allocated.
18131
18132 @item -mno-gotplt
18133 @itemx -mgotplt
18134 @opindex mno-gotplt
18135 @opindex mgotplt
18136 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18137 instruction sequences that load addresses for functions from the PLT part
18138 of the GOT rather than (traditional on other architectures) calls to the
18139 PLT@. The default is @option{-mgotplt}.
18140
18141 @item -melf
18142 @opindex melf
18143 Legacy no-op option only recognized with the cris-axis-elf and
18144 cris-axis-linux-gnu targets.
18145
18146 @item -mlinux
18147 @opindex mlinux
18148 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18149
18150 @item -sim
18151 @opindex sim
18152 This option, recognized for the cris-axis-elf, arranges
18153 to link with input-output functions from a simulator library. Code,
18154 initialized data and zero-initialized data are allocated consecutively.
18155
18156 @item -sim2
18157 @opindex sim2
18158 Like @option{-sim}, but pass linker options to locate initialized data at
18159 0x40000000 and zero-initialized data at 0x80000000.
18160 @end table
18161
18162 @node CR16 Options
18163 @subsection CR16 Options
18164 @cindex CR16 Options
18165
18166 These options are defined specifically for the CR16 ports.
18167
18168 @table @gcctabopt
18169
18170 @item -mmac
18171 @opindex mmac
18172 Enable the use of multiply-accumulate instructions. Disabled by default.
18173
18174 @item -mcr16cplus
18175 @itemx -mcr16c
18176 @opindex mcr16cplus
18177 @opindex mcr16c
18178 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18179 is default.
18180
18181 @item -msim
18182 @opindex msim
18183 Links the library libsim.a which is in compatible with simulator. Applicable
18184 to ELF compiler only.
18185
18186 @item -mint32
18187 @opindex mint32
18188 Choose integer type as 32-bit wide.
18189
18190 @item -mbit-ops
18191 @opindex mbit-ops
18192 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18193
18194 @item -mdata-model=@var{model}
18195 @opindex mdata-model
18196 Choose a data model. The choices for @var{model} are @samp{near},
18197 @samp{far} or @samp{medium}. @samp{medium} is default.
18198 However, @samp{far} is not valid with @option{-mcr16c}, as the
18199 CR16C architecture does not support the far data model.
18200 @end table
18201
18202 @node C-SKY Options
18203 @subsection C-SKY Options
18204 @cindex C-SKY Options
18205
18206 GCC supports these options when compiling for C-SKY V2 processors.
18207
18208 @table @gcctabopt
18209
18210 @item -march=@var{arch}
18211 @opindex march=
18212 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18213 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18214 The default is @samp{ck810}.
18215
18216 @item -mcpu=@var{cpu}
18217 @opindex mcpu=
18218 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18219 @samp{ck801}, @samp{ck801t},
18220 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18221 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18222 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18223 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18224 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18225 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18226 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18227 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18228 @samp{ck803eftr1}, @samp{ck803efhtr1},
18229 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18230 @samp{ck803sef}, @samp{ck803seft},
18231 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18232 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18233 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18234 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18235
18236 @item -mbig-endian
18237 @opindex mbig-endian
18238 @itemx -EB
18239 @opindex EB
18240 @itemx -mlittle-endian
18241 @opindex mlittle-endian
18242 @itemx -EL
18243 @opindex EL
18244
18245 Select big- or little-endian code. The default is little-endian.
18246
18247 @item -mhard-float
18248 @opindex mhard-float
18249 @itemx -msoft-float
18250 @opindex msoft-float
18251
18252 Select hardware or software floating-point implementations.
18253 The default is soft float.
18254
18255 @item -mdouble-float
18256 @itemx -mno-double-float
18257 @opindex mdouble-float
18258 When @option{-mhard-float} is in effect, enable generation of
18259 double-precision float instructions. This is the default except
18260 when compiling for CK803.
18261
18262 @item -mfdivdu
18263 @itemx -mno-fdivdu
18264 @opindex mfdivdu
18265 When @option{-mhard-float} is in effect, enable generation of
18266 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
18267 This is the default except when compiling for CK803.
18268
18269 @item -mfpu=@var{fpu}
18270 @opindex mfpu=
18271 Select the floating-point processor. This option can only be used with
18272 @option{-mhard-float}.
18273 Values for @var{fpu} are
18274 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
18275 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
18276 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
18277
18278 @item -melrw
18279 @itemx -mno-elrw
18280 @opindex melrw
18281 Enable the extended @code{lrw} instruction. This option defaults to on
18282 for CK801 and off otherwise.
18283
18284 @item -mistack
18285 @itemx -mno-istack
18286 @opindex mistack
18287 Enable interrupt stack instructions; the default is off.
18288
18289 The @option{-mistack} option is required to handle the
18290 @code{interrupt} and @code{isr} function attributes
18291 (@pxref{C-SKY Function Attributes}).
18292
18293 @item -mmp
18294 @opindex mmp
18295 Enable multiprocessor instructions; the default is off.
18296
18297 @item -mcp
18298 @opindex mcp
18299 Enable coprocessor instructions; the default is off.
18300
18301 @item -mcache
18302 @opindex mcache
18303 Enable coprocessor instructions; the default is off.
18304
18305 @item -msecurity
18306 @opindex msecurity
18307 Enable C-SKY security instructions; the default is off.
18308
18309 @item -mtrust
18310 @opindex mtrust
18311 Enable C-SKY trust instructions; the default is off.
18312
18313 @item -mdsp
18314 @opindex mdsp
18315 @itemx -medsp
18316 @opindex medsp
18317 @itemx -mvdsp
18318 @opindex mvdsp
18319 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
18320 All of these options default to off.
18321
18322 @item -mdiv
18323 @itemx -mno-div
18324 @opindex mdiv
18325 Generate divide instructions. Default is off.
18326
18327 @item -msmart
18328 @itemx -mno-smart
18329 @opindex msmart
18330 Generate code for Smart Mode, using only registers numbered 0-7 to allow
18331 use of 16-bit instructions. This option is ignored for CK801 where this
18332 is the required behavior, and it defaults to on for CK802.
18333 For other targets, the default is off.
18334
18335 @item -mhigh-registers
18336 @itemx -mno-high-registers
18337 @opindex mhigh-registers
18338 Generate code using the high registers numbered 16-31. This option
18339 is not supported on CK801, CK802, or CK803, and is enabled by default
18340 for other processors.
18341
18342 @item -manchor
18343 @itemx -mno-anchor
18344 @opindex manchor
18345 Generate code using global anchor symbol addresses.
18346
18347 @item -mpushpop
18348 @itemx -mno-pushpop
18349 @opindex mpushpop
18350 Generate code using @code{push} and @code{pop} instructions. This option
18351 defaults to on.
18352
18353 @item -mmultiple-stld
18354 @itemx -mstm
18355 @itemx -mno-multiple-stld
18356 @itemx -mno-stm
18357 @opindex mmultiple-stld
18358 Generate code using @code{stm} and @code{ldm} instructions. This option
18359 isn't supported on CK801 but is enabled by default on other processors.
18360
18361 @item -mconstpool
18362 @itemx -mno-constpool
18363 @opindex mconstpool
18364 Create constant pools in the compiler instead of deferring it to the
18365 assembler. This option is the default and required for correct code
18366 generation on CK801 and CK802, and is optional on other processors.
18367
18368 @item -mstack-size
18369 @item -mno-stack-size
18370 @opindex mstack-size
18371 Emit @code{.stack_size} directives for each function in the assembly
18372 output. This option defaults to off.
18373
18374 @item -mccrt
18375 @itemx -mno-ccrt
18376 @opindex mccrt
18377 Generate code for the C-SKY compiler runtime instead of libgcc. This
18378 option defaults to off.
18379
18380 @item -mbranch-cost=@var{n}
18381 @opindex mbranch-cost=
18382 Set the branch costs to roughly @code{n} instructions. The default is 1.
18383
18384 @item -msched-prolog
18385 @itemx -mno-sched-prolog
18386 @opindex msched-prolog
18387 Permit scheduling of function prologue and epilogue sequences. Using
18388 this option can result in code that is not compliant with the C-SKY V2 ABI
18389 prologue requirements and that cannot be debugged or backtraced.
18390 It is disabled by default.
18391
18392 @end table
18393
18394 @node Darwin Options
18395 @subsection Darwin Options
18396 @cindex Darwin options
18397
18398 These options are defined for all architectures running the Darwin operating
18399 system.
18400
18401 FSF GCC on Darwin does not create ``fat'' object files; it creates
18402 an object file for the single architecture that GCC was built to
18403 target. Apple's GCC on Darwin does create ``fat'' files if multiple
18404 @option{-arch} options are used; it does so by running the compiler or
18405 linker multiple times and joining the results together with
18406 @file{lipo}.
18407
18408 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
18409 @samp{i686}) is determined by the flags that specify the ISA
18410 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
18411 @option{-force_cpusubtype_ALL} option can be used to override this.
18412
18413 The Darwin tools vary in their behavior when presented with an ISA
18414 mismatch. The assembler, @file{as}, only permits instructions to
18415 be used that are valid for the subtype of the file it is generating,
18416 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
18417 The linker for shared libraries, @file{/usr/bin/libtool}, fails
18418 and prints an error if asked to create a shared library with a less
18419 restrictive subtype than its input files (for instance, trying to put
18420 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
18421 for executables, @command{ld}, quietly gives the executable the most
18422 restrictive subtype of any of its input files.
18423
18424 @table @gcctabopt
18425 @item -F@var{dir}
18426 @opindex F
18427 Add the framework directory @var{dir} to the head of the list of
18428 directories to be searched for header files. These directories are
18429 interleaved with those specified by @option{-I} options and are
18430 scanned in a left-to-right order.
18431
18432 A framework directory is a directory with frameworks in it. A
18433 framework is a directory with a @file{Headers} and/or
18434 @file{PrivateHeaders} directory contained directly in it that ends
18435 in @file{.framework}. The name of a framework is the name of this
18436 directory excluding the @file{.framework}. Headers associated with
18437 the framework are found in one of those two directories, with
18438 @file{Headers} being searched first. A subframework is a framework
18439 directory that is in a framework's @file{Frameworks} directory.
18440 Includes of subframework headers can only appear in a header of a
18441 framework that contains the subframework, or in a sibling subframework
18442 header. Two subframeworks are siblings if they occur in the same
18443 framework. A subframework should not have the same name as a
18444 framework; a warning is issued if this is violated. Currently a
18445 subframework cannot have subframeworks; in the future, the mechanism
18446 may be extended to support this. The standard frameworks can be found
18447 in @file{/System/Library/Frameworks} and
18448 @file{/Library/Frameworks}. An example include looks like
18449 @code{#include <Framework/header.h>}, where @file{Framework} denotes
18450 the name of the framework and @file{header.h} is found in the
18451 @file{PrivateHeaders} or @file{Headers} directory.
18452
18453 @item -iframework@var{dir}
18454 @opindex iframework
18455 Like @option{-F} except the directory is a treated as a system
18456 directory. The main difference between this @option{-iframework} and
18457 @option{-F} is that with @option{-iframework} the compiler does not
18458 warn about constructs contained within header files found via
18459 @var{dir}. This option is valid only for the C family of languages.
18460
18461 @item -gused
18462 @opindex gused
18463 Emit debugging information for symbols that are used. For stabs
18464 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
18465 This is by default ON@.
18466
18467 @item -gfull
18468 @opindex gfull
18469 Emit debugging information for all symbols and types.
18470
18471 @item -mmacosx-version-min=@var{version}
18472 The earliest version of MacOS X that this executable will run on
18473 is @var{version}. Typical values of @var{version} include @code{10.1},
18474 @code{10.2}, and @code{10.3.9}.
18475
18476 If the compiler was built to use the system's headers by default,
18477 then the default for this option is the system version on which the
18478 compiler is running, otherwise the default is to make choices that
18479 are compatible with as many systems and code bases as possible.
18480
18481 @item -mkernel
18482 @opindex mkernel
18483 Enable kernel development mode. The @option{-mkernel} option sets
18484 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
18485 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
18486 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
18487 applicable. This mode also sets @option{-mno-altivec},
18488 @option{-msoft-float}, @option{-fno-builtin} and
18489 @option{-mlong-branch} for PowerPC targets.
18490
18491 @item -mone-byte-bool
18492 @opindex mone-byte-bool
18493 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
18494 By default @code{sizeof(bool)} is @code{4} when compiling for
18495 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
18496 option has no effect on x86.
18497
18498 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
18499 to generate code that is not binary compatible with code generated
18500 without that switch. Using this switch may require recompiling all
18501 other modules in a program, including system libraries. Use this
18502 switch to conform to a non-default data model.
18503
18504 @item -mfix-and-continue
18505 @itemx -ffix-and-continue
18506 @itemx -findirect-data
18507 @opindex mfix-and-continue
18508 @opindex ffix-and-continue
18509 @opindex findirect-data
18510 Generate code suitable for fast turnaround development, such as to
18511 allow GDB to dynamically load @file{.o} files into already-running
18512 programs. @option{-findirect-data} and @option{-ffix-and-continue}
18513 are provided for backwards compatibility.
18514
18515 @item -all_load
18516 @opindex all_load
18517 Loads all members of static archive libraries.
18518 See man ld(1) for more information.
18519
18520 @item -arch_errors_fatal
18521 @opindex arch_errors_fatal
18522 Cause the errors having to do with files that have the wrong architecture
18523 to be fatal.
18524
18525 @item -bind_at_load
18526 @opindex bind_at_load
18527 Causes the output file to be marked such that the dynamic linker will
18528 bind all undefined references when the file is loaded or launched.
18529
18530 @item -bundle
18531 @opindex bundle
18532 Produce a Mach-o bundle format file.
18533 See man ld(1) for more information.
18534
18535 @item -bundle_loader @var{executable}
18536 @opindex bundle_loader
18537 This option specifies the @var{executable} that will load the build
18538 output file being linked. See man ld(1) for more information.
18539
18540 @item -dynamiclib
18541 @opindex dynamiclib
18542 When passed this option, GCC produces a dynamic library instead of
18543 an executable when linking, using the Darwin @file{libtool} command.
18544
18545 @item -force_cpusubtype_ALL
18546 @opindex force_cpusubtype_ALL
18547 This causes GCC's output file to have the @samp{ALL} subtype, instead of
18548 one controlled by the @option{-mcpu} or @option{-march} option.
18549
18550 @item -allowable_client @var{client_name}
18551 @itemx -client_name
18552 @itemx -compatibility_version
18553 @itemx -current_version
18554 @itemx -dead_strip
18555 @itemx -dependency-file
18556 @itemx -dylib_file
18557 @itemx -dylinker_install_name
18558 @itemx -dynamic
18559 @itemx -exported_symbols_list
18560 @itemx -filelist
18561 @need 800
18562 @itemx -flat_namespace
18563 @itemx -force_flat_namespace
18564 @itemx -headerpad_max_install_names
18565 @itemx -image_base
18566 @itemx -init
18567 @itemx -install_name
18568 @itemx -keep_private_externs
18569 @itemx -multi_module
18570 @itemx -multiply_defined
18571 @itemx -multiply_defined_unused
18572 @need 800
18573 @itemx -noall_load
18574 @itemx -no_dead_strip_inits_and_terms
18575 @itemx -nofixprebinding
18576 @itemx -nomultidefs
18577 @itemx -noprebind
18578 @itemx -noseglinkedit
18579 @itemx -pagezero_size
18580 @itemx -prebind
18581 @itemx -prebind_all_twolevel_modules
18582 @itemx -private_bundle
18583 @need 800
18584 @itemx -read_only_relocs
18585 @itemx -sectalign
18586 @itemx -sectobjectsymbols
18587 @itemx -whyload
18588 @itemx -seg1addr
18589 @itemx -sectcreate
18590 @itemx -sectobjectsymbols
18591 @itemx -sectorder
18592 @itemx -segaddr
18593 @itemx -segs_read_only_addr
18594 @need 800
18595 @itemx -segs_read_write_addr
18596 @itemx -seg_addr_table
18597 @itemx -seg_addr_table_filename
18598 @itemx -seglinkedit
18599 @itemx -segprot
18600 @itemx -segs_read_only_addr
18601 @itemx -segs_read_write_addr
18602 @itemx -single_module
18603 @itemx -static
18604 @itemx -sub_library
18605 @need 800
18606 @itemx -sub_umbrella
18607 @itemx -twolevel_namespace
18608 @itemx -umbrella
18609 @itemx -undefined
18610 @itemx -unexported_symbols_list
18611 @itemx -weak_reference_mismatches
18612 @itemx -whatsloaded
18613 @opindex allowable_client
18614 @opindex client_name
18615 @opindex compatibility_version
18616 @opindex current_version
18617 @opindex dead_strip
18618 @opindex dependency-file
18619 @opindex dylib_file
18620 @opindex dylinker_install_name
18621 @opindex dynamic
18622 @opindex exported_symbols_list
18623 @opindex filelist
18624 @opindex flat_namespace
18625 @opindex force_flat_namespace
18626 @opindex headerpad_max_install_names
18627 @opindex image_base
18628 @opindex init
18629 @opindex install_name
18630 @opindex keep_private_externs
18631 @opindex multi_module
18632 @opindex multiply_defined
18633 @opindex multiply_defined_unused
18634 @opindex noall_load
18635 @opindex no_dead_strip_inits_and_terms
18636 @opindex nofixprebinding
18637 @opindex nomultidefs
18638 @opindex noprebind
18639 @opindex noseglinkedit
18640 @opindex pagezero_size
18641 @opindex prebind
18642 @opindex prebind_all_twolevel_modules
18643 @opindex private_bundle
18644 @opindex read_only_relocs
18645 @opindex sectalign
18646 @opindex sectobjectsymbols
18647 @opindex whyload
18648 @opindex seg1addr
18649 @opindex sectcreate
18650 @opindex sectobjectsymbols
18651 @opindex sectorder
18652 @opindex segaddr
18653 @opindex segs_read_only_addr
18654 @opindex segs_read_write_addr
18655 @opindex seg_addr_table
18656 @opindex seg_addr_table_filename
18657 @opindex seglinkedit
18658 @opindex segprot
18659 @opindex segs_read_only_addr
18660 @opindex segs_read_write_addr
18661 @opindex single_module
18662 @opindex static
18663 @opindex sub_library
18664 @opindex sub_umbrella
18665 @opindex twolevel_namespace
18666 @opindex umbrella
18667 @opindex undefined
18668 @opindex unexported_symbols_list
18669 @opindex weak_reference_mismatches
18670 @opindex whatsloaded
18671 These options are passed to the Darwin linker. The Darwin linker man page
18672 describes them in detail.
18673 @end table
18674
18675 @node DEC Alpha Options
18676 @subsection DEC Alpha Options
18677
18678 These @samp{-m} options are defined for the DEC Alpha implementations:
18679
18680 @table @gcctabopt
18681 @item -mno-soft-float
18682 @itemx -msoft-float
18683 @opindex mno-soft-float
18684 @opindex msoft-float
18685 Use (do not use) the hardware floating-point instructions for
18686 floating-point operations. When @option{-msoft-float} is specified,
18687 functions in @file{libgcc.a} are used to perform floating-point
18688 operations. Unless they are replaced by routines that emulate the
18689 floating-point operations, or compiled in such a way as to call such
18690 emulations routines, these routines issue floating-point
18691 operations. If you are compiling for an Alpha without floating-point
18692 operations, you must ensure that the library is built so as not to call
18693 them.
18694
18695 Note that Alpha implementations without floating-point operations are
18696 required to have floating-point registers.
18697
18698 @item -mfp-reg
18699 @itemx -mno-fp-regs
18700 @opindex mfp-reg
18701 @opindex mno-fp-regs
18702 Generate code that uses (does not use) the floating-point register set.
18703 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
18704 register set is not used, floating-point operands are passed in integer
18705 registers as if they were integers and floating-point results are passed
18706 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
18707 so any function with a floating-point argument or return value called by code
18708 compiled with @option{-mno-fp-regs} must also be compiled with that
18709 option.
18710
18711 A typical use of this option is building a kernel that does not use,
18712 and hence need not save and restore, any floating-point registers.
18713
18714 @item -mieee
18715 @opindex mieee
18716 The Alpha architecture implements floating-point hardware optimized for
18717 maximum performance. It is mostly compliant with the IEEE floating-point
18718 standard. However, for full compliance, software assistance is
18719 required. This option generates code fully IEEE-compliant code
18720 @emph{except} that the @var{inexact-flag} is not maintained (see below).
18721 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
18722 defined during compilation. The resulting code is less efficient but is
18723 able to correctly support denormalized numbers and exceptional IEEE
18724 values such as not-a-number and plus/minus infinity. Other Alpha
18725 compilers call this option @option{-ieee_with_no_inexact}.
18726
18727 @item -mieee-with-inexact
18728 @opindex mieee-with-inexact
18729 This is like @option{-mieee} except the generated code also maintains
18730 the IEEE @var{inexact-flag}. Turning on this option causes the
18731 generated code to implement fully-compliant IEEE math. In addition to
18732 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
18733 macro. On some Alpha implementations the resulting code may execute
18734 significantly slower than the code generated by default. Since there is
18735 very little code that depends on the @var{inexact-flag}, you should
18736 normally not specify this option. Other Alpha compilers call this
18737 option @option{-ieee_with_inexact}.
18738
18739 @item -mfp-trap-mode=@var{trap-mode}
18740 @opindex mfp-trap-mode
18741 This option controls what floating-point related traps are enabled.
18742 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
18743 The trap mode can be set to one of four values:
18744
18745 @table @samp
18746 @item n
18747 This is the default (normal) setting. The only traps that are enabled
18748 are the ones that cannot be disabled in software (e.g., division by zero
18749 trap).
18750
18751 @item u
18752 In addition to the traps enabled by @samp{n}, underflow traps are enabled
18753 as well.
18754
18755 @item su
18756 Like @samp{u}, but the instructions are marked to be safe for software
18757 completion (see Alpha architecture manual for details).
18758
18759 @item sui
18760 Like @samp{su}, but inexact traps are enabled as well.
18761 @end table
18762
18763 @item -mfp-rounding-mode=@var{rounding-mode}
18764 @opindex mfp-rounding-mode
18765 Selects the IEEE rounding mode. Other Alpha compilers call this option
18766 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
18767 of:
18768
18769 @table @samp
18770 @item n
18771 Normal IEEE rounding mode. Floating-point numbers are rounded towards
18772 the nearest machine number or towards the even machine number in case
18773 of a tie.
18774
18775 @item m
18776 Round towards minus infinity.
18777
18778 @item c
18779 Chopped rounding mode. Floating-point numbers are rounded towards zero.
18780
18781 @item d
18782 Dynamic rounding mode. A field in the floating-point control register
18783 (@var{fpcr}, see Alpha architecture reference manual) controls the
18784 rounding mode in effect. The C library initializes this register for
18785 rounding towards plus infinity. Thus, unless your program modifies the
18786 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
18787 @end table
18788
18789 @item -mtrap-precision=@var{trap-precision}
18790 @opindex mtrap-precision
18791 In the Alpha architecture, floating-point traps are imprecise. This
18792 means without software assistance it is impossible to recover from a
18793 floating trap and program execution normally needs to be terminated.
18794 GCC can generate code that can assist operating system trap handlers
18795 in determining the exact location that caused a floating-point trap.
18796 Depending on the requirements of an application, different levels of
18797 precisions can be selected:
18798
18799 @table @samp
18800 @item p
18801 Program precision. This option is the default and means a trap handler
18802 can only identify which program caused a floating-point exception.
18803
18804 @item f
18805 Function precision. The trap handler can determine the function that
18806 caused a floating-point exception.
18807
18808 @item i
18809 Instruction precision. The trap handler can determine the exact
18810 instruction that caused a floating-point exception.
18811 @end table
18812
18813 Other Alpha compilers provide the equivalent options called
18814 @option{-scope_safe} and @option{-resumption_safe}.
18815
18816 @item -mieee-conformant
18817 @opindex mieee-conformant
18818 This option marks the generated code as IEEE conformant. You must not
18819 use this option unless you also specify @option{-mtrap-precision=i} and either
18820 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
18821 is to emit the line @samp{.eflag 48} in the function prologue of the
18822 generated assembly file.
18823
18824 @item -mbuild-constants
18825 @opindex mbuild-constants
18826 Normally GCC examines a 32- or 64-bit integer constant to
18827 see if it can construct it from smaller constants in two or three
18828 instructions. If it cannot, it outputs the constant as a literal and
18829 generates code to load it from the data segment at run time.
18830
18831 Use this option to require GCC to construct @emph{all} integer constants
18832 using code, even if it takes more instructions (the maximum is six).
18833
18834 You typically use this option to build a shared library dynamic
18835 loader. Itself a shared library, it must relocate itself in memory
18836 before it can find the variables and constants in its own data segment.
18837
18838 @item -mbwx
18839 @itemx -mno-bwx
18840 @itemx -mcix
18841 @itemx -mno-cix
18842 @itemx -mfix
18843 @itemx -mno-fix
18844 @itemx -mmax
18845 @itemx -mno-max
18846 @opindex mbwx
18847 @opindex mno-bwx
18848 @opindex mcix
18849 @opindex mno-cix
18850 @opindex mfix
18851 @opindex mno-fix
18852 @opindex mmax
18853 @opindex mno-max
18854 Indicate whether GCC should generate code to use the optional BWX,
18855 CIX, FIX and MAX instruction sets. The default is to use the instruction
18856 sets supported by the CPU type specified via @option{-mcpu=} option or that
18857 of the CPU on which GCC was built if none is specified.
18858
18859 @item -mfloat-vax
18860 @itemx -mfloat-ieee
18861 @opindex mfloat-vax
18862 @opindex mfloat-ieee
18863 Generate code that uses (does not use) VAX F and G floating-point
18864 arithmetic instead of IEEE single and double precision.
18865
18866 @item -mexplicit-relocs
18867 @itemx -mno-explicit-relocs
18868 @opindex mexplicit-relocs
18869 @opindex mno-explicit-relocs
18870 Older Alpha assemblers provided no way to generate symbol relocations
18871 except via assembler macros. Use of these macros does not allow
18872 optimal instruction scheduling. GNU binutils as of version 2.12
18873 supports a new syntax that allows the compiler to explicitly mark
18874 which relocations should apply to which instructions. This option
18875 is mostly useful for debugging, as GCC detects the capabilities of
18876 the assembler when it is built and sets the default accordingly.
18877
18878 @item -msmall-data
18879 @itemx -mlarge-data
18880 @opindex msmall-data
18881 @opindex mlarge-data
18882 When @option{-mexplicit-relocs} is in effect, static data is
18883 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
18884 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
18885 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
18886 16-bit relocations off of the @code{$gp} register. This limits the
18887 size of the small data area to 64KB, but allows the variables to be
18888 directly accessed via a single instruction.
18889
18890 The default is @option{-mlarge-data}. With this option the data area
18891 is limited to just below 2GB@. Programs that require more than 2GB of
18892 data must use @code{malloc} or @code{mmap} to allocate the data in the
18893 heap instead of in the program's data segment.
18894
18895 When generating code for shared libraries, @option{-fpic} implies
18896 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
18897
18898 @item -msmall-text
18899 @itemx -mlarge-text
18900 @opindex msmall-text
18901 @opindex mlarge-text
18902 When @option{-msmall-text} is used, the compiler assumes that the
18903 code of the entire program (or shared library) fits in 4MB, and is
18904 thus reachable with a branch instruction. When @option{-msmall-data}
18905 is used, the compiler can assume that all local symbols share the
18906 same @code{$gp} value, and thus reduce the number of instructions
18907 required for a function call from 4 to 1.
18908
18909 The default is @option{-mlarge-text}.
18910
18911 @item -mcpu=@var{cpu_type}
18912 @opindex mcpu
18913 Set the instruction set and instruction scheduling parameters for
18914 machine type @var{cpu_type}. You can specify either the @samp{EV}
18915 style name or the corresponding chip number. GCC supports scheduling
18916 parameters for the EV4, EV5 and EV6 family of processors and
18917 chooses the default values for the instruction set from the processor
18918 you specify. If you do not specify a processor type, GCC defaults
18919 to the processor on which the compiler was built.
18920
18921 Supported values for @var{cpu_type} are
18922
18923 @table @samp
18924 @item ev4
18925 @itemx ev45
18926 @itemx 21064
18927 Schedules as an EV4 and has no instruction set extensions.
18928
18929 @item ev5
18930 @itemx 21164
18931 Schedules as an EV5 and has no instruction set extensions.
18932
18933 @item ev56
18934 @itemx 21164a
18935 Schedules as an EV5 and supports the BWX extension.
18936
18937 @item pca56
18938 @itemx 21164pc
18939 @itemx 21164PC
18940 Schedules as an EV5 and supports the BWX and MAX extensions.
18941
18942 @item ev6
18943 @itemx 21264
18944 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
18945
18946 @item ev67
18947 @itemx 21264a
18948 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
18949 @end table
18950
18951 Native toolchains also support the value @samp{native},
18952 which selects the best architecture option for the host processor.
18953 @option{-mcpu=native} has no effect if GCC does not recognize
18954 the processor.
18955
18956 @item -mtune=@var{cpu_type}
18957 @opindex mtune
18958 Set only the instruction scheduling parameters for machine type
18959 @var{cpu_type}. The instruction set is not changed.
18960
18961 Native toolchains also support the value @samp{native},
18962 which selects the best architecture option for the host processor.
18963 @option{-mtune=native} has no effect if GCC does not recognize
18964 the processor.
18965
18966 @item -mmemory-latency=@var{time}
18967 @opindex mmemory-latency
18968 Sets the latency the scheduler should assume for typical memory
18969 references as seen by the application. This number is highly
18970 dependent on the memory access patterns used by the application
18971 and the size of the external cache on the machine.
18972
18973 Valid options for @var{time} are
18974
18975 @table @samp
18976 @item @var{number}
18977 A decimal number representing clock cycles.
18978
18979 @item L1
18980 @itemx L2
18981 @itemx L3
18982 @itemx main
18983 The compiler contains estimates of the number of clock cycles for
18984 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
18985 (also called Dcache, Scache, and Bcache), as well as to main memory.
18986 Note that L3 is only valid for EV5.
18987
18988 @end table
18989 @end table
18990
18991 @node FR30 Options
18992 @subsection FR30 Options
18993 @cindex FR30 Options
18994
18995 These options are defined specifically for the FR30 port.
18996
18997 @table @gcctabopt
18998
18999 @item -msmall-model
19000 @opindex msmall-model
19001 Use the small address space model. This can produce smaller code, but
19002 it does assume that all symbolic values and addresses fit into a
19003 20-bit range.
19004
19005 @item -mno-lsim
19006 @opindex mno-lsim
19007 Assume that runtime support has been provided and so there is no need
19008 to include the simulator library (@file{libsim.a}) on the linker
19009 command line.
19010
19011 @end table
19012
19013 @node FT32 Options
19014 @subsection FT32 Options
19015 @cindex FT32 Options
19016
19017 These options are defined specifically for the FT32 port.
19018
19019 @table @gcctabopt
19020
19021 @item -msim
19022 @opindex msim
19023 Specifies that the program will be run on the simulator. This causes
19024 an alternate runtime startup and library to be linked.
19025 You must not use this option when generating programs that will run on
19026 real hardware; you must provide your own runtime library for whatever
19027 I/O functions are needed.
19028
19029 @item -mlra
19030 @opindex mlra
19031 Enable Local Register Allocation. This is still experimental for FT32,
19032 so by default the compiler uses standard reload.
19033
19034 @item -mnodiv
19035 @opindex mnodiv
19036 Do not use div and mod instructions.
19037
19038 @item -mft32b
19039 @opindex mft32b
19040 Enable use of the extended instructions of the FT32B processor.
19041
19042 @item -mcompress
19043 @opindex mcompress
19044 Compress all code using the Ft32B code compression scheme.
19045
19046 @item -mnopm
19047 @opindex mnopm
19048 Do not generate code that reads program memory.
19049
19050 @end table
19051
19052 @node FRV Options
19053 @subsection FRV Options
19054 @cindex FRV Options
19055
19056 @table @gcctabopt
19057 @item -mgpr-32
19058 @opindex mgpr-32
19059
19060 Only use the first 32 general-purpose registers.
19061
19062 @item -mgpr-64
19063 @opindex mgpr-64
19064
19065 Use all 64 general-purpose registers.
19066
19067 @item -mfpr-32
19068 @opindex mfpr-32
19069
19070 Use only the first 32 floating-point registers.
19071
19072 @item -mfpr-64
19073 @opindex mfpr-64
19074
19075 Use all 64 floating-point registers.
19076
19077 @item -mhard-float
19078 @opindex mhard-float
19079
19080 Use hardware instructions for floating-point operations.
19081
19082 @item -msoft-float
19083 @opindex msoft-float
19084
19085 Use library routines for floating-point operations.
19086
19087 @item -malloc-cc
19088 @opindex malloc-cc
19089
19090 Dynamically allocate condition code registers.
19091
19092 @item -mfixed-cc
19093 @opindex mfixed-cc
19094
19095 Do not try to dynamically allocate condition code registers, only
19096 use @code{icc0} and @code{fcc0}.
19097
19098 @item -mdword
19099 @opindex mdword
19100
19101 Change ABI to use double word insns.
19102
19103 @item -mno-dword
19104 @opindex mno-dword
19105 @opindex mdword
19106
19107 Do not use double word instructions.
19108
19109 @item -mdouble
19110 @opindex mdouble
19111
19112 Use floating-point double instructions.
19113
19114 @item -mno-double
19115 @opindex mno-double
19116
19117 Do not use floating-point double instructions.
19118
19119 @item -mmedia
19120 @opindex mmedia
19121
19122 Use media instructions.
19123
19124 @item -mno-media
19125 @opindex mno-media
19126
19127 Do not use media instructions.
19128
19129 @item -mmuladd
19130 @opindex mmuladd
19131
19132 Use multiply and add/subtract instructions.
19133
19134 @item -mno-muladd
19135 @opindex mno-muladd
19136
19137 Do not use multiply and add/subtract instructions.
19138
19139 @item -mfdpic
19140 @opindex mfdpic
19141
19142 Select the FDPIC ABI, which uses function descriptors to represent
19143 pointers to functions. Without any PIC/PIE-related options, it
19144 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19145 assumes GOT entries and small data are within a 12-bit range from the
19146 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19147 are computed with 32 bits.
19148 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19149
19150 @item -minline-plt
19151 @opindex minline-plt
19152
19153 Enable inlining of PLT entries in function calls to functions that are
19154 not known to bind locally. It has no effect without @option{-mfdpic}.
19155 It's enabled by default if optimizing for speed and compiling for
19156 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19157 optimization option such as @option{-O3} or above is present in the
19158 command line.
19159
19160 @item -mTLS
19161 @opindex mTLS
19162
19163 Assume a large TLS segment when generating thread-local code.
19164
19165 @item -mtls
19166 @opindex mtls
19167
19168 Do not assume a large TLS segment when generating thread-local code.
19169
19170 @item -mgprel-ro
19171 @opindex mgprel-ro
19172
19173 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19174 that is known to be in read-only sections. It's enabled by default,
19175 except for @option{-fpic} or @option{-fpie}: even though it may help
19176 make the global offset table smaller, it trades 1 instruction for 4.
19177 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19178 one of which may be shared by multiple symbols, and it avoids the need
19179 for a GOT entry for the referenced symbol, so it's more likely to be a
19180 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19181
19182 @item -multilib-library-pic
19183 @opindex multilib-library-pic
19184
19185 Link with the (library, not FD) pic libraries. It's implied by
19186 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19187 @option{-fpic} without @option{-mfdpic}. You should never have to use
19188 it explicitly.
19189
19190 @item -mlinked-fp
19191 @opindex mlinked-fp
19192
19193 Follow the EABI requirement of always creating a frame pointer whenever
19194 a stack frame is allocated. This option is enabled by default and can
19195 be disabled with @option{-mno-linked-fp}.
19196
19197 @item -mlong-calls
19198 @opindex mlong-calls
19199
19200 Use indirect addressing to call functions outside the current
19201 compilation unit. This allows the functions to be placed anywhere
19202 within the 32-bit address space.
19203
19204 @item -malign-labels
19205 @opindex malign-labels
19206
19207 Try to align labels to an 8-byte boundary by inserting NOPs into the
19208 previous packet. This option only has an effect when VLIW packing
19209 is enabled. It doesn't create new packets; it merely adds NOPs to
19210 existing ones.
19211
19212 @item -mlibrary-pic
19213 @opindex mlibrary-pic
19214
19215 Generate position-independent EABI code.
19216
19217 @item -macc-4
19218 @opindex macc-4
19219
19220 Use only the first four media accumulator registers.
19221
19222 @item -macc-8
19223 @opindex macc-8
19224
19225 Use all eight media accumulator registers.
19226
19227 @item -mpack
19228 @opindex mpack
19229
19230 Pack VLIW instructions.
19231
19232 @item -mno-pack
19233 @opindex mno-pack
19234
19235 Do not pack VLIW instructions.
19236
19237 @item -mno-eflags
19238 @opindex mno-eflags
19239
19240 Do not mark ABI switches in e_flags.
19241
19242 @item -mcond-move
19243 @opindex mcond-move
19244
19245 Enable the use of conditional-move instructions (default).
19246
19247 This switch is mainly for debugging the compiler and will likely be removed
19248 in a future version.
19249
19250 @item -mno-cond-move
19251 @opindex mno-cond-move
19252
19253 Disable the use of conditional-move instructions.
19254
19255 This switch is mainly for debugging the compiler and will likely be removed
19256 in a future version.
19257
19258 @item -mscc
19259 @opindex mscc
19260
19261 Enable the use of conditional set instructions (default).
19262
19263 This switch is mainly for debugging the compiler and will likely be removed
19264 in a future version.
19265
19266 @item -mno-scc
19267 @opindex mno-scc
19268
19269 Disable the use of conditional set instructions.
19270
19271 This switch is mainly for debugging the compiler and will likely be removed
19272 in a future version.
19273
19274 @item -mcond-exec
19275 @opindex mcond-exec
19276
19277 Enable the use of conditional execution (default).
19278
19279 This switch is mainly for debugging the compiler and will likely be removed
19280 in a future version.
19281
19282 @item -mno-cond-exec
19283 @opindex mno-cond-exec
19284
19285 Disable the use of conditional execution.
19286
19287 This switch is mainly for debugging the compiler and will likely be removed
19288 in a future version.
19289
19290 @item -mvliw-branch
19291 @opindex mvliw-branch
19292
19293 Run a pass to pack branches into VLIW instructions (default).
19294
19295 This switch is mainly for debugging the compiler and will likely be removed
19296 in a future version.
19297
19298 @item -mno-vliw-branch
19299 @opindex mno-vliw-branch
19300
19301 Do not run a pass to pack branches into VLIW instructions.
19302
19303 This switch is mainly for debugging the compiler and will likely be removed
19304 in a future version.
19305
19306 @item -mmulti-cond-exec
19307 @opindex mmulti-cond-exec
19308
19309 Enable optimization of @code{&&} and @code{||} in conditional execution
19310 (default).
19311
19312 This switch is mainly for debugging the compiler and will likely be removed
19313 in a future version.
19314
19315 @item -mno-multi-cond-exec
19316 @opindex mno-multi-cond-exec
19317
19318 Disable optimization of @code{&&} and @code{||} in conditional execution.
19319
19320 This switch is mainly for debugging the compiler and will likely be removed
19321 in a future version.
19322
19323 @item -mnested-cond-exec
19324 @opindex mnested-cond-exec
19325
19326 Enable nested conditional execution optimizations (default).
19327
19328 This switch is mainly for debugging the compiler and will likely be removed
19329 in a future version.
19330
19331 @item -mno-nested-cond-exec
19332 @opindex mno-nested-cond-exec
19333
19334 Disable nested conditional execution optimizations.
19335
19336 This switch is mainly for debugging the compiler and will likely be removed
19337 in a future version.
19338
19339 @item -moptimize-membar
19340 @opindex moptimize-membar
19341
19342 This switch removes redundant @code{membar} instructions from the
19343 compiler-generated code. It is enabled by default.
19344
19345 @item -mno-optimize-membar
19346 @opindex mno-optimize-membar
19347 @opindex moptimize-membar
19348
19349 This switch disables the automatic removal of redundant @code{membar}
19350 instructions from the generated code.
19351
19352 @item -mtomcat-stats
19353 @opindex mtomcat-stats
19354
19355 Cause gas to print out tomcat statistics.
19356
19357 @item -mcpu=@var{cpu}
19358 @opindex mcpu
19359
19360 Select the processor type for which to generate code. Possible values are
19361 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
19362 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
19363
19364 @end table
19365
19366 @node GNU/Linux Options
19367 @subsection GNU/Linux Options
19368
19369 These @samp{-m} options are defined for GNU/Linux targets:
19370
19371 @table @gcctabopt
19372 @item -mglibc
19373 @opindex mglibc
19374 Use the GNU C library. This is the default except
19375 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
19376 @samp{*-*-linux-*android*} targets.
19377
19378 @item -muclibc
19379 @opindex muclibc
19380 Use uClibc C library. This is the default on
19381 @samp{*-*-linux-*uclibc*} targets.
19382
19383 @item -mmusl
19384 @opindex mmusl
19385 Use the musl C library. This is the default on
19386 @samp{*-*-linux-*musl*} targets.
19387
19388 @item -mbionic
19389 @opindex mbionic
19390 Use Bionic C library. This is the default on
19391 @samp{*-*-linux-*android*} targets.
19392
19393 @item -mandroid
19394 @opindex mandroid
19395 Compile code compatible with Android platform. This is the default on
19396 @samp{*-*-linux-*android*} targets.
19397
19398 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
19399 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
19400 this option makes the GCC driver pass Android-specific options to the linker.
19401 Finally, this option causes the preprocessor macro @code{__ANDROID__}
19402 to be defined.
19403
19404 @item -tno-android-cc
19405 @opindex tno-android-cc
19406 Disable compilation effects of @option{-mandroid}, i.e., do not enable
19407 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
19408 @option{-fno-rtti} by default.
19409
19410 @item -tno-android-ld
19411 @opindex tno-android-ld
19412 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
19413 linking options to the linker.
19414
19415 @end table
19416
19417 @node H8/300 Options
19418 @subsection H8/300 Options
19419
19420 These @samp{-m} options are defined for the H8/300 implementations:
19421
19422 @table @gcctabopt
19423 @item -mrelax
19424 @opindex mrelax
19425 Shorten some address references at link time, when possible; uses the
19426 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
19427 ld, Using ld}, for a fuller description.
19428
19429 @item -mh
19430 @opindex mh
19431 Generate code for the H8/300H@.
19432
19433 @item -ms
19434 @opindex ms
19435 Generate code for the H8S@.
19436
19437 @item -mn
19438 @opindex mn
19439 Generate code for the H8S and H8/300H in the normal mode. This switch
19440 must be used either with @option{-mh} or @option{-ms}.
19441
19442 @item -ms2600
19443 @opindex ms2600
19444 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
19445
19446 @item -mexr
19447 @opindex mexr
19448 Extended registers are stored on stack before execution of function
19449 with monitor attribute. Default option is @option{-mexr}.
19450 This option is valid only for H8S targets.
19451
19452 @item -mno-exr
19453 @opindex mno-exr
19454 @opindex mexr
19455 Extended registers are not stored on stack before execution of function
19456 with monitor attribute. Default option is @option{-mno-exr}.
19457 This option is valid only for H8S targets.
19458
19459 @item -mint32
19460 @opindex mint32
19461 Make @code{int} data 32 bits by default.
19462
19463 @item -malign-300
19464 @opindex malign-300
19465 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
19466 The default for the H8/300H and H8S is to align longs and floats on
19467 4-byte boundaries.
19468 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
19469 This option has no effect on the H8/300.
19470 @end table
19471
19472 @node HPPA Options
19473 @subsection HPPA Options
19474 @cindex HPPA Options
19475
19476 These @samp{-m} options are defined for the HPPA family of computers:
19477
19478 @table @gcctabopt
19479 @item -march=@var{architecture-type}
19480 @opindex march
19481 Generate code for the specified architecture. The choices for
19482 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
19483 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
19484 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
19485 architecture option for your machine. Code compiled for lower numbered
19486 architectures runs on higher numbered architectures, but not the
19487 other way around.
19488
19489 @item -mpa-risc-1-0
19490 @itemx -mpa-risc-1-1
19491 @itemx -mpa-risc-2-0
19492 @opindex mpa-risc-1-0
19493 @opindex mpa-risc-1-1
19494 @opindex mpa-risc-2-0
19495 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
19496
19497 @item -mcaller-copies
19498 @opindex mcaller-copies
19499 The caller copies function arguments passed by hidden reference. This
19500 option should be used with care as it is not compatible with the default
19501 32-bit runtime. However, only aggregates larger than eight bytes are
19502 passed by hidden reference and the option provides better compatibility
19503 with OpenMP.
19504
19505 @item -mjump-in-delay
19506 @opindex mjump-in-delay
19507 This option is ignored and provided for compatibility purposes only.
19508
19509 @item -mdisable-fpregs
19510 @opindex mdisable-fpregs
19511 Prevent floating-point registers from being used in any manner. This is
19512 necessary for compiling kernels that perform lazy context switching of
19513 floating-point registers. If you use this option and attempt to perform
19514 floating-point operations, the compiler aborts.
19515
19516 @item -mdisable-indexing
19517 @opindex mdisable-indexing
19518 Prevent the compiler from using indexing address modes. This avoids some
19519 rather obscure problems when compiling MIG generated code under MACH@.
19520
19521 @item -mno-space-regs
19522 @opindex mno-space-regs
19523 @opindex mspace-regs
19524 Generate code that assumes the target has no space registers. This allows
19525 GCC to generate faster indirect calls and use unscaled index address modes.
19526
19527 Such code is suitable for level 0 PA systems and kernels.
19528
19529 @item -mfast-indirect-calls
19530 @opindex mfast-indirect-calls
19531 Generate code that assumes calls never cross space boundaries. This
19532 allows GCC to emit code that performs faster indirect calls.
19533
19534 This option does not work in the presence of shared libraries or nested
19535 functions.
19536
19537 @item -mfixed-range=@var{register-range}
19538 @opindex mfixed-range
19539 Generate code treating the given register range as fixed registers.
19540 A fixed register is one that the register allocator cannot use. This is
19541 useful when compiling kernel code. A register range is specified as
19542 two registers separated by a dash. Multiple register ranges can be
19543 specified separated by a comma.
19544
19545 @item -mlong-load-store
19546 @opindex mlong-load-store
19547 Generate 3-instruction load and store sequences as sometimes required by
19548 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
19549 the HP compilers.
19550
19551 @item -mportable-runtime
19552 @opindex mportable-runtime
19553 Use the portable calling conventions proposed by HP for ELF systems.
19554
19555 @item -mgas
19556 @opindex mgas
19557 Enable the use of assembler directives only GAS understands.
19558
19559 @item -mschedule=@var{cpu-type}
19560 @opindex mschedule
19561 Schedule code according to the constraints for the machine type
19562 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
19563 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
19564 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
19565 proper scheduling option for your machine. The default scheduling is
19566 @samp{8000}.
19567
19568 @item -mlinker-opt
19569 @opindex mlinker-opt
19570 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
19571 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
19572 linkers in which they give bogus error messages when linking some programs.
19573
19574 @item -msoft-float
19575 @opindex msoft-float
19576 Generate output containing library calls for floating point.
19577 @strong{Warning:} the requisite libraries are not available for all HPPA
19578 targets. Normally the facilities of the machine's usual C compiler are
19579 used, but this cannot be done directly in cross-compilation. You must make
19580 your own arrangements to provide suitable library functions for
19581 cross-compilation.
19582
19583 @option{-msoft-float} changes the calling convention in the output file;
19584 therefore, it is only useful if you compile @emph{all} of a program with
19585 this option. In particular, you need to compile @file{libgcc.a}, the
19586 library that comes with GCC, with @option{-msoft-float} in order for
19587 this to work.
19588
19589 @item -msio
19590 @opindex msio
19591 Generate the predefine, @code{_SIO}, for server IO@. The default is
19592 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
19593 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
19594 options are available under HP-UX and HI-UX@.
19595
19596 @item -mgnu-ld
19597 @opindex mgnu-ld
19598 Use options specific to GNU @command{ld}.
19599 This passes @option{-shared} to @command{ld} when
19600 building a shared library. It is the default when GCC is configured,
19601 explicitly or implicitly, with the GNU linker. This option does not
19602 affect which @command{ld} is called; it only changes what parameters
19603 are passed to that @command{ld}.
19604 The @command{ld} that is called is determined by the
19605 @option{--with-ld} configure option, GCC's program search path, and
19606 finally by the user's @env{PATH}. The linker used by GCC can be printed
19607 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
19608 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
19609
19610 @item -mhp-ld
19611 @opindex mhp-ld
19612 Use options specific to HP @command{ld}.
19613 This passes @option{-b} to @command{ld} when building
19614 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
19615 links. It is the default when GCC is configured, explicitly or
19616 implicitly, with the HP linker. This option does not affect
19617 which @command{ld} is called; it only changes what parameters are passed to that
19618 @command{ld}.
19619 The @command{ld} that is called is determined by the @option{--with-ld}
19620 configure option, GCC's program search path, and finally by the user's
19621 @env{PATH}. The linker used by GCC can be printed using @samp{which
19622 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
19623 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
19624
19625 @item -mlong-calls
19626 @opindex mno-long-calls
19627 @opindex mlong-calls
19628 Generate code that uses long call sequences. This ensures that a call
19629 is always able to reach linker generated stubs. The default is to generate
19630 long calls only when the distance from the call site to the beginning
19631 of the function or translation unit, as the case may be, exceeds a
19632 predefined limit set by the branch type being used. The limits for
19633 normal calls are 7,600,000 and 240,000 bytes, respectively for the
19634 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
19635 240,000 bytes.
19636
19637 Distances are measured from the beginning of functions when using the
19638 @option{-ffunction-sections} option, or when using the @option{-mgas}
19639 and @option{-mno-portable-runtime} options together under HP-UX with
19640 the SOM linker.
19641
19642 It is normally not desirable to use this option as it degrades
19643 performance. However, it may be useful in large applications,
19644 particularly when partial linking is used to build the application.
19645
19646 The types of long calls used depends on the capabilities of the
19647 assembler and linker, and the type of code being generated. The
19648 impact on systems that support long absolute calls, and long pic
19649 symbol-difference or pc-relative calls should be relatively small.
19650 However, an indirect call is used on 32-bit ELF systems in pic code
19651 and it is quite long.
19652
19653 @item -munix=@var{unix-std}
19654 @opindex march
19655 Generate compiler predefines and select a startfile for the specified
19656 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
19657 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
19658 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
19659 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
19660 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
19661 and later.
19662
19663 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
19664 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
19665 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
19666 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
19667 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
19668 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
19669
19670 It is @emph{important} to note that this option changes the interfaces
19671 for various library routines. It also affects the operational behavior
19672 of the C library. Thus, @emph{extreme} care is needed in using this
19673 option.
19674
19675 Library code that is intended to operate with more than one UNIX
19676 standard must test, set and restore the variable @code{__xpg4_extended_mask}
19677 as appropriate. Most GNU software doesn't provide this capability.
19678
19679 @item -nolibdld
19680 @opindex nolibdld
19681 Suppress the generation of link options to search libdld.sl when the
19682 @option{-static} option is specified on HP-UX 10 and later.
19683
19684 @item -static
19685 @opindex static
19686 The HP-UX implementation of setlocale in libc has a dependency on
19687 libdld.sl. There isn't an archive version of libdld.sl. Thus,
19688 when the @option{-static} option is specified, special link options
19689 are needed to resolve this dependency.
19690
19691 On HP-UX 10 and later, the GCC driver adds the necessary options to
19692 link with libdld.sl when the @option{-static} option is specified.
19693 This causes the resulting binary to be dynamic. On the 64-bit port,
19694 the linkers generate dynamic binaries by default in any case. The
19695 @option{-nolibdld} option can be used to prevent the GCC driver from
19696 adding these link options.
19697
19698 @item -threads
19699 @opindex threads
19700 Add support for multithreading with the @dfn{dce thread} library
19701 under HP-UX@. This option sets flags for both the preprocessor and
19702 linker.
19703 @end table
19704
19705 @node IA-64 Options
19706 @subsection IA-64 Options
19707 @cindex IA-64 Options
19708
19709 These are the @samp{-m} options defined for the Intel IA-64 architecture.
19710
19711 @table @gcctabopt
19712 @item -mbig-endian
19713 @opindex mbig-endian
19714 Generate code for a big-endian target. This is the default for HP-UX@.
19715
19716 @item -mlittle-endian
19717 @opindex mlittle-endian
19718 Generate code for a little-endian target. This is the default for AIX5
19719 and GNU/Linux.
19720
19721 @item -mgnu-as
19722 @itemx -mno-gnu-as
19723 @opindex mgnu-as
19724 @opindex mno-gnu-as
19725 Generate (or don't) code for the GNU assembler. This is the default.
19726 @c Also, this is the default if the configure option @option{--with-gnu-as}
19727 @c is used.
19728
19729 @item -mgnu-ld
19730 @itemx -mno-gnu-ld
19731 @opindex mgnu-ld
19732 @opindex mno-gnu-ld
19733 Generate (or don't) code for the GNU linker. This is the default.
19734 @c Also, this is the default if the configure option @option{--with-gnu-ld}
19735 @c is used.
19736
19737 @item -mno-pic
19738 @opindex mno-pic
19739 Generate code that does not use a global pointer register. The result
19740 is not position independent code, and violates the IA-64 ABI@.
19741
19742 @item -mvolatile-asm-stop
19743 @itemx -mno-volatile-asm-stop
19744 @opindex mvolatile-asm-stop
19745 @opindex mno-volatile-asm-stop
19746 Generate (or don't) a stop bit immediately before and after volatile asm
19747 statements.
19748
19749 @item -mregister-names
19750 @itemx -mno-register-names
19751 @opindex mregister-names
19752 @opindex mno-register-names
19753 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
19754 the stacked registers. This may make assembler output more readable.
19755
19756 @item -mno-sdata
19757 @itemx -msdata
19758 @opindex mno-sdata
19759 @opindex msdata
19760 Disable (or enable) optimizations that use the small data section. This may
19761 be useful for working around optimizer bugs.
19762
19763 @item -mconstant-gp
19764 @opindex mconstant-gp
19765 Generate code that uses a single constant global pointer value. This is
19766 useful when compiling kernel code.
19767
19768 @item -mauto-pic
19769 @opindex mauto-pic
19770 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
19771 This is useful when compiling firmware code.
19772
19773 @item -minline-float-divide-min-latency
19774 @opindex minline-float-divide-min-latency
19775 Generate code for inline divides of floating-point values
19776 using the minimum latency algorithm.
19777
19778 @item -minline-float-divide-max-throughput
19779 @opindex minline-float-divide-max-throughput
19780 Generate code for inline divides of floating-point values
19781 using the maximum throughput algorithm.
19782
19783 @item -mno-inline-float-divide
19784 @opindex mno-inline-float-divide
19785 Do not generate inline code for divides of floating-point values.
19786
19787 @item -minline-int-divide-min-latency
19788 @opindex minline-int-divide-min-latency
19789 Generate code for inline divides of integer values
19790 using the minimum latency algorithm.
19791
19792 @item -minline-int-divide-max-throughput
19793 @opindex minline-int-divide-max-throughput
19794 Generate code for inline divides of integer values
19795 using the maximum throughput algorithm.
19796
19797 @item -mno-inline-int-divide
19798 @opindex mno-inline-int-divide
19799 @opindex minline-int-divide
19800 Do not generate inline code for divides of integer values.
19801
19802 @item -minline-sqrt-min-latency
19803 @opindex minline-sqrt-min-latency
19804 Generate code for inline square roots
19805 using the minimum latency algorithm.
19806
19807 @item -minline-sqrt-max-throughput
19808 @opindex minline-sqrt-max-throughput
19809 Generate code for inline square roots
19810 using the maximum throughput algorithm.
19811
19812 @item -mno-inline-sqrt
19813 @opindex mno-inline-sqrt
19814 Do not generate inline code for @code{sqrt}.
19815
19816 @item -mfused-madd
19817 @itemx -mno-fused-madd
19818 @opindex mfused-madd
19819 @opindex mno-fused-madd
19820 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
19821 instructions. The default is to use these instructions.
19822
19823 @item -mno-dwarf2-asm
19824 @itemx -mdwarf2-asm
19825 @opindex mno-dwarf2-asm
19826 @opindex mdwarf2-asm
19827 Don't (or do) generate assembler code for the DWARF line number debugging
19828 info. This may be useful when not using the GNU assembler.
19829
19830 @item -mearly-stop-bits
19831 @itemx -mno-early-stop-bits
19832 @opindex mearly-stop-bits
19833 @opindex mno-early-stop-bits
19834 Allow stop bits to be placed earlier than immediately preceding the
19835 instruction that triggered the stop bit. This can improve instruction
19836 scheduling, but does not always do so.
19837
19838 @item -mfixed-range=@var{register-range}
19839 @opindex mfixed-range
19840 Generate code treating the given register range as fixed registers.
19841 A fixed register is one that the register allocator cannot use. This is
19842 useful when compiling kernel code. A register range is specified as
19843 two registers separated by a dash. Multiple register ranges can be
19844 specified separated by a comma.
19845
19846 @item -mtls-size=@var{tls-size}
19847 @opindex mtls-size
19848 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
19849 64.
19850
19851 @item -mtune=@var{cpu-type}
19852 @opindex mtune
19853 Tune the instruction scheduling for a particular CPU, Valid values are
19854 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
19855 and @samp{mckinley}.
19856
19857 @item -milp32
19858 @itemx -mlp64
19859 @opindex milp32
19860 @opindex mlp64
19861 Generate code for a 32-bit or 64-bit environment.
19862 The 32-bit environment sets int, long and pointer to 32 bits.
19863 The 64-bit environment sets int to 32 bits and long and pointer
19864 to 64 bits. These are HP-UX specific flags.
19865
19866 @item -mno-sched-br-data-spec
19867 @itemx -msched-br-data-spec
19868 @opindex mno-sched-br-data-spec
19869 @opindex msched-br-data-spec
19870 (Dis/En)able data speculative scheduling before reload.
19871 This results in generation of @code{ld.a} instructions and
19872 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19873 The default setting is disabled.
19874
19875 @item -msched-ar-data-spec
19876 @itemx -mno-sched-ar-data-spec
19877 @opindex msched-ar-data-spec
19878 @opindex mno-sched-ar-data-spec
19879 (En/Dis)able data speculative scheduling after reload.
19880 This results in generation of @code{ld.a} instructions and
19881 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19882 The default setting is enabled.
19883
19884 @item -mno-sched-control-spec
19885 @itemx -msched-control-spec
19886 @opindex mno-sched-control-spec
19887 @opindex msched-control-spec
19888 (Dis/En)able control speculative scheduling. This feature is
19889 available only during region scheduling (i.e.@: before reload).
19890 This results in generation of the @code{ld.s} instructions and
19891 the corresponding check instructions @code{chk.s}.
19892 The default setting is disabled.
19893
19894 @item -msched-br-in-data-spec
19895 @itemx -mno-sched-br-in-data-spec
19896 @opindex msched-br-in-data-spec
19897 @opindex mno-sched-br-in-data-spec
19898 (En/Dis)able speculative scheduling of the instructions that
19899 are dependent on the data speculative loads before reload.
19900 This is effective only with @option{-msched-br-data-spec} enabled.
19901 The default setting is enabled.
19902
19903 @item -msched-ar-in-data-spec
19904 @itemx -mno-sched-ar-in-data-spec
19905 @opindex msched-ar-in-data-spec
19906 @opindex mno-sched-ar-in-data-spec
19907 (En/Dis)able speculative scheduling of the instructions that
19908 are dependent on the data speculative loads after reload.
19909 This is effective only with @option{-msched-ar-data-spec} enabled.
19910 The default setting is enabled.
19911
19912 @item -msched-in-control-spec
19913 @itemx -mno-sched-in-control-spec
19914 @opindex msched-in-control-spec
19915 @opindex mno-sched-in-control-spec
19916 (En/Dis)able speculative scheduling of the instructions that
19917 are dependent on the control speculative loads.
19918 This is effective only with @option{-msched-control-spec} enabled.
19919 The default setting is enabled.
19920
19921 @item -mno-sched-prefer-non-data-spec-insns
19922 @itemx -msched-prefer-non-data-spec-insns
19923 @opindex mno-sched-prefer-non-data-spec-insns
19924 @opindex msched-prefer-non-data-spec-insns
19925 If enabled, data-speculative instructions are chosen for schedule
19926 only if there are no other choices at the moment. This makes
19927 the use of the data speculation much more conservative.
19928 The default setting is disabled.
19929
19930 @item -mno-sched-prefer-non-control-spec-insns
19931 @itemx -msched-prefer-non-control-spec-insns
19932 @opindex mno-sched-prefer-non-control-spec-insns
19933 @opindex msched-prefer-non-control-spec-insns
19934 If enabled, control-speculative instructions are chosen for schedule
19935 only if there are no other choices at the moment. This makes
19936 the use of the control speculation much more conservative.
19937 The default setting is disabled.
19938
19939 @item -mno-sched-count-spec-in-critical-path
19940 @itemx -msched-count-spec-in-critical-path
19941 @opindex mno-sched-count-spec-in-critical-path
19942 @opindex msched-count-spec-in-critical-path
19943 If enabled, speculative dependencies are considered during
19944 computation of the instructions priorities. This makes the use of the
19945 speculation a bit more conservative.
19946 The default setting is disabled.
19947
19948 @item -msched-spec-ldc
19949 @opindex msched-spec-ldc
19950 Use a simple data speculation check. This option is on by default.
19951
19952 @item -msched-control-spec-ldc
19953 @opindex msched-spec-ldc
19954 Use a simple check for control speculation. This option is on by default.
19955
19956 @item -msched-stop-bits-after-every-cycle
19957 @opindex msched-stop-bits-after-every-cycle
19958 Place a stop bit after every cycle when scheduling. This option is on
19959 by default.
19960
19961 @item -msched-fp-mem-deps-zero-cost
19962 @opindex msched-fp-mem-deps-zero-cost
19963 Assume that floating-point stores and loads are not likely to cause a conflict
19964 when placed into the same instruction group. This option is disabled by
19965 default.
19966
19967 @item -msel-sched-dont-check-control-spec
19968 @opindex msel-sched-dont-check-control-spec
19969 Generate checks for control speculation in selective scheduling.
19970 This flag is disabled by default.
19971
19972 @item -msched-max-memory-insns=@var{max-insns}
19973 @opindex msched-max-memory-insns
19974 Limit on the number of memory insns per instruction group, giving lower
19975 priority to subsequent memory insns attempting to schedule in the same
19976 instruction group. Frequently useful to prevent cache bank conflicts.
19977 The default value is 1.
19978
19979 @item -msched-max-memory-insns-hard-limit
19980 @opindex msched-max-memory-insns-hard-limit
19981 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
19982 disallowing more than that number in an instruction group.
19983 Otherwise, the limit is ``soft'', meaning that non-memory operations
19984 are preferred when the limit is reached, but memory operations may still
19985 be scheduled.
19986
19987 @end table
19988
19989 @node LM32 Options
19990 @subsection LM32 Options
19991 @cindex LM32 options
19992
19993 These @option{-m} options are defined for the LatticeMico32 architecture:
19994
19995 @table @gcctabopt
19996 @item -mbarrel-shift-enabled
19997 @opindex mbarrel-shift-enabled
19998 Enable barrel-shift instructions.
19999
20000 @item -mdivide-enabled
20001 @opindex mdivide-enabled
20002 Enable divide and modulus instructions.
20003
20004 @item -mmultiply-enabled
20005 @opindex multiply-enabled
20006 Enable multiply instructions.
20007
20008 @item -msign-extend-enabled
20009 @opindex msign-extend-enabled
20010 Enable sign extend instructions.
20011
20012 @item -muser-enabled
20013 @opindex muser-enabled
20014 Enable user-defined instructions.
20015
20016 @end table
20017
20018 @node M32C Options
20019 @subsection M32C Options
20020 @cindex M32C options
20021
20022 @table @gcctabopt
20023 @item -mcpu=@var{name}
20024 @opindex mcpu=
20025 Select the CPU for which code is generated. @var{name} may be one of
20026 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20027 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20028 the M32C/80 series.
20029
20030 @item -msim
20031 @opindex msim
20032 Specifies that the program will be run on the simulator. This causes
20033 an alternate runtime library to be linked in which supports, for
20034 example, file I/O@. You must not use this option when generating
20035 programs that will run on real hardware; you must provide your own
20036 runtime library for whatever I/O functions are needed.
20037
20038 @item -memregs=@var{number}
20039 @opindex memregs=
20040 Specifies the number of memory-based pseudo-registers GCC uses
20041 during code generation. These pseudo-registers are used like real
20042 registers, so there is a tradeoff between GCC's ability to fit the
20043 code into available registers, and the performance penalty of using
20044 memory instead of registers. Note that all modules in a program must
20045 be compiled with the same value for this option. Because of that, you
20046 must not use this option with GCC's default runtime libraries.
20047
20048 @end table
20049
20050 @node M32R/D Options
20051 @subsection M32R/D Options
20052 @cindex M32R/D options
20053
20054 These @option{-m} options are defined for Renesas M32R/D architectures:
20055
20056 @table @gcctabopt
20057 @item -m32r2
20058 @opindex m32r2
20059 Generate code for the M32R/2@.
20060
20061 @item -m32rx
20062 @opindex m32rx
20063 Generate code for the M32R/X@.
20064
20065 @item -m32r
20066 @opindex m32r
20067 Generate code for the M32R@. This is the default.
20068
20069 @item -mmodel=small
20070 @opindex mmodel=small
20071 Assume all objects live in the lower 16MB of memory (so that their addresses
20072 can be loaded with the @code{ld24} instruction), and assume all subroutines
20073 are reachable with the @code{bl} instruction.
20074 This is the default.
20075
20076 The addressability of a particular object can be set with the
20077 @code{model} attribute.
20078
20079 @item -mmodel=medium
20080 @opindex mmodel=medium
20081 Assume objects may be anywhere in the 32-bit address space (the compiler
20082 generates @code{seth/add3} instructions to load their addresses), and
20083 assume all subroutines are reachable with the @code{bl} instruction.
20084
20085 @item -mmodel=large
20086 @opindex mmodel=large
20087 Assume objects may be anywhere in the 32-bit address space (the compiler
20088 generates @code{seth/add3} instructions to load their addresses), and
20089 assume subroutines may not be reachable with the @code{bl} instruction
20090 (the compiler generates the much slower @code{seth/add3/jl}
20091 instruction sequence).
20092
20093 @item -msdata=none
20094 @opindex msdata=none
20095 Disable use of the small data area. Variables are put into
20096 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20097 @code{section} attribute has been specified).
20098 This is the default.
20099
20100 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20101 Objects may be explicitly put in the small data area with the
20102 @code{section} attribute using one of these sections.
20103
20104 @item -msdata=sdata
20105 @opindex msdata=sdata
20106 Put small global and static data in the small data area, but do not
20107 generate special code to reference them.
20108
20109 @item -msdata=use
20110 @opindex msdata=use
20111 Put small global and static data in the small data area, and generate
20112 special instructions to reference them.
20113
20114 @item -G @var{num}
20115 @opindex G
20116 @cindex smaller data references
20117 Put global and static objects less than or equal to @var{num} bytes
20118 into the small data or BSS sections instead of the normal data or BSS
20119 sections. The default value of @var{num} is 8.
20120 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20121 for this option to have any effect.
20122
20123 All modules should be compiled with the same @option{-G @var{num}} value.
20124 Compiling with different values of @var{num} may or may not work; if it
20125 doesn't the linker gives an error message---incorrect code is not
20126 generated.
20127
20128 @item -mdebug
20129 @opindex mdebug
20130 Makes the M32R-specific code in the compiler display some statistics
20131 that might help in debugging programs.
20132
20133 @item -malign-loops
20134 @opindex malign-loops
20135 Align all loops to a 32-byte boundary.
20136
20137 @item -mno-align-loops
20138 @opindex mno-align-loops
20139 Do not enforce a 32-byte alignment for loops. This is the default.
20140
20141 @item -missue-rate=@var{number}
20142 @opindex missue-rate=@var{number}
20143 Issue @var{number} instructions per cycle. @var{number} can only be 1
20144 or 2.
20145
20146 @item -mbranch-cost=@var{number}
20147 @opindex mbranch-cost=@var{number}
20148 @var{number} can only be 1 or 2. If it is 1 then branches are
20149 preferred over conditional code, if it is 2, then the opposite applies.
20150
20151 @item -mflush-trap=@var{number}
20152 @opindex mflush-trap=@var{number}
20153 Specifies the trap number to use to flush the cache. The default is
20154 12. Valid numbers are between 0 and 15 inclusive.
20155
20156 @item -mno-flush-trap
20157 @opindex mno-flush-trap
20158 Specifies that the cache cannot be flushed by using a trap.
20159
20160 @item -mflush-func=@var{name}
20161 @opindex mflush-func=@var{name}
20162 Specifies the name of the operating system function to call to flush
20163 the cache. The default is @samp{_flush_cache}, but a function call
20164 is only used if a trap is not available.
20165
20166 @item -mno-flush-func
20167 @opindex mno-flush-func
20168 Indicates that there is no OS function for flushing the cache.
20169
20170 @end table
20171
20172 @node M680x0 Options
20173 @subsection M680x0 Options
20174 @cindex M680x0 options
20175
20176 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20177 The default settings depend on which architecture was selected when
20178 the compiler was configured; the defaults for the most common choices
20179 are given below.
20180
20181 @table @gcctabopt
20182 @item -march=@var{arch}
20183 @opindex march
20184 Generate code for a specific M680x0 or ColdFire instruction set
20185 architecture. Permissible values of @var{arch} for M680x0
20186 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20187 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20188 architectures are selected according to Freescale's ISA classification
20189 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20190 @samp{isab} and @samp{isac}.
20191
20192 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20193 code for a ColdFire target. The @var{arch} in this macro is one of the
20194 @option{-march} arguments given above.
20195
20196 When used together, @option{-march} and @option{-mtune} select code
20197 that runs on a family of similar processors but that is optimized
20198 for a particular microarchitecture.
20199
20200 @item -mcpu=@var{cpu}
20201 @opindex mcpu
20202 Generate code for a specific M680x0 or ColdFire processor.
20203 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20204 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20205 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20206 below, which also classifies the CPUs into families:
20207
20208 @multitable @columnfractions 0.20 0.80
20209 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20210 @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}
20211 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20212 @item @samp{5206e} @tab @samp{5206e}
20213 @item @samp{5208} @tab @samp{5207} @samp{5208}
20214 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20215 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20216 @item @samp{5216} @tab @samp{5214} @samp{5216}
20217 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20218 @item @samp{5225} @tab @samp{5224} @samp{5225}
20219 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20220 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20221 @item @samp{5249} @tab @samp{5249}
20222 @item @samp{5250} @tab @samp{5250}
20223 @item @samp{5271} @tab @samp{5270} @samp{5271}
20224 @item @samp{5272} @tab @samp{5272}
20225 @item @samp{5275} @tab @samp{5274} @samp{5275}
20226 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20227 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20228 @item @samp{5307} @tab @samp{5307}
20229 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20230 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20231 @item @samp{5407} @tab @samp{5407}
20232 @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}
20233 @end multitable
20234
20235 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20236 @var{arch} is compatible with @var{cpu}. Other combinations of
20237 @option{-mcpu} and @option{-march} are rejected.
20238
20239 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20240 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20241 where the value of @var{family} is given by the table above.
20242
20243 @item -mtune=@var{tune}
20244 @opindex mtune
20245 Tune the code for a particular microarchitecture within the
20246 constraints set by @option{-march} and @option{-mcpu}.
20247 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20248 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20249 and @samp{cpu32}. The ColdFire microarchitectures
20250 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20251
20252 You can also use @option{-mtune=68020-40} for code that needs
20253 to run relatively well on 68020, 68030 and 68040 targets.
20254 @option{-mtune=68020-60} is similar but includes 68060 targets
20255 as well. These two options select the same tuning decisions as
20256 @option{-m68020-40} and @option{-m68020-60} respectively.
20257
20258 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
20259 when tuning for 680x0 architecture @var{arch}. It also defines
20260 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
20261 option is used. If GCC is tuning for a range of architectures,
20262 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
20263 it defines the macros for every architecture in the range.
20264
20265 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
20266 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
20267 of the arguments given above.
20268
20269 @item -m68000
20270 @itemx -mc68000
20271 @opindex m68000
20272 @opindex mc68000
20273 Generate output for a 68000. This is the default
20274 when the compiler is configured for 68000-based systems.
20275 It is equivalent to @option{-march=68000}.
20276
20277 Use this option for microcontrollers with a 68000 or EC000 core,
20278 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20279
20280 @item -m68010
20281 @opindex m68010
20282 Generate output for a 68010. This is the default
20283 when the compiler is configured for 68010-based systems.
20284 It is equivalent to @option{-march=68010}.
20285
20286 @item -m68020
20287 @itemx -mc68020
20288 @opindex m68020
20289 @opindex mc68020
20290 Generate output for a 68020. This is the default
20291 when the compiler is configured for 68020-based systems.
20292 It is equivalent to @option{-march=68020}.
20293
20294 @item -m68030
20295 @opindex m68030
20296 Generate output for a 68030. This is the default when the compiler is
20297 configured for 68030-based systems. It is equivalent to
20298 @option{-march=68030}.
20299
20300 @item -m68040
20301 @opindex m68040
20302 Generate output for a 68040. This is the default when the compiler is
20303 configured for 68040-based systems. It is equivalent to
20304 @option{-march=68040}.
20305
20306 This option inhibits the use of 68881/68882 instructions that have to be
20307 emulated by software on the 68040. Use this option if your 68040 does not
20308 have code to emulate those instructions.
20309
20310 @item -m68060
20311 @opindex m68060
20312 Generate output for a 68060. This is the default when the compiler is
20313 configured for 68060-based systems. It is equivalent to
20314 @option{-march=68060}.
20315
20316 This option inhibits the use of 68020 and 68881/68882 instructions that
20317 have to be emulated by software on the 68060. Use this option if your 68060
20318 does not have code to emulate those instructions.
20319
20320 @item -mcpu32
20321 @opindex mcpu32
20322 Generate output for a CPU32. This is the default
20323 when the compiler is configured for CPU32-based systems.
20324 It is equivalent to @option{-march=cpu32}.
20325
20326 Use this option for microcontrollers with a
20327 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
20328 68336, 68340, 68341, 68349 and 68360.
20329
20330 @item -m5200
20331 @opindex m5200
20332 Generate output for a 520X ColdFire CPU@. This is the default
20333 when the compiler is configured for 520X-based systems.
20334 It is equivalent to @option{-mcpu=5206}, and is now deprecated
20335 in favor of that option.
20336
20337 Use this option for microcontroller with a 5200 core, including
20338 the MCF5202, MCF5203, MCF5204 and MCF5206.
20339
20340 @item -m5206e
20341 @opindex m5206e
20342 Generate output for a 5206e ColdFire CPU@. The option is now
20343 deprecated in favor of the equivalent @option{-mcpu=5206e}.
20344
20345 @item -m528x
20346 @opindex m528x
20347 Generate output for a member of the ColdFire 528X family.
20348 The option is now deprecated in favor of the equivalent
20349 @option{-mcpu=528x}.
20350
20351 @item -m5307
20352 @opindex m5307
20353 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
20354 in favor of the equivalent @option{-mcpu=5307}.
20355
20356 @item -m5407
20357 @opindex m5407
20358 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
20359 in favor of the equivalent @option{-mcpu=5407}.
20360
20361 @item -mcfv4e
20362 @opindex mcfv4e
20363 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
20364 This includes use of hardware floating-point instructions.
20365 The option is equivalent to @option{-mcpu=547x}, and is now
20366 deprecated in favor of that option.
20367
20368 @item -m68020-40
20369 @opindex m68020-40
20370 Generate output for a 68040, without using any of the new instructions.
20371 This results in code that can run relatively efficiently on either a
20372 68020/68881 or a 68030 or a 68040. The generated code does use the
20373 68881 instructions that are emulated on the 68040.
20374
20375 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
20376
20377 @item -m68020-60
20378 @opindex m68020-60
20379 Generate output for a 68060, without using any of the new instructions.
20380 This results in code that can run relatively efficiently on either a
20381 68020/68881 or a 68030 or a 68040. The generated code does use the
20382 68881 instructions that are emulated on the 68060.
20383
20384 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
20385
20386 @item -mhard-float
20387 @itemx -m68881
20388 @opindex mhard-float
20389 @opindex m68881
20390 Generate floating-point instructions. This is the default for 68020
20391 and above, and for ColdFire devices that have an FPU@. It defines the
20392 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
20393 on ColdFire targets.
20394
20395 @item -msoft-float
20396 @opindex msoft-float
20397 Do not generate floating-point instructions; use library calls instead.
20398 This is the default for 68000, 68010, and 68832 targets. It is also
20399 the default for ColdFire devices that have no FPU.
20400
20401 @item -mdiv
20402 @itemx -mno-div
20403 @opindex mdiv
20404 @opindex mno-div
20405 Generate (do not generate) ColdFire hardware divide and remainder
20406 instructions. If @option{-march} is used without @option{-mcpu},
20407 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
20408 architectures. Otherwise, the default is taken from the target CPU
20409 (either the default CPU, or the one specified by @option{-mcpu}). For
20410 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
20411 @option{-mcpu=5206e}.
20412
20413 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
20414
20415 @item -mshort
20416 @opindex mshort
20417 Consider type @code{int} to be 16 bits wide, like @code{short int}.
20418 Additionally, parameters passed on the stack are also aligned to a
20419 16-bit boundary even on targets whose API mandates promotion to 32-bit.
20420
20421 @item -mno-short
20422 @opindex mno-short
20423 Do not consider type @code{int} to be 16 bits wide. This is the default.
20424
20425 @item -mnobitfield
20426 @itemx -mno-bitfield
20427 @opindex mnobitfield
20428 @opindex mno-bitfield
20429 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
20430 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
20431
20432 @item -mbitfield
20433 @opindex mbitfield
20434 Do use the bit-field instructions. The @option{-m68020} option implies
20435 @option{-mbitfield}. This is the default if you use a configuration
20436 designed for a 68020.
20437
20438 @item -mrtd
20439 @opindex mrtd
20440 Use a different function-calling convention, in which functions
20441 that take a fixed number of arguments return with the @code{rtd}
20442 instruction, which pops their arguments while returning. This
20443 saves one instruction in the caller since there is no need to pop
20444 the arguments there.
20445
20446 This calling convention is incompatible with the one normally
20447 used on Unix, so you cannot use it if you need to call libraries
20448 compiled with the Unix compiler.
20449
20450 Also, you must provide function prototypes for all functions that
20451 take variable numbers of arguments (including @code{printf});
20452 otherwise incorrect code is generated for calls to those
20453 functions.
20454
20455 In addition, seriously incorrect code results if you call a
20456 function with too many arguments. (Normally, extra arguments are
20457 harmlessly ignored.)
20458
20459 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
20460 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
20461
20462 The default is @option{-mno-rtd}.
20463
20464 @item -malign-int
20465 @itemx -mno-align-int
20466 @opindex malign-int
20467 @opindex mno-align-int
20468 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
20469 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
20470 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
20471 Aligning variables on 32-bit boundaries produces code that runs somewhat
20472 faster on processors with 32-bit busses at the expense of more memory.
20473
20474 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
20475 aligns structures containing the above types differently than
20476 most published application binary interface specifications for the m68k.
20477
20478 @item -mpcrel
20479 @opindex mpcrel
20480 Use the pc-relative addressing mode of the 68000 directly, instead of
20481 using a global offset table. At present, this option implies @option{-fpic},
20482 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
20483 not presently supported with @option{-mpcrel}, though this could be supported for
20484 68020 and higher processors.
20485
20486 @item -mno-strict-align
20487 @itemx -mstrict-align
20488 @opindex mno-strict-align
20489 @opindex mstrict-align
20490 Do not (do) assume that unaligned memory references are handled by
20491 the system.
20492
20493 @item -msep-data
20494 Generate code that allows the data segment to be located in a different
20495 area of memory from the text segment. This allows for execute-in-place in
20496 an environment without virtual memory management. This option implies
20497 @option{-fPIC}.
20498
20499 @item -mno-sep-data
20500 Generate code that assumes that the data segment follows the text segment.
20501 This is the default.
20502
20503 @item -mid-shared-library
20504 Generate code that supports shared libraries via the library ID method.
20505 This allows for execute-in-place and shared libraries in an environment
20506 without virtual memory management. This option implies @option{-fPIC}.
20507
20508 @item -mno-id-shared-library
20509 Generate code that doesn't assume ID-based shared libraries are being used.
20510 This is the default.
20511
20512 @item -mshared-library-id=n
20513 Specifies the identification number of the ID-based shared library being
20514 compiled. Specifying a value of 0 generates more compact code; specifying
20515 other values forces the allocation of that number to the current
20516 library, but is no more space- or time-efficient than omitting this option.
20517
20518 @item -mxgot
20519 @itemx -mno-xgot
20520 @opindex mxgot
20521 @opindex mno-xgot
20522 When generating position-independent code for ColdFire, generate code
20523 that works if the GOT has more than 8192 entries. This code is
20524 larger and slower than code generated without this option. On M680x0
20525 processors, this option is not needed; @option{-fPIC} suffices.
20526
20527 GCC normally uses a single instruction to load values from the GOT@.
20528 While this is relatively efficient, it only works if the GOT
20529 is smaller than about 64k. Anything larger causes the linker
20530 to report an error such as:
20531
20532 @cindex relocation truncated to fit (ColdFire)
20533 @smallexample
20534 relocation truncated to fit: R_68K_GOT16O foobar
20535 @end smallexample
20536
20537 If this happens, you should recompile your code with @option{-mxgot}.
20538 It should then work with very large GOTs. However, code generated with
20539 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
20540 the value of a global symbol.
20541
20542 Note that some linkers, including newer versions of the GNU linker,
20543 can create multiple GOTs and sort GOT entries. If you have such a linker,
20544 you should only need to use @option{-mxgot} when compiling a single
20545 object file that accesses more than 8192 GOT entries. Very few do.
20546
20547 These options have no effect unless GCC is generating
20548 position-independent code.
20549
20550 @item -mlong-jump-table-offsets
20551 @opindex mlong-jump-table-offsets
20552 Use 32-bit offsets in @code{switch} tables. The default is to use
20553 16-bit offsets.
20554
20555 @end table
20556
20557 @node MCore Options
20558 @subsection MCore Options
20559 @cindex MCore options
20560
20561 These are the @samp{-m} options defined for the Motorola M*Core
20562 processors.
20563
20564 @table @gcctabopt
20565
20566 @item -mhardlit
20567 @itemx -mno-hardlit
20568 @opindex mhardlit
20569 @opindex mno-hardlit
20570 Inline constants into the code stream if it can be done in two
20571 instructions or less.
20572
20573 @item -mdiv
20574 @itemx -mno-div
20575 @opindex mdiv
20576 @opindex mno-div
20577 Use the divide instruction. (Enabled by default).
20578
20579 @item -mrelax-immediate
20580 @itemx -mno-relax-immediate
20581 @opindex mrelax-immediate
20582 @opindex mno-relax-immediate
20583 Allow arbitrary-sized immediates in bit operations.
20584
20585 @item -mwide-bitfields
20586 @itemx -mno-wide-bitfields
20587 @opindex mwide-bitfields
20588 @opindex mno-wide-bitfields
20589 Always treat bit-fields as @code{int}-sized.
20590
20591 @item -m4byte-functions
20592 @itemx -mno-4byte-functions
20593 @opindex m4byte-functions
20594 @opindex mno-4byte-functions
20595 Force all functions to be aligned to a 4-byte boundary.
20596
20597 @item -mcallgraph-data
20598 @itemx -mno-callgraph-data
20599 @opindex mcallgraph-data
20600 @opindex mno-callgraph-data
20601 Emit callgraph information.
20602
20603 @item -mslow-bytes
20604 @itemx -mno-slow-bytes
20605 @opindex mslow-bytes
20606 @opindex mno-slow-bytes
20607 Prefer word access when reading byte quantities.
20608
20609 @item -mlittle-endian
20610 @itemx -mbig-endian
20611 @opindex mlittle-endian
20612 @opindex mbig-endian
20613 Generate code for a little-endian target.
20614
20615 @item -m210
20616 @itemx -m340
20617 @opindex m210
20618 @opindex m340
20619 Generate code for the 210 processor.
20620
20621 @item -mno-lsim
20622 @opindex mno-lsim
20623 Assume that runtime support has been provided and so omit the
20624 simulator library (@file{libsim.a)} from the linker command line.
20625
20626 @item -mstack-increment=@var{size}
20627 @opindex mstack-increment
20628 Set the maximum amount for a single stack increment operation. Large
20629 values can increase the speed of programs that contain functions
20630 that need a large amount of stack space, but they can also trigger a
20631 segmentation fault if the stack is extended too much. The default
20632 value is 0x1000.
20633
20634 @end table
20635
20636 @node MeP Options
20637 @subsection MeP Options
20638 @cindex MeP options
20639
20640 @table @gcctabopt
20641
20642 @item -mabsdiff
20643 @opindex mabsdiff
20644 Enables the @code{abs} instruction, which is the absolute difference
20645 between two registers.
20646
20647 @item -mall-opts
20648 @opindex mall-opts
20649 Enables all the optional instructions---average, multiply, divide, bit
20650 operations, leading zero, absolute difference, min/max, clip, and
20651 saturation.
20652
20653
20654 @item -maverage
20655 @opindex maverage
20656 Enables the @code{ave} instruction, which computes the average of two
20657 registers.
20658
20659 @item -mbased=@var{n}
20660 @opindex mbased=
20661 Variables of size @var{n} bytes or smaller are placed in the
20662 @code{.based} section by default. Based variables use the @code{$tp}
20663 register as a base register, and there is a 128-byte limit to the
20664 @code{.based} section.
20665
20666 @item -mbitops
20667 @opindex mbitops
20668 Enables the bit operation instructions---bit test (@code{btstm}), set
20669 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
20670 test-and-set (@code{tas}).
20671
20672 @item -mc=@var{name}
20673 @opindex mc=
20674 Selects which section constant data is placed in. @var{name} may
20675 be @samp{tiny}, @samp{near}, or @samp{far}.
20676
20677 @item -mclip
20678 @opindex mclip
20679 Enables the @code{clip} instruction. Note that @option{-mclip} is not
20680 useful unless you also provide @option{-mminmax}.
20681
20682 @item -mconfig=@var{name}
20683 @opindex mconfig=
20684 Selects one of the built-in core configurations. Each MeP chip has
20685 one or more modules in it; each module has a core CPU and a variety of
20686 coprocessors, optional instructions, and peripherals. The
20687 @code{MeP-Integrator} tool, not part of GCC, provides these
20688 configurations through this option; using this option is the same as
20689 using all the corresponding command-line options. The default
20690 configuration is @samp{default}.
20691
20692 @item -mcop
20693 @opindex mcop
20694 Enables the coprocessor instructions. By default, this is a 32-bit
20695 coprocessor. Note that the coprocessor is normally enabled via the
20696 @option{-mconfig=} option.
20697
20698 @item -mcop32
20699 @opindex mcop32
20700 Enables the 32-bit coprocessor's instructions.
20701
20702 @item -mcop64
20703 @opindex mcop64
20704 Enables the 64-bit coprocessor's instructions.
20705
20706 @item -mivc2
20707 @opindex mivc2
20708 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
20709
20710 @item -mdc
20711 @opindex mdc
20712 Causes constant variables to be placed in the @code{.near} section.
20713
20714 @item -mdiv
20715 @opindex mdiv
20716 Enables the @code{div} and @code{divu} instructions.
20717
20718 @item -meb
20719 @opindex meb
20720 Generate big-endian code.
20721
20722 @item -mel
20723 @opindex mel
20724 Generate little-endian code.
20725
20726 @item -mio-volatile
20727 @opindex mio-volatile
20728 Tells the compiler that any variable marked with the @code{io}
20729 attribute is to be considered volatile.
20730
20731 @item -ml
20732 @opindex ml
20733 Causes variables to be assigned to the @code{.far} section by default.
20734
20735 @item -mleadz
20736 @opindex mleadz
20737 Enables the @code{leadz} (leading zero) instruction.
20738
20739 @item -mm
20740 @opindex mm
20741 Causes variables to be assigned to the @code{.near} section by default.
20742
20743 @item -mminmax
20744 @opindex mminmax
20745 Enables the @code{min} and @code{max} instructions.
20746
20747 @item -mmult
20748 @opindex mmult
20749 Enables the multiplication and multiply-accumulate instructions.
20750
20751 @item -mno-opts
20752 @opindex mno-opts
20753 Disables all the optional instructions enabled by @option{-mall-opts}.
20754
20755 @item -mrepeat
20756 @opindex mrepeat
20757 Enables the @code{repeat} and @code{erepeat} instructions, used for
20758 low-overhead looping.
20759
20760 @item -ms
20761 @opindex ms
20762 Causes all variables to default to the @code{.tiny} section. Note
20763 that there is a 65536-byte limit to this section. Accesses to these
20764 variables use the @code{%gp} base register.
20765
20766 @item -msatur
20767 @opindex msatur
20768 Enables the saturation instructions. Note that the compiler does not
20769 currently generate these itself, but this option is included for
20770 compatibility with other tools, like @code{as}.
20771
20772 @item -msdram
20773 @opindex msdram
20774 Link the SDRAM-based runtime instead of the default ROM-based runtime.
20775
20776 @item -msim
20777 @opindex msim
20778 Link the simulator run-time libraries.
20779
20780 @item -msimnovec
20781 @opindex msimnovec
20782 Link the simulator runtime libraries, excluding built-in support
20783 for reset and exception vectors and tables.
20784
20785 @item -mtf
20786 @opindex mtf
20787 Causes all functions to default to the @code{.far} section. Without
20788 this option, functions default to the @code{.near} section.
20789
20790 @item -mtiny=@var{n}
20791 @opindex mtiny=
20792 Variables that are @var{n} bytes or smaller are allocated to the
20793 @code{.tiny} section. These variables use the @code{$gp} base
20794 register. The default for this option is 4, but note that there's a
20795 65536-byte limit to the @code{.tiny} section.
20796
20797 @end table
20798
20799 @node MicroBlaze Options
20800 @subsection MicroBlaze Options
20801 @cindex MicroBlaze Options
20802
20803 @table @gcctabopt
20804
20805 @item -msoft-float
20806 @opindex msoft-float
20807 Use software emulation for floating point (default).
20808
20809 @item -mhard-float
20810 @opindex mhard-float
20811 Use hardware floating-point instructions.
20812
20813 @item -mmemcpy
20814 @opindex mmemcpy
20815 Do not optimize block moves, use @code{memcpy}.
20816
20817 @item -mno-clearbss
20818 @opindex mno-clearbss
20819 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
20820
20821 @item -mcpu=@var{cpu-type}
20822 @opindex mcpu=
20823 Use features of, and schedule code for, the given CPU.
20824 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
20825 where @var{X} is a major version, @var{YY} is the minor version, and
20826 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
20827 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
20828
20829 @item -mxl-soft-mul
20830 @opindex mxl-soft-mul
20831 Use software multiply emulation (default).
20832
20833 @item -mxl-soft-div
20834 @opindex mxl-soft-div
20835 Use software emulation for divides (default).
20836
20837 @item -mxl-barrel-shift
20838 @opindex mxl-barrel-shift
20839 Use the hardware barrel shifter.
20840
20841 @item -mxl-pattern-compare
20842 @opindex mxl-pattern-compare
20843 Use pattern compare instructions.
20844
20845 @item -msmall-divides
20846 @opindex msmall-divides
20847 Use table lookup optimization for small signed integer divisions.
20848
20849 @item -mxl-stack-check
20850 @opindex mxl-stack-check
20851 This option is deprecated. Use @option{-fstack-check} instead.
20852
20853 @item -mxl-gp-opt
20854 @opindex mxl-gp-opt
20855 Use GP-relative @code{.sdata}/@code{.sbss} sections.
20856
20857 @item -mxl-multiply-high
20858 @opindex mxl-multiply-high
20859 Use multiply high instructions for high part of 32x32 multiply.
20860
20861 @item -mxl-float-convert
20862 @opindex mxl-float-convert
20863 Use hardware floating-point conversion instructions.
20864
20865 @item -mxl-float-sqrt
20866 @opindex mxl-float-sqrt
20867 Use hardware floating-point square root instruction.
20868
20869 @item -mbig-endian
20870 @opindex mbig-endian
20871 Generate code for a big-endian target.
20872
20873 @item -mlittle-endian
20874 @opindex mlittle-endian
20875 Generate code for a little-endian target.
20876
20877 @item -mxl-reorder
20878 @opindex mxl-reorder
20879 Use reorder instructions (swap and byte reversed load/store).
20880
20881 @item -mxl-mode-@var{app-model}
20882 Select application model @var{app-model}. Valid models are
20883 @table @samp
20884 @item executable
20885 normal executable (default), uses startup code @file{crt0.o}.
20886
20887 @item -mpic-data-is-text-relative
20888 @opindex mpic-data-is-text-relative
20889 Assume that the displacement between the text and data segments is fixed
20890 at static link time. This allows data to be referenced by offset from start of
20891 text address instead of GOT since PC-relative addressing is not supported.
20892
20893 @item xmdstub
20894 for use with Xilinx Microprocessor Debugger (XMD) based
20895 software intrusive debug agent called xmdstub. This uses startup file
20896 @file{crt1.o} and sets the start address of the program to 0x800.
20897
20898 @item bootstrap
20899 for applications that are loaded using a bootloader.
20900 This model uses startup file @file{crt2.o} which does not contain a processor
20901 reset vector handler. This is suitable for transferring control on a
20902 processor reset to the bootloader rather than the application.
20903
20904 @item novectors
20905 for applications that do not require any of the
20906 MicroBlaze vectors. This option may be useful for applications running
20907 within a monitoring application. This model uses @file{crt3.o} as a startup file.
20908 @end table
20909
20910 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
20911 @option{-mxl-mode-@var{app-model}}.
20912
20913 @end table
20914
20915 @node MIPS Options
20916 @subsection MIPS Options
20917 @cindex MIPS options
20918
20919 @table @gcctabopt
20920
20921 @item -EB
20922 @opindex EB
20923 Generate big-endian code.
20924
20925 @item -EL
20926 @opindex EL
20927 Generate little-endian code. This is the default for @samp{mips*el-*-*}
20928 configurations.
20929
20930 @item -march=@var{arch}
20931 @opindex march
20932 Generate code that runs on @var{arch}, which can be the name of a
20933 generic MIPS ISA, or the name of a particular processor.
20934 The ISA names are:
20935 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
20936 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
20937 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
20938 @samp{mips64r5} and @samp{mips64r6}.
20939 The processor names are:
20940 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
20941 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
20942 @samp{5kc}, @samp{5kf},
20943 @samp{20kc},
20944 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
20945 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
20946 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
20947 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
20948 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
20949 @samp{i6400}, @samp{i6500},
20950 @samp{interaptiv},
20951 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
20952 @samp{gs464e}, @samp{gs264e},
20953 @samp{m4k},
20954 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
20955 @samp{m5100}, @samp{m5101},
20956 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
20957 @samp{orion},
20958 @samp{p5600}, @samp{p6600},
20959 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
20960 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
20961 @samp{rm7000}, @samp{rm9000},
20962 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
20963 @samp{sb1},
20964 @samp{sr71000},
20965 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
20966 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
20967 @samp{xlr} and @samp{xlp}.
20968 The special value @samp{from-abi} selects the
20969 most compatible architecture for the selected ABI (that is,
20970 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
20971
20972 The native Linux/GNU toolchain also supports the value @samp{native},
20973 which selects the best architecture option for the host processor.
20974 @option{-march=native} has no effect if GCC does not recognize
20975 the processor.
20976
20977 In processor names, a final @samp{000} can be abbreviated as @samp{k}
20978 (for example, @option{-march=r2k}). Prefixes are optional, and
20979 @samp{vr} may be written @samp{r}.
20980
20981 Names of the form @samp{@var{n}f2_1} refer to processors with
20982 FPUs clocked at half the rate of the core, names of the form
20983 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
20984 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
20985 processors with FPUs clocked a ratio of 3:2 with respect to the core.
20986 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
20987 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
20988 accepted as synonyms for @samp{@var{n}f1_1}.
20989
20990 GCC defines two macros based on the value of this option. The first
20991 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
20992 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
20993 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
20994 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
20995 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
20996
20997 Note that the @code{_MIPS_ARCH} macro uses the processor names given
20998 above. In other words, it has the full prefix and does not
20999 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21000 the macro names the resolved architecture (either @code{"mips1"} or
21001 @code{"mips3"}). It names the default architecture when no
21002 @option{-march} option is given.
21003
21004 @item -mtune=@var{arch}
21005 @opindex mtune
21006 Optimize for @var{arch}. Among other things, this option controls
21007 the way instructions are scheduled, and the perceived cost of arithmetic
21008 operations. The list of @var{arch} values is the same as for
21009 @option{-march}.
21010
21011 When this option is not used, GCC optimizes for the processor
21012 specified by @option{-march}. By using @option{-march} and
21013 @option{-mtune} together, it is possible to generate code that
21014 runs on a family of processors, but optimize the code for one
21015 particular member of that family.
21016
21017 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21018 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21019 @option{-march} ones described above.
21020
21021 @item -mips1
21022 @opindex mips1
21023 Equivalent to @option{-march=mips1}.
21024
21025 @item -mips2
21026 @opindex mips2
21027 Equivalent to @option{-march=mips2}.
21028
21029 @item -mips3
21030 @opindex mips3
21031 Equivalent to @option{-march=mips3}.
21032
21033 @item -mips4
21034 @opindex mips4
21035 Equivalent to @option{-march=mips4}.
21036
21037 @item -mips32
21038 @opindex mips32
21039 Equivalent to @option{-march=mips32}.
21040
21041 @item -mips32r3
21042 @opindex mips32r3
21043 Equivalent to @option{-march=mips32r3}.
21044
21045 @item -mips32r5
21046 @opindex mips32r5
21047 Equivalent to @option{-march=mips32r5}.
21048
21049 @item -mips32r6
21050 @opindex mips32r6
21051 Equivalent to @option{-march=mips32r6}.
21052
21053 @item -mips64
21054 @opindex mips64
21055 Equivalent to @option{-march=mips64}.
21056
21057 @item -mips64r2
21058 @opindex mips64r2
21059 Equivalent to @option{-march=mips64r2}.
21060
21061 @item -mips64r3
21062 @opindex mips64r3
21063 Equivalent to @option{-march=mips64r3}.
21064
21065 @item -mips64r5
21066 @opindex mips64r5
21067 Equivalent to @option{-march=mips64r5}.
21068
21069 @item -mips64r6
21070 @opindex mips64r6
21071 Equivalent to @option{-march=mips64r6}.
21072
21073 @item -mips16
21074 @itemx -mno-mips16
21075 @opindex mips16
21076 @opindex mno-mips16
21077 Generate (do not generate) MIPS16 code. If GCC is targeting a
21078 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21079
21080 MIPS16 code generation can also be controlled on a per-function basis
21081 by means of @code{mips16} and @code{nomips16} attributes.
21082 @xref{Function Attributes}, for more information.
21083
21084 @item -mflip-mips16
21085 @opindex mflip-mips16
21086 Generate MIPS16 code on alternating functions. This option is provided
21087 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21088 not intended for ordinary use in compiling user code.
21089
21090 @item -minterlink-compressed
21091 @itemx -mno-interlink-compressed
21092 @opindex minterlink-compressed
21093 @opindex mno-interlink-compressed
21094 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21095 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21096
21097 For example, code using the standard ISA encoding cannot jump directly
21098 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21099 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21100 knows that the target of the jump is not compressed.
21101
21102 @item -minterlink-mips16
21103 @itemx -mno-interlink-mips16
21104 @opindex minterlink-mips16
21105 @opindex mno-interlink-mips16
21106 Aliases of @option{-minterlink-compressed} and
21107 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21108 and are retained for backwards compatibility.
21109
21110 @item -mabi=32
21111 @itemx -mabi=o64
21112 @itemx -mabi=n32
21113 @itemx -mabi=64
21114 @itemx -mabi=eabi
21115 @opindex mabi=32
21116 @opindex mabi=o64
21117 @opindex mabi=n32
21118 @opindex mabi=64
21119 @opindex mabi=eabi
21120 Generate code for the given ABI@.
21121
21122 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21123 generates 64-bit code when you select a 64-bit architecture, but you
21124 can use @option{-mgp32} to get 32-bit code instead.
21125
21126 For information about the O64 ABI, see
21127 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21128
21129 GCC supports a variant of the o32 ABI in which floating-point registers
21130 are 64 rather than 32 bits wide. You can select this combination with
21131 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21132 and @code{mfhc1} instructions and is therefore only supported for
21133 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21134
21135 The register assignments for arguments and return values remain the
21136 same, but each scalar value is passed in a single 64-bit register
21137 rather than a pair of 32-bit registers. For example, scalar
21138 floating-point values are returned in @samp{$f0} only, not a
21139 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21140 remains the same in that the even-numbered double-precision registers
21141 are saved.
21142
21143 Two additional variants of the o32 ABI are supported to enable
21144 a transition from 32-bit to 64-bit registers. These are FPXX
21145 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21146 The FPXX extension mandates that all code must execute correctly
21147 when run using 32-bit or 64-bit registers. The code can be interlinked
21148 with either FP32 or FP64, but not both.
21149 The FP64A extension is similar to the FP64 extension but forbids the
21150 use of odd-numbered single-precision registers. This can be used
21151 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21152 processors and allows both FP32 and FP64A code to interlink and
21153 run in the same process without changing FPU modes.
21154
21155 @item -mabicalls
21156 @itemx -mno-abicalls
21157 @opindex mabicalls
21158 @opindex mno-abicalls
21159 Generate (do not generate) code that is suitable for SVR4-style
21160 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21161 systems.
21162
21163 @item -mshared
21164 @itemx -mno-shared
21165 Generate (do not generate) code that is fully position-independent,
21166 and that can therefore be linked into shared libraries. This option
21167 only affects @option{-mabicalls}.
21168
21169 All @option{-mabicalls} code has traditionally been position-independent,
21170 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21171 as an extension, the GNU toolchain allows executables to use absolute
21172 accesses for locally-binding symbols. It can also use shorter GP
21173 initialization sequences and generate direct calls to locally-defined
21174 functions. This mode is selected by @option{-mno-shared}.
21175
21176 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21177 objects that can only be linked by the GNU linker. However, the option
21178 does not affect the ABI of the final executable; it only affects the ABI
21179 of relocatable objects. Using @option{-mno-shared} generally makes
21180 executables both smaller and quicker.
21181
21182 @option{-mshared} is the default.
21183
21184 @item -mplt
21185 @itemx -mno-plt
21186 @opindex mplt
21187 @opindex mno-plt
21188 Assume (do not assume) that the static and dynamic linkers
21189 support PLTs and copy relocations. This option only affects
21190 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21191 has no effect without @option{-msym32}.
21192
21193 You can make @option{-mplt} the default by configuring
21194 GCC with @option{--with-mips-plt}. The default is
21195 @option{-mno-plt} otherwise.
21196
21197 @item -mxgot
21198 @itemx -mno-xgot
21199 @opindex mxgot
21200 @opindex mno-xgot
21201 Lift (do not lift) the usual restrictions on the size of the global
21202 offset table.
21203
21204 GCC normally uses a single instruction to load values from the GOT@.
21205 While this is relatively efficient, it only works if the GOT
21206 is smaller than about 64k. Anything larger causes the linker
21207 to report an error such as:
21208
21209 @cindex relocation truncated to fit (MIPS)
21210 @smallexample
21211 relocation truncated to fit: R_MIPS_GOT16 foobar
21212 @end smallexample
21213
21214 If this happens, you should recompile your code with @option{-mxgot}.
21215 This works with very large GOTs, although the code is also
21216 less efficient, since it takes three instructions to fetch the
21217 value of a global symbol.
21218
21219 Note that some linkers can create multiple GOTs. If you have such a
21220 linker, you should only need to use @option{-mxgot} when a single object
21221 file accesses more than 64k's worth of GOT entries. Very few do.
21222
21223 These options have no effect unless GCC is generating position
21224 independent code.
21225
21226 @item -mgp32
21227 @opindex mgp32
21228 Assume that general-purpose registers are 32 bits wide.
21229
21230 @item -mgp64
21231 @opindex mgp64
21232 Assume that general-purpose registers are 64 bits wide.
21233
21234 @item -mfp32
21235 @opindex mfp32
21236 Assume that floating-point registers are 32 bits wide.
21237
21238 @item -mfp64
21239 @opindex mfp64
21240 Assume that floating-point registers are 64 bits wide.
21241
21242 @item -mfpxx
21243 @opindex mfpxx
21244 Do not assume the width of floating-point registers.
21245
21246 @item -mhard-float
21247 @opindex mhard-float
21248 Use floating-point coprocessor instructions.
21249
21250 @item -msoft-float
21251 @opindex msoft-float
21252 Do not use floating-point coprocessor instructions. Implement
21253 floating-point calculations using library calls instead.
21254
21255 @item -mno-float
21256 @opindex mno-float
21257 Equivalent to @option{-msoft-float}, but additionally asserts that the
21258 program being compiled does not perform any floating-point operations.
21259 This option is presently supported only by some bare-metal MIPS
21260 configurations, where it may select a special set of libraries
21261 that lack all floating-point support (including, for example, the
21262 floating-point @code{printf} formats).
21263 If code compiled with @option{-mno-float} accidentally contains
21264 floating-point operations, it is likely to suffer a link-time
21265 or run-time failure.
21266
21267 @item -msingle-float
21268 @opindex msingle-float
21269 Assume that the floating-point coprocessor only supports single-precision
21270 operations.
21271
21272 @item -mdouble-float
21273 @opindex mdouble-float
21274 Assume that the floating-point coprocessor supports double-precision
21275 operations. This is the default.
21276
21277 @item -modd-spreg
21278 @itemx -mno-odd-spreg
21279 @opindex modd-spreg
21280 @opindex mno-odd-spreg
21281 Enable the use of odd-numbered single-precision floating-point registers
21282 for the o32 ABI. This is the default for processors that are known to
21283 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
21284 is set by default.
21285
21286 @item -mabs=2008
21287 @itemx -mabs=legacy
21288 @opindex mabs=2008
21289 @opindex mabs=legacy
21290 These options control the treatment of the special not-a-number (NaN)
21291 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
21292 @code{neg.@i{fmt}} machine instructions.
21293
21294 By default or when @option{-mabs=legacy} is used the legacy
21295 treatment is selected. In this case these instructions are considered
21296 arithmetic and avoided where correct operation is required and the
21297 input operand might be a NaN. A longer sequence of instructions that
21298 manipulate the sign bit of floating-point datum manually is used
21299 instead unless the @option{-ffinite-math-only} option has also been
21300 specified.
21301
21302 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
21303 this case these instructions are considered non-arithmetic and therefore
21304 operating correctly in all cases, including in particular where the
21305 input operand is a NaN. These instructions are therefore always used
21306 for the respective operations.
21307
21308 @item -mnan=2008
21309 @itemx -mnan=legacy
21310 @opindex mnan=2008
21311 @opindex mnan=legacy
21312 These options control the encoding of the special not-a-number (NaN)
21313 IEEE 754 floating-point data.
21314
21315 The @option{-mnan=legacy} option selects the legacy encoding. In this
21316 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21317 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
21318 by the first bit of their trailing significand field being 1.
21319
21320 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
21321 this case qNaNs are denoted by the first bit of their trailing
21322 significand field being 1, whereas sNaNs are denoted by the first bit of
21323 their trailing significand field being 0.
21324
21325 The default is @option{-mnan=legacy} unless GCC has been configured with
21326 @option{--with-nan=2008}.
21327
21328 @item -mllsc
21329 @itemx -mno-llsc
21330 @opindex mllsc
21331 @opindex mno-llsc
21332 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
21333 implement atomic memory built-in functions. When neither option is
21334 specified, GCC uses the instructions if the target architecture
21335 supports them.
21336
21337 @option{-mllsc} is useful if the runtime environment can emulate the
21338 instructions and @option{-mno-llsc} can be useful when compiling for
21339 nonstandard ISAs. You can make either option the default by
21340 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
21341 respectively. @option{--with-llsc} is the default for some
21342 configurations; see the installation documentation for details.
21343
21344 @item -mdsp
21345 @itemx -mno-dsp
21346 @opindex mdsp
21347 @opindex mno-dsp
21348 Use (do not use) revision 1 of the MIPS DSP ASE@.
21349 @xref{MIPS DSP Built-in Functions}. This option defines the
21350 preprocessor macro @code{__mips_dsp}. It also defines
21351 @code{__mips_dsp_rev} to 1.
21352
21353 @item -mdspr2
21354 @itemx -mno-dspr2
21355 @opindex mdspr2
21356 @opindex mno-dspr2
21357 Use (do not use) revision 2 of the MIPS DSP ASE@.
21358 @xref{MIPS DSP Built-in Functions}. This option defines the
21359 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
21360 It also defines @code{__mips_dsp_rev} to 2.
21361
21362 @item -msmartmips
21363 @itemx -mno-smartmips
21364 @opindex msmartmips
21365 @opindex mno-smartmips
21366 Use (do not use) the MIPS SmartMIPS ASE.
21367
21368 @item -mpaired-single
21369 @itemx -mno-paired-single
21370 @opindex mpaired-single
21371 @opindex mno-paired-single
21372 Use (do not use) paired-single floating-point instructions.
21373 @xref{MIPS Paired-Single Support}. This option requires
21374 hardware floating-point support to be enabled.
21375
21376 @item -mdmx
21377 @itemx -mno-mdmx
21378 @opindex mdmx
21379 @opindex mno-mdmx
21380 Use (do not use) MIPS Digital Media Extension instructions.
21381 This option can only be used when generating 64-bit code and requires
21382 hardware floating-point support to be enabled.
21383
21384 @item -mips3d
21385 @itemx -mno-mips3d
21386 @opindex mips3d
21387 @opindex mno-mips3d
21388 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
21389 The option @option{-mips3d} implies @option{-mpaired-single}.
21390
21391 @item -mmicromips
21392 @itemx -mno-micromips
21393 @opindex mmicromips
21394 @opindex mno-mmicromips
21395 Generate (do not generate) microMIPS code.
21396
21397 MicroMIPS code generation can also be controlled on a per-function basis
21398 by means of @code{micromips} and @code{nomicromips} attributes.
21399 @xref{Function Attributes}, for more information.
21400
21401 @item -mmt
21402 @itemx -mno-mt
21403 @opindex mmt
21404 @opindex mno-mt
21405 Use (do not use) MT Multithreading instructions.
21406
21407 @item -mmcu
21408 @itemx -mno-mcu
21409 @opindex mmcu
21410 @opindex mno-mcu
21411 Use (do not use) the MIPS MCU ASE instructions.
21412
21413 @item -meva
21414 @itemx -mno-eva
21415 @opindex meva
21416 @opindex mno-eva
21417 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
21418
21419 @item -mvirt
21420 @itemx -mno-virt
21421 @opindex mvirt
21422 @opindex mno-virt
21423 Use (do not use) the MIPS Virtualization (VZ) instructions.
21424
21425 @item -mxpa
21426 @itemx -mno-xpa
21427 @opindex mxpa
21428 @opindex mno-xpa
21429 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
21430
21431 @item -mcrc
21432 @itemx -mno-crc
21433 @opindex mcrc
21434 @opindex mno-crc
21435 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
21436
21437 @item -mginv
21438 @itemx -mno-ginv
21439 @opindex mginv
21440 @opindex mno-ginv
21441 Use (do not use) the MIPS Global INValidate (GINV) instructions.
21442
21443 @item -mloongson-mmi
21444 @itemx -mno-loongson-mmi
21445 @opindex mloongson-mmi
21446 @opindex mno-loongson-mmi
21447 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
21448
21449 @item -mloongson-ext
21450 @itemx -mno-loongson-ext
21451 @opindex mloongson-ext
21452 @opindex mno-loongson-ext
21453 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
21454
21455 @item -mloongson-ext2
21456 @itemx -mno-loongson-ext2
21457 @opindex mloongson-ext2
21458 @opindex mno-loongson-ext2
21459 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
21460
21461 @item -mlong64
21462 @opindex mlong64
21463 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
21464 an explanation of the default and the way that the pointer size is
21465 determined.
21466
21467 @item -mlong32
21468 @opindex mlong32
21469 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
21470
21471 The default size of @code{int}s, @code{long}s and pointers depends on
21472 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
21473 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
21474 32-bit @code{long}s. Pointers are the same size as @code{long}s,
21475 or the same size as integer registers, whichever is smaller.
21476
21477 @item -msym32
21478 @itemx -mno-sym32
21479 @opindex msym32
21480 @opindex mno-sym32
21481 Assume (do not assume) that all symbols have 32-bit values, regardless
21482 of the selected ABI@. This option is useful in combination with
21483 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
21484 to generate shorter and faster references to symbolic addresses.
21485
21486 @item -G @var{num}
21487 @opindex G
21488 Put definitions of externally-visible data in a small data section
21489 if that data is no bigger than @var{num} bytes. GCC can then generate
21490 more efficient accesses to the data; see @option{-mgpopt} for details.
21491
21492 The default @option{-G} option depends on the configuration.
21493
21494 @item -mlocal-sdata
21495 @itemx -mno-local-sdata
21496 @opindex mlocal-sdata
21497 @opindex mno-local-sdata
21498 Extend (do not extend) the @option{-G} behavior to local data too,
21499 such as to static variables in C@. @option{-mlocal-sdata} is the
21500 default for all configurations.
21501
21502 If the linker complains that an application is using too much small data,
21503 you might want to try rebuilding the less performance-critical parts with
21504 @option{-mno-local-sdata}. You might also want to build large
21505 libraries with @option{-mno-local-sdata}, so that the libraries leave
21506 more room for the main program.
21507
21508 @item -mextern-sdata
21509 @itemx -mno-extern-sdata
21510 @opindex mextern-sdata
21511 @opindex mno-extern-sdata
21512 Assume (do not assume) that externally-defined data is in
21513 a small data section if the size of that data is within the @option{-G} limit.
21514 @option{-mextern-sdata} is the default for all configurations.
21515
21516 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
21517 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
21518 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
21519 is placed in a small data section. If @var{Var} is defined by another
21520 module, you must either compile that module with a high-enough
21521 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
21522 definition. If @var{Var} is common, you must link the application
21523 with a high-enough @option{-G} setting.
21524
21525 The easiest way of satisfying these restrictions is to compile
21526 and link every module with the same @option{-G} option. However,
21527 you may wish to build a library that supports several different
21528 small data limits. You can do this by compiling the library with
21529 the highest supported @option{-G} setting and additionally using
21530 @option{-mno-extern-sdata} to stop the library from making assumptions
21531 about externally-defined data.
21532
21533 @item -mgpopt
21534 @itemx -mno-gpopt
21535 @opindex mgpopt
21536 @opindex mno-gpopt
21537 Use (do not use) GP-relative accesses for symbols that are known to be
21538 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
21539 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
21540 configurations.
21541
21542 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
21543 might not hold the value of @code{_gp}. For example, if the code is
21544 part of a library that might be used in a boot monitor, programs that
21545 call boot monitor routines pass an unknown value in @code{$gp}.
21546 (In such situations, the boot monitor itself is usually compiled
21547 with @option{-G0}.)
21548
21549 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
21550 @option{-mno-extern-sdata}.
21551
21552 @item -membedded-data
21553 @itemx -mno-embedded-data
21554 @opindex membedded-data
21555 @opindex mno-embedded-data
21556 Allocate variables to the read-only data section first if possible, then
21557 next in the small data section if possible, otherwise in data. This gives
21558 slightly slower code than the default, but reduces the amount of RAM required
21559 when executing, and thus may be preferred for some embedded systems.
21560
21561 @item -muninit-const-in-rodata
21562 @itemx -mno-uninit-const-in-rodata
21563 @opindex muninit-const-in-rodata
21564 @opindex mno-uninit-const-in-rodata
21565 Put uninitialized @code{const} variables in the read-only data section.
21566 This option is only meaningful in conjunction with @option{-membedded-data}.
21567
21568 @item -mcode-readable=@var{setting}
21569 @opindex mcode-readable
21570 Specify whether GCC may generate code that reads from executable sections.
21571 There are three possible settings:
21572
21573 @table @gcctabopt
21574 @item -mcode-readable=yes
21575 Instructions may freely access executable sections. This is the
21576 default setting.
21577
21578 @item -mcode-readable=pcrel
21579 MIPS16 PC-relative load instructions can access executable sections,
21580 but other instructions must not do so. This option is useful on 4KSc
21581 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
21582 It is also useful on processors that can be configured to have a dual
21583 instruction/data SRAM interface and that, like the M4K, automatically
21584 redirect PC-relative loads to the instruction RAM.
21585
21586 @item -mcode-readable=no
21587 Instructions must not access executable sections. This option can be
21588 useful on targets that are configured to have a dual instruction/data
21589 SRAM interface but that (unlike the M4K) do not automatically redirect
21590 PC-relative loads to the instruction RAM.
21591 @end table
21592
21593 @item -msplit-addresses
21594 @itemx -mno-split-addresses
21595 @opindex msplit-addresses
21596 @opindex mno-split-addresses
21597 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
21598 relocation operators. This option has been superseded by
21599 @option{-mexplicit-relocs} but is retained for backwards compatibility.
21600
21601 @item -mexplicit-relocs
21602 @itemx -mno-explicit-relocs
21603 @opindex mexplicit-relocs
21604 @opindex mno-explicit-relocs
21605 Use (do not use) assembler relocation operators when dealing with symbolic
21606 addresses. The alternative, selected by @option{-mno-explicit-relocs},
21607 is to use assembler macros instead.
21608
21609 @option{-mexplicit-relocs} is the default if GCC was configured
21610 to use an assembler that supports relocation operators.
21611
21612 @item -mcheck-zero-division
21613 @itemx -mno-check-zero-division
21614 @opindex mcheck-zero-division
21615 @opindex mno-check-zero-division
21616 Trap (do not trap) on integer division by zero.
21617
21618 The default is @option{-mcheck-zero-division}.
21619
21620 @item -mdivide-traps
21621 @itemx -mdivide-breaks
21622 @opindex mdivide-traps
21623 @opindex mdivide-breaks
21624 MIPS systems check for division by zero by generating either a
21625 conditional trap or a break instruction. Using traps results in
21626 smaller code, but is only supported on MIPS II and later. Also, some
21627 versions of the Linux kernel have a bug that prevents trap from
21628 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
21629 allow conditional traps on architectures that support them and
21630 @option{-mdivide-breaks} to force the use of breaks.
21631
21632 The default is usually @option{-mdivide-traps}, but this can be
21633 overridden at configure time using @option{--with-divide=breaks}.
21634 Divide-by-zero checks can be completely disabled using
21635 @option{-mno-check-zero-division}.
21636
21637 @item -mload-store-pairs
21638 @itemx -mno-load-store-pairs
21639 @opindex mload-store-pairs
21640 @opindex mno-load-store-pairs
21641 Enable (disable) an optimization that pairs consecutive load or store
21642 instructions to enable load/store bonding. This option is enabled by
21643 default but only takes effect when the selected architecture is known
21644 to support bonding.
21645
21646 @item -mmemcpy
21647 @itemx -mno-memcpy
21648 @opindex mmemcpy
21649 @opindex mno-memcpy
21650 Force (do not force) the use of @code{memcpy} for non-trivial block
21651 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
21652 most constant-sized copies.
21653
21654 @item -mlong-calls
21655 @itemx -mno-long-calls
21656 @opindex mlong-calls
21657 @opindex mno-long-calls
21658 Disable (do not disable) use of the @code{jal} instruction. Calling
21659 functions using @code{jal} is more efficient but requires the caller
21660 and callee to be in the same 256 megabyte segment.
21661
21662 This option has no effect on abicalls code. The default is
21663 @option{-mno-long-calls}.
21664
21665 @item -mmad
21666 @itemx -mno-mad
21667 @opindex mmad
21668 @opindex mno-mad
21669 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
21670 instructions, as provided by the R4650 ISA@.
21671
21672 @item -mimadd
21673 @itemx -mno-imadd
21674 @opindex mimadd
21675 @opindex mno-imadd
21676 Enable (disable) use of the @code{madd} and @code{msub} integer
21677 instructions. The default is @option{-mimadd} on architectures
21678 that support @code{madd} and @code{msub} except for the 74k
21679 architecture where it was found to generate slower code.
21680
21681 @item -mfused-madd
21682 @itemx -mno-fused-madd
21683 @opindex mfused-madd
21684 @opindex mno-fused-madd
21685 Enable (disable) use of the floating-point multiply-accumulate
21686 instructions, when they are available. The default is
21687 @option{-mfused-madd}.
21688
21689 On the R8000 CPU when multiply-accumulate instructions are used,
21690 the intermediate product is calculated to infinite precision
21691 and is not subject to the FCSR Flush to Zero bit. This may be
21692 undesirable in some circumstances. On other processors the result
21693 is numerically identical to the equivalent computation using
21694 separate multiply, add, subtract and negate instructions.
21695
21696 @item -nocpp
21697 @opindex nocpp
21698 Tell the MIPS assembler to not run its preprocessor over user
21699 assembler files (with a @samp{.s} suffix) when assembling them.
21700
21701 @item -mfix-24k
21702 @itemx -mno-fix-24k
21703 @opindex mfix-24k
21704 @opindex mno-fix-24k
21705 Work around the 24K E48 (lost data on stores during refill) errata.
21706 The workarounds are implemented by the assembler rather than by GCC@.
21707
21708 @item -mfix-r4000
21709 @itemx -mno-fix-r4000
21710 @opindex mfix-r4000
21711 @opindex mno-fix-r4000
21712 Work around certain R4000 CPU errata:
21713 @itemize @minus
21714 @item
21715 A double-word or a variable shift may give an incorrect result if executed
21716 immediately after starting an integer division.
21717 @item
21718 A double-word or a variable shift may give an incorrect result if executed
21719 while an integer multiplication is in progress.
21720 @item
21721 An integer division may give an incorrect result if started in a delay slot
21722 of a taken branch or a jump.
21723 @end itemize
21724
21725 @item -mfix-r4400
21726 @itemx -mno-fix-r4400
21727 @opindex mfix-r4400
21728 @opindex mno-fix-r4400
21729 Work around certain R4400 CPU errata:
21730 @itemize @minus
21731 @item
21732 A double-word or a variable shift may give an incorrect result if executed
21733 immediately after starting an integer division.
21734 @end itemize
21735
21736 @item -mfix-r10000
21737 @itemx -mno-fix-r10000
21738 @opindex mfix-r10000
21739 @opindex mno-fix-r10000
21740 Work around certain R10000 errata:
21741 @itemize @minus
21742 @item
21743 @code{ll}/@code{sc} sequences may not behave atomically on revisions
21744 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
21745 @end itemize
21746
21747 This option can only be used if the target architecture supports
21748 branch-likely instructions. @option{-mfix-r10000} is the default when
21749 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
21750 otherwise.
21751
21752 @item -mfix-rm7000
21753 @itemx -mno-fix-rm7000
21754 @opindex mfix-rm7000
21755 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
21756 workarounds are implemented by the assembler rather than by GCC@.
21757
21758 @item -mfix-vr4120
21759 @itemx -mno-fix-vr4120
21760 @opindex mfix-vr4120
21761 Work around certain VR4120 errata:
21762 @itemize @minus
21763 @item
21764 @code{dmultu} does not always produce the correct result.
21765 @item
21766 @code{div} and @code{ddiv} do not always produce the correct result if one
21767 of the operands is negative.
21768 @end itemize
21769 The workarounds for the division errata rely on special functions in
21770 @file{libgcc.a}. At present, these functions are only provided by
21771 the @code{mips64vr*-elf} configurations.
21772
21773 Other VR4120 errata require a NOP to be inserted between certain pairs of
21774 instructions. These errata are handled by the assembler, not by GCC itself.
21775
21776 @item -mfix-vr4130
21777 @opindex mfix-vr4130
21778 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
21779 workarounds are implemented by the assembler rather than by GCC,
21780 although GCC avoids using @code{mflo} and @code{mfhi} if the
21781 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
21782 instructions are available instead.
21783
21784 @item -mfix-sb1
21785 @itemx -mno-fix-sb1
21786 @opindex mfix-sb1
21787 Work around certain SB-1 CPU core errata.
21788 (This flag currently works around the SB-1 revision 2
21789 ``F1'' and ``F2'' floating-point errata.)
21790
21791 @item -mr10k-cache-barrier=@var{setting}
21792 @opindex mr10k-cache-barrier
21793 Specify whether GCC should insert cache barriers to avoid the
21794 side effects of speculation on R10K processors.
21795
21796 In common with many processors, the R10K tries to predict the outcome
21797 of a conditional branch and speculatively executes instructions from
21798 the ``taken'' branch. It later aborts these instructions if the
21799 predicted outcome is wrong. However, on the R10K, even aborted
21800 instructions can have side effects.
21801
21802 This problem only affects kernel stores and, depending on the system,
21803 kernel loads. As an example, a speculatively-executed store may load
21804 the target memory into cache and mark the cache line as dirty, even if
21805 the store itself is later aborted. If a DMA operation writes to the
21806 same area of memory before the ``dirty'' line is flushed, the cached
21807 data overwrites the DMA-ed data. See the R10K processor manual
21808 for a full description, including other potential problems.
21809
21810 One workaround is to insert cache barrier instructions before every memory
21811 access that might be speculatively executed and that might have side
21812 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
21813 controls GCC's implementation of this workaround. It assumes that
21814 aborted accesses to any byte in the following regions does not have
21815 side effects:
21816
21817 @enumerate
21818 @item
21819 the memory occupied by the current function's stack frame;
21820
21821 @item
21822 the memory occupied by an incoming stack argument;
21823
21824 @item
21825 the memory occupied by an object with a link-time-constant address.
21826 @end enumerate
21827
21828 It is the kernel's responsibility to ensure that speculative
21829 accesses to these regions are indeed safe.
21830
21831 If the input program contains a function declaration such as:
21832
21833 @smallexample
21834 void foo (void);
21835 @end smallexample
21836
21837 then the implementation of @code{foo} must allow @code{j foo} and
21838 @code{jal foo} to be executed speculatively. GCC honors this
21839 restriction for functions it compiles itself. It expects non-GCC
21840 functions (such as hand-written assembly code) to do the same.
21841
21842 The option has three forms:
21843
21844 @table @gcctabopt
21845 @item -mr10k-cache-barrier=load-store
21846 Insert a cache barrier before a load or store that might be
21847 speculatively executed and that might have side effects even
21848 if aborted.
21849
21850 @item -mr10k-cache-barrier=store
21851 Insert a cache barrier before a store that might be speculatively
21852 executed and that might have side effects even if aborted.
21853
21854 @item -mr10k-cache-barrier=none
21855 Disable the insertion of cache barriers. This is the default setting.
21856 @end table
21857
21858 @item -mflush-func=@var{func}
21859 @itemx -mno-flush-func
21860 @opindex mflush-func
21861 Specifies the function to call to flush the I and D caches, or to not
21862 call any such function. If called, the function must take the same
21863 arguments as the common @code{_flush_func}, that is, the address of the
21864 memory range for which the cache is being flushed, the size of the
21865 memory range, and the number 3 (to flush both caches). The default
21866 depends on the target GCC was configured for, but commonly is either
21867 @code{_flush_func} or @code{__cpu_flush}.
21868
21869 @item mbranch-cost=@var{num}
21870 @opindex mbranch-cost
21871 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21872 This cost is only a heuristic and is not guaranteed to produce
21873 consistent results across releases. A zero cost redundantly selects
21874 the default, which is based on the @option{-mtune} setting.
21875
21876 @item -mbranch-likely
21877 @itemx -mno-branch-likely
21878 @opindex mbranch-likely
21879 @opindex mno-branch-likely
21880 Enable or disable use of Branch Likely instructions, regardless of the
21881 default for the selected architecture. By default, Branch Likely
21882 instructions may be generated if they are supported by the selected
21883 architecture. An exception is for the MIPS32 and MIPS64 architectures
21884 and processors that implement those architectures; for those, Branch
21885 Likely instructions are not be generated by default because the MIPS32
21886 and MIPS64 architectures specifically deprecate their use.
21887
21888 @item -mcompact-branches=never
21889 @itemx -mcompact-branches=optimal
21890 @itemx -mcompact-branches=always
21891 @opindex mcompact-branches=never
21892 @opindex mcompact-branches=optimal
21893 @opindex mcompact-branches=always
21894 These options control which form of branches will be generated. The
21895 default is @option{-mcompact-branches=optimal}.
21896
21897 The @option{-mcompact-branches=never} option ensures that compact branch
21898 instructions will never be generated.
21899
21900 The @option{-mcompact-branches=always} option ensures that a compact
21901 branch instruction will be generated if available. If a compact branch
21902 instruction is not available, a delay slot form of the branch will be
21903 used instead.
21904
21905 This option is supported from MIPS Release 6 onwards.
21906
21907 The @option{-mcompact-branches=optimal} option will cause a delay slot
21908 branch to be used if one is available in the current ISA and the delay
21909 slot is successfully filled. If the delay slot is not filled, a compact
21910 branch will be chosen if one is available.
21911
21912 @item -mfp-exceptions
21913 @itemx -mno-fp-exceptions
21914 @opindex mfp-exceptions
21915 Specifies whether FP exceptions are enabled. This affects how
21916 FP instructions are scheduled for some processors.
21917 The default is that FP exceptions are
21918 enabled.
21919
21920 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
21921 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
21922 FP pipe.
21923
21924 @item -mvr4130-align
21925 @itemx -mno-vr4130-align
21926 @opindex mvr4130-align
21927 The VR4130 pipeline is two-way superscalar, but can only issue two
21928 instructions together if the first one is 8-byte aligned. When this
21929 option is enabled, GCC aligns pairs of instructions that it
21930 thinks should execute in parallel.
21931
21932 This option only has an effect when optimizing for the VR4130.
21933 It normally makes code faster, but at the expense of making it bigger.
21934 It is enabled by default at optimization level @option{-O3}.
21935
21936 @item -msynci
21937 @itemx -mno-synci
21938 @opindex msynci
21939 Enable (disable) generation of @code{synci} instructions on
21940 architectures that support it. The @code{synci} instructions (if
21941 enabled) are generated when @code{__builtin___clear_cache} is
21942 compiled.
21943
21944 This option defaults to @option{-mno-synci}, but the default can be
21945 overridden by configuring GCC with @option{--with-synci}.
21946
21947 When compiling code for single processor systems, it is generally safe
21948 to use @code{synci}. However, on many multi-core (SMP) systems, it
21949 does not invalidate the instruction caches on all cores and may lead
21950 to undefined behavior.
21951
21952 @item -mrelax-pic-calls
21953 @itemx -mno-relax-pic-calls
21954 @opindex mrelax-pic-calls
21955 Try to turn PIC calls that are normally dispatched via register
21956 @code{$25} into direct calls. This is only possible if the linker can
21957 resolve the destination at link time and if the destination is within
21958 range for a direct call.
21959
21960 @option{-mrelax-pic-calls} is the default if GCC was configured to use
21961 an assembler and a linker that support the @code{.reloc} assembly
21962 directive and @option{-mexplicit-relocs} is in effect. With
21963 @option{-mno-explicit-relocs}, this optimization can be performed by the
21964 assembler and the linker alone without help from the compiler.
21965
21966 @item -mmcount-ra-address
21967 @itemx -mno-mcount-ra-address
21968 @opindex mmcount-ra-address
21969 @opindex mno-mcount-ra-address
21970 Emit (do not emit) code that allows @code{_mcount} to modify the
21971 calling function's return address. When enabled, this option extends
21972 the usual @code{_mcount} interface with a new @var{ra-address}
21973 parameter, which has type @code{intptr_t *} and is passed in register
21974 @code{$12}. @code{_mcount} can then modify the return address by
21975 doing both of the following:
21976 @itemize
21977 @item
21978 Returning the new address in register @code{$31}.
21979 @item
21980 Storing the new address in @code{*@var{ra-address}},
21981 if @var{ra-address} is nonnull.
21982 @end itemize
21983
21984 The default is @option{-mno-mcount-ra-address}.
21985
21986 @item -mframe-header-opt
21987 @itemx -mno-frame-header-opt
21988 @opindex mframe-header-opt
21989 Enable (disable) frame header optimization in the o32 ABI. When using the
21990 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
21991 function to write out register arguments. When enabled, this optimization
21992 will suppress the allocation of the frame header if it can be determined that
21993 it is unused.
21994
21995 This optimization is off by default at all optimization levels.
21996
21997 @item -mlxc1-sxc1
21998 @itemx -mno-lxc1-sxc1
21999 @opindex mlxc1-sxc1
22000 When applicable, enable (disable) the generation of @code{lwxc1},
22001 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22002
22003 @item -mmadd4
22004 @itemx -mno-madd4
22005 @opindex mmadd4
22006 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22007 @code{madd.d} and related instructions. Enabled by default.
22008
22009 @end table
22010
22011 @node MMIX Options
22012 @subsection MMIX Options
22013 @cindex MMIX Options
22014
22015 These options are defined for the MMIX:
22016
22017 @table @gcctabopt
22018 @item -mlibfuncs
22019 @itemx -mno-libfuncs
22020 @opindex mlibfuncs
22021 @opindex mno-libfuncs
22022 Specify that intrinsic library functions are being compiled, passing all
22023 values in registers, no matter the size.
22024
22025 @item -mepsilon
22026 @itemx -mno-epsilon
22027 @opindex mepsilon
22028 @opindex mno-epsilon
22029 Generate floating-point comparison instructions that compare with respect
22030 to the @code{rE} epsilon register.
22031
22032 @item -mabi=mmixware
22033 @itemx -mabi=gnu
22034 @opindex mabi=mmixware
22035 @opindex mabi=gnu
22036 Generate code that passes function parameters and return values that (in
22037 the called function) are seen as registers @code{$0} and up, as opposed to
22038 the GNU ABI which uses global registers @code{$231} and up.
22039
22040 @item -mzero-extend
22041 @itemx -mno-zero-extend
22042 @opindex mzero-extend
22043 @opindex mno-zero-extend
22044 When reading data from memory in sizes shorter than 64 bits, use (do not
22045 use) zero-extending load instructions by default, rather than
22046 sign-extending ones.
22047
22048 @item -mknuthdiv
22049 @itemx -mno-knuthdiv
22050 @opindex mknuthdiv
22051 @opindex mno-knuthdiv
22052 Make the result of a division yielding a remainder have the same sign as
22053 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22054 remainder follows the sign of the dividend. Both methods are
22055 arithmetically valid, the latter being almost exclusively used.
22056
22057 @item -mtoplevel-symbols
22058 @itemx -mno-toplevel-symbols
22059 @opindex mtoplevel-symbols
22060 @opindex mno-toplevel-symbols
22061 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22062 code can be used with the @code{PREFIX} assembly directive.
22063
22064 @item -melf
22065 @opindex melf
22066 Generate an executable in the ELF format, rather than the default
22067 @samp{mmo} format used by the @command{mmix} simulator.
22068
22069 @item -mbranch-predict
22070 @itemx -mno-branch-predict
22071 @opindex mbranch-predict
22072 @opindex mno-branch-predict
22073 Use (do not use) the probable-branch instructions, when static branch
22074 prediction indicates a probable branch.
22075
22076 @item -mbase-addresses
22077 @itemx -mno-base-addresses
22078 @opindex mbase-addresses
22079 @opindex mno-base-addresses
22080 Generate (do not generate) code that uses @emph{base addresses}. Using a
22081 base address automatically generates a request (handled by the assembler
22082 and the linker) for a constant to be set up in a global register. The
22083 register is used for one or more base address requests within the range 0
22084 to 255 from the value held in the register. The generally leads to short
22085 and fast code, but the number of different data items that can be
22086 addressed is limited. This means that a program that uses lots of static
22087 data may require @option{-mno-base-addresses}.
22088
22089 @item -msingle-exit
22090 @itemx -mno-single-exit
22091 @opindex msingle-exit
22092 @opindex mno-single-exit
22093 Force (do not force) generated code to have a single exit point in each
22094 function.
22095 @end table
22096
22097 @node MN10300 Options
22098 @subsection MN10300 Options
22099 @cindex MN10300 options
22100
22101 These @option{-m} options are defined for Matsushita MN10300 architectures:
22102
22103 @table @gcctabopt
22104 @item -mmult-bug
22105 @opindex mmult-bug
22106 Generate code to avoid bugs in the multiply instructions for the MN10300
22107 processors. This is the default.
22108
22109 @item -mno-mult-bug
22110 @opindex mno-mult-bug
22111 Do not generate code to avoid bugs in the multiply instructions for the
22112 MN10300 processors.
22113
22114 @item -mam33
22115 @opindex mam33
22116 Generate code using features specific to the AM33 processor.
22117
22118 @item -mno-am33
22119 @opindex mno-am33
22120 Do not generate code using features specific to the AM33 processor. This
22121 is the default.
22122
22123 @item -mam33-2
22124 @opindex mam33-2
22125 Generate code using features specific to the AM33/2.0 processor.
22126
22127 @item -mam34
22128 @opindex mam34
22129 Generate code using features specific to the AM34 processor.
22130
22131 @item -mtune=@var{cpu-type}
22132 @opindex mtune
22133 Use the timing characteristics of the indicated CPU type when
22134 scheduling instructions. This does not change the targeted processor
22135 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22136 @samp{am33-2} or @samp{am34}.
22137
22138 @item -mreturn-pointer-on-d0
22139 @opindex mreturn-pointer-on-d0
22140 When generating a function that returns a pointer, return the pointer
22141 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22142 only in @code{a0}, and attempts to call such functions without a prototype
22143 result in errors. Note that this option is on by default; use
22144 @option{-mno-return-pointer-on-d0} to disable it.
22145
22146 @item -mno-crt0
22147 @opindex mno-crt0
22148 Do not link in the C run-time initialization object file.
22149
22150 @item -mrelax
22151 @opindex mrelax
22152 Indicate to the linker that it should perform a relaxation optimization pass
22153 to shorten branches, calls and absolute memory addresses. This option only
22154 has an effect when used on the command line for the final link step.
22155
22156 This option makes symbolic debugging impossible.
22157
22158 @item -mliw
22159 @opindex mliw
22160 Allow the compiler to generate @emph{Long Instruction Word}
22161 instructions if the target is the @samp{AM33} or later. This is the
22162 default. This option defines the preprocessor macro @code{__LIW__}.
22163
22164 @item -mno-liw
22165 @opindex mno-liw
22166 Do not allow the compiler to generate @emph{Long Instruction Word}
22167 instructions. This option defines the preprocessor macro
22168 @code{__NO_LIW__}.
22169
22170 @item -msetlb
22171 @opindex msetlb
22172 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22173 instructions if the target is the @samp{AM33} or later. This is the
22174 default. This option defines the preprocessor macro @code{__SETLB__}.
22175
22176 @item -mno-setlb
22177 @opindex mno-setlb
22178 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22179 instructions. This option defines the preprocessor macro
22180 @code{__NO_SETLB__}.
22181
22182 @end table
22183
22184 @node Moxie Options
22185 @subsection Moxie Options
22186 @cindex Moxie Options
22187
22188 @table @gcctabopt
22189
22190 @item -meb
22191 @opindex meb
22192 Generate big-endian code. This is the default for @samp{moxie-*-*}
22193 configurations.
22194
22195 @item -mel
22196 @opindex mel
22197 Generate little-endian code.
22198
22199 @item -mmul.x
22200 @opindex mmul.x
22201 Generate mul.x and umul.x instructions. This is the default for
22202 @samp{moxiebox-*-*} configurations.
22203
22204 @item -mno-crt0
22205 @opindex mno-crt0
22206 Do not link in the C run-time initialization object file.
22207
22208 @end table
22209
22210 @node MSP430 Options
22211 @subsection MSP430 Options
22212 @cindex MSP430 Options
22213
22214 These options are defined for the MSP430:
22215
22216 @table @gcctabopt
22217
22218 @item -masm-hex
22219 @opindex masm-hex
22220 Force assembly output to always use hex constants. Normally such
22221 constants are signed decimals, but this option is available for
22222 testsuite and/or aesthetic purposes.
22223
22224 @item -mmcu=
22225 @opindex mmcu=
22226 Select the MCU to target. This is used to create a C preprocessor
22227 symbol based upon the MCU name, converted to upper case and pre- and
22228 post-fixed with @samp{__}. This in turn is used by the
22229 @file{msp430.h} header file to select an MCU-specific supplementary
22230 header file.
22231
22232 The option also sets the ISA to use. If the MCU name is one that is
22233 known to only support the 430 ISA then that is selected, otherwise the
22234 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22235 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22236 name selects the 430X ISA.
22237
22238 In addition an MCU-specific linker script is added to the linker
22239 command line. The script's name is the name of the MCU with
22240 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
22241 command line defines the C preprocessor symbol @code{__XXX__} and
22242 cause the linker to search for a script called @file{xxx.ld}.
22243
22244 This option is also passed on to the assembler.
22245
22246 @item -mwarn-mcu
22247 @itemx -mno-warn-mcu
22248 @opindex mwarn-mcu
22249 @opindex mno-warn-mcu
22250 This option enables or disables warnings about conflicts between the
22251 MCU name specified by the @option{-mmcu} option and the ISA set by the
22252 @option{-mcpu} option and/or the hardware multiply support set by the
22253 @option{-mhwmult} option. It also toggles warnings about unrecognized
22254 MCU names. This option is on by default.
22255
22256 @item -mcpu=
22257 @opindex mcpu=
22258 Specifies the ISA to use. Accepted values are @samp{msp430},
22259 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
22260 @option{-mmcu=} option should be used to select the ISA.
22261
22262 @item -msim
22263 @opindex msim
22264 Link to the simulator runtime libraries and linker script. Overrides
22265 any scripts that would be selected by the @option{-mmcu=} option.
22266
22267 @item -mlarge
22268 @opindex mlarge
22269 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
22270
22271 @item -msmall
22272 @opindex msmall
22273 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
22274
22275 @item -mrelax
22276 @opindex mrelax
22277 This option is passed to the assembler and linker, and allows the
22278 linker to perform certain optimizations that cannot be done until
22279 the final link.
22280
22281 @item mhwmult=
22282 @opindex mhwmult=
22283 Describes the type of hardware multiply supported by the target.
22284 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
22285 for the original 16-bit-only multiply supported by early MCUs.
22286 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
22287 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
22288 A value of @samp{auto} can also be given. This tells GCC to deduce
22289 the hardware multiply support based upon the MCU name provided by the
22290 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
22291 the MCU name is not recognized then no hardware multiply support is
22292 assumed. @code{auto} is the default setting.
22293
22294 Hardware multiplies are normally performed by calling a library
22295 routine. This saves space in the generated code. When compiling at
22296 @option{-O3} or higher however the hardware multiplier is invoked
22297 inline. This makes for bigger, but faster code.
22298
22299 The hardware multiply routines disable interrupts whilst running and
22300 restore the previous interrupt state when they finish. This makes
22301 them safe to use inside interrupt handlers as well as in normal code.
22302
22303 @item -minrt
22304 @opindex minrt
22305 Enable the use of a minimum runtime environment - no static
22306 initializers or constructors. This is intended for memory-constrained
22307 devices. The compiler includes special symbols in some objects
22308 that tell the linker and runtime which code fragments are required.
22309
22310 @item -mcode-region=
22311 @itemx -mdata-region=
22312 @opindex mcode-region
22313 @opindex mdata-region
22314 These options tell the compiler where to place functions and data that
22315 do not have one of the @code{lower}, @code{upper}, @code{either} or
22316 @code{section} attributes. Possible values are @code{lower},
22317 @code{upper}, @code{either} or @code{any}. The first three behave
22318 like the corresponding attribute. The fourth possible value -
22319 @code{any} - is the default. It leaves placement entirely up to the
22320 linker script and how it assigns the standard sections
22321 (@code{.text}, @code{.data}, etc) to the memory regions.
22322
22323 @item -msilicon-errata=
22324 @opindex msilicon-errata
22325 This option passes on a request to assembler to enable the fixes for
22326 the named silicon errata.
22327
22328 @item -msilicon-errata-warn=
22329 @opindex msilicon-errata-warn
22330 This option passes on a request to the assembler to enable warning
22331 messages when a silicon errata might need to be applied.
22332
22333 @end table
22334
22335 @node NDS32 Options
22336 @subsection NDS32 Options
22337 @cindex NDS32 Options
22338
22339 These options are defined for NDS32 implementations:
22340
22341 @table @gcctabopt
22342
22343 @item -mbig-endian
22344 @opindex mbig-endian
22345 Generate code in big-endian mode.
22346
22347 @item -mlittle-endian
22348 @opindex mlittle-endian
22349 Generate code in little-endian mode.
22350
22351 @item -mreduced-regs
22352 @opindex mreduced-regs
22353 Use reduced-set registers for register allocation.
22354
22355 @item -mfull-regs
22356 @opindex mfull-regs
22357 Use full-set registers for register allocation.
22358
22359 @item -mcmov
22360 @opindex mcmov
22361 Generate conditional move instructions.
22362
22363 @item -mno-cmov
22364 @opindex mno-cmov
22365 Do not generate conditional move instructions.
22366
22367 @item -mext-perf
22368 @opindex mext-perf
22369 Generate performance extension instructions.
22370
22371 @item -mno-ext-perf
22372 @opindex mno-ext-perf
22373 Do not generate performance extension instructions.
22374
22375 @item -mext-perf2
22376 @opindex mext-perf2
22377 Generate performance extension 2 instructions.
22378
22379 @item -mno-ext-perf2
22380 @opindex mno-ext-perf2
22381 Do not generate performance extension 2 instructions.
22382
22383 @item -mext-string
22384 @opindex mext-string
22385 Generate string extension instructions.
22386
22387 @item -mno-ext-string
22388 @opindex mno-ext-string
22389 Do not generate string extension instructions.
22390
22391 @item -mv3push
22392 @opindex mv3push
22393 Generate v3 push25/pop25 instructions.
22394
22395 @item -mno-v3push
22396 @opindex mno-v3push
22397 Do not generate v3 push25/pop25 instructions.
22398
22399 @item -m16-bit
22400 @opindex m16-bit
22401 Generate 16-bit instructions.
22402
22403 @item -mno-16-bit
22404 @opindex mno-16-bit
22405 Do not generate 16-bit instructions.
22406
22407 @item -misr-vector-size=@var{num}
22408 @opindex misr-vector-size
22409 Specify the size of each interrupt vector, which must be 4 or 16.
22410
22411 @item -mcache-block-size=@var{num}
22412 @opindex mcache-block-size
22413 Specify the size of each cache block,
22414 which must be a power of 2 between 4 and 512.
22415
22416 @item -march=@var{arch}
22417 @opindex march
22418 Specify the name of the target architecture.
22419
22420 @item -mcmodel=@var{code-model}
22421 @opindex mcmodel
22422 Set the code model to one of
22423 @table @asis
22424 @item @samp{small}
22425 All the data and read-only data segments must be within 512KB addressing space.
22426 The text segment must be within 16MB addressing space.
22427 @item @samp{medium}
22428 The data segment must be within 512KB while the read-only data segment can be
22429 within 4GB addressing space. The text segment should be still within 16MB
22430 addressing space.
22431 @item @samp{large}
22432 All the text and data segments can be within 4GB addressing space.
22433 @end table
22434
22435 @item -mctor-dtor
22436 @opindex mctor-dtor
22437 Enable constructor/destructor feature.
22438
22439 @item -mrelax
22440 @opindex mrelax
22441 Guide linker to relax instructions.
22442
22443 @end table
22444
22445 @node Nios II Options
22446 @subsection Nios II Options
22447 @cindex Nios II options
22448 @cindex Altera Nios II options
22449
22450 These are the options defined for the Altera Nios II processor.
22451
22452 @table @gcctabopt
22453
22454 @item -G @var{num}
22455 @opindex G
22456 @cindex smaller data references
22457 Put global and static objects less than or equal to @var{num} bytes
22458 into the small data or BSS sections instead of the normal data or BSS
22459 sections. The default value of @var{num} is 8.
22460
22461 @item -mgpopt=@var{option}
22462 @itemx -mgpopt
22463 @itemx -mno-gpopt
22464 @opindex mgpopt
22465 @opindex mno-gpopt
22466 Generate (do not generate) GP-relative accesses. The following
22467 @var{option} names are recognized:
22468
22469 @table @samp
22470
22471 @item none
22472 Do not generate GP-relative accesses.
22473
22474 @item local
22475 Generate GP-relative accesses for small data objects that are not
22476 external, weak, or uninitialized common symbols.
22477 Also use GP-relative addressing for objects that
22478 have been explicitly placed in a small data section via a @code{section}
22479 attribute.
22480
22481 @item global
22482 As for @samp{local}, but also generate GP-relative accesses for
22483 small data objects that are external, weak, or common. If you use this option,
22484 you must ensure that all parts of your program (including libraries) are
22485 compiled with the same @option{-G} setting.
22486
22487 @item data
22488 Generate GP-relative accesses for all data objects in the program. If you
22489 use this option, the entire data and BSS segments
22490 of your program must fit in 64K of memory and you must use an appropriate
22491 linker script to allocate them within the addressable range of the
22492 global pointer.
22493
22494 @item all
22495 Generate GP-relative addresses for function pointers as well as data
22496 pointers. If you use this option, the entire text, data, and BSS segments
22497 of your program must fit in 64K of memory and you must use an appropriate
22498 linker script to allocate them within the addressable range of the
22499 global pointer.
22500
22501 @end table
22502
22503 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
22504 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
22505
22506 The default is @option{-mgpopt} except when @option{-fpic} or
22507 @option{-fPIC} is specified to generate position-independent code.
22508 Note that the Nios II ABI does not permit GP-relative accesses from
22509 shared libraries.
22510
22511 You may need to specify @option{-mno-gpopt} explicitly when building
22512 programs that include large amounts of small data, including large
22513 GOT data sections. In this case, the 16-bit offset for GP-relative
22514 addressing may not be large enough to allow access to the entire
22515 small data section.
22516
22517 @item -mgprel-sec=@var{regexp}
22518 @opindex mgprel-sec
22519 This option specifies additional section names that can be accessed via
22520 GP-relative addressing. It is most useful in conjunction with
22521 @code{section} attributes on variable declarations
22522 (@pxref{Common Variable Attributes}) and a custom linker script.
22523 The @var{regexp} is a POSIX Extended Regular Expression.
22524
22525 This option does not affect the behavior of the @option{-G} option, and
22526 the specified sections are in addition to the standard @code{.sdata}
22527 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
22528
22529 @item -mr0rel-sec=@var{regexp}
22530 @opindex mr0rel-sec
22531 This option specifies names of sections that can be accessed via a
22532 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
22533 of the 32-bit address space. It is most useful in conjunction with
22534 @code{section} attributes on variable declarations
22535 (@pxref{Common Variable Attributes}) and a custom linker script.
22536 The @var{regexp} is a POSIX Extended Regular Expression.
22537
22538 In contrast to the use of GP-relative addressing for small data,
22539 zero-based addressing is never generated by default and there are no
22540 conventional section names used in standard linker scripts for sections
22541 in the low or high areas of memory.
22542
22543 @item -mel
22544 @itemx -meb
22545 @opindex mel
22546 @opindex meb
22547 Generate little-endian (default) or big-endian (experimental) code,
22548 respectively.
22549
22550 @item -march=@var{arch}
22551 @opindex march
22552 This specifies the name of the target Nios II architecture. GCC uses this
22553 name to determine what kind of instructions it can emit when generating
22554 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
22555
22556 The preprocessor macro @code{__nios2_arch__} is available to programs,
22557 with value 1 or 2, indicating the targeted ISA level.
22558
22559 @item -mbypass-cache
22560 @itemx -mno-bypass-cache
22561 @opindex mno-bypass-cache
22562 @opindex mbypass-cache
22563 Force all load and store instructions to always bypass cache by
22564 using I/O variants of the instructions. The default is not to
22565 bypass the cache.
22566
22567 @item -mno-cache-volatile
22568 @itemx -mcache-volatile
22569 @opindex mcache-volatile
22570 @opindex mno-cache-volatile
22571 Volatile memory access bypass the cache using the I/O variants of
22572 the load and store instructions. The default is not to bypass the cache.
22573
22574 @item -mno-fast-sw-div
22575 @itemx -mfast-sw-div
22576 @opindex mno-fast-sw-div
22577 @opindex mfast-sw-div
22578 Do not use table-based fast divide for small numbers. The default
22579 is to use the fast divide at @option{-O3} and above.
22580
22581 @item -mno-hw-mul
22582 @itemx -mhw-mul
22583 @itemx -mno-hw-mulx
22584 @itemx -mhw-mulx
22585 @itemx -mno-hw-div
22586 @itemx -mhw-div
22587 @opindex mno-hw-mul
22588 @opindex mhw-mul
22589 @opindex mno-hw-mulx
22590 @opindex mhw-mulx
22591 @opindex mno-hw-div
22592 @opindex mhw-div
22593 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
22594 instructions by the compiler. The default is to emit @code{mul}
22595 and not emit @code{div} and @code{mulx}.
22596
22597 @item -mbmx
22598 @itemx -mno-bmx
22599 @itemx -mcdx
22600 @itemx -mno-cdx
22601 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
22602 CDX (code density) instructions. Enabling these instructions also
22603 requires @option{-march=r2}. Since these instructions are optional
22604 extensions to the R2 architecture, the default is not to emit them.
22605
22606 @item -mcustom-@var{insn}=@var{N}
22607 @itemx -mno-custom-@var{insn}
22608 @opindex mcustom-@var{insn}
22609 @opindex mno-custom-@var{insn}
22610 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
22611 custom instruction with encoding @var{N} when generating code that uses
22612 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
22613 instruction 253 for single-precision floating-point add operations instead
22614 of the default behavior of using a library call.
22615
22616 The following values of @var{insn} are supported. Except as otherwise
22617 noted, floating-point operations are expected to be implemented with
22618 normal IEEE 754 semantics and correspond directly to the C operators or the
22619 equivalent GCC built-in functions (@pxref{Other Builtins}).
22620
22621 Single-precision floating point:
22622 @table @asis
22623
22624 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
22625 Binary arithmetic operations.
22626
22627 @item @samp{fnegs}
22628 Unary negation.
22629
22630 @item @samp{fabss}
22631 Unary absolute value.
22632
22633 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
22634 Comparison operations.
22635
22636 @item @samp{fmins}, @samp{fmaxs}
22637 Floating-point minimum and maximum. These instructions are only
22638 generated if @option{-ffinite-math-only} is specified.
22639
22640 @item @samp{fsqrts}
22641 Unary square root operation.
22642
22643 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
22644 Floating-point trigonometric and exponential functions. These instructions
22645 are only generated if @option{-funsafe-math-optimizations} is also specified.
22646
22647 @end table
22648
22649 Double-precision floating point:
22650 @table @asis
22651
22652 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
22653 Binary arithmetic operations.
22654
22655 @item @samp{fnegd}
22656 Unary negation.
22657
22658 @item @samp{fabsd}
22659 Unary absolute value.
22660
22661 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
22662 Comparison operations.
22663
22664 @item @samp{fmind}, @samp{fmaxd}
22665 Double-precision minimum and maximum. These instructions are only
22666 generated if @option{-ffinite-math-only} is specified.
22667
22668 @item @samp{fsqrtd}
22669 Unary square root operation.
22670
22671 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
22672 Double-precision trigonometric and exponential functions. These instructions
22673 are only generated if @option{-funsafe-math-optimizations} is also specified.
22674
22675 @end table
22676
22677 Conversions:
22678 @table @asis
22679 @item @samp{fextsd}
22680 Conversion from single precision to double precision.
22681
22682 @item @samp{ftruncds}
22683 Conversion from double precision to single precision.
22684
22685 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
22686 Conversion from floating point to signed or unsigned integer types, with
22687 truncation towards zero.
22688
22689 @item @samp{round}
22690 Conversion from single-precision floating point to signed integer,
22691 rounding to the nearest integer and ties away from zero.
22692 This corresponds to the @code{__builtin_lroundf} function when
22693 @option{-fno-math-errno} is used.
22694
22695 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
22696 Conversion from signed or unsigned integer types to floating-point types.
22697
22698 @end table
22699
22700 In addition, all of the following transfer instructions for internal
22701 registers X and Y must be provided to use any of the double-precision
22702 floating-point instructions. Custom instructions taking two
22703 double-precision source operands expect the first operand in the
22704 64-bit register X. The other operand (or only operand of a unary
22705 operation) is given to the custom arithmetic instruction with the
22706 least significant half in source register @var{src1} and the most
22707 significant half in @var{src2}. A custom instruction that returns a
22708 double-precision result returns the most significant 32 bits in the
22709 destination register and the other half in 32-bit register Y.
22710 GCC automatically generates the necessary code sequences to write
22711 register X and/or read register Y when double-precision floating-point
22712 instructions are used.
22713
22714 @table @asis
22715
22716 @item @samp{fwrx}
22717 Write @var{src1} into the least significant half of X and @var{src2} into
22718 the most significant half of X.
22719
22720 @item @samp{fwry}
22721 Write @var{src1} into Y.
22722
22723 @item @samp{frdxhi}, @samp{frdxlo}
22724 Read the most or least (respectively) significant half of X and store it in
22725 @var{dest}.
22726
22727 @item @samp{frdy}
22728 Read the value of Y and store it into @var{dest}.
22729 @end table
22730
22731 Note that you can gain more local control over generation of Nios II custom
22732 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
22733 and @code{target("no-custom-@var{insn}")} function attributes
22734 (@pxref{Function Attributes})
22735 or pragmas (@pxref{Function Specific Option Pragmas}).
22736
22737 @item -mcustom-fpu-cfg=@var{name}
22738 @opindex mcustom-fpu-cfg
22739
22740 This option enables a predefined, named set of custom instruction encodings
22741 (see @option{-mcustom-@var{insn}} above).
22742 Currently, the following sets are defined:
22743
22744 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
22745 @gccoptlist{-mcustom-fmuls=252 @gol
22746 -mcustom-fadds=253 @gol
22747 -mcustom-fsubs=254 @gol
22748 -fsingle-precision-constant}
22749
22750 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
22751 @gccoptlist{-mcustom-fmuls=252 @gol
22752 -mcustom-fadds=253 @gol
22753 -mcustom-fsubs=254 @gol
22754 -mcustom-fdivs=255 @gol
22755 -fsingle-precision-constant}
22756
22757 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
22758 @gccoptlist{-mcustom-floatus=243 @gol
22759 -mcustom-fixsi=244 @gol
22760 -mcustom-floatis=245 @gol
22761 -mcustom-fcmpgts=246 @gol
22762 -mcustom-fcmples=249 @gol
22763 -mcustom-fcmpeqs=250 @gol
22764 -mcustom-fcmpnes=251 @gol
22765 -mcustom-fmuls=252 @gol
22766 -mcustom-fadds=253 @gol
22767 -mcustom-fsubs=254 @gol
22768 -mcustom-fdivs=255 @gol
22769 -fsingle-precision-constant}
22770
22771 Custom instruction assignments given by individual
22772 @option{-mcustom-@var{insn}=} options override those given by
22773 @option{-mcustom-fpu-cfg=}, regardless of the
22774 order of the options on the command line.
22775
22776 Note that you can gain more local control over selection of a FPU
22777 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
22778 function attribute (@pxref{Function Attributes})
22779 or pragma (@pxref{Function Specific Option Pragmas}).
22780
22781 @end table
22782
22783 These additional @samp{-m} options are available for the Altera Nios II
22784 ELF (bare-metal) target:
22785
22786 @table @gcctabopt
22787
22788 @item -mhal
22789 @opindex mhal
22790 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
22791 startup and termination code, and is typically used in conjunction with
22792 @option{-msys-crt0=} to specify the location of the alternate startup code
22793 provided by the HAL BSP.
22794
22795 @item -msmallc
22796 @opindex msmallc
22797 Link with a limited version of the C library, @option{-lsmallc}, rather than
22798 Newlib.
22799
22800 @item -msys-crt0=@var{startfile}
22801 @opindex msys-crt0
22802 @var{startfile} is the file name of the startfile (crt0) to use
22803 when linking. This option is only useful in conjunction with @option{-mhal}.
22804
22805 @item -msys-lib=@var{systemlib}
22806 @opindex msys-lib
22807 @var{systemlib} is the library name of the library that provides
22808 low-level system calls required by the C library,
22809 e.g.@: @code{read} and @code{write}.
22810 This option is typically used to link with a library provided by a HAL BSP.
22811
22812 @end table
22813
22814 @node Nvidia PTX Options
22815 @subsection Nvidia PTX Options
22816 @cindex Nvidia PTX options
22817 @cindex nvptx options
22818
22819 These options are defined for Nvidia PTX:
22820
22821 @table @gcctabopt
22822
22823 @item -m32
22824 @itemx -m64
22825 @opindex m32
22826 @opindex m64
22827 Generate code for 32-bit or 64-bit ABI.
22828
22829 @item -misa=@var{ISA-string}
22830 @opindex march
22831 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
22832 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
22833 @samp{sm_35}. The default ISA is sm_30.
22834
22835 @item -mmainkernel
22836 @opindex mmainkernel
22837 Link in code for a __main kernel. This is for stand-alone instead of
22838 offloading execution.
22839
22840 @item -moptimize
22841 @opindex moptimize
22842 Apply partitioned execution optimizations. This is the default when any
22843 level of optimization is selected.
22844
22845 @item -msoft-stack
22846 @opindex msoft-stack
22847 Generate code that does not use @code{.local} memory
22848 directly for stack storage. Instead, a per-warp stack pointer is
22849 maintained explicitly. This enables variable-length stack allocation (with
22850 variable-length arrays or @code{alloca}), and when global memory is used for
22851 underlying storage, makes it possible to access automatic variables from other
22852 threads, or with atomic instructions. This code generation variant is used
22853 for OpenMP offloading, but the option is exposed on its own for the purpose
22854 of testing the compiler; to generate code suitable for linking into programs
22855 using OpenMP offloading, use option @option{-mgomp}.
22856
22857 @item -muniform-simt
22858 @opindex muniform-simt
22859 Switch to code generation variant that allows to execute all threads in each
22860 warp, while maintaining memory state and side effects as if only one thread
22861 in each warp was active outside of OpenMP SIMD regions. All atomic operations
22862 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
22863 current lane index equals the master lane index), and the register being
22864 assigned is copied via a shuffle instruction from the master lane. Outside of
22865 SIMD regions lane 0 is the master; inside, each thread sees itself as the
22866 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
22867 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
22868 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
22869 with current lane index to compute the master lane index.
22870
22871 @item -mgomp
22872 @opindex mgomp
22873 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
22874 @option{-muniform-simt} options, and selects corresponding multilib variant.
22875
22876 @end table
22877
22878 @node OpenRISC Options
22879 @subsection OpenRISC Options
22880 @cindex OpenRISC Options
22881
22882 These options are defined for OpenRISC:
22883
22884 @table @gcctabopt
22885
22886 @item -mboard=@var{name}
22887 @opindex mboard
22888 Configure a board specific runtime. This will be passed to the linker for
22889 newlib board library linking. The default is @code{or1ksim}.
22890
22891 @item -mnewlib
22892 @opindex mnewlib
22893 For compatibility, it's always newlib for elf now.
22894
22895 @item -mhard-div
22896 @opindex mhard-div
22897 Generate code for hardware which supports divide instructions. This is the
22898 default.
22899
22900 @item -mhard-mul
22901 @opindex mhard-mul
22902 Generate code for hardware which supports multiply instructions. This is the
22903 default.
22904
22905 @item -mcmov
22906 @opindex mcmov
22907 Generate code for hardware which supports the conditional move (@code{l.cmov})
22908 instruction.
22909
22910 @item -mror
22911 @opindex mror
22912 Generate code for hardware which supports rotate right instructions.
22913
22914 @item -msext
22915 @opindex msext
22916 Generate code for hardware which supports sign-extension instructions.
22917
22918 @item -msfimm
22919 @opindex msfimm
22920 Generate code for hardware which supports set flag immediate (@code{l.sf*i})
22921 instructions.
22922
22923 @item -mshftimm
22924 @opindex mshftimm
22925 Generate code for hardware which supports shift immediate related instructions
22926 (i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to
22927 enable generation of the @code{l.rori} instruction the @option{-mror} flag must
22928 also be specified.
22929
22930 @item -msoft-div
22931 @opindex msoft-div
22932 Generate code for hardware which requires divide instruction emulation.
22933
22934 @item -msoft-mul
22935 @opindex msoft-mul
22936 Generate code for hardware which requires multiply instruction emulation.
22937
22938 @end table
22939
22940 @node PDP-11 Options
22941 @subsection PDP-11 Options
22942 @cindex PDP-11 Options
22943
22944 These options are defined for the PDP-11:
22945
22946 @table @gcctabopt
22947 @item -mfpu
22948 @opindex mfpu
22949 Use hardware FPP floating point. This is the default. (FIS floating
22950 point on the PDP-11/40 is not supported.) Implies -m45.
22951
22952 @item -msoft-float
22953 @opindex msoft-float
22954 Do not use hardware floating point.
22955
22956 @item -mac0
22957 @opindex mac0
22958 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
22959
22960 @item -mno-ac0
22961 @opindex mno-ac0
22962 Return floating-point results in memory. This is the default.
22963
22964 @item -m40
22965 @opindex m40
22966 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
22967
22968 @item -m45
22969 @opindex m45
22970 Generate code for a PDP-11/45. This is the default.
22971
22972 @item -m10
22973 @opindex m10
22974 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
22975
22976 @item -mint16
22977 @itemx -mno-int32
22978 @opindex mint16
22979 @opindex mno-int32
22980 Use 16-bit @code{int}. This is the default.
22981
22982 @item -mint32
22983 @itemx -mno-int16
22984 @opindex mint32
22985 @opindex mno-int16
22986 Use 32-bit @code{int}.
22987
22988 @item -msplit
22989 @opindex msplit
22990 Target has split instruction and data space. Implies -m45.
22991
22992 @item -munix-asm
22993 @opindex munix-asm
22994 Use Unix assembler syntax.
22995
22996 @item -mdec-asm
22997 @opindex mdec-asm
22998 Use DEC assembler syntax.
22999
23000 @item -mgnu-asm
23001 @opindex mgnu-asm
23002 Use GNU assembler syntax. This is the default.
23003
23004 @item -mlra
23005 @opindex mlra
23006 Use the new LRA register allocator. By default, the old ``reload''
23007 allocator is used.
23008 @end table
23009
23010 @node picoChip Options
23011 @subsection picoChip Options
23012 @cindex picoChip options
23013
23014 These @samp{-m} options are defined for picoChip implementations:
23015
23016 @table @gcctabopt
23017
23018 @item -mae=@var{ae_type}
23019 @opindex mcpu
23020 Set the instruction set, register set, and instruction scheduling
23021 parameters for array element type @var{ae_type}. Supported values
23022 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23023
23024 @option{-mae=ANY} selects a completely generic AE type. Code
23025 generated with this option runs on any of the other AE types. The
23026 code is not as efficient as it would be if compiled for a specific
23027 AE type, and some types of operation (e.g., multiplication) do not
23028 work properly on all types of AE.
23029
23030 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23031 for compiled code, and is the default.
23032
23033 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23034 option may suffer from poor performance of byte (char) manipulation,
23035 since the DSP AE does not provide hardware support for byte load/stores.
23036
23037 @item -msymbol-as-address
23038 Enable the compiler to directly use a symbol name as an address in a
23039 load/store instruction, without first loading it into a
23040 register. Typically, the use of this option generates larger
23041 programs, which run faster than when the option isn't used. However, the
23042 results vary from program to program, so it is left as a user option,
23043 rather than being permanently enabled.
23044
23045 @item -mno-inefficient-warnings
23046 Disables warnings about the generation of inefficient code. These
23047 warnings can be generated, for example, when compiling code that
23048 performs byte-level memory operations on the MAC AE type. The MAC AE has
23049 no hardware support for byte-level memory operations, so all byte
23050 load/stores must be synthesized from word load/store operations. This is
23051 inefficient and a warning is generated to indicate
23052 that you should rewrite the code to avoid byte operations, or to target
23053 an AE type that has the necessary hardware support. This option disables
23054 these warnings.
23055
23056 @end table
23057
23058 @node PowerPC Options
23059 @subsection PowerPC Options
23060 @cindex PowerPC options
23061
23062 These are listed under @xref{RS/6000 and PowerPC Options}.
23063
23064 @node PowerPC SPE Options
23065 @subsection PowerPC SPE Options
23066 @cindex PowerPC SPE options
23067
23068 These @samp{-m} options are defined for PowerPC SPE:
23069 @table @gcctabopt
23070 @item -mmfcrf
23071 @itemx -mno-mfcrf
23072 @itemx -mpopcntb
23073 @itemx -mno-popcntb
23074 @opindex mmfcrf
23075 @opindex mno-mfcrf
23076 @opindex mpopcntb
23077 @opindex mno-popcntb
23078 You use these options to specify which instructions are available on the
23079 processor you are using. The default value of these options is
23080 determined when configuring GCC@. Specifying the
23081 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23082 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23083 rather than the options listed above.
23084
23085 The @option{-mmfcrf} option allows GCC to generate the move from
23086 condition register field instruction implemented on the POWER4
23087 processor and other processors that support the PowerPC V2.01
23088 architecture.
23089 The @option{-mpopcntb} option allows GCC to generate the popcount and
23090 double-precision FP reciprocal estimate instruction implemented on the
23091 POWER5 processor and other processors that support the PowerPC V2.02
23092 architecture.
23093
23094 @item -mcpu=@var{cpu_type}
23095 @opindex mcpu
23096 Set architecture type, register usage, and
23097 instruction scheduling parameters for machine type @var{cpu_type}.
23098 Supported values for @var{cpu_type} are @samp{8540}, @samp{8548},
23099 and @samp{native}.
23100
23101 @option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either
23102 endian), with an appropriate, generic processor model assumed for
23103 scheduling purposes.
23104
23105 Specifying @samp{native} as cpu type detects and selects the
23106 architecture option that corresponds to the host processor of the
23107 system performing the compilation.
23108 @option{-mcpu=native} has no effect if GCC does not recognize the
23109 processor.
23110
23111 The other options specify a specific processor. Code generated under
23112 those options runs best on that processor, and may not run at all on
23113 others.
23114
23115 The @option{-mcpu} options automatically enable or disable the
23116 following options:
23117
23118 @gccoptlist{-mhard-float -mmfcrf -mmultiple @gol
23119 -mpopcntb -mpopcntd @gol
23120 -msingle-float -mdouble-float @gol
23121 -mfloat128}
23122
23123 The particular options set for any particular CPU varies between
23124 compiler versions, depending on what setting seems to produce optimal
23125 code for that CPU; it doesn't necessarily reflect the actual hardware's
23126 capabilities. If you wish to set an individual option to a particular
23127 value, you may specify it after the @option{-mcpu} option, like
23128 @option{-mcpu=8548}.
23129
23130 @item -mtune=@var{cpu_type}
23131 @opindex mtune
23132 Set the instruction scheduling parameters for machine type
23133 @var{cpu_type}, but do not set the architecture type or register usage,
23134 as @option{-mcpu=@var{cpu_type}} does. The same
23135 values for @var{cpu_type} are used for @option{-mtune} as for
23136 @option{-mcpu}. If both are specified, the code generated uses the
23137 architecture and registers set by @option{-mcpu}, but the
23138 scheduling parameters set by @option{-mtune}.
23139
23140 @item -msecure-plt
23141 @opindex msecure-plt
23142 Generate code that allows @command{ld} and @command{ld.so}
23143 to build executables and shared
23144 libraries with non-executable @code{.plt} and @code{.got} sections.
23145 This is a PowerPC
23146 32-bit SYSV ABI option.
23147
23148 @item -mbss-plt
23149 @opindex mbss-plt
23150 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
23151 fills in, and
23152 requires @code{.plt} and @code{.got}
23153 sections that are both writable and executable.
23154 This is a PowerPC 32-bit SYSV ABI option.
23155
23156 @item -misel
23157 @itemx -mno-isel
23158 @opindex misel
23159 @opindex mno-isel
23160 This switch enables or disables the generation of ISEL instructions.
23161
23162 @item -misel=@var{yes/no}
23163 This switch has been deprecated. Use @option{-misel} and
23164 @option{-mno-isel} instead.
23165
23166 @item -mspe
23167 @itemx -mno-spe
23168 @opindex mspe
23169 @opindex mno-spe
23170 This switch enables or disables the generation of SPE simd
23171 instructions.
23172
23173 @item -mspe=@var{yes/no}
23174 This option has been deprecated. Use @option{-mspe} and
23175 @option{-mno-spe} instead.
23176
23177 @item -mfloat128
23178 @itemx -mno-float128
23179 @opindex mfloat128
23180 @opindex mno-float128
23181 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
23182 and use either software emulation for IEEE 128-bit floating point or
23183 hardware instructions.
23184
23185 @item -mfloat-gprs=@var{yes/single/double/no}
23186 @itemx -mfloat-gprs
23187 @opindex mfloat-gprs
23188 This switch enables or disables the generation of floating-point
23189 operations on the general-purpose registers for architectures that
23190 support it.
23191
23192 The argument @samp{yes} or @samp{single} enables the use of
23193 single-precision floating-point operations.
23194
23195 The argument @samp{double} enables the use of single and
23196 double-precision floating-point operations.
23197
23198 The argument @samp{no} disables floating-point operations on the
23199 general-purpose registers.
23200
23201 This option is currently only available on the MPC854x.
23202
23203 @item -mfull-toc
23204 @itemx -mno-fp-in-toc
23205 @itemx -mno-sum-in-toc
23206 @itemx -mminimal-toc
23207 @opindex mfull-toc
23208 @opindex mno-fp-in-toc
23209 @opindex mno-sum-in-toc
23210 @opindex mminimal-toc
23211 Modify generation of the TOC (Table Of Contents), which is created for
23212 every executable file. The @option{-mfull-toc} option is selected by
23213 default. In that case, GCC allocates at least one TOC entry for
23214 each unique non-automatic variable reference in your program. GCC
23215 also places floating-point constants in the TOC@. However, only
23216 16,384 entries are available in the TOC@.
23217
23218 If you receive a linker error message that saying you have overflowed
23219 the available TOC space, you can reduce the amount of TOC space used
23220 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
23221 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
23222 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
23223 generate code to calculate the sum of an address and a constant at
23224 run time instead of putting that sum into the TOC@. You may specify one
23225 or both of these options. Each causes GCC to produce very slightly
23226 slower and larger code at the expense of conserving TOC space.
23227
23228 If you still run out of space in the TOC even when you specify both of
23229 these options, specify @option{-mminimal-toc} instead. This option causes
23230 GCC to make only one TOC entry for every file. When you specify this
23231 option, GCC produces code that is slower and larger but which
23232 uses extremely little TOC space. You may wish to use this option
23233 only on files that contain less frequently-executed code.
23234
23235 @item -maix32
23236 @opindex maix32
23237 Disables the 64-bit ABI. GCC defaults to @option{-maix32}.
23238
23239 @item -mxl-compat
23240 @itemx -mno-xl-compat
23241 @opindex mxl-compat
23242 @opindex mno-xl-compat
23243 Produce code that conforms more closely to IBM XL compiler semantics
23244 when using AIX-compatible ABI@. Pass floating-point arguments to
23245 prototyped functions beyond the register save area (RSA) on the stack
23246 in addition to argument FPRs. Do not assume that most significant
23247 double in 128-bit long double value is properly rounded when comparing
23248 values and converting to double. Use XL symbol names for long double
23249 support routines.
23250
23251 The AIX calling convention was extended but not initially documented to
23252 handle an obscure K&R C case of calling a function that takes the
23253 address of its arguments with fewer arguments than declared. IBM XL
23254 compilers access floating-point arguments that do not fit in the
23255 RSA from the stack when a subroutine is compiled without
23256 optimization. Because always storing floating-point arguments on the
23257 stack is inefficient and rarely needed, this option is not enabled by
23258 default and only is necessary when calling subroutines compiled by IBM
23259 XL compilers without optimization.
23260
23261 @item -malign-natural
23262 @itemx -malign-power
23263 @opindex malign-natural
23264 @opindex malign-power
23265 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23266 @option{-malign-natural} overrides the ABI-defined alignment of larger
23267 types, such as floating-point doubles, on their natural size-based boundary.
23268 The option @option{-malign-power} instructs GCC to follow the ABI-specified
23269 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
23270
23271 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
23272 is not supported.
23273
23274 @item -msoft-float
23275 @itemx -mhard-float
23276 @opindex msoft-float
23277 @opindex mhard-float
23278 Generate code that does not use (uses) the floating-point register set.
23279 Software floating-point emulation is provided if you use the
23280 @option{-msoft-float} option, and pass the option to GCC when linking.
23281
23282 @item -msingle-float
23283 @itemx -mdouble-float
23284 @opindex msingle-float
23285 @opindex mdouble-float
23286 Generate code for single- or double-precision floating-point operations.
23287 @option{-mdouble-float} implies @option{-msingle-float}.
23288
23289 @item -mmultiple
23290 @itemx -mno-multiple
23291 @opindex mmultiple
23292 @opindex mno-multiple
23293 Generate code that uses (does not use) the load multiple word
23294 instructions and the store multiple word instructions. These
23295 instructions are generated by default on POWER systems, and not
23296 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
23297 PowerPC systems, since those instructions do not work when the
23298 processor is in little-endian mode. The exceptions are PPC740 and
23299 PPC750 which permit these instructions in little-endian mode.
23300
23301 @item -mupdate
23302 @itemx -mno-update
23303 @opindex mupdate
23304 @opindex mno-update
23305 Generate code that uses (does not use) the load or store instructions
23306 that update the base register to the address of the calculated memory
23307 location. These instructions are generated by default. If you use
23308 @option{-mno-update}, there is a small window between the time that the
23309 stack pointer is updated and the address of the previous frame is
23310 stored, which means code that walks the stack frame across interrupts or
23311 signals may get corrupted data.
23312
23313 @item -mavoid-indexed-addresses
23314 @itemx -mno-avoid-indexed-addresses
23315 @opindex mavoid-indexed-addresses
23316 @opindex mno-avoid-indexed-addresses
23317 Generate code that tries to avoid (not avoid) the use of indexed load
23318 or store instructions. These instructions can incur a performance
23319 penalty on Power6 processors in certain situations, such as when
23320 stepping through large arrays that cross a 16M boundary. This option
23321 is enabled by default when targeting Power6 and disabled otherwise.
23322
23323 @item -mfused-madd
23324 @itemx -mno-fused-madd
23325 @opindex mfused-madd
23326 @opindex mno-fused-madd
23327 Generate code that uses (does not use) the floating-point multiply and
23328 accumulate instructions. These instructions are generated by default
23329 if hardware floating point is used. The machine-dependent
23330 @option{-mfused-madd} option is now mapped to the machine-independent
23331 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23332 mapped to @option{-ffp-contract=off}.
23333
23334 @item -mno-strict-align
23335 @itemx -mstrict-align
23336 @opindex mno-strict-align
23337 @opindex mstrict-align
23338 On System V.4 and embedded PowerPC systems do not (do) assume that
23339 unaligned memory references are handled by the system.
23340
23341 @item -mrelocatable
23342 @itemx -mno-relocatable
23343 @opindex mrelocatable
23344 @opindex mno-relocatable
23345 Generate code that allows (does not allow) a static executable to be
23346 relocated to a different address at run time. A simple embedded
23347 PowerPC system loader should relocate the entire contents of
23348 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
23349 a table of 32-bit addresses generated by this option. For this to
23350 work, all objects linked together must be compiled with
23351 @option{-mrelocatable} or @option{-mrelocatable-lib}.
23352 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
23353
23354 @item -mrelocatable-lib
23355 @itemx -mno-relocatable-lib
23356 @opindex mrelocatable-lib
23357 @opindex mno-relocatable-lib
23358 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
23359 @code{.fixup} section to allow static executables to be relocated at
23360 run time, but @option{-mrelocatable-lib} does not use the smaller stack
23361 alignment of @option{-mrelocatable}. Objects compiled with
23362 @option{-mrelocatable-lib} may be linked with objects compiled with
23363 any combination of the @option{-mrelocatable} options.
23364
23365 @item -mno-toc
23366 @itemx -mtoc
23367 @opindex mno-toc
23368 @opindex mtoc
23369 On System V.4 and embedded PowerPC systems do not (do) assume that
23370 register 2 contains a pointer to a global area pointing to the addresses
23371 used in the program.
23372
23373 @item -mlittle
23374 @itemx -mlittle-endian
23375 @opindex mlittle
23376 @opindex mlittle-endian
23377 On System V.4 and embedded PowerPC systems compile code for the
23378 processor in little-endian mode. The @option{-mlittle-endian} option is
23379 the same as @option{-mlittle}.
23380
23381 @item -mbig
23382 @itemx -mbig-endian
23383 @opindex mbig
23384 @opindex mbig-endian
23385 On System V.4 and embedded PowerPC systems compile code for the
23386 processor in big-endian mode. The @option{-mbig-endian} option is
23387 the same as @option{-mbig}.
23388
23389 @item -mdynamic-no-pic
23390 @opindex mdynamic-no-pic
23391 On Darwin and Mac OS X systems, compile code so that it is not
23392 relocatable, but that its external references are relocatable. The
23393 resulting code is suitable for applications, but not shared
23394 libraries.
23395
23396 @item -msingle-pic-base
23397 @opindex msingle-pic-base
23398 Treat the register used for PIC addressing as read-only, rather than
23399 loading it in the prologue for each function. The runtime system is
23400 responsible for initializing this register with an appropriate value
23401 before execution begins.
23402
23403 @item -mprioritize-restricted-insns=@var{priority}
23404 @opindex mprioritize-restricted-insns
23405 This option controls the priority that is assigned to
23406 dispatch-slot restricted instructions during the second scheduling
23407 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
23408 or @samp{2} to assign no, highest, or second-highest (respectively)
23409 priority to dispatch-slot restricted
23410 instructions.
23411
23412 @item -msched-costly-dep=@var{dependence_type}
23413 @opindex msched-costly-dep
23414 This option controls which dependences are considered costly
23415 by the target during instruction scheduling. The argument
23416 @var{dependence_type} takes one of the following values:
23417
23418 @table @asis
23419 @item @samp{no}
23420 No dependence is costly.
23421
23422 @item @samp{all}
23423 All dependences are costly.
23424
23425 @item @samp{true_store_to_load}
23426 A true dependence from store to load is costly.
23427
23428 @item @samp{store_to_load}
23429 Any dependence from store to load is costly.
23430
23431 @item @var{number}
23432 Any dependence for which the latency is greater than or equal to
23433 @var{number} is costly.
23434 @end table
23435
23436 @item -minsert-sched-nops=@var{scheme}
23437 @opindex minsert-sched-nops
23438 This option controls which NOP insertion scheme is used during
23439 the second scheduling pass. The argument @var{scheme} takes one of the
23440 following values:
23441
23442 @table @asis
23443 @item @samp{no}
23444 Don't insert NOPs.
23445
23446 @item @samp{pad}
23447 Pad with NOPs any dispatch group that has vacant issue slots,
23448 according to the scheduler's grouping.
23449
23450 @item @samp{regroup_exact}
23451 Insert NOPs to force costly dependent insns into
23452 separate groups. Insert exactly as many NOPs as needed to force an insn
23453 to a new group, according to the estimated processor grouping.
23454
23455 @item @var{number}
23456 Insert NOPs to force costly dependent insns into
23457 separate groups. Insert @var{number} NOPs to force an insn to a new group.
23458 @end table
23459
23460 @item -mcall-sysv
23461 @opindex mcall-sysv
23462 On System V.4 and embedded PowerPC systems compile code using calling
23463 conventions that adhere to the March 1995 draft of the System V
23464 Application Binary Interface, PowerPC processor supplement. This is the
23465 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
23466
23467 @item -mcall-sysv-eabi
23468 @itemx -mcall-eabi
23469 @opindex mcall-sysv-eabi
23470 @opindex mcall-eabi
23471 Specify both @option{-mcall-sysv} and @option{-meabi} options.
23472
23473 @item -mcall-sysv-noeabi
23474 @opindex mcall-sysv-noeabi
23475 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
23476
23477 @item -mcall-aixdesc
23478 @opindex m
23479 On System V.4 and embedded PowerPC systems compile code for the AIX
23480 operating system.
23481
23482 @item -mcall-linux
23483 @opindex mcall-linux
23484 On System V.4 and embedded PowerPC systems compile code for the
23485 Linux-based GNU system.
23486
23487 @item -mcall-freebsd
23488 @opindex mcall-freebsd
23489 On System V.4 and embedded PowerPC systems compile code for the
23490 FreeBSD operating system.
23491
23492 @item -mcall-netbsd
23493 @opindex mcall-netbsd
23494 On System V.4 and embedded PowerPC systems compile code for the
23495 NetBSD operating system.
23496
23497 @item -mcall-openbsd
23498 @opindex mcall-netbsd
23499 On System V.4 and embedded PowerPC systems compile code for the
23500 OpenBSD operating system.
23501
23502 @item -maix-struct-return
23503 @opindex maix-struct-return
23504 Return all structures in memory (as specified by the AIX ABI)@.
23505
23506 @item -msvr4-struct-return
23507 @opindex msvr4-struct-return
23508 Return structures smaller than 8 bytes in registers (as specified by the
23509 SVR4 ABI)@.
23510
23511 @item -mabi=@var{abi-type}
23512 @opindex mabi
23513 Extend the current ABI with a particular extension, or remove such extension.
23514 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
23515 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
23516 @samp{elfv1}, @samp{elfv2}@.
23517
23518 @item -mabi=spe
23519 @opindex mabi=spe
23520 Extend the current ABI with SPE ABI extensions. This does not change
23521 the default ABI, instead it adds the SPE ABI extensions to the current
23522 ABI@.
23523
23524 @item -mabi=no-spe
23525 @opindex mabi=no-spe
23526 Disable Book-E SPE ABI extensions for the current ABI@.
23527
23528 @item -mabi=ibmlongdouble
23529 @opindex mabi=ibmlongdouble
23530 Change the current ABI to use IBM extended-precision long double.
23531 This is not likely to work if your system defaults to using IEEE
23532 extended-precision long double. If you change the long double type
23533 from IEEE extended-precision, the compiler will issue a warning unless
23534 you use the @option{-Wno-psabi} option.
23535
23536 @item -mabi=ieeelongdouble
23537 @opindex mabi=ieeelongdouble
23538 Change the current ABI to use IEEE extended-precision long double.
23539 This is not likely to work if your system defaults to using IBM
23540 extended-precision long double. If you change the long double type
23541 from IBM extended-precision, the compiler will issue a warning unless
23542 you use the @option{-Wno-psabi} option.
23543
23544 @item -mabi=elfv1
23545 @opindex mabi=elfv1
23546 Change the current ABI to use the ELFv1 ABI.
23547 This is the default ABI for big-endian PowerPC 64-bit Linux.
23548 Overriding the default ABI requires special system support and is
23549 likely to fail in spectacular ways.
23550
23551 @item -mabi=elfv2
23552 @opindex mabi=elfv2
23553 Change the current ABI to use the ELFv2 ABI.
23554 This is the default ABI for little-endian PowerPC 64-bit Linux.
23555 Overriding the default ABI requires special system support and is
23556 likely to fail in spectacular ways.
23557
23558 @item -mgnu-attribute
23559 @itemx -mno-gnu-attribute
23560 @opindex mgnu-attribute
23561 @opindex mno-gnu-attribute
23562 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23563 .gnu.attributes section that specify ABI variations in function
23564 parameters or return values.
23565
23566 @item -mprototype
23567 @itemx -mno-prototype
23568 @opindex mprototype
23569 @opindex mno-prototype
23570 On System V.4 and embedded PowerPC systems assume that all calls to
23571 variable argument functions are properly prototyped. Otherwise, the
23572 compiler must insert an instruction before every non-prototyped call to
23573 set or clear bit 6 of the condition code register (@code{CR}) to
23574 indicate whether floating-point values are passed in the floating-point
23575 registers in case the function takes variable arguments. With
23576 @option{-mprototype}, only calls to prototyped variable argument functions
23577 set or clear the bit.
23578
23579 @item -msim
23580 @opindex msim
23581 On embedded PowerPC systems, assume that the startup module is called
23582 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
23583 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
23584 configurations.
23585
23586 @item -mmvme
23587 @opindex mmvme
23588 On embedded PowerPC systems, assume that the startup module is called
23589 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
23590 @file{libc.a}.
23591
23592 @item -mads
23593 @opindex mads
23594 On embedded PowerPC systems, assume that the startup module is called
23595 @file{crt0.o} and the standard C libraries are @file{libads.a} and
23596 @file{libc.a}.
23597
23598 @item -myellowknife
23599 @opindex myellowknife
23600 On embedded PowerPC systems, assume that the startup module is called
23601 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
23602 @file{libc.a}.
23603
23604 @item -mvxworks
23605 @opindex mvxworks
23606 On System V.4 and embedded PowerPC systems, specify that you are
23607 compiling for a VxWorks system.
23608
23609 @item -memb
23610 @opindex memb
23611 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
23612 header to indicate that @samp{eabi} extended relocations are used.
23613
23614 @item -meabi
23615 @itemx -mno-eabi
23616 @opindex meabi
23617 @opindex mno-eabi
23618 On System V.4 and embedded PowerPC systems do (do not) adhere to the
23619 Embedded Applications Binary Interface (EABI), which is a set of
23620 modifications to the System V.4 specifications. Selecting @option{-meabi}
23621 means that the stack is aligned to an 8-byte boundary, a function
23622 @code{__eabi} is called from @code{main} to set up the EABI
23623 environment, and the @option{-msdata} option can use both @code{r2} and
23624 @code{r13} to point to two separate small data areas. Selecting
23625 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
23626 no EABI initialization function is called from @code{main}, and the
23627 @option{-msdata} option only uses @code{r13} to point to a single
23628 small data area. The @option{-meabi} option is on by default if you
23629 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
23630
23631 @item -msdata=eabi
23632 @opindex msdata=eabi
23633 On System V.4 and embedded PowerPC systems, put small initialized
23634 @code{const} global and static data in the @code{.sdata2} section, which
23635 is pointed to by register @code{r2}. Put small initialized
23636 non-@code{const} global and static data in the @code{.sdata} section,
23637 which is pointed to by register @code{r13}. Put small uninitialized
23638 global and static data in the @code{.sbss} section, which is adjacent to
23639 the @code{.sdata} section. The @option{-msdata=eabi} option is
23640 incompatible with the @option{-mrelocatable} option. The
23641 @option{-msdata=eabi} option also sets the @option{-memb} option.
23642
23643 @item -msdata=sysv
23644 @opindex msdata=sysv
23645 On System V.4 and embedded PowerPC systems, put small global and static
23646 data in the @code{.sdata} section, which is pointed to by register
23647 @code{r13}. Put small uninitialized global and static data in the
23648 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
23649 The @option{-msdata=sysv} option is incompatible with the
23650 @option{-mrelocatable} option.
23651
23652 @item -msdata=default
23653 @itemx -msdata
23654 @opindex msdata=default
23655 @opindex msdata
23656 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
23657 compile code the same as @option{-msdata=eabi}, otherwise compile code the
23658 same as @option{-msdata=sysv}.
23659
23660 @item -msdata=data
23661 @opindex msdata=data
23662 On System V.4 and embedded PowerPC systems, put small global
23663 data in the @code{.sdata} section. Put small uninitialized global
23664 data in the @code{.sbss} section. Do not use register @code{r13}
23665 to address small data however. This is the default behavior unless
23666 other @option{-msdata} options are used.
23667
23668 @item -msdata=none
23669 @itemx -mno-sdata
23670 @opindex msdata=none
23671 @opindex mno-sdata
23672 On embedded PowerPC systems, put all initialized global and static data
23673 in the @code{.data} section, and all uninitialized data in the
23674 @code{.bss} section.
23675
23676 @item -mblock-move-inline-limit=@var{num}
23677 @opindex mblock-move-inline-limit
23678 Inline all block moves (such as calls to @code{memcpy} or structure
23679 copies) less than or equal to @var{num} bytes. The minimum value for
23680 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
23681 targets. The default value is target-specific.
23682
23683 @item -G @var{num}
23684 @opindex G
23685 @cindex smaller data references (PowerPC)
23686 @cindex .sdata/.sdata2 references (PowerPC)
23687 On embedded PowerPC systems, put global and static items less than or
23688 equal to @var{num} bytes into the small data or BSS sections instead of
23689 the normal data or BSS section. By default, @var{num} is 8. The
23690 @option{-G @var{num}} switch is also passed to the linker.
23691 All modules should be compiled with the same @option{-G @var{num}} value.
23692
23693 @item -mregnames
23694 @itemx -mno-regnames
23695 @opindex mregnames
23696 @opindex mno-regnames
23697 On System V.4 and embedded PowerPC systems do (do not) emit register
23698 names in the assembly language output using symbolic forms.
23699
23700 @item -mlongcall
23701 @itemx -mno-longcall
23702 @opindex mlongcall
23703 @opindex mno-longcall
23704 By default assume that all calls are far away so that a longer and more
23705 expensive calling sequence is required. This is required for calls
23706 farther than 32 megabytes (33,554,432 bytes) from the current location.
23707 A short call is generated if the compiler knows
23708 the call cannot be that far away. This setting can be overridden by
23709 the @code{shortcall} function attribute, or by @code{#pragma
23710 longcall(0)}.
23711
23712 Some linkers are capable of detecting out-of-range calls and generating
23713 glue code on the fly. On these systems, long calls are unnecessary and
23714 generate slower code. As of this writing, the AIX linker can do this,
23715 as can the GNU linker for PowerPC/64. It is planned to add this feature
23716 to the GNU linker for 32-bit PowerPC systems as well.
23717
23718 In the future, GCC may ignore all longcall specifications
23719 when the linker is known to generate glue.
23720
23721 @item -mtls-markers
23722 @itemx -mno-tls-markers
23723 @opindex mtls-markers
23724 @opindex mno-tls-markers
23725 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
23726 specifying the function argument. The relocation allows the linker to
23727 reliably associate function call with argument setup instructions for
23728 TLS optimization, which in turn allows GCC to better schedule the
23729 sequence.
23730
23731 @item -mrecip
23732 @itemx -mno-recip
23733 @opindex mrecip
23734 This option enables use of the reciprocal estimate and
23735 reciprocal square root estimate instructions with additional
23736 Newton-Raphson steps to increase precision instead of doing a divide or
23737 square root and divide for floating-point arguments. You should use
23738 the @option{-ffast-math} option when using @option{-mrecip} (or at
23739 least @option{-funsafe-math-optimizations},
23740 @option{-ffinite-math-only}, @option{-freciprocal-math} and
23741 @option{-fno-trapping-math}). Note that while the throughput of the
23742 sequence is generally higher than the throughput of the non-reciprocal
23743 instruction, the precision of the sequence can be decreased by up to 2
23744 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
23745 roots.
23746
23747 @item -mrecip=@var{opt}
23748 @opindex mrecip=opt
23749 This option controls which reciprocal estimate instructions
23750 may be used. @var{opt} is a comma-separated list of options, which may
23751 be preceded by a @code{!} to invert the option:
23752
23753 @table @samp
23754
23755 @item all
23756 Enable all estimate instructions.
23757
23758 @item default
23759 Enable the default instructions, equivalent to @option{-mrecip}.
23760
23761 @item none
23762 Disable all estimate instructions, equivalent to @option{-mno-recip}.
23763
23764 @item div
23765 Enable the reciprocal approximation instructions for both
23766 single and double precision.
23767
23768 @item divf
23769 Enable the single-precision reciprocal approximation instructions.
23770
23771 @item divd
23772 Enable the double-precision reciprocal approximation instructions.
23773
23774 @item rsqrt
23775 Enable the reciprocal square root approximation instructions for both
23776 single and double precision.
23777
23778 @item rsqrtf
23779 Enable the single-precision reciprocal square root approximation instructions.
23780
23781 @item rsqrtd
23782 Enable the double-precision reciprocal square root approximation instructions.
23783
23784 @end table
23785
23786 So, for example, @option{-mrecip=all,!rsqrtd} enables
23787 all of the reciprocal estimate instructions, except for the
23788 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
23789 which handle the double-precision reciprocal square root calculations.
23790
23791 @item -mrecip-precision
23792 @itemx -mno-recip-precision
23793 @opindex mrecip-precision
23794 Assume (do not assume) that the reciprocal estimate instructions
23795 provide higher-precision estimates than is mandated by the PowerPC
23796 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
23797 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
23798 The double-precision square root estimate instructions are not generated by
23799 default on low-precision machines, since they do not provide an
23800 estimate that converges after three steps.
23801
23802 @item -mpointers-to-nested-functions
23803 @itemx -mno-pointers-to-nested-functions
23804 @opindex mpointers-to-nested-functions
23805 Generate (do not generate) code to load up the static chain register
23806 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
23807 systems where a function pointer points to a 3-word descriptor giving
23808 the function address, TOC value to be loaded in register @code{r2}, and
23809 static chain value to be loaded in register @code{r11}. The
23810 @option{-mpointers-to-nested-functions} is on by default. You cannot
23811 call through pointers to nested functions or pointers
23812 to functions compiled in other languages that use the static chain if
23813 you use @option{-mno-pointers-to-nested-functions}.
23814
23815 @item -msave-toc-indirect
23816 @itemx -mno-save-toc-indirect
23817 @opindex msave-toc-indirect
23818 Generate (do not generate) code to save the TOC value in the reserved
23819 stack location in the function prologue if the function calls through
23820 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
23821 saved in the prologue, it is saved just before the call through the
23822 pointer. The @option{-mno-save-toc-indirect} option is the default.
23823
23824 @item -mcompat-align-parm
23825 @itemx -mno-compat-align-parm
23826 @opindex mcompat-align-parm
23827 Generate (do not generate) code to pass structure parameters with a
23828 maximum alignment of 64 bits, for compatibility with older versions
23829 of GCC.
23830
23831 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
23832 structure parameter on a 128-bit boundary when that structure contained
23833 a member requiring 128-bit alignment. This is corrected in more
23834 recent versions of GCC. This option may be used to generate code
23835 that is compatible with functions compiled with older versions of
23836 GCC.
23837
23838 The @option{-mno-compat-align-parm} option is the default.
23839
23840 @item -mstack-protector-guard=@var{guard}
23841 @itemx -mstack-protector-guard-reg=@var{reg}
23842 @itemx -mstack-protector-guard-offset=@var{offset}
23843 @itemx -mstack-protector-guard-symbol=@var{symbol}
23844 @opindex mstack-protector-guard
23845 @opindex mstack-protector-guard-reg
23846 @opindex mstack-protector-guard-offset
23847 @opindex mstack-protector-guard-symbol
23848 Generate stack protection code using canary at @var{guard}. Supported
23849 locations are @samp{global} for global canary or @samp{tls} for per-thread
23850 canary in the TLS block (the default with GNU libc version 2.4 or later).
23851
23852 With the latter choice the options
23853 @option{-mstack-protector-guard-reg=@var{reg}} and
23854 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
23855 which register to use as base register for reading the canary, and from what
23856 offset from that base register. The default for those is as specified in the
23857 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
23858 the offset with a symbol reference to a canary in the TLS block.
23859 @end table
23860
23861
23862 @node RISC-V Options
23863 @subsection RISC-V Options
23864 @cindex RISC-V Options
23865
23866 These command-line options are defined for RISC-V targets:
23867
23868 @table @gcctabopt
23869 @item -mbranch-cost=@var{n}
23870 @opindex mbranch-cost
23871 Set the cost of branches to roughly @var{n} instructions.
23872
23873 @item -mplt
23874 @itemx -mno-plt
23875 @opindex plt
23876 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23877 non-PIC. The default is @option{-mplt}.
23878
23879 @item -mabi=@var{ABI-string}
23880 @opindex mabi
23881 Specify integer and floating-point calling convention. @var{ABI-string}
23882 contains two parts: the size of integer types and the registers used for
23883 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23884 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23885 32-bit), and that floating-point values up to 64 bits wide are passed in F
23886 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23887 allows the compiler to generate code that uses the F and D extensions but only
23888 allows floating-point values up to 32 bits long to be passed in registers; or
23889 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23890 passed in registers.
23891
23892 The default for this argument is system dependent, users who want a specific
23893 calling convention should specify one explicitly. The valid calling
23894 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23895 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23896 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23897 invalid because the ABI requires 64-bit values be passed in F registers, but F
23898 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23899 only be used with the @samp{rv32e} architecture. This ABI is not well
23900 specified at present, and is subject to change.
23901
23902 @item -mfdiv
23903 @itemx -mno-fdiv
23904 @opindex mfdiv
23905 Do or don't use hardware floating-point divide and square root instructions.
23906 This requires the F or D extensions for floating-point registers. The default
23907 is to use them if the specified architecture has these instructions.
23908
23909 @item -mdiv
23910 @itemx -mno-div
23911 @opindex mdiv
23912 Do or don't use hardware instructions for integer division. This requires the
23913 M extension. The default is to use them if the specified architecture has
23914 these instructions.
23915
23916 @item -march=@var{ISA-string}
23917 @opindex march
23918 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
23919 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23920 @samp{rv32imaf}.
23921
23922 @item -mtune=@var{processor-string}
23923 @opindex mtune
23924 Optimize the output for the given processor, specified by microarchitecture
23925 name.
23926
23927 @item -mpreferred-stack-boundary=@var{num}
23928 @opindex mpreferred-stack-boundary
23929 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23930 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23931 the default is 4 (16 bytes or 128-bits).
23932
23933 @strong{Warning:} If you use this switch, then you must build all modules with
23934 the same value, including any libraries. This includes the system libraries
23935 and startup modules.
23936
23937 @item -msmall-data-limit=@var{n}
23938 @opindex msmall-data-limit
23939 Put global and static data smaller than @var{n} bytes into a special section
23940 (on some targets).
23941
23942 @item -msave-restore
23943 @itemx -mno-save-restore
23944 @opindex msave-restore
23945 Do or don't use smaller but slower prologue and epilogue code that uses
23946 library function calls. The default is to use fast inline prologues and
23947 epilogues.
23948
23949 @item -mstrict-align
23950 @itemx -mno-strict-align
23951 @opindex mstrict-align
23952 Do not or do generate unaligned memory accesses. The default is set depending
23953 on whether the processor we are optimizing for supports fast unaligned access
23954 or not.
23955
23956 @item -mcmodel=medlow
23957 @opindex mcmodel=medlow
23958 Generate code for the medium-low code model. The program and its statically
23959 defined symbols must lie within a single 2 GiB address range and must lie
23960 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23961 statically or dynamically linked. This is the default code model.
23962
23963 @item -mcmodel=medany
23964 @opindex mcmodel=medany
23965 Generate code for the medium-any code model. The program and its statically
23966 defined symbols must be within any single 2 GiB address range. Programs can be
23967 statically or dynamically linked.
23968
23969 @item -mexplicit-relocs
23970 @itemx -mno-exlicit-relocs
23971 Use or do not use assembler relocation operators when dealing with symbolic
23972 addresses. The alternative is to use assembler macros instead, which may
23973 limit optimization.
23974
23975 @item -mrelax
23976 @itemx -mno-relax
23977 Take advantage of linker relaxations to reduce the number of instructions
23978 required to materialize symbol addresses. The default is to take advantage of
23979 linker relaxations.
23980
23981 @end table
23982
23983 @node RL78 Options
23984 @subsection RL78 Options
23985 @cindex RL78 Options
23986
23987 @table @gcctabopt
23988
23989 @item -msim
23990 @opindex msim
23991 Links in additional target libraries to support operation within a
23992 simulator.
23993
23994 @item -mmul=none
23995 @itemx -mmul=g10
23996 @itemx -mmul=g13
23997 @itemx -mmul=g14
23998 @itemx -mmul=rl78
23999 @opindex mmul
24000 Specifies the type of hardware multiplication and division support to
24001 be used. The simplest is @code{none}, which uses software for both
24002 multiplication and division. This is the default. The @code{g13}
24003 value is for the hardware multiply/divide peripheral found on the
24004 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24005 the multiplication and division instructions supported by the RL78/G14
24006 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24007 the value @code{mg10} is an alias for @code{none}.
24008
24009 In addition a C preprocessor macro is defined, based upon the setting
24010 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24011 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24012
24013 @item -mcpu=g10
24014 @itemx -mcpu=g13
24015 @itemx -mcpu=g14
24016 @itemx -mcpu=rl78
24017 @opindex mcpu
24018 Specifies the RL78 core to target. The default is the G14 core, also
24019 known as an S3 core or just RL78. The G13 or S2 core does not have
24020 multiply or divide instructions, instead it uses a hardware peripheral
24021 for these operations. The G10 or S1 core does not have register
24022 banks, so it uses a different calling convention.
24023
24024 If this option is set it also selects the type of hardware multiply
24025 support to use, unless this is overridden by an explicit
24026 @option{-mmul=none} option on the command line. Thus specifying
24027 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24028 peripheral and specifying @option{-mcpu=g10} disables the use of
24029 hardware multiplications altogether.
24030
24031 Note, although the RL78/G14 core is the default target, specifying
24032 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24033 change the behavior of the toolchain since it also enables G14
24034 hardware multiply support. If these options are not specified on the
24035 command line then software multiplication routines will be used even
24036 though the code targets the RL78 core. This is for backwards
24037 compatibility with older toolchains which did not have hardware
24038 multiply and divide support.
24039
24040 In addition a C preprocessor macro is defined, based upon the setting
24041 of this option. Possible values are: @code{__RL78_G10__},
24042 @code{__RL78_G13__} or @code{__RL78_G14__}.
24043
24044 @item -mg10
24045 @itemx -mg13
24046 @itemx -mg14
24047 @itemx -mrl78
24048 @opindex mg10
24049 @opindex mg13
24050 @opindex mg14
24051 @opindex mrl78
24052 These are aliases for the corresponding @option{-mcpu=} option. They
24053 are provided for backwards compatibility.
24054
24055 @item -mallregs
24056 @opindex mallregs
24057 Allow the compiler to use all of the available registers. By default
24058 registers @code{r24..r31} are reserved for use in interrupt handlers.
24059 With this option enabled these registers can be used in ordinary
24060 functions as well.
24061
24062 @item -m64bit-doubles
24063 @itemx -m32bit-doubles
24064 @opindex m64bit-doubles
24065 @opindex m32bit-doubles
24066 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24067 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24068 @option{-m32bit-doubles}.
24069
24070 @item -msave-mduc-in-interrupts
24071 @itemx -mno-save-mduc-in-interrupts
24072 @opindex msave-mduc-in-interrupts
24073 @opindex mno-save-mduc-in-interrupts
24074 Specifies that interrupt handler functions should preserve the
24075 MDUC registers. This is only necessary if normal code might use
24076 the MDUC registers, for example because it performs multiplication
24077 and division operations. The default is to ignore the MDUC registers
24078 as this makes the interrupt handlers faster. The target option -mg13
24079 needs to be passed for this to work as this feature is only available
24080 on the G13 target (S2 core). The MDUC registers will only be saved
24081 if the interrupt handler performs a multiplication or division
24082 operation or it calls another function.
24083
24084 @end table
24085
24086 @node RS/6000 and PowerPC Options
24087 @subsection IBM RS/6000 and PowerPC Options
24088 @cindex RS/6000 and PowerPC Options
24089 @cindex IBM RS/6000 and PowerPC Options
24090
24091 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24092 @table @gcctabopt
24093 @item -mpowerpc-gpopt
24094 @itemx -mno-powerpc-gpopt
24095 @itemx -mpowerpc-gfxopt
24096 @itemx -mno-powerpc-gfxopt
24097 @need 800
24098 @itemx -mpowerpc64
24099 @itemx -mno-powerpc64
24100 @itemx -mmfcrf
24101 @itemx -mno-mfcrf
24102 @itemx -mpopcntb
24103 @itemx -mno-popcntb
24104 @itemx -mpopcntd
24105 @itemx -mno-popcntd
24106 @itemx -mfprnd
24107 @itemx -mno-fprnd
24108 @need 800
24109 @itemx -mcmpb
24110 @itemx -mno-cmpb
24111 @itemx -mmfpgpr
24112 @itemx -mno-mfpgpr
24113 @itemx -mhard-dfp
24114 @itemx -mno-hard-dfp
24115 @opindex mpowerpc-gpopt
24116 @opindex mno-powerpc-gpopt
24117 @opindex mpowerpc-gfxopt
24118 @opindex mno-powerpc-gfxopt
24119 @opindex mpowerpc64
24120 @opindex mno-powerpc64
24121 @opindex mmfcrf
24122 @opindex mno-mfcrf
24123 @opindex mpopcntb
24124 @opindex mno-popcntb
24125 @opindex mpopcntd
24126 @opindex mno-popcntd
24127 @opindex mfprnd
24128 @opindex mno-fprnd
24129 @opindex mcmpb
24130 @opindex mno-cmpb
24131 @opindex mmfpgpr
24132 @opindex mno-mfpgpr
24133 @opindex mhard-dfp
24134 @opindex mno-hard-dfp
24135 You use these options to specify which instructions are available on the
24136 processor you are using. The default value of these options is
24137 determined when configuring GCC@. Specifying the
24138 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24139 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24140 rather than the options listed above.
24141
24142 Specifying @option{-mpowerpc-gpopt} allows
24143 GCC to use the optional PowerPC architecture instructions in the
24144 General Purpose group, including floating-point square root. Specifying
24145 @option{-mpowerpc-gfxopt} allows GCC to
24146 use the optional PowerPC architecture instructions in the Graphics
24147 group, including floating-point select.
24148
24149 The @option{-mmfcrf} option allows GCC to generate the move from
24150 condition register field instruction implemented on the POWER4
24151 processor and other processors that support the PowerPC V2.01
24152 architecture.
24153 The @option{-mpopcntb} option allows GCC to generate the popcount and
24154 double-precision FP reciprocal estimate instruction implemented on the
24155 POWER5 processor and other processors that support the PowerPC V2.02
24156 architecture.
24157 The @option{-mpopcntd} option allows GCC to generate the popcount
24158 instruction implemented on the POWER7 processor and other processors
24159 that support the PowerPC V2.06 architecture.
24160 The @option{-mfprnd} option allows GCC to generate the FP round to
24161 integer instructions implemented on the POWER5+ processor and other
24162 processors that support the PowerPC V2.03 architecture.
24163 The @option{-mcmpb} option allows GCC to generate the compare bytes
24164 instruction implemented on the POWER6 processor and other processors
24165 that support the PowerPC V2.05 architecture.
24166 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
24167 general-purpose register instructions implemented on the POWER6X
24168 processor and other processors that support the extended PowerPC V2.05
24169 architecture.
24170 The @option{-mhard-dfp} option allows GCC to generate the decimal
24171 floating-point instructions implemented on some POWER processors.
24172
24173 The @option{-mpowerpc64} option allows GCC to generate the additional
24174 64-bit instructions that are found in the full PowerPC64 architecture
24175 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24176 @option{-mno-powerpc64}.
24177
24178 @item -mcpu=@var{cpu_type}
24179 @opindex mcpu
24180 Set architecture type, register usage, and
24181 instruction scheduling parameters for machine type @var{cpu_type}.
24182 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24183 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24184 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24185 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24186 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24187 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24188 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24189 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24190 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24191 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24192 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
24193 @samp{rs64}, and @samp{native}.
24194
24195 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24196 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24197 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24198 architecture machine types, with an appropriate, generic processor
24199 model assumed for scheduling purposes.
24200
24201 Specifying @samp{native} as cpu type detects and selects the
24202 architecture option that corresponds to the host processor of the
24203 system performing the compilation.
24204 @option{-mcpu=native} has no effect if GCC does not recognize the
24205 processor.
24206
24207 The other options specify a specific processor. Code generated under
24208 those options runs best on that processor, and may not run at all on
24209 others.
24210
24211 The @option{-mcpu} options automatically enable or disable the
24212 following options:
24213
24214 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24215 -mpopcntb -mpopcntd -mpowerpc64 @gol
24216 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24217 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24218 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24219 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24220
24221 The particular options set for any particular CPU varies between
24222 compiler versions, depending on what setting seems to produce optimal
24223 code for that CPU; it doesn't necessarily reflect the actual hardware's
24224 capabilities. If you wish to set an individual option to a particular
24225 value, you may specify it after the @option{-mcpu} option, like
24226 @option{-mcpu=970 -mno-altivec}.
24227
24228 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24229 not enabled or disabled by the @option{-mcpu} option at present because
24230 AIX does not have full support for these options. You may still
24231 enable or disable them individually if you're sure it'll work in your
24232 environment.
24233
24234 @item -mtune=@var{cpu_type}
24235 @opindex mtune
24236 Set the instruction scheduling parameters for machine type
24237 @var{cpu_type}, but do not set the architecture type or register usage,
24238 as @option{-mcpu=@var{cpu_type}} does. The same
24239 values for @var{cpu_type} are used for @option{-mtune} as for
24240 @option{-mcpu}. If both are specified, the code generated uses the
24241 architecture and registers set by @option{-mcpu}, but the
24242 scheduling parameters set by @option{-mtune}.
24243
24244 @item -mcmodel=small
24245 @opindex mcmodel=small
24246 Generate PowerPC64 code for the small model: The TOC is limited to
24247 64k.
24248
24249 @item -mcmodel=medium
24250 @opindex mcmodel=medium
24251 Generate PowerPC64 code for the medium model: The TOC and other static
24252 data may be up to a total of 4G in size. This is the default for 64-bit
24253 Linux.
24254
24255 @item -mcmodel=large
24256 @opindex mcmodel=large
24257 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24258 in size. Other data and code is only limited by the 64-bit address
24259 space.
24260
24261 @item -maltivec
24262 @itemx -mno-altivec
24263 @opindex maltivec
24264 @opindex mno-altivec
24265 Generate code that uses (does not use) AltiVec instructions, and also
24266 enable the use of built-in functions that allow more direct access to
24267 the AltiVec instruction set. You may also need to set
24268 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24269 enhancements.
24270
24271 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
24272 @option{-maltivec=be}, the element order for AltiVec intrinsics such
24273 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24274 match array element order corresponding to the endianness of the
24275 target. That is, element zero identifies the leftmost element in a
24276 vector register when targeting a big-endian platform, and identifies
24277 the rightmost element in a vector register when targeting a
24278 little-endian platform.
24279
24280 @item -maltivec=be
24281 @opindex maltivec=be
24282 Generate AltiVec instructions using big-endian element order,
24283 regardless of whether the target is big- or little-endian. This is
24284 the default when targeting a big-endian platform. Using this option
24285 is currently deprecated. Support for this feature will be removed in
24286 GCC 9.
24287
24288 The element order is used to interpret element numbers in AltiVec
24289 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
24290 @code{vec_insert}. By default, these match array element order
24291 corresponding to the endianness for the target.
24292
24293 @item -maltivec=le
24294 @opindex maltivec=le
24295 Generate AltiVec instructions using little-endian element order,
24296 regardless of whether the target is big- or little-endian. This is
24297 the default when targeting a little-endian platform. This option is
24298 currently ignored when targeting a big-endian platform.
24299
24300 The element order is used to interpret element numbers in AltiVec
24301 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
24302 @code{vec_insert}. By default, these match array element order
24303 corresponding to the endianness for the target.
24304
24305 @item -mvrsave
24306 @itemx -mno-vrsave
24307 @opindex mvrsave
24308 @opindex mno-vrsave
24309 Generate VRSAVE instructions when generating AltiVec code.
24310
24311 @item -msecure-plt
24312 @opindex msecure-plt
24313 Generate code that allows @command{ld} and @command{ld.so}
24314 to build executables and shared
24315 libraries with non-executable @code{.plt} and @code{.got} sections.
24316 This is a PowerPC
24317 32-bit SYSV ABI option.
24318
24319 @item -mbss-plt
24320 @opindex mbss-plt
24321 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24322 fills in, and
24323 requires @code{.plt} and @code{.got}
24324 sections that are both writable and executable.
24325 This is a PowerPC 32-bit SYSV ABI option.
24326
24327 @item -misel
24328 @itemx -mno-isel
24329 @opindex misel
24330 @opindex mno-isel
24331 This switch enables or disables the generation of ISEL instructions.
24332
24333 @item -mvsx
24334 @itemx -mno-vsx
24335 @opindex mvsx
24336 @opindex mno-vsx
24337 Generate code that uses (does not use) vector/scalar (VSX)
24338 instructions, and also enable the use of built-in functions that allow
24339 more direct access to the VSX instruction set.
24340
24341 @item -mcrypto
24342 @itemx -mno-crypto
24343 @opindex mcrypto
24344 @opindex mno-crypto
24345 Enable the use (disable) of the built-in functions that allow direct
24346 access to the cryptographic instructions that were added in version
24347 2.07 of the PowerPC ISA.
24348
24349 @item -mhtm
24350 @itemx -mno-htm
24351 @opindex mhtm
24352 @opindex mno-htm
24353 Enable (disable) the use of the built-in functions that allow direct
24354 access to the Hardware Transactional Memory (HTM) instructions that
24355 were added in version 2.07 of the PowerPC ISA.
24356
24357 @item -mpower8-fusion
24358 @itemx -mno-power8-fusion
24359 @opindex mpower8-fusion
24360 @opindex mno-power8-fusion
24361 Generate code that keeps (does not keeps) some integer operations
24362 adjacent so that the instructions can be fused together on power8 and
24363 later processors.
24364
24365 @item -mpower8-vector
24366 @itemx -mno-power8-vector
24367 @opindex mpower8-vector
24368 @opindex mno-power8-vector
24369 Generate code that uses (does not use) the vector and scalar
24370 instructions that were added in version 2.07 of the PowerPC ISA. Also
24371 enable the use of built-in functions that allow more direct access to
24372 the vector instructions.
24373
24374 @item -mquad-memory
24375 @itemx -mno-quad-memory
24376 @opindex mquad-memory
24377 @opindex mno-quad-memory
24378 Generate code that uses (does not use) the non-atomic quad word memory
24379 instructions. The @option{-mquad-memory} option requires use of
24380 64-bit mode.
24381
24382 @item -mquad-memory-atomic
24383 @itemx -mno-quad-memory-atomic
24384 @opindex mquad-memory-atomic
24385 @opindex mno-quad-memory-atomic
24386 Generate code that uses (does not use) the atomic quad word memory
24387 instructions. The @option{-mquad-memory-atomic} option requires use of
24388 64-bit mode.
24389
24390 @item -mfloat128
24391 @itemx -mno-float128
24392 @opindex mfloat128
24393 @opindex mno-float128
24394 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24395 and use either software emulation for IEEE 128-bit floating point or
24396 hardware instructions.
24397
24398 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24399 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24400 use the IEEE 128-bit floating point support. The IEEE 128-bit
24401 floating point support only works on PowerPC Linux systems.
24402
24403 The default for @option{-mfloat128} is enabled on PowerPC Linux
24404 systems using the VSX instruction set, and disabled on other systems.
24405
24406 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24407 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24408 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24409 floating point instructions. Otherwise, if you do not specify to
24410 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24411 system, IEEE 128-bit floating point will be done with software
24412 emulation.
24413
24414 @item -mfloat128-hardware
24415 @itemx -mno-float128-hardware
24416 @opindex mfloat128-hardware
24417 @opindex mno-float128-hardware
24418 Enable/disable using ISA 3.0 hardware instructions to support the
24419 @var{__float128} data type.
24420
24421 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24422 Linux systems using the ISA 3.0 instruction set, and disabled on other
24423 systems.
24424
24425 @item -m32
24426 @itemx -m64
24427 @opindex m32
24428 @opindex m64
24429 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24430 targets (including GNU/Linux). The 32-bit environment sets int, long
24431 and pointer to 32 bits and generates code that runs on any PowerPC
24432 variant. The 64-bit environment sets int to 32 bits and long and
24433 pointer to 64 bits, and generates code for PowerPC64, as for
24434 @option{-mpowerpc64}.
24435
24436 @item -mfull-toc
24437 @itemx -mno-fp-in-toc
24438 @itemx -mno-sum-in-toc
24439 @itemx -mminimal-toc
24440 @opindex mfull-toc
24441 @opindex mno-fp-in-toc
24442 @opindex mno-sum-in-toc
24443 @opindex mminimal-toc
24444 Modify generation of the TOC (Table Of Contents), which is created for
24445 every executable file. The @option{-mfull-toc} option is selected by
24446 default. In that case, GCC allocates at least one TOC entry for
24447 each unique non-automatic variable reference in your program. GCC
24448 also places floating-point constants in the TOC@. However, only
24449 16,384 entries are available in the TOC@.
24450
24451 If you receive a linker error message that saying you have overflowed
24452 the available TOC space, you can reduce the amount of TOC space used
24453 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24454 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24455 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24456 generate code to calculate the sum of an address and a constant at
24457 run time instead of putting that sum into the TOC@. You may specify one
24458 or both of these options. Each causes GCC to produce very slightly
24459 slower and larger code at the expense of conserving TOC space.
24460
24461 If you still run out of space in the TOC even when you specify both of
24462 these options, specify @option{-mminimal-toc} instead. This option causes
24463 GCC to make only one TOC entry for every file. When you specify this
24464 option, GCC produces code that is slower and larger but which
24465 uses extremely little TOC space. You may wish to use this option
24466 only on files that contain less frequently-executed code.
24467
24468 @item -maix64
24469 @itemx -maix32
24470 @opindex maix64
24471 @opindex maix32
24472 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24473 @code{long} type, and the infrastructure needed to support them.
24474 Specifying @option{-maix64} implies @option{-mpowerpc64},
24475 while @option{-maix32} disables the 64-bit ABI and
24476 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24477
24478 @item -mxl-compat
24479 @itemx -mno-xl-compat
24480 @opindex mxl-compat
24481 @opindex mno-xl-compat
24482 Produce code that conforms more closely to IBM XL compiler semantics
24483 when using AIX-compatible ABI@. Pass floating-point arguments to
24484 prototyped functions beyond the register save area (RSA) on the stack
24485 in addition to argument FPRs. Do not assume that most significant
24486 double in 128-bit long double value is properly rounded when comparing
24487 values and converting to double. Use XL symbol names for long double
24488 support routines.
24489
24490 The AIX calling convention was extended but not initially documented to
24491 handle an obscure K&R C case of calling a function that takes the
24492 address of its arguments with fewer arguments than declared. IBM XL
24493 compilers access floating-point arguments that do not fit in the
24494 RSA from the stack when a subroutine is compiled without
24495 optimization. Because always storing floating-point arguments on the
24496 stack is inefficient and rarely needed, this option is not enabled by
24497 default and only is necessary when calling subroutines compiled by IBM
24498 XL compilers without optimization.
24499
24500 @item -mpe
24501 @opindex mpe
24502 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24503 application written to use message passing with special startup code to
24504 enable the application to run. The system must have PE installed in the
24505 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24506 must be overridden with the @option{-specs=} option to specify the
24507 appropriate directory location. The Parallel Environment does not
24508 support threads, so the @option{-mpe} option and the @option{-pthread}
24509 option are incompatible.
24510
24511 @item -malign-natural
24512 @itemx -malign-power
24513 @opindex malign-natural
24514 @opindex malign-power
24515 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24516 @option{-malign-natural} overrides the ABI-defined alignment of larger
24517 types, such as floating-point doubles, on their natural size-based boundary.
24518 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24519 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24520
24521 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24522 is not supported.
24523
24524 @item -msoft-float
24525 @itemx -mhard-float
24526 @opindex msoft-float
24527 @opindex mhard-float
24528 Generate code that does not use (uses) the floating-point register set.
24529 Software floating-point emulation is provided if you use the
24530 @option{-msoft-float} option, and pass the option to GCC when linking.
24531
24532 @item -mmultiple
24533 @itemx -mno-multiple
24534 @opindex mmultiple
24535 @opindex mno-multiple
24536 Generate code that uses (does not use) the load multiple word
24537 instructions and the store multiple word instructions. These
24538 instructions are generated by default on POWER systems, and not
24539 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24540 PowerPC systems, since those instructions do not work when the
24541 processor is in little-endian mode. The exceptions are PPC740 and
24542 PPC750 which permit these instructions in little-endian mode.
24543
24544 @item -mupdate
24545 @itemx -mno-update
24546 @opindex mupdate
24547 @opindex mno-update
24548 Generate code that uses (does not use) the load or store instructions
24549 that update the base register to the address of the calculated memory
24550 location. These instructions are generated by default. If you use
24551 @option{-mno-update}, there is a small window between the time that the
24552 stack pointer is updated and the address of the previous frame is
24553 stored, which means code that walks the stack frame across interrupts or
24554 signals may get corrupted data.
24555
24556 @item -mavoid-indexed-addresses
24557 @itemx -mno-avoid-indexed-addresses
24558 @opindex mavoid-indexed-addresses
24559 @opindex mno-avoid-indexed-addresses
24560 Generate code that tries to avoid (not avoid) the use of indexed load
24561 or store instructions. These instructions can incur a performance
24562 penalty on Power6 processors in certain situations, such as when
24563 stepping through large arrays that cross a 16M boundary. This option
24564 is enabled by default when targeting Power6 and disabled otherwise.
24565
24566 @item -mfused-madd
24567 @itemx -mno-fused-madd
24568 @opindex mfused-madd
24569 @opindex mno-fused-madd
24570 Generate code that uses (does not use) the floating-point multiply and
24571 accumulate instructions. These instructions are generated by default
24572 if hardware floating point is used. The machine-dependent
24573 @option{-mfused-madd} option is now mapped to the machine-independent
24574 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24575 mapped to @option{-ffp-contract=off}.
24576
24577 @item -mmulhw
24578 @itemx -mno-mulhw
24579 @opindex mmulhw
24580 @opindex mno-mulhw
24581 Generate code that uses (does not use) the half-word multiply and
24582 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24583 These instructions are generated by default when targeting those
24584 processors.
24585
24586 @item -mdlmzb
24587 @itemx -mno-dlmzb
24588 @opindex mdlmzb
24589 @opindex mno-dlmzb
24590 Generate code that uses (does not use) the string-search @samp{dlmzb}
24591 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24592 generated by default when targeting those processors.
24593
24594 @item -mno-bit-align
24595 @itemx -mbit-align
24596 @opindex mno-bit-align
24597 @opindex mbit-align
24598 On System V.4 and embedded PowerPC systems do not (do) force structures
24599 and unions that contain bit-fields to be aligned to the base type of the
24600 bit-field.
24601
24602 For example, by default a structure containing nothing but 8
24603 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24604 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24605 the structure is aligned to a 1-byte boundary and is 1 byte in
24606 size.
24607
24608 @item -mno-strict-align
24609 @itemx -mstrict-align
24610 @opindex mno-strict-align
24611 @opindex mstrict-align
24612 On System V.4 and embedded PowerPC systems do not (do) assume that
24613 unaligned memory references are handled by the system.
24614
24615 @item -mrelocatable
24616 @itemx -mno-relocatable
24617 @opindex mrelocatable
24618 @opindex mno-relocatable
24619 Generate code that allows (does not allow) a static executable to be
24620 relocated to a different address at run time. A simple embedded
24621 PowerPC system loader should relocate the entire contents of
24622 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24623 a table of 32-bit addresses generated by this option. For this to
24624 work, all objects linked together must be compiled with
24625 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24626 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24627
24628 @item -mrelocatable-lib
24629 @itemx -mno-relocatable-lib
24630 @opindex mrelocatable-lib
24631 @opindex mno-relocatable-lib
24632 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24633 @code{.fixup} section to allow static executables to be relocated at
24634 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24635 alignment of @option{-mrelocatable}. Objects compiled with
24636 @option{-mrelocatable-lib} may be linked with objects compiled with
24637 any combination of the @option{-mrelocatable} options.
24638
24639 @item -mno-toc
24640 @itemx -mtoc
24641 @opindex mno-toc
24642 @opindex mtoc
24643 On System V.4 and embedded PowerPC systems do not (do) assume that
24644 register 2 contains a pointer to a global area pointing to the addresses
24645 used in the program.
24646
24647 @item -mlittle
24648 @itemx -mlittle-endian
24649 @opindex mlittle
24650 @opindex mlittle-endian
24651 On System V.4 and embedded PowerPC systems compile code for the
24652 processor in little-endian mode. The @option{-mlittle-endian} option is
24653 the same as @option{-mlittle}.
24654
24655 @item -mbig
24656 @itemx -mbig-endian
24657 @opindex mbig
24658 @opindex mbig-endian
24659 On System V.4 and embedded PowerPC systems compile code for the
24660 processor in big-endian mode. The @option{-mbig-endian} option is
24661 the same as @option{-mbig}.
24662
24663 @item -mdynamic-no-pic
24664 @opindex mdynamic-no-pic
24665 On Darwin and Mac OS X systems, compile code so that it is not
24666 relocatable, but that its external references are relocatable. The
24667 resulting code is suitable for applications, but not shared
24668 libraries.
24669
24670 @item -msingle-pic-base
24671 @opindex msingle-pic-base
24672 Treat the register used for PIC addressing as read-only, rather than
24673 loading it in the prologue for each function. The runtime system is
24674 responsible for initializing this register with an appropriate value
24675 before execution begins.
24676
24677 @item -mprioritize-restricted-insns=@var{priority}
24678 @opindex mprioritize-restricted-insns
24679 This option controls the priority that is assigned to
24680 dispatch-slot restricted instructions during the second scheduling
24681 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24682 or @samp{2} to assign no, highest, or second-highest (respectively)
24683 priority to dispatch-slot restricted
24684 instructions.
24685
24686 @item -msched-costly-dep=@var{dependence_type}
24687 @opindex msched-costly-dep
24688 This option controls which dependences are considered costly
24689 by the target during instruction scheduling. The argument
24690 @var{dependence_type} takes one of the following values:
24691
24692 @table @asis
24693 @item @samp{no}
24694 No dependence is costly.
24695
24696 @item @samp{all}
24697 All dependences are costly.
24698
24699 @item @samp{true_store_to_load}
24700 A true dependence from store to load is costly.
24701
24702 @item @samp{store_to_load}
24703 Any dependence from store to load is costly.
24704
24705 @item @var{number}
24706 Any dependence for which the latency is greater than or equal to
24707 @var{number} is costly.
24708 @end table
24709
24710 @item -minsert-sched-nops=@var{scheme}
24711 @opindex minsert-sched-nops
24712 This option controls which NOP insertion scheme is used during
24713 the second scheduling pass. The argument @var{scheme} takes one of the
24714 following values:
24715
24716 @table @asis
24717 @item @samp{no}
24718 Don't insert NOPs.
24719
24720 @item @samp{pad}
24721 Pad with NOPs any dispatch group that has vacant issue slots,
24722 according to the scheduler's grouping.
24723
24724 @item @samp{regroup_exact}
24725 Insert NOPs to force costly dependent insns into
24726 separate groups. Insert exactly as many NOPs as needed to force an insn
24727 to a new group, according to the estimated processor grouping.
24728
24729 @item @var{number}
24730 Insert NOPs to force costly dependent insns into
24731 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24732 @end table
24733
24734 @item -mcall-sysv
24735 @opindex mcall-sysv
24736 On System V.4 and embedded PowerPC systems compile code using calling
24737 conventions that adhere to the March 1995 draft of the System V
24738 Application Binary Interface, PowerPC processor supplement. This is the
24739 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24740
24741 @item -mcall-sysv-eabi
24742 @itemx -mcall-eabi
24743 @opindex mcall-sysv-eabi
24744 @opindex mcall-eabi
24745 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24746
24747 @item -mcall-sysv-noeabi
24748 @opindex mcall-sysv-noeabi
24749 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24750
24751 @item -mcall-aixdesc
24752 @opindex m
24753 On System V.4 and embedded PowerPC systems compile code for the AIX
24754 operating system.
24755
24756 @item -mcall-linux
24757 @opindex mcall-linux
24758 On System V.4 and embedded PowerPC systems compile code for the
24759 Linux-based GNU system.
24760
24761 @item -mcall-freebsd
24762 @opindex mcall-freebsd
24763 On System V.4 and embedded PowerPC systems compile code for the
24764 FreeBSD operating system.
24765
24766 @item -mcall-netbsd
24767 @opindex mcall-netbsd
24768 On System V.4 and embedded PowerPC systems compile code for the
24769 NetBSD operating system.
24770
24771 @item -mcall-openbsd
24772 @opindex mcall-netbsd
24773 On System V.4 and embedded PowerPC systems compile code for the
24774 OpenBSD operating system.
24775
24776 @item -mtraceback=@var{traceback_type}
24777 @opindex mtraceback
24778 Select the type of traceback table. Valid values for @var{traceback_type}
24779 are @samp{full}, @samp{part}, and @samp{no}.
24780
24781 @item -maix-struct-return
24782 @opindex maix-struct-return
24783 Return all structures in memory (as specified by the AIX ABI)@.
24784
24785 @item -msvr4-struct-return
24786 @opindex msvr4-struct-return
24787 Return structures smaller than 8 bytes in registers (as specified by the
24788 SVR4 ABI)@.
24789
24790 @item -mabi=@var{abi-type}
24791 @opindex mabi
24792 Extend the current ABI with a particular extension, or remove such extension.
24793 Valid values are @samp{altivec}, @samp{no-altivec},
24794 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24795 @samp{elfv1}, @samp{elfv2}@.
24796
24797 @item -mabi=ibmlongdouble
24798 @opindex mabi=ibmlongdouble
24799 Change the current ABI to use IBM extended-precision long double.
24800 This is not likely to work if your system defaults to using IEEE
24801 extended-precision long double. If you change the long double type
24802 from IEEE extended-precision, the compiler will issue a warning unless
24803 you use the @option{-Wno-psabi} option.
24804
24805 @item -mabi=ieeelongdouble
24806 @opindex mabi=ieeelongdouble
24807 Change the current ABI to use IEEE extended-precision long double.
24808 This is not likely to work if your system defaults to using IBM
24809 extended-precision long double. If you change the long double type
24810 from IBM extended-precision, the compiler will issue a warning unless
24811 you use the @option{-Wno-psabi} option.
24812
24813 @item -mabi=elfv1
24814 @opindex mabi=elfv1
24815 Change the current ABI to use the ELFv1 ABI.
24816 This is the default ABI for big-endian PowerPC 64-bit Linux.
24817 Overriding the default ABI requires special system support and is
24818 likely to fail in spectacular ways.
24819
24820 @item -mabi=elfv2
24821 @opindex mabi=elfv2
24822 Change the current ABI to use the ELFv2 ABI.
24823 This is the default ABI for little-endian PowerPC 64-bit Linux.
24824 Overriding the default ABI requires special system support and is
24825 likely to fail in spectacular ways.
24826
24827 @item -mgnu-attribute
24828 @itemx -mno-gnu-attribute
24829 @opindex mgnu-attribute
24830 @opindex mno-gnu-attribute
24831 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24832 .gnu.attributes section that specify ABI variations in function
24833 parameters or return values.
24834
24835 @item -mprototype
24836 @itemx -mno-prototype
24837 @opindex mprototype
24838 @opindex mno-prototype
24839 On System V.4 and embedded PowerPC systems assume that all calls to
24840 variable argument functions are properly prototyped. Otherwise, the
24841 compiler must insert an instruction before every non-prototyped call to
24842 set or clear bit 6 of the condition code register (@code{CR}) to
24843 indicate whether floating-point values are passed in the floating-point
24844 registers in case the function takes variable arguments. With
24845 @option{-mprototype}, only calls to prototyped variable argument functions
24846 set or clear the bit.
24847
24848 @item -msim
24849 @opindex msim
24850 On embedded PowerPC systems, assume that the startup module is called
24851 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24852 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24853 configurations.
24854
24855 @item -mmvme
24856 @opindex mmvme
24857 On embedded PowerPC systems, assume that the startup module is called
24858 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24859 @file{libc.a}.
24860
24861 @item -mads
24862 @opindex mads
24863 On embedded PowerPC systems, assume that the startup module is called
24864 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24865 @file{libc.a}.
24866
24867 @item -myellowknife
24868 @opindex myellowknife
24869 On embedded PowerPC systems, assume that the startup module is called
24870 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24871 @file{libc.a}.
24872
24873 @item -mvxworks
24874 @opindex mvxworks
24875 On System V.4 and embedded PowerPC systems, specify that you are
24876 compiling for a VxWorks system.
24877
24878 @item -memb
24879 @opindex memb
24880 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24881 header to indicate that @samp{eabi} extended relocations are used.
24882
24883 @item -meabi
24884 @itemx -mno-eabi
24885 @opindex meabi
24886 @opindex mno-eabi
24887 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24888 Embedded Applications Binary Interface (EABI), which is a set of
24889 modifications to the System V.4 specifications. Selecting @option{-meabi}
24890 means that the stack is aligned to an 8-byte boundary, a function
24891 @code{__eabi} is called from @code{main} to set up the EABI
24892 environment, and the @option{-msdata} option can use both @code{r2} and
24893 @code{r13} to point to two separate small data areas. Selecting
24894 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24895 no EABI initialization function is called from @code{main}, and the
24896 @option{-msdata} option only uses @code{r13} to point to a single
24897 small data area. The @option{-meabi} option is on by default if you
24898 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24899
24900 @item -msdata=eabi
24901 @opindex msdata=eabi
24902 On System V.4 and embedded PowerPC systems, put small initialized
24903 @code{const} global and static data in the @code{.sdata2} section, which
24904 is pointed to by register @code{r2}. Put small initialized
24905 non-@code{const} global and static data in the @code{.sdata} section,
24906 which is pointed to by register @code{r13}. Put small uninitialized
24907 global and static data in the @code{.sbss} section, which is adjacent to
24908 the @code{.sdata} section. The @option{-msdata=eabi} option is
24909 incompatible with the @option{-mrelocatable} option. The
24910 @option{-msdata=eabi} option also sets the @option{-memb} option.
24911
24912 @item -msdata=sysv
24913 @opindex msdata=sysv
24914 On System V.4 and embedded PowerPC systems, put small global and static
24915 data in the @code{.sdata} section, which is pointed to by register
24916 @code{r13}. Put small uninitialized global and static data in the
24917 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24918 The @option{-msdata=sysv} option is incompatible with the
24919 @option{-mrelocatable} option.
24920
24921 @item -msdata=default
24922 @itemx -msdata
24923 @opindex msdata=default
24924 @opindex msdata
24925 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24926 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24927 same as @option{-msdata=sysv}.
24928
24929 @item -msdata=data
24930 @opindex msdata=data
24931 On System V.4 and embedded PowerPC systems, put small global
24932 data in the @code{.sdata} section. Put small uninitialized global
24933 data in the @code{.sbss} section. Do not use register @code{r13}
24934 to address small data however. This is the default behavior unless
24935 other @option{-msdata} options are used.
24936
24937 @item -msdata=none
24938 @itemx -mno-sdata
24939 @opindex msdata=none
24940 @opindex mno-sdata
24941 On embedded PowerPC systems, put all initialized global and static data
24942 in the @code{.data} section, and all uninitialized data in the
24943 @code{.bss} section.
24944
24945 @item -mreadonly-in-sdata
24946 @opindex mreadonly-in-sdata
24947 @opindex mno-readonly-in-sdata
24948 Put read-only objects in the @code{.sdata} section as well. This is the
24949 default.
24950
24951 @item -mblock-move-inline-limit=@var{num}
24952 @opindex mblock-move-inline-limit
24953 Inline all block moves (such as calls to @code{memcpy} or structure
24954 copies) less than or equal to @var{num} bytes. The minimum value for
24955 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24956 targets. The default value is target-specific.
24957
24958 @item -mblock-compare-inline-limit=@var{num}
24959 @opindex mblock-compare-inline-limit
24960 Generate non-looping inline code for all block compares (such as calls
24961 to @code{memcmp} or structure compares) less than or equal to @var{num}
24962 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24963 block compare is disabled. The default value is target-specific.
24964
24965 @item -mblock-compare-inline-loop-limit=@var{num}
24966 @opindex mblock-compare-inline-loop-limit
24967 Generate an inline expansion using loop code for all block compares that
24968 are less than or equal to @var{num} bytes, but greater than the limit
24969 for non-loop inline block compare expansion. If the block length is not
24970 constant, at most @var{num} bytes will be compared before @code{memcmp}
24971 is called to compare the remainder of the block. The default value is
24972 target-specific.
24973
24974 @item -mstring-compare-inline-limit=@var{num}
24975 @opindex mstring-compare-inline-limit
24976 Compare at most @var{num} string bytes with inline code.
24977 If the difference or end of string is not found at the
24978 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24979 take care of the rest of the comparison. The default is 64 bytes.
24980
24981 @item -G @var{num}
24982 @opindex G
24983 @cindex smaller data references (PowerPC)
24984 @cindex .sdata/.sdata2 references (PowerPC)
24985 On embedded PowerPC systems, put global and static items less than or
24986 equal to @var{num} bytes into the small data or BSS sections instead of
24987 the normal data or BSS section. By default, @var{num} is 8. The
24988 @option{-G @var{num}} switch is also passed to the linker.
24989 All modules should be compiled with the same @option{-G @var{num}} value.
24990
24991 @item -mregnames
24992 @itemx -mno-regnames
24993 @opindex mregnames
24994 @opindex mno-regnames
24995 On System V.4 and embedded PowerPC systems do (do not) emit register
24996 names in the assembly language output using symbolic forms.
24997
24998 @item -mlongcall
24999 @itemx -mno-longcall
25000 @opindex mlongcall
25001 @opindex mno-longcall
25002 By default assume that all calls are far away so that a longer and more
25003 expensive calling sequence is required. This is required for calls
25004 farther than 32 megabytes (33,554,432 bytes) from the current location.
25005 A short call is generated if the compiler knows
25006 the call cannot be that far away. This setting can be overridden by
25007 the @code{shortcall} function attribute, or by @code{#pragma
25008 longcall(0)}.
25009
25010 Some linkers are capable of detecting out-of-range calls and generating
25011 glue code on the fly. On these systems, long calls are unnecessary and
25012 generate slower code. As of this writing, the AIX linker can do this,
25013 as can the GNU linker for PowerPC/64. It is planned to add this feature
25014 to the GNU linker for 32-bit PowerPC systems as well.
25015
25016 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25017 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25018 addresses represent the callee and the branch island. The
25019 Darwin/PPC linker prefers the first address and generates a @code{bl
25020 callee} if the PPC @code{bl} instruction reaches the callee directly;
25021 otherwise, the linker generates @code{bl L42} to call the branch
25022 island. The branch island is appended to the body of the
25023 calling function; it computes the full 32-bit address of the callee
25024 and jumps to it.
25025
25026 On Mach-O (Darwin) systems, this option directs the compiler emit to
25027 the glue for every direct call, and the Darwin linker decides whether
25028 to use or discard it.
25029
25030 In the future, GCC may ignore all longcall specifications
25031 when the linker is known to generate glue.
25032
25033 @item -mtls-markers
25034 @itemx -mno-tls-markers
25035 @opindex mtls-markers
25036 @opindex mno-tls-markers
25037 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25038 specifying the function argument. The relocation allows the linker to
25039 reliably associate function call with argument setup instructions for
25040 TLS optimization, which in turn allows GCC to better schedule the
25041 sequence.
25042
25043 @item -mrecip
25044 @itemx -mno-recip
25045 @opindex mrecip
25046 This option enables use of the reciprocal estimate and
25047 reciprocal square root estimate instructions with additional
25048 Newton-Raphson steps to increase precision instead of doing a divide or
25049 square root and divide for floating-point arguments. You should use
25050 the @option{-ffast-math} option when using @option{-mrecip} (or at
25051 least @option{-funsafe-math-optimizations},
25052 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25053 @option{-fno-trapping-math}). Note that while the throughput of the
25054 sequence is generally higher than the throughput of the non-reciprocal
25055 instruction, the precision of the sequence can be decreased by up to 2
25056 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25057 roots.
25058
25059 @item -mrecip=@var{opt}
25060 @opindex mrecip=opt
25061 This option controls which reciprocal estimate instructions
25062 may be used. @var{opt} is a comma-separated list of options, which may
25063 be preceded by a @code{!} to invert the option:
25064
25065 @table @samp
25066
25067 @item all
25068 Enable all estimate instructions.
25069
25070 @item default
25071 Enable the default instructions, equivalent to @option{-mrecip}.
25072
25073 @item none
25074 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25075
25076 @item div
25077 Enable the reciprocal approximation instructions for both
25078 single and double precision.
25079
25080 @item divf
25081 Enable the single-precision reciprocal approximation instructions.
25082
25083 @item divd
25084 Enable the double-precision reciprocal approximation instructions.
25085
25086 @item rsqrt
25087 Enable the reciprocal square root approximation instructions for both
25088 single and double precision.
25089
25090 @item rsqrtf
25091 Enable the single-precision reciprocal square root approximation instructions.
25092
25093 @item rsqrtd
25094 Enable the double-precision reciprocal square root approximation instructions.
25095
25096 @end table
25097
25098 So, for example, @option{-mrecip=all,!rsqrtd} enables
25099 all of the reciprocal estimate instructions, except for the
25100 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25101 which handle the double-precision reciprocal square root calculations.
25102
25103 @item -mrecip-precision
25104 @itemx -mno-recip-precision
25105 @opindex mrecip-precision
25106 Assume (do not assume) that the reciprocal estimate instructions
25107 provide higher-precision estimates than is mandated by the PowerPC
25108 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25109 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25110 The double-precision square root estimate instructions are not generated by
25111 default on low-precision machines, since they do not provide an
25112 estimate that converges after three steps.
25113
25114 @item -mveclibabi=@var{type}
25115 @opindex mveclibabi
25116 Specifies the ABI type to use for vectorizing intrinsics using an
25117 external library. The only type supported at present is @samp{mass},
25118 which specifies to use IBM's Mathematical Acceleration Subsystem
25119 (MASS) libraries for vectorizing intrinsics using external libraries.
25120 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25121 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25122 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25123 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25124 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25125 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25126 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25127 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25128 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25129 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25130 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25131 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25132 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25133 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25134 for power7. Both @option{-ftree-vectorize} and
25135 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25136 libraries must be specified at link time.
25137
25138 @item -mfriz
25139 @itemx -mno-friz
25140 @opindex mfriz
25141 Generate (do not generate) the @code{friz} instruction when the
25142 @option{-funsafe-math-optimizations} option is used to optimize
25143 rounding of floating-point values to 64-bit integer and back to floating
25144 point. The @code{friz} instruction does not return the same value if
25145 the floating-point number is too large to fit in an integer.
25146
25147 @item -mpointers-to-nested-functions
25148 @itemx -mno-pointers-to-nested-functions
25149 @opindex mpointers-to-nested-functions
25150 Generate (do not generate) code to load up the static chain register
25151 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25152 systems where a function pointer points to a 3-word descriptor giving
25153 the function address, TOC value to be loaded in register @code{r2}, and
25154 static chain value to be loaded in register @code{r11}. The
25155 @option{-mpointers-to-nested-functions} is on by default. You cannot
25156 call through pointers to nested functions or pointers
25157 to functions compiled in other languages that use the static chain if
25158 you use @option{-mno-pointers-to-nested-functions}.
25159
25160 @item -msave-toc-indirect
25161 @itemx -mno-save-toc-indirect
25162 @opindex msave-toc-indirect
25163 Generate (do not generate) code to save the TOC value in the reserved
25164 stack location in the function prologue if the function calls through
25165 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25166 saved in the prologue, it is saved just before the call through the
25167 pointer. The @option{-mno-save-toc-indirect} option is the default.
25168
25169 @item -mcompat-align-parm
25170 @itemx -mno-compat-align-parm
25171 @opindex mcompat-align-parm
25172 Generate (do not generate) code to pass structure parameters with a
25173 maximum alignment of 64 bits, for compatibility with older versions
25174 of GCC.
25175
25176 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25177 structure parameter on a 128-bit boundary when that structure contained
25178 a member requiring 128-bit alignment. This is corrected in more
25179 recent versions of GCC. This option may be used to generate code
25180 that is compatible with functions compiled with older versions of
25181 GCC.
25182
25183 The @option{-mno-compat-align-parm} option is the default.
25184
25185 @item -mstack-protector-guard=@var{guard}
25186 @itemx -mstack-protector-guard-reg=@var{reg}
25187 @itemx -mstack-protector-guard-offset=@var{offset}
25188 @itemx -mstack-protector-guard-symbol=@var{symbol}
25189 @opindex mstack-protector-guard
25190 @opindex mstack-protector-guard-reg
25191 @opindex mstack-protector-guard-offset
25192 @opindex mstack-protector-guard-symbol
25193 Generate stack protection code using canary at @var{guard}. Supported
25194 locations are @samp{global} for global canary or @samp{tls} for per-thread
25195 canary in the TLS block (the default with GNU libc version 2.4 or later).
25196
25197 With the latter choice the options
25198 @option{-mstack-protector-guard-reg=@var{reg}} and
25199 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25200 which register to use as base register for reading the canary, and from what
25201 offset from that base register. The default for those is as specified in the
25202 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25203 the offset with a symbol reference to a canary in the TLS block.
25204 @end table
25205
25206 @node RX Options
25207 @subsection RX Options
25208 @cindex RX Options
25209
25210 These command-line options are defined for RX targets:
25211
25212 @table @gcctabopt
25213 @item -m64bit-doubles
25214 @itemx -m32bit-doubles
25215 @opindex m64bit-doubles
25216 @opindex m32bit-doubles
25217 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25218 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25219 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25220 works on 32-bit values, which is why the default is
25221 @option{-m32bit-doubles}.
25222
25223 @item -fpu
25224 @itemx -nofpu
25225 @opindex fpu
25226 @opindex nofpu
25227 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25228 floating-point hardware. The default is enabled for the RX600
25229 series and disabled for the RX200 series.
25230
25231 Floating-point instructions are only generated for 32-bit floating-point
25232 values, however, so the FPU hardware is not used for doubles if the
25233 @option{-m64bit-doubles} option is used.
25234
25235 @emph{Note} If the @option{-fpu} option is enabled then
25236 @option{-funsafe-math-optimizations} is also enabled automatically.
25237 This is because the RX FPU instructions are themselves unsafe.
25238
25239 @item -mcpu=@var{name}
25240 @opindex mcpu
25241 Selects the type of RX CPU to be targeted. Currently three types are
25242 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25243 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25244
25245 The only difference between @samp{RX600} and @samp{RX610} is that the
25246 @samp{RX610} does not support the @code{MVTIPL} instruction.
25247
25248 The @samp{RX200} series does not have a hardware floating-point unit
25249 and so @option{-nofpu} is enabled by default when this type is
25250 selected.
25251
25252 @item -mbig-endian-data
25253 @itemx -mlittle-endian-data
25254 @opindex mbig-endian-data
25255 @opindex mlittle-endian-data
25256 Store data (but not code) in the big-endian format. The default is
25257 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25258 format.
25259
25260 @item -msmall-data-limit=@var{N}
25261 @opindex msmall-data-limit
25262 Specifies the maximum size in bytes of global and static variables
25263 which can be placed into the small data area. Using the small data
25264 area can lead to smaller and faster code, but the size of area is
25265 limited and it is up to the programmer to ensure that the area does
25266 not overflow. Also when the small data area is used one of the RX's
25267 registers (usually @code{r13}) is reserved for use pointing to this
25268 area, so it is no longer available for use by the compiler. This
25269 could result in slower and/or larger code if variables are pushed onto
25270 the stack instead of being held in this register.
25271
25272 Note, common variables (variables that have not been initialized) and
25273 constants are not placed into the small data area as they are assigned
25274 to other sections in the output executable.
25275
25276 The default value is zero, which disables this feature. Note, this
25277 feature is not enabled by default with higher optimization levels
25278 (@option{-O2} etc) because of the potentially detrimental effects of
25279 reserving a register. It is up to the programmer to experiment and
25280 discover whether this feature is of benefit to their program. See the
25281 description of the @option{-mpid} option for a description of how the
25282 actual register to hold the small data area pointer is chosen.
25283
25284 @item -msim
25285 @itemx -mno-sim
25286 @opindex msim
25287 @opindex mno-sim
25288 Use the simulator runtime. The default is to use the libgloss
25289 board-specific runtime.
25290
25291 @item -mas100-syntax
25292 @itemx -mno-as100-syntax
25293 @opindex mas100-syntax
25294 @opindex mno-as100-syntax
25295 When generating assembler output use a syntax that is compatible with
25296 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25297 assembler, but it has some restrictions so it is not generated by default.
25298
25299 @item -mmax-constant-size=@var{N}
25300 @opindex mmax-constant-size
25301 Specifies the maximum size, in bytes, of a constant that can be used as
25302 an operand in a RX instruction. Although the RX instruction set does
25303 allow constants of up to 4 bytes in length to be used in instructions,
25304 a longer value equates to a longer instruction. Thus in some
25305 circumstances it can be beneficial to restrict the size of constants
25306 that are used in instructions. Constants that are too big are instead
25307 placed into a constant pool and referenced via register indirection.
25308
25309 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25310 or 4 means that constants of any size are allowed.
25311
25312 @item -mrelax
25313 @opindex mrelax
25314 Enable linker relaxation. Linker relaxation is a process whereby the
25315 linker attempts to reduce the size of a program by finding shorter
25316 versions of various instructions. Disabled by default.
25317
25318 @item -mint-register=@var{N}
25319 @opindex mint-register
25320 Specify the number of registers to reserve for fast interrupt handler
25321 functions. The value @var{N} can be between 0 and 4. A value of 1
25322 means that register @code{r13} is reserved for the exclusive use
25323 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25324 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25325 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25326 A value of 0, the default, does not reserve any registers.
25327
25328 @item -msave-acc-in-interrupts
25329 @opindex msave-acc-in-interrupts
25330 Specifies that interrupt handler functions should preserve the
25331 accumulator register. This is only necessary if normal code might use
25332 the accumulator register, for example because it performs 64-bit
25333 multiplications. The default is to ignore the accumulator as this
25334 makes the interrupt handlers faster.
25335
25336 @item -mpid
25337 @itemx -mno-pid
25338 @opindex mpid
25339 @opindex mno-pid
25340 Enables the generation of position independent data. When enabled any
25341 access to constant data is done via an offset from a base address
25342 held in a register. This allows the location of constant data to be
25343 determined at run time without requiring the executable to be
25344 relocated, which is a benefit to embedded applications with tight
25345 memory constraints. Data that can be modified is not affected by this
25346 option.
25347
25348 Note, using this feature reserves a register, usually @code{r13}, for
25349 the constant data base address. This can result in slower and/or
25350 larger code, especially in complicated functions.
25351
25352 The actual register chosen to hold the constant data base address
25353 depends upon whether the @option{-msmall-data-limit} and/or the
25354 @option{-mint-register} command-line options are enabled. Starting
25355 with register @code{r13} and proceeding downwards, registers are
25356 allocated first to satisfy the requirements of @option{-mint-register},
25357 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25358 is possible for the small data area register to be @code{r8} if both
25359 @option{-mint-register=4} and @option{-mpid} are specified on the
25360 command line.
25361
25362 By default this feature is not enabled. The default can be restored
25363 via the @option{-mno-pid} command-line option.
25364
25365 @item -mno-warn-multiple-fast-interrupts
25366 @itemx -mwarn-multiple-fast-interrupts
25367 @opindex mno-warn-multiple-fast-interrupts
25368 @opindex mwarn-multiple-fast-interrupts
25369 Prevents GCC from issuing a warning message if it finds more than one
25370 fast interrupt handler when it is compiling a file. The default is to
25371 issue a warning for each extra fast interrupt handler found, as the RX
25372 only supports one such interrupt.
25373
25374 @item -mallow-string-insns
25375 @itemx -mno-allow-string-insns
25376 @opindex mallow-string-insns
25377 @opindex mno-allow-string-insns
25378 Enables or disables the use of the string manipulation instructions
25379 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25380 @code{SWHILE} and also the @code{RMPA} instruction. These
25381 instructions may prefetch data, which is not safe to do if accessing
25382 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25383 for more information).
25384
25385 The default is to allow these instructions, but it is not possible for
25386 GCC to reliably detect all circumstances where a string instruction
25387 might be used to access an I/O register, so their use cannot be
25388 disabled automatically. Instead it is reliant upon the programmer to
25389 use the @option{-mno-allow-string-insns} option if their program
25390 accesses I/O space.
25391
25392 When the instructions are enabled GCC defines the C preprocessor
25393 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25394 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25395
25396 @item -mjsr
25397 @itemx -mno-jsr
25398 @opindex mjsr
25399 @opindex mno-jsr
25400 Use only (or not only) @code{JSR} instructions to access functions.
25401 This option can be used when code size exceeds the range of @code{BSR}
25402 instructions. Note that @option{-mno-jsr} does not mean to not use
25403 @code{JSR} but instead means that any type of branch may be used.
25404 @end table
25405
25406 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25407 has special significance to the RX port when used with the
25408 @code{interrupt} function attribute. This attribute indicates a
25409 function intended to process fast interrupts. GCC ensures
25410 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25411 and/or @code{r13} and only provided that the normal use of the
25412 corresponding registers have been restricted via the
25413 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25414 options.
25415
25416 @node S/390 and zSeries Options
25417 @subsection S/390 and zSeries Options
25418 @cindex S/390 and zSeries Options
25419
25420 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25421
25422 @table @gcctabopt
25423 @item -mhard-float
25424 @itemx -msoft-float
25425 @opindex mhard-float
25426 @opindex msoft-float
25427 Use (do not use) the hardware floating-point instructions and registers
25428 for floating-point operations. When @option{-msoft-float} is specified,
25429 functions in @file{libgcc.a} are used to perform floating-point
25430 operations. When @option{-mhard-float} is specified, the compiler
25431 generates IEEE floating-point instructions. This is the default.
25432
25433 @item -mhard-dfp
25434 @itemx -mno-hard-dfp
25435 @opindex mhard-dfp
25436 @opindex mno-hard-dfp
25437 Use (do not use) the hardware decimal-floating-point instructions for
25438 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25439 specified, functions in @file{libgcc.a} are used to perform
25440 decimal-floating-point operations. When @option{-mhard-dfp} is
25441 specified, the compiler generates decimal-floating-point hardware
25442 instructions. This is the default for @option{-march=z9-ec} or higher.
25443
25444 @item -mlong-double-64
25445 @itemx -mlong-double-128
25446 @opindex mlong-double-64
25447 @opindex mlong-double-128
25448 These switches control the size of @code{long double} type. A size
25449 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25450 type. This is the default.
25451
25452 @item -mbackchain
25453 @itemx -mno-backchain
25454 @opindex mbackchain
25455 @opindex mno-backchain
25456 Store (do not store) the address of the caller's frame as backchain pointer
25457 into the callee's stack frame.
25458 A backchain may be needed to allow debugging using tools that do not understand
25459 DWARF call frame information.
25460 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25461 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25462 the backchain is placed into the topmost word of the 96/160 byte register
25463 save area.
25464
25465 In general, code compiled with @option{-mbackchain} is call-compatible with
25466 code compiled with @option{-mmo-backchain}; however, use of the backchain
25467 for debugging purposes usually requires that the whole binary is built with
25468 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25469 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25470 to build a linux kernel use @option{-msoft-float}.
25471
25472 The default is to not maintain the backchain.
25473
25474 @item -mpacked-stack
25475 @itemx -mno-packed-stack
25476 @opindex mpacked-stack
25477 @opindex mno-packed-stack
25478 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25479 specified, the compiler uses the all fields of the 96/160 byte register save
25480 area only for their default purpose; unused fields still take up stack space.
25481 When @option{-mpacked-stack} is specified, register save slots are densely
25482 packed at the top of the register save area; unused space is reused for other
25483 purposes, allowing for more efficient use of the available stack space.
25484 However, when @option{-mbackchain} is also in effect, the topmost word of
25485 the save area is always used to store the backchain, and the return address
25486 register is always saved two words below the backchain.
25487
25488 As long as the stack frame backchain is not used, code generated with
25489 @option{-mpacked-stack} is call-compatible with code generated with
25490 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25491 S/390 or zSeries generated code that uses the stack frame backchain at run
25492 time, not just for debugging purposes. Such code is not call-compatible
25493 with code compiled with @option{-mpacked-stack}. Also, note that the
25494 combination of @option{-mbackchain},
25495 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25496 to build a linux kernel use @option{-msoft-float}.
25497
25498 The default is to not use the packed stack layout.
25499
25500 @item -msmall-exec
25501 @itemx -mno-small-exec
25502 @opindex msmall-exec
25503 @opindex mno-small-exec
25504 Generate (or do not generate) code using the @code{bras} instruction
25505 to do subroutine calls.
25506 This only works reliably if the total executable size does not
25507 exceed 64k. The default is to use the @code{basr} instruction instead,
25508 which does not have this limitation.
25509
25510 @item -m64
25511 @itemx -m31
25512 @opindex m64
25513 @opindex m31
25514 When @option{-m31} is specified, generate code compliant to the
25515 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25516 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25517 particular to generate 64-bit instructions. For the @samp{s390}
25518 targets, the default is @option{-m31}, while the @samp{s390x}
25519 targets default to @option{-m64}.
25520
25521 @item -mzarch
25522 @itemx -mesa
25523 @opindex mzarch
25524 @opindex mesa
25525 When @option{-mzarch} is specified, generate code using the
25526 instructions available on z/Architecture.
25527 When @option{-mesa} is specified, generate code using the
25528 instructions available on ESA/390. Note that @option{-mesa} is
25529 not possible with @option{-m64}.
25530 When generating code compliant to the GNU/Linux for S/390 ABI,
25531 the default is @option{-mesa}. When generating code compliant
25532 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25533
25534 @item -mhtm
25535 @itemx -mno-htm
25536 @opindex mhtm
25537 @opindex mno-htm
25538 The @option{-mhtm} option enables a set of builtins making use of
25539 instructions available with the transactional execution facility
25540 introduced with the IBM zEnterprise EC12 machine generation
25541 @ref{S/390 System z Built-in Functions}.
25542 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25543
25544 @item -mvx
25545 @itemx -mno-vx
25546 @opindex mvx
25547 @opindex mno-vx
25548 When @option{-mvx} is specified, generate code using the instructions
25549 available with the vector extension facility introduced with the IBM
25550 z13 machine generation.
25551 This option changes the ABI for some vector type values with regard to
25552 alignment and calling conventions. In case vector type values are
25553 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25554 command will be added to mark the resulting binary with the ABI used.
25555 @option{-mvx} is enabled by default when using @option{-march=z13}.
25556
25557 @item -mzvector
25558 @itemx -mno-zvector
25559 @opindex mzvector
25560 @opindex mno-zvector
25561 The @option{-mzvector} option enables vector language extensions and
25562 builtins using instructions available with the vector extension
25563 facility introduced with the IBM z13 machine generation.
25564 This option adds support for @samp{vector} to be used as a keyword to
25565 define vector type variables and arguments. @samp{vector} is only
25566 available when GNU extensions are enabled. It will not be expanded
25567 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25568 In addition to the GCC low-level builtins @option{-mzvector} enables
25569 a set of builtins added for compatibility with AltiVec-style
25570 implementations like Power and Cell. In order to make use of these
25571 builtins the header file @file{vecintrin.h} needs to be included.
25572 @option{-mzvector} is disabled by default.
25573
25574 @item -mmvcle
25575 @itemx -mno-mvcle
25576 @opindex mmvcle
25577 @opindex mno-mvcle
25578 Generate (or do not generate) code using the @code{mvcle} instruction
25579 to perform block moves. When @option{-mno-mvcle} is specified,
25580 use a @code{mvc} loop instead. This is the default unless optimizing for
25581 size.
25582
25583 @item -mdebug
25584 @itemx -mno-debug
25585 @opindex mdebug
25586 @opindex mno-debug
25587 Print (or do not print) additional debug information when compiling.
25588 The default is to not print debug information.
25589
25590 @item -march=@var{cpu-type}
25591 @opindex march
25592 Generate code that runs on @var{cpu-type}, which is the name of a
25593 system representing a certain processor type. Possible values for
25594 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25595 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25596 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
25597 @samp{native}.
25598
25599 The default is @option{-march=z900}.
25600
25601 Specifying @samp{native} as cpu type can be used to select the best
25602 architecture option for the host processor.
25603 @option{-march=native} has no effect if GCC does not recognize the
25604 processor.
25605
25606 @item -mtune=@var{cpu-type}
25607 @opindex mtune
25608 Tune to @var{cpu-type} everything applicable about the generated code,
25609 except for the ABI and the set of available instructions.
25610 The list of @var{cpu-type} values is the same as for @option{-march}.
25611 The default is the value used for @option{-march}.
25612
25613 @item -mtpf-trace
25614 @itemx -mno-tpf-trace
25615 @opindex mtpf-trace
25616 @opindex mno-tpf-trace
25617 Generate code that adds (does not add) in TPF OS specific branches to trace
25618 routines in the operating system. This option is off by default, even
25619 when compiling for the TPF OS@.
25620
25621 @item -mfused-madd
25622 @itemx -mno-fused-madd
25623 @opindex mfused-madd
25624 @opindex mno-fused-madd
25625 Generate code that uses (does not use) the floating-point multiply and
25626 accumulate instructions. These instructions are generated by default if
25627 hardware floating point is used.
25628
25629 @item -mwarn-framesize=@var{framesize}
25630 @opindex mwarn-framesize
25631 Emit a warning if the current function exceeds the given frame size. Because
25632 this is a compile-time check it doesn't need to be a real problem when the program
25633 runs. It is intended to identify functions that most probably cause
25634 a stack overflow. It is useful to be used in an environment with limited stack
25635 size e.g.@: the linux kernel.
25636
25637 @item -mwarn-dynamicstack
25638 @opindex mwarn-dynamicstack
25639 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25640 arrays. This is generally a bad idea with a limited stack size.
25641
25642 @item -mstack-guard=@var{stack-guard}
25643 @itemx -mstack-size=@var{stack-size}
25644 @opindex mstack-guard
25645 @opindex mstack-size
25646 If these options are provided the S/390 back end emits additional instructions in
25647 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25648 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25649 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25650 the frame size of the compiled function is chosen.
25651 These options are intended to be used to help debugging stack overflow problems.
25652 The additionally emitted code causes only little overhead and hence can also be
25653 used in production-like systems without greater performance degradation. The given
25654 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25655 @var{stack-guard} without exceeding 64k.
25656 In order to be efficient the extra code makes the assumption that the stack starts
25657 at an address aligned to the value given by @var{stack-size}.
25658 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25659
25660 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25661 @opindex mhotpatch
25662 If the hotpatch option is enabled, a ``hot-patching'' function
25663 prologue is generated for all functions in the compilation unit.
25664 The funtion label is prepended with the given number of two-byte
25665 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25666 the label, 2 * @var{post-halfwords} bytes are appended, using the
25667 largest NOP like instructions the architecture allows (maximum
25668 1000000).
25669
25670 If both arguments are zero, hotpatching is disabled.
25671
25672 This option can be overridden for individual functions with the
25673 @code{hotpatch} attribute.
25674 @end table
25675
25676 @node Score Options
25677 @subsection Score Options
25678 @cindex Score Options
25679
25680 These options are defined for Score implementations:
25681
25682 @table @gcctabopt
25683 @item -meb
25684 @opindex meb
25685 Compile code for big-endian mode. This is the default.
25686
25687 @item -mel
25688 @opindex mel
25689 Compile code for little-endian mode.
25690
25691 @item -mnhwloop
25692 @opindex mnhwloop
25693 Disable generation of @code{bcnz} instructions.
25694
25695 @item -muls
25696 @opindex muls
25697 Enable generation of unaligned load and store instructions.
25698
25699 @item -mmac
25700 @opindex mmac
25701 Enable the use of multiply-accumulate instructions. Disabled by default.
25702
25703 @item -mscore5
25704 @opindex mscore5
25705 Specify the SCORE5 as the target architecture.
25706
25707 @item -mscore5u
25708 @opindex mscore5u
25709 Specify the SCORE5U of the target architecture.
25710
25711 @item -mscore7
25712 @opindex mscore7
25713 Specify the SCORE7 as the target architecture. This is the default.
25714
25715 @item -mscore7d
25716 @opindex mscore7d
25717 Specify the SCORE7D as the target architecture.
25718 @end table
25719
25720 @node SH Options
25721 @subsection SH Options
25722
25723 These @samp{-m} options are defined for the SH implementations:
25724
25725 @table @gcctabopt
25726 @item -m1
25727 @opindex m1
25728 Generate code for the SH1.
25729
25730 @item -m2
25731 @opindex m2
25732 Generate code for the SH2.
25733
25734 @item -m2e
25735 Generate code for the SH2e.
25736
25737 @item -m2a-nofpu
25738 @opindex m2a-nofpu
25739 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25740 that the floating-point unit is not used.
25741
25742 @item -m2a-single-only
25743 @opindex m2a-single-only
25744 Generate code for the SH2a-FPU, in such a way that no double-precision
25745 floating-point operations are used.
25746
25747 @item -m2a-single
25748 @opindex m2a-single
25749 Generate code for the SH2a-FPU assuming the floating-point unit is in
25750 single-precision mode by default.
25751
25752 @item -m2a
25753 @opindex m2a
25754 Generate code for the SH2a-FPU assuming the floating-point unit is in
25755 double-precision mode by default.
25756
25757 @item -m3
25758 @opindex m3
25759 Generate code for the SH3.
25760
25761 @item -m3e
25762 @opindex m3e
25763 Generate code for the SH3e.
25764
25765 @item -m4-nofpu
25766 @opindex m4-nofpu
25767 Generate code for the SH4 without a floating-point unit.
25768
25769 @item -m4-single-only
25770 @opindex m4-single-only
25771 Generate code for the SH4 with a floating-point unit that only
25772 supports single-precision arithmetic.
25773
25774 @item -m4-single
25775 @opindex m4-single
25776 Generate code for the SH4 assuming the floating-point unit is in
25777 single-precision mode by default.
25778
25779 @item -m4
25780 @opindex m4
25781 Generate code for the SH4.
25782
25783 @item -m4-100
25784 @opindex m4-100
25785 Generate code for SH4-100.
25786
25787 @item -m4-100-nofpu
25788 @opindex m4-100-nofpu
25789 Generate code for SH4-100 in such a way that the
25790 floating-point unit is not used.
25791
25792 @item -m4-100-single
25793 @opindex m4-100-single
25794 Generate code for SH4-100 assuming the floating-point unit is in
25795 single-precision mode by default.
25796
25797 @item -m4-100-single-only
25798 @opindex m4-100-single-only
25799 Generate code for SH4-100 in such a way that no double-precision
25800 floating-point operations are used.
25801
25802 @item -m4-200
25803 @opindex m4-200
25804 Generate code for SH4-200.
25805
25806 @item -m4-200-nofpu
25807 @opindex m4-200-nofpu
25808 Generate code for SH4-200 without in such a way that the
25809 floating-point unit is not used.
25810
25811 @item -m4-200-single
25812 @opindex m4-200-single
25813 Generate code for SH4-200 assuming the floating-point unit is in
25814 single-precision mode by default.
25815
25816 @item -m4-200-single-only
25817 @opindex m4-200-single-only
25818 Generate code for SH4-200 in such a way that no double-precision
25819 floating-point operations are used.
25820
25821 @item -m4-300
25822 @opindex m4-300
25823 Generate code for SH4-300.
25824
25825 @item -m4-300-nofpu
25826 @opindex m4-300-nofpu
25827 Generate code for SH4-300 without in such a way that the
25828 floating-point unit is not used.
25829
25830 @item -m4-300-single
25831 @opindex m4-300-single
25832 Generate code for SH4-300 in such a way that no double-precision
25833 floating-point operations are used.
25834
25835 @item -m4-300-single-only
25836 @opindex m4-300-single-only
25837 Generate code for SH4-300 in such a way that no double-precision
25838 floating-point operations are used.
25839
25840 @item -m4-340
25841 @opindex m4-340
25842 Generate code for SH4-340 (no MMU, no FPU).
25843
25844 @item -m4-500
25845 @opindex m4-500
25846 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25847 assembler.
25848
25849 @item -m4a-nofpu
25850 @opindex m4a-nofpu
25851 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25852 floating-point unit is not used.
25853
25854 @item -m4a-single-only
25855 @opindex m4a-single-only
25856 Generate code for the SH4a, in such a way that no double-precision
25857 floating-point operations are used.
25858
25859 @item -m4a-single
25860 @opindex m4a-single
25861 Generate code for the SH4a assuming the floating-point unit is in
25862 single-precision mode by default.
25863
25864 @item -m4a
25865 @opindex m4a
25866 Generate code for the SH4a.
25867
25868 @item -m4al
25869 @opindex m4al
25870 Same as @option{-m4a-nofpu}, except that it implicitly passes
25871 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25872 instructions at the moment.
25873
25874 @item -mb
25875 @opindex mb
25876 Compile code for the processor in big-endian mode.
25877
25878 @item -ml
25879 @opindex ml
25880 Compile code for the processor in little-endian mode.
25881
25882 @item -mdalign
25883 @opindex mdalign
25884 Align doubles at 64-bit boundaries. Note that this changes the calling
25885 conventions, and thus some functions from the standard C library do
25886 not work unless you recompile it first with @option{-mdalign}.
25887
25888 @item -mrelax
25889 @opindex mrelax
25890 Shorten some address references at link time, when possible; uses the
25891 linker option @option{-relax}.
25892
25893 @item -mbigtable
25894 @opindex mbigtable
25895 Use 32-bit offsets in @code{switch} tables. The default is to use
25896 16-bit offsets.
25897
25898 @item -mbitops
25899 @opindex mbitops
25900 Enable the use of bit manipulation instructions on SH2A.
25901
25902 @item -mfmovd
25903 @opindex mfmovd
25904 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25905 alignment constraints.
25906
25907 @item -mrenesas
25908 @opindex mrenesas
25909 Comply with the calling conventions defined by Renesas.
25910
25911 @item -mno-renesas
25912 @opindex mno-renesas
25913 Comply with the calling conventions defined for GCC before the Renesas
25914 conventions were available. This option is the default for all
25915 targets of the SH toolchain.
25916
25917 @item -mnomacsave
25918 @opindex mnomacsave
25919 Mark the @code{MAC} register as call-clobbered, even if
25920 @option{-mrenesas} is given.
25921
25922 @item -mieee
25923 @itemx -mno-ieee
25924 @opindex mieee
25925 @opindex mno-ieee
25926 Control the IEEE compliance of floating-point comparisons, which affects the
25927 handling of cases where the result of a comparison is unordered. By default
25928 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25929 enabled @option{-mno-ieee} is implicitly set, which results in faster
25930 floating-point greater-equal and less-equal comparisons. The implicit settings
25931 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25932
25933 @item -minline-ic_invalidate
25934 @opindex minline-ic_invalidate
25935 Inline code to invalidate instruction cache entries after setting up
25936 nested function trampolines.
25937 This option has no effect if @option{-musermode} is in effect and the selected
25938 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
25939 instruction.
25940 If the selected code generation option does not allow the use of the @code{icbi}
25941 instruction, and @option{-musermode} is not in effect, the inlined code
25942 manipulates the instruction cache address array directly with an associative
25943 write. This not only requires privileged mode at run time, but it also
25944 fails if the cache line had been mapped via the TLB and has become unmapped.
25945
25946 @item -misize
25947 @opindex misize
25948 Dump instruction size and location in the assembly code.
25949
25950 @item -mpadstruct
25951 @opindex mpadstruct
25952 This option is deprecated. It pads structures to multiple of 4 bytes,
25953 which is incompatible with the SH ABI@.
25954
25955 @item -matomic-model=@var{model}
25956 @opindex matomic-model=@var{model}
25957 Sets the model of atomic operations and additional parameters as a comma
25958 separated list. For details on the atomic built-in functions see
25959 @ref{__atomic Builtins}. The following models and parameters are supported:
25960
25961 @table @samp
25962
25963 @item none
25964 Disable compiler generated atomic sequences and emit library calls for atomic
25965 operations. This is the default if the target is not @code{sh*-*-linux*}.
25966
25967 @item soft-gusa
25968 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25969 built-in functions. The generated atomic sequences require additional support
25970 from the interrupt/exception handling code of the system and are only suitable
25971 for SH3* and SH4* single-core systems. This option is enabled by default when
25972 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25973 this option also partially utilizes the hardware atomic instructions
25974 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25975 @samp{strict} is specified.
25976
25977 @item soft-tcb
25978 Generate software atomic sequences that use a variable in the thread control
25979 block. This is a variation of the gUSA sequences which can also be used on
25980 SH1* and SH2* targets. The generated atomic sequences require additional
25981 support from the interrupt/exception handling code of the system and are only
25982 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25983 parameter has to be specified as well.
25984
25985 @item soft-imask
25986 Generate software atomic sequences that temporarily disable interrupts by
25987 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25988 in privileged mode and is only suitable for single-core systems. Additional
25989 support from the interrupt/exception handling code of the system is not
25990 required. This model is enabled by default when the target is
25991 @code{sh*-*-linux*} and SH1* or SH2*.
25992
25993 @item hard-llcs
25994 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25995 instructions only. This is only available on SH4A and is suitable for
25996 multi-core systems. Since the hardware instructions support only 32 bit atomic
25997 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25998 Code compiled with this option is also compatible with other software
25999 atomic model interrupt/exception handling systems if executed on an SH4A
26000 system. Additional support from the interrupt/exception handling code of the
26001 system is not required for this model.
26002
26003 @item gbr-offset=
26004 This parameter specifies the offset in bytes of the variable in the thread
26005 control block structure that should be used by the generated atomic sequences
26006 when the @samp{soft-tcb} model has been selected. For other models this
26007 parameter is ignored. The specified value must be an integer multiple of four
26008 and in the range 0-1020.
26009
26010 @item strict
26011 This parameter prevents mixed usage of multiple atomic models, even if they
26012 are compatible, and makes the compiler generate atomic sequences of the
26013 specified model only.
26014
26015 @end table
26016
26017 @item -mtas
26018 @opindex mtas
26019 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26020 Notice that depending on the particular hardware and software configuration
26021 this can degrade overall performance due to the operand cache line flushes
26022 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26023 processors the @code{tas.b} instruction must be used with caution since it
26024 can result in data corruption for certain cache configurations.
26025
26026 @item -mprefergot
26027 @opindex mprefergot
26028 When generating position-independent code, emit function calls using
26029 the Global Offset Table instead of the Procedure Linkage Table.
26030
26031 @item -musermode
26032 @itemx -mno-usermode
26033 @opindex musermode
26034 @opindex mno-usermode
26035 Don't allow (allow) the compiler generating privileged mode code. Specifying
26036 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26037 inlined code would not work in user mode. @option{-musermode} is the default
26038 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26039 @option{-musermode} has no effect, since there is no user mode.
26040
26041 @item -multcost=@var{number}
26042 @opindex multcost=@var{number}
26043 Set the cost to assume for a multiply insn.
26044
26045 @item -mdiv=@var{strategy}
26046 @opindex mdiv=@var{strategy}
26047 Set the division strategy to be used for integer division operations.
26048 @var{strategy} can be one of:
26049
26050 @table @samp
26051
26052 @item call-div1
26053 Calls a library function that uses the single-step division instruction
26054 @code{div1} to perform the operation. Division by zero calculates an
26055 unspecified result and does not trap. This is the default except for SH4,
26056 SH2A and SHcompact.
26057
26058 @item call-fp
26059 Calls a library function that performs the operation in double precision
26060 floating point. Division by zero causes a floating-point exception. This is
26061 the default for SHcompact with FPU. Specifying this for targets that do not
26062 have a double precision FPU defaults to @code{call-div1}.
26063
26064 @item call-table
26065 Calls a library function that uses a lookup table for small divisors and
26066 the @code{div1} instruction with case distinction for larger divisors. Division
26067 by zero calculates an unspecified result and does not trap. This is the default
26068 for SH4. Specifying this for targets that do not have dynamic shift
26069 instructions defaults to @code{call-div1}.
26070
26071 @end table
26072
26073 When a division strategy has not been specified the default strategy is
26074 selected based on the current target. For SH2A the default strategy is to
26075 use the @code{divs} and @code{divu} instructions instead of library function
26076 calls.
26077
26078 @item -maccumulate-outgoing-args
26079 @opindex maccumulate-outgoing-args
26080 Reserve space once for outgoing arguments in the function prologue rather
26081 than around each call. Generally beneficial for performance and size. Also
26082 needed for unwinding to avoid changing the stack frame around conditional code.
26083
26084 @item -mdivsi3_libfunc=@var{name}
26085 @opindex mdivsi3_libfunc=@var{name}
26086 Set the name of the library function used for 32-bit signed division to
26087 @var{name}.
26088 This only affects the name used in the @samp{call} division strategies, and
26089 the compiler still expects the same sets of input/output/clobbered registers as
26090 if this option were not present.
26091
26092 @item -mfixed-range=@var{register-range}
26093 @opindex mfixed-range
26094 Generate code treating the given register range as fixed registers.
26095 A fixed register is one that the register allocator can not use. This is
26096 useful when compiling kernel code. A register range is specified as
26097 two registers separated by a dash. Multiple register ranges can be
26098 specified separated by a comma.
26099
26100 @item -mbranch-cost=@var{num}
26101 @opindex mbranch-cost=@var{num}
26102 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26103 make the compiler try to generate more branch-free code if possible.
26104 If not specified the value is selected depending on the processor type that
26105 is being compiled for.
26106
26107 @item -mzdcbranch
26108 @itemx -mno-zdcbranch
26109 @opindex mzdcbranch
26110 @opindex mno-zdcbranch
26111 Assume (do not assume) that zero displacement conditional branch instructions
26112 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26113 compiler prefers zero displacement branch code sequences. This is
26114 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26115 disabled by specifying @option{-mno-zdcbranch}.
26116
26117 @item -mcbranch-force-delay-slot
26118 @opindex mcbranch-force-delay-slot
26119 Force the usage of delay slots for conditional branches, which stuffs the delay
26120 slot with a @code{nop} if a suitable instruction cannot be found. By default
26121 this option is disabled. It can be enabled to work around hardware bugs as
26122 found in the original SH7055.
26123
26124 @item -mfused-madd
26125 @itemx -mno-fused-madd
26126 @opindex mfused-madd
26127 @opindex mno-fused-madd
26128 Generate code that uses (does not use) the floating-point multiply and
26129 accumulate instructions. These instructions are generated by default
26130 if hardware floating point is used. The machine-dependent
26131 @option{-mfused-madd} option is now mapped to the machine-independent
26132 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26133 mapped to @option{-ffp-contract=off}.
26134
26135 @item -mfsca
26136 @itemx -mno-fsca
26137 @opindex mfsca
26138 @opindex mno-fsca
26139 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26140 and cosine approximations. The option @option{-mfsca} must be used in
26141 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26142 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26143 approximations even if @option{-funsafe-math-optimizations} is in effect.
26144
26145 @item -mfsrra
26146 @itemx -mno-fsrra
26147 @opindex mfsrra
26148 @opindex mno-fsrra
26149 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26150 reciprocal square root approximations. The option @option{-mfsrra} must be used
26151 in combination with @option{-funsafe-math-optimizations} and
26152 @option{-ffinite-math-only}. It is enabled by default when generating code for
26153 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26154 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26155 in effect.
26156
26157 @item -mpretend-cmove
26158 @opindex mpretend-cmove
26159 Prefer zero-displacement conditional branches for conditional move instruction
26160 patterns. This can result in faster code on the SH4 processor.
26161
26162 @item -mfdpic
26163 @opindex fdpic
26164 Generate code using the FDPIC ABI.
26165
26166 @end table
26167
26168 @node Solaris 2 Options
26169 @subsection Solaris 2 Options
26170 @cindex Solaris 2 options
26171
26172 These @samp{-m} options are supported on Solaris 2:
26173
26174 @table @gcctabopt
26175 @item -mclear-hwcap
26176 @opindex mclear-hwcap
26177 @option{-mclear-hwcap} tells the compiler to remove the hardware
26178 capabilities generated by the Solaris assembler. This is only necessary
26179 when object files use ISA extensions not supported by the current
26180 machine, but check at runtime whether or not to use them.
26181
26182 @item -mimpure-text
26183 @opindex mimpure-text
26184 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26185 the compiler to not pass @option{-z text} to the linker when linking a
26186 shared object. Using this option, you can link position-dependent
26187 code into a shared object.
26188
26189 @option{-mimpure-text} suppresses the ``relocations remain against
26190 allocatable but non-writable sections'' linker error message.
26191 However, the necessary relocations trigger copy-on-write, and the
26192 shared object is not actually shared across processes. Instead of
26193 using @option{-mimpure-text}, you should compile all source code with
26194 @option{-fpic} or @option{-fPIC}.
26195
26196 @end table
26197
26198 These switches are supported in addition to the above on Solaris 2:
26199
26200 @table @gcctabopt
26201 @item -pthreads
26202 @opindex pthreads
26203 This is a synonym for @option{-pthread}.
26204 @end table
26205
26206 @node SPARC Options
26207 @subsection SPARC Options
26208 @cindex SPARC options
26209
26210 These @samp{-m} options are supported on the SPARC:
26211
26212 @table @gcctabopt
26213 @item -mno-app-regs
26214 @itemx -mapp-regs
26215 @opindex mno-app-regs
26216 @opindex mapp-regs
26217 Specify @option{-mapp-regs} to generate output using the global registers
26218 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26219 global register 1, each global register 2 through 4 is then treated as an
26220 allocable register that is clobbered by function calls. This is the default.
26221
26222 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26223 specify @option{-mno-app-regs}. You should compile libraries and system
26224 software with this option.
26225
26226 @item -mflat
26227 @itemx -mno-flat
26228 @opindex mflat
26229 @opindex mno-flat
26230 With @option{-mflat}, the compiler does not generate save/restore instructions
26231 and uses a ``flat'' or single register window model. This model is compatible
26232 with the regular register window model. The local registers and the input
26233 registers (0--5) are still treated as ``call-saved'' registers and are
26234 saved on the stack as needed.
26235
26236 With @option{-mno-flat} (the default), the compiler generates save/restore
26237 instructions (except for leaf functions). This is the normal operating mode.
26238
26239 @item -mfpu
26240 @itemx -mhard-float
26241 @opindex mfpu
26242 @opindex mhard-float
26243 Generate output containing floating-point instructions. This is the
26244 default.
26245
26246 @item -mno-fpu
26247 @itemx -msoft-float
26248 @opindex mno-fpu
26249 @opindex msoft-float
26250 Generate output containing library calls for floating point.
26251 @strong{Warning:} the requisite libraries are not available for all SPARC
26252 targets. Normally the facilities of the machine's usual C compiler are
26253 used, but this cannot be done directly in cross-compilation. You must make
26254 your own arrangements to provide suitable library functions for
26255 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26256 @samp{sparclite-*-*} do provide software floating-point support.
26257
26258 @option{-msoft-float} changes the calling convention in the output file;
26259 therefore, it is only useful if you compile @emph{all} of a program with
26260 this option. In particular, you need to compile @file{libgcc.a}, the
26261 library that comes with GCC, with @option{-msoft-float} in order for
26262 this to work.
26263
26264 @item -mhard-quad-float
26265 @opindex mhard-quad-float
26266 Generate output containing quad-word (long double) floating-point
26267 instructions.
26268
26269 @item -msoft-quad-float
26270 @opindex msoft-quad-float
26271 Generate output containing library calls for quad-word (long double)
26272 floating-point instructions. The functions called are those specified
26273 in the SPARC ABI@. This is the default.
26274
26275 As of this writing, there are no SPARC implementations that have hardware
26276 support for the quad-word floating-point instructions. They all invoke
26277 a trap handler for one of these instructions, and then the trap handler
26278 emulates the effect of the instruction. Because of the trap handler overhead,
26279 this is much slower than calling the ABI library routines. Thus the
26280 @option{-msoft-quad-float} option is the default.
26281
26282 @item -mno-unaligned-doubles
26283 @itemx -munaligned-doubles
26284 @opindex mno-unaligned-doubles
26285 @opindex munaligned-doubles
26286 Assume that doubles have 8-byte alignment. This is the default.
26287
26288 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26289 alignment only if they are contained in another type, or if they have an
26290 absolute address. Otherwise, it assumes they have 4-byte alignment.
26291 Specifying this option avoids some rare compatibility problems with code
26292 generated by other compilers. It is not the default because it results
26293 in a performance loss, especially for floating-point code.
26294
26295 @item -muser-mode
26296 @itemx -mno-user-mode
26297 @opindex muser-mode
26298 @opindex mno-user-mode
26299 Do not generate code that can only run in supervisor mode. This is relevant
26300 only for the @code{casa} instruction emitted for the LEON3 processor. This
26301 is the default.
26302
26303 @item -mfaster-structs
26304 @itemx -mno-faster-structs
26305 @opindex mfaster-structs
26306 @opindex mno-faster-structs
26307 With @option{-mfaster-structs}, the compiler assumes that structures
26308 should have 8-byte alignment. This enables the use of pairs of
26309 @code{ldd} and @code{std} instructions for copies in structure
26310 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26311 However, the use of this changed alignment directly violates the SPARC
26312 ABI@. Thus, it's intended only for use on targets where the developer
26313 acknowledges that their resulting code is not directly in line with
26314 the rules of the ABI@.
26315
26316 @item -mstd-struct-return
26317 @itemx -mno-std-struct-return
26318 @opindex mstd-struct-return
26319 @opindex mno-std-struct-return
26320 With @option{-mstd-struct-return}, the compiler generates checking code
26321 in functions returning structures or unions to detect size mismatches
26322 between the two sides of function calls, as per the 32-bit ABI@.
26323
26324 The default is @option{-mno-std-struct-return}. This option has no effect
26325 in 64-bit mode.
26326
26327 @item -mlra
26328 @itemx -mno-lra
26329 @opindex mlra
26330 @opindex mno-lra
26331 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26332 so @option{-mno-lra} needs to be passed to get old Reload.
26333
26334 @item -mcpu=@var{cpu_type}
26335 @opindex mcpu
26336 Set the instruction set, register set, and instruction scheduling parameters
26337 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26338 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26339 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26340 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26341 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26342 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26343
26344 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26345 which selects the best architecture option for the host processor.
26346 @option{-mcpu=native} has no effect if GCC does not recognize
26347 the processor.
26348
26349 Default instruction scheduling parameters are used for values that select
26350 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26351 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26352
26353 Here is a list of each supported architecture and their supported
26354 implementations.
26355
26356 @table @asis
26357 @item v7
26358 cypress, leon3v7
26359
26360 @item v8
26361 supersparc, hypersparc, leon, leon3
26362
26363 @item sparclite
26364 f930, f934, sparclite86x
26365
26366 @item sparclet
26367 tsc701
26368
26369 @item v9
26370 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26371 niagara7, m8
26372 @end table
26373
26374 By default (unless configured otherwise), GCC generates code for the V7
26375 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26376 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26377 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26378 SPARCStation 1, 2, IPX etc.
26379
26380 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26381 architecture. The only difference from V7 code is that the compiler emits
26382 the integer multiply and integer divide instructions which exist in SPARC-V8
26383 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26384 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26385 2000 series.
26386
26387 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26388 the SPARC architecture. This adds the integer multiply, integer divide step
26389 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26390 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26391 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26392 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26393 MB86934 chip, which is the more recent SPARClite with FPU@.
26394
26395 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26396 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26397 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26398 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26399 optimizes it for the TEMIC SPARClet chip.
26400
26401 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26402 architecture. This adds 64-bit integer and floating-point move instructions,
26403 3 additional floating-point condition code registers and conditional move
26404 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26405 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26406 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26407 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26408 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26409 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26410 additionally optimizes it for Sun UltraSPARC T2 chips. With
26411 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26412 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26413 additionally optimizes it for Sun UltraSPARC T4 chips. With
26414 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26415 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26416 additionally optimizes it for Oracle M8 chips.
26417
26418 @item -mtune=@var{cpu_type}
26419 @opindex mtune
26420 Set the instruction scheduling parameters for machine type
26421 @var{cpu_type}, but do not set the instruction set or register set that the
26422 option @option{-mcpu=@var{cpu_type}} does.
26423
26424 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26425 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26426 that select a particular CPU implementation. Those are
26427 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26428 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26429 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26430 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26431 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26432 and GNU/Linux toolchains, @samp{native} can also be used.
26433
26434 @item -mv8plus
26435 @itemx -mno-v8plus
26436 @opindex mv8plus
26437 @opindex mno-v8plus
26438 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26439 difference from the V8 ABI is that the global and out registers are
26440 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26441 mode for all SPARC-V9 processors.
26442
26443 @item -mvis
26444 @itemx -mno-vis
26445 @opindex mvis
26446 @opindex mno-vis
26447 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26448 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26449
26450 @item -mvis2
26451 @itemx -mno-vis2
26452 @opindex mvis2
26453 @opindex mno-vis2
26454 With @option{-mvis2}, GCC generates code that takes advantage of
26455 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26456 default is @option{-mvis2} when targeting a cpu that supports such
26457 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26458 also sets @option{-mvis}.
26459
26460 @item -mvis3
26461 @itemx -mno-vis3
26462 @opindex mvis3
26463 @opindex mno-vis3
26464 With @option{-mvis3}, GCC generates code that takes advantage of
26465 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26466 default is @option{-mvis3} when targeting a cpu that supports such
26467 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26468 also sets @option{-mvis2} and @option{-mvis}.
26469
26470 @item -mvis4
26471 @itemx -mno-vis4
26472 @opindex mvis4
26473 @opindex mno-vis4
26474 With @option{-mvis4}, GCC generates code that takes advantage of
26475 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26476 default is @option{-mvis4} when targeting a cpu that supports such
26477 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26478 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26479
26480 @item -mvis4b
26481 @itemx -mno-vis4b
26482 @opindex mvis4b
26483 @opindex mno-vis4b
26484 With @option{-mvis4b}, GCC generates code that takes advantage of
26485 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26486 the additional VIS instructions introduced in the Oracle SPARC
26487 Architecture 2017. The default is @option{-mvis4b} when targeting a
26488 cpu that supports such instructions, such as m8 and later. Setting
26489 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26490 @option{-mvis2} and @option{-mvis}.
26491
26492 @item -mcbcond
26493 @itemx -mno-cbcond
26494 @opindex mcbcond
26495 @opindex mno-cbcond
26496 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26497 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26498 when targeting a CPU that supports such instructions, such as Niagara-4 and
26499 later.
26500
26501 @item -mfmaf
26502 @itemx -mno-fmaf
26503 @opindex mfmaf
26504 @opindex mno-fmaf
26505 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26506 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26507 when targeting a CPU that supports such instructions, such as Niagara-3 and
26508 later.
26509
26510 @item -mfsmuld
26511 @itemx -mno-fsmuld
26512 @opindex mfsmuld
26513 @opindex mno-fsmuld
26514 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26515 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26516 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26517 or V9 with FPU except @option{-mcpu=leon}.
26518
26519 @item -mpopc
26520 @itemx -mno-popc
26521 @opindex mpopc
26522 @opindex mno-popc
26523 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26524 Population Count instruction. The default is @option{-mpopc}
26525 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26526 later.
26527
26528 @item -msubxc
26529 @itemx -mno-subxc
26530 @opindex msubxc
26531 @opindex mno-subxc
26532 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26533 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26534 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26535 later.
26536
26537 @item -mfix-at697f
26538 @opindex mfix-at697f
26539 Enable the documented workaround for the single erratum of the Atmel AT697F
26540 processor (which corresponds to erratum #13 of the AT697E processor).
26541
26542 @item -mfix-ut699
26543 @opindex mfix-ut699
26544 Enable the documented workarounds for the floating-point errata and the data
26545 cache nullify errata of the UT699 processor.
26546
26547 @item -mfix-ut700
26548 @opindex mfix-ut700
26549 Enable the documented workaround for the back-to-back store errata of
26550 the UT699E/UT700 processor.
26551
26552 @item -mfix-gr712rc
26553 @opindex mfix-gr712rc
26554 Enable the documented workaround for the back-to-back store errata of
26555 the GR712RC processor.
26556 @end table
26557
26558 These @samp{-m} options are supported in addition to the above
26559 on SPARC-V9 processors in 64-bit environments:
26560
26561 @table @gcctabopt
26562 @item -m32
26563 @itemx -m64
26564 @opindex m32
26565 @opindex m64
26566 Generate code for a 32-bit or 64-bit environment.
26567 The 32-bit environment sets int, long and pointer to 32 bits.
26568 The 64-bit environment sets int to 32 bits and long and pointer
26569 to 64 bits.
26570
26571 @item -mcmodel=@var{which}
26572 @opindex mcmodel
26573 Set the code model to one of
26574
26575 @table @samp
26576 @item medlow
26577 The Medium/Low code model: 64-bit addresses, programs
26578 must be linked in the low 32 bits of memory. Programs can be statically
26579 or dynamically linked.
26580
26581 @item medmid
26582 The Medium/Middle code model: 64-bit addresses, programs
26583 must be linked in the low 44 bits of memory, the text and data segments must
26584 be less than 2GB in size and the data segment must be located within 2GB of
26585 the text segment.
26586
26587 @item medany
26588 The Medium/Anywhere code model: 64-bit addresses, programs
26589 may be linked anywhere in memory, the text and data segments must be less
26590 than 2GB in size and the data segment must be located within 2GB of the
26591 text segment.
26592
26593 @item embmedany
26594 The Medium/Anywhere code model for embedded systems:
26595 64-bit addresses, the text and data segments must be less than 2GB in
26596 size, both starting anywhere in memory (determined at link time). The
26597 global register %g4 points to the base of the data segment. Programs
26598 are statically linked and PIC is not supported.
26599 @end table
26600
26601 @item -mmemory-model=@var{mem-model}
26602 @opindex mmemory-model
26603 Set the memory model in force on the processor to one of
26604
26605 @table @samp
26606 @item default
26607 The default memory model for the processor and operating system.
26608
26609 @item rmo
26610 Relaxed Memory Order
26611
26612 @item pso
26613 Partial Store Order
26614
26615 @item tso
26616 Total Store Order
26617
26618 @item sc
26619 Sequential Consistency
26620 @end table
26621
26622 These memory models are formally defined in Appendix D of the SPARC-V9
26623 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26624
26625 @item -mstack-bias
26626 @itemx -mno-stack-bias
26627 @opindex mstack-bias
26628 @opindex mno-stack-bias
26629 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26630 frame pointer if present, are offset by @minus{}2047 which must be added back
26631 when making stack frame references. This is the default in 64-bit mode.
26632 Otherwise, assume no such offset is present.
26633 @end table
26634
26635 @node SPU Options
26636 @subsection SPU Options
26637 @cindex SPU options
26638
26639 These @samp{-m} options are supported on the SPU:
26640
26641 @table @gcctabopt
26642 @item -mwarn-reloc
26643 @itemx -merror-reloc
26644 @opindex mwarn-reloc
26645 @opindex merror-reloc
26646
26647 The loader for SPU does not handle dynamic relocations. By default, GCC
26648 gives an error when it generates code that requires a dynamic
26649 relocation. @option{-mno-error-reloc} disables the error,
26650 @option{-mwarn-reloc} generates a warning instead.
26651
26652 @item -msafe-dma
26653 @itemx -munsafe-dma
26654 @opindex msafe-dma
26655 @opindex munsafe-dma
26656
26657 Instructions that initiate or test completion of DMA must not be
26658 reordered with respect to loads and stores of the memory that is being
26659 accessed.
26660 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26661 memory accesses, but that can lead to inefficient code in places where the
26662 memory is known to not change. Rather than mark the memory as volatile,
26663 you can use @option{-msafe-dma} to tell the compiler to treat
26664 the DMA instructions as potentially affecting all memory.
26665
26666 @item -mbranch-hints
26667 @opindex mbranch-hints
26668
26669 By default, GCC generates a branch hint instruction to avoid
26670 pipeline stalls for always-taken or probably-taken branches. A hint
26671 is not generated closer than 8 instructions away from its branch.
26672 There is little reason to disable them, except for debugging purposes,
26673 or to make an object a little bit smaller.
26674
26675 @item -msmall-mem
26676 @itemx -mlarge-mem
26677 @opindex msmall-mem
26678 @opindex mlarge-mem
26679
26680 By default, GCC generates code assuming that addresses are never larger
26681 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26682 a full 32-bit address.
26683
26684 @item -mstdmain
26685 @opindex mstdmain
26686
26687 By default, GCC links against startup code that assumes the SPU-style
26688 main function interface (which has an unconventional parameter list).
26689 With @option{-mstdmain}, GCC links your program against startup
26690 code that assumes a C99-style interface to @code{main}, including a
26691 local copy of @code{argv} strings.
26692
26693 @item -mfixed-range=@var{register-range}
26694 @opindex mfixed-range
26695 Generate code treating the given register range as fixed registers.
26696 A fixed register is one that the register allocator cannot use. This is
26697 useful when compiling kernel code. A register range is specified as
26698 two registers separated by a dash. Multiple register ranges can be
26699 specified separated by a comma.
26700
26701 @item -mea32
26702 @itemx -mea64
26703 @opindex mea32
26704 @opindex mea64
26705 Compile code assuming that pointers to the PPU address space accessed
26706 via the @code{__ea} named address space qualifier are either 32 or 64
26707 bits wide. The default is 32 bits. As this is an ABI-changing option,
26708 all object code in an executable must be compiled with the same setting.
26709
26710 @item -maddress-space-conversion
26711 @itemx -mno-address-space-conversion
26712 @opindex maddress-space-conversion
26713 @opindex mno-address-space-conversion
26714 Allow/disallow treating the @code{__ea} address space as superset
26715 of the generic address space. This enables explicit type casts
26716 between @code{__ea} and generic pointer as well as implicit
26717 conversions of generic pointers to @code{__ea} pointers. The
26718 default is to allow address space pointer conversions.
26719
26720 @item -mcache-size=@var{cache-size}
26721 @opindex mcache-size
26722 This option controls the version of libgcc that the compiler links to an
26723 executable and selects a software-managed cache for accessing variables
26724 in the @code{__ea} address space with a particular cache size. Possible
26725 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26726 and @samp{128}. The default cache size is 64KB.
26727
26728 @item -matomic-updates
26729 @itemx -mno-atomic-updates
26730 @opindex matomic-updates
26731 @opindex mno-atomic-updates
26732 This option controls the version of libgcc that the compiler links to an
26733 executable and selects whether atomic updates to the software-managed
26734 cache of PPU-side variables are used. If you use atomic updates, changes
26735 to a PPU variable from SPU code using the @code{__ea} named address space
26736 qualifier do not interfere with changes to other PPU variables residing
26737 in the same cache line from PPU code. If you do not use atomic updates,
26738 such interference may occur; however, writing back cache lines is
26739 more efficient. The default behavior is to use atomic updates.
26740
26741 @item -mdual-nops
26742 @itemx -mdual-nops=@var{n}
26743 @opindex mdual-nops
26744 By default, GCC inserts NOPs to increase dual issue when it expects
26745 it to increase performance. @var{n} can be a value from 0 to 10. A
26746 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26747 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26748
26749 @item -mhint-max-nops=@var{n}
26750 @opindex mhint-max-nops
26751 Maximum number of NOPs to insert for a branch hint. A branch hint must
26752 be at least 8 instructions away from the branch it is affecting. GCC
26753 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26754 generate the branch hint.
26755
26756 @item -mhint-max-distance=@var{n}
26757 @opindex mhint-max-distance
26758 The encoding of the branch hint instruction limits the hint to be within
26759 256 instructions of the branch it is affecting. By default, GCC makes
26760 sure it is within 125.
26761
26762 @item -msafe-hints
26763 @opindex msafe-hints
26764 Work around a hardware bug that causes the SPU to stall indefinitely.
26765 By default, GCC inserts the @code{hbrp} instruction to make sure
26766 this stall won't happen.
26767
26768 @end table
26769
26770 @node System V Options
26771 @subsection Options for System V
26772
26773 These additional options are available on System V Release 4 for
26774 compatibility with other compilers on those systems:
26775
26776 @table @gcctabopt
26777 @item -G
26778 @opindex G
26779 Create a shared object.
26780 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26781
26782 @item -Qy
26783 @opindex Qy
26784 Identify the versions of each tool used by the compiler, in a
26785 @code{.ident} assembler directive in the output.
26786
26787 @item -Qn
26788 @opindex Qn
26789 Refrain from adding @code{.ident} directives to the output file (this is
26790 the default).
26791
26792 @item -YP,@var{dirs}
26793 @opindex YP
26794 Search the directories @var{dirs}, and no others, for libraries
26795 specified with @option{-l}.
26796
26797 @item -Ym,@var{dir}
26798 @opindex Ym
26799 Look in the directory @var{dir} to find the M4 preprocessor.
26800 The assembler uses this option.
26801 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26802 @c the generic assembler that comes with Solaris takes just -Ym.
26803 @end table
26804
26805 @node TILE-Gx Options
26806 @subsection TILE-Gx Options
26807 @cindex TILE-Gx options
26808
26809 These @samp{-m} options are supported on the TILE-Gx:
26810
26811 @table @gcctabopt
26812 @item -mcmodel=small
26813 @opindex mcmodel=small
26814 Generate code for the small model. The distance for direct calls is
26815 limited to 500M in either direction. PC-relative addresses are 32
26816 bits. Absolute addresses support the full address range.
26817
26818 @item -mcmodel=large
26819 @opindex mcmodel=large
26820 Generate code for the large model. There is no limitation on call
26821 distance, pc-relative addresses, or absolute addresses.
26822
26823 @item -mcpu=@var{name}
26824 @opindex mcpu
26825 Selects the type of CPU to be targeted. Currently the only supported
26826 type is @samp{tilegx}.
26827
26828 @item -m32
26829 @itemx -m64
26830 @opindex m32
26831 @opindex m64
26832 Generate code for a 32-bit or 64-bit environment. The 32-bit
26833 environment sets int, long, and pointer to 32 bits. The 64-bit
26834 environment sets int to 32 bits and long and pointer to 64 bits.
26835
26836 @item -mbig-endian
26837 @itemx -mlittle-endian
26838 @opindex mbig-endian
26839 @opindex mlittle-endian
26840 Generate code in big/little endian mode, respectively.
26841 @end table
26842
26843 @node TILEPro Options
26844 @subsection TILEPro Options
26845 @cindex TILEPro options
26846
26847 These @samp{-m} options are supported on the TILEPro:
26848
26849 @table @gcctabopt
26850 @item -mcpu=@var{name}
26851 @opindex mcpu
26852 Selects the type of CPU to be targeted. Currently the only supported
26853 type is @samp{tilepro}.
26854
26855 @item -m32
26856 @opindex m32
26857 Generate code for a 32-bit environment, which sets int, long, and
26858 pointer to 32 bits. This is the only supported behavior so the flag
26859 is essentially ignored.
26860 @end table
26861
26862 @node V850 Options
26863 @subsection V850 Options
26864 @cindex V850 Options
26865
26866 These @samp{-m} options are defined for V850 implementations:
26867
26868 @table @gcctabopt
26869 @item -mlong-calls
26870 @itemx -mno-long-calls
26871 @opindex mlong-calls
26872 @opindex mno-long-calls
26873 Treat all calls as being far away (near). If calls are assumed to be
26874 far away, the compiler always loads the function's address into a
26875 register, and calls indirect through the pointer.
26876
26877 @item -mno-ep
26878 @itemx -mep
26879 @opindex mno-ep
26880 @opindex mep
26881 Do not optimize (do optimize) basic blocks that use the same index
26882 pointer 4 or more times to copy pointer into the @code{ep} register, and
26883 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26884 option is on by default if you optimize.
26885
26886 @item -mno-prolog-function
26887 @itemx -mprolog-function
26888 @opindex mno-prolog-function
26889 @opindex mprolog-function
26890 Do not use (do use) external functions to save and restore registers
26891 at the prologue and epilogue of a function. The external functions
26892 are slower, but use less code space if more than one function saves
26893 the same number of registers. The @option{-mprolog-function} option
26894 is on by default if you optimize.
26895
26896 @item -mspace
26897 @opindex mspace
26898 Try to make the code as small as possible. At present, this just turns
26899 on the @option{-mep} and @option{-mprolog-function} options.
26900
26901 @item -mtda=@var{n}
26902 @opindex mtda
26903 Put static or global variables whose size is @var{n} bytes or less into
26904 the tiny data area that register @code{ep} points to. The tiny data
26905 area can hold up to 256 bytes in total (128 bytes for byte references).
26906
26907 @item -msda=@var{n}
26908 @opindex msda
26909 Put static or global variables whose size is @var{n} bytes or less into
26910 the small data area that register @code{gp} points to. The small data
26911 area can hold up to 64 kilobytes.
26912
26913 @item -mzda=@var{n}
26914 @opindex mzda
26915 Put static or global variables whose size is @var{n} bytes or less into
26916 the first 32 kilobytes of memory.
26917
26918 @item -mv850
26919 @opindex mv850
26920 Specify that the target processor is the V850.
26921
26922 @item -mv850e3v5
26923 @opindex mv850e3v5
26924 Specify that the target processor is the V850E3V5. The preprocessor
26925 constant @code{__v850e3v5__} is defined if this option is used.
26926
26927 @item -mv850e2v4
26928 @opindex mv850e2v4
26929 Specify that the target processor is the V850E3V5. This is an alias for
26930 the @option{-mv850e3v5} option.
26931
26932 @item -mv850e2v3
26933 @opindex mv850e2v3
26934 Specify that the target processor is the V850E2V3. The preprocessor
26935 constant @code{__v850e2v3__} is defined if this option is used.
26936
26937 @item -mv850e2
26938 @opindex mv850e2
26939 Specify that the target processor is the V850E2. The preprocessor
26940 constant @code{__v850e2__} is defined if this option is used.
26941
26942 @item -mv850e1
26943 @opindex mv850e1
26944 Specify that the target processor is the V850E1. The preprocessor
26945 constants @code{__v850e1__} and @code{__v850e__} are defined if
26946 this option is used.
26947
26948 @item -mv850es
26949 @opindex mv850es
26950 Specify that the target processor is the V850ES. This is an alias for
26951 the @option{-mv850e1} option.
26952
26953 @item -mv850e
26954 @opindex mv850e
26955 Specify that the target processor is the V850E@. The preprocessor
26956 constant @code{__v850e__} is defined if this option is used.
26957
26958 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26959 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26960 are defined then a default target processor is chosen and the
26961 relevant @samp{__v850*__} preprocessor constant is defined.
26962
26963 The preprocessor constants @code{__v850} and @code{__v851__} are always
26964 defined, regardless of which processor variant is the target.
26965
26966 @item -mdisable-callt
26967 @itemx -mno-disable-callt
26968 @opindex mdisable-callt
26969 @opindex mno-disable-callt
26970 This option suppresses generation of the @code{CALLT} instruction for the
26971 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26972 architecture.
26973
26974 This option is enabled by default when the RH850 ABI is
26975 in use (see @option{-mrh850-abi}), and disabled by default when the
26976 GCC ABI is in use. If @code{CALLT} instructions are being generated
26977 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26978
26979 @item -mrelax
26980 @itemx -mno-relax
26981 @opindex mrelax
26982 @opindex mno-relax
26983 Pass on (or do not pass on) the @option{-mrelax} command-line option
26984 to the assembler.
26985
26986 @item -mlong-jumps
26987 @itemx -mno-long-jumps
26988 @opindex mlong-jumps
26989 @opindex mno-long-jumps
26990 Disable (or re-enable) the generation of PC-relative jump instructions.
26991
26992 @item -msoft-float
26993 @itemx -mhard-float
26994 @opindex msoft-float
26995 @opindex mhard-float
26996 Disable (or re-enable) the generation of hardware floating point
26997 instructions. This option is only significant when the target
26998 architecture is @samp{V850E2V3} or higher. If hardware floating point
26999 instructions are being generated then the C preprocessor symbol
27000 @code{__FPU_OK__} is defined, otherwise the symbol
27001 @code{__NO_FPU__} is defined.
27002
27003 @item -mloop
27004 @opindex mloop
27005 Enables the use of the e3v5 LOOP instruction. The use of this
27006 instruction is not enabled by default when the e3v5 architecture is
27007 selected because its use is still experimental.
27008
27009 @item -mrh850-abi
27010 @itemx -mghs
27011 @opindex mrh850-abi
27012 @opindex mghs
27013 Enables support for the RH850 version of the V850 ABI. This is the
27014 default. With this version of the ABI the following rules apply:
27015
27016 @itemize
27017 @item
27018 Integer sized structures and unions are returned via a memory pointer
27019 rather than a register.
27020
27021 @item
27022 Large structures and unions (more than 8 bytes in size) are passed by
27023 value.
27024
27025 @item
27026 Functions are aligned to 16-bit boundaries.
27027
27028 @item
27029 The @option{-m8byte-align} command-line option is supported.
27030
27031 @item
27032 The @option{-mdisable-callt} command-line option is enabled by
27033 default. The @option{-mno-disable-callt} command-line option is not
27034 supported.
27035 @end itemize
27036
27037 When this version of the ABI is enabled the C preprocessor symbol
27038 @code{__V850_RH850_ABI__} is defined.
27039
27040 @item -mgcc-abi
27041 @opindex mgcc-abi
27042 Enables support for the old GCC version of the V850 ABI. With this
27043 version of the ABI the following rules apply:
27044
27045 @itemize
27046 @item
27047 Integer sized structures and unions are returned in register @code{r10}.
27048
27049 @item
27050 Large structures and unions (more than 8 bytes in size) are passed by
27051 reference.
27052
27053 @item
27054 Functions are aligned to 32-bit boundaries, unless optimizing for
27055 size.
27056
27057 @item
27058 The @option{-m8byte-align} command-line option is not supported.
27059
27060 @item
27061 The @option{-mdisable-callt} command-line option is supported but not
27062 enabled by default.
27063 @end itemize
27064
27065 When this version of the ABI is enabled the C preprocessor symbol
27066 @code{__V850_GCC_ABI__} is defined.
27067
27068 @item -m8byte-align
27069 @itemx -mno-8byte-align
27070 @opindex m8byte-align
27071 @opindex mno-8byte-align
27072 Enables support for @code{double} and @code{long long} types to be
27073 aligned on 8-byte boundaries. The default is to restrict the
27074 alignment of all objects to at most 4-bytes. When
27075 @option{-m8byte-align} is in effect the C preprocessor symbol
27076 @code{__V850_8BYTE_ALIGN__} is defined.
27077
27078 @item -mbig-switch
27079 @opindex mbig-switch
27080 Generate code suitable for big switch tables. Use this option only if
27081 the assembler/linker complain about out of range branches within a switch
27082 table.
27083
27084 @item -mapp-regs
27085 @opindex mapp-regs
27086 This option causes r2 and r5 to be used in the code generated by
27087 the compiler. This setting is the default.
27088
27089 @item -mno-app-regs
27090 @opindex mno-app-regs
27091 This option causes r2 and r5 to be treated as fixed registers.
27092
27093 @end table
27094
27095 @node VAX Options
27096 @subsection VAX Options
27097 @cindex VAX options
27098
27099 These @samp{-m} options are defined for the VAX:
27100
27101 @table @gcctabopt
27102 @item -munix
27103 @opindex munix
27104 Do not output certain jump instructions (@code{aobleq} and so on)
27105 that the Unix assembler for the VAX cannot handle across long
27106 ranges.
27107
27108 @item -mgnu
27109 @opindex mgnu
27110 Do output those jump instructions, on the assumption that the
27111 GNU assembler is being used.
27112
27113 @item -mg
27114 @opindex mg
27115 Output code for G-format floating-point numbers instead of D-format.
27116 @end table
27117
27118 @node Visium Options
27119 @subsection Visium Options
27120 @cindex Visium options
27121
27122 @table @gcctabopt
27123
27124 @item -mdebug
27125 @opindex mdebug
27126 A program which performs file I/O and is destined to run on an MCM target
27127 should be linked with this option. It causes the libraries libc.a and
27128 libdebug.a to be linked. The program should be run on the target under
27129 the control of the GDB remote debugging stub.
27130
27131 @item -msim
27132 @opindex msim
27133 A program which performs file I/O and is destined to run on the simulator
27134 should be linked with option. This causes libraries libc.a and libsim.a to
27135 be linked.
27136
27137 @item -mfpu
27138 @itemx -mhard-float
27139 @opindex mfpu
27140 @opindex mhard-float
27141 Generate code containing floating-point instructions. This is the
27142 default.
27143
27144 @item -mno-fpu
27145 @itemx -msoft-float
27146 @opindex mno-fpu
27147 @opindex msoft-float
27148 Generate code containing library calls for floating-point.
27149
27150 @option{-msoft-float} changes the calling convention in the output file;
27151 therefore, it is only useful if you compile @emph{all} of a program with
27152 this option. In particular, you need to compile @file{libgcc.a}, the
27153 library that comes with GCC, with @option{-msoft-float} in order for
27154 this to work.
27155
27156 @item -mcpu=@var{cpu_type}
27157 @opindex mcpu
27158 Set the instruction set, register set, and instruction scheduling parameters
27159 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27160 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27161
27162 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27163
27164 By default (unless configured otherwise), GCC generates code for the GR5
27165 variant of the Visium architecture.
27166
27167 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27168 architecture. The only difference from GR5 code is that the compiler will
27169 generate block move instructions.
27170
27171 @item -mtune=@var{cpu_type}
27172 @opindex mtune
27173 Set the instruction scheduling parameters for machine type @var{cpu_type},
27174 but do not set the instruction set or register set that the option
27175 @option{-mcpu=@var{cpu_type}} would.
27176
27177 @item -msv-mode
27178 @opindex msv-mode
27179 Generate code for the supervisor mode, where there are no restrictions on
27180 the access to general registers. This is the default.
27181
27182 @item -muser-mode
27183 @opindex muser-mode
27184 Generate code for the user mode, where the access to some general registers
27185 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27186 mode; on the GR6, only registers r29 to r31 are affected.
27187 @end table
27188
27189 @node VMS Options
27190 @subsection VMS Options
27191
27192 These @samp{-m} options are defined for the VMS implementations:
27193
27194 @table @gcctabopt
27195 @item -mvms-return-codes
27196 @opindex mvms-return-codes
27197 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27198 condition (e.g.@: error) codes.
27199
27200 @item -mdebug-main=@var{prefix}
27201 @opindex mdebug-main=@var{prefix}
27202 Flag the first routine whose name starts with @var{prefix} as the main
27203 routine for the debugger.
27204
27205 @item -mmalloc64
27206 @opindex mmalloc64
27207 Default to 64-bit memory allocation routines.
27208
27209 @item -mpointer-size=@var{size}
27210 @opindex mpointer-size=@var{size}
27211 Set the default size of pointers. Possible options for @var{size} are
27212 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27213 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27214 The later option disables @code{pragma pointer_size}.
27215 @end table
27216
27217 @node VxWorks Options
27218 @subsection VxWorks Options
27219 @cindex VxWorks Options
27220
27221 The options in this section are defined for all VxWorks targets.
27222 Options specific to the target hardware are listed with the other
27223 options for that target.
27224
27225 @table @gcctabopt
27226 @item -mrtp
27227 @opindex mrtp
27228 GCC can generate code for both VxWorks kernels and real time processes
27229 (RTPs). This option switches from the former to the latter. It also
27230 defines the preprocessor macro @code{__RTP__}.
27231
27232 @item -non-static
27233 @opindex non-static
27234 Link an RTP executable against shared libraries rather than static
27235 libraries. The options @option{-static} and @option{-shared} can
27236 also be used for RTPs (@pxref{Link Options}); @option{-static}
27237 is the default.
27238
27239 @item -Bstatic
27240 @itemx -Bdynamic
27241 @opindex Bstatic
27242 @opindex Bdynamic
27243 These options are passed down to the linker. They are defined for
27244 compatibility with Diab.
27245
27246 @item -Xbind-lazy
27247 @opindex Xbind-lazy
27248 Enable lazy binding of function calls. This option is equivalent to
27249 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27250
27251 @item -Xbind-now
27252 @opindex Xbind-now
27253 Disable lazy binding of function calls. This option is the default and
27254 is defined for compatibility with Diab.
27255 @end table
27256
27257 @node x86 Options
27258 @subsection x86 Options
27259 @cindex x86 Options
27260
27261 These @samp{-m} options are defined for the x86 family of computers.
27262
27263 @table @gcctabopt
27264
27265 @item -march=@var{cpu-type}
27266 @opindex march
27267 Generate instructions for the machine type @var{cpu-type}. In contrast to
27268 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27269 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27270 to generate code that may not run at all on processors other than the one
27271 indicated. Specifying @option{-march=@var{cpu-type}} implies
27272 @option{-mtune=@var{cpu-type}}.
27273
27274 The choices for @var{cpu-type} are:
27275
27276 @table @samp
27277 @item native
27278 This selects the CPU to generate code for at compilation time by determining
27279 the processor type of the compiling machine. Using @option{-march=native}
27280 enables all instruction subsets supported by the local machine (hence
27281 the result might not run on different machines). Using @option{-mtune=native}
27282 produces code optimized for the local machine under the constraints
27283 of the selected instruction set.
27284
27285 @item x86-64
27286 A generic CPU with 64-bit extensions.
27287
27288 @item i386
27289 Original Intel i386 CPU@.
27290
27291 @item i486
27292 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27293
27294 @item i586
27295 @itemx pentium
27296 Intel Pentium CPU with no MMX support.
27297
27298 @item lakemont
27299 Intel Lakemont MCU, based on Intel Pentium CPU.
27300
27301 @item pentium-mmx
27302 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27303
27304 @item pentiumpro
27305 Intel Pentium Pro CPU@.
27306
27307 @item i686
27308 When used with @option{-march}, the Pentium Pro
27309 instruction set is used, so the code runs on all i686 family chips.
27310 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27311
27312 @item pentium2
27313 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27314 support.
27315
27316 @item pentium3
27317 @itemx pentium3m
27318 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27319 set support.
27320
27321 @item pentium-m
27322 Intel Pentium M; low-power version of Intel Pentium III CPU
27323 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27324
27325 @item pentium4
27326 @itemx pentium4m
27327 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27328
27329 @item prescott
27330 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27331 set support.
27332
27333 @item nocona
27334 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27335 SSE2 and SSE3 instruction set support.
27336
27337 @item core2
27338 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27339 instruction set support.
27340
27341 @item nehalem
27342 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27343 SSE4.1, SSE4.2 and POPCNT instruction set support.
27344
27345 @item westmere
27346 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27347 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27348
27349 @item sandybridge
27350 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27351 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27352
27353 @item ivybridge
27354 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27355 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27356 instruction set support.
27357
27358 @item haswell
27359 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27360 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27361 BMI, BMI2 and F16C instruction set support.
27362
27363 @item broadwell
27364 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27365 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27366 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27367
27368 @item skylake
27369 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27370 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27371 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27372 XSAVES instruction set support.
27373
27374 @item bonnell
27375 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27376 instruction set support.
27377
27378 @item silvermont
27379 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27380 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27381
27382 @item goldmont
27383 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27384 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27385 instruction set support.
27386
27387 @item goldmont-plus
27388 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27389 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27390 PTWRITE, RDPID, SGX and UMIP instruction set support.
27391
27392 @item tremont
27393 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27394 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27395 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27396
27397 @item knl
27398 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27399 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27400 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27401 AVX512CD instruction set support.
27402
27403 @item knm
27404 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27405 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27406 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27407 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27408
27409 @item skylake-avx512
27410 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27411 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27412 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27413 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27414
27415 @item cannonlake
27416 Intel Cannonlake Server 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 and UMIP instruction set support.
27421
27422 @item icelake-client
27423 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27424 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27425 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27426 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27427 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27428 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27429
27430 @item icelake-server
27431 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27432 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27433 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27434 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27435 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27436 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27437 set support.
27438
27439 @item k6
27440 AMD K6 CPU with MMX instruction set support.
27441
27442 @item k6-2
27443 @itemx k6-3
27444 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27445
27446 @item athlon
27447 @itemx athlon-tbird
27448 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27449 support.
27450
27451 @item athlon-4
27452 @itemx athlon-xp
27453 @itemx athlon-mp
27454 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27455 instruction set support.
27456
27457 @item k8
27458 @itemx opteron
27459 @itemx athlon64
27460 @itemx athlon-fx
27461 Processors based on the AMD K8 core with x86-64 instruction set support,
27462 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27463 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27464 instruction set extensions.)
27465
27466 @item k8-sse3
27467 @itemx opteron-sse3
27468 @itemx athlon64-sse3
27469 Improved versions of AMD K8 cores with SSE3 instruction set support.
27470
27471 @item amdfam10
27472 @itemx barcelona
27473 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27474 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27475 instruction set extensions.)
27476
27477 @item bdver1
27478 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27479 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27480 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27481 @item bdver2
27482 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27483 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
27484 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27485 extensions.)
27486 @item bdver3
27487 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27488 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27489 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27490 64-bit instruction set extensions.
27491 @item bdver4
27492 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27493 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27494 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27495 SSE4.2, ABM and 64-bit instruction set extensions.
27496
27497 @item znver1
27498 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27499 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27500 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27501 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27502 instruction set extensions.
27503 @item znver2
27504 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27505 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27506 MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27507 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27508 instruction set extensions.)
27509
27510
27511 @item btver1
27512 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27513 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27514 instruction set extensions.)
27515
27516 @item btver2
27517 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27518 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27519 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27520
27521 @item winchip-c6
27522 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27523 set support.
27524
27525 @item winchip2
27526 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27527 instruction set support.
27528
27529 @item c3
27530 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27531 (No scheduling is implemented for this chip.)
27532
27533 @item c3-2
27534 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27535 (No scheduling is implemented for this chip.)
27536
27537 @item c7
27538 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27539 (No scheduling is implemented for this chip.)
27540
27541 @item samuel-2
27542 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27543 (No scheduling is implemented for this chip.)
27544
27545 @item nehemiah
27546 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27547 (No scheduling is implemented for this chip.)
27548
27549 @item esther
27550 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27551 (No scheduling is implemented for this chip.)
27552
27553 @item eden-x2
27554 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27555 (No scheduling is implemented for this chip.)
27556
27557 @item eden-x4
27558 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27559 AVX and AVX2 instruction set support.
27560 (No scheduling is implemented for this chip.)
27561
27562 @item nano
27563 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27564 instruction set support.
27565 (No scheduling is implemented for this chip.)
27566
27567 @item nano-1000
27568 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27569 instruction set support.
27570 (No scheduling is implemented for this chip.)
27571
27572 @item nano-2000
27573 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27574 instruction set support.
27575 (No scheduling is implemented for this chip.)
27576
27577 @item nano-3000
27578 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27579 instruction set support.
27580 (No scheduling is implemented for this chip.)
27581
27582 @item nano-x2
27583 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27584 instruction set support.
27585 (No scheduling is implemented for this chip.)
27586
27587 @item nano-x4
27588 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27589 instruction set support.
27590 (No scheduling is implemented for this chip.)
27591
27592 @item geode
27593 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27594 @end table
27595
27596 @item -mtune=@var{cpu-type}
27597 @opindex mtune
27598 Tune to @var{cpu-type} everything applicable about the generated code, except
27599 for the ABI and the set of available instructions.
27600 While picking a specific @var{cpu-type} schedules things appropriately
27601 for that particular chip, the compiler does not generate any code that
27602 cannot run on the default machine type unless you use a
27603 @option{-march=@var{cpu-type}} option.
27604 For example, if GCC is configured for i686-pc-linux-gnu
27605 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27606 but still runs on i686 machines.
27607
27608 The choices for @var{cpu-type} are the same as for @option{-march}.
27609 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27610
27611 @table @samp
27612 @item generic
27613 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27614 If you know the CPU on which your code will run, then you should use
27615 the corresponding @option{-mtune} or @option{-march} option instead of
27616 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27617 of your application will have, then you should use this option.
27618
27619 As new processors are deployed in the marketplace, the behavior of this
27620 option will change. Therefore, if you upgrade to a newer version of
27621 GCC, code generation controlled by this option will change to reflect
27622 the processors
27623 that are most common at the time that version of GCC is released.
27624
27625 There is no @option{-march=generic} option because @option{-march}
27626 indicates the instruction set the compiler can use, and there is no
27627 generic instruction set applicable to all processors. In contrast,
27628 @option{-mtune} indicates the processor (or, in this case, collection of
27629 processors) for which the code is optimized.
27630
27631 @item intel
27632 Produce code optimized for the most current Intel processors, which are
27633 Haswell and Silvermont for this version of GCC. If you know the CPU
27634 on which your code will run, then you should use the corresponding
27635 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27636 But, if you want your application performs better on both Haswell and
27637 Silvermont, then you should use this option.
27638
27639 As new Intel processors are deployed in the marketplace, the behavior of
27640 this option will change. Therefore, if you upgrade to a newer version of
27641 GCC, code generation controlled by this option will change to reflect
27642 the most current Intel processors at the time that version of GCC is
27643 released.
27644
27645 There is no @option{-march=intel} option because @option{-march} indicates
27646 the instruction set the compiler can use, and there is no common
27647 instruction set applicable to all processors. In contrast,
27648 @option{-mtune} indicates the processor (or, in this case, collection of
27649 processors) for which the code is optimized.
27650 @end table
27651
27652 @item -mcpu=@var{cpu-type}
27653 @opindex mcpu
27654 A deprecated synonym for @option{-mtune}.
27655
27656 @item -mfpmath=@var{unit}
27657 @opindex mfpmath
27658 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27659 for @var{unit} are:
27660
27661 @table @samp
27662 @item 387
27663 Use the standard 387 floating-point coprocessor present on the majority of chips and
27664 emulated otherwise. Code compiled with this option runs almost everywhere.
27665 The temporary results are computed in 80-bit precision instead of the precision
27666 specified by the type, resulting in slightly different results compared to most
27667 of other chips. See @option{-ffloat-store} for more detailed description.
27668
27669 This is the default choice for non-Darwin x86-32 targets.
27670
27671 @item sse
27672 Use scalar floating-point instructions present in the SSE instruction set.
27673 This instruction set is supported by Pentium III and newer chips,
27674 and in the AMD line
27675 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27676 instruction set supports only single-precision arithmetic, thus the double and
27677 extended-precision arithmetic are still done using 387. A later version, present
27678 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27679 arithmetic too.
27680
27681 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27682 or @option{-msse2} switches to enable SSE extensions and make this option
27683 effective. For the x86-64 compiler, these extensions are enabled by default.
27684
27685 The resulting code should be considerably faster in the majority of cases and avoid
27686 the numerical instability problems of 387 code, but may break some existing
27687 code that expects temporaries to be 80 bits.
27688
27689 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27690 and the default choice for x86-32 targets with the SSE2 instruction set
27691 when @option{-ffast-math} is enabled.
27692
27693 @item sse,387
27694 @itemx sse+387
27695 @itemx both
27696 Attempt to utilize both instruction sets at once. This effectively doubles the
27697 amount of available registers, and on chips with separate execution units for
27698 387 and SSE the execution resources too. Use this option with care, as it is
27699 still experimental, because the GCC register allocator does not model separate
27700 functional units well, resulting in unstable performance.
27701 @end table
27702
27703 @item -masm=@var{dialect}
27704 @opindex masm=@var{dialect}
27705 Output assembly instructions using selected @var{dialect}. Also affects
27706 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27707 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27708 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27709 not support @samp{intel}.
27710
27711 @item -mieee-fp
27712 @itemx -mno-ieee-fp
27713 @opindex mieee-fp
27714 @opindex mno-ieee-fp
27715 Control whether or not the compiler uses IEEE floating-point
27716 comparisons. These correctly handle the case where the result of a
27717 comparison is unordered.
27718
27719 @item -m80387
27720 @itemx -mhard-float
27721 @opindex 80387
27722 @opindex mhard-float
27723 Generate output containing 80387 instructions for floating point.
27724
27725 @item -mno-80387
27726 @itemx -msoft-float
27727 @opindex no-80387
27728 @opindex msoft-float
27729 Generate output containing library calls for floating point.
27730
27731 @strong{Warning:} the requisite libraries are not part of GCC@.
27732 Normally the facilities of the machine's usual C compiler are used, but
27733 this cannot be done directly in cross-compilation. You must make your
27734 own arrangements to provide suitable library functions for
27735 cross-compilation.
27736
27737 On machines where a function returns floating-point results in the 80387
27738 register stack, some floating-point opcodes may be emitted even if
27739 @option{-msoft-float} is used.
27740
27741 @item -mno-fp-ret-in-387
27742 @opindex mno-fp-ret-in-387
27743 @opindex mfp-ret-in-387
27744 Do not use the FPU registers for return values of functions.
27745
27746 The usual calling convention has functions return values of types
27747 @code{float} and @code{double} in an FPU register, even if there
27748 is no FPU@. The idea is that the operating system should emulate
27749 an FPU@.
27750
27751 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27752 in ordinary CPU registers instead.
27753
27754 @item -mno-fancy-math-387
27755 @opindex mno-fancy-math-387
27756 @opindex mfancy-math-387
27757 Some 387 emulators do not support the @code{sin}, @code{cos} and
27758 @code{sqrt} instructions for the 387. Specify this option to avoid
27759 generating those instructions.
27760 This option is overridden when @option{-march}
27761 indicates that the target CPU always has an FPU and so the
27762 instruction does not need emulation. These
27763 instructions are not generated unless you also use the
27764 @option{-funsafe-math-optimizations} switch.
27765
27766 @item -malign-double
27767 @itemx -mno-align-double
27768 @opindex malign-double
27769 @opindex mno-align-double
27770 Control whether GCC aligns @code{double}, @code{long double}, and
27771 @code{long long} variables on a two-word boundary or a one-word
27772 boundary. Aligning @code{double} variables on a two-word boundary
27773 produces code that runs somewhat faster on a Pentium at the
27774 expense of more memory.
27775
27776 On x86-64, @option{-malign-double} is enabled by default.
27777
27778 @strong{Warning:} if you use the @option{-malign-double} switch,
27779 structures containing the above types are aligned differently than
27780 the published application binary interface specifications for the x86-32
27781 and are not binary compatible with structures in code compiled
27782 without that switch.
27783
27784 @item -m96bit-long-double
27785 @itemx -m128bit-long-double
27786 @opindex m96bit-long-double
27787 @opindex m128bit-long-double
27788 These switches control the size of @code{long double} type. The x86-32
27789 application binary interface specifies the size to be 96 bits,
27790 so @option{-m96bit-long-double} is the default in 32-bit mode.
27791
27792 Modern architectures (Pentium and newer) prefer @code{long double}
27793 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27794 conforming to the ABI, this is not possible. So specifying
27795 @option{-m128bit-long-double} aligns @code{long double}
27796 to a 16-byte boundary by padding the @code{long double} with an additional
27797 32-bit zero.
27798
27799 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27800 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27801
27802 Notice that neither of these options enable any extra precision over the x87
27803 standard of 80 bits for a @code{long double}.
27804
27805 @strong{Warning:} if you override the default value for your target ABI, this
27806 changes the size of
27807 structures and arrays containing @code{long double} variables,
27808 as well as modifying the function calling convention for functions taking
27809 @code{long double}. Hence they are not binary-compatible
27810 with code compiled without that switch.
27811
27812 @item -mlong-double-64
27813 @itemx -mlong-double-80
27814 @itemx -mlong-double-128
27815 @opindex mlong-double-64
27816 @opindex mlong-double-80
27817 @opindex mlong-double-128
27818 These switches control the size of @code{long double} type. A size
27819 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27820 type. This is the default for 32-bit Bionic C library. A size
27821 of 128 bits makes the @code{long double} type equivalent to the
27822 @code{__float128} type. This is the default for 64-bit Bionic C library.
27823
27824 @strong{Warning:} if you override the default value for your target ABI, this
27825 changes the size of
27826 structures and arrays containing @code{long double} variables,
27827 as well as modifying the function calling convention for functions taking
27828 @code{long double}. Hence they are not binary-compatible
27829 with code compiled without that switch.
27830
27831 @item -malign-data=@var{type}
27832 @opindex malign-data
27833 Control how GCC aligns variables. Supported values for @var{type} are
27834 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27835 and earlier, @samp{abi} uses alignment value as specified by the
27836 psABI, and @samp{cacheline} uses increased alignment value to match
27837 the cache line size. @samp{compat} is the default.
27838
27839 @item -mlarge-data-threshold=@var{threshold}
27840 @opindex mlarge-data-threshold
27841 When @option{-mcmodel=medium} is specified, data objects larger than
27842 @var{threshold} are placed in the large data section. This value must be the
27843 same across all objects linked into the binary, and defaults to 65535.
27844
27845 @item -mrtd
27846 @opindex mrtd
27847 Use a different function-calling convention, in which functions that
27848 take a fixed number of arguments return with the @code{ret @var{num}}
27849 instruction, which pops their arguments while returning. This saves one
27850 instruction in the caller since there is no need to pop the arguments
27851 there.
27852
27853 You can specify that an individual function is called with this calling
27854 sequence with the function attribute @code{stdcall}. You can also
27855 override the @option{-mrtd} option by using the function attribute
27856 @code{cdecl}. @xref{Function Attributes}.
27857
27858 @strong{Warning:} this calling convention is incompatible with the one
27859 normally used on Unix, so you cannot use it if you need to call
27860 libraries compiled with the Unix compiler.
27861
27862 Also, you must provide function prototypes for all functions that
27863 take variable numbers of arguments (including @code{printf});
27864 otherwise incorrect code is generated for calls to those
27865 functions.
27866
27867 In addition, seriously incorrect code results if you call a
27868 function with too many arguments. (Normally, extra arguments are
27869 harmlessly ignored.)
27870
27871 @item -mregparm=@var{num}
27872 @opindex mregparm
27873 Control how many registers are used to pass integer arguments. By
27874 default, no registers are used to pass arguments, and at most 3
27875 registers can be used. You can control this behavior for a specific
27876 function by using the function attribute @code{regparm}.
27877 @xref{Function Attributes}.
27878
27879 @strong{Warning:} if you use this switch, and
27880 @var{num} is nonzero, then you must build all modules with the same
27881 value, including any libraries. This includes the system libraries and
27882 startup modules.
27883
27884 @item -msseregparm
27885 @opindex msseregparm
27886 Use SSE register passing conventions for float and double arguments
27887 and return values. You can control this behavior for a specific
27888 function by using the function attribute @code{sseregparm}.
27889 @xref{Function Attributes}.
27890
27891 @strong{Warning:} if you use this switch then you must build all
27892 modules with the same value, including any libraries. This includes
27893 the system libraries and startup modules.
27894
27895 @item -mvect8-ret-in-mem
27896 @opindex mvect8-ret-in-mem
27897 Return 8-byte vectors in memory instead of MMX registers. This is the
27898 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
27899 Studio compilers until version 12. Later compiler versions (starting
27900 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
27901 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
27902 you need to remain compatible with existing code produced by those
27903 previous compiler versions or older versions of GCC@.
27904
27905 @item -mpc32
27906 @itemx -mpc64
27907 @itemx -mpc80
27908 @opindex mpc32
27909 @opindex mpc64
27910 @opindex mpc80
27911
27912 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27913 is specified, the significands of results of floating-point operations are
27914 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27915 significands of results of floating-point operations to 53 bits (double
27916 precision) and @option{-mpc80} rounds the significands of results of
27917 floating-point operations to 64 bits (extended double precision), which is
27918 the default. When this option is used, floating-point operations in higher
27919 precisions are not available to the programmer without setting the FPU
27920 control word explicitly.
27921
27922 Setting the rounding of floating-point operations to less than the default
27923 80 bits can speed some programs by 2% or more. Note that some mathematical
27924 libraries assume that extended-precision (80-bit) floating-point operations
27925 are enabled by default; routines in such libraries could suffer significant
27926 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27927 when this option is used to set the precision to less than extended precision.
27928
27929 @item -mstackrealign
27930 @opindex mstackrealign
27931 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27932 option generates an alternate prologue and epilogue that realigns the
27933 run-time stack if necessary. This supports mixing legacy codes that keep
27934 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27935 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27936 applicable to individual functions.
27937
27938 @item -mpreferred-stack-boundary=@var{num}
27939 @opindex mpreferred-stack-boundary
27940 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27941 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27942 the default is 4 (16 bytes or 128 bits).
27943
27944 @strong{Warning:} When generating code for the x86-64 architecture with
27945 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27946 used to keep the stack boundary aligned to 8 byte boundary. Since
27947 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27948 intended to be used in controlled environment where stack space is
27949 important limitation. This option leads to wrong code when functions
27950 compiled with 16 byte stack alignment (such as functions from a standard
27951 library) are called with misaligned stack. In this case, SSE
27952 instructions may lead to misaligned memory access traps. In addition,
27953 variable arguments are handled incorrectly for 16 byte aligned
27954 objects (including x87 long double and __int128), leading to wrong
27955 results. You must build all modules with
27956 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27957 includes the system libraries and startup modules.
27958
27959 @item -mincoming-stack-boundary=@var{num}
27960 @opindex mincoming-stack-boundary
27961 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27962 boundary. If @option{-mincoming-stack-boundary} is not specified,
27963 the one specified by @option{-mpreferred-stack-boundary} is used.
27964
27965 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27966 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27967 suffer significant run time performance penalties. On Pentium III, the
27968 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27969 properly if it is not 16-byte aligned.
27970
27971 To ensure proper alignment of this values on the stack, the stack boundary
27972 must be as aligned as that required by any value stored on the stack.
27973 Further, every function must be generated such that it keeps the stack
27974 aligned. Thus calling a function compiled with a higher preferred
27975 stack boundary from a function compiled with a lower preferred stack
27976 boundary most likely misaligns the stack. It is recommended that
27977 libraries that use callbacks always use the default setting.
27978
27979 This extra alignment does consume extra stack space, and generally
27980 increases code size. Code that is sensitive to stack space usage, such
27981 as embedded systems and operating system kernels, may want to reduce the
27982 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27983
27984 @need 200
27985 @item -mmmx
27986 @opindex mmmx
27987 @need 200
27988 @itemx -msse
27989 @opindex msse
27990 @need 200
27991 @itemx -msse2
27992 @opindex msse2
27993 @need 200
27994 @itemx -msse3
27995 @opindex msse3
27996 @need 200
27997 @itemx -mssse3
27998 @opindex mssse3
27999 @need 200
28000 @itemx -msse4
28001 @opindex msse4
28002 @need 200
28003 @itemx -msse4a
28004 @opindex msse4a
28005 @need 200
28006 @itemx -msse4.1
28007 @opindex msse4.1
28008 @need 200
28009 @itemx -msse4.2
28010 @opindex msse4.2
28011 @need 200
28012 @itemx -mavx
28013 @opindex mavx
28014 @need 200
28015 @itemx -mavx2
28016 @opindex mavx2
28017 @need 200
28018 @itemx -mavx512f
28019 @opindex mavx512f
28020 @need 200
28021 @itemx -mavx512pf
28022 @opindex mavx512pf
28023 @need 200
28024 @itemx -mavx512er
28025 @opindex mavx512er
28026 @need 200
28027 @itemx -mavx512cd
28028 @opindex mavx512cd
28029 @need 200
28030 @itemx -mavx512vl
28031 @opindex mavx512vl
28032 @need 200
28033 @itemx -mavx512bw
28034 @opindex mavx512bw
28035 @need 200
28036 @itemx -mavx512dq
28037 @opindex mavx512dq
28038 @need 200
28039 @itemx -mavx512ifma
28040 @opindex mavx512ifma
28041 @need 200
28042 @itemx -mavx512vbmi
28043 @opindex mavx512vbmi
28044 @need 200
28045 @itemx -msha
28046 @opindex msha
28047 @need 200
28048 @itemx -maes
28049 @opindex maes
28050 @need 200
28051 @itemx -mpclmul
28052 @opindex mpclmul
28053 @need 200
28054 @itemx -mclflushopt
28055 @opindex mclflushopt
28056 @need 200
28057 @itemx -mfsgsbase
28058 @opindex mfsgsbase
28059 @need 200
28060 @itemx -mptwrite
28061 @opindex mptwrite
28062 @need 200
28063 @itemx -mrdrnd
28064 @opindex mrdrnd
28065 @need 200
28066 @itemx -mf16c
28067 @opindex mf16c
28068 @need 200
28069 @itemx -mfma
28070 @opindex mfma
28071 @need 200
28072 @itemx -mpconfig
28073 @opindex mpconfig
28074 @need 200
28075 @itemx -mwbnoinvd
28076 @opindex mwbnoinvd
28077 @need 200
28078 @itemx -mfma4
28079 @opindex mfma4
28080 @need 200
28081 @itemx -mprefetchwt1
28082 @opindex mprefetchwt1
28083 @need 200
28084 @itemx -mxop
28085 @opindex mxop
28086 @need 200
28087 @itemx -mlwp
28088 @opindex mlwp
28089 @need 200
28090 @itemx -m3dnow
28091 @opindex m3dnow
28092 @need 200
28093 @itemx -m3dnowa
28094 @opindex m3dnowa
28095 @need 200
28096 @itemx -mpopcnt
28097 @opindex mpopcnt
28098 @need 200
28099 @itemx -mabm
28100 @opindex mabm
28101 @need 200
28102 @itemx -mbmi
28103 @opindex mbmi
28104 @need 200
28105 @itemx -mbmi2
28106 @need 200
28107 @itemx -mlzcnt
28108 @opindex mlzcnt
28109 @need 200
28110 @itemx -mfxsr
28111 @opindex mfxsr
28112 @need 200
28113 @itemx -mxsave
28114 @opindex mxsave
28115 @need 200
28116 @itemx -mxsaveopt
28117 @opindex mxsaveopt
28118 @need 200
28119 @itemx -mxsavec
28120 @opindex mxsavec
28121 @need 200
28122 @itemx -mxsaves
28123 @opindex mxsaves
28124 @need 200
28125 @itemx -mrtm
28126 @opindex mrtm
28127 @need 200
28128 @itemx -mtbm
28129 @opindex mtbm
28130 @need 200
28131 @itemx -mmwaitx
28132 @opindex mmwaitx
28133 @need 200
28134 @itemx -mclzero
28135 @opindex mclzero
28136 @need 200
28137 @itemx -mpku
28138 @opindex mpku
28139 @need 200
28140 @itemx -mavx512vbmi2
28141 @opindex mavx512vbmi2
28142 @need 200
28143 @itemx -mgfni
28144 @opindex mgfni
28145 @need 200
28146 @itemx -mvaes
28147 @opindex mvaes
28148 @need 200
28149 @itemx -mwaitpkg
28150 @opindex mwaitpkg
28151 @need 200
28152 @itemx -mvpclmulqdq
28153 @opindex mvpclmulqdq
28154 @need 200
28155 @itemx -mavx512bitalg
28156 @opindex mavx512bitalg
28157 @need 200
28158 @itemx -mmovdiri
28159 @opindex mmovdiri
28160 @need 200
28161 @itemx -mmovdir64b
28162 @opindex mmovdir64b
28163 @need 200
28164 @itemx -mavx512vpopcntdq
28165 @opindex mavx512vpopcntdq
28166 @need 200
28167 @itemx -mcldemote
28168 @opindex mcldemote
28169 These switches enable the use of instructions in the MMX, SSE,
28170 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
28171 SHA, AES, PCLMUL, FSGSBASE, PTWRITE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
28172 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES, WAITPKG,
28173 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
28174 GFNI, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
28175 AVX512VPOPCNTDQ, CLDEMOTE, 3DNow!@: or enhanced 3DNow!@: extended instruction
28176 sets. Each has a corresponding @option{-mno-} option to disable use of these
28177 instructions.
28178
28179 These extensions are also available as built-in functions: see
28180 @ref{x86 Built-in Functions}, for details of the functions enabled and
28181 disabled by these switches.
28182
28183 To generate SSE/SSE2 instructions automatically from floating-point
28184 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28185
28186 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28187 generates new AVX instructions or AVX equivalence for all SSEx instructions
28188 when needed.
28189
28190 These options enable GCC to use these extended instructions in
28191 generated code, even without @option{-mfpmath=sse}. Applications that
28192 perform run-time CPU detection must compile separate files for each
28193 supported architecture, using the appropriate flags. In particular,
28194 the file containing the CPU detection code should be compiled without
28195 these options.
28196
28197 @item -mdump-tune-features
28198 @opindex mdump-tune-features
28199 This option instructs GCC to dump the names of the x86 performance
28200 tuning features and default settings. The names can be used in
28201 @option{-mtune-ctrl=@var{feature-list}}.
28202
28203 @item -mtune-ctrl=@var{feature-list}
28204 @opindex mtune-ctrl=@var{feature-list}
28205 This option is used to do fine grain control of x86 code generation features.
28206 @var{feature-list} is a comma separated list of @var{feature} names. See also
28207 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28208 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28209 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28210 developers. Using it may lead to code paths not covered by testing and can
28211 potentially result in compiler ICEs or runtime errors.
28212
28213 @item -mno-default
28214 @opindex mno-default
28215 This option instructs GCC to turn off all tunable features. See also
28216 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28217
28218 @item -mcld
28219 @opindex mcld
28220 This option instructs GCC to emit a @code{cld} instruction in the prologue
28221 of functions that use string instructions. String instructions depend on
28222 the DF flag to select between autoincrement or autodecrement mode. While the
28223 ABI specifies the DF flag to be cleared on function entry, some operating
28224 systems violate this specification by not clearing the DF flag in their
28225 exception dispatchers. The exception handler can be invoked with the DF flag
28226 set, which leads to wrong direction mode when string instructions are used.
28227 This option can be enabled by default on 32-bit x86 targets by configuring
28228 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28229 instructions can be suppressed with the @option{-mno-cld} compiler option
28230 in this case.
28231
28232 @item -mvzeroupper
28233 @opindex mvzeroupper
28234 This option instructs GCC to emit a @code{vzeroupper} instruction
28235 before a transfer of control flow out of the function to minimize
28236 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28237 intrinsics.
28238
28239 @item -mprefer-avx128
28240 @opindex mprefer-avx128
28241 This option instructs GCC to use 128-bit AVX instructions instead of
28242 256-bit AVX instructions in the auto-vectorizer.
28243
28244 @item -mprefer-vector-width=@var{opt}
28245 @opindex mprefer-vector-width
28246 This option instructs GCC to use @var{opt}-bit vector width in instructions
28247 instead of default on the selected platform.
28248
28249 @table @samp
28250 @item none
28251 No extra limitations applied to GCC other than defined by the selected platform.
28252
28253 @item 128
28254 Prefer 128-bit vector width for instructions.
28255
28256 @item 256
28257 Prefer 256-bit vector width for instructions.
28258
28259 @item 512
28260 Prefer 512-bit vector width for instructions.
28261 @end table
28262
28263 @item -mcx16
28264 @opindex mcx16
28265 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28266 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28267 objects. This is useful for atomic updates of data structures exceeding one
28268 machine word in size. The compiler uses this instruction to implement
28269 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28270 128-bit integers, a library call is always used.
28271
28272 @item -msahf
28273 @opindex msahf
28274 This option enables generation of @code{SAHF} instructions in 64-bit code.
28275 Early Intel Pentium 4 CPUs with Intel 64 support,
28276 prior to the introduction of Pentium 4 G1 step in December 2005,
28277 lacked the @code{LAHF} and @code{SAHF} instructions
28278 which are supported by AMD64.
28279 These are load and store instructions, respectively, for certain status flags.
28280 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28281 @code{drem}, and @code{remainder} built-in functions;
28282 see @ref{Other Builtins} for details.
28283
28284 @item -mmovbe
28285 @opindex mmovbe
28286 This option enables use of the @code{movbe} instruction to implement
28287 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28288
28289 @item -mshstk
28290 @opindex mshstk
28291 The @option{-mshstk} option enables shadow stack built-in functions
28292 from x86 Control-flow Enforcement Technology (CET).
28293
28294 @item -mcrc32
28295 @opindex mcrc32
28296 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28297 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28298 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28299
28300 @item -mrecip
28301 @opindex mrecip
28302 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28303 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28304 with an additional Newton-Raphson step
28305 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28306 (and their vectorized
28307 variants) for single-precision floating-point arguments. These instructions
28308 are generated only when @option{-funsafe-math-optimizations} is enabled
28309 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28310 Note that while the throughput of the sequence is higher than the throughput
28311 of the non-reciprocal instruction, the precision of the sequence can be
28312 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28313
28314 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28315 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28316 combination), and doesn't need @option{-mrecip}.
28317
28318 Also note that GCC emits the above sequence with additional Newton-Raphson step
28319 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28320 already with @option{-ffast-math} (or the above option combination), and
28321 doesn't need @option{-mrecip}.
28322
28323 @item -mrecip=@var{opt}
28324 @opindex mrecip=opt
28325 This option controls which reciprocal estimate instructions
28326 may be used. @var{opt} is a comma-separated list of options, which may
28327 be preceded by a @samp{!} to invert the option:
28328
28329 @table @samp
28330 @item all
28331 Enable all estimate instructions.
28332
28333 @item default
28334 Enable the default instructions, equivalent to @option{-mrecip}.
28335
28336 @item none
28337 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28338
28339 @item div
28340 Enable the approximation for scalar division.
28341
28342 @item vec-div
28343 Enable the approximation for vectorized division.
28344
28345 @item sqrt
28346 Enable the approximation for scalar square root.
28347
28348 @item vec-sqrt
28349 Enable the approximation for vectorized square root.
28350 @end table
28351
28352 So, for example, @option{-mrecip=all,!sqrt} enables
28353 all of the reciprocal approximations, except for square root.
28354
28355 @item -mveclibabi=@var{type}
28356 @opindex mveclibabi
28357 Specifies the ABI type to use for vectorizing intrinsics using an
28358 external library. Supported values for @var{type} are @samp{svml}
28359 for the Intel short
28360 vector math library and @samp{acml} for the AMD math core library.
28361 To use this option, both @option{-ftree-vectorize} and
28362 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28363 ABI-compatible library must be specified at link time.
28364
28365 GCC currently emits calls to @code{vmldExp2},
28366 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28367 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28368 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28369 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28370 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28371 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28372 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28373 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28374 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28375 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28376 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28377 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28378 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28379 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28380 when @option{-mveclibabi=acml} is used.
28381
28382 @item -mabi=@var{name}
28383 @opindex mabi
28384 Generate code for the specified calling convention. Permissible values
28385 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28386 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28387 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28388 You can control this behavior for specific functions by
28389 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28390 @xref{Function Attributes}.
28391
28392 @item -mforce-indirect-call
28393 @opindex mforce-indirect-call
28394 Force all calls to functions to be indirect. This is useful
28395 when using Intel Processor Trace where it generates more precise timing
28396 information for function calls.
28397
28398 @item -mcall-ms2sysv-xlogues
28399 @opindex mcall-ms2sysv-xlogues
28400 @opindex mno-call-ms2sysv-xlogues
28401 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28402 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28403 default, the code for saving and restoring these registers is emitted inline,
28404 resulting in fairly lengthy prologues and epilogues. Using
28405 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28406 use stubs in the static portion of libgcc to perform these saves and restores,
28407 thus reducing function size at the cost of a few extra instructions.
28408
28409 @item -mtls-dialect=@var{type}
28410 @opindex mtls-dialect
28411 Generate code to access thread-local storage using the @samp{gnu} or
28412 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28413 @samp{gnu2} is more efficient, but it may add compile- and run-time
28414 requirements that cannot be satisfied on all systems.
28415
28416 @item -mpush-args
28417 @itemx -mno-push-args
28418 @opindex mpush-args
28419 @opindex mno-push-args
28420 Use PUSH operations to store outgoing parameters. This method is shorter
28421 and usually equally fast as method using SUB/MOV operations and is enabled
28422 by default. In some cases disabling it may improve performance because of
28423 improved scheduling and reduced dependencies.
28424
28425 @item -maccumulate-outgoing-args
28426 @opindex maccumulate-outgoing-args
28427 If enabled, the maximum amount of space required for outgoing arguments is
28428 computed in the function prologue. This is faster on most modern CPUs
28429 because of reduced dependencies, improved scheduling and reduced stack usage
28430 when the preferred stack boundary is not equal to 2. The drawback is a notable
28431 increase in code size. This switch implies @option{-mno-push-args}.
28432
28433 @item -mthreads
28434 @opindex mthreads
28435 Support thread-safe exception handling on MinGW. Programs that rely
28436 on thread-safe exception handling must compile and link all code with the
28437 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28438 @option{-D_MT}; when linking, it links in a special thread helper library
28439 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28440
28441 @item -mms-bitfields
28442 @itemx -mno-ms-bitfields
28443 @opindex mms-bitfields
28444 @opindex mno-ms-bitfields
28445
28446 Enable/disable bit-field layout compatible with the native Microsoft
28447 Windows compiler.
28448
28449 If @code{packed} is used on a structure, or if bit-fields are used,
28450 it may be that the Microsoft ABI lays out the structure differently
28451 than the way GCC normally does. Particularly when moving packed
28452 data between functions compiled with GCC and the native Microsoft compiler
28453 (either via function call or as data in a file), it may be necessary to access
28454 either format.
28455
28456 This option is enabled by default for Microsoft Windows
28457 targets. This behavior can also be controlled locally by use of variable
28458 or type attributes. For more information, see @ref{x86 Variable Attributes}
28459 and @ref{x86 Type Attributes}.
28460
28461 The Microsoft structure layout algorithm is fairly simple with the exception
28462 of the bit-field packing.
28463 The padding and alignment of members of structures and whether a bit-field
28464 can straddle a storage-unit boundary are determine by these rules:
28465
28466 @enumerate
28467 @item Structure members are stored sequentially in the order in which they are
28468 declared: the first member has the lowest memory address and the last member
28469 the highest.
28470
28471 @item Every data object has an alignment requirement. The alignment requirement
28472 for all data except structures, unions, and arrays is either the size of the
28473 object or the current packing size (specified with either the
28474 @code{aligned} attribute or the @code{pack} pragma),
28475 whichever is less. For structures, unions, and arrays,
28476 the alignment requirement is the largest alignment requirement of its members.
28477 Every object is allocated an offset so that:
28478
28479 @smallexample
28480 offset % alignment_requirement == 0
28481 @end smallexample
28482
28483 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28484 unit if the integral types are the same size and if the next bit-field fits
28485 into the current allocation unit without crossing the boundary imposed by the
28486 common alignment requirements of the bit-fields.
28487 @end enumerate
28488
28489 MSVC interprets zero-length bit-fields in the following ways:
28490
28491 @enumerate
28492 @item If a zero-length bit-field is inserted between two bit-fields that
28493 are normally coalesced, the bit-fields are not coalesced.
28494
28495 For example:
28496
28497 @smallexample
28498 struct
28499 @{
28500 unsigned long bf_1 : 12;
28501 unsigned long : 0;
28502 unsigned long bf_2 : 12;
28503 @} t1;
28504 @end smallexample
28505
28506 @noindent
28507 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28508 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28509
28510 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28511 alignment of the zero-length bit-field is greater than the member that follows it,
28512 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28513
28514 For example:
28515
28516 @smallexample
28517 struct
28518 @{
28519 char foo : 4;
28520 short : 0;
28521 char bar;
28522 @} t2;
28523
28524 struct
28525 @{
28526 char foo : 4;
28527 short : 0;
28528 double bar;
28529 @} t3;
28530 @end smallexample
28531
28532 @noindent
28533 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28534 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28535 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28536 of the structure.
28537
28538 Taking this into account, it is important to note the following:
28539
28540 @enumerate
28541 @item If a zero-length bit-field follows a normal bit-field, the type of the
28542 zero-length bit-field may affect the alignment of the structure as whole. For
28543 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28544 normal bit-field, and is of type short.
28545
28546 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28547 still affect the alignment of the structure:
28548
28549 @smallexample
28550 struct
28551 @{
28552 char foo : 6;
28553 long : 0;
28554 @} t4;
28555 @end smallexample
28556
28557 @noindent
28558 Here, @code{t4} takes up 4 bytes.
28559 @end enumerate
28560
28561 @item Zero-length bit-fields following non-bit-field members are ignored:
28562
28563 @smallexample
28564 struct
28565 @{
28566 char foo;
28567 long : 0;
28568 char bar;
28569 @} t5;
28570 @end smallexample
28571
28572 @noindent
28573 Here, @code{t5} takes up 2 bytes.
28574 @end enumerate
28575
28576
28577 @item -mno-align-stringops
28578 @opindex mno-align-stringops
28579 @opindex malign-stringops
28580 Do not align the destination of inlined string operations. This switch reduces
28581 code size and improves performance in case the destination is already aligned,
28582 but GCC doesn't know about it.
28583
28584 @item -minline-all-stringops
28585 @opindex minline-all-stringops
28586 By default GCC inlines string operations only when the destination is
28587 known to be aligned to least a 4-byte boundary.
28588 This enables more inlining and increases code
28589 size, but may improve performance of code that depends on fast
28590 @code{memcpy}, @code{strlen},
28591 and @code{memset} for short lengths.
28592
28593 @item -minline-stringops-dynamically
28594 @opindex minline-stringops-dynamically
28595 For string operations of unknown size, use run-time checks with
28596 inline code for small blocks and a library call for large blocks.
28597
28598 @item -mstringop-strategy=@var{alg}
28599 @opindex mstringop-strategy=@var{alg}
28600 Override the internal decision heuristic for the particular algorithm to use
28601 for inlining string operations. The allowed values for @var{alg} are:
28602
28603 @table @samp
28604 @item rep_byte
28605 @itemx rep_4byte
28606 @itemx rep_8byte
28607 Expand using i386 @code{rep} prefix of the specified size.
28608
28609 @item byte_loop
28610 @itemx loop
28611 @itemx unrolled_loop
28612 Expand into an inline loop.
28613
28614 @item libcall
28615 Always use a library call.
28616 @end table
28617
28618 @item -mmemcpy-strategy=@var{strategy}
28619 @opindex mmemcpy-strategy=@var{strategy}
28620 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28621 should be inlined and what inline algorithm to use when the expected size
28622 of the copy operation is known. @var{strategy}
28623 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28624 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28625 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28626 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28627 in the list must be specified in increasing order. The minimal byte size for
28628 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28629 preceding range.
28630
28631 @item -mmemset-strategy=@var{strategy}
28632 @opindex mmemset-strategy=@var{strategy}
28633 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28634 @code{__builtin_memset} expansion.
28635
28636 @item -momit-leaf-frame-pointer
28637 @opindex momit-leaf-frame-pointer
28638 Don't keep the frame pointer in a register for leaf functions. This
28639 avoids the instructions to save, set up, and restore frame pointers and
28640 makes an extra register available in leaf functions. The option
28641 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28642 which might make debugging harder.
28643
28644 @item -mtls-direct-seg-refs
28645 @itemx -mno-tls-direct-seg-refs
28646 @opindex mtls-direct-seg-refs
28647 Controls whether TLS variables may be accessed with offsets from the
28648 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28649 or whether the thread base pointer must be added. Whether or not this
28650 is valid depends on the operating system, and whether it maps the
28651 segment to cover the entire TLS area.
28652
28653 For systems that use the GNU C Library, the default is on.
28654
28655 @item -msse2avx
28656 @itemx -mno-sse2avx
28657 @opindex msse2avx
28658 Specify that the assembler should encode SSE instructions with VEX
28659 prefix. The option @option{-mavx} turns this on by default.
28660
28661 @item -mfentry
28662 @itemx -mno-fentry
28663 @opindex mfentry
28664 If profiling is active (@option{-pg}), put the profiling
28665 counter call before the prologue.
28666 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28667 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28668
28669 @item -mrecord-mcount
28670 @itemx -mno-record-mcount
28671 @opindex mrecord-mcount
28672 If profiling is active (@option{-pg}), generate a __mcount_loc section
28673 that contains pointers to each profiling call. This is useful for
28674 automatically patching and out calls.
28675
28676 @item -mnop-mcount
28677 @itemx -mno-nop-mcount
28678 @opindex mnop-mcount
28679 If profiling is active (@option{-pg}), generate the calls to
28680 the profiling functions as NOPs. This is useful when they
28681 should be patched in later dynamically. This is likely only
28682 useful together with @option{-mrecord-mcount}.
28683
28684 @item -mskip-rax-setup
28685 @itemx -mno-skip-rax-setup
28686 @opindex mskip-rax-setup
28687 When generating code for the x86-64 architecture with SSE extensions
28688 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28689 register when there are no variable arguments passed in vector registers.
28690
28691 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28692 saving vector registers on stack when passing variable arguments, the
28693 impacts of this option are callees may waste some stack space,
28694 misbehave or jump to a random location. GCC 4.4 or newer don't have
28695 those issues, regardless the RAX register value.
28696
28697 @item -m8bit-idiv
28698 @itemx -mno-8bit-idiv
28699 @opindex m8bit-idiv
28700 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28701 much faster than 32-bit/64-bit integer divide. This option generates a
28702 run-time check. If both dividend and divisor are within range of 0
28703 to 255, 8-bit unsigned integer divide is used instead of
28704 32-bit/64-bit integer divide.
28705
28706 @item -mavx256-split-unaligned-load
28707 @itemx -mavx256-split-unaligned-store
28708 @opindex mavx256-split-unaligned-load
28709 @opindex mavx256-split-unaligned-store
28710 Split 32-byte AVX unaligned load and store.
28711
28712 @item -mstack-protector-guard=@var{guard}
28713 @itemx -mstack-protector-guard-reg=@var{reg}
28714 @itemx -mstack-protector-guard-offset=@var{offset}
28715 @opindex mstack-protector-guard
28716 @opindex mstack-protector-guard-reg
28717 @opindex mstack-protector-guard-offset
28718 Generate stack protection code using canary at @var{guard}. Supported
28719 locations are @samp{global} for global canary or @samp{tls} for per-thread
28720 canary in the TLS block (the default). This option has effect only when
28721 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28722
28723 With the latter choice the options
28724 @option{-mstack-protector-guard-reg=@var{reg}} and
28725 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28726 which segment register (@code{%fs} or @code{%gs}) to use as base register
28727 for reading the canary, and from what offset from that base register.
28728 The default for those is as specified in the relevant ABI.
28729
28730 @item -mgeneral-regs-only
28731 @opindex mgeneral-regs-only
28732 Generate code that uses only the general-purpose registers. This
28733 prevents the compiler from using floating-point, vector, mask and bound
28734 registers.
28735
28736 @item -mindirect-branch=@var{choice}
28737 @opindex mindirect-branch
28738 Convert indirect call and jump with @var{choice}. The default is
28739 @samp{keep}, which keeps indirect call and jump unmodified.
28740 @samp{thunk} converts indirect call and jump to call and return thunk.
28741 @samp{thunk-inline} converts indirect call and jump to inlined call
28742 and return thunk. @samp{thunk-extern} converts indirect call and jump
28743 to external call and return thunk provided in a separate object file.
28744 You can control this behavior for a specific function by using the
28745 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28746
28747 Note that @option{-mcmodel=large} is incompatible with
28748 @option{-mindirect-branch=thunk} and
28749 @option{-mindirect-branch=thunk-extern} since the thunk function may
28750 not be reachable in the large code model.
28751
28752 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28753 @option{-fcf-protection=branch} since the external thunk can not be modified
28754 to disable control-flow check.
28755
28756 @item -mfunction-return=@var{choice}
28757 @opindex mfunction-return
28758 Convert function return with @var{choice}. The default is @samp{keep},
28759 which keeps function return unmodified. @samp{thunk} converts function
28760 return to call and return thunk. @samp{thunk-inline} converts function
28761 return to inlined call and return thunk. @samp{thunk-extern} converts
28762 function return to external call and return thunk provided in a separate
28763 object file. You can control this behavior for a specific function by
28764 using the function attribute @code{function_return}.
28765 @xref{Function Attributes}.
28766
28767 Note that @option{-mcmodel=large} is incompatible with
28768 @option{-mfunction-return=thunk} and
28769 @option{-mfunction-return=thunk-extern} since the thunk function may
28770 not be reachable in the large code model.
28771
28772
28773 @item -mindirect-branch-register
28774 @opindex mindirect-branch-register
28775 Force indirect call and jump via register.
28776
28777 @end table
28778
28779 These @samp{-m} switches are supported in addition to the above
28780 on x86-64 processors in 64-bit environments.
28781
28782 @table @gcctabopt
28783 @item -m32
28784 @itemx -m64
28785 @itemx -mx32
28786 @itemx -m16
28787 @itemx -miamcu
28788 @opindex m32
28789 @opindex m64
28790 @opindex mx32
28791 @opindex m16
28792 @opindex miamcu
28793 Generate code for a 16-bit, 32-bit or 64-bit environment.
28794 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28795 to 32 bits, and
28796 generates code that runs on any i386 system.
28797
28798 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28799 types to 64 bits, and generates code for the x86-64 architecture.
28800 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28801 and @option{-mdynamic-no-pic} options.
28802
28803 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28804 to 32 bits, and
28805 generates code for the x86-64 architecture.
28806
28807 The @option{-m16} option is the same as @option{-m32}, except for that
28808 it outputs the @code{.code16gcc} assembly directive at the beginning of
28809 the assembly output so that the binary can run in 16-bit mode.
28810
28811 The @option{-miamcu} option generates code which conforms to Intel MCU
28812 psABI. It requires the @option{-m32} option to be turned on.
28813
28814 @item -mno-red-zone
28815 @opindex mno-red-zone
28816 @opindex mred-zone
28817 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28818 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28819 stack pointer that is not modified by signal or interrupt handlers
28820 and therefore can be used for temporary data without adjusting the stack
28821 pointer. The flag @option{-mno-red-zone} disables this red zone.
28822
28823 @item -mcmodel=small
28824 @opindex mcmodel=small
28825 Generate code for the small code model: the program and its symbols must
28826 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28827 Programs can be statically or dynamically linked. This is the default
28828 code model.
28829
28830 @item -mcmodel=kernel
28831 @opindex mcmodel=kernel
28832 Generate code for the kernel code model. The kernel runs in the
28833 negative 2 GB of the address space.
28834 This model has to be used for Linux kernel code.
28835
28836 @item -mcmodel=medium
28837 @opindex mcmodel=medium
28838 Generate code for the medium model: the program is linked in the lower 2
28839 GB of the address space. Small symbols are also placed there. Symbols
28840 with sizes larger than @option{-mlarge-data-threshold} are put into
28841 large data or BSS sections and can be located above 2GB. Programs can
28842 be statically or dynamically linked.
28843
28844 @item -mcmodel=large
28845 @opindex mcmodel=large
28846 Generate code for the large model. This model makes no assumptions
28847 about addresses and sizes of sections.
28848
28849 @item -maddress-mode=long
28850 @opindex maddress-mode=long
28851 Generate code for long address mode. This is only supported for 64-bit
28852 and x32 environments. It is the default address mode for 64-bit
28853 environments.
28854
28855 @item -maddress-mode=short
28856 @opindex maddress-mode=short
28857 Generate code for short address mode. This is only supported for 32-bit
28858 and x32 environments. It is the default address mode for 32-bit and
28859 x32 environments.
28860 @end table
28861
28862 @node x86 Windows Options
28863 @subsection x86 Windows Options
28864 @cindex x86 Windows Options
28865 @cindex Windows Options for x86
28866
28867 These additional options are available for Microsoft Windows targets:
28868
28869 @table @gcctabopt
28870 @item -mconsole
28871 @opindex mconsole
28872 This option
28873 specifies that a console application is to be generated, by
28874 instructing the linker to set the PE header subsystem type
28875 required for console applications.
28876 This option is available for Cygwin and MinGW targets and is
28877 enabled by default on those targets.
28878
28879 @item -mdll
28880 @opindex mdll
28881 This option is available for Cygwin and MinGW targets. It
28882 specifies that a DLL---a dynamic link library---is to be
28883 generated, enabling the selection of the required runtime
28884 startup object and entry point.
28885
28886 @item -mnop-fun-dllimport
28887 @opindex mnop-fun-dllimport
28888 This option is available for Cygwin and MinGW targets. It
28889 specifies that the @code{dllimport} attribute should be ignored.
28890
28891 @item -mthread
28892 @opindex mthread
28893 This option is available for MinGW targets. It specifies
28894 that MinGW-specific thread support is to be used.
28895
28896 @item -municode
28897 @opindex municode
28898 This option is available for MinGW-w64 targets. It causes
28899 the @code{UNICODE} preprocessor macro to be predefined, and
28900 chooses Unicode-capable runtime startup code.
28901
28902 @item -mwin32
28903 @opindex mwin32
28904 This option is available for Cygwin and MinGW targets. It
28905 specifies that the typical Microsoft Windows predefined macros are to
28906 be set in the pre-processor, but does not influence the choice
28907 of runtime library/startup code.
28908
28909 @item -mwindows
28910 @opindex mwindows
28911 This option is available for Cygwin and MinGW targets. It
28912 specifies that a GUI application is to be generated by
28913 instructing the linker to set the PE header subsystem type
28914 appropriately.
28915
28916 @item -fno-set-stack-executable
28917 @opindex fno-set-stack-executable
28918 @opindex fset-stack-executable
28919 This option is available for MinGW targets. It specifies that
28920 the executable flag for the stack used by nested functions isn't
28921 set. This is necessary for binaries running in kernel mode of
28922 Microsoft Windows, as there the User32 API, which is used to set executable
28923 privileges, isn't available.
28924
28925 @item -fwritable-relocated-rdata
28926 @opindex fno-writable-relocated-rdata
28927 @opindex fwritable-relocated-rdata
28928 This option is available for MinGW and Cygwin targets. It specifies
28929 that relocated-data in read-only section is put into the @code{.data}
28930 section. This is a necessary for older runtimes not supporting
28931 modification of @code{.rdata} sections for pseudo-relocation.
28932
28933 @item -mpe-aligned-commons
28934 @opindex mpe-aligned-commons
28935 This option is available for Cygwin and MinGW targets. It
28936 specifies that the GNU extension to the PE file format that
28937 permits the correct alignment of COMMON variables should be
28938 used when generating code. It is enabled by default if
28939 GCC detects that the target assembler found during configuration
28940 supports the feature.
28941 @end table
28942
28943 See also under @ref{x86 Options} for standard options.
28944
28945 @node Xstormy16 Options
28946 @subsection Xstormy16 Options
28947 @cindex Xstormy16 Options
28948
28949 These options are defined for Xstormy16:
28950
28951 @table @gcctabopt
28952 @item -msim
28953 @opindex msim
28954 Choose startup files and linker script suitable for the simulator.
28955 @end table
28956
28957 @node Xtensa Options
28958 @subsection Xtensa Options
28959 @cindex Xtensa Options
28960
28961 These options are supported for Xtensa targets:
28962
28963 @table @gcctabopt
28964 @item -mconst16
28965 @itemx -mno-const16
28966 @opindex mconst16
28967 @opindex mno-const16
28968 Enable or disable use of @code{CONST16} instructions for loading
28969 constant values. The @code{CONST16} instruction is currently not a
28970 standard option from Tensilica. When enabled, @code{CONST16}
28971 instructions are always used in place of the standard @code{L32R}
28972 instructions. The use of @code{CONST16} is enabled by default only if
28973 the @code{L32R} instruction is not available.
28974
28975 @item -mfused-madd
28976 @itemx -mno-fused-madd
28977 @opindex mfused-madd
28978 @opindex mno-fused-madd
28979 Enable or disable use of fused multiply/add and multiply/subtract
28980 instructions in the floating-point option. This has no effect if the
28981 floating-point option is not also enabled. Disabling fused multiply/add
28982 and multiply/subtract instructions forces the compiler to use separate
28983 instructions for the multiply and add/subtract operations. This may be
28984 desirable in some cases where strict IEEE 754-compliant results are
28985 required: the fused multiply add/subtract instructions do not round the
28986 intermediate result, thereby producing results with @emph{more} bits of
28987 precision than specified by the IEEE standard. Disabling fused multiply
28988 add/subtract instructions also ensures that the program output is not
28989 sensitive to the compiler's ability to combine multiply and add/subtract
28990 operations.
28991
28992 @item -mserialize-volatile
28993 @itemx -mno-serialize-volatile
28994 @opindex mserialize-volatile
28995 @opindex mno-serialize-volatile
28996 When this option is enabled, GCC inserts @code{MEMW} instructions before
28997 @code{volatile} memory references to guarantee sequential consistency.
28998 The default is @option{-mserialize-volatile}. Use
28999 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29000
29001 @item -mforce-no-pic
29002 @opindex mforce-no-pic
29003 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29004 position-independent code (PIC), this option disables PIC for compiling
29005 kernel code.
29006
29007 @item -mtext-section-literals
29008 @itemx -mno-text-section-literals
29009 @opindex mtext-section-literals
29010 @opindex mno-text-section-literals
29011 These options control the treatment of literal pools. The default is
29012 @option{-mno-text-section-literals}, which places literals in a separate
29013 section in the output file. This allows the literal pool to be placed
29014 in a data RAM/ROM, and it also allows the linker to combine literal
29015 pools from separate object files to remove redundant literals and
29016 improve code size. With @option{-mtext-section-literals}, the literals
29017 are interspersed in the text section in order to keep them as close as
29018 possible to their references. This may be necessary for large assembly
29019 files. Literals for each function are placed right before that function.
29020
29021 @item -mauto-litpools
29022 @itemx -mno-auto-litpools
29023 @opindex mauto-litpools
29024 @opindex mno-auto-litpools
29025 These options control the treatment of literal pools. The default is
29026 @option{-mno-auto-litpools}, which places literals in a separate
29027 section in the output file unless @option{-mtext-section-literals} is
29028 used. With @option{-mauto-litpools} the literals are interspersed in
29029 the text section by the assembler. Compiler does not produce explicit
29030 @code{.literal} directives and loads literals into registers with
29031 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29032 do relaxation and place literals as necessary. This option allows
29033 assembler to create several literal pools per function and assemble
29034 very big functions, which may not be possible with
29035 @option{-mtext-section-literals}.
29036
29037 @item -mtarget-align
29038 @itemx -mno-target-align
29039 @opindex mtarget-align
29040 @opindex mno-target-align
29041 When this option is enabled, GCC instructs the assembler to
29042 automatically align instructions to reduce branch penalties at the
29043 expense of some code density. The assembler attempts to widen density
29044 instructions to align branch targets and the instructions following call
29045 instructions. If there are not enough preceding safe density
29046 instructions to align a target, no widening is performed. The
29047 default is @option{-mtarget-align}. These options do not affect the
29048 treatment of auto-aligned instructions like @code{LOOP}, which the
29049 assembler always aligns, either by widening density instructions or
29050 by inserting NOP instructions.
29051
29052 @item -mlongcalls
29053 @itemx -mno-longcalls
29054 @opindex mlongcalls
29055 @opindex mno-longcalls
29056 When this option is enabled, GCC instructs the assembler to translate
29057 direct calls to indirect calls unless it can determine that the target
29058 of a direct call is in the range allowed by the call instruction. This
29059 translation typically occurs for calls to functions in other source
29060 files. Specifically, the assembler translates a direct @code{CALL}
29061 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29062 The default is @option{-mno-longcalls}. This option should be used in
29063 programs where the call target can potentially be out of range. This
29064 option is implemented in the assembler, not the compiler, so the
29065 assembly code generated by GCC still shows direct call
29066 instructions---look at the disassembled object code to see the actual
29067 instructions. Note that the assembler uses an indirect call for
29068 every cross-file call, not just those that really are out of range.
29069 @end table
29070
29071 @node zSeries Options
29072 @subsection zSeries Options
29073 @cindex zSeries options
29074
29075 These are listed under @xref{S/390 and zSeries Options}.
29076
29077
29078 @c man end
29079
29080 @node Spec Files
29081 @section Specifying Subprocesses and the Switches to Pass to Them
29082 @cindex Spec Files
29083
29084 @command{gcc} is a driver program. It performs its job by invoking a
29085 sequence of other programs to do the work of compiling, assembling and
29086 linking. GCC interprets its command-line parameters and uses these to
29087 deduce which programs it should invoke, and which command-line options
29088 it ought to place on their command lines. This behavior is controlled
29089 by @dfn{spec strings}. In most cases there is one spec string for each
29090 program that GCC can invoke, but a few programs have multiple spec
29091 strings to control their behavior. The spec strings built into GCC can
29092 be overridden by using the @option{-specs=} command-line switch to specify
29093 a spec file.
29094
29095 @dfn{Spec files} are plain-text files that are used to construct spec
29096 strings. They consist of a sequence of directives separated by blank
29097 lines. The type of directive is determined by the first non-whitespace
29098 character on the line, which can be one of the following:
29099
29100 @table @code
29101 @item %@var{command}
29102 Issues a @var{command} to the spec file processor. The commands that can
29103 appear here are:
29104
29105 @table @code
29106 @item %include <@var{file}>
29107 @cindex @code{%include}
29108 Search for @var{file} and insert its text at the current point in the
29109 specs file.
29110
29111 @item %include_noerr <@var{file}>
29112 @cindex @code{%include_noerr}
29113 Just like @samp{%include}, but do not generate an error message if the include
29114 file cannot be found.
29115
29116 @item %rename @var{old_name} @var{new_name}
29117 @cindex @code{%rename}
29118 Rename the spec string @var{old_name} to @var{new_name}.
29119
29120 @end table
29121
29122 @item *[@var{spec_name}]:
29123 This tells the compiler to create, override or delete the named spec
29124 string. All lines after this directive up to the next directive or
29125 blank line are considered to be the text for the spec string. If this
29126 results in an empty string then the spec is deleted. (Or, if the
29127 spec did not exist, then nothing happens.) Otherwise, if the spec
29128 does not currently exist a new spec is created. If the spec does
29129 exist then its contents are overridden by the text of this
29130 directive, unless the first character of that text is the @samp{+}
29131 character, in which case the text is appended to the spec.
29132
29133 @item [@var{suffix}]:
29134 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29135 and up to the next directive or blank line are considered to make up the
29136 spec string for the indicated suffix. When the compiler encounters an
29137 input file with the named suffix, it processes the spec string in
29138 order to work out how to compile that file. For example:
29139
29140 @smallexample
29141 .ZZ:
29142 z-compile -input %i
29143 @end smallexample
29144
29145 This says that any input file whose name ends in @samp{.ZZ} should be
29146 passed to the program @samp{z-compile}, which should be invoked with the
29147 command-line switch @option{-input} and with the result of performing the
29148 @samp{%i} substitution. (See below.)
29149
29150 As an alternative to providing a spec string, the text following a
29151 suffix directive can be one of the following:
29152
29153 @table @code
29154 @item @@@var{language}
29155 This says that the suffix is an alias for a known @var{language}. This is
29156 similar to using the @option{-x} command-line switch to GCC to specify a
29157 language explicitly. For example:
29158
29159 @smallexample
29160 .ZZ:
29161 @@c++
29162 @end smallexample
29163
29164 Says that .ZZ files are, in fact, C++ source files.
29165
29166 @item #@var{name}
29167 This causes an error messages saying:
29168
29169 @smallexample
29170 @var{name} compiler not installed on this system.
29171 @end smallexample
29172 @end table
29173
29174 GCC already has an extensive list of suffixes built into it.
29175 This directive adds an entry to the end of the list of suffixes, but
29176 since the list is searched from the end backwards, it is effectively
29177 possible to override earlier entries using this technique.
29178
29179 @end table
29180
29181 GCC has the following spec strings built into it. Spec files can
29182 override these strings or create their own. Note that individual
29183 targets can also add their own spec strings to this list.
29184
29185 @smallexample
29186 asm Options to pass to the assembler
29187 asm_final Options to pass to the assembler post-processor
29188 cpp Options to pass to the C preprocessor
29189 cc1 Options to pass to the C compiler
29190 cc1plus Options to pass to the C++ compiler
29191 endfile Object files to include at the end of the link
29192 link Options to pass to the linker
29193 lib Libraries to include on the command line to the linker
29194 libgcc Decides which GCC support library to pass to the linker
29195 linker Sets the name of the linker
29196 predefines Defines to be passed to the C preprocessor
29197 signed_char Defines to pass to CPP to say whether @code{char} is signed
29198 by default
29199 startfile Object files to include at the start of the link
29200 @end smallexample
29201
29202 Here is a small example of a spec file:
29203
29204 @smallexample
29205 %rename lib old_lib
29206
29207 *lib:
29208 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29209 @end smallexample
29210
29211 This example renames the spec called @samp{lib} to @samp{old_lib} and
29212 then overrides the previous definition of @samp{lib} with a new one.
29213 The new definition adds in some extra command-line options before
29214 including the text of the old definition.
29215
29216 @dfn{Spec strings} are a list of command-line options to be passed to their
29217 corresponding program. In addition, the spec strings can contain
29218 @samp{%}-prefixed sequences to substitute variable text or to
29219 conditionally insert text into the command line. Using these constructs
29220 it is possible to generate quite complex command lines.
29221
29222 Here is a table of all defined @samp{%}-sequences for spec
29223 strings. Note that spaces are not generated automatically around the
29224 results of expanding these sequences. Therefore you can concatenate them
29225 together or combine them with constant text in a single argument.
29226
29227 @table @code
29228 @item %%
29229 Substitute one @samp{%} into the program name or argument.
29230
29231 @item %i
29232 Substitute the name of the input file being processed.
29233
29234 @item %b
29235 Substitute the basename of the input file being processed.
29236 This is the substring up to (and not including) the last period
29237 and not including the directory.
29238
29239 @item %B
29240 This is the same as @samp{%b}, but include the file suffix (text after
29241 the last period).
29242
29243 @item %d
29244 Marks the argument containing or following the @samp{%d} as a
29245 temporary file name, so that that file is deleted if GCC exits
29246 successfully. Unlike @samp{%g}, this contributes no text to the
29247 argument.
29248
29249 @item %g@var{suffix}
29250 Substitute a file name that has suffix @var{suffix} and is chosen
29251 once per compilation, and mark the argument in the same way as
29252 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29253 name is now chosen in a way that is hard to predict even when previously
29254 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29255 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29256 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29257 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29258 was simply substituted with a file name chosen once per compilation,
29259 without regard to any appended suffix (which was therefore treated
29260 just like ordinary text), making such attacks more likely to succeed.
29261
29262 @item %u@var{suffix}
29263 Like @samp{%g}, but generates a new temporary file name
29264 each time it appears instead of once per compilation.
29265
29266 @item %U@var{suffix}
29267 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29268 new one if there is no such last file name. In the absence of any
29269 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29270 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29271 involves the generation of two distinct file names, one
29272 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29273 simply substituted with a file name chosen for the previous @samp{%u},
29274 without regard to any appended suffix.
29275
29276 @item %j@var{suffix}
29277 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29278 writable, and if @option{-save-temps} is not used;
29279 otherwise, substitute the name
29280 of a temporary file, just like @samp{%u}. This temporary file is not
29281 meant for communication between processes, but rather as a junk
29282 disposal mechanism.
29283
29284 @item %|@var{suffix}
29285 @itemx %m@var{suffix}
29286 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29287 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29288 all. These are the two most common ways to instruct a program that it
29289 should read from standard input or write to standard output. If you
29290 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29291 construct: see for example @file{f/lang-specs.h}.
29292
29293 @item %.@var{SUFFIX}
29294 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29295 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29296 terminated by the next space or %.
29297
29298 @item %w
29299 Marks the argument containing or following the @samp{%w} as the
29300 designated output file of this compilation. This puts the argument
29301 into the sequence of arguments that @samp{%o} substitutes.
29302
29303 @item %o
29304 Substitutes the names of all the output files, with spaces
29305 automatically placed around them. You should write spaces
29306 around the @samp{%o} as well or the results are undefined.
29307 @samp{%o} is for use in the specs for running the linker.
29308 Input files whose names have no recognized suffix are not compiled
29309 at all, but they are included among the output files, so they are
29310 linked.
29311
29312 @item %O
29313 Substitutes the suffix for object files. Note that this is
29314 handled specially when it immediately follows @samp{%g, %u, or %U},
29315 because of the need for those to form complete file names. The
29316 handling is such that @samp{%O} is treated exactly as if it had already
29317 been substituted, except that @samp{%g, %u, and %U} do not currently
29318 support additional @var{suffix} characters following @samp{%O} as they do
29319 following, for example, @samp{.o}.
29320
29321 @item %p
29322 Substitutes the standard macro predefinitions for the
29323 current target machine. Use this when running @command{cpp}.
29324
29325 @item %P
29326 Like @samp{%p}, but puts @samp{__} before and after the name of each
29327 predefined macro, except for macros that start with @samp{__} or with
29328 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29329 C@.
29330
29331 @item %I
29332 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29333 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29334 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29335 and @option{-imultilib} as necessary.
29336
29337 @item %s
29338 Current argument is the name of a library or startup file of some sort.
29339 Search for that file in a standard list of directories and substitute
29340 the full name found. The current working directory is included in the
29341 list of directories scanned.
29342
29343 @item %T
29344 Current argument is the name of a linker script. Search for that file
29345 in the current list of directories to scan for libraries. If the file
29346 is located insert a @option{--script} option into the command line
29347 followed by the full path name found. If the file is not found then
29348 generate an error message. Note: the current working directory is not
29349 searched.
29350
29351 @item %e@var{str}
29352 Print @var{str} as an error message. @var{str} is terminated by a newline.
29353 Use this when inconsistent options are detected.
29354
29355 @item %(@var{name})
29356 Substitute the contents of spec string @var{name} at this point.
29357
29358 @item %x@{@var{option}@}
29359 Accumulate an option for @samp{%X}.
29360
29361 @item %X
29362 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29363 spec string.
29364
29365 @item %Y
29366 Output the accumulated assembler options specified by @option{-Wa}.
29367
29368 @item %Z
29369 Output the accumulated preprocessor options specified by @option{-Wp}.
29370
29371 @item %a
29372 Process the @code{asm} spec. This is used to compute the
29373 switches to be passed to the assembler.
29374
29375 @item %A
29376 Process the @code{asm_final} spec. This is a spec string for
29377 passing switches to an assembler post-processor, if such a program is
29378 needed.
29379
29380 @item %l
29381 Process the @code{link} spec. This is the spec for computing the
29382 command line passed to the linker. Typically it makes use of the
29383 @samp{%L %G %S %D and %E} sequences.
29384
29385 @item %D
29386 Dump out a @option{-L} option for each directory that GCC believes might
29387 contain startup files. If the target supports multilibs then the
29388 current multilib directory is prepended to each of these paths.
29389
29390 @item %L
29391 Process the @code{lib} spec. This is a spec string for deciding which
29392 libraries are included on the command line to the linker.
29393
29394 @item %G
29395 Process the @code{libgcc} spec. This is a spec string for deciding
29396 which GCC support library is included on the command line to the linker.
29397
29398 @item %S
29399 Process the @code{startfile} spec. This is a spec for deciding which
29400 object files are the first ones passed to the linker. Typically
29401 this might be a file named @file{crt0.o}.
29402
29403 @item %E
29404 Process the @code{endfile} spec. This is a spec string that specifies
29405 the last object files that are passed to the linker.
29406
29407 @item %C
29408 Process the @code{cpp} spec. This is used to construct the arguments
29409 to be passed to the C preprocessor.
29410
29411 @item %1
29412 Process the @code{cc1} spec. This is used to construct the options to be
29413 passed to the actual C compiler (@command{cc1}).
29414
29415 @item %2
29416 Process the @code{cc1plus} spec. This is used to construct the options to be
29417 passed to the actual C++ compiler (@command{cc1plus}).
29418
29419 @item %*
29420 Substitute the variable part of a matched option. See below.
29421 Note that each comma in the substituted string is replaced by
29422 a single space.
29423
29424 @item %<S
29425 Remove all occurrences of @code{-S} from the command line. Note---this
29426 command is position dependent. @samp{%} commands in the spec string
29427 before this one see @code{-S}, @samp{%} commands in the spec string
29428 after this one do not.
29429
29430 @item %:@var{function}(@var{args})
29431 Call the named function @var{function}, passing it @var{args}.
29432 @var{args} is first processed as a nested spec string, then split
29433 into an argument vector in the usual fashion. The function returns
29434 a string which is processed as if it had appeared literally as part
29435 of the current spec.
29436
29437 The following built-in spec functions are provided:
29438
29439 @table @code
29440 @item @code{getenv}
29441 The @code{getenv} spec function takes two arguments: an environment
29442 variable name and a string. If the environment variable is not
29443 defined, a fatal error is issued. Otherwise, the return value is the
29444 value of the environment variable concatenated with the string. For
29445 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29446
29447 @smallexample
29448 %:getenv(TOPDIR /include)
29449 @end smallexample
29450
29451 expands to @file{/path/to/top/include}.
29452
29453 @item @code{if-exists}
29454 The @code{if-exists} spec function takes one argument, an absolute
29455 pathname to a file. If the file exists, @code{if-exists} returns the
29456 pathname. Here is a small example of its usage:
29457
29458 @smallexample
29459 *startfile:
29460 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29461 @end smallexample
29462
29463 @item @code{if-exists-else}
29464 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29465 spec function, except that it takes two arguments. The first argument is
29466 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29467 returns the pathname. If it does not exist, it returns the second argument.
29468 This way, @code{if-exists-else} can be used to select one file or another,
29469 based on the existence of the first. Here is a small example of its usage:
29470
29471 @smallexample
29472 *startfile:
29473 crt0%O%s %:if-exists(crti%O%s) \
29474 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29475 @end smallexample
29476
29477 @item @code{replace-outfile}
29478 The @code{replace-outfile} spec function takes two arguments. It looks for the
29479 first argument in the outfiles array and replaces it with the second argument. Here
29480 is a small example of its usage:
29481
29482 @smallexample
29483 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29484 @end smallexample
29485
29486 @item @code{remove-outfile}
29487 The @code{remove-outfile} spec function takes one argument. It looks for the
29488 first argument in the outfiles array and removes it. Here is a small example
29489 its usage:
29490
29491 @smallexample
29492 %:remove-outfile(-lm)
29493 @end smallexample
29494
29495 @item @code{pass-through-libs}
29496 The @code{pass-through-libs} spec function takes any number of arguments. It
29497 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29498 assumes are the names of linker input library archive files) and returns a
29499 result containing all the found arguments each prepended by
29500 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29501 intended to be passed to the LTO linker plugin.
29502
29503 @smallexample
29504 %:pass-through-libs(%G %L %G)
29505 @end smallexample
29506
29507 @item @code{print-asm-header}
29508 The @code{print-asm-header} function takes no arguments and simply
29509 prints a banner like:
29510
29511 @smallexample
29512 Assembler options
29513 =================
29514
29515 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29516 @end smallexample
29517
29518 It is used to separate compiler options from assembler options
29519 in the @option{--target-help} output.
29520 @end table
29521
29522 @item %@{S@}
29523 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29524 If that switch is not specified, this substitutes nothing. Note that
29525 the leading dash is omitted when specifying this option, and it is
29526 automatically inserted if the substitution is performed. Thus the spec
29527 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29528 and outputs the command-line option @option{-foo}.
29529
29530 @item %W@{S@}
29531 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29532 deleted on failure.
29533
29534 @item %@{S*@}
29535 Substitutes all the switches specified to GCC whose names start
29536 with @code{-S}, but which also take an argument. This is used for
29537 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29538 GCC considers @option{-o foo} as being
29539 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29540 text, including the space. Thus two arguments are generated.
29541
29542 @item %@{S*&T*@}
29543 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29544 (the order of @code{S} and @code{T} in the spec is not significant).
29545 There can be any number of ampersand-separated variables; for each the
29546 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29547
29548 @item %@{S:X@}
29549 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29550
29551 @item %@{!S:X@}
29552 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29553
29554 @item %@{S*:X@}
29555 Substitutes @code{X} if one or more switches whose names start with
29556 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29557 once, no matter how many such switches appeared. However, if @code{%*}
29558 appears somewhere in @code{X}, then @code{X} is substituted once
29559 for each matching switch, with the @code{%*} replaced by the part of
29560 that switch matching the @code{*}.
29561
29562 If @code{%*} appears as the last part of a spec sequence then a space
29563 is added after the end of the last substitution. If there is more
29564 text in the sequence, however, then a space is not generated. This
29565 allows the @code{%*} substitution to be used as part of a larger
29566 string. For example, a spec string like this:
29567
29568 @smallexample
29569 %@{mcu=*:--script=%*/memory.ld@}
29570 @end smallexample
29571
29572 @noindent
29573 when matching an option like @option{-mcu=newchip} produces:
29574
29575 @smallexample
29576 --script=newchip/memory.ld
29577 @end smallexample
29578
29579 @item %@{.S:X@}
29580 Substitutes @code{X}, if processing a file with suffix @code{S}.
29581
29582 @item %@{!.S:X@}
29583 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29584
29585 @item %@{,S:X@}
29586 Substitutes @code{X}, if processing a file for language @code{S}.
29587
29588 @item %@{!,S:X@}
29589 Substitutes @code{X}, if not processing a file for language @code{S}.
29590
29591 @item %@{S|P:X@}
29592 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29593 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29594 @code{*} sequences as well, although they have a stronger binding than
29595 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29596 alternatives must be starred, and only the first matching alternative
29597 is substituted.
29598
29599 For example, a spec string like this:
29600
29601 @smallexample
29602 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29603 @end smallexample
29604
29605 @noindent
29606 outputs the following command-line options from the following input
29607 command-line options:
29608
29609 @smallexample
29610 fred.c -foo -baz
29611 jim.d -bar -boggle
29612 -d fred.c -foo -baz -boggle
29613 -d jim.d -bar -baz -boggle
29614 @end smallexample
29615
29616 @item %@{S:X; T:Y; :D@}
29617
29618 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29619 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29620 be as many clauses as you need. This may be combined with @code{.},
29621 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29622
29623
29624 @end table
29625
29626 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29627 or similar construct can use a backslash to ignore the special meaning
29628 of the character following it, thus allowing literal matching of a
29629 character that is otherwise specially treated. For example,
29630 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29631 @option{-std=iso9899:1999} option is given.
29632
29633 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29634 construct may contain other nested @samp{%} constructs or spaces, or
29635 even newlines. They are processed as usual, as described above.
29636 Trailing white space in @code{X} is ignored. White space may also
29637 appear anywhere on the left side of the colon in these constructs,
29638 except between @code{.} or @code{*} and the corresponding word.
29639
29640 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29641 handled specifically in these constructs. If another value of
29642 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29643 @option{-W} switch is found later in the command line, the earlier
29644 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29645 just one letter, which passes all matching options.
29646
29647 The character @samp{|} at the beginning of the predicate text is used to
29648 indicate that a command should be piped to the following command, but
29649 only if @option{-pipe} is specified.
29650
29651 It is built into GCC which switches take arguments and which do not.
29652 (You might think it would be useful to generalize this to allow each
29653 compiler's spec to say which switches take arguments. But this cannot
29654 be done in a consistent fashion. GCC cannot even decide which input
29655 files have been specified without knowing which switches take arguments,
29656 and it must know which input files to compile in order to tell which
29657 compilers to run).
29658
29659 GCC also knows implicitly that arguments starting in @option{-l} are to be
29660 treated as compiler output files, and passed to the linker in their
29661 proper position among the other output files.
29662
29663 @node Environment Variables
29664 @section Environment Variables Affecting GCC
29665 @cindex environment variables
29666
29667 @c man begin ENVIRONMENT
29668 This section describes several environment variables that affect how GCC
29669 operates. Some of them work by specifying directories or prefixes to use
29670 when searching for various kinds of files. Some are used to specify other
29671 aspects of the compilation environment.
29672
29673 Note that you can also specify places to search using options such as
29674 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29675 take precedence over places specified using environment variables, which
29676 in turn take precedence over those specified by the configuration of GCC@.
29677 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29678 GNU Compiler Collection (GCC) Internals}.
29679
29680 @table @env
29681 @item LANG
29682 @itemx LC_CTYPE
29683 @c @itemx LC_COLLATE
29684 @itemx LC_MESSAGES
29685 @c @itemx LC_MONETARY
29686 @c @itemx LC_NUMERIC
29687 @c @itemx LC_TIME
29688 @itemx LC_ALL
29689 @findex LANG
29690 @findex LC_CTYPE
29691 @c @findex LC_COLLATE
29692 @findex LC_MESSAGES
29693 @c @findex LC_MONETARY
29694 @c @findex LC_NUMERIC
29695 @c @findex LC_TIME
29696 @findex LC_ALL
29697 @cindex locale
29698 These environment variables control the way that GCC uses
29699 localization information which allows GCC to work with different
29700 national conventions. GCC inspects the locale categories
29701 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29702 so. These locale categories can be set to any value supported by your
29703 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29704 Kingdom encoded in UTF-8.
29705
29706 The @env{LC_CTYPE} environment variable specifies character
29707 classification. GCC uses it to determine the character boundaries in
29708 a string; this is needed for some multibyte encodings that contain quote
29709 and escape characters that are otherwise interpreted as a string
29710 end or escape.
29711
29712 The @env{LC_MESSAGES} environment variable specifies the language to
29713 use in diagnostic messages.
29714
29715 If the @env{LC_ALL} environment variable is set, it overrides the value
29716 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29717 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29718 environment variable. If none of these variables are set, GCC
29719 defaults to traditional C English behavior.
29720
29721 @item TMPDIR
29722 @findex TMPDIR
29723 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29724 files. GCC uses temporary files to hold the output of one stage of
29725 compilation which is to be used as input to the next stage: for example,
29726 the output of the preprocessor, which is the input to the compiler
29727 proper.
29728
29729 @item GCC_COMPARE_DEBUG
29730 @findex GCC_COMPARE_DEBUG
29731 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29732 @option{-fcompare-debug} to the compiler driver. See the documentation
29733 of this option for more details.
29734
29735 @item GCC_EXEC_PREFIX
29736 @findex GCC_EXEC_PREFIX
29737 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29738 names of the subprograms executed by the compiler. No slash is added
29739 when this prefix is combined with the name of a subprogram, but you can
29740 specify a prefix that ends with a slash if you wish.
29741
29742 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29743 an appropriate prefix to use based on the pathname it is invoked with.
29744
29745 If GCC cannot find the subprogram using the specified prefix, it
29746 tries looking in the usual places for the subprogram.
29747
29748 The default value of @env{GCC_EXEC_PREFIX} is
29749 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29750 the installed compiler. In many cases @var{prefix} is the value
29751 of @code{prefix} when you ran the @file{configure} script.
29752
29753 Other prefixes specified with @option{-B} take precedence over this prefix.
29754
29755 This prefix is also used for finding files such as @file{crt0.o} that are
29756 used for linking.
29757
29758 In addition, the prefix is used in an unusual way in finding the
29759 directories to search for header files. For each of the standard
29760 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29761 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29762 replacing that beginning with the specified prefix to produce an
29763 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29764 @file{foo/bar} just before it searches the standard directory
29765 @file{/usr/local/lib/bar}.
29766 If a standard directory begins with the configured
29767 @var{prefix} then the value of @var{prefix} is replaced by
29768 @env{GCC_EXEC_PREFIX} when looking for header files.
29769
29770 @item COMPILER_PATH
29771 @findex COMPILER_PATH
29772 The value of @env{COMPILER_PATH} is a colon-separated list of
29773 directories, much like @env{PATH}. GCC tries the directories thus
29774 specified when searching for subprograms, if it cannot find the
29775 subprograms using @env{GCC_EXEC_PREFIX}.
29776
29777 @item LIBRARY_PATH
29778 @findex LIBRARY_PATH
29779 The value of @env{LIBRARY_PATH} is a colon-separated list of
29780 directories, much like @env{PATH}. When configured as a native compiler,
29781 GCC tries the directories thus specified when searching for special
29782 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29783 using GCC also uses these directories when searching for ordinary
29784 libraries for the @option{-l} option (but directories specified with
29785 @option{-L} come first).
29786
29787 @item LANG
29788 @findex LANG
29789 @cindex locale definition
29790 This variable is used to pass locale information to the compiler. One way in
29791 which this information is used is to determine the character set to be used
29792 when character literals, string literals and comments are parsed in C and C++.
29793 When the compiler is configured to allow multibyte characters,
29794 the following values for @env{LANG} are recognized:
29795
29796 @table @samp
29797 @item C-JIS
29798 Recognize JIS characters.
29799 @item C-SJIS
29800 Recognize SJIS characters.
29801 @item C-EUCJP
29802 Recognize EUCJP characters.
29803 @end table
29804
29805 If @env{LANG} is not defined, or if it has some other value, then the
29806 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29807 recognize and translate multibyte characters.
29808 @end table
29809
29810 @noindent
29811 Some additional environment variables affect the behavior of the
29812 preprocessor.
29813
29814 @include cppenv.texi
29815
29816 @c man end
29817
29818 @node Precompiled Headers
29819 @section Using Precompiled Headers
29820 @cindex precompiled headers
29821 @cindex speed of compilation
29822
29823 Often large projects have many header files that are included in every
29824 source file. The time the compiler takes to process these header files
29825 over and over again can account for nearly all of the time required to
29826 build the project. To make builds faster, GCC allows you to
29827 @dfn{precompile} a header file.
29828
29829 To create a precompiled header file, simply compile it as you would any
29830 other file, if necessary using the @option{-x} option to make the driver
29831 treat it as a C or C++ header file. You may want to use a
29832 tool like @command{make} to keep the precompiled header up-to-date when
29833 the headers it contains change.
29834
29835 A precompiled header file is searched for when @code{#include} is
29836 seen in the compilation. As it searches for the included file
29837 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29838 compiler looks for a precompiled header in each directory just before it
29839 looks for the include file in that directory. The name searched for is
29840 the name specified in the @code{#include} with @samp{.gch} appended. If
29841 the precompiled header file cannot be used, it is ignored.
29842
29843 For instance, if you have @code{#include "all.h"}, and you have
29844 @file{all.h.gch} in the same directory as @file{all.h}, then the
29845 precompiled header file is used if possible, and the original
29846 header is used otherwise.
29847
29848 Alternatively, you might decide to put the precompiled header file in a
29849 directory and use @option{-I} to ensure that directory is searched
29850 before (or instead of) the directory containing the original header.
29851 Then, if you want to check that the precompiled header file is always
29852 used, you can put a file of the same name as the original header in this
29853 directory containing an @code{#error} command.
29854
29855 This also works with @option{-include}. So yet another way to use
29856 precompiled headers, good for projects not designed with precompiled
29857 header files in mind, is to simply take most of the header files used by
29858 a project, include them from another header file, precompile that header
29859 file, and @option{-include} the precompiled header. If the header files
29860 have guards against multiple inclusion, they are skipped because
29861 they've already been included (in the precompiled header).
29862
29863 If you need to precompile the same header file for different
29864 languages, targets, or compiler options, you can instead make a
29865 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29866 header in the directory, perhaps using @option{-o}. It doesn't matter
29867 what you call the files in the directory; every precompiled header in
29868 the directory is considered. The first precompiled header
29869 encountered in the directory that is valid for this compilation is
29870 used; they're searched in no particular order.
29871
29872 There are many other possibilities, limited only by your imagination,
29873 good sense, and the constraints of your build system.
29874
29875 A precompiled header file can be used only when these conditions apply:
29876
29877 @itemize
29878 @item
29879 Only one precompiled header can be used in a particular compilation.
29880
29881 @item
29882 A precompiled header cannot be used once the first C token is seen. You
29883 can have preprocessor directives before a precompiled header; you cannot
29884 include a precompiled header from inside another header.
29885
29886 @item
29887 The precompiled header file must be produced for the same language as
29888 the current compilation. You cannot use a C precompiled header for a C++
29889 compilation.
29890
29891 @item
29892 The precompiled header file must have been produced by the same compiler
29893 binary as the current compilation is using.
29894
29895 @item
29896 Any macros defined before the precompiled header is included must
29897 either be defined in the same way as when the precompiled header was
29898 generated, or must not affect the precompiled header, which usually
29899 means that they don't appear in the precompiled header at all.
29900
29901 The @option{-D} option is one way to define a macro before a
29902 precompiled header is included; using a @code{#define} can also do it.
29903 There are also some options that define macros implicitly, like
29904 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29905 defined this way.
29906
29907 @item If debugging information is output when using the precompiled
29908 header, using @option{-g} or similar, the same kind of debugging information
29909 must have been output when building the precompiled header. However,
29910 a precompiled header built using @option{-g} can be used in a compilation
29911 when no debugging information is being output.
29912
29913 @item The same @option{-m} options must generally be used when building
29914 and using the precompiled header. @xref{Submodel Options},
29915 for any cases where this rule is relaxed.
29916
29917 @item Each of the following options must be the same when building and using
29918 the precompiled header:
29919
29920 @gccoptlist{-fexceptions}
29921
29922 @item
29923 Some other command-line options starting with @option{-f},
29924 @option{-p}, or @option{-O} must be defined in the same way as when
29925 the precompiled header was generated. At present, it's not clear
29926 which options are safe to change and which are not; the safest choice
29927 is to use exactly the same options when generating and using the
29928 precompiled header. The following are known to be safe:
29929
29930 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29931 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29932 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29933 -pedantic-errors}
29934
29935 @end itemize
29936
29937 For all of these except the last, the compiler automatically
29938 ignores the precompiled header if the conditions aren't met. If you
29939 find an option combination that doesn't work and doesn't cause the
29940 precompiled header to be ignored, please consider filing a bug report,
29941 see @ref{Bugs}.
29942
29943 If you do use differing options when generating and using the
29944 precompiled header, the actual behavior is a mixture of the
29945 behavior for the options. For instance, if you use @option{-g} to
29946 generate the precompiled header but not when using it, you may or may
29947 not get debugging information for routines in the precompiled header.